diff --git a/composer.json b/composer.json index b08baffa1eb8fa581e91d2154ec339edf1f159ec..c5412d55e6e2237f11222964442a9c74773a758b 100644 --- a/composer.json +++ b/composer.json @@ -106,7 +106,7 @@ "drupal/config_update": "^1.5", "drupal/console": "^1", "drupal/content_access": "1.0-alpha1", - "drupal/core": "8.6.10", + "drupal/core": "8.6.13", "drupal/crop": "2.0-rc1", "drupal/ctools": "3.0", "drupal/ctools_views": "3.0", @@ -185,8 +185,7 @@ "gdsmith/jquery.easing": "1.4.1", "oomphinc/composer-installers-extender": "^1.1", "pantheon-systems/quicksilver-pushback": "~1", - "rvtraveller/qs-composer-installer": "^1.1", - "webflo/drupal-core-strict": "^8" + "rvtraveller/qs-composer-installer": "^1.1" }, "require-dev": { }, diff --git a/composer.lock b/composer.lock index e94732d571c98918d00a0931c3471fb43b956c9c..585acf0c4a0ff280c4bd1666fafd96b0e73960b4 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": "043b2baf91d691df11a754750ab786a0", + "content-hash": "426e6f0320bdc4396c4421c039673f87", "packages": [ { "name": "alchemy/zippy", @@ -374,16 +374,16 @@ }, { "name": "composer/semver", - "version": "1.4.2", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e", + "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e", "shasum": "" }, "require": { @@ -432,7 +432,7 @@ "validation", "versioning" ], - "time": "2016-08-30T16:08:34+00:00" + "time": "2019-03-19T17:25:45+00:00" }, { "name": "consolidation/annotated-command", @@ -832,35 +832,35 @@ }, { "name": "doctrine/annotations", - "version": "v1.2.7", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", - "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": ">=5.3.2" + "php": "^5.6 || ^7.0" }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "^5.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\Annotations\\": "lib/" + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" } }, "notification-url": "https://packagist.org/downloads/", @@ -896,20 +896,20 @@ "docblock", "parser" ], - "time": "2015-08-31T12:32:49+00:00" + "time": "2017-02-24T16:22:25+00:00" }, { "name": "doctrine/cache", - "version": "v1.6.1", + "version": "v1.6.2", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3" + "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/b6f544a20f4807e81f7044d31e679ccbb1866dc3", - "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3", + "url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b", + "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b", "shasum": "" }, "require": { @@ -966,32 +966,33 @@ "cache", "caching" ], - "time": "2016-10-29T11:16:17+00:00" + "time": "2017-07-22T12:49:21+00:00" }, { "name": "doctrine/collections", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", - "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba", + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "doctrine/coding-standard": "~0.1@dev", + "phpunit/phpunit": "^5.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -1032,20 +1033,20 @@ "collections", "iterator" ], - "time": "2015-04-14T22:21:58+00:00" + "time": "2017-01-03T10:49:41+00:00" }, { "name": "doctrine/common", - "version": "v2.6.2", + "version": "v2.7.3", "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3" + "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/7bce00698899aa2c06fe7365c76e4d78ddb15fa3", - "reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3", + "url": "https://api.github.com/repos/doctrine/common/zipball/4acb8f89626baafede6ee5475bc5844096eba8a9", + "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9", "shasum": "" }, "require": { @@ -1054,10 +1055,10 @@ "doctrine/collections": "1.*", "doctrine/inflector": "1.*", "doctrine/lexer": "1.*", - "php": "~5.5|~7.0" + "php": "~5.6|~7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8|~5.0" + "phpunit/phpunit": "^5.4.6" }, "type": "library", "extra": { @@ -1105,37 +1106,37 @@ "persistence", "spl" ], - "time": "2016-11-30T16:50:46+00:00" + "time": "2017-07-22T08:35:12+00:00" }, { "name": "doctrine/inflector", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" + "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", - "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462", + "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "^6.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\Inflector\\": "lib/" + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } }, "notification-url": "https://packagist.org/downloads/", @@ -1172,7 +1173,7 @@ "singularize", "string" ], - "time": "2015-11-06T14:35:42+00:00" + "time": "2017-07-22T12:18:28+00:00" }, { "name": "doctrine/lexer", @@ -2553,16 +2554,16 @@ }, { "name": "drupal/core", - "version": "8.6.10", + "version": "8.6.13", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "59568ac02948cf075ee8543e6c6d4386ad8daec1" + "reference": "8d5b80030ac3f13df2d66aeef0ea388fd9a90632" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/59568ac02948cf075ee8543e6c6d4386ad8daec1", - "reference": "59568ac02948cf075ee8543e6c6d4386ad8daec1", + "url": "https://api.github.com/repos/drupal/core/zipball/8d5b80030ac3f13df2d66aeef0ea388fd9a90632", + "reference": "8d5b80030ac3f13df2d66aeef0ea388fd9a90632", "shasum": "" }, "require": { @@ -2605,7 +2606,7 @@ "symfony/translation": "~3.4.0", "symfony/validator": "~3.4.0", "symfony/yaml": "~3.4.5", - "twig/twig": "^1.35.0", + "twig/twig": "^1.38.2", "typo3/phar-stream-wrapper": "^2.0.1", "zendframework/zend-diactoros": "^1.1", "zendframework/zend-feed": "^2.4" @@ -2791,7 +2792,7 @@ "GPL-2.0-or-later" ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", - "time": "2019-02-20T18:35:01+00:00" + "time": "2019-03-20T06:01:19+00:00" }, { "name": "drupal/crop", @@ -7442,16 +7443,16 @@ }, { "name": "egulias/email-validator", - "version": "1.2.14", + "version": "1.2.15", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "5642614492f0ca2064c01d60cc33284cc2f731a9" + "reference": "758a77525bdaabd6c0f5669176bd4361cb2dda9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/5642614492f0ca2064c01d60cc33284cc2f731a9", - "reference": "5642614492f0ca2064c01d60cc33284cc2f731a9", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/758a77525bdaabd6c0f5669176bd4361cb2dda9e", + "reference": "758a77525bdaabd6c0f5669176bd4361cb2dda9e", "shasum": "" }, "require": { @@ -7490,7 +7491,7 @@ "validation", "validator" ], - "time": "2017-02-03T22:48:59+00:00" + "time": "2018-09-25T20:59:41+00:00" }, { "name": "enyo/dropzone", @@ -7661,16 +7662,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.3.0", + "version": "6.3.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", "shasum": "" }, "require": { @@ -7680,7 +7681,7 @@ }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0 || ^5.0", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", "psr/log": "^1.0" }, "suggest": { @@ -7689,7 +7690,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.2-dev" + "dev-master": "6.3-dev" } }, "autoload": { @@ -7722,7 +7723,7 @@ "rest", "web service" ], - "time": "2017-06-22T18:50:49+00:00" + "time": "2018-04-22T15:46:56+00:00" }, { "name": "guzzlehttp/promises", @@ -7777,32 +7778,33 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.4.2", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + "reference": "9f83dded91781a01c63574e387eaa769be769115" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115", + "reference": "9f83dded91781a01c63574e387eaa769be769115", "shasum": "" }, "require": { "php": ">=5.4.0", - "psr/http-message": "~1.0" + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5" }, "provide": { "psr/http-message-implementation": "1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } }, "autoload": { @@ -7832,13 +7834,14 @@ "keywords": [ "http", "message", + "psr-7", "request", "response", "stream", "uri", "url" ], - "time": "2017-03-20T17:10:46+00:00" + "time": "2018-12-04T20:46:45+00:00" }, { "name": "j7mbo/twitter-api-php", @@ -8023,31 +8026,33 @@ }, { "name": "masterminds/html5", - "version": "2.3.0", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/Masterminds/html5-php.git", - "reference": "2c37c6c520b995b761674de3be8455a381679067" + "reference": "c961ca6a0a81dc6b55b6859b3f9ea7f402edf9ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/2c37c6c520b995b761674de3be8455a381679067", - "reference": "2c37c6c520b995b761674de3be8455a381679067", + "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/c961ca6a0a81dc6b55b6859b3f9ea7f402edf9ad", + "reference": "c961ca6a0a81dc6b55b6859b3f9ea7f402edf9ad", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-dom": "*", "ext-libxml": "*", "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "4.*", + "phpunit/phpunit": "^4.8.35", "sami/sami": "~2.0", "satooshi/php-coveralls": "1.0.*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -8084,7 +8089,7 @@ "serializer", "xml" ], - "time": "2017-09-04T12:26:28+00:00" + "time": "2019-03-10T11:41:28+00:00" }, { "name": "mehrpadin/superfish", @@ -8238,16 +8243,16 @@ }, { "name": "paragonie/random_compat", - "version": "v2.0.11", + "version": "v2.0.18", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", + "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", "shasum": "" }, "require": { @@ -8279,10 +8284,11 @@ "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", "keywords": [ "csprng", + "polyfill", "pseudorandom", "random" ], - "time": "2017-09-27T21:40:39+00:00" + "time": "2019-01-03T20:59:08+00:00" }, { "name": "pear/console_table", @@ -8440,16 +8446,16 @@ }, { "name": "psr/log", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", "shasum": "" }, "require": { @@ -8483,7 +8489,7 @@ "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2018-11-20T15:27:04+00:00" }, { "name": "psy/psysh", @@ -8559,6 +8565,46 @@ ], "time": "2018-08-11T15:54:43+00:00" }, + { + "name": "ralouphie/getallheaders", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.0", + "satooshi/php-coveralls": ">=1.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2016-02-11T07:05:27+00:00" + }, { "name": "robrichards/xmlseclibs", "version": "3.0.1", @@ -8925,16 +8971,16 @@ }, { "name": "symfony/class-loader", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", - "reference": "31db283fc86d3143e7ff87e922177b457d909c30" + "reference": "4459eef5298dedfb69f771186a580062b8516497" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/class-loader/zipball/31db283fc86d3143e7ff87e922177b457d909c30", - "reference": "31db283fc86d3143e7ff87e922177b457d909c30", + "url": "https://api.github.com/repos/symfony/class-loader/zipball/4459eef5298dedfb69f771186a580062b8516497", + "reference": "4459eef5298dedfb69f771186a580062b8516497", "shasum": "" }, "require": { @@ -8977,7 +9023,7 @@ ], "description": "Symfony ClassLoader Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2019-01-16T09:39:14+00:00" }, { "name": "symfony/config", @@ -9045,16 +9091,16 @@ }, { "name": "symfony/console", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73" + "reference": "71ce77f37af0c5ffb9590e43cc4f70e426945c5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6b217594552b9323bcdcfc14f8a0ce126e84cd73", - "reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73", + "url": "https://api.github.com/repos/symfony/console/zipball/71ce77f37af0c5ffb9590e43cc4f70e426945c5e", + "reference": "71ce77f37af0c5ffb9590e43cc4f70e426945c5e", "shasum": "" }, "require": { @@ -9066,6 +9112,9 @@ "symfony/dependency-injection": "<3.4", "symfony/process": "<3.3" }, + "provide": { + "psr/log-implementation": "1.0" + }, "require-dev": { "psr/log": "~1.0", "symfony/config": "~3.3|~4.0", @@ -9075,7 +9124,7 @@ "symfony/process": "~3.3|~4.0" }, "suggest": { - "psr/log-implementation": "For using the console logger", + "psr/log": "For using the console logger", "symfony/event-dispatcher": "", "symfony/lock": "", "symfony/process": "" @@ -9110,7 +9159,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/css-selector", @@ -9167,16 +9216,16 @@ }, { "name": "symfony/debug", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc" + "reference": "8d8a9e877b3fcdc50ddecf8dcea146059753f782" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/d5a058ff6ecad26b30c1ba452241306ea34c65cc", - "reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc", + "url": "https://api.github.com/repos/symfony/debug/zipball/8d8a9e877b3fcdc50ddecf8dcea146059753f782", + "reference": "8d8a9e877b3fcdc50ddecf8dcea146059753f782", "shasum": "" }, "require": { @@ -9219,20 +9268,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2019-02-24T15:45:11+00:00" }, { "name": "symfony/dependency-injection", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "1c0e679e522591fd744fdf242fec41a43d62b2b1" + "reference": "c3dd7b7ea8cd8ec12304a5e222d7dc01cac8fa11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1c0e679e522591fd744fdf242fec41a43d62b2b1", - "reference": "1c0e679e522591fd744fdf242fec41a43d62b2b1", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/c3dd7b7ea8cd8ec12304a5e222d7dc01cac8fa11", + "reference": "c3dd7b7ea8cd8ec12304a5e222d7dc01cac8fa11", "shasum": "" }, "require": { @@ -9290,7 +9339,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2018-07-29T15:19:31+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/dom-crawler", @@ -9351,16 +9400,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb" + "reference": "ec625e2fff7f584eeb91754821807317b2e79236" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb", - "reference": "b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ec625e2fff7f584eeb91754821807317b2e79236", + "reference": "ec625e2fff7f584eeb91754821807317b2e79236", "shasum": "" }, "require": { @@ -9410,7 +9459,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-07-26T09:06:28+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/filesystem", @@ -9513,16 +9562,16 @@ }, { "name": "symfony/http-foundation", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6" + "reference": "9a96d77ceb1fd913c9d4a89e8a7e1be87604be8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6", - "reference": "19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/9a96d77ceb1fd913c9d4a89e8a7e1be87604be8a", + "reference": "9a96d77ceb1fd913c9d4a89e8a7e1be87604be8a", "shasum": "" }, "require": { @@ -9563,26 +9612,26 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-08-01T14:04:26+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/http-kernel", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "8e84cc498f0ffecfbabdea78b87828fd66189544" + "reference": "0362368c761cb8d9c79e56ab0db61d2c692db594" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/8e84cc498f0ffecfbabdea78b87828fd66189544", - "reference": "8e84cc498f0ffecfbabdea78b87828fd66189544", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/0362368c761cb8d9c79e56ab0db61d2c692db594", + "reference": "0362368c761cb8d9c79e56ab0db61d2c692db594", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0", - "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/debug": "^3.3.3|~4.0", "symfony/event-dispatcher": "~2.8|~3.0|~4.0", "symfony/http-foundation": "~3.4.12|~4.0.12|^4.1.1", "symfony/polyfill-ctype": "~1.8" @@ -9652,29 +9701,32 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-08-01T14:47:47+00:00" + "time": "2019-03-03T18:52:34+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.8.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "suggest": { + "ext-ctype": "For best performance" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -9696,7 +9748,7 @@ }, { "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" + "email": "backendtea@gmail.com" } ], "description": "Symfony polyfill for ctype functions", @@ -9707,20 +9759,20 @@ "polyfill", "portable" ], - "time": "2018-04-30T19:57:29+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/polyfill-iconv", - "version": "v1.8.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "7cb8436a814d5b0fcf292810ee26f8b0cb47584d" + "reference": "97001cfc283484c9691769f51cdf25259037eba2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/7cb8436a814d5b0fcf292810ee26f8b0cb47584d", - "reference": "7cb8436a814d5b0fcf292810ee26f8b0cb47584d", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/97001cfc283484c9691769f51cdf25259037eba2", + "reference": "97001cfc283484c9691769f51cdf25259037eba2", "shasum": "" }, "require": { @@ -9732,7 +9784,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -9766,20 +9818,20 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-09-21T06:26:08+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", "shasum": "" }, "require": { @@ -9791,7 +9843,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -9825,30 +9877,30 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-09-21T13:07:52+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.8.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6" + "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/77454693d8f10dd23bb24955cffd2d82db1007a6", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/6b88000cdd431cd2e940caa2cb569201f3f84224", + "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0", + "paragonie/random_compat": "~1.0|~2.0|~9.99", "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -9884,20 +9936,20 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-09-21T06:26:08+00:00" }, { "name": "symfony/process", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f" + "reference": "009f8dda80930e89e8344a4e310b08f9ff07dd2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/0414db29bd770ec5a4152683e655f55efd4fa60f", - "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f", + "url": "https://api.github.com/repos/symfony/process/zipball/009f8dda80930e89e8344a4e310b08f9ff07dd2e", + "reference": "009f8dda80930e89e8344a4e310b08f9ff07dd2e", "shasum": "" }, "require": { @@ -9933,44 +9985,47 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2019-01-16T13:27:11+00:00" }, { "name": "symfony/psr-http-message-bridge", - "version": "v1.0.2", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/psr-http-message-bridge.git", - "reference": "c2b757934f2d9681a287e662efbc27c41fe8ef86" + "reference": "921f8669c36ea0148d2520c0bb7838cda14879e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/c2b757934f2d9681a287e662efbc27c41fe8ef86", - "reference": "c2b757934f2d9681a287e662efbc27c41fe8ef86", + "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/921f8669c36ea0148d2520c0bb7838cda14879e0", + "reference": "921f8669c36ea0148d2520c0bb7838cda14879e0", "shasum": "" }, "require": { - "php": ">=5.3.3", - "psr/http-message": "~1.0", - "symfony/http-foundation": "~2.3|~3.0|~4.0" + "php": "^5.3.3 || ^7.0", + "psr/http-message": "^1.0", + "symfony/http-foundation": "^2.3.42 || ^3.4 || ^4.0" }, "require-dev": { - "symfony/phpunit-bridge": "~3.2|4.0" + "nyholm/psr7": "^1.1", + "symfony/phpunit-bridge": "^3.4 || ^4.0" }, "suggest": { - "psr/http-message-implementation": "To use the HttpFoundation factory", - "zendframework/zend-diactoros": "To use the Zend Diactoros factory" + "nyholm/psr7": "For a super lightweight PSR-7/17 implementation" }, "type": "symfony-bridge", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.1-dev" } }, "autoload": { "psr-4": { "Symfony\\Bridge\\PsrHttpMessage\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -9991,22 +10046,23 @@ "keywords": [ "http", "http-message", + "psr-17", "psr-7" ], - "time": "2017-12-19T00:31:44+00:00" + "time": "2019-03-11T15:23:15+00:00" }, { "name": "symfony/routing", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "e20f4bb79502c3c0db86d572f7683a30d4143911" + "reference": "6b25a86df5860461ff1990946168c0ef944f83db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/e20f4bb79502c3c0db86d572f7683a30d4143911", - "reference": "e20f4bb79502c3c0db86d572f7683a30d4143911", + "url": "https://api.github.com/repos/symfony/routing/zipball/6b25a86df5860461ff1990946168c0ef944f83db", + "reference": "6b25a86df5860461ff1990946168c0ef944f83db", "shasum": "" }, "require": { @@ -10070,20 +10126,20 @@ "uri", "url" ], - "time": "2018-07-26T11:19:56+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/serializer", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "40031683816470610af87c2d03ea86d1cf0f0104" + "reference": "964b7a59002391136fb0087fd5dc41213f7c283e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/40031683816470610af87c2d03ea86d1cf0f0104", - "reference": "40031683816470610af87c2d03ea86d1cf0f0104", + "url": "https://api.github.com/repos/symfony/serializer/zipball/964b7a59002391136fb0087fd5dc41213f7c283e", + "reference": "964b7a59002391136fb0087fd5dc41213f7c283e", "shasum": "" }, "require": { @@ -10149,20 +10205,20 @@ ], "description": "Symfony Serializer Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:58:24+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/translation", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "9749930bfc825139aadd2d28461ddbaed6577862" + "reference": "3e2966209567ffed8825905b53fc8548446130aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/9749930bfc825139aadd2d28461ddbaed6577862", - "reference": "9749930bfc825139aadd2d28461ddbaed6577862", + "url": "https://api.github.com/repos/symfony/translation/zipball/3e2966209567ffed8825905b53fc8548446130aa", + "reference": "3e2966209567ffed8825905b53fc8548446130aa", "shasum": "" }, "require": { @@ -10217,20 +10273,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/validator", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "364b818b5cc813282f19fefb364c24424210634a" + "reference": "21f8a7da6d4d8e6e34bd4e2bfaa24fa373886907" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/364b818b5cc813282f19fefb364c24424210634a", - "reference": "364b818b5cc813282f19fefb364c24424210634a", + "url": "https://api.github.com/repos/symfony/validator/zipball/21f8a7da6d4d8e6e34bd4e2bfaa24fa373886907", + "reference": "21f8a7da6d4d8e6e34bd4e2bfaa24fa373886907", "shasum": "" }, "require": { @@ -10302,7 +10358,7 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:58:24+00:00" + "time": "2019-02-25T09:32:21+00:00" }, { "name": "symfony/var-dumper", @@ -10375,16 +10431,16 @@ }, { "name": "symfony/yaml", - "version": "v3.4.14", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2" + "reference": "57f1ce82c997f5a8701b89ef970e36bb657fd09c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", - "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", + "url": "https://api.github.com/repos/symfony/yaml/zipball/57f1ce82c997f5a8701b89ef970e36bb657fd09c", + "reference": "57f1ce82c997f5a8701b89ef970e36bb657fd09c", "shasum": "" }, "require": { @@ -10430,7 +10486,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "twig/extensions", @@ -10489,30 +10545,31 @@ }, { "name": "twig/twig", - "version": "v1.35.3", + "version": "v1.38.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f" + "reference": "874adbd9222f928f6998732b25b01b41dff15b0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/b48680b6eb7d16b5025b9bfc4108d86f6b8af86f", - "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/874adbd9222f928f6998732b25b01b41dff15b0c", + "reference": "874adbd9222f928f6998732b25b01b41dff15b0c", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.4.0", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { "psr/container": "^1.0", "symfony/debug": "^2.7", - "symfony/phpunit-bridge": "^3.3" + "symfony/phpunit-bridge": "^3.4.19|^4.1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.35-dev" + "dev-master": "1.38-dev" } }, "autoload": { @@ -10541,16 +10598,16 @@ }, { "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", + "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", + "homepage": "https://twig.symfony.com", "keywords": [ "templating" ], - "time": "2018-03-20T04:25:58+00:00" + "time": "2019-03-12T18:45:24+00:00" }, { "name": "typo3/phar-stream-wrapper", @@ -10592,110 +10649,6 @@ ], "time": "2018-10-18T08:46:28+00:00" }, - { - "name": "webflo/drupal-core-strict", - "version": "8.5.6", - "source": { - "type": "git", - "url": "https://github.com/webflo/drupal-core-strict.git", - "reference": "e95610956f961f4421fd9a36849dcd6e2b55f4fe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webflo/drupal-core-strict/zipball/e95610956f961f4421fd9a36849dcd6e2b55f4fe", - "reference": "e95610956f961f4421fd9a36849dcd6e2b55f4fe", - "shasum": "" - }, - "require": { - "asm89/stack-cors": "1.2.0", - "composer/installers": "v1.5.0", - "composer/semver": "1.4.2", - "doctrine/annotations": "v1.2.7", - "doctrine/cache": "v1.6.1", - "doctrine/collections": "v1.3.0", - "doctrine/common": "v2.6.2", - "doctrine/inflector": "v1.1.0", - "doctrine/lexer": "v1.0.1", - "easyrdf/easyrdf": "0.9.1", - "egulias/email-validator": "1.2.14", - "guzzlehttp/guzzle": "6.3.0", - "guzzlehttp/promises": "v1.3.1", - "guzzlehttp/psr7": "1.4.2", - "masterminds/html5": "2.3.0", - "paragonie/random_compat": "v2.0.11", - "psr/container": "1.0.0", - "psr/http-message": "1.0.1", - "psr/log": "1.0.2", - "stack/builder": "v1.0.5", - "symfony-cmf/routing": "1.4.1", - "symfony/class-loader": "v3.4.14", - "symfony/console": "v3.4.14", - "symfony/debug": "v3.4.14", - "symfony/dependency-injection": "v3.4.14", - "symfony/event-dispatcher": "v3.4.14", - "symfony/http-foundation": "v3.4.14", - "symfony/http-kernel": "v3.4.14", - "symfony/polyfill-ctype": "v1.8.0", - "symfony/polyfill-iconv": "v1.8.0", - "symfony/polyfill-mbstring": "v1.8.0", - "symfony/polyfill-php70": "v1.8.0", - "symfony/process": "v3.4.14", - "symfony/psr-http-message-bridge": "v1.0.2", - "symfony/routing": "v3.4.14", - "symfony/serializer": "v3.4.14", - "symfony/translation": "v3.4.14", - "symfony/validator": "v3.4.14", - "symfony/yaml": "v3.4.14", - "twig/twig": "v1.35.3", - "wikimedia/composer-merge-plugin": "v1.4.1", - "zendframework/zend-diactoros": "1.4.1", - "zendframework/zend-escaper": "2.5.2", - "zendframework/zend-feed": "2.7.0", - "zendframework/zend-stdlib": "3.0.1" - }, - "require-dev": { - "behat/mink": "dev-master#9ea1cebe3dc529ba3861d87c818f045362c40484", - "behat/mink-browserkit-driver": "v1.3.2", - "behat/mink-goutte-driver": "v1.2.1", - "behat/mink-selenium2-driver": "dev-master#93474c65a2a7bf959200ab5f7a14cc450645c185", - "doctrine/instantiator": "1.0.5", - "drupal/coder": "8.2.12", - "fabpot/goutte": "v3.2.1", - "instaclick/php-webdriver": "1.4.5", - "ircmaxell/password-compat": "v1.0.4", - "jcalderonzumba/gastonjs": "v1.0.2", - "jcalderonzumba/mink-phantomjs-driver": "v0.3.2", - "mikey179/vfsstream": "v1.6.5", - "phpdocumentor/reflection-docblock": "2.0.4", - "phpspec/prophecy": "v1.7.0", - "phpunit/php-code-coverage": "2.2.4", - "phpunit/php-file-iterator": "1.4.2", - "phpunit/php-text-template": "1.2.1", - "phpunit/php-timer": "1.0.9", - "phpunit/php-token-stream": "1.4.11", - "phpunit/phpunit": "4.8.36", - "phpunit/phpunit-mock-objects": "2.3.8", - "sebastian/comparator": "1.2.4", - "sebastian/diff": "1.4.1", - "sebastian/environment": "1.3.8", - "sebastian/exporter": "1.2.2", - "sebastian/global-state": "1.1.1", - "sebastian/recursion-context": "1.0.5", - "sebastian/version": "1.0.6", - "squizlabs/php_codesniffer": "2.8.1", - "symfony/browser-kit": "v3.4.14", - "symfony/css-selector": "v3.4.14", - "symfony/dom-crawler": "v3.4.14", - "symfony/phpunit-bridge": "v3.4.14" - }, - "type": "metapackage", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0-or-later" - ], - "description": "Locked core dependencies", - "time": "2018-08-01T21:00:49+00:00" - }, { "name": "webflo/drupal-finder", "version": "1.1.0", @@ -10873,72 +10826,23 @@ ], "time": "2015-02-11T11:06:42+00:00" }, - { - "name": "wikimedia/composer-merge-plugin", - "version": "v1.4.1", - "source": { - "type": "git", - "url": "https://github.com/wikimedia/composer-merge-plugin.git", - "reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/81c6ac72a24a67383419c7eb9aa2b3437f2ab100", - "reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0", - "php": ">=5.3.2" - }, - "require-dev": { - "composer/composer": "~1.0.0", - "jakub-onderka/php-parallel-lint": "~0.8", - "phpunit/phpunit": "~4.8|~5.0", - "squizlabs/php_codesniffer": "~2.1.0" - }, - "type": "composer-plugin", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - }, - "class": "Wikimedia\\Composer\\MergePlugin" - }, - "autoload": { - "psr-4": { - "Wikimedia\\Composer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bryan Davis", - "email": "bd808@wikimedia.org" - } - ], - "description": "Composer plugin to merge multiple composer.json files", - "time": "2017-04-25T02:31:25+00:00" - }, { "name": "zendframework/zend-diactoros", - "version": "1.4.1", + "version": "1.8.6", "source": { "type": "git", "url": "https://github.com/zendframework/zend-diactoros.git", - "reference": "424a840dc3bedcdeea510b42e056c77c2d6c4bef" + "reference": "20da13beba0dde8fb648be3cc19765732790f46e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/424a840dc3bedcdeea510b42e056c77c2d6c4bef", - "reference": "424a840dc3bedcdeea510b42e056c77c2d6c4bef", + "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/20da13beba0dde8fb648be3cc19765732790f46e", + "reference": "20da13beba0dde8fb648be3cc19765732790f46e", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0", - "psr/http-message": "~1.0" + "php": "^5.6 || ^7.0", + "psr/http-message": "^1.0" }, "provide": { "psr/http-message-implementation": "1.0" @@ -10946,17 +10850,29 @@ "require-dev": { "ext-dom": "*", "ext-libxml": "*", - "phpunit/phpunit": "^4.6 || ^5.5", - "zendframework/zend-coding-standard": "~1.0.0" + "php-http/psr7-integration-tests": "dev-master", + "phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7", + "zendframework/zend-coding-standard": "~1.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev", - "dev-develop": "1.5-dev" + "dev-master": "1.8.x-dev", + "dev-develop": "1.9.x-dev", + "dev-release-2.0": "2.0.x-dev" } }, "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php" + ], "psr-4": { "Zend\\Diactoros\\": "src/" } @@ -10972,34 +10888,34 @@ "psr", "psr-7" ], - "time": "2017-08-17T21:21:00+00:00" + "time": "2018-09-05T19:29:37+00:00" }, { "name": "zendframework/zend-escaper", - "version": "2.5.2", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-escaper.git", - "reference": "2dcd14b61a72d8b8e27d579c6344e12c26141d4e" + "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/2dcd14b61a72d8b8e27d579c6344e12c26141d4e", - "reference": "2dcd14b61a72d8b8e27d579c6344e12c26141d4e", + "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/31d8aafae982f9568287cb4dce987e6aff8fd074", + "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074", "shasum": "" }, "require": { - "php": ">=5.5" + "php": "^5.6 || ^7.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" + "dev-master": "2.6.x-dev", + "dev-develop": "2.7.x-dev" } }, "autoload": { @@ -11011,55 +10927,58 @@ "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zend-escaper", + "description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs", "keywords": [ + "ZendFramework", "escaper", - "zf2" + "zf" ], - "time": "2016-06-30T19:48:38+00:00" + "time": "2018-04-25T15:48:53+00:00" }, { "name": "zendframework/zend-feed", - "version": "2.7.0", + "version": "2.12.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-feed.git", - "reference": "12b328d382aa5200f1de53d4147033b885776b67" + "reference": "d926c5af34b93a0121d5e2641af34ddb1533d733" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-feed/zipball/12b328d382aa5200f1de53d4147033b885776b67", - "reference": "12b328d382aa5200f1de53d4147033b885776b67", + "url": "https://api.github.com/repos/zendframework/zend-feed/zipball/d926c5af34b93a0121d5e2641af34ddb1533d733", + "reference": "d926c5af34b93a0121d5e2641af34ddb1533d733", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "zendframework/zend-escaper": "^2.5", - "zendframework/zend-stdlib": "^2.7 || ^3.0" + "ext-dom": "*", + "ext-libxml": "*", + "php": "^5.6 || ^7.0", + "zendframework/zend-escaper": "^2.5.2", + "zendframework/zend-stdlib": "^3.2.1" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "psr/http-message": "^1.0", - "zendframework/zend-cache": "^2.5", - "zendframework/zend-db": "^2.5", - "zendframework/zend-http": "^2.5", - "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", - "zendframework/zend-validator": "^2.5" + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "psr/http-message": "^1.0.1", + "zendframework/zend-cache": "^2.7.2", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-db": "^2.8.2", + "zendframework/zend-http": "^2.7", + "zendframework/zend-servicemanager": "^2.7.8 || ^3.3", + "zendframework/zend-validator": "^2.10.1" }, "suggest": { - "psr/http-message": "PSR-7 ^1.0, if you wish to use Zend\\Feed\\Reader\\Http\\Psr7ResponseDecorator", + "psr/http-message": "PSR-7 ^1.0.1, if you wish to use Zend\\Feed\\Reader\\Http\\Psr7ResponseDecorator", "zendframework/zend-cache": "Zend\\Cache component, for optionally caching feeds between requests", "zendframework/zend-db": "Zend\\Db component, for use with PubSubHubbub", "zendframework/zend-http": "Zend\\Http for PubSubHubbub, and optionally for use with Zend\\Feed\\Reader", "zendframework/zend-servicemanager": "Zend\\ServiceManager component, for easily extending ExtensionManager implementations", - "zendframework/zend-validator": "Zend\\Validator component, for validating email addresses used in Atom feeds and entries ehen using the Writer subcomponent" + "zendframework/zend-validator": "Zend\\Validator component, for validating email addresses used in Atom feeds and entries when using the Writer subcomponent" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev", - "dev-develop": "2.8-dev" + "dev-master": "2.12.x-dev", + "dev-develop": "2.13.x-dev" } }, "autoload": { @@ -11072,40 +10991,40 @@ "BSD-3-Clause" ], "description": "provides functionality for consuming RSS and Atom feeds", - "homepage": "https://github.com/zendframework/zend-feed", "keywords": [ + "ZendFramework", "feed", - "zf2" + "zf" ], - "time": "2016-02-11T18:54:29+00:00" + "time": "2019-03-05T20:08:49+00:00" }, { "name": "zendframework/zend-stdlib", - "version": "3.0.1", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-stdlib.git", - "reference": "8bafa58574204bdff03c275d1d618aaa601588ae" + "reference": "66536006722aff9e62d1b331025089b7ec71c065" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/8bafa58574204bdff03c275d1d618aaa601588ae", - "reference": "8bafa58574204bdff03c275d1d618aaa601588ae", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/66536006722aff9e62d1b331025089b7ec71c065", + "reference": "66536006722aff9e62d1b331025089b7ec71c065", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0" + "php": "^5.6 || ^7.0" }, "require-dev": { - "athletic/athletic": "~0.1", - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0" + "phpbench/phpbench": "^0.13", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev", - "dev-develop": "3.1-dev" + "dev-master": "3.2.x-dev", + "dev-develop": "3.3.x-dev" } }, "autoload": { @@ -11117,12 +11036,13 @@ "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zend-stdlib", + "description": "SPL extensions, array utilities, error handlers, and more", "keywords": [ + "ZendFramework", "stdlib", - "zf2" + "zf" ], - "time": "2016-04-12T21:19:36+00:00" + "time": "2018-08-28T21:34:05+00:00" } ], "packages-dev": [], diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 660e8053f189bef13a63e565c265ef247540c928..9d5771ff554bc894b8fde13562379334bcb6fc9c 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -2751,6 +2751,7 @@ 'GuzzleHttp\\Psr7\\PumpStream' => $vendorDir . '/guzzlehttp/psr7/src/PumpStream.php', 'GuzzleHttp\\Psr7\\Request' => $vendorDir . '/guzzlehttp/psr7/src/Request.php', 'GuzzleHttp\\Psr7\\Response' => $vendorDir . '/guzzlehttp/psr7/src/Response.php', + 'GuzzleHttp\\Psr7\\Rfc7230' => $vendorDir . '/guzzlehttp/psr7/src/Rfc7230.php', 'GuzzleHttp\\Psr7\\ServerRequest' => $vendorDir . '/guzzlehttp/psr7/src/ServerRequest.php', 'GuzzleHttp\\Psr7\\Stream' => $vendorDir . '/guzzlehttp/psr7/src/Stream.php', 'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => $vendorDir . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php', @@ -3028,6 +3029,7 @@ 'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php', 'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', 'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', + 'Psr\\Log\\Test\\TestLogger' => $vendorDir . '/psr/log/Psr/Log/Test/TestLogger.php', 'Psy\\CodeCleaner' => $vendorDir . '/psy/psysh/src/CodeCleaner.php', 'Psy\\CodeCleaner\\AbstractClassPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/AbstractClassPass.php', 'Psy\\CodeCleaner\\AssignThisVariablePass' => $vendorDir . '/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php', @@ -3389,16 +3391,9 @@ 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\HookFactory' => $vendorDir . '/stecman/symfony-console-completion/src/HookFactory.php', 'Symfony\\Bridge\\PsrHttpMessage\\Factory\\DiactorosFactory' => $vendorDir . '/symfony/psr-http-message-bridge/Factory/DiactorosFactory.php', 'Symfony\\Bridge\\PsrHttpMessage\\Factory\\HttpFoundationFactory' => $vendorDir . '/symfony/psr-http-message-bridge/Factory/HttpFoundationFactory.php', + 'Symfony\\Bridge\\PsrHttpMessage\\Factory\\PsrHttpFactory' => $vendorDir . '/symfony/psr-http-message-bridge/Factory/PsrHttpFactory.php', 'Symfony\\Bridge\\PsrHttpMessage\\HttpFoundationFactoryInterface' => $vendorDir . '/symfony/psr-http-message-bridge/HttpFoundationFactoryInterface.php', 'Symfony\\Bridge\\PsrHttpMessage\\HttpMessageFactoryInterface' => $vendorDir . '/symfony/psr-http-message-bridge/HttpMessageFactoryInterface.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Factory\\DiactorosFactoryTest' => $vendorDir . '/symfony/psr-http-message-bridge/Tests/Factory/DiactorosFactoryTest.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Factory\\HttpFoundationFactoryTest' => $vendorDir . '/symfony/psr-http-message-bridge/Tests/Factory/HttpFoundationFactoryTest.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\Message' => $vendorDir . '/symfony/psr-http-message-bridge/Tests/Fixtures/Message.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\Response' => $vendorDir . '/symfony/psr-http-message-bridge/Tests/Fixtures/Response.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\ServerRequest' => $vendorDir . '/symfony/psr-http-message-bridge/Tests/Fixtures/ServerRequest.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\Stream' => $vendorDir . '/symfony/psr-http-message-bridge/Tests/Fixtures/Stream.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\UploadedFile' => $vendorDir . '/symfony/psr-http-message-bridge/Tests/Fixtures/UploadedFile.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\Uri' => $vendorDir . '/symfony/psr-http-message-bridge/Tests/Fixtures/Uri.php', 'Symfony\\Cmf\\Component\\Routing\\Candidates\\Candidates' => $vendorDir . '/symfony-cmf/routing/Candidates/Candidates.php', 'Symfony\\Cmf\\Component\\Routing\\Candidates\\CandidatesInterface' => $vendorDir . '/symfony-cmf/routing/Candidates/CandidatesInterface.php', 'Symfony\\Cmf\\Component\\Routing\\ChainRouteCollection' => $vendorDir . '/symfony-cmf/routing/ChainRouteCollection.php', @@ -4585,6 +4580,8 @@ 'Twig\\Node\\BlockReferenceNode' => $vendorDir . '/twig/twig/src/Node/BlockReferenceNode.php', 'Twig\\Node\\BodyNode' => $vendorDir . '/twig/twig/src/Node/BodyNode.php', 'Twig\\Node\\CheckSecurityNode' => $vendorDir . '/twig/twig/src/Node/CheckSecurityNode.php', + 'Twig\\Node\\CheckToStringNode' => $vendorDir . '/twig/twig/src/Node/CheckToStringNode.php', + 'Twig\\Node\\DeprecatedNode' => $vendorDir . '/twig/twig/src/Node/DeprecatedNode.php', 'Twig\\Node\\DoNode' => $vendorDir . '/twig/twig/src/Node/DoNode.php', 'Twig\\Node\\EmbedNode' => $vendorDir . '/twig/twig/src/Node/EmbedNode.php', 'Twig\\Node\\Expression\\AbstractExpression' => $vendorDir . '/twig/twig/src/Node/Expression/AbstractExpression.php', @@ -4689,6 +4686,7 @@ 'Twig\\TokenParser\\AbstractTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/AbstractTokenParser.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', 'Twig\\TokenParser\\DoTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/DoTokenParser.php', 'Twig\\TokenParser\\EmbedTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/EmbedTokenParser.php', 'Twig\\TokenParser\\ExtendsTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ExtendsTokenParser.php', @@ -4798,6 +4796,7 @@ 'Twig_Node_BlockReference' => $vendorDir . '/twig/twig/lib/Twig/Node/BlockReference.php', 'Twig_Node_Body' => $vendorDir . '/twig/twig/lib/Twig/Node/Body.php', 'Twig_Node_CheckSecurity' => $vendorDir . '/twig/twig/lib/Twig/Node/CheckSecurity.php', + 'Twig_Node_Deprecated' => $vendorDir . '/twig/twig/lib/Twig/Node/Deprecated.php', 'Twig_Node_Do' => $vendorDir . '/twig/twig/lib/Twig/Node/Do.php', 'Twig_Node_Embed' => $vendorDir . '/twig/twig/lib/Twig/Node/Embed.php', 'Twig_Node_Expression' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression.php', @@ -4913,6 +4912,7 @@ 'Twig_TokenParserInterface' => $vendorDir . '/twig/twig/lib/Twig/TokenParserInterface.php', 'Twig_TokenParser_AutoEscape' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/AutoEscape.php', 'Twig_TokenParser_Block' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Block.php', + 'Twig_TokenParser_Deprecated' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Deprecated.php', 'Twig_TokenParser_Do' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Do.php', 'Twig_TokenParser_Embed' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Embed.php', 'Twig_TokenParser_Extends' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Extends.php', @@ -4938,13 +4938,6 @@ 'Webmozart\\PathUtil\\Path' => $vendorDir . '/webmozart/path-util/src/Path.php', 'Webmozart\\PathUtil\\Url' => $vendorDir . '/webmozart/path-util/src/Url.php', 'WhiteHat101\\Crypt\\APR1_MD5' => $vendorDir . '/whitehat101/apr1-md5/src/APR1_MD5.php', - 'Wikimedia\\Composer\\Logger' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Logger.php', - 'Wikimedia\\Composer\\MergePlugin' => $vendorDir . '/wikimedia/composer-merge-plugin/src/MergePlugin.php', - 'Wikimedia\\Composer\\Merge\\ExtraPackage' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Merge/ExtraPackage.php', - 'Wikimedia\\Composer\\Merge\\MissingFileException' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Merge/MissingFileException.php', - 'Wikimedia\\Composer\\Merge\\NestedArray' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Merge/NestedArray.php', - 'Wikimedia\\Composer\\Merge\\PluginState' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Merge/PluginState.php', - 'Wikimedia\\Composer\\Merge\\StabilityFlags' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Merge/StabilityFlags.php', 'XdgBaseDir\\Xdg' => $vendorDir . '/dnoegel/php-xdg-base-dir/src/Xdg.php', 'Zend\\Diactoros\\AbstractSerializer' => $vendorDir . '/zendframework/zend-diactoros/src/AbstractSerializer.php', 'Zend\\Diactoros\\CallbackStream' => $vendorDir . '/zendframework/zend-diactoros/src/CallbackStream.php', @@ -4971,6 +4964,7 @@ 'Zend\\Diactoros\\Response\\SapiStreamEmitter' => $vendorDir . '/zendframework/zend-diactoros/src/Response/SapiStreamEmitter.php', 'Zend\\Diactoros\\Response\\Serializer' => $vendorDir . '/zendframework/zend-diactoros/src/Response/Serializer.php', 'Zend\\Diactoros\\Response\\TextResponse' => $vendorDir . '/zendframework/zend-diactoros/src/Response/TextResponse.php', + 'Zend\\Diactoros\\Response\\XmlResponse' => $vendorDir . '/zendframework/zend-diactoros/src/Response/XmlResponse.php', 'Zend\\Diactoros\\Server' => $vendorDir . '/zendframework/zend-diactoros/src/Server.php', 'Zend\\Diactoros\\ServerRequest' => $vendorDir . '/zendframework/zend-diactoros/src/ServerRequest.php', 'Zend\\Diactoros\\ServerRequestFactory' => $vendorDir . '/zendframework/zend-diactoros/src/ServerRequestFactory.php', @@ -5027,6 +5021,8 @@ 'Zend\\Feed\\Reader\\Extension\\CreativeCommons\\Feed' => $vendorDir . '/zendframework/zend-feed/src/Reader/Extension/CreativeCommons/Feed.php', 'Zend\\Feed\\Reader\\Extension\\DublinCore\\Entry' => $vendorDir . '/zendframework/zend-feed/src/Reader/Extension/DublinCore/Entry.php', 'Zend\\Feed\\Reader\\Extension\\DublinCore\\Feed' => $vendorDir . '/zendframework/zend-feed/src/Reader/Extension/DublinCore/Feed.php', + 'Zend\\Feed\\Reader\\Extension\\GooglePlayPodcast\\Entry' => $vendorDir . '/zendframework/zend-feed/src/Reader/Extension/GooglePlayPodcast/Entry.php', + 'Zend\\Feed\\Reader\\Extension\\GooglePlayPodcast\\Feed' => $vendorDir . '/zendframework/zend-feed/src/Reader/Extension/GooglePlayPodcast/Feed.php', 'Zend\\Feed\\Reader\\Extension\\Podcast\\Entry' => $vendorDir . '/zendframework/zend-feed/src/Reader/Extension/Podcast/Entry.php', 'Zend\\Feed\\Reader\\Extension\\Podcast\\Feed' => $vendorDir . '/zendframework/zend-feed/src/Reader/Extension/Podcast/Feed.php', 'Zend\\Feed\\Reader\\Extension\\Slash\\Entry' => $vendorDir . '/zendframework/zend-feed/src/Reader/Extension/Slash/Entry.php', @@ -5065,6 +5061,10 @@ 'Zend\\Feed\\Writer\\Extension\\Content\\Renderer\\Entry' => $vendorDir . '/zendframework/zend-feed/src/Writer/Extension/Content/Renderer/Entry.php', 'Zend\\Feed\\Writer\\Extension\\DublinCore\\Renderer\\Entry' => $vendorDir . '/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Entry.php', 'Zend\\Feed\\Writer\\Extension\\DublinCore\\Renderer\\Feed' => $vendorDir . '/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php', + 'Zend\\Feed\\Writer\\Extension\\GooglePlayPodcast\\Entry' => $vendorDir . '/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Entry.php', + 'Zend\\Feed\\Writer\\Extension\\GooglePlayPodcast\\Feed' => $vendorDir . '/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Feed.php', + 'Zend\\Feed\\Writer\\Extension\\GooglePlayPodcast\\Renderer\\Entry' => $vendorDir . '/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Renderer/Entry.php', + 'Zend\\Feed\\Writer\\Extension\\GooglePlayPodcast\\Renderer\\Feed' => $vendorDir . '/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Renderer/Feed.php', 'Zend\\Feed\\Writer\\Extension\\ITunes\\Entry' => $vendorDir . '/zendframework/zend-feed/src/Writer/Extension/ITunes/Entry.php', 'Zend\\Feed\\Writer\\Extension\\ITunes\\Feed' => $vendorDir . '/zendframework/zend-feed/src/Writer/Extension/ITunes/Feed.php', 'Zend\\Feed\\Writer\\Extension\\ITunes\\Renderer\\Entry' => $vendorDir . '/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Entry.php', @@ -5099,6 +5099,7 @@ 'Zend\\Stdlib\\ArrayUtils\\MergeRemoveKey' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php', 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKey' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKey.php', 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKeyInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php', + 'Zend\\Stdlib\\ConsoleHelper' => $vendorDir . '/zendframework/zend-stdlib/src/ConsoleHelper.php', 'Zend\\Stdlib\\DispatchableInterface' => $vendorDir . '/zendframework/zend-stdlib/src/DispatchableInterface.php', 'Zend\\Stdlib\\ErrorHandler' => $vendorDir . '/zendframework/zend-stdlib/src/ErrorHandler.php', 'Zend\\Stdlib\\Exception\\BadMethodCallException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/BadMethodCallException.php', diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 03c0ffd3de2a4a33f88acd1b0759aafb6b91243d..d8af397388e07ac6ec4890ae7315a7c378b71208 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -11,10 +11,19 @@ '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', '023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php', '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', + '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php', + 'cf97c57bfe0f23854afd2f3818abb7a0' => $vendorDir . '/zendframework/zend-diactoros/src/functions/create_uploaded_file.php', + '9bf37a3d0dad93e29cb4e1b1bfab04e9' => $vendorDir . '/zendframework/zend-diactoros/src/functions/marshal_headers_from_sapi.php', + 'ce70dccb4bcc2efc6e94d2ee526e6972' => $vendorDir . '/zendframework/zend-diactoros/src/functions/marshal_method_from_sapi.php', + 'f86420df471f14d568bfcb71e271b523' => $vendorDir . '/zendframework/zend-diactoros/src/functions/marshal_protocol_version_from_sapi.php', + 'b87481e008a3700344428ae089e7f9e5' => $vendorDir . '/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php', + '0b0974a5566a1077e4f2e111341112c1' => $vendorDir . '/zendframework/zend-diactoros/src/functions/normalize_server.php', + '1ca3bc274755662169f9629d5412a1da' => $vendorDir . '/zendframework/zend-diactoros/src/functions/normalize_uploaded_files.php', + '40360c0b9b437e69bcbb7f1349ce029e' => $vendorDir . '/zendframework/zend-diactoros/src/functions/parse_cookie_header.php', '801c31d8ed748cfa537fa45402288c95' => $vendorDir . '/psy/psysh/src/functions.php', '6175f5662c2e26de0149cb048cda7209' => $vendorDir . '/simplesamlphp/saml2/src/_autoload.php', '5a12a5271c58108e0aa33355e6ac54ea' => $vendorDir . '/drupal/console-core/src/functions.php', diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php index 28039d1dd42373166b42728500e1d1dea4cbe3a3..ce921821cac5b863af40fa2d52ba53ce507c12d9 100644 --- a/vendor/composer/autoload_namespaces.php +++ b/vendor/composer/autoload_namespaces.php @@ -16,9 +16,7 @@ 'EasyRdf_' => array($vendorDir . '/easyrdf/easyrdf/lib'), 'Drush' => array($vendorDir . '/drush/drush/lib'), 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'), - 'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'), 'Doctrine\\Common\\Collections\\' => array($vendorDir . '/doctrine/collections/lib'), - 'Doctrine\\Common\\Annotations\\' => array($vendorDir . '/doctrine/annotations/lib'), 'Dflydev\\PlaceholderResolver' => array($vendorDir . '/dflydev/placeholder-resolver/src'), 'Dflydev\\DotAccessData' => array($vendorDir . '/dflydev/dot-access-data/src'), 'Dflydev\\DotAccessConfiguration' => array($vendorDir . '/dflydev/dot-access-configuration/src'), diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index ca49397094920513f50c37f11055e261353a8d29..670b670111132fb64a86e5dde6ec51256b84038f 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -13,7 +13,6 @@ 'Zend\\Escaper\\' => array($vendorDir . '/zendframework/zend-escaper/src'), 'Zend\\Diactoros\\' => array($vendorDir . '/zendframework/zend-diactoros/src'), 'XdgBaseDir\\' => array($vendorDir . '/dnoegel/php-xdg-base-dir/src'), - 'Wikimedia\\Composer\\' => array($vendorDir . '/wikimedia/composer-merge-plugin/src'), 'WhiteHat101\\Crypt\\' => array($vendorDir . '/whitehat101/apr1-md5/src'), 'Webmozart\\PathUtil\\' => array($vendorDir . '/webmozart/path-util/src'), 'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'), @@ -69,7 +68,9 @@ 'Drupal\\Console\\' => array($vendorDir . '/drupal/console/src'), 'Drupal\\Component\\' => array($baseDir . '/web/core/lib/Drupal/Component'), 'DrupalComposer\\DrupalScaffold\\' => array($vendorDir . '/drupal-composer/drupal-scaffold/src'), + 'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Common/Inflector'), 'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache'), + 'Doctrine\\Common\\Annotations\\' => array($vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations'), 'Doctrine\\Common\\' => array($vendorDir . '/doctrine/common/lib/Doctrine/Common'), 'Consolidation\\OutputFormatters\\' => array($vendorDir . '/consolidation/output-formatters/src'), 'Consolidation\\AnnotatedCommand\\' => array($vendorDir . '/consolidation/annotated-command/src'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 3fb16ee6db8aec04c112fa941572a336544782d7..20a080e3257c4034d43c7258f53c29543c15ef14 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -12,10 +12,19 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', '023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php', '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', + '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php', + 'cf97c57bfe0f23854afd2f3818abb7a0' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/create_uploaded_file.php', + '9bf37a3d0dad93e29cb4e1b1bfab04e9' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/marshal_headers_from_sapi.php', + 'ce70dccb4bcc2efc6e94d2ee526e6972' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/marshal_method_from_sapi.php', + 'f86420df471f14d568bfcb71e271b523' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/marshal_protocol_version_from_sapi.php', + 'b87481e008a3700344428ae089e7f9e5' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php', + '0b0974a5566a1077e4f2e111341112c1' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/normalize_server.php', + '1ca3bc274755662169f9629d5412a1da' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/normalize_uploaded_files.php', + '40360c0b9b437e69bcbb7f1349ce029e' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/parse_cookie_header.php', '801c31d8ed748cfa537fa45402288c95' => __DIR__ . '/..' . '/psy/psysh/src/functions.php', '6175f5662c2e26de0149cb048cda7209' => __DIR__ . '/..' . '/simplesamlphp/saml2/src/_autoload.php', '5a12a5271c58108e0aa33355e6ac54ea' => __DIR__ . '/..' . '/drupal/console-core/src/functions.php', @@ -44,7 +53,6 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 ), 'W' => array ( - 'Wikimedia\\Composer\\' => 19, 'WhiteHat101\\Crypt\\' => 18, 'Webmozart\\PathUtil\\' => 19, 'Webmozart\\Assert\\' => 17, @@ -127,7 +135,9 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Drupal\\Console\\' => 15, 'Drupal\\Component\\' => 17, 'DrupalComposer\\DrupalScaffold\\' => 30, + 'Doctrine\\Common\\Inflector\\' => 26, 'Doctrine\\Common\\Cache\\' => 22, + 'Doctrine\\Common\\Annotations\\' => 28, 'Doctrine\\Common\\' => 16, ), 'C' => @@ -175,10 +185,6 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 array ( 0 => __DIR__ . '/..' . '/dnoegel/php-xdg-base-dir/src', ), - 'Wikimedia\\Composer\\' => - array ( - 0 => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src', - ), 'WhiteHat101\\Crypt\\' => array ( 0 => __DIR__ . '/..' . '/whitehat101/apr1-md5/src', @@ -399,10 +405,18 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 array ( 0 => __DIR__ . '/..' . '/drupal-composer/drupal-scaffold/src', ), + 'Doctrine\\Common\\Inflector\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Common/Inflector', + ), 'Doctrine\\Common\\Cache\\' => array ( 0 => __DIR__ . '/..' . '/doctrine/cache/lib/Doctrine/Common/Cache', ), + 'Doctrine\\Common\\Annotations\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations', + ), 'Doctrine\\Common\\' => array ( 0 => __DIR__ . '/..' . '/doctrine/common/lib/Doctrine/Common', @@ -496,18 +510,10 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 array ( 0 => __DIR__ . '/..' . '/doctrine/lexer/lib', ), - 'Doctrine\\Common\\Inflector\\' => - array ( - 0 => __DIR__ . '/..' . '/doctrine/inflector/lib', - ), 'Doctrine\\Common\\Collections\\' => array ( 0 => __DIR__ . '/..' . '/doctrine/collections/lib', ), - 'Doctrine\\Common\\Annotations\\' => - array ( - 0 => __DIR__ . '/..' . '/doctrine/annotations/lib', - ), 'Dflydev\\PlaceholderResolver' => array ( 0 => __DIR__ . '/..' . '/dflydev/placeholder-resolver/src', @@ -3276,6 +3282,7 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'GuzzleHttp\\Psr7\\PumpStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/PumpStream.php', 'GuzzleHttp\\Psr7\\Request' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Request.php', 'GuzzleHttp\\Psr7\\Response' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Response.php', + 'GuzzleHttp\\Psr7\\Rfc7230' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Rfc7230.php', 'GuzzleHttp\\Psr7\\ServerRequest' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/ServerRequest.php', 'GuzzleHttp\\Psr7\\Stream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Stream.php', 'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php', @@ -3553,6 +3560,7 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php', 'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', 'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', + 'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php', 'Psy\\CodeCleaner' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner.php', 'Psy\\CodeCleaner\\AbstractClassPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/AbstractClassPass.php', 'Psy\\CodeCleaner\\AssignThisVariablePass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php', @@ -3914,16 +3922,9 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\HookFactory' => __DIR__ . '/..' . '/stecman/symfony-console-completion/src/HookFactory.php', 'Symfony\\Bridge\\PsrHttpMessage\\Factory\\DiactorosFactory' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/Factory/DiactorosFactory.php', 'Symfony\\Bridge\\PsrHttpMessage\\Factory\\HttpFoundationFactory' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/Factory/HttpFoundationFactory.php', + 'Symfony\\Bridge\\PsrHttpMessage\\Factory\\PsrHttpFactory' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/Factory/PsrHttpFactory.php', 'Symfony\\Bridge\\PsrHttpMessage\\HttpFoundationFactoryInterface' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/HttpFoundationFactoryInterface.php', 'Symfony\\Bridge\\PsrHttpMessage\\HttpMessageFactoryInterface' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/HttpMessageFactoryInterface.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Factory\\DiactorosFactoryTest' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/Tests/Factory/DiactorosFactoryTest.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Factory\\HttpFoundationFactoryTest' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/Tests/Factory/HttpFoundationFactoryTest.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\Message' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/Tests/Fixtures/Message.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\Response' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/Tests/Fixtures/Response.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\ServerRequest' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/Tests/Fixtures/ServerRequest.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\Stream' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/Tests/Fixtures/Stream.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\UploadedFile' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/Tests/Fixtures/UploadedFile.php', - 'Symfony\\Bridge\\PsrHttpMessage\\Tests\\Fixtures\\Uri' => __DIR__ . '/..' . '/symfony/psr-http-message-bridge/Tests/Fixtures/Uri.php', 'Symfony\\Cmf\\Component\\Routing\\Candidates\\Candidates' => __DIR__ . '/..' . '/symfony-cmf/routing/Candidates/Candidates.php', 'Symfony\\Cmf\\Component\\Routing\\Candidates\\CandidatesInterface' => __DIR__ . '/..' . '/symfony-cmf/routing/Candidates/CandidatesInterface.php', 'Symfony\\Cmf\\Component\\Routing\\ChainRouteCollection' => __DIR__ . '/..' . '/symfony-cmf/routing/ChainRouteCollection.php', @@ -5110,6 +5111,8 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Twig\\Node\\BlockReferenceNode' => __DIR__ . '/..' . '/twig/twig/src/Node/BlockReferenceNode.php', 'Twig\\Node\\BodyNode' => __DIR__ . '/..' . '/twig/twig/src/Node/BodyNode.php', 'Twig\\Node\\CheckSecurityNode' => __DIR__ . '/..' . '/twig/twig/src/Node/CheckSecurityNode.php', + 'Twig\\Node\\CheckToStringNode' => __DIR__ . '/..' . '/twig/twig/src/Node/CheckToStringNode.php', + 'Twig\\Node\\DeprecatedNode' => __DIR__ . '/..' . '/twig/twig/src/Node/DeprecatedNode.php', 'Twig\\Node\\DoNode' => __DIR__ . '/..' . '/twig/twig/src/Node/DoNode.php', 'Twig\\Node\\EmbedNode' => __DIR__ . '/..' . '/twig/twig/src/Node/EmbedNode.php', 'Twig\\Node\\Expression\\AbstractExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/AbstractExpression.php', @@ -5214,6 +5217,7 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Twig\\TokenParser\\AbstractTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/AbstractTokenParser.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', 'Twig\\TokenParser\\DoTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/DoTokenParser.php', 'Twig\\TokenParser\\EmbedTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/EmbedTokenParser.php', 'Twig\\TokenParser\\ExtendsTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ExtendsTokenParser.php', @@ -5323,6 +5327,7 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Twig_Node_BlockReference' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/BlockReference.php', 'Twig_Node_Body' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Body.php', 'Twig_Node_CheckSecurity' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/CheckSecurity.php', + 'Twig_Node_Deprecated' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Deprecated.php', 'Twig_Node_Do' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Do.php', 'Twig_Node_Embed' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Embed.php', 'Twig_Node_Expression' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression.php', @@ -5438,6 +5443,7 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Twig_TokenParserInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParserInterface.php', 'Twig_TokenParser_AutoEscape' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/AutoEscape.php', 'Twig_TokenParser_Block' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Block.php', + 'Twig_TokenParser_Deprecated' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Deprecated.php', 'Twig_TokenParser_Do' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Do.php', 'Twig_TokenParser_Embed' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Embed.php', 'Twig_TokenParser_Extends' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Extends.php', @@ -5463,13 +5469,6 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Webmozart\\PathUtil\\Path' => __DIR__ . '/..' . '/webmozart/path-util/src/Path.php', 'Webmozart\\PathUtil\\Url' => __DIR__ . '/..' . '/webmozart/path-util/src/Url.php', 'WhiteHat101\\Crypt\\APR1_MD5' => __DIR__ . '/..' . '/whitehat101/apr1-md5/src/APR1_MD5.php', - 'Wikimedia\\Composer\\Logger' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Logger.php', - 'Wikimedia\\Composer\\MergePlugin' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/MergePlugin.php', - 'Wikimedia\\Composer\\Merge\\ExtraPackage' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Merge/ExtraPackage.php', - 'Wikimedia\\Composer\\Merge\\MissingFileException' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Merge/MissingFileException.php', - 'Wikimedia\\Composer\\Merge\\NestedArray' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Merge/NestedArray.php', - 'Wikimedia\\Composer\\Merge\\PluginState' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Merge/PluginState.php', - 'Wikimedia\\Composer\\Merge\\StabilityFlags' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Merge/StabilityFlags.php', 'XdgBaseDir\\Xdg' => __DIR__ . '/..' . '/dnoegel/php-xdg-base-dir/src/Xdg.php', 'Zend\\Diactoros\\AbstractSerializer' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/AbstractSerializer.php', 'Zend\\Diactoros\\CallbackStream' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/CallbackStream.php', @@ -5496,6 +5495,7 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Zend\\Diactoros\\Response\\SapiStreamEmitter' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/Response/SapiStreamEmitter.php', 'Zend\\Diactoros\\Response\\Serializer' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/Response/Serializer.php', 'Zend\\Diactoros\\Response\\TextResponse' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/Response/TextResponse.php', + 'Zend\\Diactoros\\Response\\XmlResponse' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/Response/XmlResponse.php', 'Zend\\Diactoros\\Server' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/Server.php', 'Zend\\Diactoros\\ServerRequest' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/ServerRequest.php', 'Zend\\Diactoros\\ServerRequestFactory' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/ServerRequestFactory.php', @@ -5552,6 +5552,8 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Zend\\Feed\\Reader\\Extension\\CreativeCommons\\Feed' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Reader/Extension/CreativeCommons/Feed.php', 'Zend\\Feed\\Reader\\Extension\\DublinCore\\Entry' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Reader/Extension/DublinCore/Entry.php', 'Zend\\Feed\\Reader\\Extension\\DublinCore\\Feed' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Reader/Extension/DublinCore/Feed.php', + 'Zend\\Feed\\Reader\\Extension\\GooglePlayPodcast\\Entry' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Reader/Extension/GooglePlayPodcast/Entry.php', + 'Zend\\Feed\\Reader\\Extension\\GooglePlayPodcast\\Feed' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Reader/Extension/GooglePlayPodcast/Feed.php', 'Zend\\Feed\\Reader\\Extension\\Podcast\\Entry' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Reader/Extension/Podcast/Entry.php', 'Zend\\Feed\\Reader\\Extension\\Podcast\\Feed' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Reader/Extension/Podcast/Feed.php', 'Zend\\Feed\\Reader\\Extension\\Slash\\Entry' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Reader/Extension/Slash/Entry.php', @@ -5590,6 +5592,10 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Zend\\Feed\\Writer\\Extension\\Content\\Renderer\\Entry' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Writer/Extension/Content/Renderer/Entry.php', 'Zend\\Feed\\Writer\\Extension\\DublinCore\\Renderer\\Entry' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Entry.php', 'Zend\\Feed\\Writer\\Extension\\DublinCore\\Renderer\\Feed' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php', + 'Zend\\Feed\\Writer\\Extension\\GooglePlayPodcast\\Entry' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Entry.php', + 'Zend\\Feed\\Writer\\Extension\\GooglePlayPodcast\\Feed' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Feed.php', + 'Zend\\Feed\\Writer\\Extension\\GooglePlayPodcast\\Renderer\\Entry' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Renderer/Entry.php', + 'Zend\\Feed\\Writer\\Extension\\GooglePlayPodcast\\Renderer\\Feed' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Renderer/Feed.php', 'Zend\\Feed\\Writer\\Extension\\ITunes\\Entry' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Writer/Extension/ITunes/Entry.php', 'Zend\\Feed\\Writer\\Extension\\ITunes\\Feed' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Writer/Extension/ITunes/Feed.php', 'Zend\\Feed\\Writer\\Extension\\ITunes\\Renderer\\Entry' => __DIR__ . '/..' . '/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Entry.php', @@ -5624,6 +5630,7 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Zend\\Stdlib\\ArrayUtils\\MergeRemoveKey' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php', 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKey' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKey.php', 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKeyInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php', + 'Zend\\Stdlib\\ConsoleHelper' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ConsoleHelper.php', 'Zend\\Stdlib\\DispatchableInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/DispatchableInterface.php', 'Zend\\Stdlib\\ErrorHandler' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ErrorHandler.php', 'Zend\\Stdlib\\Exception\\BadMethodCallException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/BadMethodCallException.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index f97cd336c37e5fc7045fca1b78e7e71097fcde4d..8af622c47438f09a9ec8e54a9168a46c98bee091 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -381,17 +381,17 @@ }, { "name": "composer/semver", - "version": "1.4.2", - "version_normalized": "1.4.2.0", + "version": "1.5.0", + "version_normalized": "1.5.0.0", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e", + "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e", "shasum": "" }, "require": { @@ -401,7 +401,7 @@ "phpunit/phpunit": "^4.5 || ^5.0.5", "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" }, - "time": "2016-08-30T16:08:34+00:00", + "time": "2019-03-19T17:25:45+00:00", "type": "library", "extra": { "branch-alias": { @@ -861,38 +861,38 @@ }, { "name": "doctrine/annotations", - "version": "v1.2.7", - "version_normalized": "1.2.7.0", + "version": "v1.4.0", + "version_normalized": "1.4.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", - "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": ">=5.3.2" + "php": "^5.6 || ^7.0" }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "^5.7" }, - "time": "2015-08-31T12:32:49+00:00", + "time": "2017-02-24T16:22:25+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.4.x-dev" } }, "installation-source": "dist", "autoload": { - "psr-0": { - "Doctrine\\Common\\Annotations\\": "lib/" + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" } }, "notification-url": "https://packagist.org/downloads/", @@ -931,17 +931,17 @@ }, { "name": "doctrine/cache", - "version": "v1.6.1", - "version_normalized": "1.6.1.0", + "version": "v1.6.2", + "version_normalized": "1.6.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3" + "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/b6f544a20f4807e81f7044d31e679ccbb1866dc3", - "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3", + "url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b", + "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b", "shasum": "" }, "require": { @@ -955,7 +955,7 @@ "predis/predis": "~1.0", "satooshi/php-coveralls": "~0.6" }, - "time": "2016-10-29T11:16:17+00:00", + "time": "2017-07-22T12:49:21+00:00", "type": "library", "extra": { "branch-alias": { @@ -1003,30 +1003,31 @@ }, { "name": "doctrine/collections", - "version": "v1.3.0", - "version_normalized": "1.3.0.0", + "version": "v1.4.0", + "version_normalized": "1.4.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", - "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba", + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "doctrine/coding-standard": "~0.1@dev", + "phpunit/phpunit": "^5.7" }, - "time": "2015-04-14T22:21:58+00:00", + "time": "2017-01-03T10:49:41+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "installation-source": "dist", @@ -1071,17 +1072,17 @@ }, { "name": "doctrine/common", - "version": "v2.6.2", - "version_normalized": "2.6.2.0", + "version": "v2.7.3", + "version_normalized": "2.7.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3" + "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/7bce00698899aa2c06fe7365c76e4d78ddb15fa3", - "reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3", + "url": "https://api.github.com/repos/doctrine/common/zipball/4acb8f89626baafede6ee5475bc5844096eba8a9", + "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9", "shasum": "" }, "require": { @@ -1090,12 +1091,12 @@ "doctrine/collections": "1.*", "doctrine/inflector": "1.*", "doctrine/lexer": "1.*", - "php": "~5.5|~7.0" + "php": "~5.6|~7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8|~5.0" + "phpunit/phpunit": "^5.4.6" }, - "time": "2016-11-30T16:50:46+00:00", + "time": "2017-07-22T08:35:12+00:00", "type": "library", "extra": { "branch-alias": { @@ -1146,36 +1147,36 @@ }, { "name": "doctrine/inflector", - "version": "v1.1.0", - "version_normalized": "1.1.0.0", + "version": "v1.2.0", + "version_normalized": "1.2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" + "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", - "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462", + "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "^6.2" }, - "time": "2015-11-06T14:35:42+00:00", + "time": "2017-07-22T12:18:28+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "installation-source": "dist", "autoload": { - "psr-0": { - "Doctrine\\Common\\Inflector\\": "lib/" + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } }, "notification-url": "https://packagist.org/downloads/", @@ -2640,17 +2641,17 @@ }, { "name": "drupal/core", - "version": "8.6.10", - "version_normalized": "8.6.10.0", + "version": "8.6.13", + "version_normalized": "8.6.13.0", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "59568ac02948cf075ee8543e6c6d4386ad8daec1" + "reference": "8d5b80030ac3f13df2d66aeef0ea388fd9a90632" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/59568ac02948cf075ee8543e6c6d4386ad8daec1", - "reference": "59568ac02948cf075ee8543e6c6d4386ad8daec1", + "url": "https://api.github.com/repos/drupal/core/zipball/8d5b80030ac3f13df2d66aeef0ea388fd9a90632", + "reference": "8d5b80030ac3f13df2d66aeef0ea388fd9a90632", "shasum": "" }, "require": { @@ -2693,7 +2694,7 @@ "symfony/translation": "~3.4.0", "symfony/validator": "~3.4.0", "symfony/yaml": "~3.4.5", - "twig/twig": "^1.35.0", + "twig/twig": "^1.38.2", "typo3/phar-stream-wrapper": "^2.0.1", "zendframework/zend-diactoros": "^1.1", "zendframework/zend-feed": "^2.4" @@ -2823,7 +2824,7 @@ "symfony/debug": "^3.4.0", "symfony/phpunit-bridge": "^3.4.3" }, - "time": "2019-02-20T18:35:01+00:00", + "time": "2019-03-20T06:01:19+00:00", "type": "drupal-core", "extra": { "merge-plugin": { @@ -7680,17 +7681,17 @@ }, { "name": "egulias/email-validator", - "version": "1.2.14", - "version_normalized": "1.2.14.0", + "version": "1.2.15", + "version_normalized": "1.2.15.0", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "5642614492f0ca2064c01d60cc33284cc2f731a9" + "reference": "758a77525bdaabd6c0f5669176bd4361cb2dda9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/5642614492f0ca2064c01d60cc33284cc2f731a9", - "reference": "5642614492f0ca2064c01d60cc33284cc2f731a9", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/758a77525bdaabd6c0f5669176bd4361cb2dda9e", + "reference": "758a77525bdaabd6c0f5669176bd4361cb2dda9e", "shasum": "" }, "require": { @@ -7700,7 +7701,7 @@ "require-dev": { "phpunit/phpunit": "^4.8.24" }, - "time": "2017-02-03T22:48:59+00:00", + "time": "2018-09-25T20:59:41+00:00", "type": "library", "extra": { "branch-alias": { @@ -7909,17 +7910,17 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.3.0", - "version_normalized": "6.3.0.0", + "version": "6.3.3", + "version_normalized": "6.3.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", "shasum": "" }, "require": { @@ -7929,17 +7930,17 @@ }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0 || ^5.0", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", "psr/log": "^1.0" }, "suggest": { "psr/log": "Required for using the Log middleware" }, - "time": "2017-06-22T18:50:49+00:00", + "time": "2018-04-22T15:46:56+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "6.2-dev" + "dev-master": "6.3-dev" } }, "installation-source": "dist", @@ -8029,34 +8030,35 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.4.2", - "version_normalized": "1.4.2.0", + "version": "1.5.2", + "version_normalized": "1.5.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + "reference": "9f83dded91781a01c63574e387eaa769be769115" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115", + "reference": "9f83dded91781a01c63574e387eaa769be769115", "shasum": "" }, "require": { "php": ">=5.4.0", - "psr/http-message": "~1.0" + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5" }, "provide": { "psr/http-message-implementation": "1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" }, - "time": "2017-03-20T17:10:46+00:00", + "time": "2018-12-04T20:46:45+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } }, "installation-source": "dist", @@ -8087,6 +8089,7 @@ "keywords": [ "http", "message", + "psr-7", "request", "response", "stream", @@ -8285,33 +8288,35 @@ }, { "name": "masterminds/html5", - "version": "2.3.0", - "version_normalized": "2.3.0.0", + "version": "2.6.0", + "version_normalized": "2.6.0.0", "source": { "type": "git", "url": "https://github.com/Masterminds/html5-php.git", - "reference": "2c37c6c520b995b761674de3be8455a381679067" + "reference": "c961ca6a0a81dc6b55b6859b3f9ea7f402edf9ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/2c37c6c520b995b761674de3be8455a381679067", - "reference": "2c37c6c520b995b761674de3be8455a381679067", + "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/c961ca6a0a81dc6b55b6859b3f9ea7f402edf9ad", + "reference": "c961ca6a0a81dc6b55b6859b3f9ea7f402edf9ad", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-dom": "*", "ext-libxml": "*", "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "4.*", + "phpunit/phpunit": "^4.8.35", "sami/sami": "~2.0", "satooshi/php-coveralls": "1.0.*" }, - "time": "2017-09-04T12:26:28+00:00", + "time": "2019-03-10T11:41:28+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.6-dev" } }, "installation-source": "dist", @@ -8510,17 +8515,17 @@ }, { "name": "paragonie/random_compat", - "version": "v2.0.11", - "version_normalized": "2.0.11.0", + "version": "v2.0.18", + "version_normalized": "2.0.18.0", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", + "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", "shasum": "" }, "require": { @@ -8532,7 +8537,7 @@ "suggest": { "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." }, - "time": "2017-09-27T21:40:39+00:00", + "time": "2019-01-03T20:59:08+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -8554,6 +8559,7 @@ "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", "keywords": [ "csprng", + "polyfill", "pseudorandom", "random" ] @@ -8720,23 +8726,23 @@ }, { "name": "psr/log", - "version": "1.0.2", - "version_normalized": "1.0.2.0", + "version": "1.1.0", + "version_normalized": "1.1.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", "shasum": "" }, "require": { "php": ">=5.3.0" }, - "time": "2016-10-10T12:19:37+00:00", + "time": "2018-11-20T15:27:04+00:00", "type": "library", "extra": { "branch-alias": { @@ -8843,6 +8849,48 @@ "shell" ] }, + { + "name": "ralouphie/getallheaders", + "version": "2.0.5", + "version_normalized": "2.0.5.0", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.0", + "satooshi/php-coveralls": ">=1.0" + }, + "time": "2016-02-11T07:05:27+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders." + }, { "name": "robrichards/xmlseclibs", "version": "3.0.1", @@ -9223,17 +9271,17 @@ }, { "name": "symfony/class-loader", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", - "reference": "31db283fc86d3143e7ff87e922177b457d909c30" + "reference": "4459eef5298dedfb69f771186a580062b8516497" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/class-loader/zipball/31db283fc86d3143e7ff87e922177b457d909c30", - "reference": "31db283fc86d3143e7ff87e922177b457d909c30", + "url": "https://api.github.com/repos/symfony/class-loader/zipball/4459eef5298dedfb69f771186a580062b8516497", + "reference": "4459eef5298dedfb69f771186a580062b8516497", "shasum": "" }, "require": { @@ -9246,7 +9294,7 @@ "suggest": { "symfony/polyfill-apcu": "For using ApcClassLoader on HHVM" }, - "time": "2018-07-26T11:19:56+00:00", + "time": "2019-01-16T09:39:14+00:00", "type": "library", "extra": { "branch-alias": { @@ -9347,17 +9395,17 @@ }, { "name": "symfony/console", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73" + "reference": "71ce77f37af0c5ffb9590e43cc4f70e426945c5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6b217594552b9323bcdcfc14f8a0ce126e84cd73", - "reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73", + "url": "https://api.github.com/repos/symfony/console/zipball/71ce77f37af0c5ffb9590e43cc4f70e426945c5e", + "reference": "71ce77f37af0c5ffb9590e43cc4f70e426945c5e", "shasum": "" }, "require": { @@ -9369,6 +9417,9 @@ "symfony/dependency-injection": "<3.4", "symfony/process": "<3.3" }, + "provide": { + "psr/log-implementation": "1.0" + }, "require-dev": { "psr/log": "~1.0", "symfony/config": "~3.3|~4.0", @@ -9378,12 +9429,12 @@ "symfony/process": "~3.3|~4.0" }, "suggest": { - "psr/log-implementation": "For using the console logger", + "psr/log": "For using the console logger", "symfony/event-dispatcher": "", "symfony/lock": "", "symfony/process": "" }, - "time": "2018-07-26T11:19:56+00:00", + "time": "2019-02-23T15:06:07+00:00", "type": "library", "extra": { "branch-alias": { @@ -9473,17 +9524,17 @@ }, { "name": "symfony/debug", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc" + "reference": "8d8a9e877b3fcdc50ddecf8dcea146059753f782" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/d5a058ff6ecad26b30c1ba452241306ea34c65cc", - "reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc", + "url": "https://api.github.com/repos/symfony/debug/zipball/8d8a9e877b3fcdc50ddecf8dcea146059753f782", + "reference": "8d8a9e877b3fcdc50ddecf8dcea146059753f782", "shasum": "" }, "require": { @@ -9496,7 +9547,7 @@ "require-dev": { "symfony/http-kernel": "~2.8|~3.0|~4.0" }, - "time": "2018-07-26T11:19:56+00:00", + "time": "2019-02-24T15:45:11+00:00", "type": "library", "extra": { "branch-alias": { @@ -9531,17 +9582,17 @@ }, { "name": "symfony/dependency-injection", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "1c0e679e522591fd744fdf242fec41a43d62b2b1" + "reference": "c3dd7b7ea8cd8ec12304a5e222d7dc01cac8fa11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1c0e679e522591fd744fdf242fec41a43d62b2b1", - "reference": "1c0e679e522591fd744fdf242fec41a43d62b2b1", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/c3dd7b7ea8cd8ec12304a5e222d7dc01cac8fa11", + "reference": "c3dd7b7ea8cd8ec12304a5e222d7dc01cac8fa11", "shasum": "" }, "require": { @@ -9569,7 +9620,7 @@ "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", "symfony/yaml": "" }, - "time": "2018-07-29T15:19:31+00:00", + "time": "2019-02-23T15:06:07+00:00", "type": "library", "extra": { "branch-alias": { @@ -9663,17 +9714,17 @@ }, { "name": "symfony/event-dispatcher", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb" + "reference": "ec625e2fff7f584eeb91754821807317b2e79236" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb", - "reference": "b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ec625e2fff7f584eeb91754821807317b2e79236", + "reference": "ec625e2fff7f584eeb91754821807317b2e79236", "shasum": "" }, "require": { @@ -9693,7 +9744,7 @@ "symfony/dependency-injection": "", "symfony/http-kernel": "" }, - "time": "2018-07-26T09:06:28+00:00", + "time": "2019-02-23T15:06:07+00:00", "type": "library", "extra": { "branch-alias": { @@ -9831,17 +9882,17 @@ }, { "name": "symfony/http-foundation", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6" + "reference": "9a96d77ceb1fd913c9d4a89e8a7e1be87604be8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6", - "reference": "19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/9a96d77ceb1fd913c9d4a89e8a7e1be87604be8a", + "reference": "9a96d77ceb1fd913c9d4a89e8a7e1be87604be8a", "shasum": "" }, "require": { @@ -9852,7 +9903,7 @@ "require-dev": { "symfony/expression-language": "~2.8|~3.0|~4.0" }, - "time": "2018-08-01T14:04:26+00:00", + "time": "2019-02-23T15:06:07+00:00", "type": "library", "extra": { "branch-alias": { @@ -9887,23 +9938,23 @@ }, { "name": "symfony/http-kernel", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "8e84cc498f0ffecfbabdea78b87828fd66189544" + "reference": "0362368c761cb8d9c79e56ab0db61d2c692db594" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/8e84cc498f0ffecfbabdea78b87828fd66189544", - "reference": "8e84cc498f0ffecfbabdea78b87828fd66189544", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/0362368c761cb8d9c79e56ab0db61d2c692db594", + "reference": "0362368c761cb8d9c79e56ab0db61d2c692db594", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0", - "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/debug": "^3.3.3|~4.0", "symfony/event-dispatcher": "~2.8|~3.0|~4.0", "symfony/http-foundation": "~3.4.12|~4.0.12|^4.1.1", "symfony/polyfill-ctype": "~1.8" @@ -9943,7 +9994,7 @@ "symfony/finder": "", "symfony/var-dumper": "" }, - "time": "2018-08-01T14:47:47+00:00", + "time": "2019-03-03T18:52:34+00:00", "type": "library", "extra": { "branch-alias": { @@ -9978,27 +10029,30 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.8.0", - "version_normalized": "1.8.0.0", + "version": "v1.10.0", + "version_normalized": "1.10.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2018-04-30T19:57:29+00:00", + "suggest": { + "ext-ctype": "For best performance" + }, + "time": "2018-08-06T14:22:27+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "installation-source": "dist", @@ -10021,7 +10075,7 @@ }, { "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" + "email": "backendtea@gmail.com" } ], "description": "Symfony polyfill for ctype functions", @@ -10035,17 +10089,17 @@ }, { "name": "symfony/polyfill-iconv", - "version": "v1.8.0", - "version_normalized": "1.8.0.0", + "version": "v1.10.0", + "version_normalized": "1.10.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "7cb8436a814d5b0fcf292810ee26f8b0cb47584d" + "reference": "97001cfc283484c9691769f51cdf25259037eba2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/7cb8436a814d5b0fcf292810ee26f8b0cb47584d", - "reference": "7cb8436a814d5b0fcf292810ee26f8b0cb47584d", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/97001cfc283484c9691769f51cdf25259037eba2", + "reference": "97001cfc283484c9691769f51cdf25259037eba2", "shasum": "" }, "require": { @@ -10054,11 +10108,11 @@ "suggest": { "ext-iconv": "For best performance" }, - "time": "2018-04-26T10:06:28+00:00", + "time": "2018-09-21T06:26:08+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "installation-source": "dist", @@ -10096,17 +10150,17 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", - "version_normalized": "1.8.0.0", + "version": "v1.10.0", + "version_normalized": "1.10.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", "shasum": "" }, "require": { @@ -10115,11 +10169,11 @@ "suggest": { "ext-mbstring": "For best performance" }, - "time": "2018-04-26T10:06:28+00:00", + "time": "2018-09-21T13:07:52+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "installation-source": "dist", @@ -10157,28 +10211,28 @@ }, { "name": "symfony/polyfill-php70", - "version": "v1.8.0", - "version_normalized": "1.8.0.0", + "version": "v1.10.0", + "version_normalized": "1.10.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6" + "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/77454693d8f10dd23bb24955cffd2d82db1007a6", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/6b88000cdd431cd2e940caa2cb569201f3f84224", + "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0", + "paragonie/random_compat": "~1.0|~2.0|~9.99", "php": ">=5.3.3" }, - "time": "2018-04-26T10:06:28+00:00", + "time": "2018-09-21T06:26:08+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "installation-source": "dist", @@ -10218,23 +10272,23 @@ }, { "name": "symfony/process", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f" + "reference": "009f8dda80930e89e8344a4e310b08f9ff07dd2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/0414db29bd770ec5a4152683e655f55efd4fa60f", - "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f", + "url": "https://api.github.com/repos/symfony/process/zipball/009f8dda80930e89e8344a4e310b08f9ff07dd2e", + "reference": "009f8dda80930e89e8344a4e310b08f9ff07dd2e", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, - "time": "2018-07-26T11:19:56+00:00", + "time": "2019-01-16T13:27:11+00:00", "type": "library", "extra": { "branch-alias": { @@ -10269,43 +10323,46 @@ }, { "name": "symfony/psr-http-message-bridge", - "version": "v1.0.2", - "version_normalized": "1.0.2.0", + "version": "v1.1.1", + "version_normalized": "1.1.1.0", "source": { "type": "git", "url": "https://github.com/symfony/psr-http-message-bridge.git", - "reference": "c2b757934f2d9681a287e662efbc27c41fe8ef86" + "reference": "921f8669c36ea0148d2520c0bb7838cda14879e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/c2b757934f2d9681a287e662efbc27c41fe8ef86", - "reference": "c2b757934f2d9681a287e662efbc27c41fe8ef86", + "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/921f8669c36ea0148d2520c0bb7838cda14879e0", + "reference": "921f8669c36ea0148d2520c0bb7838cda14879e0", "shasum": "" }, "require": { - "php": ">=5.3.3", - "psr/http-message": "~1.0", - "symfony/http-foundation": "~2.3|~3.0|~4.0" + "php": "^5.3.3 || ^7.0", + "psr/http-message": "^1.0", + "symfony/http-foundation": "^2.3.42 || ^3.4 || ^4.0" }, "require-dev": { - "symfony/phpunit-bridge": "~3.2|4.0" + "nyholm/psr7": "^1.1", + "symfony/phpunit-bridge": "^3.4 || ^4.0" }, "suggest": { - "psr/http-message-implementation": "To use the HttpFoundation factory", - "zendframework/zend-diactoros": "To use the Zend Diactoros factory" + "nyholm/psr7": "For a super lightweight PSR-7/17 implementation" }, - "time": "2017-12-19T00:31:44+00:00", + "time": "2019-03-11T15:23:15+00:00", "type": "symfony-bridge", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.1-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { "Symfony\\Bridge\\PsrHttpMessage\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -10326,22 +10383,23 @@ "keywords": [ "http", "http-message", + "psr-17", "psr-7" ] }, { "name": "symfony/routing", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "e20f4bb79502c3c0db86d572f7683a30d4143911" + "reference": "6b25a86df5860461ff1990946168c0ef944f83db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/e20f4bb79502c3c0db86d572f7683a30d4143911", - "reference": "e20f4bb79502c3c0db86d572f7683a30d4143911", + "url": "https://api.github.com/repos/symfony/routing/zipball/6b25a86df5860461ff1990946168c0ef944f83db", + "reference": "6b25a86df5860461ff1990946168c0ef944f83db", "shasum": "" }, "require": { @@ -10369,7 +10427,7 @@ "symfony/http-foundation": "For using a Symfony Request object", "symfony/yaml": "For using the YAML loader" }, - "time": "2018-07-26T11:19:56+00:00", + "time": "2019-02-23T15:06:07+00:00", "type": "library", "extra": { "branch-alias": { @@ -10410,17 +10468,17 @@ }, { "name": "symfony/serializer", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "40031683816470610af87c2d03ea86d1cf0f0104" + "reference": "964b7a59002391136fb0087fd5dc41213f7c283e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/40031683816470610af87c2d03ea86d1cf0f0104", - "reference": "40031683816470610af87c2d03ea86d1cf0f0104", + "url": "https://api.github.com/repos/symfony/serializer/zipball/964b7a59002391136fb0087fd5dc41213f7c283e", + "reference": "964b7a59002391136fb0087fd5dc41213f7c283e", "shasum": "" }, "require": { @@ -10456,7 +10514,7 @@ "symfony/property-info": "To deserialize relations.", "symfony/yaml": "For using the default YAML mapping loader." }, - "time": "2018-07-26T11:58:24+00:00", + "time": "2019-02-23T15:06:07+00:00", "type": "library", "extra": { "branch-alias": { @@ -10491,17 +10549,17 @@ }, { "name": "symfony/translation", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "9749930bfc825139aadd2d28461ddbaed6577862" + "reference": "3e2966209567ffed8825905b53fc8548446130aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/9749930bfc825139aadd2d28461ddbaed6577862", - "reference": "9749930bfc825139aadd2d28461ddbaed6577862", + "url": "https://api.github.com/repos/symfony/translation/zipball/3e2966209567ffed8825905b53fc8548446130aa", + "reference": "3e2966209567ffed8825905b53fc8548446130aa", "shasum": "" }, "require": { @@ -10526,7 +10584,7 @@ "symfony/config": "", "symfony/yaml": "" }, - "time": "2018-07-26T11:19:56+00:00", + "time": "2019-02-23T15:06:07+00:00", "type": "library", "extra": { "branch-alias": { @@ -10561,17 +10619,17 @@ }, { "name": "symfony/validator", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "364b818b5cc813282f19fefb364c24424210634a" + "reference": "21f8a7da6d4d8e6e34bd4e2bfaa24fa373886907" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/364b818b5cc813282f19fefb364c24424210634a", - "reference": "364b818b5cc813282f19fefb364c24424210634a", + "url": "https://api.github.com/repos/symfony/validator/zipball/21f8a7da6d4d8e6e34bd4e2bfaa24fa373886907", + "reference": "21f8a7da6d4d8e6e34bd4e2bfaa24fa373886907", "shasum": "" }, "require": { @@ -10613,7 +10671,7 @@ "symfony/property-access": "For accessing properties within comparison constraints", "symfony/yaml": "" }, - "time": "2018-07-26T11:58:24+00:00", + "time": "2019-02-25T09:32:21+00:00", "type": "library", "extra": { "branch-alias": { @@ -10719,17 +10777,17 @@ }, { "name": "symfony/yaml", - "version": "v3.4.14", - "version_normalized": "3.4.14.0", + "version": "v3.4.23", + "version_normalized": "3.4.23.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2" + "reference": "57f1ce82c997f5a8701b89ef970e36bb657fd09c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", - "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", + "url": "https://api.github.com/repos/symfony/yaml/zipball/57f1ce82c997f5a8701b89ef970e36bb657fd09c", + "reference": "57f1ce82c997f5a8701b89ef970e36bb657fd09c", "shasum": "" }, "require": { @@ -10745,7 +10803,7 @@ "suggest": { "symfony/console": "For validating YAML files using the lint command" }, - "time": "2018-07-26T11:19:56+00:00", + "time": "2019-02-23T15:06:07+00:00", "type": "library", "extra": { "branch-alias": { @@ -10837,32 +10895,33 @@ }, { "name": "twig/twig", - "version": "v1.35.3", - "version_normalized": "1.35.3.0", + "version": "v1.38.2", + "version_normalized": "1.38.2.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f" + "reference": "874adbd9222f928f6998732b25b01b41dff15b0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/b48680b6eb7d16b5025b9bfc4108d86f6b8af86f", - "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/874adbd9222f928f6998732b25b01b41dff15b0c", + "reference": "874adbd9222f928f6998732b25b01b41dff15b0c", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.4.0", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { "psr/container": "^1.0", "symfony/debug": "^2.7", - "symfony/phpunit-bridge": "^3.3" + "symfony/phpunit-bridge": "^3.4.19|^4.1.8" }, - "time": "2018-03-20T04:25:58+00:00", + "time": "2019-03-12T18:45:24+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.35-dev" + "dev-master": "1.38-dev" } }, "installation-source": "dist", @@ -10892,12 +10951,12 @@ }, { "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", + "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", + "homepage": "https://twig.symfony.com", "keywords": [ "templating" ] @@ -10944,111 +11003,6 @@ "stream-wrapper" ] }, - { - "name": "webflo/drupal-core-strict", - "version": "8.5.6", - "version_normalized": "8.5.6.0", - "source": { - "type": "git", - "url": "https://github.com/webflo/drupal-core-strict.git", - "reference": "e95610956f961f4421fd9a36849dcd6e2b55f4fe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webflo/drupal-core-strict/zipball/e95610956f961f4421fd9a36849dcd6e2b55f4fe", - "reference": "e95610956f961f4421fd9a36849dcd6e2b55f4fe", - "shasum": "" - }, - "require": { - "asm89/stack-cors": "1.2.0", - "composer/installers": "v1.5.0", - "composer/semver": "1.4.2", - "doctrine/annotations": "v1.2.7", - "doctrine/cache": "v1.6.1", - "doctrine/collections": "v1.3.0", - "doctrine/common": "v2.6.2", - "doctrine/inflector": "v1.1.0", - "doctrine/lexer": "v1.0.1", - "easyrdf/easyrdf": "0.9.1", - "egulias/email-validator": "1.2.14", - "guzzlehttp/guzzle": "6.3.0", - "guzzlehttp/promises": "v1.3.1", - "guzzlehttp/psr7": "1.4.2", - "masterminds/html5": "2.3.0", - "paragonie/random_compat": "v2.0.11", - "psr/container": "1.0.0", - "psr/http-message": "1.0.1", - "psr/log": "1.0.2", - "stack/builder": "v1.0.5", - "symfony-cmf/routing": "1.4.1", - "symfony/class-loader": "v3.4.14", - "symfony/console": "v3.4.14", - "symfony/debug": "v3.4.14", - "symfony/dependency-injection": "v3.4.14", - "symfony/event-dispatcher": "v3.4.14", - "symfony/http-foundation": "v3.4.14", - "symfony/http-kernel": "v3.4.14", - "symfony/polyfill-ctype": "v1.8.0", - "symfony/polyfill-iconv": "v1.8.0", - "symfony/polyfill-mbstring": "v1.8.0", - "symfony/polyfill-php70": "v1.8.0", - "symfony/process": "v3.4.14", - "symfony/psr-http-message-bridge": "v1.0.2", - "symfony/routing": "v3.4.14", - "symfony/serializer": "v3.4.14", - "symfony/translation": "v3.4.14", - "symfony/validator": "v3.4.14", - "symfony/yaml": "v3.4.14", - "twig/twig": "v1.35.3", - "wikimedia/composer-merge-plugin": "v1.4.1", - "zendframework/zend-diactoros": "1.4.1", - "zendframework/zend-escaper": "2.5.2", - "zendframework/zend-feed": "2.7.0", - "zendframework/zend-stdlib": "3.0.1" - }, - "require-dev": { - "behat/mink": "dev-master#9ea1cebe3dc529ba3861d87c818f045362c40484", - "behat/mink-browserkit-driver": "v1.3.2", - "behat/mink-goutte-driver": "v1.2.1", - "behat/mink-selenium2-driver": "dev-master#93474c65a2a7bf959200ab5f7a14cc450645c185", - "doctrine/instantiator": "1.0.5", - "drupal/coder": "8.2.12", - "fabpot/goutte": "v3.2.1", - "instaclick/php-webdriver": "1.4.5", - "ircmaxell/password-compat": "v1.0.4", - "jcalderonzumba/gastonjs": "v1.0.2", - "jcalderonzumba/mink-phantomjs-driver": "v0.3.2", - "mikey179/vfsstream": "v1.6.5", - "phpdocumentor/reflection-docblock": "2.0.4", - "phpspec/prophecy": "v1.7.0", - "phpunit/php-code-coverage": "2.2.4", - "phpunit/php-file-iterator": "1.4.2", - "phpunit/php-text-template": "1.2.1", - "phpunit/php-timer": "1.0.9", - "phpunit/php-token-stream": "1.4.11", - "phpunit/phpunit": "4.8.36", - "phpunit/phpunit-mock-objects": "2.3.8", - "sebastian/comparator": "1.2.4", - "sebastian/diff": "1.4.1", - "sebastian/environment": "1.3.8", - "sebastian/exporter": "1.2.2", - "sebastian/global-state": "1.1.1", - "sebastian/recursion-context": "1.0.5", - "sebastian/version": "1.0.6", - "squizlabs/php_codesniffer": "2.8.1", - "symfony/browser-kit": "v3.4.14", - "symfony/css-selector": "v3.4.14", - "symfony/dom-crawler": "v3.4.14", - "symfony/phpunit-bridge": "v3.4.14" - }, - "time": "2018-08-01T21:00:49+00:00", - "type": "metapackage", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0-or-later" - ], - "description": "Locked core dependencies" - }, { "name": "webflo/drupal-finder", "version": "1.1.0", @@ -11234,75 +11188,24 @@ "apr1" ] }, - { - "name": "wikimedia/composer-merge-plugin", - "version": "v1.4.1", - "version_normalized": "1.4.1.0", - "source": { - "type": "git", - "url": "https://github.com/wikimedia/composer-merge-plugin.git", - "reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/81c6ac72a24a67383419c7eb9aa2b3437f2ab100", - "reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0", - "php": ">=5.3.2" - }, - "require-dev": { - "composer/composer": "~1.0.0", - "jakub-onderka/php-parallel-lint": "~0.8", - "phpunit/phpunit": "~4.8|~5.0", - "squizlabs/php_codesniffer": "~2.1.0" - }, - "time": "2017-04-25T02:31:25+00:00", - "type": "composer-plugin", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - }, - "class": "Wikimedia\\Composer\\MergePlugin" - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Wikimedia\\Composer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bryan Davis", - "email": "bd808@wikimedia.org" - } - ], - "description": "Composer plugin to merge multiple composer.json files" - }, { "name": "zendframework/zend-diactoros", - "version": "1.4.1", - "version_normalized": "1.4.1.0", + "version": "1.8.6", + "version_normalized": "1.8.6.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-diactoros.git", - "reference": "424a840dc3bedcdeea510b42e056c77c2d6c4bef" + "reference": "20da13beba0dde8fb648be3cc19765732790f46e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/424a840dc3bedcdeea510b42e056c77c2d6c4bef", - "reference": "424a840dc3bedcdeea510b42e056c77c2d6c4bef", + "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/20da13beba0dde8fb648be3cc19765732790f46e", + "reference": "20da13beba0dde8fb648be3cc19765732790f46e", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0", - "psr/http-message": "~1.0" + "php": "^5.6 || ^7.0", + "psr/http-message": "^1.0" }, "provide": { "psr/http-message-implementation": "1.0" @@ -11310,19 +11213,31 @@ "require-dev": { "ext-dom": "*", "ext-libxml": "*", - "phpunit/phpunit": "^4.6 || ^5.5", - "zendframework/zend-coding-standard": "~1.0.0" + "php-http/psr7-integration-tests": "dev-master", + "phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7", + "zendframework/zend-coding-standard": "~1.0" }, - "time": "2017-08-17T21:21:00+00:00", + "time": "2018-09-05T19:29:37+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev", - "dev-develop": "1.5-dev" + "dev-master": "1.8.x-dev", + "dev-develop": "1.9.x-dev", + "dev-release-2.0": "2.0.x-dev" } }, "installation-source": "dist", "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php" + ], "psr-4": { "Zend\\Diactoros\\": "src/" } @@ -11341,32 +11256,32 @@ }, { "name": "zendframework/zend-escaper", - "version": "2.5.2", - "version_normalized": "2.5.2.0", + "version": "2.6.0", + "version_normalized": "2.6.0.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-escaper.git", - "reference": "2dcd14b61a72d8b8e27d579c6344e12c26141d4e" + "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/2dcd14b61a72d8b8e27d579c6344e12c26141d4e", - "reference": "2dcd14b61a72d8b8e27d579c6344e12c26141d4e", + "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/31d8aafae982f9568287cb4dce987e6aff8fd074", + "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074", "shasum": "" }, "require": { - "php": ">=5.5" + "php": "^5.6 || ^7.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0" }, - "time": "2016-06-30T19:48:38+00:00", + "time": "2018-04-25T15:48:53+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" + "dev-master": "2.6.x-dev", + "dev-develop": "2.7.x-dev" } }, "installation-source": "dist", @@ -11379,56 +11294,59 @@ "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zend-escaper", + "description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs", "keywords": [ + "ZendFramework", "escaper", - "zf2" + "zf" ] }, { "name": "zendframework/zend-feed", - "version": "2.7.0", - "version_normalized": "2.7.0.0", + "version": "2.12.0", + "version_normalized": "2.12.0.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-feed.git", - "reference": "12b328d382aa5200f1de53d4147033b885776b67" + "reference": "d926c5af34b93a0121d5e2641af34ddb1533d733" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-feed/zipball/12b328d382aa5200f1de53d4147033b885776b67", - "reference": "12b328d382aa5200f1de53d4147033b885776b67", + "url": "https://api.github.com/repos/zendframework/zend-feed/zipball/d926c5af34b93a0121d5e2641af34ddb1533d733", + "reference": "d926c5af34b93a0121d5e2641af34ddb1533d733", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "zendframework/zend-escaper": "^2.5", - "zendframework/zend-stdlib": "^2.7 || ^3.0" + "ext-dom": "*", + "ext-libxml": "*", + "php": "^5.6 || ^7.0", + "zendframework/zend-escaper": "^2.5.2", + "zendframework/zend-stdlib": "^3.2.1" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "psr/http-message": "^1.0", - "zendframework/zend-cache": "^2.5", - "zendframework/zend-db": "^2.5", - "zendframework/zend-http": "^2.5", - "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", - "zendframework/zend-validator": "^2.5" + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "psr/http-message": "^1.0.1", + "zendframework/zend-cache": "^2.7.2", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-db": "^2.8.2", + "zendframework/zend-http": "^2.7", + "zendframework/zend-servicemanager": "^2.7.8 || ^3.3", + "zendframework/zend-validator": "^2.10.1" }, "suggest": { - "psr/http-message": "PSR-7 ^1.0, if you wish to use Zend\\Feed\\Reader\\Http\\Psr7ResponseDecorator", + "psr/http-message": "PSR-7 ^1.0.1, if you wish to use Zend\\Feed\\Reader\\Http\\Psr7ResponseDecorator", "zendframework/zend-cache": "Zend\\Cache component, for optionally caching feeds between requests", "zendframework/zend-db": "Zend\\Db component, for use with PubSubHubbub", "zendframework/zend-http": "Zend\\Http for PubSubHubbub, and optionally for use with Zend\\Feed\\Reader", "zendframework/zend-servicemanager": "Zend\\ServiceManager component, for easily extending ExtensionManager implementations", - "zendframework/zend-validator": "Zend\\Validator component, for validating email addresses used in Atom feeds and entries ehen using the Writer subcomponent" + "zendframework/zend-validator": "Zend\\Validator component, for validating email addresses used in Atom feeds and entries when using the Writer subcomponent" }, - "time": "2016-02-11T18:54:29+00:00", + "time": "2019-03-05T20:08:49+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev", - "dev-develop": "2.8-dev" + "dev-master": "2.12.x-dev", + "dev-develop": "2.13.x-dev" } }, "installation-source": "dist", @@ -11442,41 +11360,41 @@ "BSD-3-Clause" ], "description": "provides functionality for consuming RSS and Atom feeds", - "homepage": "https://github.com/zendframework/zend-feed", "keywords": [ + "ZendFramework", "feed", - "zf2" + "zf" ] }, { "name": "zendframework/zend-stdlib", - "version": "3.0.1", - "version_normalized": "3.0.1.0", + "version": "3.2.1", + "version_normalized": "3.2.1.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-stdlib.git", - "reference": "8bafa58574204bdff03c275d1d618aaa601588ae" + "reference": "66536006722aff9e62d1b331025089b7ec71c065" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/8bafa58574204bdff03c275d1d618aaa601588ae", - "reference": "8bafa58574204bdff03c275d1d618aaa601588ae", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/66536006722aff9e62d1b331025089b7ec71c065", + "reference": "66536006722aff9e62d1b331025089b7ec71c065", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0" + "php": "^5.6 || ^7.0" }, "require-dev": { - "athletic/athletic": "~0.1", - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0" + "phpbench/phpbench": "^0.13", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0" }, - "time": "2016-04-12T21:19:36+00:00", + "time": "2018-08-28T21:34:05+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev", - "dev-develop": "3.1-dev" + "dev-master": "3.2.x-dev", + "dev-develop": "3.3.x-dev" } }, "installation-source": "dist", @@ -11489,10 +11407,11 @@ "license": [ "BSD-3-Clause" ], - "homepage": "https://github.com/zendframework/zend-stdlib", + "description": "SPL extensions, array utilities, error handlers, and more", "keywords": [ + "ZendFramework", "stdlib", - "zf2" + "zf" ] } ] diff --git a/vendor/composer/semver/CHANGELOG.md b/vendor/composer/semver/CHANGELOG.md index febedc97385613c18a930690f4ce556aed75fbbb..e5009d7b62892a65925bfaecdbdbbf1a054ffa82 100644 --- a/vendor/composer/semver/CHANGELOG.md +++ b/vendor/composer/semver/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +### [1.5.0] 2019-03-19 + + * Added: some support for date versions (e.g. 201903) in `~` operator + * Fixed: support for stabilities in `~` operator was inconsistent + ### [1.4.2] 2016-08-30 * Fixed: collapsing of complex constraints lead to buggy constraints @@ -57,6 +62,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Namespace: `Composer\Test\Package\LinkConstraint` -> `Composer\Test\Semver\Constraint` * Changed: code style using php-cs-fixer. +[1.4.2]: https://github.com/composer/semver/compare/1.4.1...1.4.2 [1.4.1]: https://github.com/composer/semver/compare/1.4.0...1.4.1 [1.4.0]: https://github.com/composer/semver/compare/1.3.0...1.4.0 [1.3.0]: https://github.com/composer/semver/compare/1.2.0...1.3.0 diff --git a/vendor/composer/semver/src/Constraint/AbstractConstraint.php b/vendor/composer/semver/src/Constraint/AbstractConstraint.php index be83f750be2c3534222934a49fa86c9b757ef0cd..7b5270fa350acaf0b5cc57abd807b6af46410474 100644 --- a/vendor/composer/semver/src/Constraint/AbstractConstraint.php +++ b/vendor/composer/semver/src/Constraint/AbstractConstraint.php @@ -11,7 +11,7 @@ namespace Composer\Semver\Constraint; -trigger_error('The ' . __CLASS__ . ' abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED); +trigger_error('The ' . __NAMESPACE__ . '\AbstractConstraint abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED); /** * Base constraint class. diff --git a/vendor/composer/semver/src/VersionParser.php b/vendor/composer/semver/src/VersionParser.php index 359c18c4686e11004e4a74a0ec6ea54dd518981a..475e9cc0f93ca93ebf64055630bb58ffb1d60a1e 100644 --- a/vendor/composer/semver/src/VersionParser.php +++ b/vendor/composer/semver/src/VersionParser.php @@ -322,11 +322,11 @@ private function parseConstraint($constraint) } // Work out which position in the version we are operating at - if (isset($matches[4]) && '' !== $matches[4]) { + if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) { $position = 4; - } elseif (isset($matches[3]) && '' !== $matches[3]) { + } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) { $position = 3; - } elseif (isset($matches[2]) && '' !== $matches[2]) { + } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) { $position = 2; } else { $position = 1; @@ -334,19 +334,11 @@ private function parseConstraint($constraint) // Calculate the stability suffix $stabilitySuffix = ''; - if (!empty($matches[5])) { - $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : ''); - } - - if (!empty($matches[7])) { + if (empty($matches[5]) && empty($matches[7])) { $stabilitySuffix .= '-dev'; } - if (!$stabilitySuffix) { - $stabilitySuffix = '-dev'; - } - - $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix; + $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1)); $lowerBound = new Constraint('>=', $lowVersion); // For upper bound, we increment the position of one more significance, @@ -368,9 +360,9 @@ private function parseConstraint($constraint) // versions 0.X >=0.1.0, and no updates for versions 0.0.X if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) { // Work out which position in the version we are operating at - if ('0' !== $matches[1] || '' === $matches[2]) { + if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) { $position = 1; - } elseif ('0' !== $matches[2] || '' === $matches[3]) { + } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) { $position = 2; } else { $position = 3; @@ -401,9 +393,9 @@ private function parseConstraint($constraint) // Any of X, x, or * may be used to "stand in" for one of the numeric values in the [major, minor, patch] tuple. // A partial version range is treated as an X-Range, so the special character is in fact optional. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) { - if (isset($matches[3]) && '' !== $matches[3]) { + if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) { $position = 3; - } elseif (isset($matches[2]) && '' !== $matches[2]) { + } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) { $position = 2; } else { $position = 1; diff --git a/vendor/doctrine/annotations/CHANGELOG.md b/vendor/doctrine/annotations/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..c09ebe60107ef2d316321cef1c1bccf5c0545df7 --- /dev/null +++ b/vendor/doctrine/annotations/CHANGELOG.md @@ -0,0 +1,115 @@ +## Changelog + + +### 1.4.0 + +This release fix an issue were some annotations could be not loaded if the namespace in the use statement started with a backslash. +It also update the tests and drop the support for php 5.X + +- [115: Missing annotations with the latest composer version](https://github.com/doctrine/annotations/issues/115) thanks to @pascalporedda +- [120: Missing annotations with the latest composer version](https://github.com/doctrine/annotations/pull/120) thanks to @gnat42 +- [121: Adding a more detailed explanation of the test](https://github.com/doctrine/annotations/pull/121) thanks to @mikeSimonson +- [101: Test annotation parameters containing space](https://github.com/doctrine/annotations/pull/101) thanks to @mikeSimonson +- [111: Cleanup: move to correct phpunit assertions](https://github.com/doctrine/annotations/pull/111) thanks to @Ocramius +- [112: Removes support for PHP 5.x](https://github.com/doctrine/annotations/pull/112) thanks to @railto +- [113: bumped phpunit version to 5.7](https://github.com/doctrine/annotations/pull/113) thanks to @gabbydgab +- [114: Enhancement: Use SVG Travis build badge](https://github.com/doctrine/annotations/pull/114) thanks to @localheinz +- [118: Integrating PHPStan](https://github.com/doctrine/annotations/pull/118) thanks to @ondrejmirtes + +### 1.3.1 - 2016-12-30 + +This release fixes an issue with ignored annotations that were already +autoloaded, causing the `SimpleAnnotationReader` to pick them up +anyway. [#110](https://github.com/doctrine/annotations/pull/110) + +Additionally, an issue was fixed in the `CachedReader`, which was +not correctly checking the freshness of cached annotations when +traits were defined on a class. [#105](https://github.com/doctrine/annotations/pull/105) + +Total issues resolved: **2** + +- [105: Return single max timestamp](https://github.com/doctrine/annotations/pull/105) +- [110: setIgnoreNotImportedAnnotations(true) didn’t work for existing classes](https://github.com/doctrine/annotations/pull/110) + +### 1.3.0 + +This release introduces a PHP version bump. `doctrine/annotations` now requires PHP +5.6 or later to be installed. + +A series of additional improvements have been introduced: + + * support for PHP 7 "grouped use statements" + * support for ignoring entire namespace names + via `Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredNamespace()` and + `Doctrine\Common\Annotations\DocParser::setIgnoredAnnotationNamespaces()`. This will + allow you to ignore annotations from namespaces that you cannot autoload + * testing all parent classes and interfaces when checking if the annotation cache + in the `CachedReader` is fresh + * simplifying the cache keys used by the `CachedReader`: keys are no longer artificially + namespaced, since `Doctrine\Common\Cache` already supports that + * corrected parsing of multibyte strings when `mbstring.func_overload` is enabled + * corrected parsing of annotations when `"\t"` is put before the first annotation + in a docblock + * allow skipping non-imported annotations when a custom `DocParser` is passed to + the `AnnotationReader` constructor + +Total issues resolved: **15** + +- [45: DocParser can now ignore whole namespaces](https://github.com/doctrine/annotations/pull/45) +- [57: Switch to the docker-based infrastructure on Travis](https://github.com/doctrine/annotations/pull/57) +- [59: opcache.load_comments has been removed from PHP 7](https://github.com/doctrine/annotations/pull/59) +- [62: [CachedReader\ Test traits and parent class to see if cache is fresh](https://github.com/doctrine/annotations/pull/62) +- [65: Remove cache salt making key unnecessarily long](https://github.com/doctrine/annotations/pull/65) +- [66: Fix of incorrect parsing multibyte strings](https://github.com/doctrine/annotations/pull/66) +- [68: Annotations that are indented by tab are not processed.](https://github.com/doctrine/annotations/issues/68) +- [69: Support for Group Use Statements](https://github.com/doctrine/annotations/pull/69) +- [70: Allow tab character before first annotation in DocBlock](https://github.com/doctrine/annotations/pull/70) +- [74: Ignore not registered annotations fix](https://github.com/doctrine/annotations/pull/74) +- [92: Added tests for AnnotationRegistry class.](https://github.com/doctrine/annotations/pull/92) +- [96: Fix/#62 check trait and parent class ttl in annotations](https://github.com/doctrine/annotations/pull/96) +- [97: Feature - #45 - allow ignoring entire namespaces](https://github.com/doctrine/annotations/pull/97) +- [98: Enhancement/#65 remove cache salt from cached reader](https://github.com/doctrine/annotations/pull/98) +- [99: Fix - #70 - allow tab character before first annotation in docblock](https://github.com/doctrine/annotations/pull/99) + +### 1.2.4 + +Total issues resolved: **1** + +- [51: FileCacheReader::saveCacheFile::unlink fix](https://github.com/doctrine/annotations/pull/51) + +### 1.2.3 + +Total issues resolved: [**2**](https://github.com/doctrine/annotations/milestones/v1.2.3) + +- [49: #46 - applying correct `chmod()` to generated cache file](https://github.com/doctrine/annotations/pull/49) +- [50: Hotfix: match escaped quotes (revert #44)](https://github.com/doctrine/annotations/pull/50) + +### 1.2.2 + +Total issues resolved: **4** + +- [43: Exclude files from distribution with .gitattributes](https://github.com/doctrine/annotations/pull/43) +- [44: Update DocLexer.php](https://github.com/doctrine/annotations/pull/44) +- [46: A plain "file_put_contents" can cause havoc](https://github.com/doctrine/annotations/pull/46) +- [48: Deprecating the `FileCacheReader` in 1.2.2: will be removed in 2.0.0](https://github.com/doctrine/annotations/pull/48) + +### 1.2.1 + +Total issues resolved: **4** + +- [38: fixes doctrine/common#326](https://github.com/doctrine/annotations/pull/38) +- [39: Remove superfluous NS](https://github.com/doctrine/annotations/pull/39) +- [41: Warn if load_comments is not enabled.](https://github.com/doctrine/annotations/pull/41) +- [42: Clean up unused uses](https://github.com/doctrine/annotations/pull/42) + +### 1.2.0 + + * HHVM support + * Allowing dangling comma in annotations + * Excluded annotations are no longer autoloaded + * Importing namespaces also in traits + * Added support for `::class` 5.5-style constant, works also in 5.3 and 5.4 + +### 1.1.0 + + * Add Exception when ZendOptimizer+ or Opcache is configured to drop comments diff --git a/vendor/doctrine/annotations/README.md b/vendor/doctrine/annotations/README.md index ebb30e0bca4b9dea65df67ba437e24e3d50d7fbb..8f89ea5450445956a99563e3c328c75551bf1e44 100644 --- a/vendor/doctrine/annotations/README.md +++ b/vendor/doctrine/annotations/README.md @@ -1,19 +1,17 @@ # Doctrine Annotations -[](https://travis-ci.org/doctrine/annotations) +[](https://travis-ci.org/doctrine/annotations) +[](https://www.versioneye.com/package/php--doctrine--annotations) +[](https://www.versioneye.com/php/doctrine:annotations/references) +[](https://packagist.org/packages/doctrine/annotations) +[](https://packagist.org/packages/doctrine/annotations) Docblock Annotations Parser library (extracted from [Doctrine Common](https://github.com/doctrine/common)). -## Changelog - -### v1.2.0 +## Documentation - * HHVM support - * Allowing dangling comma in annotations - * Excluded annotations are no longer autoloaded - * Importing namespaces also in traits - * Added support for `::class` 5.5-style constant, works also in 5.3 and 5.4 +See the [doctrine-project website](http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/annotations.html). -### v1.1 +## Changelog - * Add Exception when ZendOptimizer+ or Opcache is configured to drop comments +See [CHANGELOG.md](CHANGELOG.md). diff --git a/vendor/doctrine/annotations/composer.json b/vendor/doctrine/annotations/composer.json index 1c65f6cd35a71e555f901d575911bf519003080e..6a2719b348f107c5025b0b3fe7c8178498944b69 100644 --- a/vendor/doctrine/annotations/composer.json +++ b/vendor/doctrine/annotations/composer.json @@ -13,19 +13,22 @@ {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} ], "require": { - "php": ">=5.3.2", + "php": "^5.6 || ^7.0", "doctrine/lexer": "1.*" }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "^5.7" }, "autoload": { - "psr-0": { "Doctrine\\Common\\Annotations\\": "lib/" } + "psr-4": { "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" } + }, + "autoload-dev": { + "psr-4": { "Doctrine\\Tests\\Common\\Annotations\\": "tests/Doctrine/Tests/Common/Annotations" } }, "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.4.x-dev" } } } diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php index 4ebd1fb4a00c50d2493f89733b3a1590fabc1e11..6c579775fd682fb344db60a6f17a7d1ce5c25c24 100644 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php @@ -102,6 +102,15 @@ class AnnotationReader implements Reader 'startuml' => true, 'enduml' => true, ); + /** + * A list with annotations that are not causing exceptions when not resolved to an annotation class. + * + * The names are case sensitive. + * + * @var array + */ + private static $globalIgnoredNamespaces = array(); + /** * Add a new annotation to the globally ignored annotation names with regard to exception handling. * @@ -112,6 +121,16 @@ static public function addGlobalIgnoredName($name) self::$globalIgnoredNames[$name] = true; } + /** + * Add a new annotation to the globally ignored annotation namespaces with regard to exception handling. + * + * @param string $namespace + */ + static public function addGlobalIgnoredNamespace($namespace) + { + self::$globalIgnoredNamespaces[$namespace] = true; + } + /** * Annotations parser. * @@ -151,8 +170,10 @@ static public function addGlobalIgnoredName($name) * Constructor. * * Initializes a new AnnotationReader. + * + * @param DocParser $parser */ - public function __construct() + public function __construct(DocParser $parser = null) { if (extension_loaded('Zend Optimizer+') && (ini_get('zend_optimizerplus.save_comments') === "0" || ini_get('opcache.save_comments') === "0")) { throw AnnotationException::optimizerPlusSaveComments(); @@ -174,7 +195,8 @@ public function __construct() AnnotationRegistry::registerFile(__DIR__ . '/Annotation/IgnoreAnnotation.php'); - $this->parser = new DocParser; + $this->parser = $parser ?: new DocParser(); + $this->preParser = new DocParser; $this->preParser->setImports(self::$globalImports); @@ -191,6 +213,7 @@ public function getClassAnnotations(ReflectionClass $class) $this->parser->setTarget(Target::TARGET_CLASS); $this->parser->setImports($this->getClassImports($class)); $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); + $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName()); } @@ -222,6 +245,7 @@ public function getPropertyAnnotations(ReflectionProperty $property) $this->parser->setTarget(Target::TARGET_PROPERTY); $this->parser->setImports($this->getPropertyImports($property)); $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); + $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); return $this->parser->parse($property->getDocComment(), $context); } @@ -253,6 +277,7 @@ public function getMethodAnnotations(ReflectionMethod $method) $this->parser->setTarget(Target::TARGET_METHOD); $this->parser->setImports($this->getMethodImports($method)); $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); + $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); return $this->parser->parse($method->getDocComment(), $context); } @@ -282,7 +307,8 @@ public function getMethodAnnotation(ReflectionMethod $method, $annotationName) */ private function getIgnoredAnnotationNames(ReflectionClass $class) { - if (isset($this->ignoredAnnotationNames[$name = $class->getName()])) { + $name = $class->getName(); + if (isset($this->ignoredAnnotationNames[$name])) { return $this->ignoredAnnotationNames[$name]; } @@ -300,7 +326,8 @@ private function getIgnoredAnnotationNames(ReflectionClass $class) */ private function getClassImports(ReflectionClass $class) { - if (isset($this->imports[$name = $class->getName()])) { + $name = $class->getName(); + if (isset($this->imports[$name])) { return $this->imports[$name]; } diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php index e6dc59329a5fd2d2376b6417fde08e55b474b9b7..751c1b1b7f53a51f5a7d664e6674887c4e07515b 100644 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php @@ -20,6 +20,7 @@ namespace Doctrine\Common\Annotations; use Doctrine\Common\Cache\Cache; +use ReflectionClass; /** * A cache aware annotation reader. @@ -29,11 +30,6 @@ */ final class CachedReader implements Reader { - /** - * @var string - */ - private static $CACHE_SALT = '@[Annot]'; - /** * @var Reader */ @@ -71,7 +67,7 @@ public function __construct(Reader $reader, Cache $cache, $debug = false) /** * {@inheritDoc} */ - public function getClassAnnotations(\ReflectionClass $class) + public function getClassAnnotations(ReflectionClass $class) { $cacheKey = $class->getName(); @@ -90,7 +86,7 @@ public function getClassAnnotations(\ReflectionClass $class) /** * {@inheritDoc} */ - public function getClassAnnotation(\ReflectionClass $class, $annotationName) + public function getClassAnnotation(ReflectionClass $class, $annotationName) { foreach ($this->getClassAnnotations($class) as $annot) { if ($annot instanceof $annotationName) { @@ -182,14 +178,13 @@ public function clearLoadedAnnotations() /** * Fetches a value from the cache. * - * @param string $rawCacheKey The cache key. - * @param \ReflectionClass $class The related class. + * @param string $cacheKey The cache key. + * @param ReflectionClass $class The related class. * * @return mixed The cached value or false when the value is not in cache. */ - private function fetchFromCache($rawCacheKey, \ReflectionClass $class) + private function fetchFromCache($cacheKey, ReflectionClass $class) { - $cacheKey = $rawCacheKey . self::$CACHE_SALT; if (($data = $this->cache->fetch($cacheKey)) !== false) { if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) { return $data; @@ -202,14 +197,13 @@ private function fetchFromCache($rawCacheKey, \ReflectionClass $class) /** * Saves a value to the cache. * - * @param string $rawCacheKey The cache key. - * @param mixed $value The value. + * @param string $cacheKey The cache key. + * @param mixed $value The value. * * @return void */ - private function saveToCache($rawCacheKey, $value) + private function saveToCache($cacheKey, $value) { - $cacheKey = $rawCacheKey . self::$CACHE_SALT; $this->cache->save($cacheKey, $value); if ($this->debug) { $this->cache->save('[C]'.$cacheKey, time()); @@ -220,16 +214,49 @@ private function saveToCache($rawCacheKey, $value) * Checks if the cache is fresh. * * @param string $cacheKey - * @param \ReflectionClass $class + * @param ReflectionClass $class * * @return boolean */ - private function isCacheFresh($cacheKey, \ReflectionClass $class) + private function isCacheFresh($cacheKey, ReflectionClass $class) { - if (false === $filename = $class->getFilename()) { + if (null === $lastModification = $this->getLastModification($class)) { return true; } - return $this->cache->fetch('[C]'.$cacheKey) >= filemtime($filename); + return $this->cache->fetch('[C]'.$cacheKey) >= $lastModification; + } + + /** + * Returns the time the class was last modified, testing traits and parents + * + * @param ReflectionClass $class + * @return int + */ + private function getLastModification(ReflectionClass $class) + { + $filename = $class->getFileName(); + $parent = $class->getParentClass(); + + return max(array_merge( + [$filename ? filemtime($filename) : 0], + array_map([$this, 'getTraitLastModificationTime'], $class->getTraits()), + array_map([$this, 'getLastModification'], $class->getInterfaces()), + $parent ? [$this->getLastModification($parent)] : [] + )); + } + + /** + * @param ReflectionClass $reflectionTrait + * @return int + */ + private function getTraitLastModificationTime(ReflectionClass $reflectionTrait) + { + $fileName = $reflectionTrait->getFileName(); + + return max(array_merge( + [$fileName ? filemtime($fileName) : 0], + array_map([$this, 'getTraitLastModificationTime'], $reflectionTrait->getTraits()) + )); } } diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php index db668460ee14e06ff41748b17ae8aa44ceae5979..eb7a457f504152c9198fe369d6a8d2e451699c33 100644 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php @@ -61,7 +61,7 @@ final class DocParser /** * Current target context. * - * @var string + * @var integer */ private $target; @@ -105,7 +105,7 @@ final class DocParser /** * An array of default namespaces if operating in simple mode. * - * @var array + * @var string[] */ private $namespaces = array(); @@ -115,10 +115,18 @@ final class DocParser * The names must be the raw names as used in the class, not the fully qualified * class names. * - * @var array + * @var bool[] indexed by annotation name */ private $ignoredAnnotationNames = array(); + /** + * A list with annotations in namespaced format + * that are not causing exceptions when not resolved to an annotation class. + * + * @var bool[] indexed by namespace name + */ + private $ignoredAnnotationNamespaces = array(); + /** * @var string */ @@ -242,7 +250,7 @@ public function __construct() * The names are supposed to be the raw names as used in the class, not the * fully qualified class names. * - * @param array $names + * @param bool[] $names indexed by annotation name * * @return void */ @@ -251,6 +259,18 @@ public function setIgnoredAnnotationNames(array $names) $this->ignoredAnnotationNames = $names; } + /** + * Sets the annotation namespaces that are ignored during the parsing process. + * + * @param bool[] $ignoredAnnotationNamespaces indexed by annotation namespace name + * + * @return void + */ + public function setIgnoredAnnotationNamespaces($ignoredAnnotationNamespaces) + { + $this->ignoredAnnotationNamespaces = $ignoredAnnotationNamespaces; + } + /** * Sets ignore on not-imported annotations. * @@ -266,7 +286,7 @@ public function setIgnoreNotImportedAnnotations($bool) /** * Sets the default namespaces. * - * @param array $namespace + * @param string $namespace * * @return void * @@ -347,8 +367,10 @@ private function findInitialTokenPosition($input) // search for first valid annotation while (($pos = strpos($input, '@', $pos)) !== false) { - // if the @ is preceded by a space or * it is valid - if ($pos === 0 || $input[$pos - 1] === ' ' || $input[$pos - 1] === '*') { + $preceding = substr($input, $pos - 1, 1); + + // if the @ is preceded by a space, a tab or * it is valid + if ($pos === 0 || $preceding === ' ' || $preceding === '*' || $preceding === "\t") { return $pos; } @@ -669,8 +691,10 @@ private function Annotation() $originalName = $name; if ('\\' !== $name[0]) { - $alias = (false === $pos = strpos($name, '\\'))? $name : substr($name, 0, $pos); + $pos = strpos($name, '\\'); + $alias = (false === $pos)? $name : substr($name, 0, $pos); $found = false; + $loweredAlias = strtolower($alias); if ($this->namespaces) { foreach ($this->namespaces as $namespace) { @@ -680,7 +704,7 @@ private function Annotation() break; } } - } elseif (isset($this->imports[$loweredAlias = strtolower($alias)])) { + } elseif (isset($this->imports[$loweredAlias])) { $found = true; $name = (false !== $pos) ? $this->imports[$loweredAlias] . substr($name, $pos) @@ -696,7 +720,7 @@ private function Annotation() } if ( ! $found) { - if ($this->ignoreNotImportedAnnotations || isset($this->ignoredAnnotationNames[$name])) { + if ($this->isIgnoredAnnotation($name)) { return false; } @@ -704,6 +728,8 @@ private function Annotation() } } + $name = ltrim($name,'\\'); + if ( ! $this->classExists($name)) { throw AnnotationException::semanticalError(sprintf('The annotation "@%s" in %s does not exist, or could not be auto-loaded.', $name, $this->context)); } @@ -720,7 +746,7 @@ private function Annotation() // verify that the class is really meant to be an annotation and not just any ordinary class if (self::$annotationMetadata[$name]['is_annotation'] === false) { - if (isset($this->ignoredAnnotationNames[$originalName])) { + if ($this->ignoreNotImportedAnnotations || isset($this->ignoredAnnotationNames[$originalName])) { return false; } @@ -897,8 +923,10 @@ private function Constant() if ( ! defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { list($className, $const) = explode('::', $identifier); - $alias = (false === $pos = strpos($className, '\\')) ? $className : substr($className, 0, $pos); + $pos = strpos($className, '\\'); + $alias = (false === $pos) ? $className : substr($className, 0, $pos); $found = false; + $loweredAlias = strtolower($alias); switch (true) { case !empty ($this->namespaces): @@ -911,7 +939,7 @@ private function Constant() } break; - case isset($this->imports[$loweredAlias = strtolower($alias)]): + case isset($this->imports[$loweredAlias]): $found = true; $className = (false !== $pos) ? $this->imports[$loweredAlias] . substr($className, $pos) @@ -1045,7 +1073,7 @@ private function PlainValue() * FieldAssignment ::= FieldName "=" PlainValue * FieldName ::= identifier * - * @return array + * @return \stdClass */ private function FieldAssignment() { @@ -1135,4 +1163,28 @@ private function ArrayEntry() return array(null, $this->Value()); } + + /** + * Checks whether the given $name matches any ignored annotation name or namespace + * + * @param string $name + * + * @return bool + */ + private function isIgnoredAnnotation($name) + { + if ($this->ignoreNotImportedAnnotations || isset($this->ignoredAnnotationNames[$name])) { + return true; + } + + foreach (array_keys($this->ignoredAnnotationNamespaces) as $ignoredAnnotationNamespace) { + $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\') . '\\'; + + if (0 === stripos(rtrim($name, '\\') . '\\', $ignoredAnnotationNamespace)) { + return true; + } + } + + return false; + } } diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php index 24add1b3ba83a46abaedbc393758c0f9fd8d924f..fd2fedee1f4c569e9a929fcb3e6a6813fc627412 100644 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php @@ -112,7 +112,7 @@ public function getClassAnnotations(\ReflectionClass $class) } if ($this->debug - && (false !== $filename = $class->getFilename()) + && (false !== $filename = $class->getFileName()) && filemtime($path) < filemtime($filename)) { @unlink($path); @@ -214,6 +214,8 @@ private function saveCacheFile($path, $data) throw new \RuntimeException(sprintf('Unable to create tempfile in directory: %s', $this->dir)); } + @chmod($tempfile, 0666 & (~$this->umask)); + $written = file_put_contents($tempfile, '<?php return unserialize('.var_export(serialize($data), true).');'); if (false === $written) { diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php index 21ee7cc9030178addfce1aee66195a2786549f2c..c2d477049d01354a7e1f604a3c07c1529bc682e8 100644 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php @@ -42,7 +42,7 @@ public function parseClass(\ReflectionClass $class) return $class->getUseStatements(); } - if (false === $filename = $class->getFilename()) { + if (false === $filename = $class->getFileName()) { return array(); } @@ -67,7 +67,7 @@ public function parseClass(\ReflectionClass $class) * @param string $filename The name of the file to load. * @param integer $lineNumber The number of lines to read from file. * - * @return string The content of the file. + * @return string|null The content of the file or null if the file does not exist. */ private function getFileContent($filename, $lineNumber) { diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php index 9bdcccec92d21bfeb445ca34cea091fb93e89a91..bf1b71339072bece909f4513604fd3322ca29bd3 100644 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php @@ -99,6 +99,8 @@ public function next($docCommentIsComment = TRUE) */ public function parseUseStatement() { + + $groupRoot = ''; $class = ''; $alias = ''; $statements = array(); @@ -114,13 +116,18 @@ public function parseUseStatement() $explicitAlias = true; $alias = ''; } else if ($token === ',') { - $statements[strtolower($alias)] = $class; + $statements[strtolower($alias)] = $groupRoot . $class; $class = ''; $alias = ''; $explicitAlias = false; } else if ($token === ';') { - $statements[strtolower($alias)] = $class; + $statements[strtolower($alias)] = $groupRoot . $class; break; + } else if ($token === '{' ) { + $groupRoot = $class; + $class = ''; + } else if ($token === '}' ) { + continue; } else { break; } diff --git a/vendor/doctrine/annotations/phpstan.neon b/vendor/doctrine/annotations/phpstan.neon new file mode 100644 index 0000000000000000000000000000000000000000..d2b79a7fd65549181ea808290b13b32dbb78bce0 --- /dev/null +++ b/vendor/doctrine/annotations/phpstan.neon @@ -0,0 +1,14 @@ +parameters: + autoload_files: + - %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php + excludes_analyse: + - %currentWorkingDirectory%/tests/*/Fixtures/* + polluteScopeWithLoopInitialAssignments: true + ignoreErrors: + - '#Class Doctrine_Tests_Common_Annotations_Fixtures_ClassNoNamespaceNoComment not found#' + - '#Instantiated class Doctrine_Tests_Common_Annotations_Fixtures_ClassNoNamespaceNoComment not found#' + - '#Property Doctrine\\Tests\\Common\\Annotations\\DummyClassNonAnnotationProblem::\$foo has unknown class#' + - '#Class Doctrine\\Tests\\Common\\Annotations\\True not found#' + - '#Class Doctrine\\Tests\\Common\\Annotations\\False not found#' + - '#Class Doctrine\\Tests\\Common\\Annotations\\Null not found#' + - '#Call to an undefined method ReflectionClass::getUseStatements\(\)#' diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php index dc4016b5979a75a85f4614bf3bc4867f679f5ade..5a0fc0eaf09676d6742e1d8b1717205aa11f89c3 100644 --- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php @@ -94,8 +94,9 @@ protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) */ protected function doContains($id) { - return false !== $this->memcached->get($id) - || $this->memcached->getResultCode() !== Memcached::RES_NOTFOUND; + $this->memcached->get($id); + + return $this->memcached->getResultCode() === Memcached::RES_SUCCESS; } /** diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php index 5dd64d7fd90176a47c8f3bd9ee189eaec96c2740..fb16e639e23f3e109b8024ff1d8dadf2b77834eb 100644 --- a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php @@ -444,6 +444,16 @@ public function testSaveReturnsTrueWithAndWithoutTTlSet() $this->assertTrue($cache->save('with_ttl', 'with_ttl', 3600)); } + public function testValueThatIsFalseBooleanIsProperlyRetrieved() + { + $cache = $this->_getCacheDriver(); + $cache->deleteAll(); + + $this->assertTrue($cache->save('key1', false)); + $this->assertTrue($cache->contains('key1')); + $this->assertFalse($cache->fetch('key1')); + } + /** * Return whether multiple cache providers share the same storage. * diff --git a/vendor/doctrine/collections/.gitignore b/vendor/doctrine/collections/.gitignore deleted file mode 100644 index 48b8bf9072d8716346ec810e5a1808305c97d50f..0000000000000000000000000000000000000000 --- a/vendor/doctrine/collections/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor/ diff --git a/vendor/doctrine/collections/.travis.yml b/vendor/doctrine/collections/.travis.yml deleted file mode 100644 index 60f479277d085b2cdd592668bde86132503c69b3..0000000000000000000000000000000000000000 --- a/vendor/doctrine/collections/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: php - -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - hhvm - - hhvm-nightly - -matrix: - fast_finish: true - allow_failures: - - php: 7.0 - -before_script: - - composer --prefer-source install - -script: - - phpunit diff --git a/vendor/doctrine/collections/CONTRIBUTING.md b/vendor/doctrine/collections/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..407a6652150c45c2eb1a7a71847a013a83ae3b99 --- /dev/null +++ b/vendor/doctrine/collections/CONTRIBUTING.md @@ -0,0 +1,67 @@ +# Contribute to Doctrine + +Thank you for contributing to Doctrine! + +Before we can merge your Pull-Request here are some guidelines that you need to follow. +These guidelines exist not to annoy you, but to keep the code base clean, +unified and future proof. + +## We only accept PRs to "master" + +Our branching strategy is "everything to master first", even +bugfixes and we then merge them into the stable branches. You should only +open pull requests against the master branch. Otherwise we cannot accept the PR. + +There is one exception to the rule, when we merged a bug into some stable branches +we do occasionally accept pull requests that merge the same bug fix into earlier +branches. + +## Coding Standard + +We use [doctrine coding standard](https://github.com/doctrine/coding-standard) which is PSR-1 and PSR-2: + +* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md +* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md + +with some exceptions/differences: + +* Keep the nesting of control structures per method as small as possible +* Align equals (=) signs +* Add spaces between assignment, control and return statements +* Prefer early exit over nesting conditions +* Add spaces around a negation if condition ``if ( ! $cond)`` +* Add legal information at the beginning of each source file +* Add ``@author`` [phpDoc](https://www.phpdoc.org/docs/latest/references/phpdoc/tags/author.html) comment at DockBlock of class/interface/trait that you create. + +## Unit-Tests + +Please try to add a test for your pull-request. + +* If you want to contribute new functionality add unit- or functional tests + depending on the scope of the feature. + +You can run the unit-tests by calling ``vendor/bin/phpunit`` from the root of the project. +It will run all the project tests. + +In order to do that, you will need a fresh copy of doctrine/collections, and you +will have to run a composer installation in the project: + +```sh +git clone git@github.com:doctrine/collections.git +cd collections +curl -sS https://getcomposer.org/installer | php -- +./composer.phar install +``` + +## Travis + +We automatically run your pull request through [Travis CI](https://www.travis-ci.org) +against supported PHP versions. If you break the tests, we cannot merge your code, +so please make sure that your code is working before opening up a Pull-Request. + +## Getting merged + +Please allow us time to review your pull requests. We will give our best to review +everything as fast as possible, but cannot always live up to our own expectations. + +Thank you very much again for your contribution! diff --git a/vendor/doctrine/collections/README.md b/vendor/doctrine/collections/README.md index 161cab63c73a9fc6706f8591af9682e6c016715b..81e06d0cefd1709d0d4e4f20df65147a16f47489 100644 --- a/vendor/doctrine/collections/README.md +++ b/vendor/doctrine/collections/README.md @@ -1,6 +1,8 @@ # Doctrine Collections [](https://travis-ci.org/doctrine/collections) +[](https://scrutinizer-ci.com/g/doctrine/collections/?branch=master) +[](https://scrutinizer-ci.com/g/doctrine/collections/?branch=master) Collections Abstraction library diff --git a/vendor/doctrine/collections/composer.json b/vendor/doctrine/collections/composer.json index 155cac48f97a53a29e82275b1dfcba56fc737b64..385fa93d25049a28d7437bd8619f65955cfc9c61 100644 --- a/vendor/doctrine/collections/composer.json +++ b/vendor/doctrine/collections/composer.json @@ -13,17 +13,23 @@ {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} ], "require": { - "php": ">=5.3.2" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^5.7", + "doctrine/coding-standard": "~0.1@dev" }, "autoload": { "psr-0": { "Doctrine\\Common\\Collections\\": "lib/" } }, + "autoload-dev": { + "psr-4": { + "Doctrine\\Tests\\": "tests/Doctrine/Tests" + } + }, "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } } } diff --git a/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php b/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php index bce575120ea794a29004b51749252c8a63e6cc8c..7ddd068e56264f73e8a2e492c5c7e9b71daf8876 100644 --- a/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php +++ b/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php @@ -26,6 +26,11 @@ /** * An ArrayCollection is a Collection implementation that wraps a regular PHP array. * + * Warning: Using (un-)serialize() on a collection is not a supported use-case + * and may break when we change the internals in the future. If you need to + * serialize a collection use {@link toArray()} and reconstruct the collection + * manually. + * * @since 2.0 * @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Jonathan Wage <jonwage@gmail.com> @@ -50,6 +55,21 @@ public function __construct(array $elements = array()) $this->elements = $elements; } + /** + * Creates a new instance from the specified elements. + * + * This method is provided for derived classes to specify how a new + * instance should be created when constructor semantics have changed. + * + * @param array $elements Elements. + * + * @return static + */ + protected function createFrom(array $elements) + { + return new static($elements); + } + /** * {@inheritDoc} */ @@ -254,9 +274,9 @@ public function set($key, $value) /** * {@inheritDoc} */ - public function add($value) + public function add($element) { - $this->elements[] = $value; + $this->elements[] = $element; return true; } @@ -284,7 +304,7 @@ public function getIterator() */ public function map(Closure $func) { - return new static(array_map($func, $this->elements)); + return $this->createFrom(array_map($func, $this->elements)); } /** @@ -292,7 +312,7 @@ public function map(Closure $func) */ public function filter(Closure $p) { - return new static(array_filter($this->elements, $p)); + return $this->createFrom(array_filter($this->elements, $p)); } /** @@ -324,7 +344,7 @@ public function partition(Closure $p) } } - return array(new static($matches), new static($noMatches)); + return array($this->createFrom($matches), $this->createFrom($noMatches)); } /** @@ -368,8 +388,9 @@ public function matching(Criteria $criteria) } if ($orderings = $criteria->getOrderings()) { + $next = null; foreach (array_reverse($orderings) as $field => $ordering) { - $next = ClosureExpressionVisitor::sortByField($field, $ordering == Criteria::DESC ? -1 : 1); + $next = ClosureExpressionVisitor::sortByField($field, $ordering == Criteria::DESC ? -1 : 1, $next); } uasort($filtered, $next); @@ -382,6 +403,6 @@ public function matching(Criteria $criteria) $filtered = array_slice($filtered, (int)$offset, $length); } - return new static($filtered); + return $this->createFrom($filtered); } } diff --git a/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php b/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php index 994085f914f0006660b7923f2502397178b182d5..1239aa393edb0ed6d22ea7374ec261ba85c6f03f 100644 --- a/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php +++ b/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php @@ -69,6 +69,24 @@ public static function getObjectFieldValue($object, $field) return $object[$field]; } + if (isset($object->$field)) { + return $object->$field; + } + + // camelcase field name to support different variable naming conventions + $ccField = preg_replace_callback('/_(.?)/', function($matches) { return strtoupper($matches[1]); }, $field); + + foreach ($accessors as $accessor) { + $accessor .= $ccField; + + + if ( ! method_exists($object, $accessor)) { + continue; + } + + return $object->$accessor(); + } + return $object->$field; } @@ -155,6 +173,26 @@ public function walkComparison(Comparison $comparison) return false !== strpos(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value); }; + case Comparison::MEMBER_OF: + return function ($object) use ($field, $value) { + $fieldValues = ClosureExpressionVisitor::getObjectFieldValue($object, $field); + if (!is_array($fieldValues)) { + $fieldValues = iterator_to_array($fieldValues); + } + return in_array($value, $fieldValues); + }; + + case Comparison::STARTS_WITH: + return function ($object) use ($field, $value) { + return 0 === strpos(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value); + }; + + case Comparison::ENDS_WITH: + return function ($object) use ($field, $value) { + return $value === substr(ClosureExpressionVisitor::getObjectFieldValue($object, $field), -strlen($value)); + }; + + default: throw new \RuntimeException("Unknown comparison operator: " . $comparison->getOperator()); } diff --git a/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Comparison.php b/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Comparison.php index d54ecf25c7d5af7bde342427fc8dd370b0b79d35..ec9a9f48a0a83027f0b7414f74cd274870757e2d 100644 --- a/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Comparison.php +++ b/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Comparison.php @@ -27,17 +27,19 @@ */ class Comparison implements Expression { - const EQ = '='; - const NEQ = '<>'; - const LT = '<'; - const LTE = '<='; - const GT = '>'; - const GTE = '>='; - const IS = '='; // no difference with EQ - const IN = 'IN'; - const NIN = 'NIN'; - const CONTAINS = 'CONTAINS'; - + const EQ = '='; + const NEQ = '<>'; + const LT = '<'; + const LTE = '<='; + const GT = '>'; + const GTE = '>='; + const IS = '='; // no difference with EQ + const IN = 'IN'; + const NIN = 'NIN'; + const CONTAINS = 'CONTAINS'; + const MEMBER_OF = 'MEMBER_OF'; + const STARTS_WITH = 'STARTS_WITH'; + const ENDS_WITH = 'ENDS_WITH'; /** * @var string */ diff --git a/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ExpressionBuilder.php b/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ExpressionBuilder.php index 6539e3c75fd44f27b38e81e6bec5f5f7a76e92ab..1a44a7ba844284f6c6fb2560c24970c6f8d47d83 100644 --- a/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ExpressionBuilder.php +++ b/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ExpressionBuilder.php @@ -27,7 +27,7 @@ * Builder for Expressions in the {@link Selectable} interface. * * Important Notice for interoperable code: You have to use scalar - * values only for comparisons, otherwise the behavior of the comparision + * values only for comparisons, otherwise the behavior of the comparison * may be different between implementations (Array vs ORM vs ODM). * * @author Benjamin Eberlei <kontakt@beberlei.de> @@ -163,4 +163,38 @@ public function contains($field, $value) { return new Comparison($field, Comparison::CONTAINS, new Value($value)); } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function memberOf ($field, $value) + { + return new Comparison($field, Comparison::MEMBER_OF, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function startsWith($field, $value) + { + return new Comparison($field, Comparison::STARTS_WITH, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function endsWith($field, $value) + { + return new Comparison($field, Comparison::ENDS_WITH, new Value($value)); + } + } diff --git a/vendor/doctrine/collections/phpunit.xml.dist b/vendor/doctrine/collections/phpunit.xml.dist deleted file mode 100644 index 36968e99c30a8d01b2742eb300a20967111d76f7..0000000000000000000000000000000000000000 --- a/vendor/doctrine/collections/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<phpunit backupGlobals="false" - backupStaticAttributes="false" - colors="true" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - processIsolation="false" - stopOnFailure="false" - syntaxCheck="false" - bootstrap="./tests/Doctrine/Tests/TestInit.php" -> - <testsuites> - <testsuite name="Doctrine Collections Test Suite"> - <directory>./tests/Doctrine/</directory> - </testsuite> - </testsuites> - - <filter> - <whitelist> - <directory>./lib/Doctrine/</directory> - </whitelist> - </filter> - - <groups> - <exclude> - <group>performance</group> - </exclude> - </groups> -</phpunit> diff --git a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/AbstractLazyCollectionTest.php b/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/AbstractLazyCollectionTest.php deleted file mode 100644 index 4de82cc2037d38d92b82d7e65d6b066b5983c585..0000000000000000000000000000000000000000 --- a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/AbstractLazyCollectionTest.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -namespace Doctrine\Tests\Common\Collections; - -use Doctrine\Tests\LazyArrayCollection; - -class AbstractLazyCollectionTest extends \PHPUnit_Framework_TestCase -{ - public function testLazyCollection() - { - $collection = new LazyArrayCollection(); - - $this->assertFalse($collection->isInitialized()); - $this->assertCount(3, $collection); - - $collection->add('bar'); - $this->assertTrue($collection->isInitialized()); - $this->assertCount(4, $collection); - } -} diff --git a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php b/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php deleted file mode 100644 index 1b8a906fdaf8bb9dfcd1905a84bb381ce918e794..0000000000000000000000000000000000000000 --- a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php +++ /dev/null @@ -1,296 +0,0 @@ -<?php -/* - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the MIT license. For more information, see - * <http://www.doctrine-project.org>. - */ - -namespace Doctrine\Tests\Common\Collections; - -use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\Common\Collections\Criteria; - -/** - * Tests for {@see \Doctrine\Common\Collections\ArrayCollection} - * - * @covers \Doctrine\Common\Collections\ArrayCollection - */ -class ArrayCollectionTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider provideDifferentElements - */ - public function testToArray($elements) - { - $collection = new ArrayCollection($elements); - - $this->assertSame($elements, $collection->toArray()); - } - - /** - * @dataProvider provideDifferentElements - */ - public function testFirst($elements) - { - $collection = new ArrayCollection($elements); - $this->assertSame(reset($elements), $collection->first()); - } - - /** - * @dataProvider provideDifferentElements - */ - public function testLast($elements) - { - $collection = new ArrayCollection($elements); - $this->assertSame(end($elements), $collection->last()); - } - - /** - * @dataProvider provideDifferentElements - */ - public function testKey($elements) - { - $collection = new ArrayCollection($elements); - - $this->assertSame(key($elements), $collection->key()); - - next($elements); - $collection->next(); - - $this->assertSame(key($elements), $collection->key()); - } - - /** - * @dataProvider provideDifferentElements - */ - public function testNext($elements) - { - $collection = new ArrayCollection($elements); - - while (true) { - $collectionNext = $collection->next(); - $arrayNext = next($elements); - - if(!$collectionNext || !$arrayNext) { - break; - } - - $this->assertSame($arrayNext, $collectionNext, "Returned value of ArrayCollection::next() and next() not match"); - $this->assertSame(key($elements), $collection->key(), "Keys not match"); - $this->assertSame(current($elements), $collection->current(), "Current values not match"); - } - } - - /** - * @dataProvider provideDifferentElements - */ - public function testCurrent($elements) - { - $collection = new ArrayCollection($elements); - - $this->assertSame(current($elements), $collection->current()); - - next($elements); - $collection->next(); - - $this->assertSame(current($elements), $collection->current()); - } - - /** - * @dataProvider provideDifferentElements - */ - public function testGetKeys($elements) - { - $collection = new ArrayCollection($elements); - - $this->assertSame(array_keys($elements), $collection->getKeys()); - } - - /** - * @dataProvider provideDifferentElements - */ - public function testGetValues($elements) - { - $collection = new ArrayCollection($elements); - - $this->assertSame(array_values($elements), $collection->getValues()); - } - - /** - * @dataProvider provideDifferentElements - */ - public function testCount($elements) - { - $collection = new ArrayCollection($elements); - - $this->assertSame(count($elements), $collection->count()); - } - - /** - * @dataProvider provideDifferentElements - */ - public function testIterator($elements) - { - $collection = new ArrayCollection($elements); - - $iterations = 0; - foreach($collection->getIterator() as $key => $item) { - $this->assertSame($elements[$key], $item, "Item {$key} not match"); - $iterations++; - } - - $this->assertEquals(count($elements), $iterations, "Number of iterations not match"); - } - - /** - * @return array - */ - public function provideDifferentElements() - { - return array( - 'indexed' => array(array(1, 2, 3, 4, 5)), - 'associative' => array(array('A' => 'a', 'B' => 'b', 'C' => 'c')), - 'mixed' => array(array('A' => 'a', 1, 'B' => 'b', 2, 3)), - ); - } - - public function testRemove() - { - $elements = array(1, 'A' => 'a', 2, 'B' => 'b', 3); - $collection = new ArrayCollection($elements); - - $this->assertEquals(1, $collection->remove(0)); - unset($elements[0]); - - $this->assertEquals(null, $collection->remove('non-existent')); - unset($elements['non-existent']); - - $this->assertEquals(2, $collection->remove(1)); - unset($elements[1]); - - $this->assertEquals('a', $collection->remove('A')); - unset($elements['A']); - - $this->assertEquals($elements, $collection->toArray()); - } - - public function testRemoveElement() - { - $elements = array(1, 'A' => 'a', 2, 'B' => 'b', 3, 'A2' => 'a', 'B2' => 'b'); - $collection = new ArrayCollection($elements); - - $this->assertTrue($collection->removeElement(1)); - unset($elements[0]); - - $this->assertFalse($collection->removeElement('non-existent')); - - $this->assertTrue($collection->removeElement('a')); - unset($elements['A']); - - $this->assertTrue($collection->removeElement('a')); - unset($elements['A2']); - - $this->assertEquals($elements, $collection->toArray()); - } - - public function testContainsKey() - { - $elements = array(1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'B2' => 'b'); - $collection = new ArrayCollection($elements); - - $this->assertTrue($collection->containsKey(0), "Contains index 0"); - $this->assertTrue($collection->containsKey('A'), "Contains key \"A\""); - $this->assertTrue($collection->containsKey('null'), "Contains key \"null\", with value null"); - $this->assertFalse($collection->containsKey('non-existent'), "Doesn't contain key"); - } - - public function testEmpty() - { - $collection = new ArrayCollection(); - $this->assertTrue($collection->isEmpty(), "Empty collection"); - - $collection->add(1); - $this->assertFalse($collection->isEmpty(), "Not empty collection"); - } - - public function testContains() - { - $elements = array(1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0); - $collection = new ArrayCollection($elements); - - $this->assertTrue($collection->contains(0), "Contains Zero"); - $this->assertTrue($collection->contains('a'), "Contains \"a\""); - $this->assertTrue($collection->contains(null), "Contains Null"); - $this->assertFalse($collection->contains('non-existent'), "Doesn't contain an element"); - } - - public function testExists() - { - $elements = array(1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0); - $collection = new ArrayCollection($elements); - - $this->assertTrue($collection->exists(function($key, $element) { - return $key == 'A' && $element == 'a'; - }), "Element exists"); - - $this->assertFalse($collection->exists(function($key, $element) { - return $key == 'non-existent' && $element == 'non-existent'; - }), "Element not exists"); - } - - public function testIndexOf() - { - $elements = array(1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0); - $collection = new ArrayCollection($elements); - - $this->assertSame(array_search(2, $elements, true), $collection->indexOf(2), 'Index of 2'); - $this->assertSame(array_search(null, $elements, true), $collection->indexOf(null), 'Index of null'); - $this->assertSame(array_search('non-existent', $elements, true), $collection->indexOf('non-existent'), 'Index of non existent'); - } - - public function testGet() - { - $elements = array(1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0); - $collection = new ArrayCollection($elements); - - $this->assertSame(2, $collection->get(1), 'Get element by index'); - $this->assertSame('a', $collection->get('A'), 'Get element by name'); - $this->assertSame(null, $collection->get('non-existent'), 'Get non existent element'); - } - - public function testMatchingWithSortingPreservesyKeys() - { - $object1 = new \stdClass(); - $object2 = new \stdClass(); - - $object1->sortField = 2; - $object2->sortField = 1; - - $collection = new ArrayCollection(array( - 'object1' => $object1, - 'object2' => $object2, - )); - - $this->assertSame( - array( - 'object2' => $object2, - 'object1' => $object1, - ), - $collection - ->matching(new Criteria(null, array('sortField' => Criteria::ASC))) - ->toArray() - ); - } -} diff --git a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php b/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php deleted file mode 100644 index 21c2e3dfc52c172ecf071c5a91dd41868aedfbdf..0000000000000000000000000000000000000000 --- a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php +++ /dev/null @@ -1,250 +0,0 @@ -<?php -/* - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the MIT license. For more information, see - * <http://www.doctrine-project.org>. - */ - -namespace Doctrine\Tests\Common\Collections; - -use Doctrine\Common\Collections\Expr\ClosureExpressionVisitor; -use Doctrine\Common\Collections\ExpressionBuilder; - -/** - * @group DDC-1637 - */ -class ClosureExpressionVisitorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var ClosureExpressionVisitor - */ - private $visitor; - - /** - * @var ExpressionBuilder - */ - private $builder; - - protected function setUp() - { - $this->visitor = new ClosureExpressionVisitor(); - $this->builder = new ExpressionBuilder(); - } - - public function testGetObjectFieldValueIsAccessor() - { - $object = new TestObject(1, 2, true); - - $this->assertTrue($this->visitor->getObjectFieldValue($object, 'baz')); - } - - public function testGetObjectFieldValueMagicCallMethod() - { - $object = new TestObject(1, 2, true, 3); - - $this->assertEquals(3, $this->visitor->getObjectFieldValue($object, 'qux')); - } - - public function testWalkEqualsComparison() - { - $closure = $this->visitor->walkComparison($this->builder->eq("foo", 1)); - - $this->assertTrue($closure(new TestObject(1))); - $this->assertFalse($closure(new TestObject(2))); - } - - public function testWalkNotEqualsComparison() - { - $closure = $this->visitor->walkComparison($this->builder->neq("foo", 1)); - - $this->assertFalse($closure(new TestObject(1))); - $this->assertTrue($closure(new TestObject(2))); - } - - public function testWalkLessThanComparison() - { - $closure = $this->visitor->walkComparison($this->builder->lt("foo", 1)); - - $this->assertFalse($closure(new TestObject(1))); - $this->assertTrue($closure(new TestObject(0))); - } - - public function testWalkLessThanEqualsComparison() - { - $closure = $this->visitor->walkComparison($this->builder->lte("foo", 1)); - - $this->assertFalse($closure(new TestObject(2))); - $this->assertTrue($closure(new TestObject(1))); - $this->assertTrue($closure(new TestObject(0))); - } - - public function testWalkGreaterThanEqualsComparison() - { - $closure = $this->visitor->walkComparison($this->builder->gte("foo", 1)); - - $this->assertTrue($closure(new TestObject(2))); - $this->assertTrue($closure(new TestObject(1))); - $this->assertFalse($closure(new TestObject(0))); - } - - public function testWalkGreaterThanComparison() - { - $closure = $this->visitor->walkComparison($this->builder->gt("foo", 1)); - - $this->assertTrue($closure(new TestObject(2))); - $this->assertFalse($closure(new TestObject(1))); - $this->assertFalse($closure(new TestObject(0))); - } - - public function testWalkInComparison() - { - $closure = $this->visitor->walkComparison($this->builder->in("foo", array(1, 2, 3))); - - $this->assertTrue($closure(new TestObject(2))); - $this->assertTrue($closure(new TestObject(1))); - $this->assertFalse($closure(new TestObject(0))); - } - - public function testWalkNotInComparison() - { - $closure = $this->visitor->walkComparison($this->builder->notIn("foo", array(1, 2, 3))); - - $this->assertFalse($closure(new TestObject(1))); - $this->assertFalse($closure(new TestObject(2))); - $this->assertTrue($closure(new TestObject(0))); - $this->assertTrue($closure(new TestObject(4))); - } - - public function testWalkContainsComparison() - { - $closure = $this->visitor->walkComparison($this->builder->contains('foo', 'hello')); - - $this->assertTrue($closure(new TestObject('hello world'))); - $this->assertFalse($closure(new TestObject('world'))); - } - - public function testWalkAndCompositeExpression() - { - $closure = $this->visitor->walkCompositeExpression( - $this->builder->andX( - $this->builder->eq("foo", 1), - $this->builder->eq("bar", 1) - ) - ); - - $this->assertTrue($closure(new TestObject(1, 1))); - $this->assertFalse($closure(new TestObject(1, 0))); - $this->assertFalse($closure(new TestObject(0, 1))); - $this->assertFalse($closure(new TestObject(0, 0))); - } - - public function testWalkOrCompositeExpression() - { - $closure = $this->visitor->walkCompositeExpression( - $this->builder->orX( - $this->builder->eq("foo", 1), - $this->builder->eq("bar", 1) - ) - ); - - $this->assertTrue($closure(new TestObject(1, 1))); - $this->assertTrue($closure(new TestObject(1, 0))); - $this->assertTrue($closure(new TestObject(0, 1))); - $this->assertFalse($closure(new TestObject(0, 0))); - } - - public function testSortByFieldAscending() - { - $objects = array(new TestObject("b"), new TestObject("a"), new TestObject("c")); - $sort = ClosureExpressionVisitor::sortByField("foo"); - - usort($objects, $sort); - - $this->assertEquals("a", $objects[0]->getFoo()); - $this->assertEquals("b", $objects[1]->getFoo()); - $this->assertEquals("c", $objects[2]->getFoo()); - } - - public function testSortByFieldDescending() - { - $objects = array(new TestObject("b"), new TestObject("a"), new TestObject("c")); - $sort = ClosureExpressionVisitor::sortByField("foo", -1); - - usort($objects, $sort); - - $this->assertEquals("c", $objects[0]->getFoo()); - $this->assertEquals("b", $objects[1]->getFoo()); - $this->assertEquals("a", $objects[2]->getFoo()); - } - - public function testSortDelegate() - { - $objects = array(new TestObject("a", "c"), new TestObject("a", "b"), new TestObject("a", "a")); - $sort = ClosureExpressionVisitor::sortByField("bar", 1); - $sort = ClosureExpressionVisitor::sortByField("foo", 1, $sort); - - usort($objects, $sort); - - $this->assertEquals("a", $objects[0]->getBar()); - $this->assertEquals("b", $objects[1]->getBar()); - $this->assertEquals("c", $objects[2]->getBar()); - } - - public function testArrayComparison() - { - $closure = $this->visitor->walkComparison($this->builder->eq("foo", 42)); - - $this->assertTrue($closure(array('foo' => 42))); - } -} - -class TestObject -{ - private $foo; - private $bar; - private $baz; - private $qux; - - public function __construct($foo = null, $bar = null, $baz = null, $qux = null) - { - $this->foo = $foo; - $this->bar = $bar; - $this->baz = $baz; - $this->qux = $qux; - } - - public function __call($name, $arguments) - { - if ('getqux' === $name) { - return $this->qux; - } - } - - public function getFoo() - { - return $this->foo; - } - - public function getBar() - { - return $this->bar; - } - - public function isBaz() - { - return $this->baz; - } -} - diff --git a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php b/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php deleted file mode 100644 index f3f91ad3f13cb3341c4d916a4cb247c3f23a6279..0000000000000000000000000000000000000000 --- a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php +++ /dev/null @@ -1,265 +0,0 @@ -<?php - -namespace Doctrine\Tests\Common\Collections; - -use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\Common\Collections\Collection; -use Doctrine\Common\Collections\Criteria; - -class CollectionTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var Collection - */ - private $collection; - - protected function setUp() - { - $this->collection = new ArrayCollection(); - } - - public function testIssetAndUnset() - { - $this->assertFalse(isset($this->collection[0])); - $this->collection->add('testing'); - $this->assertTrue(isset($this->collection[0])); - unset($this->collection[0]); - $this->assertFalse(isset($this->collection[0])); - } - - public function testToString() - { - $this->collection->add('testing'); - $this->assertTrue(is_string((string) $this->collection)); - } - - public function testRemovingNonExistentEntryReturnsNull() - { - $this->assertEquals(null, $this->collection->remove('testing_does_not_exist')); - } - - public function testExists() - { - $this->collection->add("one"); - $this->collection->add("two"); - $exists = $this->collection->exists(function($k, $e) { return $e == "one"; }); - $this->assertTrue($exists); - $exists = $this->collection->exists(function($k, $e) { return $e == "other"; }); - $this->assertFalse($exists); - } - - public function testMap() - { - $this->collection->add(1); - $this->collection->add(2); - $res = $this->collection->map(function($e) { return $e * 2; }); - $this->assertEquals(array(2, 4), $res->toArray()); - } - - public function testFilter() - { - $this->collection->add(1); - $this->collection->add("foo"); - $this->collection->add(3); - $res = $this->collection->filter(function($e) { return is_numeric($e); }); - $this->assertEquals(array(0 => 1, 2 => 3), $res->toArray()); - } - - public function testFirstAndLast() - { - $this->collection->add('one'); - $this->collection->add('two'); - - $this->assertEquals($this->collection->first(), 'one'); - $this->assertEquals($this->collection->last(), 'two'); - } - - public function testArrayAccess() - { - $this->collection[] = 'one'; - $this->collection[] = 'two'; - - $this->assertEquals($this->collection[0], 'one'); - $this->assertEquals($this->collection[1], 'two'); - - unset($this->collection[0]); - $this->assertEquals($this->collection->count(), 1); - } - - public function testContainsKey() - { - $this->collection[5] = 'five'; - $this->assertTrue($this->collection->containsKey(5)); - } - - public function testContains() - { - $this->collection[0] = 'test'; - $this->assertTrue($this->collection->contains('test')); - } - - public function testSearch() - { - $this->collection[0] = 'test'; - $this->assertEquals(0, $this->collection->indexOf('test')); - } - - public function testGet() - { - $this->collection[0] = 'test'; - $this->assertEquals('test', $this->collection->get(0)); - } - - public function testGetKeys() - { - $this->collection[] = 'one'; - $this->collection[] = 'two'; - $this->assertEquals(array(0, 1), $this->collection->getKeys()); - } - - public function testGetValues() - { - $this->collection[] = 'one'; - $this->collection[] = 'two'; - $this->assertEquals(array('one', 'two'), $this->collection->getValues()); - } - - public function testCount() - { - $this->collection[] = 'one'; - $this->collection[] = 'two'; - $this->assertEquals($this->collection->count(), 2); - $this->assertEquals(count($this->collection), 2); - } - - public function testForAll() - { - $this->collection[] = 'one'; - $this->collection[] = 'two'; - $this->assertEquals($this->collection->forAll(function($k, $e) { return is_string($e); }), true); - $this->assertEquals($this->collection->forAll(function($k, $e) { return is_array($e); }), false); - } - - public function testPartition() - { - $this->collection[] = true; - $this->collection[] = false; - $partition = $this->collection->partition(function($k, $e) { return $e == true; }); - $this->assertEquals($partition[0][0], true); - $this->assertEquals($partition[1][0], false); - } - - public function testClear() - { - $this->collection[] = 'one'; - $this->collection[] = 'two'; - $this->collection->clear(); - $this->assertEquals($this->collection->isEmpty(), true); - } - - public function testRemove() - { - $this->collection[] = 'one'; - $this->collection[] = 'two'; - $el = $this->collection->remove(0); - - $this->assertEquals('one', $el); - $this->assertEquals($this->collection->contains('one'), false); - $this->assertNull($this->collection->remove(0)); - } - - public function testRemoveElement() - { - $this->collection[] = 'one'; - $this->collection[] = 'two'; - - $this->assertTrue($this->collection->removeElement('two')); - $this->assertFalse($this->collection->contains('two')); - $this->assertFalse($this->collection->removeElement('two')); - } - - public function testSlice() - { - $this->collection[] = 'one'; - $this->collection[] = 'two'; - $this->collection[] = 'three'; - - $slice = $this->collection->slice(0, 1); - $this->assertInternalType('array', $slice); - $this->assertEquals(array('one'), $slice); - - $slice = $this->collection->slice(1); - $this->assertEquals(array(1 => 'two', 2 => 'three'), $slice); - - $slice = $this->collection->slice(1, 1); - $this->assertEquals(array(1 => 'two'), $slice); - } - - public function fillMatchingFixture() - { - $std1 = new \stdClass(); - $std1->foo = "bar"; - $this->collection[] = $std1; - - $std2 = new \stdClass(); - $std2->foo = "baz"; - $this->collection[] = $std2; - } - - /** - * @group DDC-1637 - */ - public function testMatching() - { - $this->fillMatchingFixture(); - - $col = $this->collection->matching(new Criteria(Criteria::expr()->eq("foo", "bar"))); - $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); - $this->assertNotSame($col, $this->collection); - $this->assertEquals(1, count($col)); - } - - /** - * @group DDC-1637 - */ - public function testMatchingOrdering() - { - $this->fillMatchingFixture(); - - $col = $this->collection->matching(new Criteria(null, array('foo' => 'DESC'))); - - $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); - $this->assertNotSame($col, $this->collection); - $this->assertEquals(2, count($col)); - $this->assertEquals('baz', $col->first()->foo); - $this->assertEquals('bar', $col->last()->foo); - } - - /** - * @group DDC-1637 - */ - public function testMatchingSlice() - { - $this->fillMatchingFixture(); - - $col = $this->collection->matching(new Criteria(null, null, 1, 1)); - - $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); - $this->assertNotSame($col, $this->collection); - $this->assertEquals(1, count($col)); - $this->assertEquals('baz', $col[0]->foo); - } - - public function testCanRemoveNullValuesByKey() - { - $this->collection->add(null); - $this->collection->remove(0); - $this->assertTrue($this->collection->isEmpty()); - } - - public function testCanVerifyExistingKeysWithNullValues() - { - $this->collection->set('key', null); - $this->assertTrue($this->collection->containsKey('key')); - } -} diff --git a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php b/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php deleted file mode 100644 index 1ab058a9b8c7ad82ac5c70ea3cbb28ec5376065c..0000000000000000000000000000000000000000 --- a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -namespace Doctrine\Tests\Common\Collections; - -use Doctrine\Common\Collections\Criteria; -use Doctrine\Common\Collections\Expr\Comparison; -use Doctrine\Common\Collections\Expr\CompositeExpression; - -class CriteriaTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $criteria = Criteria::create(); - - $this->assertInstanceOf('Doctrine\Common\Collections\Criteria', $criteria); - } - - public function testConstructor() - { - $expr = new Comparison("field", "=", "value"); - $criteria = new Criteria($expr, array("foo" => "ASC"), 10, 20); - - $this->assertSame($expr, $criteria->getWhereExpression()); - $this->assertEquals(array("foo" => "ASC"), $criteria->getOrderings()); - $this->assertEquals(10, $criteria->getFirstResult()); - $this->assertEquals(20, $criteria->getMaxResults()); - } - - public function testWhere() - { - $expr = new Comparison("field", "=", "value"); - $criteria = new Criteria(); - - $criteria->where($expr); - - $this->assertSame($expr, $criteria->getWhereExpression()); - } - - public function testAndWhere() - { - $expr = new Comparison("field", "=", "value"); - $criteria = new Criteria(); - - $criteria->where($expr); - $expr = $criteria->getWhereExpression(); - $criteria->andWhere($expr); - - $where = $criteria->getWhereExpression(); - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\CompositeExpression', $where); - - $this->assertEquals(CompositeExpression::TYPE_AND, $where->getType()); - $this->assertSame(array($expr, $expr), $where->getExpressionList()); - } - - public function testOrWhere() - { - $expr = new Comparison("field", "=", "value"); - $criteria = new Criteria(); - - $criteria->where($expr); - $expr = $criteria->getWhereExpression(); - $criteria->orWhere($expr); - - $where = $criteria->getWhereExpression(); - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\CompositeExpression', $where); - - $this->assertEquals(CompositeExpression::TYPE_OR, $where->getType()); - $this->assertSame(array($expr, $expr), $where->getExpressionList()); - } - - public function testOrderings() - { - $criteria = Criteria::create() - ->orderBy(array("foo" => "ASC")); - - $this->assertEquals(array("foo" => "ASC"), $criteria->getOrderings()); - } - - public function testExpr() - { - $this->assertInstanceOf('Doctrine\Common\Collections\ExpressionBuilder', Criteria::expr()); - } -} diff --git a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php b/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php deleted file mode 100644 index 5f6b4ce2f01170e1ee5b4330259bccd1977863bf..0000000000000000000000000000000000000000 --- a/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php - -namespace Doctrine\Tests\Common\Collections; - -use Doctrine\Common\Collections\ExpressionBuilder; -use Doctrine\Common\Collections\Expr\Comparison; -use Doctrine\Common\Collections\Expr\CompositeExpression; - -/** - * @group DDC-1637 - */ -class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var ExpressionBuilder - */ - private $builder; - - protected function setUp() - { - $this->builder = new ExpressionBuilder(); - } - - public function testAndX() - { - $expr = $this->builder->andX($this->builder->eq("a", "b")); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\CompositeExpression', $expr); - $this->assertEquals(CompositeExpression::TYPE_AND, $expr->getType()); - } - - public function testOrX() - { - $expr = $this->builder->orX($this->builder->eq("a", "b")); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\CompositeExpression', $expr); - $this->assertEquals(CompositeExpression::TYPE_OR, $expr->getType()); - } - - public function testInvalidAndXArgument() - { - $this->setExpectedException("RuntimeException"); - $this->builder->andX("foo"); - } - - public function testEq() - { - $expr = $this->builder->eq("a", "b"); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); - $this->assertEquals(Comparison::EQ, $expr->getOperator()); - } - - public function testNeq() - { - $expr = $this->builder->neq("a", "b"); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); - $this->assertEquals(Comparison::NEQ, $expr->getOperator()); - } - - public function testLt() - { - $expr = $this->builder->lt("a", "b"); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); - $this->assertEquals(Comparison::LT, $expr->getOperator()); - } - - public function testGt() - { - $expr = $this->builder->gt("a", "b"); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); - $this->assertEquals(Comparison::GT, $expr->getOperator()); - } - - public function testGte() - { - $expr = $this->builder->gte("a", "b"); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); - $this->assertEquals(Comparison::GTE, $expr->getOperator()); - } - - public function testLte() - { - $expr = $this->builder->lte("a", "b"); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); - $this->assertEquals(Comparison::LTE, $expr->getOperator()); - } - - public function testIn() - { - $expr = $this->builder->in("a", array("b")); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); - $this->assertEquals(Comparison::IN, $expr->getOperator()); - } - - public function testNotIn() - { - $expr = $this->builder->notIn("a", array("b")); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); - $this->assertEquals(Comparison::NIN, $expr->getOperator()); - } - - public function testIsNull() - { - $expr = $this->builder->isNull("a"); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); - $this->assertEquals(Comparison::EQ, $expr->getOperator()); - } - - public function testContains() - { - $expr = $this->builder->contains("a", "b"); - - $this->assertInstanceOf('Doctrine\Common\Collections\Expr\Comparison', $expr); - $this->assertEquals(Comparison::CONTAINS, $expr->getOperator()); - } -} diff --git a/vendor/doctrine/collections/tests/Doctrine/Tests/LazyArrayCollection.php b/vendor/doctrine/collections/tests/Doctrine/Tests/LazyArrayCollection.php deleted file mode 100644 index 56736b83b207860c27f10755c0a016fd8aace7cc..0000000000000000000000000000000000000000 --- a/vendor/doctrine/collections/tests/Doctrine/Tests/LazyArrayCollection.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -namespace Doctrine\Tests; - -use Doctrine\Common\Collections\AbstractLazyCollection; -use Doctrine\Common\Collections\ArrayCollection; - -/** - * Simple lazy collection that used an ArrayCollection as backed collection - */ -class LazyArrayCollection extends AbstractLazyCollection -{ - /** - * Do the initialization logic - * - * @return void - */ - protected function doInitialize() - { - $this->collection = new ArrayCollection(array('a', 'b', 'c')); - } -} diff --git a/vendor/doctrine/collections/tests/Doctrine/Tests/TestInit.php b/vendor/doctrine/collections/tests/Doctrine/Tests/TestInit.php deleted file mode 100644 index 973b5fef64f21ea904ba0f61153bcac798e8a2d3..0000000000000000000000000000000000000000 --- a/vendor/doctrine/collections/tests/Doctrine/Tests/TestInit.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/* - * This file bootstraps the test environment. - */ -namespace Doctrine\Tests; - -error_reporting(E_ALL | E_STRICT); - -// register silently failing autoloader -spl_autoload_register(function($class) { - if (0 === strpos($class, 'Doctrine\Tests\\')) { - $path = __DIR__.'/../../'.strtr($class, '\\', '/').'.php'; - if (is_file($path) && is_readable($path)) { - require_once $path; - - return true; - } - } -}); - -require_once __DIR__ . "/../../../vendor/autoload.php"; diff --git a/vendor/doctrine/common/composer.json b/vendor/doctrine/common/composer.json index a12495ab1d30a1fbc6d8b9f42d48675af359e138..7729b1689c07eb15192548d86a6fd0fc58ff35d4 100644 --- a/vendor/doctrine/common/composer.json +++ b/vendor/doctrine/common/composer.json @@ -13,7 +13,7 @@ {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} ], "require": { - "php": "~5.5|~7.0", + "php": "~5.6|~7.0", "doctrine/inflector": "1.*", "doctrine/cache": "1.*", "doctrine/collections": "1.*", @@ -21,7 +21,7 @@ "doctrine/annotations": "1.*" }, "require-dev": { - "phpunit/phpunit": "~4.8|~5.0" + "phpunit/phpunit": "^5.4.6" }, "autoload": { "psr-4": { diff --git a/vendor/doctrine/common/humbug.json.dist b/vendor/doctrine/common/humbug.json.dist new file mode 100644 index 0000000000000000000000000000000000000000..ed6732a3cc268362d613200c9c1461c0c348df1a --- /dev/null +++ b/vendor/doctrine/common/humbug.json.dist @@ -0,0 +1,11 @@ +{ + "source": { + "directories": [ + "lib\/Doctrine" + ] + }, + "timeout": 10, + "logs": { + "text": "reports/humbuglog.txt" + } +} diff --git a/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php b/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php index facce64710d59aafc21d0c89ccd86a3ba277a27b..f1390bc0b94bdb1ea2ee7afea9d86d9d9aba1eff 100644 --- a/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php +++ b/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php @@ -130,7 +130,7 @@ private function assertValidField($field) throw new \InvalidArgumentException(sprintf( 'Field "%s" is not a valid field of the entity "%s" in PreUpdateEventArgs.', $field, - get_class($this->getEntity()) + get_class($this->getObject()) )); } } diff --git a/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php b/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php index 3d82881195bbcd2183e9f8a027f9ac158534e196..bc6fb11d19b1acca9af7929e489606f48b3deea6 100644 --- a/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php +++ b/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php @@ -33,7 +33,7 @@ interface ClassMetadataFactory * Forces the factory to load the metadata of all classes known to the underlying * mapping driver. * - * @return array The ClassMetadata instances of all mapped classes. + * @return ClassMetadata[] The ClassMetadata instances of all mapped classes. */ public function getAllMetadata(); diff --git a/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php b/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php index dc799d5cc8434fd21452b65b1e390975e5c54b7c..f17b263c09347b6b8aa7ca23fd317b611ee0f551 100644 --- a/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php +++ b/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php @@ -117,6 +117,8 @@ public function getElement($className) throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->locator->getFileExtension()); } + $this->classCache[$className] = $result[$className]; + return $result[$className]; } diff --git a/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php b/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php index f60721914a1424ac180ab69934885df4f3c91e7c..fd968a3e0693690e4018360fc43788ed87233090 100644 --- a/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php +++ b/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php @@ -34,7 +34,7 @@ interface ObjectRepository * * @param mixed $id The identifier. * - * @return object The object. + * @return object|null The object. */ public function find($id); @@ -68,7 +68,7 @@ public function findBy(array $criteria, array $orderBy = null, $limit = null, $o * * @param array $criteria The criteria. * - * @return object The object. + * @return object|null The object. */ public function findOneBy(array $criteria); diff --git a/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php b/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php index 990642e78e987720039c140db2bd2046bc2db0cc..f90b0cccacbe46467e0a9b9aa91d0dae9789597f 100644 --- a/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php +++ b/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php @@ -119,8 +119,6 @@ public function injectObjectManager(ObjectManager $objectManager, ClassMetadata */ private function set($field, $args) { - $this->initializeDoctrine(); - if ($this->cm->hasField($field) && !$this->cm->isIdentifier($field)) { $this->$field = $args[0]; } else if ($this->cm->hasAssociation($field) && $this->cm->isSingleValuedAssociation($field)) { @@ -146,13 +144,11 @@ private function set($field, $args) */ private function get($field) { - $this->initializeDoctrine(); - if ( $this->cm->hasField($field) || $this->cm->hasAssociation($field) ) { return $this->$field; - } else { - throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'"); } + + throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'"); } /** @@ -190,8 +186,6 @@ private function completeOwningSide($field, $targetClass, $targetObject) */ private function add($field, $args) { - $this->initializeDoctrine(); - if ($this->cm->hasAssociation($field) && $this->cm->isCollectionValuedAssociation($field)) { $targetClass = $this->cm->getAssociationTargetClass($field); if (!($args[0] instanceof $targetClass)) { @@ -239,6 +233,8 @@ private function initializeDoctrine() */ public function __call($method, $args) { + $this->initializeDoctrine(); + $command = substr($method, 0, 3); $field = lcfirst(substr($method, 3)); if ($command == "set") { diff --git a/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Autoloader.php b/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Autoloader.php index 0aa930b229b7b7180d508d5a2482e2d9b1f0633a..fae3348ee19b9d52f612a2b212c41c649e804929 100644 --- a/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Autoloader.php +++ b/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Autoloader.php @@ -49,9 +49,13 @@ public static function resolveFile($proxyDir, $proxyNamespace, $className) throw InvalidArgumentException::notProxyClass($className, $proxyNamespace); } - $className = str_replace('\\', '', substr($className, strlen($proxyNamespace) + 1)); + // remove proxy namespace from class name + $classNameRelativeToProxyNamespace = substr($className, strlen($proxyNamespace)); - return $proxyDir . DIRECTORY_SEPARATOR . $className . '.php'; + // remove namespace separators from remaining class name + $fileName = str_replace('\\', '', $classNameRelativeToProxyNamespace); + + return $proxyDir . DIRECTORY_SEPARATOR . $fileName . '.php'; } /** diff --git a/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php b/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php index 154b9177995696aaaa48ec04badf34ffa220bac0..ec980b59343aa8d778f9f669df7043047ee916d1 100644 --- a/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php +++ b/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php @@ -41,15 +41,19 @@ public static function proxyDirectoryNotWritable($proxyDirectory) } /** - * @param string $className - * @param string $methodName - * @param string $parameterName - * @param \Exception $previous + * @param string $className + * @param string $methodName + * @param string $parameterName + * @param \Exception|null $previous * * @return self */ - public static function invalidParameterTypeHint($className, $methodName, $parameterName, \Exception $previous) - { + public static function invalidParameterTypeHint( + $className, + $methodName, + $parameterName, + \Exception $previous = null + ) { return new self( sprintf( 'The type hint of parameter "%s" in method "%s" in class "%s" is invalid.', @@ -61,4 +65,24 @@ public static function invalidParameterTypeHint($className, $methodName, $parame $previous ); } + + /** + * @param $className + * @param $methodName + * @param \Exception|null $previous + * + * @return self + */ + public static function invalidReturnTypeHint($className, $methodName, \Exception $previous = null) + { + return new self( + sprintf( + 'The return type of method "%s" in class "%s" is invalid.', + $methodName, + $className + ), + 0, + $previous + ); + } } diff --git a/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php b/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php index 925dcd1b7bc2a6c5213a422ab156cefd25dec19d..62f4167f37cbfa6db6a70ab76f2e92d8d174787c 100644 --- a/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php +++ b/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php @@ -37,7 +37,7 @@ class ProxyGenerator * Used to match very simple id methods that don't need * to be decorated since the identifier is known. */ - const PATTERN_MATCH_ID_METHOD = '((public\s+)?(function\s+%s\s*\(\)\s*)\s*{\s*return\s*\$this->%s;\s*})i'; + const PATTERN_MATCH_ID_METHOD = '((public\s+)?(function\s+%s\s*\(\)\s*)\s*(?::\s*\??\s*\\\\?[a-z_\x7f-\xff][\w\x7f-\xff]*(?:\\\\[a-z_\x7f-\xff][\w\x7f-\xff]*)*\s*)?{\s*return\s*\$this->%s;\s*})i'; /** * The namespace that contains all proxy classes. @@ -787,7 +787,9 @@ private function generateMethods(ClassMetadata $class) $cast = in_array($fieldType, ['integer', 'smallint']) ? '(int) ' : ''; $methods .= ' if ($this->__isInitialized__ === false) {' . "\n"; - $methods .= ' return ' . $cast . ' parent::' . $method->getName() . "();\n"; + $methods .= ' '; + $methods .= $this->shouldProxiedMethodReturn($method) ? 'return ' : ''; + $methods .= $cast . ' parent::' . $method->getName() . "();\n"; $methods .= ' }' . "\n\n"; } @@ -797,7 +799,9 @@ private function generateMethods(ClassMetadata $class) $methods .= "\n \$this->__initializer__ " . "&& \$this->__initializer__->__invoke(\$this, " . var_export($name, true) . ", [" . $invokeParamsString . "]);" - . "\n\n return parent::" . $name . '(' . $callParamsString . ');' + . "\n\n " + . ($this->shouldProxiedMethodReturn($method) ? 'return ' : '') + . "parent::" . $name . '(' . $callParamsString . ');' . "\n" . ' }' . "\n"; } @@ -935,8 +939,15 @@ private function buildParametersString(ClassMetadata $class, \ReflectionMethod $ */ private function getParameterType(ClassMetadata $class, \ReflectionMethod $method, \ReflectionParameter $parameter) { + if (method_exists($parameter, 'hasType')) { + if ( ! $parameter->hasType()) { + return ''; + } + + return $this->formatType($parameter->getType(), $parameter->getDeclaringFunction(), $parameter); + } - // We need to pick the type hint class too + // For PHP 5.x, we need to pick the type hint in the old way (to be removed for PHP 7.0+) if ($parameter->isArray()) { return 'array'; } @@ -945,10 +956,6 @@ private function getParameterType(ClassMetadata $class, \ReflectionMethod $metho return 'callable'; } - if (method_exists($parameter, 'hasType') && $parameter->hasType() && $parameter->getType()->isBuiltin()) { - return (string) $parameter->getType(); - } - try { $parameterClass = $parameter->getClass(); @@ -1012,26 +1019,75 @@ function (\ReflectionParameter $parameter) { */ private function getMethodReturnType(\ReflectionMethod $method) { - if (! (method_exists($method, 'hasReturnType') && $method->hasReturnType())) { + if ( ! method_exists($method, 'hasReturnType') || ! $method->hasReturnType()) { return ''; } - $returnType = $method->getReturnType(); + return ': ' . $this->formatType($method->getReturnType(), $method); + } - if ($returnType->isBuiltin()) { - return ': ' . $returnType; + /** + * @param \ReflectionMethod $method + * + * @return bool + */ + private function shouldProxiedMethodReturn(\ReflectionMethod $method) + { + if ( ! method_exists($method, 'hasReturnType') || ! $method->hasReturnType()) { + return true; } - $nameLower = strtolower((string) $returnType); + return 'void' !== strtolower($this->formatType($method->getReturnType(), $method)); + } + + /** + * @param \ReflectionType $type + * @param \ReflectionMethod $method + * @param \ReflectionParameter|null $parameter + * + * @return string + */ + private function formatType( + \ReflectionType $type, + \ReflectionMethod $method, + \ReflectionParameter $parameter = null + ) { + $name = method_exists($type, 'getName') ? $type->getName() : (string) $type; + $nameLower = strtolower($name); if ('self' === $nameLower) { - return ': \\' . $method->getDeclaringClass()->getName(); + $name = $method->getDeclaringClass()->getName(); } if ('parent' === $nameLower) { - return ': \\' . $method->getDeclaringClass()->getParentClass()->getName(); + $name = $method->getDeclaringClass()->getParentClass()->getName(); + } + + if ( ! $type->isBuiltin() && ! class_exists($name) && ! interface_exists($name)) { + if (null !== $parameter) { + throw UnexpectedValueException::invalidParameterTypeHint( + $method->getDeclaringClass()->getName(), + $method->getName(), + $parameter->getName() + ); + } + + throw UnexpectedValueException::invalidReturnTypeHint( + $method->getDeclaringClass()->getName(), + $method->getName() + ); + } + + if ( ! $type->isBuiltin()) { + $name = '\\' . $name; + } + + if ($type->allowsNull() + && (null === $parameter || ! $parameter->isDefaultValueAvailable() || null !== $parameter->getDefaultValue()) + ) { + $name = '?' . $name; } - return ': \\' . (string) $returnType; + return $name; } } diff --git a/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php b/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php index c48e9ba73a5e05f69c0843478098bda47ca90e4c..17bcd7c9f0d12771d87ffffbe7995ada655288a2 100644 --- a/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php +++ b/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php @@ -137,70 +137,72 @@ protected function parse() } $tokenParser = new TokenParser($contents); $docComment = ''; + $last_token = false; + while ($token = $tokenParser->next(false)) { - if (is_array($token)) { - switch ($token[0]) { - case T_USE: - $this->useStatements = array_merge($this->useStatements, $tokenParser->parseUseStatement()); - break; - case T_DOC_COMMENT: - $docComment = $token[1]; - break; - case T_CLASS: - $this->docComment['class'] = $docComment; - $docComment = ''; - break; - case T_VAR: - case T_PRIVATE: - case T_PROTECTED: - case T_PUBLIC: - $token = $tokenParser->next(); - if ($token[0] === T_VARIABLE) { - $propertyName = substr($token[1], 1); - $this->docComment['property'][$propertyName] = $docComment; - continue 2; - } - if ($token[0] !== T_FUNCTION) { - // For example, it can be T_FINAL. - continue 2; - } - // No break. - case T_FUNCTION: - // The next string after function is the name, but - // there can be & before the function name so find the - // string. - while (($token = $tokenParser->next()) && $token[0] !== T_STRING); - $methodName = $token[1]; - $this->docComment['method'][$methodName] = $docComment; - $docComment = ''; - break; - case T_EXTENDS: - $this->parentClassName = $tokenParser->parseClass(); - $nsPos = strpos($this->parentClassName, '\\'); - $fullySpecified = false; - if ($nsPos === 0) { - $fullySpecified = true; + if (is_array($token)) {switch ($token[0]) { + case T_USE: + $this->useStatements = array_merge($this->useStatements, $tokenParser->parseUseStatement()); + break; + case T_DOC_COMMENT: + $docComment = $token[1]; + break; + case T_CLASS: + if ($last_token !== T_PAAMAYIM_NEKUDOTAYIM) {$this->docComment['class'] = $docComment; + $docComment = '';} + break; + case T_VAR: + case T_PRIVATE: + case T_PROTECTED: + case T_PUBLIC: + $token = $tokenParser->next(); + if ($token[0] === T_VARIABLE) { + $propertyName = substr($token[1], 1); + $this->docComment['property'][$propertyName] = $docComment; + continue 2; + } + if ($token[0] !== T_FUNCTION) { + // For example, it can be T_FINAL. + continue 2; + } + // No break. + case T_FUNCTION: + // The next string after function is the name, but + // there can be & before the function name so find the + // string. + while (($token = $tokenParser->next()) && $token[0] !== T_STRING); + $methodName = $token[1]; + $this->docComment['method'][$methodName] = $docComment; + $docComment = ''; + break; + case T_EXTENDS: + $this->parentClassName = $tokenParser->parseClass(); + $nsPos = strpos($this->parentClassName, '\\'); + $fullySpecified = false; + if ($nsPos === 0) { + $fullySpecified = true; + } else { + if ($nsPos) { + $prefix = strtolower(substr($this->parentClassName, 0, $nsPos)); + $postfix = substr($this->parentClassName, $nsPos); } else { - if ($nsPos) { - $prefix = strtolower(substr($this->parentClassName, 0, $nsPos)); - $postfix = substr($this->parentClassName, $nsPos); - } else { - $prefix = strtolower($this->parentClassName); - $postfix = ''; - } - foreach ($this->useStatements as $alias => $use) { - if ($alias == $prefix) { - $this->parentClassName = '\\' . $use . $postfix; - $fullySpecified = true; - } - } + $prefix = strtolower($this->parentClassName); + $postfix = ''; } - if (!$fullySpecified) { - $this->parentClassName = '\\' . $this->namespace . '\\' . $this->parentClassName; + foreach ($this->useStatements as $alias => $use) { + if ($alias == $prefix) { + $this->parentClassName = '\\' . $use . $postfix; + $fullySpecified = true; + } } - break; - } + } + if (!$fullySpecified) { + $this->parentClassName = '\\' . $this->namespace . '\\' . $this->parentClassName; + } + break;} } + + $last_token = $token[0]; } } diff --git a/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php b/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php index 7f675328f8010a860ac8e9438d2bda67dc0bc4a9..ae115edd7a2f9901be6933b4b84594d5459026ad 100644 --- a/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php +++ b/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php @@ -65,7 +65,7 @@ public static function dump($var, $maxDepth = 2, $stripTags = true, $echo = true ini_set('xdebug.var_display_max_depth', $maxDepth); } - $var = self::export($var, $maxDepth++); + $var = self::export($var, $maxDepth); ob_start(); var_dump($var); @@ -77,11 +77,11 @@ public static function dump($var, $maxDepth = 2, $stripTags = true, $echo = true $dumpText = ($stripTags ? strip_tags(html_entity_decode($dump)) : $dump); ini_set('html_errors', $html); - + if ($echo) { echo $dumpText; } - + return $dumpText; } @@ -100,47 +100,86 @@ public static function export($var, $maxDepth) $var = $var->toArray(); } - if ($maxDepth) { - if (is_array($var)) { - $return = []; + if (! $maxDepth) { + return is_object($var) ? get_class($var) + : (is_array($var) ? 'Array(' . count($var) . ')' : $var); + } - foreach ($var as $k => $v) { - $return[$k] = self::export($v, $maxDepth - 1); - } - } else if ($isObj) { - $return = new \stdclass(); - if ($var instanceof \DateTime) { - $return->__CLASS__ = "DateTime"; - $return->date = $var->format('c'); - $return->timezone = $var->getTimeZone()->getName(); - } else { - $reflClass = ClassUtils::newReflectionObject($var); - $return->__CLASS__ = ClassUtils::getClass($var); - - if ($var instanceof Proxy) { - $return->__IS_PROXY__ = true; - $return->__PROXY_INITIALIZED__ = $var->__isInitialized(); - } - - if ($var instanceof \ArrayObject || $var instanceof \ArrayIterator) { - $return->__STORAGE__ = self::export($var->getArrayCopy(), $maxDepth - 1); - } - - foreach ($reflClass->getProperties() as $reflProperty) { - $name = $reflProperty->getName(); - - $reflProperty->setAccessible(true); - $return->$name = self::export($reflProperty->getValue($var), $maxDepth - 1); - } - } - } else { - $return = $var; + if (is_array($var)) { + $return = []; + + foreach ($var as $k => $v) { + $return[$k] = self::export($v, $maxDepth - 1); } - } else { - $return = is_object($var) ? get_class($var) - : (is_array($var) ? 'Array(' . count($var) . ')' : $var); + + return $return; } + if (! $isObj) { + return $var; + } + + $return = new \stdclass(); + if ($var instanceof \DateTimeInterface) { + $return->__CLASS__ = get_class($var); + $return->date = $var->format('c'); + $return->timezone = $var->getTimezone()->getName(); + + return $return; + } + + $return->__CLASS__ = ClassUtils::getClass($var); + + if ($var instanceof Proxy) { + $return->__IS_PROXY__ = true; + $return->__PROXY_INITIALIZED__ = $var->__isInitialized(); + } + + if ($var instanceof \ArrayObject || $var instanceof \ArrayIterator) { + $return->__STORAGE__ = self::export($var->getArrayCopy(), $maxDepth - 1); + } + + return self::fillReturnWithClassAttributes($var, $return, $maxDepth); + } + + /** + * Fill the $return variable with class attributes + * + * @param object $var + * @param stdClass $return + * @param int $maxDepth + * + * @return mixed + */ + private static function fillReturnWithClassAttributes($var, \stdClass $return, $maxDepth) + { + $reflClass = ClassUtils::newReflectionObject($var); + $parsedAttributes = array(); + do { + $currentClassName = $reflClass->getName(); + + foreach ($reflClass->getProperties() as $reflProperty) { + $attributeKey = $reflProperty->isPrivate() ? $currentClassName . '#' : ''; + $attributeKey .= $reflProperty->getName(); + + if (isset($parsedAttributes[$attributeKey])) { + continue; + } + + $parsedAttributes[$attributeKey] = true; + + $name = + $reflProperty->getName() + . ($return->__CLASS__ !== $currentClassName || $reflProperty->isPrivate() ? ':' . $currentClassName : '') + . ($reflProperty->isPrivate() ? ':private' : '') + . ($reflProperty->isProtected() ? ':protected' : '') + ; + + $reflProperty->setAccessible(true); + $return->$name = self::export($reflProperty->getValue($var), $maxDepth - 1); + } + } while ($reflClass = $reflClass->getParentClass()); + return $return; } diff --git a/vendor/doctrine/common/lib/Doctrine/Common/Version.php b/vendor/doctrine/common/lib/Doctrine/Common/Version.php index 872f169ac604482fda4e712ac9eeb4fbde704701..09e500560c046081724a6913ce95d0a1cede1c21 100644 --- a/vendor/doctrine/common/lib/Doctrine/Common/Version.php +++ b/vendor/doctrine/common/lib/Doctrine/Common/Version.php @@ -34,7 +34,7 @@ class Version /** * Current Doctrine Version. */ - const VERSION = '2.6.2-DEV'; + const VERSION = '2.7.3'; /** * Compares a Doctrine version with the current one. diff --git a/vendor/doctrine/inflector/.travis.yml b/vendor/doctrine/inflector/.travis.yml deleted file mode 100644 index 9ec68f7650ca198d2d78d578a7f3bd19c516624c..0000000000000000000000000000000000000000 --- a/vendor/doctrine/inflector/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: php - -sudo: false - -cache: - directory: - - $HOME/.composer/cache - -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - hhvm - -install: - - composer install -n - -script: - - phpunit diff --git a/vendor/doctrine/inflector/composer.json b/vendor/doctrine/inflector/composer.json index 7e5b2efbfdb89c8ec9c1f27cd1a9fc01ce165de3..e06b649465a9f935a0e235bf21b93d54f8145a38 100644 --- a/vendor/doctrine/inflector/composer.json +++ b/vendor/doctrine/inflector/composer.json @@ -13,17 +13,20 @@ {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} ], "require": { - "php": ">=5.3.2" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "^6.2" }, "autoload": { - "psr-0": { "Doctrine\\Common\\Inflector\\": "lib/" } + "psr-4": { "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } + }, + "autoload-dev": { + "psr-4": { "Doctrine\\Tests\\Common\\Inflector\\": "tests/Doctrine/Common/Inflector" } }, "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } } } diff --git a/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php b/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php index a53828aba95d0569788ff411ef0d5750f6284c4c..3a951af8d4a43d88f1b8aeed56c8221ef4ebe7fa 100644 --- a/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php +++ b/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php @@ -49,7 +49,7 @@ class Inflector '/(matr|vert|ind)(ix|ex)$/i' => '\1ices', '/(x|ch|ss|sh)$/i' => '\1es', '/([^aeiouy]|qu)y$/i' => '\1ies', - '/(hive)$/i' => '\1s', + '/(hive|gulf)$/i' => '\1s', '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves', '/sis$/i' => 'ses', '/([ti])um$/i' => '\1a', @@ -67,7 +67,16 @@ class Inflector '/$/' => 's', ), 'uninflected' => array( - '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', 'people', 'cookie' + '.*[nrlm]ese', + '.*deer', + '.*fish', + '.*measles', + '.*ois', + '.*pox', + '.*sheep', + 'people', + 'cookie', + 'police', ), 'irregular' => array( 'atlas' => 'atlases', @@ -76,6 +85,7 @@ class Inflector 'brother' => 'brothers', 'cafe' => 'cafes', 'chateau' => 'chateaux', + 'niveau' => 'niveaux', 'child' => 'children', 'cookie' => 'cookies', 'corpus' => 'corpuses', @@ -95,6 +105,7 @@ class Inflector 'hoof' => 'hoofs', 'human' => 'humans', 'iris' => 'irises', + 'larva' => 'larvae', 'leaf' => 'leaves', 'loaf' => 'loaves', 'man' => 'men', @@ -112,6 +123,7 @@ class Inflector 'octopus' => 'octopuses', 'opus' => 'opuses', 'ox' => 'oxen', + 'passerby' => 'passersby', 'penis' => 'penises', 'person' => 'people', 'plateau' => 'plateaux', @@ -161,6 +173,7 @@ class Inflector '/(tive)s$/i' => '\1', '/(hive)s$/i' => '\1', '/(drive)s$/i' => '\1', + '/(dive)s$/i' => '\1', '/([^fo])ves$/i' => '\1fe', '/(^analy)ses$/i' => '\1sis', '/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis', @@ -183,8 +196,12 @@ class Inflector '.*pox', '.*sheep', '.*ss', + 'police', + 'pants', + 'clothes', ), 'irregular' => array( + 'caches' => 'cache', 'criteria' => 'criterion', 'curves' => 'curve', 'emphases' => 'emphasis', @@ -206,9 +223,9 @@ class Inflector 'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus', 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps', 'debris', 'diabetes', 'djinn', 'eland', 'elk', 'equipment', 'Faroese', 'flounder', - 'Foochowese', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti', + 'Foochowese', 'Furniture', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti', 'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings', - 'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'mackerel', 'Maltese', '.*?media', + 'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'Luggage', 'mackerel', 'Maltese', '.*?media', 'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese', 'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese', 'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors', @@ -252,7 +269,7 @@ public static function tableize($word) */ public static function classify($word) { - return str_replace(" ", "", ucwords(strtr($word, "_-", " "))); + return str_replace(' ', '', ucwords(strtr($word, '_-', ' '))); } /** @@ -404,7 +421,7 @@ public static function pluralize($word) if (preg_match('/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs)) { self::$cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1); - + return self::$cache['pluralize'][$word]; } @@ -457,7 +474,7 @@ public static function singularize($word) if (preg_match('/(.*)\\b(' . self::$singular['cacheIrregular'] . ')$/i', $word, $regs)) { self::$cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1); - + return self::$cache['singularize'][$word]; } diff --git a/vendor/doctrine/inflector/phpunit.xml.dist b/vendor/doctrine/inflector/phpunit.xml.dist deleted file mode 100644 index ef07faa53c8bea9b324d18e6d5ae6952a62645e3..0000000000000000000000000000000000000000 --- a/vendor/doctrine/inflector/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<phpunit backupGlobals="false" - backupStaticAttributes="false" - colors="true" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - processIsolation="false" - stopOnFailure="false" - syntaxCheck="false" - bootstrap="./tests/Doctrine/Tests/TestInit.php" -> - <testsuites> - <testsuite name="Doctrine Inflector Test Suite"> - <directory>./tests/Doctrine/</directory> - </testsuite> - </testsuites> - - <filter> - <whitelist> - <directory>./lib/Doctrine/</directory> - </whitelist> - </filter> - - <groups> - <exclude> - <group>performance</group> - </exclude> - </groups> -</phpunit> diff --git a/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php b/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php deleted file mode 100644 index 4198d22c1da963d800b43e4ca0f1cc00cabce89c..0000000000000000000000000000000000000000 --- a/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php +++ /dev/null @@ -1,309 +0,0 @@ -<?php - -namespace Doctrine\Tests\Common\Inflector; - -use Doctrine\Tests\DoctrineTestCase; -use Doctrine\Common\Inflector\Inflector; - -class InflectorTest extends DoctrineTestCase -{ - /** - * Singular & Plural test data. Returns an array of sample words. - * - * @return array - */ - public function dataSampleWords() - { - Inflector::reset(); - - // In the format array('singular', 'plural') - return array( - array('', ''), - array('Alias', 'Aliases'), - array('alumnus', 'alumni'), - array('analysis', 'analyses'), - array('aquarium', 'aquaria'), - array('arch', 'arches'), - array('atlas', 'atlases'), - array('axe', 'axes'), - array('baby', 'babies'), - array('bacillus', 'bacilli'), - array('bacterium', 'bacteria'), - array('bureau', 'bureaus'), - array('bus', 'buses'), - array('Bus', 'Buses'), - array('cactus', 'cacti'), - array('cafe', 'cafes'), - array('calf', 'calves'), - array('categoria', 'categorias'), - array('chateau', 'chateaux'), - array('cherry', 'cherries'), - array('child', 'children'), - array('church', 'churches'), - array('circus', 'circuses'), - array('city', 'cities'), - array('cod', 'cod'), - array('cookie', 'cookies'), - array('copy', 'copies'), - array('crisis', 'crises'), - array('criterion', 'criteria'), - array('curriculum', 'curricula'), - array('curve', 'curves'), - array('deer', 'deer'), - array('demo', 'demos'), - array('dictionary', 'dictionaries'), - array('domino', 'dominoes'), - array('dwarf', 'dwarves'), - array('echo', 'echoes'), - array('elf', 'elves'), - array('emphasis', 'emphases'), - array('family', 'families'), - array('fax', 'faxes'), - array('fish', 'fish'), - array('flush', 'flushes'), - array('fly', 'flies'), - array('focus', 'foci'), - array('foe', 'foes'), - array('food_menu', 'food_menus'), - array('FoodMenu', 'FoodMenus'), - array('foot', 'feet'), - array('fungus', 'fungi'), - array('glove', 'gloves'), - array('half', 'halves'), - array('hero', 'heroes'), - array('hippopotamus', 'hippopotami'), - array('hoax', 'hoaxes'), - array('house', 'houses'), - array('human', 'humans'), - array('identity', 'identities'), - array('index', 'indices'), - array('iris', 'irises'), - array('kiss', 'kisses'), - array('knife', 'knives'), - array('leaf', 'leaves'), - array('life', 'lives'), - array('loaf', 'loaves'), - array('man', 'men'), - array('matrix', 'matrices'), - array('matrix_row', 'matrix_rows'), - array('medium', 'media'), - array('memorandum', 'memoranda'), - array('menu', 'menus'), - array('Menu', 'Menus'), - array('mess', 'messes'), - array('moose', 'moose'), - array('motto', 'mottoes'), - array('mouse', 'mice'), - array('neurosis', 'neuroses'), - array('news', 'news'), - array('NodeMedia', 'NodeMedia'), - array('nucleus', 'nuclei'), - array('oasis', 'oases'), - array('octopus', 'octopuses'), - array('pass', 'passes'), - array('person', 'people'), - array('plateau', 'plateaux'), - array('potato', 'potatoes'), - array('powerhouse', 'powerhouses'), - array('quiz', 'quizzes'), - array('radius', 'radii'), - array('reflex', 'reflexes'), - array('roof', 'roofs'), - array('runner-up', 'runners-up'), - array('scarf', 'scarves'), - array('scratch', 'scratches'), - array('series', 'series'), - array('sheep', 'sheep'), - array('shelf', 'shelves'), - array('shoe', 'shoes'), - array('son-in-law', 'sons-in-law'), - array('species', 'species'), - array('splash', 'splashes'), - array('spy', 'spies'), - array('stimulus', 'stimuli'), - array('stitch', 'stitches'), - array('story', 'stories'), - array('syllabus', 'syllabi'), - array('tax', 'taxes'), - array('terminus', 'termini'), - array('thesis', 'theses'), - array('thief', 'thieves'), - array('tomato', 'tomatoes'), - array('tooth', 'teeth'), - array('tornado', 'tornadoes'), - array('try', 'tries'), - array('vertex', 'vertices'), - array('virus', 'viri'), - array('volcano', 'volcanoes'), - array('wash', 'washes'), - array('watch', 'watches'), - array('wave', 'waves'), - array('wharf', 'wharves'), - array('wife', 'wives'), - array('woman', 'women'), - ); - } - - /** - * testInflectingSingulars method - * - * @dataProvider dataSampleWords - * @return void - */ - public function testInflectingSingulars($singular, $plural) - { - $this->assertEquals( - $singular, - Inflector::singularize($plural), - "'$plural' should be singularized to '$singular'" - ); - } - - /** - * testInflectingPlurals method - * - * @dataProvider dataSampleWords - * @return void - */ - public function testInflectingPlurals($singular, $plural) - { - $this->assertEquals( - $plural, - Inflector::pluralize($singular), - "'$singular' should be pluralized to '$plural'" - ); - } - - /** - * testCustomPluralRule method - * - * @return void - */ - public function testCustomPluralRule() - { - Inflector::reset(); - Inflector::rules('plural', array('/^(custom)$/i' => '\1izables')); - - $this->assertEquals(Inflector::pluralize('custom'), 'customizables'); - - Inflector::rules('plural', array('uninflected' => array('uninflectable'))); - - $this->assertEquals(Inflector::pluralize('uninflectable'), 'uninflectable'); - - Inflector::rules('plural', array( - 'rules' => array('/^(alert)$/i' => '\1ables'), - 'uninflected' => array('noflect', 'abtuse'), - 'irregular' => array('amaze' => 'amazable', 'phone' => 'phonezes') - )); - - $this->assertEquals(Inflector::pluralize('noflect'), 'noflect'); - $this->assertEquals(Inflector::pluralize('abtuse'), 'abtuse'); - $this->assertEquals(Inflector::pluralize('alert'), 'alertables'); - $this->assertEquals(Inflector::pluralize('amaze'), 'amazable'); - $this->assertEquals(Inflector::pluralize('phone'), 'phonezes'); - } - - /** - * testCustomSingularRule method - * - * @return void - */ - public function testCustomSingularRule() - { - Inflector::reset(); - Inflector::rules('singular', array('/(eple)r$/i' => '\1', '/(jente)r$/i' => '\1')); - - $this->assertEquals(Inflector::singularize('epler'), 'eple'); - $this->assertEquals(Inflector::singularize('jenter'), 'jente'); - - Inflector::rules('singular', array( - 'rules' => array('/^(bil)er$/i' => '\1', '/^(inflec|contribu)tors$/i' => '\1ta'), - 'uninflected' => array('singulars'), - 'irregular' => array('spins' => 'spinor') - )); - - $this->assertEquals(Inflector::singularize('inflectors'), 'inflecta'); - $this->assertEquals(Inflector::singularize('contributors'), 'contributa'); - $this->assertEquals(Inflector::singularize('spins'), 'spinor'); - $this->assertEquals(Inflector::singularize('singulars'), 'singulars'); - } - - /** - * test that setting new rules clears the inflector caches. - * - * @return void - */ - public function testRulesClearsCaches() - { - Inflector::reset(); - - $this->assertEquals(Inflector::singularize('Bananas'), 'Banana'); - $this->assertEquals(Inflector::pluralize('Banana'), 'Bananas'); - - Inflector::rules('singular', array( - 'rules' => array('/(.*)nas$/i' => '\1zzz') - )); - - $this->assertEquals('Banazzz', Inflector::singularize('Bananas'), 'Was inflected with old rules.'); - - Inflector::rules('plural', array( - 'rules' => array('/(.*)na$/i' => '\1zzz'), - 'irregular' => array('corpus' => 'corpora') - )); - - $this->assertEquals(Inflector::pluralize('Banana'), 'Banazzz', 'Was inflected with old rules.'); - $this->assertEquals(Inflector::pluralize('corpus'), 'corpora', 'Was inflected with old irregular form.'); - } - - /** - * Test resetting inflection rules. - * - * @return void - */ - public function testCustomRuleWithReset() - { - Inflector::reset(); - - $uninflected = array('atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x'); - $pluralIrregular = array('as' => 'ases'); - - Inflector::rules('singular', array( - 'rules' => array('/^(.*)(a|e|o|u)is$/i' => '\1\2l'), - 'uninflected' => $uninflected, - ), true); - - Inflector::rules('plural', array( - 'rules' => array( - '/^(.*)(a|e|o|u)l$/i' => '\1\2is', - ), - 'uninflected' => $uninflected, - 'irregular' => $pluralIrregular - ), true); - - $this->assertEquals(Inflector::pluralize('Alcool'), 'Alcoois'); - $this->assertEquals(Inflector::pluralize('Atlas'), 'Atlas'); - $this->assertEquals(Inflector::singularize('Alcoois'), 'Alcool'); - $this->assertEquals(Inflector::singularize('Atlas'), 'Atlas'); - } - - /** - * Test basic ucwords functionality. - * - * @return void - */ - public function testUcwords() - { - $this->assertSame('Top-O-The-Morning To All_of_you!', Inflector::ucwords( 'top-o-the-morning to all_of_you!')); - } - - /** - * Test ucwords functionality with custom delimeters. - * - * @return void - */ - public function testUcwordsWithCustomDelimeters() - { - $this->assertSame('Top-O-The-Morning To All_Of_You!', Inflector::ucwords( 'top-o-the-morning to all_of_you!', '-_ ')); - } -} - diff --git a/vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php b/vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php deleted file mode 100644 index e8323d294092a5ed06eb1ff8fca5840f613ae41a..0000000000000000000000000000000000000000 --- a/vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace Doctrine\Tests; - -/** - * Base testcase class for all Doctrine testcases. - */ -abstract class DoctrineTestCase extends \PHPUnit_Framework_TestCase -{ -} \ No newline at end of file diff --git a/vendor/doctrine/inflector/tests/Doctrine/Tests/TestInit.php b/vendor/doctrine/inflector/tests/Doctrine/Tests/TestInit.php deleted file mode 100644 index ead2e30583fc9e2c3a3dd98b9fb402913da5b4c6..0000000000000000000000000000000000000000 --- a/vendor/doctrine/inflector/tests/Doctrine/Tests/TestInit.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/* - * This file bootstraps the test environment. - */ -namespace Doctrine\Tests; - -error_reporting(E_ALL | E_STRICT); - -// register silently failing autoloader -spl_autoload_register(function($class) -{ - if (0 === strpos($class, 'Doctrine\Tests\\')) { - $path = __DIR__.'/../../'.strtr($class, '\\', '/').'.php'; - if (is_file($path) && is_readable($path)) { - require_once $path; - - return true; - } - } else if (0 === strpos($class, 'Doctrine\Common\\')) { - $path = __DIR__.'/../../../lib/'.($class = strtr($class, '\\', '/')).'.php'; - if (is_file($path) && is_readable($path)) { - require_once $path; - - return true; - } - } -}); diff --git a/vendor/egulias/email-validator/.travis.yml b/vendor/egulias/email-validator/.travis.yml index 86d52b23e262b88d8c3e09b0ffa2ae3666df0f4e..5bb3b989414f5f408d344fcda58e07c69e6cb141 100644 --- a/vendor/egulias/email-validator/.travis.yml +++ b/vendor/egulias/email-validator/.travis.yml @@ -2,12 +2,17 @@ sudo: false language: php +cache: + directories: + - $HOME/.composer/cache/files + php: - - 5.3 - 5.4 - 5.5 - 5.6 - 7.0 + - 7.1 + - 7.2 - hhvm env: @@ -18,6 +23,9 @@ matrix: fast_finish: true include: - php: 5.3 + dist: precise + - php: 5.3 + dist: precise env: deps=low - php: 5.4 env: deps=no @@ -31,5 +39,5 @@ install: script: - mkdir -p build/logs - - phpunit --coverage-clover build/logs/clover.xml + - composer test -- --coverage-clover build/logs/clover.xml diff --git a/vendor/egulias/email-validator/composer.json b/vendor/egulias/email-validator/composer.json index 6fdc4d0b9d71618559e613a8a31c62b01a0a1f91..f34621626aed088d89da4a6cff16feffa5a354bc 100644 --- a/vendor/egulias/email-validator/composer.json +++ b/vendor/egulias/email-validator/composer.json @@ -24,5 +24,8 @@ "psr-0": { "Egulias\\": "src/" } + }, + "scripts": { + "test": "phpunit" } } diff --git a/vendor/egulias/email-validator/src/Egulias/EmailValidator/EmailValidator.php b/vendor/egulias/email-validator/src/Egulias/EmailValidator/EmailValidator.php index 69ff5fc1a6ed68f02b932780752d647c094d0a0d..9733b6e2b5522cd06f3ab125024edf1b011140a6 100644 --- a/vendor/egulias/email-validator/src/Egulias/EmailValidator/EmailValidator.php +++ b/vendor/egulias/email-validator/src/Egulias/EmailValidator/EmailValidator.php @@ -133,7 +133,7 @@ public function isValid($email, $checkDNS = false, $strict = false) return false; } - return ($strict ? (!$this->hasWarnings() && !$dnsProblemExists) : true); + return !($dnsProblemExists || $strict && $this->hasWarnings()); } /** diff --git a/vendor/egulias/email-validator/tests/egulias/Tests/EmailValidator/EmailValidatorTest.php b/vendor/egulias/email-validator/tests/egulias/Tests/EmailValidator/EmailValidatorTest.php index d5083761479c4808fd41f4b09bf729633ad54e28..f48f141a1554786a02e76ccb72d76af5b0f597fc 100644 --- a/vendor/egulias/email-validator/tests/egulias/Tests/EmailValidator/EmailValidatorTest.php +++ b/vendor/egulias/email-validator/tests/egulias/Tests/EmailValidator/EmailValidatorTest.php @@ -180,7 +180,7 @@ public function getInvalidEmailsWithErrors() */ public function testValidEmailsWithWarningsCheck($warnings, $email) { - $this->assertTrue($this->validator->isValid($email, true)); + $this->assertFalse($this->validator->isValid($email, true)); $this->assertEquals($warnings, $this->validator->getWarnings()); } diff --git a/vendor/guzzlehttp/guzzle/CHANGELOG.md b/vendor/guzzlehttp/guzzle/CHANGELOG.md index b265cbcd1afdd1710371ebe9f756b929b2039fdd..17badd756062b2fbb6d893750da457b88117d2f1 100644 --- a/vendor/guzzlehttp/guzzle/CHANGELOG.md +++ b/vendor/guzzlehttp/guzzle/CHANGELOG.md @@ -1,4 +1,27 @@ -# CHANGELOG +# Change Log + +## 6.3.3 - 2018-04-22 + +* Fix: Default headers when decode_content is specified + + +## 6.3.2 - 2018-03-26 + +* Fix: Release process + + +## 6.3.1 - 2018-03-26 + +* Bug fix: Parsing 0 epoch expiry times in cookies [#2014](https://github.com/guzzle/guzzle/pull/2014) +* Improvement: Better ConnectException detection [#2012](https://github.com/guzzle/guzzle/pull/2012) +* Bug fix: Malformed domain that contains a "/" [#1999](https://github.com/guzzle/guzzle/pull/1999) +* Bug fix: Undefined offset when a cookie has no first key-value pair [#1998](https://github.com/guzzle/guzzle/pull/1998) +* Improvement: Support PHPUnit 6 [#1953](https://github.com/guzzle/guzzle/pull/1953) +* Bug fix: Support empty headers [#1915](https://github.com/guzzle/guzzle/pull/1915) +* Bug fix: Ignore case during header modifications [#1916](https://github.com/guzzle/guzzle/pull/1916) + ++ Minor code cleanups, documentation fixes and clarifications. + ## 6.3.0 - 2017-06-22 diff --git a/vendor/guzzlehttp/guzzle/LICENSE b/vendor/guzzlehttp/guzzle/LICENSE index ea7f07c54cdd915063011b69358fac8fa7773c0e..50a177b0320c3f1f201fe6c57d4ecc0971017037 100644 --- a/vendor/guzzlehttp/guzzle/LICENSE +++ b/vendor/guzzlehttp/guzzle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2011-2016 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com> +Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/guzzlehttp/guzzle/README.md b/vendor/guzzlehttp/guzzle/README.md index 2f614d6f3ae3806fb9de478638f94c3910ffbd7e..bcd18b8e718bcfb922288cf6350eced1dbae966d 100644 --- a/vendor/guzzlehttp/guzzle/README.md +++ b/vendor/guzzlehttp/guzzle/README.md @@ -1,7 +1,9 @@ Guzzle, PHP HTTP client ======================= -[](https://travis-ci.org/guzzle/guzzle) +[](https://github.com/guzzle/guzzle/releases) +[](https://travis-ci.org/guzzle/guzzle) +[](https://packagist.org/packages/guzzlehttp/guzzle) Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services. diff --git a/vendor/guzzlehttp/guzzle/composer.json b/vendor/guzzlehttp/guzzle/composer.json index 65687a58219e682d850d2c87b7127e17612ed942..1f328e308cdbf05fd63eac1be11099a194d3cb1c 100644 --- a/vendor/guzzlehttp/guzzle/composer.json +++ b/vendor/guzzlehttp/guzzle/composer.json @@ -19,7 +19,7 @@ }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0 || ^5.0", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", "psr/log": "^1.0" }, "autoload": { @@ -38,7 +38,7 @@ }, "extra": { "branch-alias": { - "dev-master": "6.2-dev" + "dev-master": "6.3-dev" } } } diff --git a/vendor/guzzlehttp/guzzle/src/Client.php b/vendor/guzzlehttp/guzzle/src/Client.php index de4df8a5ca144db7192d89f72f7cbba742573906..80417918d053c720a6079496dc9dbf40d19c41d7 100644 --- a/vendor/guzzlehttp/guzzle/src/Client.php +++ b/vendor/guzzlehttp/guzzle/src/Client.php @@ -290,7 +290,14 @@ private function transfer(RequestInterface $request, array $options) */ private function applyOptions(RequestInterface $request, array &$options) { - $modify = []; + $modify = [ + 'set_headers' => [], + ]; + + if (isset($options['headers'])) { + $modify['set_headers'] = $options['headers']; + unset($options['headers']); + } if (isset($options['form_params'])) { if (isset($options['multipart'])) { @@ -302,6 +309,8 @@ private function applyOptions(RequestInterface $request, array &$options) } $options['body'] = http_build_query($options['form_params'], '', '&'); unset($options['form_params']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded'; } @@ -313,24 +322,19 @@ private function applyOptions(RequestInterface $request, array &$options) if (isset($options['json'])) { $options['body'] = \GuzzleHttp\json_encode($options['json']); unset($options['json']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); $options['_conditional']['Content-Type'] = 'application/json'; } if (!empty($options['decode_content']) && $options['decode_content'] !== true ) { + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $options['_conditional']); $modify['set_headers']['Accept-Encoding'] = $options['decode_content']; } - if (isset($options['headers'])) { - if (isset($modify['set_headers'])) { - $modify['set_headers'] = $options['headers'] + $modify['set_headers']; - } else { - $modify['set_headers'] = $options['headers']; - } - unset($options['headers']); - } - if (isset($options['body'])) { if (is_array($options['body'])) { $this->invalidBody(); @@ -344,6 +348,8 @@ private function applyOptions(RequestInterface $request, array &$options) $type = isset($value[2]) ? strtolower($value[2]) : 'basic'; switch ($type) { case 'basic': + // Ensure that we don't have the header in different case and set the new value. + $modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']); $modify['set_headers']['Authorization'] = 'Basic ' . base64_encode("$value[0]:$value[1]"); break; @@ -382,6 +388,8 @@ private function applyOptions(RequestInterface $request, array &$options) $request = Psr7\modify_request($request, $modify); if ($request->getBody() instanceof Psr7\MultipartStream) { // Use a multipart/form-data POST if a Content-Type is not set. + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary=' . $request->getBody()->getBoundary(); } diff --git a/vendor/guzzlehttp/guzzle/src/ClientInterface.php b/vendor/guzzlehttp/guzzle/src/ClientInterface.php index 5a67b66bf866504129f91c95d12c64e09f8bfe36..2dbcffa492d0c4ade0b8bf7ba73756cdede249a0 100644 --- a/vendor/guzzlehttp/guzzle/src/ClientInterface.php +++ b/vendor/guzzlehttp/guzzle/src/ClientInterface.php @@ -12,7 +12,7 @@ */ interface ClientInterface { - const VERSION = '6.2.1'; + const VERSION = '6.3.3'; /** * Send an HTTP request. diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php index 1c17b5a436ffa190c2af26d08b7250317eedfe46..78f2b79fecb55316ad3b974e3293206d66e81590 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php @@ -95,11 +95,11 @@ public static function shouldPersist( public function getCookieByName($name) { // don't allow a null name - if($name === null) { + if ($name === null) { return null; } - foreach($this->cookies as $cookie) { - if($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) { + foreach ($this->cookies as $cookie) { + if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) { return $cookie; } } diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php index e4bfafd4fb034451f4e71b44c45a55f1f5810a2b..4497bcf03e24ec69b443eff05ac56b2c94e62c9f 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php @@ -15,7 +15,7 @@ class SessionCookieJar extends CookieJar /** * Create a new SessionCookieJar object * - * @param string $sessionKey Session key name to store the cookie + * @param string $sessionKey Session key name to store the cookie * data in session * @param bool $storeSessionCookies Set to true to store session cookies * in the cookie jar. diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php index c911e2a3fca459736020d178964a5106de886c4c..f6993943e747c2d56218b343c74d7444bcb98cd8 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php @@ -35,14 +35,13 @@ public static function fromString($cookie) $data = self::$defaults; // Explode the cookie string using a series of semicolons $pieces = array_filter(array_map('trim', explode(';', $cookie))); - // The name of the cookie (first kvp) must include an equal sign. - if (empty($pieces) || !strpos($pieces[0], '=')) { + // The name of the cookie (first kvp) must exist and include an equal sign. + if (empty($pieces[0]) || !strpos($pieces[0], '=')) { return new self($data); } // Add the cookie pieces into the parsed data array foreach ($pieces as $part) { - $cookieParts = explode('=', $part, 2); $key = trim($cookieParts[0]); $value = isset($cookieParts[1]) @@ -349,7 +348,7 @@ public function matchesDomain($domain) return false; } - return (bool) preg_match('/\.' . preg_quote($cookieDomain) . '$/', $domain); + return (bool) preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/', $domain); } /** @@ -359,7 +358,7 @@ public function matchesDomain($domain) */ public function isExpired() { - return $this->getExpires() && time() > $this->getExpires(); + return $this->getExpires() !== null && time() > $this->getExpires(); } /** @@ -378,8 +377,8 @@ public function validate() // Check if any of the invalid characters are present in the cookie name if (preg_match( '/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/', - $name) - ) { + $name + )) { return 'Cookie name must not contain invalid characters: ASCII ' . 'Control characters (0-31;127), space, tab and the ' . 'following characters: ()<>@,;:\"/?={}'; diff --git a/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php index c82998e0d7ef06fad4bbf048e2a61fc921b768ed..510778f6eb2f6800eef95d903d0b5b3ff139b415 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php @@ -1,4 +1,13 @@ <?php namespace GuzzleHttp\Exception; +/** + * @method string getMessage() + * @method \Throwable|null getPrevious() + * @method mixed getCode() + * @method string getFile() + * @method int getLine() + * @method array getTrace() + * @method string getTraceAsString() + */ interface GuzzleException {} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php index 49808e5c44679c724ecaacb3856973f3937a0607..e0923714306af0cc5c92bfbd838503e872e4fc68 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php @@ -4,7 +4,6 @@ use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Promise\FulfilledPromise; -use GuzzleHttp\Promise\RejectedPromise; use GuzzleHttp\Psr7; use GuzzleHttp\Psr7\LazyOpenStream; use GuzzleHttp\TransferStats; @@ -288,7 +287,14 @@ private function applyHeaders(EasyHandle $easy, array &$conf) { foreach ($conf['_headers'] as $name => $values) { foreach ($values as $value) { - $conf[CURLOPT_HTTPHEADER][] = "$name: $value"; + $value = (string) $value; + if ($value === '') { + // cURL requires a special format for empty headers. + // See https://github.com/guzzle/guzzle/issues/1882 for more details. + $conf[CURLOPT_HTTPHEADER][] = "$name;"; + } else { + $conf[CURLOPT_HTTPHEADER][] = "$name: $value"; + } } } @@ -388,7 +394,7 @@ private function applyHandlerOptions(EasyHandle $easy, array &$conf) if (isset($options['force_ip_resolve'])) { if ('v4' === $options['force_ip_resolve']) { $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4; - } else if ('v6' === $options['force_ip_resolve']) { + } elseif ('v6' === $options['force_ip_resolve']) { $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6; } } diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php index 945d06ee4e2adae1fa28d5202b5b97efd62ad4ab..2754d8e4378d92530e1a3767c92cc3b673660161 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -65,7 +65,9 @@ public function __invoke(RequestInterface $request, array $options) $promise = new Promise( [$this, 'execute'], - function () use ($id) { return $this->cancel($id); } + function () use ($id) { + return $this->cancel($id); + } ); $this->addRequest(['easy' => $easy, 'deferred' => $promise]); diff --git a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php index b12bfd942398a63b3e6430e227dd05fa482e5a50..b686545ea7f1d44d0de79ee0343524fc2b68128f 100644 --- a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php +++ b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php @@ -4,7 +4,6 @@ use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Promise\FulfilledPromise; -use GuzzleHttp\Promise\RejectedPromise; use GuzzleHttp\Promise\PromiseInterface; use GuzzleHttp\Psr7; use GuzzleHttp\TransferStats; @@ -61,6 +60,7 @@ public function __invoke(RequestInterface $request, array $options) if (strpos($message, 'getaddrinfo') // DNS lookup failed || strpos($message, 'Connection refused') || strpos($message, "couldn't connect to host") // error on HHVM + || strpos($message, "connection attempt failed") ) { $e = new ConnectException($e->getMessage(), $request, $e); } @@ -103,7 +103,7 @@ private function createResponse( $status = $parts[1]; $reason = isset($parts[2]) ? $parts[2] : null; $headers = \GuzzleHttp\headers_from_lines($hdrs); - list ($stream, $headers) = $this->checkDecode($options, $headers, $stream); + list($stream, $headers) = $this->checkDecode($options, $headers, $stream); $stream = Psr7\stream_for($stream); $sink = $stream; @@ -276,7 +276,7 @@ private function createStream(RequestInterface $request, array $options) } $params = []; - $context = $this->getDefaultContext($request, $options); + $context = $this->getDefaultContext($request); if (isset($options['on_headers']) && !is_callable($options['on_headers'])) { throw new \InvalidArgumentException('on_headers must be callable'); @@ -307,7 +307,6 @@ private function createStream(RequestInterface $request, array $options) && isset($options['auth'][2]) && 'ntlm' == $options['auth'][2] ) { - throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); } diff --git a/vendor/guzzlehttp/guzzle/src/HandlerStack.php b/vendor/guzzlehttp/guzzle/src/HandlerStack.php index a72e38a532b2ee6a8f4da4a4f7ba49fdbf5be0a3..24c46fd9fea30c28a93137325f39bc18e9c8873c 100644 --- a/vendor/guzzlehttp/guzzle/src/HandlerStack.php +++ b/vendor/guzzlehttp/guzzle/src/HandlerStack.php @@ -22,7 +22,7 @@ class HandlerStack * Creates a default handler stack that can be used by clients. * * The returned handler will wrap the provided handler or use the most - * appropriate default handler for you system. The returned HandlerStack has + * appropriate default handler for your system. The returned HandlerStack has * support for cookies, redirects, HTTP error exceptions, and preparing a body * before sending. * diff --git a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php index 6b090a977391a3903e580b05ff882965239a388d..663ac7391632645eb2f6b926123a1d669c1b9e69 100644 --- a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php +++ b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php @@ -19,7 +19,6 @@ * - {host}: Host of the request * - {method}: Method of the request * - {uri}: URI of the request - * - {host}: Host of the request * - {version}: Protocol version * - {target}: Request target of the request (path + query + fragment) * - {hostname}: Hostname of the machine that sent the request @@ -74,7 +73,6 @@ public function format( return preg_replace_callback( '/{\s*([A-Za-z_\-\.0-9]+)\s*}/', function (array $matches) use ($request, $response, $error, &$cache) { - if (isset($cache[$matches[1]])) { return $cache[$matches[1]]; } diff --git a/vendor/guzzlehttp/guzzle/src/Middleware.php b/vendor/guzzlehttp/guzzle/src/Middleware.php index 9d79bd26e8ae31006a0ce68204b5393208398967..d4ad75c94f333a43b97f42e973e3c5962572d606 100644 --- a/vendor/guzzlehttp/guzzle/src/Middleware.php +++ b/vendor/guzzlehttp/guzzle/src/Middleware.php @@ -34,10 +34,11 @@ public static function cookies() $cookieJar = $options['cookies']; $request = $cookieJar->withCookieHeader($request); return $handler($request, $options) - ->then(function ($response) use ($cookieJar, $request) { - $cookieJar->extractCookies($request, $response); - return $response; - } + ->then( + function ($response) use ($cookieJar, $request) { + $cookieJar->extractCookies($request, $response); + return $response; + } ); }; }; @@ -72,7 +73,7 @@ function (ResponseInterface $response) use ($request, $handler) { /** * Middleware that pushes history data to an ArrayAccess container. * - * @param array $container Container to hold the history (by reference). + * @param array|\ArrayAccess $container Container to hold the history (by reference). * * @return callable Returns a function that accepts the next handler. * @throws \InvalidArgumentException if container is not an array or ArrayAccess. diff --git a/vendor/guzzlehttp/guzzle/src/UriTemplate.php b/vendor/guzzlehttp/guzzle/src/UriTemplate.php index 0b1623ecaca007facc98ad039cf08037a213e98c..96dcfd09cd71fb4a2c40b38445faee78568ba0cc 100644 --- a/vendor/guzzlehttp/guzzle/src/UriTemplate.php +++ b/vendor/guzzlehttp/guzzle/src/UriTemplate.php @@ -107,7 +107,6 @@ private function expandMatch(array $matches) $useQuery = self::$operatorHash[$parsed['operator']]['query']; foreach ($parsed['values'] as $value) { - if (!isset($this->variables[$value['value']])) { continue; } @@ -117,11 +116,9 @@ private function expandMatch(array $matches) $expanded = ''; if (is_array($variable)) { - $isAssoc = $this->isAssoc($variable); $kvp = []; foreach ($variable as $key => $var) { - if ($isAssoc) { $key = rawurlencode($key); $isNestedArray = is_array($var); @@ -179,7 +176,6 @@ private function expandMatch(array $matches) } $expanded = implode(',', $kvp); } - } else { if ($value['modifier'] === ':') { $variable = substr($variable, 0, $value['position']); diff --git a/vendor/guzzlehttp/guzzle/src/functions.php b/vendor/guzzlehttp/guzzle/src/functions.php index 59e212edfad829c2b0a016cac8a2fdc9352b5da7..a3ac450db94cfe1409f5ec052d2710e6426e469e 100644 --- a/vendor/guzzlehttp/guzzle/src/functions.php +++ b/vendor/guzzlehttp/guzzle/src/functions.php @@ -302,7 +302,8 @@ function json_decode($json, $assoc = false, $depth = 512, $options = 0) $data = \json_decode($json, $assoc, $depth, $options); if (JSON_ERROR_NONE !== json_last_error()) { throw new \InvalidArgumentException( - 'json_decode error: ' . json_last_error_msg()); + 'json_decode error: ' . json_last_error_msg() + ); } return $data; @@ -324,7 +325,8 @@ function json_encode($value, $options = 0, $depth = 512) $json = \json_encode($value, $options, $depth); if (JSON_ERROR_NONE !== json_last_error()) { throw new \InvalidArgumentException( - 'json_encode error: ' . json_last_error_msg()); + 'json_encode error: ' . json_last_error_msg() + ); } return $json; diff --git a/vendor/guzzlehttp/psr7/.editorconfig b/vendor/guzzlehttp/psr7/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..677e36e295e22dc4b69d04902912abdfca604f7e --- /dev/null +++ b/vendor/guzzlehttp/psr7/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/vendor/guzzlehttp/psr7/CHANGELOG.md b/vendor/guzzlehttp/psr7/CHANGELOG.md index 5c252b3a208313cd73f7a84d63b752800edd96ff..27b65f095126739eb5e3a93fe6da9cd544dd318c 100644 --- a/vendor/guzzlehttp/psr7/CHANGELOG.md +++ b/vendor/guzzlehttp/psr7/CHANGELOG.md @@ -1,32 +1,82 @@ -# CHANGELOG +# Change Log -## 1.4.2 - 2017-03-20 -* Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + + +## [Unreleased] + + +## [1.5.2] - 2018-12-04 + +### Fixed + +- Check body size when getting the message summary + + +## [1.5.1] - 2018-12-04 + +### Fixed + +- Get the summary of a body only if it is readable + + +## [1.5.0] - 2018-12-03 + +### Added + +- Response first-line to response string exception (fixes #145) +- A test for #129 behavior +- `get_message_body_summary` function in order to get the message summary +- `3gp` and `mkv` mime types + +### Changed + +- Clarify exception message when stream is detached + +### Deprecated + +- Deprecated parsing folded header lines as per RFC 7230 + +### Fixed + +- Fix `AppendStream::detach` to not close streams +- `InflateStream` preserves `isSeekable` attribute of the underlying stream +- `ServerRequest::getUriFromGlobals` to support URLs in query parameters + + +Several other fixes and improvements. + + +## [1.4.2] - 2017-03-20 + +### Fixed + +- Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing calls to `trigger_error` when deprecated methods are invoked. -## 1.4.1 - 2017-02-27 -* Reverted BC break by reintroducing behavior to automagically fix a URI with a +## [1.4.1] - 2017-02-27 + +### Added + +- Rriggering of silenced deprecation warnings. + +### Fixed + +- Reverted BC break by reintroducing behavior to automagically fix a URI with a relative path and an authority by adding a leading slash to the path. It's only deprecated now. -* Added triggering of silenced deprecation warnings. -## 1.4.0 - 2017-02-21 -* Fix `Stream::read` when length parameter <= 0. -* `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory. -* Fix `ServerRequest::getUriFromGlobals` when `Host` header contains port. -* Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form. -* Allow `parse_response` to parse a response without delimiting space and reason. -* Ensure each URI modification results in a valid URI according to PSR-7 discussions. - Invalid modifications will throw an exception instead of returning a wrong URI or - doing some magic. - - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception - because the path of a URI with an authority must start with a slash "/" or be empty - - `(new Uri())->withScheme('http')` will return `'http://localhost'` -* Fix compatibility of URIs with `file` scheme and empty host. -* Added common URI utility methods based on RFC 3986 (see documentation in the readme): +## [1.4.0] - 2017-02-21 + +### Added + +- Added common URI utility methods based on RFC 3986 (see documentation in the readme): - `Uri::isDefaultPort` - `Uri::isAbsolute` - `Uri::isNetworkPathReference` @@ -37,69 +87,117 @@ - `UriNormalizer::normalize` - `UriNormalizer::isEquivalent` - `UriResolver::relativize` -* Deprecated `Uri::resolve` in favor of `UriResolver::resolve` -* Deprecated `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments` -## 1.3.1 - 2016-06-25 +### Changed + +- Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form. +- Allow `parse_response` to parse a response without delimiting space and reason. +- Ensure each URI modification results in a valid URI according to PSR-7 discussions. + Invalid modifications will throw an exception instead of returning a wrong URI or + doing some magic. + - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception + because the path of a URI with an authority must start with a slash "/" or be empty + - `(new Uri())->withScheme('http')` will return `'http://localhost'` + +### Deprecated + +- `Uri::resolve` in favor of `UriResolver::resolve` +- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments` + +### Fixed + +- `Stream::read` when length parameter <= 0. +- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory. +- `ServerRequest::getUriFromGlobals` when `Host` header contains port. +- Compatibility of URIs with `file` scheme and empty host. + -* Fix `Uri::__toString` for network path references, e.g. `//example.org`. -* Fix missing lowercase normalization for host. -* Fix handling of URI components in case they are `'0'` in a lot of places, +## [1.3.1] - 2016-06-25 + +### Fixed + +- `Uri::__toString` for network path references, e.g. `//example.org`. +- Missing lowercase normalization for host. +- Handling of URI components in case they are `'0'` in a lot of places, e.g. as a user info password. -* Fix `Uri::withAddedHeader` to correctly merge headers with different case. -* Fix trimming of header values in `Uri::withAddedHeader`. Header values may +- `Uri::withAddedHeader` to correctly merge headers with different case. +- Trimming of header values in `Uri::withAddedHeader`. Header values may be surrounded by whitespace which should be ignored according to RFC 7230 Section 3.2.4. This does not apply to header names. -* Fix `Uri::withAddedHeader` with an array of header values. -* Fix `Uri::resolve` when base path has no slash and handling of fragment. -* Fix handling of encoding in `Uri::with(out)QueryValue` so one can pass the +- `Uri::withAddedHeader` with an array of header values. +- `Uri::resolve` when base path has no slash and handling of fragment. +- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the key/value both in encoded as well as decoded form to those methods. This is consistent with withPath, withQuery etc. -* Fix `ServerRequest::withoutAttribute` when attribute value is null. +- `ServerRequest::withoutAttribute` when attribute value is null. + + +## [1.3.0] - 2016-04-13 -## 1.3.0 - 2016-04-13 +### Added -* Added remaining interfaces needed for full PSR7 compatibility +- Remaining interfaces needed for full PSR7 compatibility (ServerRequestInterface, UploadedFileInterface, etc.). -* Added support for stream_for from scalars. -* Can now extend Uri. -* Fixed a bug in validating request methods by making it more permissive. +- Support for stream_for from scalars. -## 1.2.3 - 2016-02-18 +### Changed -* Fixed support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote +- Can now extend Uri. + +### Fixed +- A bug in validating request methods by making it more permissive. + + +## [1.2.3] - 2016-02-18 + +### Fixed + +- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote streams, which can sometimes return fewer bytes than requested with `fread`. -* Fixed handling of gzipped responses with FNAME headers. +- Handling of gzipped responses with FNAME headers. + + +## [1.2.2] - 2016-01-22 + +### Added + +- Support for URIs without any authority. +- Support for HTTP 451 'Unavailable For Legal Reasons.' +- Support for using '0' as a filename. +- Support for including non-standard ports in Host headers. -## 1.2.2 - 2016-01-22 -* Added support for URIs without any authority. -* Added support for HTTP 451 'Unavailable For Legal Reasons.' -* Added support for using '0' as a filename. -* Added support for including non-standard ports in Host headers. +## [1.2.1] - 2015-11-02 -## 1.2.1 - 2015-11-02 +### Changes -* Now supporting negative offsets when seeking to SEEK_END. +- Now supporting negative offsets when seeking to SEEK_END. -## 1.2.0 - 2015-08-15 -* Body as `"0"` is now properly added to a response. -* Now allowing forward seeking in CachingStream. -* Now properly parsing HTTP requests that contain proxy targets in +## [1.2.0] - 2015-08-15 + +### Changed + +- Body as `"0"` is now properly added to a response. +- Now allowing forward seeking in CachingStream. +- Now properly parsing HTTP requests that contain proxy targets in `parse_request`. -* functions.php is now conditionally required. -* user-info is no longer dropped when resolving URIs. +- functions.php is now conditionally required. +- user-info is no longer dropped when resolving URIs. + + +## [1.1.0] - 2015-06-24 -## 1.1.0 - 2015-06-24 +### Changed -* URIs can now be relative. -* `multipart/form-data` headers are now overridden case-insensitively. -* URI paths no longer encode the following characters because they are allowed +- URIs can now be relative. +- `multipart/form-data` headers are now overridden case-insensitively. +- URI paths no longer encode the following characters because they are allowed in URIs: "(", ")", "*", "!", "'" -* A port is no longer added to a URI when the scheme is missing and no port is +- A port is no longer added to a URI when the scheme is missing and no port is present. + ## 1.0.0 - 2015-05-19 Initial release. @@ -108,3 +206,20 @@ Currently unsupported: - `Psr\Http\Message\ServerRequestInterface` - `Psr\Http\Message\UploadedFileInterface` + + + +[Unreleased]: https://github.com/guzzle/psr7/compare/1.5.2...HEAD +[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2 +[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1 +[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0 +[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2 +[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1 +[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0 +[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1 +[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0 +[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3 +[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2 +[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1 +[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0 +[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0 diff --git a/vendor/guzzlehttp/psr7/README.md b/vendor/guzzlehttp/psr7/README.md index 16499358ea102a6d05d5cc44fcdb7abba19083ab..c60a6a38d3306f5c4b2e9ab7c1e19c5b65495c27 100644 --- a/vendor/guzzlehttp/psr7/README.md +++ b/vendor/guzzlehttp/psr7/README.md @@ -372,7 +372,7 @@ This method accepts the following `$resource` types: $stream = GuzzleHttp\Psr7\stream_for('foo'); $stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r')); -$generator function ($bytes) { +$generator = function ($bytes) { for ($i = 0; $i < $bytes; $i++) { yield ' '; } @@ -606,6 +606,12 @@ Creates a new URI with a specific query string value. Any existing query string provided key are removed and replaced with the given key value pair. A value of null will set the query string key without a value, e.g. "key" instead of "key=value". +### `GuzzleHttp\Psr7\Uri::withQueryValues` + +`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface` + +Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an +associative array of key => value. ### `GuzzleHttp\Psr7\Uri::withoutQueryValue` diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json index b1c5a90ba71569e748dd46146a1cd31dd3509a5a..2add153ec424514d7d839fcf8d85a82c39c01755 100644 --- a/vendor/guzzlehttp/psr7/composer.json +++ b/vendor/guzzlehttp/psr7/composer.json @@ -2,7 +2,7 @@ "name": "guzzlehttp/psr7", "type": "library", "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": ["request", "response", "message", "stream", "http", "uri", "url"], + "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"], "license": "MIT", "authors": [ { @@ -17,10 +17,11 @@ ], "require": { "php": ">=5.4.0", - "psr/http-message": "~1.0" + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" }, "provide": { "psr/http-message-implementation": "1.0" @@ -31,9 +32,14 @@ }, "files": ["src/functions_include.php"] }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\Psr7\\": "tests/" + } + }, "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } } } diff --git a/vendor/guzzlehttp/psr7/src/AppendStream.php b/vendor/guzzlehttp/psr7/src/AppendStream.php index 23039fd794bbcaaf1fda658301e90d0a4b209c46..472a0d61ba47c1010aa61bd99a67ef0418efc24b 100644 --- a/vendor/guzzlehttp/psr7/src/AppendStream.php +++ b/vendor/guzzlehttp/psr7/src/AppendStream.php @@ -16,7 +16,6 @@ class AppendStream implements StreamInterface private $seekable = true; private $current = 0; private $pos = 0; - private $detached = false; /** * @param StreamInterface[] $streams Streams to decorate. Each stream must @@ -73,6 +72,7 @@ public function getContents() public function close() { $this->pos = $this->current = 0; + $this->seekable = true; foreach ($this->streams as $stream) { $stream->close(); @@ -82,14 +82,22 @@ public function close() } /** - * Detaches each attached stream + * Detaches each attached stream. + * + * Returns null as it's not clear which underlying stream resource to return. * * {@inheritdoc} */ public function detach() { - $this->close(); - $this->detached = true; + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->detach(); + } + + $this->streams = []; } public function tell() diff --git a/vendor/guzzlehttp/psr7/src/FnStream.php b/vendor/guzzlehttp/psr7/src/FnStream.php index cc9b4453f716150dacb93db04289b65a014c9186..73daea6f375c41cb49169dd0751d24a82f6a6abb 100644 --- a/vendor/guzzlehttp/psr7/src/FnStream.php +++ b/vendor/guzzlehttp/psr7/src/FnStream.php @@ -52,6 +52,15 @@ public function __destruct() } } + /** + * An unserialize would allow the __destruct to run when the unserialized value goes out of scope. + * @throws \LogicException + */ + public function __wakeup() + { + throw new \LogicException('FnStream should never be unserialized'); + } + /** * Adds custom functionality to an underlying stream by intercepting * specific method calls. diff --git a/vendor/guzzlehttp/psr7/src/InflateStream.php b/vendor/guzzlehttp/psr7/src/InflateStream.php index 0051d3fec5a8bdd2d906f85bad4c6120949c7f4b..5e4f6028ca0baaadcfc1facf71c02c8bb4c586d4 100644 --- a/vendor/guzzlehttp/psr7/src/InflateStream.php +++ b/vendor/guzzlehttp/psr7/src/InflateStream.php @@ -27,7 +27,7 @@ public function __construct(StreamInterface $stream) $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength); $resource = StreamWrapper::getResource($stream); stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ); - $this->stream = new Stream($resource); + $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); } /** diff --git a/vendor/guzzlehttp/psr7/src/Request.php b/vendor/guzzlehttp/psr7/src/Request.php index 08285484da22d738e3b7bc2781ef06e81d7f6b19..00066424065636e6769c028e1ad26fa7223b6873 100644 --- a/vendor/guzzlehttp/psr7/src/Request.php +++ b/vendor/guzzlehttp/psr7/src/Request.php @@ -45,7 +45,7 @@ public function __construct( $this->setHeaders($headers); $this->protocol = $version; - if (!$this->hasHeader('Host')) { + if (!isset($this->headerNames['host'])) { $this->updateHostFromUri(); } @@ -110,7 +110,7 @@ public function withUri(UriInterface $uri, $preserveHost = false) $new = clone $this; $new->uri = $uri; - if (!$preserveHost) { + if (!$preserveHost || !isset($this->headerNames['host'])) { $new->updateHostFromUri(); } diff --git a/vendor/guzzlehttp/psr7/src/Response.php b/vendor/guzzlehttp/psr7/src/Response.php index 2830c6c9ee10229c613e94f7b4360d6796c3e752..6e72c06b8c7ee232145696b767d5035f129f9dc2 100644 --- a/vendor/guzzlehttp/psr7/src/Response.php +++ b/vendor/guzzlehttp/psr7/src/Response.php @@ -93,6 +93,10 @@ public function __construct( $version = '1.1', $reason = null ) { + if (filter_var($status, FILTER_VALIDATE_INT) === false) { + throw new \InvalidArgumentException('Status code must be an integer value.'); + } + $this->statusCode = (int) $status; if ($body !== '' && $body !== null) { diff --git a/vendor/guzzlehttp/psr7/src/Rfc7230.php b/vendor/guzzlehttp/psr7/src/Rfc7230.php new file mode 100644 index 0000000000000000000000000000000000000000..505e4742b6e749f85e69499c013617df20f7232e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Rfc7230.php @@ -0,0 +1,18 @@ +<?php + +namespace GuzzleHttp\Psr7; + +final class Rfc7230 +{ + /** + * Header related regular expressions (copied from amphp/http package) + * (Note: once we require PHP 7.x we could just depend on the upstream package) + * + * Note: header delimiter (\r\n) is modified to \r?\n to accept line feed only delimiters for BC reasons. + * + * @link https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15 + * @license https://github.com/amphp/http/blob/v1.0.1/LICENSE + */ + const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m"; + const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; +} diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php index 575aab8489a60279366f1b1cca29d93ad77287cd..99f453a51ddfc57c171dd549ea9a8afb42a30ce5 100644 --- a/vendor/guzzlehttp/psr7/src/ServerRequest.php +++ b/vendor/guzzlehttp/psr7/src/ServerRequest.php @@ -166,7 +166,7 @@ private static function normalizeNestedFileSpec(array $files = []) public static function fromGlobals() { $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; - $headers = function_exists('getallheaders') ? getallheaders() : []; + $headers = getallheaders(); $uri = self::getUriFromGlobals(); $body = new LazyOpenStream('php://input', 'r+'); $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; @@ -180,23 +180,41 @@ public static function fromGlobals() ->withUploadedFiles(self::normalizeFiles($_FILES)); } + private static function extractHostAndPortFromAuthority($authority) + { + $uri = 'http://'.$authority; + $parts = parse_url($uri); + if (false === $parts) { + return [null, null]; + } + + $host = isset($parts['host']) ? $parts['host'] : null; + $port = isset($parts['port']) ? $parts['port'] : null; + + return [$host, $port]; + } + /** * Get a Uri populated with values from $_SERVER. * * @return UriInterface */ - public static function getUriFromGlobals() { + public static function getUriFromGlobals() + { $uri = new Uri(''); $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); $hasPort = false; if (isset($_SERVER['HTTP_HOST'])) { - $hostHeaderParts = explode(':', $_SERVER['HTTP_HOST']); - $uri = $uri->withHost($hostHeaderParts[0]); - if (isset($hostHeaderParts[1])) { + list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); + if ($host !== null) { + $uri = $uri->withHost($host); + } + + if ($port !== null) { $hasPort = true; - $uri = $uri->withPort($hostHeaderParts[1]); + $uri = $uri->withPort($port); } } elseif (isset($_SERVER['SERVER_NAME'])) { $uri = $uri->withHost($_SERVER['SERVER_NAME']); @@ -210,7 +228,7 @@ public static function getUriFromGlobals() { $hasQuery = false; if (isset($_SERVER['REQUEST_URI'])) { - $requestUriParts = explode('?', $_SERVER['REQUEST_URI']); + $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2); $uri = $uri->withPath($requestUriParts[0]); if (isset($requestUriParts[1])) { $hasQuery = true; diff --git a/vendor/guzzlehttp/psr7/src/Stream.php b/vendor/guzzlehttp/psr7/src/Stream.php index e33662879ffbac5ee1fc971f1dc17fdedfd8979f..111795eb032375a564cf64c489a5426b10513550 100644 --- a/vendor/guzzlehttp/psr7/src/Stream.php +++ b/vendor/guzzlehttp/psr7/src/Stream.php @@ -24,11 +24,11 @@ class Stream implements StreamInterface 'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true, 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, 'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true, - 'x+t' => true, 'c+t' => true, 'a+' => true + 'x+t' => true, 'c+t' => true, 'a+' => true, 'rb+' => true, ], 'write' => [ 'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, - 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, + 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, 'rb+' => true, 'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true, 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true ] @@ -70,15 +70,6 @@ public function __construct($stream, $options = []) $this->uri = $this->getMetadata('uri'); } - public function __get($name) - { - if ($name == 'stream') { - throw new \RuntimeException('The stream is detached'); - } - - throw new \BadMethodCallException('No value for ' . $name); - } - /** * Closes the stream when the destructed */ @@ -99,6 +90,10 @@ public function __toString() public function getContents() { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + $contents = stream_get_contents($this->stream); if ($contents === false) { @@ -173,11 +168,19 @@ public function isSeekable() public function eof() { - return !$this->stream || feof($this->stream); + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + return feof($this->stream); } public function tell() { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + $result = ftell($this->stream); if ($result === false) { @@ -194,9 +197,13 @@ public function rewind() public function seek($offset, $whence = SEEK_SET) { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } if (!$this->seekable) { throw new \RuntimeException('Stream is not seekable'); - } elseif (fseek($this->stream, $offset, $whence) === -1) { + } + if (fseek($this->stream, $offset, $whence) === -1) { throw new \RuntimeException('Unable to seek to stream position ' . $offset . ' with whence ' . var_export($whence, true)); } @@ -204,6 +211,9 @@ public function seek($offset, $whence = SEEK_SET) public function read($length) { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } if (!$this->readable) { throw new \RuntimeException('Cannot read from non-readable stream'); } @@ -225,6 +235,9 @@ public function read($length) public function write($string) { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } if (!$this->writable) { throw new \RuntimeException('Cannot write to a non-writable stream'); } diff --git a/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/vendor/guzzlehttp/psr7/src/StreamWrapper.php index cf7b2232e463e21dc3eb6de440fdef70c6d057e7..0f3a2856a2e592c1d57940fe6bb5be3cc8e46228 100644 --- a/vendor/guzzlehttp/psr7/src/StreamWrapper.php +++ b/vendor/guzzlehttp/psr7/src/StreamWrapper.php @@ -38,9 +38,21 @@ public static function getResource(StreamInterface $stream) . 'writable, or both.'); } - return fopen('guzzle://stream', $mode, null, stream_context_create([ + return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream)); + } + + /** + * Creates a stream context that can be used to open a stream as a php stream resource. + * + * @param StreamInterface $stream + * + * @return resource + */ + public static function createStreamContext(StreamInterface $stream) + { + return stream_context_create([ 'guzzle' => ['stream' => $stream] - ])); + ]); } /** @@ -94,12 +106,21 @@ public function stream_seek($offset, $whence) return true; } + public function stream_cast($cast_as) + { + $stream = clone($this->stream); + + return $stream->detach(); + } + public function stream_stat() { static $modeMap = [ 'r' => 33060, + 'rb' => 33060, 'r+' => 33206, - 'w' => 33188 + 'w' => 33188, + 'wb' => 33188 ]; return [ @@ -118,4 +139,23 @@ public function stream_stat() 'blocks' => 0 ]; } + + public function url_stat($path, $flags) + { + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => 0, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } } diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php index f46c1db9e07812e8d0069a4d9beb145ea3bfbf31..36219568c8763e03ac74ca89ec42a1522c02c90a 100644 --- a/vendor/guzzlehttp/psr7/src/Uri.php +++ b/vendor/guzzlehttp/psr7/src/Uri.php @@ -301,15 +301,7 @@ public static function resolve(UriInterface $base, $rel) */ public static function withoutQueryValue(UriInterface $uri, $key) { - $current = $uri->getQuery(); - if ($current === '') { - return $uri; - } - - $decodedKey = rawurldecode($key); - $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) { - return rawurldecode(explode('=', $part)[0]) !== $decodedKey; - }); + $result = self::getFilteredQueryString($uri, [$key]); return $uri->withQuery(implode('&', $result)); } @@ -331,26 +323,29 @@ public static function withoutQueryValue(UriInterface $uri, $key) */ public static function withQueryValue(UriInterface $uri, $key, $value) { - $current = $uri->getQuery(); + $result = self::getFilteredQueryString($uri, [$key]); - if ($current === '') { - $result = []; - } else { - $decodedKey = rawurldecode($key); - $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) { - return rawurldecode(explode('=', $part)[0]) !== $decodedKey; - }); - } + $result[] = self::generateQueryString($key, $value); - // Query string separators ("=", "&") within the key or value need to be encoded - // (while preventing double-encoding) before setting the query string. All other - // chars that need percent-encoding will be encoded by withQuery(). - $key = strtr($key, self::$replaceQuery); + return $uri->withQuery(implode('&', $result)); + } - if ($value !== null) { - $result[] = $key . '=' . strtr($value, self::$replaceQuery); - } else { - $result[] = $key; + /** + * Creates a new URI with multiple specific query string values. + * + * It has the same behavior as withQueryValue() but for an associative array of key => value. + * + * @param UriInterface $uri URI to use as a base. + * @param array $keyValueArray Associative array of key and values + * + * @return UriInterface + */ + public static function withQueryValues(UriInterface $uri, array $keyValueArray) + { + $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); + + foreach ($keyValueArray as $key => $value) { + $result[] = self::generateQueryString($key, $value); } return $uri->withQuery(implode('&', $result)); @@ -620,6 +615,47 @@ private function filterPort($port) return $port; } + /** + * @param UriInterface $uri + * @param array $keys + * + * @return array + */ + private static function getFilteredQueryString(UriInterface $uri, array $keys) + { + $current = $uri->getQuery(); + + if ($current === '') { + return []; + } + + $decodedKeys = array_map('rawurldecode', $keys); + + return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { + return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); + }); + } + + /** + * @param string $key + * @param string|null $value + * + * @return string + */ + private static function generateQueryString($key, $value) + { + // Query string separators ("=", "&") within the key or value need to be encoded + // (while preventing double-encoding) before setting the query string. All other + // chars that need percent-encoding will be encoded by withQuery(). + $queryString = strtr($key, self::$replaceQuery); + + if ($value !== null) { + $queryString .= '=' . strtr($value, self::$replaceQuery); + } + + return $queryString; + } + private function removeDefaultPort() { if ($this->port !== null && self::isDefaultPort($this)) { diff --git a/vendor/guzzlehttp/psr7/src/functions.php b/vendor/guzzlehttp/psr7/src/functions.php index e40348d6abdee0bafd739cae12f99f033b131da8..957bfb42aecc947a08c9354ba3f834f3dadbc8d3 100644 --- a/vendor/guzzlehttp/psr7/src/functions.php +++ b/vendor/guzzlehttp/psr7/src/functions.php @@ -69,10 +69,10 @@ function uri_for($uri) * - metadata: Array of custom metadata. * - size: Size of the stream. * - * @param resource|string|null|int|float|bool|StreamInterface|callable $resource Entity body data - * @param array $options Additional options + * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data + * @param array $options Additional options * - * @return Stream + * @return StreamInterface * @throws \InvalidArgumentException if the $resource arg is not valid. */ function stream_for($resource = '', array $options = []) @@ -238,7 +238,7 @@ function modify_request(RequestInterface $request, array $changes) } if ($request instanceof ServerRequestInterface) { - return new ServerRequest( + return (new ServerRequest( isset($changes['method']) ? $changes['method'] : $request->getMethod(), $uri, $headers, @@ -247,7 +247,11 @@ function modify_request(RequestInterface $request, array $changes) ? $changes['version'] : $request->getProtocolVersion(), $request->getServerParams() - ); + )) + ->withParsedBody($request->getParsedBody()) + ->withQueryParams($request->getQueryParams()) + ->withCookieParams($request->getCookieParams()) + ->withUploadedFiles($request->getUploadedFiles()); } return new Request( @@ -431,7 +435,7 @@ function hash( * @param StreamInterface $stream Stream to read from * @param int $maxLength Maximum buffer length * - * @return string|bool + * @return string */ function readline(StreamInterface $stream, $maxLength = null) { @@ -495,7 +499,7 @@ function parse_response($message) // between status-code and reason-phrase is required. But browsers accept // responses without space and reason as well. if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { - throw new \InvalidArgumentException('Invalid response string'); + throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']); } $parts = explode(' ', $data['start-line'], 3); @@ -516,8 +520,8 @@ function parse_response($message) * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']). * - * @param string $str Query string to parse - * @param bool|string $urlEncoding How the query string is encoded + * @param string $str Query string to parse + * @param int|bool $urlEncoding How the query string is encoded * * @return array */ @@ -533,9 +537,9 @@ function parse_query($str, $urlEncoding = true) $decoder = function ($value) { return rawurldecode(str_replace('+', ' ', $value)); }; - } elseif ($urlEncoding == PHP_QUERY_RFC3986) { + } elseif ($urlEncoding === PHP_QUERY_RFC3986) { $decoder = 'rawurldecode'; - } elseif ($urlEncoding == PHP_QUERY_RFC1738) { + } elseif ($urlEncoding === PHP_QUERY_RFC1738) { $decoder = 'urldecode'; } else { $decoder = function ($str) { return $str; }; @@ -633,6 +637,7 @@ function mimetype_from_filename($filename) function mimetype_from_extension($extension) { static $mimetypes = [ + '3gp' => 'video/3gpp', '7z' => 'application/x-7z-compressed', 'aac' => 'audio/x-aac', 'ai' => 'application/postscript', @@ -680,6 +685,7 @@ function mimetype_from_extension($extension) 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mov' => 'video/quicktime', + 'mkv' => 'video/x-matroska', 'mp3' => 'audio/mpeg', 'mp4' => 'video/mp4', 'mp4a' => 'audio/mp4', @@ -758,29 +764,53 @@ function _parse_message($message) throw new \InvalidArgumentException('Invalid message'); } - // Iterate over each line in the message, accounting for line endings - $lines = preg_split('/(\\r?\\n)/', $message, -1, PREG_SPLIT_DELIM_CAPTURE); - $result = ['start-line' => array_shift($lines), 'headers' => [], 'body' => '']; - array_shift($lines); + $message = ltrim($message, "\r\n"); - for ($i = 0, $totalLines = count($lines); $i < $totalLines; $i += 2) { - $line = $lines[$i]; - // If two line breaks were encountered, then this is the end of body - if (empty($line)) { - if ($i < $totalLines - 1) { - $result['body'] = implode('', array_slice($lines, $i + 2)); - } - break; - } - if (strpos($line, ':')) { - $parts = explode(':', $line, 2); - $key = trim($parts[0]); - $value = isset($parts[1]) ? trim($parts[1]) : ''; - $result['headers'][$key][] = $value; + $messageParts = preg_split("/\r?\n\r?\n/", $message, 2); + + if ($messageParts === false || count($messageParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing header delimiter'); + } + + list($rawHeaders, $body) = $messageParts; + $rawHeaders .= "\r\n"; // Put back the delimiter we split previously + $headerParts = preg_split("/\r?\n/", $rawHeaders, 2); + + if ($headerParts === false || count($headerParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing status line'); + } + + list($startLine, $rawHeaders) = $headerParts; + + if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') { + // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0 + $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders); + } + + /** @var array[] $headerLines */ + $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER); + + // If these aren't the same, then one line didn't match and there's an invalid header. + if ($count !== substr_count($rawHeaders, "\n")) { + // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4 + if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { + throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding'); } + + throw new \InvalidArgumentException('Invalid header syntax'); } - return $result; + $headers = []; + + foreach ($headerLines as $headerLine) { + $headers[$headerLine[1]][] = $headerLine[2]; + } + + return [ + 'start-line' => $startLine, + 'headers' => $headers, + 'body' => $body, + ]; } /** @@ -809,6 +839,46 @@ function _parse_request_uri($path, array $headers) return $scheme . '://' . $host . '/' . ltrim($path, '/'); } +/** + * Get a short summary of the message body + * + * Will return `null` if the response is not printable. + * + * @param MessageInterface $message The message to get the body summary + * @param int $truncateAt The maximum allowed size of the summary + * + * @return null|string + */ +function get_message_body_summary(MessageInterface $message, $truncateAt = 120) +{ + $body = $message->getBody(); + + if (!$body->isSeekable() || !$body->isReadable()) { + return null; + } + + $size = $body->getSize(); + + if ($size === 0) { + return null; + } + + $summary = $body->read($truncateAt); + $body->rewind(); + + if ($size > $truncateAt) { + $summary .= ' (truncated...)'; + } + + // Matches any printable character, including unicode characters: + // letters, marks, numbers, punctuation, spacing, and separators. + if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) { + return null; + } + + return $summary; +} + /** @internal */ function _caseless_remove($keys, array $data) { diff --git a/vendor/masterminds/html5/.gitignore b/vendor/masterminds/html5/.gitignore index f9ead4a8f306d0a78a893eaf4d1d6b84a2ecaac8..1fa9e586153da6654167044016b906de96eeb15e 100644 --- a/vendor/masterminds/html5/.gitignore +++ b/vendor/masterminds/html5/.gitignore @@ -1,4 +1,5 @@ vendor/ scratch.php composer.lock -build/ \ No newline at end of file +build/ +.php_cs.cache diff --git a/vendor/masterminds/html5/.php_cs.dist b/vendor/masterminds/html5/.php_cs.dist new file mode 100644 index 0000000000000000000000000000000000000000..d5e49183d574f5cc4b3026763cba624517c03e25 --- /dev/null +++ b/vendor/masterminds/html5/.php_cs.dist @@ -0,0 +1,14 @@ +<?php + +$finder = PhpCsFixer\Finder::create() + ->in(__DIR__) +; + +return PhpCsFixer\Config::create() + ->setRules(array( + '@Symfony' => true, + 'concat_space' => array('spacing' => 'one'), + 'phpdoc_annotation_without_dot' => false, + )) + ->setFinder($finder) +; diff --git a/vendor/masterminds/html5/.travis.yml b/vendor/masterminds/html5/.travis.yml index 9183e6569b8a56350089f6ff74deb50c8f7056f2..f10bcf3f42e15cca03e4bba411cef66778747639 100644 --- a/vendor/masterminds/html5/.travis.yml +++ b/vendor/masterminds/html5/.travis.yml @@ -1,39 +1,42 @@ language: php - +dist: trusty sudo: false -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - hhvm - matrix: - include: - - php: 5.3 - dist: precise - fast_finish: true - -dist: trusty + include: + - php: 5.3 + dist: precise + env: COMPOSER_FLAGS="--prefer-lowest" + - php: 5.4 + - php: 5.5 + - php: 5.6 + env: SCRUTINIZER=1 + - php: 7.0 + env: COMPOSER_FLAGS="--prefer-lowest" + - php: 7.1 + env: CS_FIXER=1 + - php: 7.2 + env: BENCHMARK=1 + - php: hhvm + fast_finish: true cache: directories: - $HOME/.composer/cache -notifications: - irc: "irc.freenode.net#masterminds" - before_script: - composer self-update - - composer install + - composer update $COMPOSER_FLAGS --prefer-dist script: + - stty cols 120 + - if [ "$CS_FIXER" == 1 ]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.13.1/php-cs-fixer.phar && php php-cs-fixer.phar fix --dry-run --diff; fi - mkdir -p build/logs - ./vendor/bin/phpunit --coverage-clover=coverage.xml after_script: - - bash -c 'if [ "$TRAVIS_PHP_VERSION" == "5.6" ] ; then wget https://scrutinizer-ci.com/ocular.phar; fi;' - - bash -c 'if [ "$TRAVIS_PHP_VERSION" == "5.6" ] ; then php ocular.phar code-coverage:upload --format=php-clover coverage.xml; fi;' - - php test/benchmark/run.php 50 + - if [ "$SCRUTINIZER" == 1 ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.xml; fi + - if [ "$BENCHMARK" == 1 ]; then php test/benchmark/run.php 10; fi + +notifications: + irc: "irc.freenode.net#masterminds" diff --git a/vendor/masterminds/html5/README.md b/vendor/masterminds/html5/README.md index e2cfdf9527c5bf336c7ac92504ddd9308528d78c..ef247370085b2e7be43f84c8e3d5b6f7c2ef2865 100644 --- a/vendor/masterminds/html5/README.md +++ b/vendor/masterminds/html5/README.md @@ -2,7 +2,7 @@ HTML5 is a standards-compliant HTML5 parser and writer written entirely in PHP. It is stable and used in many production websites, and has -well over [one million downloads](https://packagist.org/packages/masterminds/html5). +well over [five million downloads](https://packagist.org/packages/masterminds/html5). HTML5 provides the following features. @@ -24,21 +24,21 @@ HTML5 provides the following features. Install HTML5-PHP using [composer](http://getcomposer.org/). -To install, add `masterminds/html5` to your `composer.json` file: +By adding the `masterminds/html5` dependency to your `composer.json` file: ```json { "require" : { - "masterminds/html5": "2.*" + "masterminds/html5": "^2.0" }, } ``` -(You may substitute `2.*` for a more specific release tag, of -course.) +By invoking require command via composer executable: -From there, use the `composer install` or `composer update` commands to -install. +```bash +composer require masterminds/html5 +``` ## Basic Usage @@ -50,8 +50,8 @@ Here is how you use the high-level `HTML5` library API: <?php // Assuming you installed from Composer: require "vendor/autoload.php"; -use Masterminds\HTML5; +use Masterminds\HTML5; // An example HTML document: $html = <<< 'HERE' @@ -75,8 +75,6 @@ print $html5->saveHTML($dom); // Or save it to a file: $html5->save($dom, 'out.html'); - -?> ``` The `$dom` created by the parser is a full `DOMDocument` object. And the @@ -117,8 +115,6 @@ The following options are supported: This library provides the following low-level APIs that you can use to create more customized HTML5 tools: -- An `InputStream` abstraction that can work with different kinds of -input source (not just files and strings). - A SAX-like event-based parser that you can hook into for special kinds of parsing. - A flexible error-reporting mechanism that can be tuned to document @@ -132,7 +128,6 @@ is well-documented. The parser is designed as follows: -- The `InputStream` portion handles direct I/O. - The `Scanner` handles scanning on behalf of the parser. - The `Tokenizer` requests data off of the scanner, parses it, clasifies it, and sends it to an `EventHandler`. It is a *recursive descent parser.* @@ -202,7 +197,7 @@ issues known issues that are not presently on the roadmap: - PLAINTEXT: Unsupported. - Adoption Agency Algorithm: Not yet implemented. (8.2.5.4.7) -##XML Namespaces +## XML Namespaces To use XML style namespaces you have to configure well the main `HTML5` instance. @@ -219,7 +214,7 @@ $dom->documentElement->namespaceURI; // http://www.example.com ``` You can also add some default prefixes that will not require the namespace declaration, -but it's elements will be namespaced. +but its elements will be namespaced. ```php use Masterminds\HTML5; @@ -243,7 +238,7 @@ a list of contributors. We owe a huge debt of gratitude to the original authors of html5lib. -While not much of the orignal parser remains, we learned a lot from +While not much of the original parser remains, we learned a lot from reading the html5lib library. And some pieces remain here. In particular, much of the UTF-8 and Unicode handling is derived from the html5lib project. diff --git a/vendor/masterminds/html5/RELEASE.md b/vendor/masterminds/html5/RELEASE.md index b4ddf824d7ac359aefa91a19b6025ce09d748cc8..3c51cecbf5f2e98de31472b343c3eff926fd9c57 100644 --- a/vendor/masterminds/html5/RELEASE.md +++ b/vendor/masterminds/html5/RELEASE.md @@ -1,5 +1,32 @@ # Release Notes +2.6.0 (2019-03-10) + +- #163: Allow to pass a charset to the Scanner + +2.5.0 (2018-12-27) + +- #162, #161, #155, #154, #153, #151: big performance improvements +- #156: fixed typos +- #160: adopt and enforce code style +- #159: remove deprecated php unit base test case +- #150: backport changes from old master branch + +2.4.0 (2018-11-17) + +- #148: Improve performance by moving sequence matching +- #147: Improve the Tokenizer performance +- #146: Improve performance by relying on a native string instead of InputStream +- #144: Add DOM extension in composer.json +- #145: Add more extensions on composer.json, improve phpdocs and remove dead code +- #143: Remove experimental comment + +2.3.1 (2018-10-18) + +- #121: Audio is not a block tag (fixed by #141) +- #136: Handle illegal self-closing according to spec (fixed by #137) +- #141: Minor fixes in the README + 2.3.0 (2017-09-04) - #129: image within inline svg breaks system (fixed by #133) diff --git a/vendor/masterminds/html5/bin/entities.php b/vendor/masterminds/html5/bin/entities.php index 0fbd6eca0cd1db0496e52afa5ecf783e4569b0c7..56323a34112d4cd6a3ded6aa557db76b856c266a 100644 --- a/vendor/masterminds/html5/bin/entities.php +++ b/vendor/masterminds/html5/bin/entities.php @@ -11,16 +11,16 @@ $table = array(); foreach ($json as $name => $obj) { - $sname = substr($name, 1, -1); - $table[$sname] = $obj->characters; + $sname = substr($name, 1, -1); + $table[$sname] = $obj->characters; } -print '<?php +echo '<?php namespace Masterminds\\HTML5; /** Entity lookup tables. This class is automatically generated. */ class Entities { public static $byName = '; var_export($table); -print '; +echo '; }' . PHP_EOL; //print serialize($table); diff --git a/vendor/masterminds/html5/composer.json b/vendor/masterminds/html5/composer.json index f4f43d325519a710d23689ab7eb5a8473f99f019..a1c059bef73bb67bdda94b5c498a5a55cbcb292d 100644 --- a/vendor/masterminds/html5/composer.json +++ b/vendor/masterminds/html5/composer.json @@ -20,12 +20,14 @@ } ], "require" : { + "ext-ctype": "*", + "ext-dom": "*", "ext-libxml" : "*", "php" : ">=5.3.0" }, "require-dev": { "satooshi/php-coveralls": "1.0.*", - "phpunit/phpunit" : "4.*", + "phpunit/phpunit" : "^4.8.35", "sami/sami": "~2.0" }, "autoload": { @@ -36,7 +38,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.6-dev" } } } diff --git a/vendor/masterminds/html5/example.php b/vendor/masterminds/html5/example.php index 5e3b25fc00fb92130de9b939a18141b896bf4827..e4e1f22f99d13418872d8b62dd5571be4b496252 100644 --- a/vendor/masterminds/html5/example.php +++ b/vendor/masterminds/html5/example.php @@ -1,9 +1,8 @@ <?php -require "vendor/autoload.php"; +require 'vendor/autoload.php'; use Masterminds\HTML5; - $html = <<< 'HERE' <html> <head> @@ -28,6 +27,6 @@ $html5 = new HTML5(); $dom = $html5->loadHTML($html); -print "Converting to HTML 5\n"; +echo "Converting to HTML 5\n"; -$html5->save($dom, fopen("php://stdin", 'w')); +$html5->save($dom, fopen('php://stdin', 'w')); diff --git a/vendor/masterminds/html5/sami.php b/vendor/masterminds/html5/sami.php index d0dd80b544e9ee4e67395e90c20da97c887d1c96..e776cc1c23f359f9d172fe9e700a8d583bc98e93 100644 --- a/vendor/masterminds/html5/sami.php +++ b/vendor/masterminds/html5/sami.php @@ -2,9 +2,9 @@ use Sami\Sami; -return new Sami(__DIR__ . '/src' , array( - 'title' => 'HTML5-PHP API', - 'build_dir' => __DIR__.'/build/apidoc', - 'cache_dir' => __DIR__.'/build/sami-cache', +return new Sami(__DIR__ . '/src', array( + 'title' => 'HTML5-PHP API', + 'build_dir' => __DIR__ . '/build/apidoc', + 'cache_dir' => __DIR__ . '/build/sami-cache', 'default_opened_level' => 1, -)); \ No newline at end of file +)); diff --git a/vendor/masterminds/html5/src/HTML5.php b/vendor/masterminds/html5/src/HTML5.php index 990e8f4339dcae342d1eab05c238318e2b2a1e5c..6316e43a988049defef6b7dced4d7c0c9f5caa4e 100644 --- a/vendor/masterminds/html5/src/HTML5.php +++ b/vendor/masterminds/html5/src/HTML5.php @@ -1,8 +1,7 @@ <?php + namespace Masterminds; -use Masterminds\HTML5\Parser\FileInputStream; -use Masterminds\HTML5\Parser\StringInputStream; use Masterminds\HTML5\Parser\DOMTreeBuilder; use Masterminds\HTML5\Parser\Scanner; use Masterminds\HTML5\Parser\Tokenizer; @@ -11,39 +10,38 @@ /** * This class offers convenience methods for parsing and serializing HTML5. - * It is roughly designed to mirror the \DOMDocument class that is - * provided with most versions of PHP. - * - * EXPERIMENTAL. This may change or be completely replaced. + * It is roughly designed to mirror the \DOMDocument native class. */ class HTML5 { - /** * Global options for the parser and serializer. * * @var array */ - protected $options = array( - // If the serializer should encode all entities. - 'encode_entities' => false + private $defaultOptions = array( + // Whether the serializer should aggressively encode all characters as entities. + 'encode_entities' => false, + + // Prevents the parser from automatically assigning the HTML5 namespace to the DOM document. + 'disable_html_ns' => false, ); protected $errors = array(); - public function __construct(array $options = array()) + public function __construct(array $defaultOptions = array()) { - $this->options = array_merge($this->options, $options); + $this->defaultOptions = array_merge($this->defaultOptions, $defaultOptions); } /** - * Get the default options. + * Get the current default options. * - * @return array The default options. + * @return array */ public function getOptions() { - return $this->options; + return $this->defaultOptions; } /** @@ -56,26 +54,22 @@ public function getOptions() * * The rules governing parsing are set out in the HTML 5 spec. * - * @param string $file - * The path to the file to parse. If this is a resource, it is - * assumed to be an open stream whose pointer is set to the first - * byte of input. - * @param array $options - * Configuration options when parsing the HTML + * @param string|resource $file The path to the file to parse. If this is a resource, it is + * assumed to be an open stream whose pointer is set to the first + * byte of input. + * @param array $options Configuration options when parsing the HTML. + * * @return \DOMDocument A DOM document. These object type is defined by the libxml - * library, and should have been included with your version of PHP. + * library, and should have been included with your version of PHP. */ public function load($file, array $options = array()) { // Handle the case where file is a resource. if (is_resource($file)) { - // FIXME: We need a StreamInputStream class. - return $this->loadHTML(stream_get_contents($file), $options); + return $this->parse(stream_get_contents($file), $options); } - $input = new FileInputStream($file); - - return $this->parse($input, $options); + return $this->parse(file_get_contents($file), $options); } /** @@ -84,18 +78,15 @@ public function load($file, array $options = array()) * Take a string of HTML 5 (or earlier) and parse it into a * DOMDocument. * - * @param string $string - * A html5 document as a string. - * @param array $options - * Configuration options when parsing the HTML + * @param string $string A html5 document as a string. + * @param array $options Configuration options when parsing the HTML. + * * @return \DOMDocument A DOM document. DOM is part of libxml, which is included with - * almost all distribtions of PHP. + * almost all distribtions of PHP. */ public function loadHTML($string, array $options = array()) { - $input = new StringInputStream($string); - - return $this->parse($input, $options); + return $this->parse($string, $options); } /** @@ -104,15 +95,13 @@ public function loadHTML($string, array $options = array()) * This is here to provide backwards compatibility with the * PHP DOM implementation. It simply calls load(). * - * @param string $file - * The path to the file to parse. If this is a resource, it is - * assumed to be an open stream whose pointer is set to the first - * byte of input. - * @param array $options - * Configuration options when parsing the HTML + * @param string $file The path to the file to parse. If this is a resource, it is + * assumed to be an open stream whose pointer is set to the first + * byte of input. + * @param array $options Configuration options when parsing the HTML. * * @return \DOMDocument A DOM document. These object type is defined by the libxml - * library, and should have been included with your version of PHP. + * library, and should have been included with your version of PHP. */ public function loadHTMLFile($file, array $options = array()) { @@ -122,23 +111,19 @@ public function loadHTMLFile($file, array $options = array()) /** * Parse a HTML fragment from a string. * - * @param string $string - * The html5 fragment as a string. - * @param array $options - * Configuration options when parsing the HTML + * @param string $string the HTML5 fragment as a string + * @param array $options Configuration options when parsing the HTML * * @return \DOMDocumentFragment A DOM fragment. The DOM is part of libxml, which is included with - * almost all distributions of PHP. + * almost all distributions of PHP. */ public function loadHTMLFragment($string, array $options = array()) { - $input = new StringInputStream($string); - - return $this->parseFragment($input, $options); + return $this->parseFragment($string, $options); } /** - * Return all errors encountered into parsing phase + * Return all errors encountered into parsing phase. * * @return array */ @@ -148,7 +133,7 @@ public function getErrors() } /** - * Return true it some errors were encountered into parsing phase + * Return true it some errors were encountered into parsing phase. * * @return bool */ @@ -158,18 +143,20 @@ public function hasErrors() } /** - * Parse an input stream. + * Parse an input string. * - * Lower-level loading function. This requires an input stream instead - * of a string, file, or resource. + * @param string $input + * @param array $options + * + * @return \DOMDocument */ - public function parse(\Masterminds\HTML5\Parser\InputStream $input, array $options = array()) + public function parse($input, array $options = array()) { $this->errors = array(); - $options = array_merge($this->getOptions(), $options); + $options = array_merge($this->defaultOptions, $options); $events = new DOMTreeBuilder(false, $options); - $scanner = new Scanner($input); - $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML: Tokenizer::CONFORMANT_HTML); + $scanner = new Scanner($input, !empty($options['encoding']) ? $options['encoding'] : 'UTF-8'); + $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML : Tokenizer::CONFORMANT_HTML); $parser->parse(); $this->errors = $events->getErrors(); @@ -182,13 +169,18 @@ public function parse(\Masterminds\HTML5\Parser\InputStream $input, array $optio * * Lower-level loading function. This requires an input stream instead * of a string, file, or resource. + * + * @param string $input The input data to parse in the form of a string. + * @param array $options An array of options. + * + * @return \DOMDocumentFragment */ - public function parseFragment(\Masterminds\HTML5\Parser\InputStream $input, array $options = array()) + public function parseFragment($input, array $options = array()) { - $options = array_merge($this->getOptions(), $options); + $options = array_merge($this->defaultOptions, $options); $events = new DOMTreeBuilder(true, $options); - $scanner = new Scanner($input); - $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML: Tokenizer::CONFORMANT_HTML); + $scanner = new Scanner($input, !empty($options['encoding']) ? $options['encoding'] : 'UTF-8'); + $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML : Tokenizer::CONFORMANT_HTML); $parser->parse(); $this->errors = $events->getErrors(); @@ -199,15 +191,12 @@ public function parseFragment(\Masterminds\HTML5\Parser\InputStream $input, arra /** * Save a DOM into a given file as HTML5. * - * @param mixed $dom - * The DOM to be serialized. - * @param string $file - * The filename to be written. - * @param array $options - * Configuration options when serializing the DOM. These include: - * - encode_entities: Text written to the output is escaped by default and not all - * entities are encoded. If this is set to true all entities will be encoded. - * Defaults to false. + * @param mixed $dom The DOM to be serialized. + * @param string|resource $file The filename to be written or resource to write to. + * @param array $options Configuration options when serializing the DOM. These include: + * - encode_entities: Text written to the output is escaped by default and not all + * entities are encoded. If this is set to true all entities will be encoded. + * Defaults to false. */ public function save($dom, $file, $options = array()) { @@ -216,9 +205,9 @@ public function save($dom, $file, $options = array()) $stream = $file; $close = false; } else { - $stream = fopen($file, 'w'); + $stream = fopen($file, 'wb'); } - $options = array_merge($this->getOptions(), $options); + $options = array_merge($this->defaultOptions, $options); $rules = new OutputRules($stream, $options); $trav = new Traverser($dom, $stream, $rules, $options); @@ -232,21 +221,19 @@ public function save($dom, $file, $options = array()) /** * Convert a DOM into an HTML5 string. * - * @param mixed $dom - * The DOM to be serialized. - * @param array $options - * Configuration options when serializing the DOM. These include: - * - encode_entities: Text written to the output is escaped by default and not all - * entities are encoded. If this is set to true all entities will be encoded. - * Defaults to false. + * @param mixed $dom The DOM to be serialized. + * @param array $options Configuration options when serializing the DOM. These include: + * - encode_entities: Text written to the output is escaped by default and not all + * entities are encoded. If this is set to true all entities will be encoded. + * Defaults to false. * * @return string A HTML5 documented generated from the DOM. */ public function saveHTML($dom, $options = array()) { - $stream = fopen('php://temp', 'w'); - $this->save($dom, $stream, array_merge($this->getOptions(), $options)); + $stream = fopen('php://temp', 'wb'); + $this->save($dom, $stream, array_merge($this->defaultOptions, $options)); - return stream_get_contents($stream, - 1, 0); + return stream_get_contents($stream, -1, 0); } } diff --git a/vendor/masterminds/html5/src/HTML5/Elements.php b/vendor/masterminds/html5/src/HTML5/Elements.php index 0e880e7f693507e58f555388b985476ac1268829..8fe798789e8d2c61844e52246e03361a19915cdf 100644 --- a/vendor/masterminds/html5/src/HTML5/Elements.php +++ b/vendor/masterminds/html5/src/HTML5/Elements.php @@ -2,6 +2,7 @@ /** * Provide general element functions. */ + namespace Masterminds\HTML5; /** @@ -17,7 +18,6 @@ */ class Elements { - /** * Indicates an element is described in the specification. */ @@ -77,116 +77,116 @@ class Elements * @var array */ public static $html5 = array( - "a" => 1, - "abbr" => 1, - "address" => 65, // NORMAL | BLOCK_TAG - "area" => 9, // NORMAL | VOID_TAG - "article" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "aside" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "audio" => 65, // NORMAL | BLOCK_TAG - "b" => 1, - "base" => 9, // NORMAL | VOID_TAG - "bdi" => 1, - "bdo" => 1, - "blockquote" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "body" => 1, - "br" => 9, // NORMAL | VOID_TAG - "button" => 1, - "canvas" => 65, // NORMAL | BLOCK_TAG - "caption" => 1, - "cite" => 1, - "code" => 1, - "col" => 9, // NORMAL | VOID_TAG - "colgroup" => 1, - "command" => 9, // NORMAL | VOID_TAG + 'a' => 1, + 'abbr' => 1, + 'address' => 65, // NORMAL | BLOCK_TAG + 'area' => 9, // NORMAL | VOID_TAG + 'article' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'aside' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'audio' => 1, // NORMAL + 'b' => 1, + 'base' => 9, // NORMAL | VOID_TAG + 'bdi' => 1, + 'bdo' => 1, + 'blockquote' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'body' => 1, + 'br' => 9, // NORMAL | VOID_TAG + 'button' => 1, + 'canvas' => 65, // NORMAL | BLOCK_TAG + 'caption' => 1, + 'cite' => 1, + 'code' => 1, + 'col' => 9, // NORMAL | VOID_TAG + 'colgroup' => 1, + 'command' => 9, // NORMAL | VOID_TAG // "data" => 1, // This is highly experimental and only part of the whatwg spec (not w3c). See https://developer.mozilla.org/en-US/docs/HTML/Element/data - "datalist" => 1, - "dd" => 65, // NORMAL | BLOCK_TAG - "del" => 1, - "details" => 17, // NORMAL | AUTOCLOSE_P, - "dfn" => 1, - "dialog" => 17, // NORMAL | AUTOCLOSE_P, - "div" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "dl" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "dt" => 1, - "em" => 1, - "embed" => 9, // NORMAL | VOID_TAG - "fieldset" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "figcaption" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "figure" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "footer" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "form" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "h1" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "h2" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "h3" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "h4" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "h5" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "h6" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "head" => 1, - "header" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "hgroup" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "hr" => 73, // NORMAL | VOID_TAG - "html" => 1, - "i" => 1, - "iframe" => 3, // NORMAL | TEXT_RAW - "img" => 9, // NORMAL | VOID_TAG - "input" => 9, // NORMAL | VOID_TAG - "kbd" => 1, - "ins" => 1, - "keygen" => 9, // NORMAL | VOID_TAG - "label" => 1, - "legend" => 1, - "li" => 1, - "link" => 9, // NORMAL | VOID_TAG - "map" => 1, - "mark" => 1, - "menu" => 17, // NORMAL | AUTOCLOSE_P, - "meta" => 9, // NORMAL | VOID_TAG - "meter" => 1, - "nav" => 17, // NORMAL | AUTOCLOSE_P, - "noscript" => 65, // NORMAL | BLOCK_TAG - "object" => 1, - "ol" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "optgroup" => 1, - "option" => 1, - "output" => 65, // NORMAL | BLOCK_TAG - "p" => 209, // NORMAL | AUTOCLOSE_P | BLOCK_TAG | BLOCK_ONLY_INLINE - "param" => 9, // NORMAL | VOID_TAG - "pre" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "progress" => 1, - "q" => 1, - "rp" => 1, - "rt" => 1, - "ruby" => 1, - "s" => 1, - "samp" => 1, - "script" => 3, // NORMAL | TEXT_RAW - "section" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "select" => 1, - "small" => 1, - "source" => 9, // NORMAL | VOID_TAG - "span" => 1, - "strong" => 1, - "style" => 3, // NORMAL | TEXT_RAW - "sub" => 1, - "summary" => 17, // NORMAL | AUTOCLOSE_P, - "sup" => 1, - "table" => 65, // NORMAL | BLOCK_TAG - "tbody" => 1, - "td" => 1, - "textarea" => 5, // NORMAL | TEXT_RCDATA - "tfoot" => 65, // NORMAL | BLOCK_TAG - "th" => 1, - "thead" => 1, - "time" => 1, - "title" => 5, // NORMAL | TEXT_RCDATA - "tr" => 1, - "track" => 9, // NORMAL | VOID_TAG - "u" => 1, - "ul" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG - "var" => 1, - "video" => 65, // NORMAL | BLOCK_TAG - "wbr" => 9, // NORMAL | VOID_TAG + 'datalist' => 1, + 'dd' => 65, // NORMAL | BLOCK_TAG + 'del' => 1, + 'details' => 17, // NORMAL | AUTOCLOSE_P, + 'dfn' => 1, + 'dialog' => 17, // NORMAL | AUTOCLOSE_P, + 'div' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'dl' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'dt' => 1, + 'em' => 1, + 'embed' => 9, // NORMAL | VOID_TAG + 'fieldset' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'figcaption' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'figure' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'footer' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'form' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h1' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h2' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h3' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h4' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h5' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'h6' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'head' => 1, + 'header' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'hgroup' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'hr' => 73, // NORMAL | VOID_TAG + 'html' => 1, + 'i' => 1, + 'iframe' => 3, // NORMAL | TEXT_RAW + 'img' => 9, // NORMAL | VOID_TAG + 'input' => 9, // NORMAL | VOID_TAG + 'kbd' => 1, + 'ins' => 1, + 'keygen' => 9, // NORMAL | VOID_TAG + 'label' => 1, + 'legend' => 1, + 'li' => 1, + 'link' => 9, // NORMAL | VOID_TAG + 'map' => 1, + 'mark' => 1, + 'menu' => 17, // NORMAL | AUTOCLOSE_P, + 'meta' => 9, // NORMAL | VOID_TAG + 'meter' => 1, + 'nav' => 17, // NORMAL | AUTOCLOSE_P, + 'noscript' => 65, // NORMAL | BLOCK_TAG + 'object' => 1, + 'ol' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'optgroup' => 1, + 'option' => 1, + 'output' => 65, // NORMAL | BLOCK_TAG + 'p' => 209, // NORMAL | AUTOCLOSE_P | BLOCK_TAG | BLOCK_ONLY_INLINE + 'param' => 9, // NORMAL | VOID_TAG + 'pre' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'progress' => 1, + 'q' => 1, + 'rp' => 1, + 'rt' => 1, + 'ruby' => 1, + 's' => 1, + 'samp' => 1, + 'script' => 3, // NORMAL | TEXT_RAW + 'section' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'select' => 1, + 'small' => 1, + 'source' => 9, // NORMAL | VOID_TAG + 'span' => 1, + 'strong' => 1, + 'style' => 3, // NORMAL | TEXT_RAW + 'sub' => 1, + 'summary' => 17, // NORMAL | AUTOCLOSE_P, + 'sup' => 1, + 'table' => 65, // NORMAL | BLOCK_TAG + 'tbody' => 1, + 'td' => 1, + 'textarea' => 5, // NORMAL | TEXT_RCDATA + 'tfoot' => 65, // NORMAL | BLOCK_TAG + 'th' => 1, + 'thead' => 1, + 'time' => 1, + 'title' => 5, // NORMAL | TEXT_RCDATA + 'tr' => 1, + 'track' => 9, // NORMAL | VOID_TAG + 'u' => 1, + 'ul' => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG + 'var' => 1, + 'video' => 65, // NORMAL | BLOCK_TAG + 'wbr' => 9, // NORMAL | VOID_TAG // Legacy? 'basefont' => 8, // VOID_TAG @@ -202,7 +202,7 @@ class Elements 'marquee' => 0, 'isindex' => 8, // VOID_TAG 'xmp' => 20, // AUTOCLOSE_P | VOID_TAG | RAW_TEXT - 'noembed' => 2 // RAW_TEXT + 'noembed' => 2, // RAW_TEXT ); /** @@ -215,45 +215,45 @@ class Elements * @var array */ public static $mathml = array( - "maction" => 1, - "maligngroup" => 1, - "malignmark" => 1, - "math" => 1, - "menclose" => 1, - "merror" => 1, - "mfenced" => 1, - "mfrac" => 1, - "mglyph" => 1, - "mi" => 1, - "mlabeledtr" => 1, - "mlongdiv" => 1, - "mmultiscripts" => 1, - "mn" => 1, - "mo" => 1, - "mover" => 1, - "mpadded" => 1, - "mphantom" => 1, - "mroot" => 1, - "mrow" => 1, - "ms" => 1, - "mscarries" => 1, - "mscarry" => 1, - "msgroup" => 1, - "msline" => 1, - "mspace" => 1, - "msqrt" => 1, - "msrow" => 1, - "mstack" => 1, - "mstyle" => 1, - "msub" => 1, - "msup" => 1, - "msubsup" => 1, - "mtable" => 1, - "mtd" => 1, - "mtext" => 1, - "mtr" => 1, - "munder" => 1, - "munderover" => 1 + 'maction' => 1, + 'maligngroup' => 1, + 'malignmark' => 1, + 'math' => 1, + 'menclose' => 1, + 'merror' => 1, + 'mfenced' => 1, + 'mfrac' => 1, + 'mglyph' => 1, + 'mi' => 1, + 'mlabeledtr' => 1, + 'mlongdiv' => 1, + 'mmultiscripts' => 1, + 'mn' => 1, + 'mo' => 1, + 'mover' => 1, + 'mpadded' => 1, + 'mphantom' => 1, + 'mroot' => 1, + 'mrow' => 1, + 'ms' => 1, + 'mscarries' => 1, + 'mscarry' => 1, + 'msgroup' => 1, + 'msline' => 1, + 'mspace' => 1, + 'msqrt' => 1, + 'msrow' => 1, + 'mstack' => 1, + 'mstyle' => 1, + 'msub' => 1, + 'msup' => 1, + 'msubsup' => 1, + 'mtable' => 1, + 'mtd' => 1, + 'mtext' => 1, + 'mtr' => 1, + 'munder' => 1, + 'munderover' => 1, ); /** @@ -269,90 +269,90 @@ class Elements * @var array */ public static $svg = array( - "a" => 1, - "altGlyph" => 1, - "altGlyphDef" => 1, - "altGlyphItem" => 1, - "animate" => 1, - "animateColor" => 1, - "animateMotion" => 1, - "animateTransform" => 1, - "circle" => 1, - "clipPath" => 1, - "color-profile" => 1, - "cursor" => 1, - "defs" => 1, - "desc" => 1, - "ellipse" => 1, - "feBlend" => 1, - "feColorMatrix" => 1, - "feComponentTransfer" => 1, - "feComposite" => 1, - "feConvolveMatrix" => 1, - "feDiffuseLighting" => 1, - "feDisplacementMap" => 1, - "feDistantLight" => 1, - "feFlood" => 1, - "feFuncA" => 1, - "feFuncB" => 1, - "feFuncG" => 1, - "feFuncR" => 1, - "feGaussianBlur" => 1, - "feImage" => 1, - "feMerge" => 1, - "feMergeNode" => 1, - "feMorphology" => 1, - "feOffset" => 1, - "fePointLight" => 1, - "feSpecularLighting" => 1, - "feSpotLight" => 1, - "feTile" => 1, - "feTurbulence" => 1, - "filter" => 1, - "font" => 1, - "font-face" => 1, - "font-face-format" => 1, - "font-face-name" => 1, - "font-face-src" => 1, - "font-face-uri" => 1, - "foreignObject" => 1, - "g" => 1, - "glyph" => 1, - "glyphRef" => 1, - "hkern" => 1, - "image" => 1, - "line" => 1, - "linearGradient" => 1, - "marker" => 1, - "mask" => 1, - "metadata" => 1, - "missing-glyph" => 1, - "mpath" => 1, - "path" => 1, - "pattern" => 1, - "polygon" => 1, - "polyline" => 1, - "radialGradient" => 1, - "rect" => 1, - "script" => 3, // NORMAL | RAW_TEXT - "set" => 1, - "stop" => 1, - "style" => 3, // NORMAL | RAW_TEXT - "svg" => 1, - "switch" => 1, - "symbol" => 1, - "text" => 1, - "textPath" => 1, - "title" => 1, - "tref" => 1, - "tspan" => 1, - "use" => 1, - "view" => 1, - "vkern" => 1 + 'a' => 1, + 'altGlyph' => 1, + 'altGlyphDef' => 1, + 'altGlyphItem' => 1, + 'animate' => 1, + 'animateColor' => 1, + 'animateMotion' => 1, + 'animateTransform' => 1, + 'circle' => 1, + 'clipPath' => 1, + 'color-profile' => 1, + 'cursor' => 1, + 'defs' => 1, + 'desc' => 1, + 'ellipse' => 1, + 'feBlend' => 1, + 'feColorMatrix' => 1, + 'feComponentTransfer' => 1, + 'feComposite' => 1, + 'feConvolveMatrix' => 1, + 'feDiffuseLighting' => 1, + 'feDisplacementMap' => 1, + 'feDistantLight' => 1, + 'feFlood' => 1, + 'feFuncA' => 1, + 'feFuncB' => 1, + 'feFuncG' => 1, + 'feFuncR' => 1, + 'feGaussianBlur' => 1, + 'feImage' => 1, + 'feMerge' => 1, + 'feMergeNode' => 1, + 'feMorphology' => 1, + 'feOffset' => 1, + 'fePointLight' => 1, + 'feSpecularLighting' => 1, + 'feSpotLight' => 1, + 'feTile' => 1, + 'feTurbulence' => 1, + 'filter' => 1, + 'font' => 1, + 'font-face' => 1, + 'font-face-format' => 1, + 'font-face-name' => 1, + 'font-face-src' => 1, + 'font-face-uri' => 1, + 'foreignObject' => 1, + 'g' => 1, + 'glyph' => 1, + 'glyphRef' => 1, + 'hkern' => 1, + 'image' => 1, + 'line' => 1, + 'linearGradient' => 1, + 'marker' => 1, + 'mask' => 1, + 'metadata' => 1, + 'missing-glyph' => 1, + 'mpath' => 1, + 'path' => 1, + 'pattern' => 1, + 'polygon' => 1, + 'polyline' => 1, + 'radialGradient' => 1, + 'rect' => 1, + 'script' => 3, // NORMAL | RAW_TEXT + 'set' => 1, + 'stop' => 1, + 'style' => 3, // NORMAL | RAW_TEXT + 'svg' => 1, + 'switch' => 1, + 'symbol' => 1, + 'text' => 1, + 'textPath' => 1, + 'title' => 1, + 'tref' => 1, + 'tspan' => 1, + 'use' => 1, + 'view' => 1, + 'vkern' => 1, ); /** - * Some attributes in SVG are case sensetitive. + * Some attributes in SVG are case sensitive. * * This map contains key/value pairs with the key as the lowercase attribute * name and the value with the correct casing. @@ -419,11 +419,11 @@ class Elements 'viewtarget' => 'viewTarget', 'xchannelselector' => 'xChannelSelector', 'ychannelselector' => 'yChannelSelector', - 'zoomandpan' => 'zoomAndPan' + 'zoomandpan' => 'zoomAndPan', ); /** - * Some SVG elements are case sensetitive. + * Some SVG elements are case sensitive. * This map contains these. * * The map contains key/value store of the name is lowercase as the keys and @@ -465,7 +465,7 @@ class Elements 'glyphref' => 'glyphRef', 'lineargradient' => 'linearGradient', 'radialgradient' => 'radialGradient', - 'textpath' => 'textPath' + 'textpath' => 'textPath', ); /** @@ -477,32 +477,26 @@ class Elements * * Elements::isA('script', Elements::TEXT_RCDATA); // Returns false. * - * @param string $name - * The element name. - * @param int $mask - * One of the constants on this class. - * @return boolean true if the element matches the mask, false otherwise. + * @param string $name The element name. + * @param int $mask One of the constants on this class. + * + * @return bool true if the element matches the mask, false otherwise. */ public static function isA($name, $mask) { - if (! static::isElement($name)) { - return false; - } - - return (static::element($name) & $mask) == $mask; + return (static::element($name) & $mask) === $mask; } /** * Test if an element is a valid html5 element. * - * @param string $name - * The name of the element. + * @param string $name The name of the element. * - * @return bool True if a html5 element and false otherwise. + * @return bool true if a html5 element and false otherwise. */ public static function isHtml5Element($name) { - // html5 element names are case insensetitive. Forcing lowercase for the check. + // html5 element names are case insensitive. Forcing lowercase for the check. // Do we need this check or will all data passed here already be lowercase? return isset(static::$html5[strtolower($name)]); } @@ -510,41 +504,37 @@ public static function isHtml5Element($name) /** * Test if an element name is a valid MathML presentation element. * - * @param string $name - * The name of the element. + * @param string $name The name of the element. * - * @return bool True if a MathML name and false otherwise. + * @return bool true if a MathML name and false otherwise. */ public static function isMathMLElement($name) { - // MathML is case-sensetitive unlike html5 elements. + // MathML is case-sensitive unlike html5 elements. return isset(static::$mathml[$name]); } /** * Test if an element is a valid SVG element. * - * @param string $name - * The name of the element. + * @param string $name The name of the element. * - * @return boolean True if a SVG element and false otherise. + * @return bool true if a SVG element and false otherise. */ public static function isSvgElement($name) { - // SVG is case-sensetitive unlike html5 elements. + // SVG is case-sensitive unlike html5 elements. return isset(static::$svg[$name]); } /** * Is an element name valid in an html5 document. - * * This includes html5 elements along with other allowed embedded content * such as svg and mathml. * - * @param string $name - * The name of the element. + * @param string $name The name of the element. * - * @return bool True if valid and false otherwise. + * @return bool true if valid and false otherwise. */ public static function isElement($name) { @@ -554,10 +544,9 @@ public static function isElement($name) /** * Get the element mask for the given element name. * - * @param string $name - * The name of the element. + * @param string $name The name of the element. * - * @return int|bool The element mask or false if element does not exist. + * @return int the element mask. */ public static function element($name) { @@ -571,16 +560,15 @@ public static function element($name) return static::$mathml[$name]; } - return false; + return 0; } /** * Normalize a SVG element name to its proper case and form. * - * @param string $name - * The name of the element. + * @param string $name The name of the element. * - * @return string The normalized form of the element name. + * @return string the normalized form of the element name. */ public static function normalizeSvgElement($name) { @@ -595,8 +583,7 @@ public static function normalizeSvgElement($name) /** * Normalize a SVG attribute name to its proper case and form. * - * @param string $name - * The name of the attribute. + * @param string $name The name of the attribute. * * @return string The normalized form of the attribute name. */ @@ -612,11 +599,9 @@ public static function normalizeSvgAttribute($name) /** * Normalize a MathML attribute name to its proper case and form. - * * Note, all MathML element names are lowercase. * - * @param string $name - * The name of the attribute. + * @param string $name The name of the attribute. * * @return string The normalized form of the attribute name. */ @@ -625,7 +610,7 @@ public static function normalizeMathMlAttribute($name) $name = strtolower($name); // Only one attribute has a mixed case form for MathML. - if ($name == 'definitionurl') { + if ('definitionurl' === $name) { $name = 'definitionURL'; } diff --git a/vendor/masterminds/html5/src/HTML5/Entities.php b/vendor/masterminds/html5/src/HTML5/Entities.php index 2e605d652b8f96e95e46cea88f912ff594cdbfa6..0e7227dc1d605385ada8bd6859b826ad20078842 100644 --- a/vendor/masterminds/html5/src/HTML5/Entities.php +++ b/vendor/masterminds/html5/src/HTML5/Entities.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5; /** @@ -7,7 +8,6 @@ */ class Entities { - public static $byName = array( 'Aacute' => 'Á', 'Aacut' => 'Á', @@ -2231,6 +2231,6 @@ class Entities 'Zscr' => '𝒵', 'zscr' => '𝓏', 'zwj' => '', - 'zwnj' => '' + 'zwnj' => '', ); } diff --git a/vendor/masterminds/html5/src/HTML5/Exception.php b/vendor/masterminds/html5/src/HTML5/Exception.php index 8f33126bd49a5e5f78cd515980d008b56eb63269..64e97e6ff1ea5dd7b49e7603fe130cbb7abf2443 100644 --- a/vendor/masterminds/html5/src/HTML5/Exception.php +++ b/vendor/masterminds/html5/src/HTML5/Exception.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5; /** diff --git a/vendor/masterminds/html5/src/HTML5/InstructionProcessor.php b/vendor/masterminds/html5/src/HTML5/InstructionProcessor.php index ac6a23c54fe184dca8b3636c01c47909ff77c48f..33a73fcfbce510250a693880dbd17a37213a9dfe 100644 --- a/vendor/masterminds/html5/src/HTML5/InstructionProcessor.php +++ b/vendor/masterminds/html5/src/HTML5/InstructionProcessor.php @@ -2,6 +2,7 @@ /** * A handler for processor instructions. */ + namespace Masterminds\HTML5; /** @@ -18,7 +19,6 @@ */ interface InstructionProcessor { - /** * Process an individual processing instruction. * @@ -28,16 +28,14 @@ interface InstructionProcessor * - Making any subsequent modifications to the DOM by modifying the * DOMElement or its attached DOM tree. * - * @param DOMElement $element - * The parent element for the current processing instruction. - * @param string $name - * The instruction's name. E.g. `<?php` has the name `php`. - * @param string $data - * All of the data between the opening and closing PI marks. - * @return DOMElement The element that should be considered "Current". This may just be - * the element passed in, but if the processor added more elements, - * it may choose to reset the current element to one of the elements - * it created. (When in doubt, return the element passed in.) + * @param \DOMElement $element The parent element for the current processing instruction. + * @param string $name The instruction's name. E.g. `<?php` has the name `php`. + * @param string $data All of the data between the opening and closing PI marks. + * + * @return \DOMElement The element that should be considered "Current". This may just be + * the element passed in, but if the processor added more elements, + * it may choose to reset the current element to one of the elements + * it created. (When in doubt, return the element passed in.) */ public function process(\DOMElement $element, $name, $data); } diff --git a/vendor/masterminds/html5/src/HTML5/Parser/CharacterReference.php b/vendor/masterminds/html5/src/HTML5/Parser/CharacterReference.php index c1617e712571be5f6b12153c31634b40b3331308..490b5487bf6552e6f550de964076daff33318dd3 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/CharacterReference.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/CharacterReference.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5\Parser; use Masterminds\HTML5\Entities; @@ -6,25 +7,22 @@ /** * Manage entity references. * - * This is a simple resolver for HTML5 character reference entitites. - * See \Masterminds\HTML5\Entities for the list of supported entities. + * This is a simple resolver for HTML5 character reference entitites. See Entities for the list of supported entities. */ class CharacterReference { - protected static $numeric_mask = array( 0x0, 0x2FFFF, 0, - 0xFFFF + 0xFFFF, ); /** - * Given a name (e.g. - * 'amp'), lookup the UTF-8 character ('&') + * Given a name (e.g. 'amp'), lookup the UTF-8 character ('&'). + * + * @param string $name The name to look up. * - * @param string $name - * The name to look up. * @return string The character sequence. In UTF-8 this may be more than one byte. */ public static function lookupName($name) @@ -33,21 +31,17 @@ public static function lookupName($name) return isset(Entities::$byName[$name]) ? Entities::$byName[$name] : null; } - /** - * Given a Unicode codepoint, return the UTF-8 character. - * - * (NOT USED ANYWHERE) - */ - /* - * public static function lookupCode($codePoint) { return 'POINT'; } - */ - /** * Given a decimal number, return the UTF-8 character. + * + * @param $int + * + * @return false|string|string[]|null */ public static function lookupDecimal($int) { $entity = '&#' . $int . ';'; + // UNTESTED: This may fail on some planes. Couldn't find full documentation // on the value of the mask array. return mb_decode_numericentity($entity, static::$numeric_mask, 'utf-8'); @@ -55,6 +49,10 @@ public static function lookupDecimal($int) /** * Given a hexidecimal number, return the UTF-8 character. + * + * @param $hexdec + * + * @return false|string|string[]|null */ public static function lookupHex($hexdec) { diff --git a/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php b/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php index b26860da9c1bb1f3e1c851c6e2a5db95377f389b..f01cf4d1267e87511e815a3b0d3a3ef2170ce6b1 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php @@ -1,7 +1,9 @@ <?php + namespace Masterminds\HTML5\Parser; use Masterminds\HTML5\Elements; +use Masterminds\HTML5\InstructionProcessor; /** * Create an HTML5 DOM tree from events. @@ -24,7 +26,7 @@ class DOMTreeBuilder implements EventHandler { /** - * Defined in http://www.w3.org/TR/html51/infrastructure.html#html-namespace-0 + * Defined in http://www.w3.org/TR/html51/infrastructure.html#html-namespace-0. */ const NAMESPACE_HTML = 'http://www.w3.org/1999/xhtml'; @@ -45,14 +47,14 @@ class DOMTreeBuilder implements EventHandler const OPT_IMPLICIT_NS = 'implicit_namespaces'; /** - * Holds the HTML5 element names that causes a namespace switch + * Holds the HTML5 element names that causes a namespace switch. * * @var array */ protected $nsRoots = array( 'html' => self::NAMESPACE_HTML, 'svg' => self::NAMESPACE_SVG, - 'math' => self::NAMESPACE_MATHML + 'math' => self::NAMESPACE_MATHML, ); /** @@ -63,7 +65,7 @@ class DOMTreeBuilder implements EventHandler protected $implicitNamespaces = array( 'xml' => self::NAMESPACE_XML, 'xmlns' => self::NAMESPACE_XMLNS, - 'xlink' => self::NAMESPACE_XLINK + 'xlink' => self::NAMESPACE_XLINK, ); /** @@ -136,6 +138,7 @@ class DOMTreeBuilder implements EventHandler protected $stack = array(); protected $current; // Pointer in the tag hierarchy. + protected $rules; protected $doc; protected $frag; @@ -145,15 +148,15 @@ class DOMTreeBuilder implements EventHandler protected $insertMode = 0; /** - * Track if we are in an element that allows only inline child nodes + * Track if we are in an element that allows only inline child nodes. + * * @var string|null */ protected $onlyInline; /** * Quirks mode is enabled by default. - * Any document that is missing the - * DT will be considered to be in quirks mode. + * Any document that is missing the DT will be considered to be in quirks mode. */ protected $quirks = true; @@ -174,24 +177,23 @@ public function __construct($isFragment = false, array $options = array()) // $this->doc = \DOMImplementation::createDocument(NULL, 'html', $dt); $this->doc = $impl->createDocument(null, null, $dt); } + $this->errors = array(); $this->current = $this->doc; // ->documentElement; // Create a rules engine for tags. - $this->rules = new TreeBuildingRules($this->doc); + $this->rules = new TreeBuildingRules(); $implicitNS = array(); if (isset($this->options[self::OPT_IMPLICIT_NS])) { $implicitNS = $this->options[self::OPT_IMPLICIT_NS]; - } elseif (isset($this->options["implicitNamespaces"])) { - $implicitNS = $this->options["implicitNamespaces"]; + } elseif (isset($this->options['implicitNamespaces'])) { + $implicitNS = $this->options['implicitNamespaces']; } // Fill $nsStack with the defalut HTML5 namespaces, plus the "implicitNamespaces" array taken form $options - array_unshift($this->nsStack, $implicitNS + array( - '' => self::NAMESPACE_HTML - ) + $this->implicitNamespaces); + array_unshift($this->nsStack, $implicitNS + array('' => self::NAMESPACE_HTML) + $this->implicitNamespaces); if ($isFragment) { $this->insertMode = static::IM_IN_BODY; @@ -216,7 +218,7 @@ public function document() * * @see http://www.w3.org/TR/2012/CR-html5-20121217/syntax.html#concept-frag-parse-context * - * @return \DOMFragmentDocumentFragment + * @return \DOMDocumentFragment */ public function fragment() { @@ -228,8 +230,10 @@ public function fragment() * * This is used for handling Processor Instructions as they are * inserted. If omitted, PI's are inserted directly into the DOM tree. + * + * @param InstructionProcessor $proc */ - public function setInstructionProcessor(\Masterminds\HTML5\InstructionProcessor $proc) + public function setInstructionProcessor(InstructionProcessor $proc) { $this->processor = $proc; } @@ -241,7 +245,7 @@ public function doctype($name, $idType = 0, $id = null, $quirks = false) $this->quirks = $quirks; if ($this->insertMode > static::IM_INITIAL) { - $this->parseError("Illegal placement of DOCTYPE tag. Ignoring: " . $name); + $this->parseError('Illegal placement of DOCTYPE tag. Ignoring: ' . $name); return; } @@ -255,27 +259,32 @@ public function doctype($name, $idType = 0, $id = null, $quirks = false) * @todo - XMLNS namespace handling (we need to parse, even if it's not valid) * - XLink, MathML and SVG namespace handling * - Omission rules: 8.1.2.4 Optional tags + * + * @param string $name + * @param array $attributes + * @param bool $selfClosing + * + * @return int */ public function startTag($name, $attributes = array(), $selfClosing = false) { - // fprintf(STDOUT, $name); $lname = $this->normalizeTagName($name); // Make sure we have an html element. - if (! $this->doc->documentElement && $name !== 'html' && ! $this->frag) { + if (!$this->doc->documentElement && 'html' !== $name && !$this->frag) { $this->startTag('html'); } // Set quirks mode if we're at IM_INITIAL with no doctype. - if ($this->insertMode == static::IM_INITIAL) { + if ($this->insertMode === static::IM_INITIAL) { $this->quirks = true; - $this->parseError("No DOCTYPE specified."); + $this->parseError('No DOCTYPE specified.'); } // SPECIAL TAG HANDLING: // Spec says do this, and "don't ask." // find the spec where this is defined... looks problematic - if ($name == 'image' && !($this->insertMode === static::IM_IN_SVG || $this->insertMode === static::IM_IN_MATHML)) { + if ('image' === $name && !($this->insertMode === static::IM_IN_SVG || $this->insertMode === static::IM_IN_MATHML)) { $name = 'img'; } @@ -291,7 +300,7 @@ public function startTag($name, $attributes = array(), $selfClosing = false) break; case 'head': if ($this->insertMode > static::IM_BEFORE_HEAD) { - $this->parseError("Unexpected head tag outside of head context."); + $this->parseError('Unexpected head tag outside of head context.'); } else { $this->insertMode = static::IM_IN_HEAD; } @@ -306,14 +315,14 @@ public function startTag($name, $attributes = array(), $selfClosing = false) $this->insertMode = static::IM_IN_MATHML; break; case 'noscript': - if ($this->insertMode == static::IM_IN_HEAD) { + if ($this->insertMode === static::IM_IN_HEAD) { $this->insertMode = static::IM_IN_HEAD_NOSCRIPT; } break; } // Special case handling for SVG. - if ($this->insertMode == static::IM_IN_SVG) { + if ($this->insertMode === static::IM_IN_SVG) { $lname = Elements::normalizeSvgElement($lname); } @@ -321,62 +330,58 @@ public function startTag($name, $attributes = array(), $selfClosing = false) // when we found a tag thats appears inside $nsRoots, we have to switch the defalut namespace if (isset($this->nsRoots[$lname]) && $this->nsStack[0][''] !== $this->nsRoots[$lname]) { array_unshift($this->nsStack, array( - '' => $this->nsRoots[$lname] + '' => $this->nsRoots[$lname], ) + $this->nsStack[0]); - $pushes ++; + ++$pushes; } $needsWorkaround = false; - if (isset($this->options["xmlNamespaces"]) && $this->options["xmlNamespaces"]) { + if (isset($this->options['xmlNamespaces']) && $this->options['xmlNamespaces']) { // when xmlNamespaces is true a and we found a 'xmlns' or 'xmlns:*' attribute, we should add a new item to the $nsStack foreach ($attributes as $aName => $aVal) { - if ($aName === 'xmlns') { + if ('xmlns' === $aName) { $needsWorkaround = $aVal; array_unshift($this->nsStack, array( - '' => $aVal + '' => $aVal, ) + $this->nsStack[0]); - $pushes ++; - } elseif ((($pos = strpos($aName, ':')) ? substr($aName, 0, $pos) : '') === 'xmlns') { + ++$pushes; + } elseif ('xmlns' === (($pos = strpos($aName, ':')) ? substr($aName, 0, $pos) : '')) { array_unshift($this->nsStack, array( - substr($aName, $pos + 1) => $aVal + substr($aName, $pos + 1) => $aVal, ) + $this->nsStack[0]); - $pushes ++; + ++$pushes; } } } if ($this->onlyInline && Elements::isA($lname, Elements::BLOCK_TAG)) { - $this->autoclose($this->onlyInline); - $this->onlyInline = null; + $this->autoclose($this->onlyInline); + $this->onlyInline = null; } try { $prefix = ($pos = strpos($lname, ':')) ? substr($lname, 0, $pos) : ''; - - if ($needsWorkaround!==false) { - - $xml = "<$lname xmlns=\"$needsWorkaround\" ".(strlen($prefix) && isset($this->nsStack[0][$prefix])?("xmlns:$prefix=\"".$this->nsStack[0][$prefix]."\""):"")."/>"; + if (false !== $needsWorkaround) { + $xml = "<$lname xmlns=\"$needsWorkaround\" " . (strlen($prefix) && isset($this->nsStack[0][$prefix]) ? ("xmlns:$prefix=\"" . $this->nsStack[0][$prefix] . '"') : '') . '/>'; $frag = new \DOMDocument('1.0', 'UTF-8'); $frag->loadXML($xml); $ele = $this->doc->importNode($frag->documentElement, true); - } else { - if (!isset($this->nsStack[0][$prefix]) || ($prefix === "" && isset($this->options[self::OPT_DISABLE_HTML_NS]) && $this->options[self::OPT_DISABLE_HTML_NS])) { + if (!isset($this->nsStack[0][$prefix]) || ('' === $prefix && isset($this->options[self::OPT_DISABLE_HTML_NS]) && $this->options[self::OPT_DISABLE_HTML_NS])) { $ele = $this->doc->createElement($lname); } else { $ele = $this->doc->createElementNS($this->nsStack[0][$prefix], $lname); } } - } catch (\DOMException $e) { $this->parseError("Illegal tag name: <$lname>. Replaced with <invalid>."); $ele = $this->doc->createElement('invalid'); } if (Elements::isA($lname, Elements::BLOCK_ONLY_INLINE)) { - $this->onlyInline = $lname; + $this->onlyInline = $lname; } // When we add some namespacess, we have to track them. Later, when "endElement" is invoked, we have to remove them. @@ -395,23 +400,23 @@ public function startTag($name, $attributes = array(), $selfClosing = false) foreach ($attributes as $aName => $aVal) { // xmlns attributes can't be set - if ($aName === 'xmlns') { + if ('xmlns' === $aName) { continue; } - if ($this->insertMode == static::IM_IN_SVG) { + if ($this->insertMode === static::IM_IN_SVG) { $aName = Elements::normalizeSvgAttribute($aName); - } elseif ($this->insertMode == static::IM_IN_MATHML) { + } elseif ($this->insertMode === static::IM_IN_MATHML) { $aName = Elements::normalizeMathMlAttribute($aName); } try { $prefix = ($pos = strpos($aName, ':')) ? substr($aName, 0, $pos) : false; - if ($prefix==='xmlns') { - $ele->setAttributeNs(self::NAMESPACE_XMLNS, $aName, $aVal); - } elseif ($prefix!==false && isset($this->nsStack[0][$prefix])) { - $ele->setAttributeNs($this->nsStack[0][$prefix], $aName, $aVal); + if ('xmlns' === $prefix) { + $ele->setAttributeNS(self::NAMESPACE_XMLNS, $aName, $aVal); + } elseif (false !== $prefix && isset($this->nsStack[0][$prefix])) { + $ele->setAttributeNS($this->nsStack[0][$prefix], $aName, $aVal); } else { $ele->setAttribute($aName, $aVal); } @@ -421,27 +426,33 @@ public function startTag($name, $attributes = array(), $selfClosing = false) } // This is necessary on a non-DTD schema, like HTML5. - if ($aName == 'id') { + if ('id' === $aName) { $ele->setIdAttribute('id', true); } } - // Some elements have special processing rules. Handle those separately. - if ($this->rules->hasRules($name) && $this->frag !== $this->current) { + if ($this->frag !== $this->current && $this->rules->hasRules($name)) { + // Some elements have special processing rules. Handle those separately. $this->current = $this->rules->evaluate($ele, $this->current); - } // Otherwise, it's a standard element. - else { + } else { + // Otherwise, it's a standard element. $this->current->appendChild($ele); - // XXX: Need to handle self-closing tags and unary tags. - if (! Elements::isA($name, Elements::VOID_TAG)) { + if (!Elements::isA($name, Elements::VOID_TAG)) { $this->current = $ele; } + + // Self-closing tags should only be respected on foreign elements + // (and are implied on void elements) + // See: https://www.w3.org/TR/html5/syntax.html#start-tags + if (Elements::isHtml5Element($name)) { + $selfClosing = false; + } } // This is sort of a last-ditch attempt to correct for cases where no head/body // elements are provided. - if ($this->insertMode <= static::IM_BEFORE_HEAD && $name != 'head' && $name != 'html') { + if ($this->insertMode <= static::IM_BEFORE_HEAD && 'head' !== $name && 'html' !== $name) { $this->insertMode = static::IM_IN_BODY; } @@ -449,10 +460,15 @@ public function startTag($name, $attributes = array(), $selfClosing = false) // but we have to remove the namespaces pushed to $nsStack. if ($pushes > 0 && Elements::isA($name, Elements::VOID_TAG)) { // remove the namespaced definded by current node - for ($i = 0; $i < $pushes; $i ++) { + for ($i = 0; $i < $pushes; ++$i) { array_shift($this->nsStack); } } + + if ($selfClosing) { + $this->endTag($name); + } + // Return the element mask, which the tokenizer can then use to set // various processing rules. return Elements::element($name); @@ -473,7 +489,7 @@ public function endTag($name) 'html', 'br', 'head', - 'title' + 'title', ))) { $this->startTag('html'); $this->endTag($name); @@ -483,13 +499,13 @@ public function endTag($name) } // Ignore the tag. - $this->parseError("Illegal closing tag at global scope."); + $this->parseError('Illegal closing tag at global scope.'); return; } // Special case handling for SVG. - if ($this->insertMode == static::IM_IN_SVG) { + if ($this->insertMode === static::IM_IN_SVG) { $lname = Elements::normalizeSvgElement($lname); } @@ -500,39 +516,33 @@ public function endTag($name) $cid = spl_object_hash($this->current); } - // XXX: Not sure whether we need this anymore. - // if ($name != $lname) { - // return $this->quirksTreeResolver($lname); - // } - // XXX: HTML has no parent. What do we do, though, // if this element appears in the wrong place? - if ($lname == 'html') { + if ('html' === $lname) { return; } // remove the namespaced definded by current node if (isset($this->pushes[$cid])) { - for ($i = 0; $i < $this->pushes[$cid][0]; $i ++) { + for ($i = 0; $i < $this->pushes[$cid][0]; ++$i) { array_shift($this->nsStack); } unset($this->pushes[$cid]); } - if (! $this->autoclose($lname)) { + if (!$this->autoclose($lname)) { $this->parseError('Could not find closing tag for ' . $lname); } - // switch ($this->insertMode) { switch ($lname) { - case "head": + case 'head': $this->insertMode = static::IM_AFTER_HEAD; break; - case "body": + case 'body': $this->insertMode = static::IM_AFTER_BODY; break; - case "svg": - case "mathml": + case 'svg': + case 'mathml': $this->insertMode = static::IM_IN_BODY; break; } @@ -554,9 +564,9 @@ public function text($data) // practical as most documents contain these characters. Other text is not // expected here so recording a parse error is necessary. $dataTmp = trim($data, " \t\n\r\f"); - if (! empty($dataTmp)) { + if (!empty($dataTmp)) { // fprintf(STDOUT, "Unexpected insert mode: %d", $this->insertMode); - $this->parseError("Unexpected text. Ignoring: " . $dataTmp); + $this->parseError('Unexpected text. Ignoring: ' . $dataTmp); } return; @@ -573,7 +583,7 @@ public function eof() public function parseError($msg, $line = 0, $col = 0) { - $this->errors[] = sprintf("Line %d, Col %d: %s", $line, $col, $msg); + $this->errors[] = sprintf('Line %d, Col %d: %s', $line, $col, $msg); } public function getErrors() @@ -590,15 +600,14 @@ public function cdata($data) public function processingInstruction($name, $data = null) { // XXX: Ignore initial XML declaration, per the spec. - if ($this->insertMode == static::IM_INITIAL && 'xml' == strtolower($name)) { + if ($this->insertMode === static::IM_INITIAL && 'xml' === strtolower($name)) { return; } - // Important: The processor may modify the current DOM tree however - // it sees fit. - if (isset($this->processor)) { + // Important: The processor may modify the current DOM tree however it sees fit. + if ($this->processor instanceof InstructionProcessor) { $res = $this->processor->process($this->current, $name, $data); - if (! empty($res)) { + if (!empty($res)) { $this->current = $res; } @@ -617,42 +626,46 @@ public function processingInstruction($name, $data = null) /** * Apply normalization rules to a tag name. - * * See sections 2.9 and 8.1.2. * - * @param string $name - * The tag name. + * @param string $tagName + * * @return string The normalized tag name. */ - protected function normalizeTagName($name) + protected function normalizeTagName($tagName) { /* * Section 2.9 suggests that we should not do this. if (strpos($name, ':') !== false) { // We know from the grammar that there must be at least one other // char besides :, since : is not a legal tag start. $parts = explode(':', $name); return array_pop($parts); } */ - return $name; + return $tagName; } protected function quirksTreeResolver($name) { - throw new \Exception("Not implemented."); + throw new \Exception('Not implemented.'); } /** * Automatically climb the tree and close the closest node with the matching $tag. + * + * @param string $tagName + * + * @return bool */ - protected function autoclose($tag) + protected function autoclose($tagName) { $working = $this->current; do { - if ($working->nodeType != XML_ELEMENT_NODE) { + if (XML_ELEMENT_NODE !== $working->nodeType) { return false; } - if ($working->tagName == $tag) { + if ($working->tagName === $tagName) { $this->current = $working->parentNode; return true; } } while ($working = $working->parentNode); + return false; } @@ -661,12 +674,16 @@ protected function autoclose($tag) * * If $this->current or anything above $this->current matches the given tag * name, this returns true. + * + * @param string $tagName + * + * @return bool */ - protected function isAncestor($tagname) + protected function isAncestor($tagName) { $candidate = $this->current; - while ($candidate->nodeType === XML_ELEMENT_NODE) { - if ($candidate->tagName == $tagname) { + while (XML_ELEMENT_NODE === $candidate->nodeType) { + if ($candidate->tagName === $tagName) { return true; } $candidate = $candidate->parentNode; @@ -677,9 +694,13 @@ protected function isAncestor($tagname) /** * Returns true if the immediate parent element is of the given tagname. + * + * @param string $tagName + * + * @return bool */ - protected function isParent($tagname) + protected function isParent($tagName) { - return $this->current->tagName == $tagname; + return $this->current->tagName === $tagName; } } diff --git a/vendor/masterminds/html5/src/HTML5/Parser/EventHandler.php b/vendor/masterminds/html5/src/HTML5/Parser/EventHandler.php index 3da71a3fd6f3a4a1c796d3efaef3cd4379e776ca..9893a718b985e54bece2a9b2f316ff0a26d1c5a2 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/EventHandler.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/EventHandler.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5\Parser; /** @@ -20,7 +21,6 @@ */ interface EventHandler { - const DOCTYPE_NONE = 0; const DOCTYPE_PUBLIC = 1; @@ -30,15 +30,11 @@ interface EventHandler /** * A doctype declaration. * - * @param string $name - * The name of the root element. - * @param int $idType - * One of DOCTYPE_NONE, DOCTYPE_PUBLIC, or DOCTYPE_SYSTEM. - * @param string $id - * The identifier. For DOCTYPE_PUBLIC, this is the public ID. If DOCTYPE_SYSTEM, - * then this is a system ID. - * @param boolean $quirks - * Indicates whether the builder should enter quirks mode. + * @param string $name The name of the root element. + * @param int $idType One of DOCTYPE_NONE, DOCTYPE_PUBLIC, or DOCTYPE_SYSTEM + * @param string $id The identifier. For DOCTYPE_PUBLIC, this is the public ID. If DOCTYPE_SYSTEM, + * then this is a system ID. + * @param bool $quirks Indicates whether the builder should enter quirks mode. */ public function doctype($name, $idType = 0, $id = null, $quirks = false); @@ -63,13 +59,11 @@ public function doctype($name, $idType = 0, $id = null, $quirks = false); * The textmode is automatically reset to Tokenizer::TEXTMODE_NORMAL when the * closing tag is encounter. **This behavior may change.** * - * @param string $name - * The tag name. - * @param array $attributes - * An array with all of the tag's attributes. - * @param boolean $selfClosing - * An indicator of whether or not this tag is self-closing (<foo/>) - * @return int One of the Tokenizer::TEXTMODE_* constants. + * @param string $name The tag name. + * @param array $attributes An array with all of the tag's attributes. + * @param bool $selfClosing An indicator of whether or not this tag is self-closing (<foo/>). + * + * @return int one of the Tokenizer::TEXTMODE_* constants */ public function startTag($name, $attributes = array(), $selfClosing = false); @@ -104,7 +98,7 @@ public function parseError($msg, $line, $col); * A CDATA section. * * @param string $data - * The unparsed character data. + * The unparsed character data */ public function cdata($data); @@ -113,10 +107,8 @@ public function cdata($data); * * While user agents don't get PIs, server-side does. * - * @param string $name - * The name of the processor (e.g. 'php'). - * @param string $data - * The unparsed data. + * @param string $name The name of the processor (e.g. 'php'). + * @param string $data The unparsed data. */ public function processingInstruction($name, $data = null); } diff --git a/vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php b/vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php index e58006a16416f07bf30cb52ecb4835e2abee2758..b081ed96b0eafd5fe899b4f9c4bb3fc7e2f639fb 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5\Parser; /** @@ -11,16 +12,16 @@ * really like to rewrite this class to efficiently handle lower level * stream reads (and thus efficiently handle large documents). * - * @todo A buffered input stream would be useful. + * @deprecated since 2.4, to remove in 3.0. Use a string in the scanner instead. */ class FileInputStream extends StringInputStream implements InputStream { - /** * Load a file input stream. * - * @param string $data - * The file or url path to load. + * @param string $data The file or url path to load. + * @param string $encoding The encoding to use for the data. + * @param string $debug A fprintf format to use to echo the data on stdout. */ public function __construct($data, $encoding = 'UTF-8', $debug = '') { diff --git a/vendor/masterminds/html5/src/HTML5/Parser/InputStream.php b/vendor/masterminds/html5/src/HTML5/Parser/InputStream.php index 0bdc803b242315839b6819891c78cc406509a17f..ff4ef22668e38be97402bf1035f13a868780c566 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/InputStream.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/InputStream.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5\Parser; /** @@ -9,10 +10,11 @@ * * Currently provided InputStream implementations include * FileInputStream and StringInputStream. + * + * @deprecated since 2.4, to remove in 3.0. Use a string in the scanner instead. */ interface InputStream extends \Iterator { - /** * Returns the current line that is being consumed. * @@ -47,12 +49,12 @@ public function remainingChars(); * and returns the matched substring. * * @see strcspn - * @param string $bytes - * Bytes to match. - * @param int $max - * Maximum number of bytes to scan. + * + * @param string $bytes Bytes to match. + * @param int $max Maximum number of bytes to scan. + * * @return mixed Index or false if no match is found. You should use strong - * equality when checking the result, since index could be 0. + * equality when checking the result, since index could be 0. */ public function charsUntil($bytes, $max = null); @@ -63,20 +65,18 @@ public function charsUntil($bytes, $max = null); * and returns the matched substring. * * @see strspn - * @param string $bytes - * A mask of bytes to match. If ANY byte in this mask matches the - * current char, the pointer advances and the char is part of the - * substring. - * @param int $max - * The max number of chars to read. + * + * @param string $bytes A mask of bytes to match. If ANY byte in this mask matches the + * current char, the pointer advances and the char is part of the + * substring. + * @param int $max The max number of chars to read. */ public function charsWhile($bytes, $max = null); /** * Unconsume one character. * - * @param int $howMany - * The number of characters to move the pointer back. + * @param int $howMany The number of characters to move the pointer back. */ public function unconsume($howMany = 1); diff --git a/vendor/masterminds/html5/src/HTML5/Parser/ParseError.php b/vendor/masterminds/html5/src/HTML5/Parser/ParseError.php index 86498a13b78b5951c1cc9ab5d818e48ea90929cd..640e516c89e5beeb4cc949c3b3dd1b94d369b7a7 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/ParseError.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/ParseError.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5\Parser; /** diff --git a/vendor/masterminds/html5/src/HTML5/Parser/Scanner.php b/vendor/masterminds/html5/src/HTML5/Parser/Scanner.php index f605c69b3b18c6fee251089b9715d93c0b7746ce..1b52983e73db1ddbdcee4b2af4e591dd5354b92d 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/Scanner.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/Scanner.php @@ -1,34 +1,90 @@ <?php + namespace Masterminds\HTML5\Parser; +use Masterminds\HTML5\Exception; + /** - * The scanner. - * - * This scans over an input stream. + * The scanner scans over a given data input to react appropriately to characters. */ class Scanner { - const CHARS_HEX = 'abcdefABCDEF01234567890'; - const CHARS_ALNUM = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890'; - const CHARS_ALPHA = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - protected $is; + /** + * The string data we're parsing. + */ + private $data; - // Flipping this to true will give minisculely more debugging info. - public $debug = false; + /** + * The current integer byte position we are in $data. + */ + private $char; + + /** + * Length of $data; when $char === $data, we are at the end-of-file. + */ + private $EOF; + + /** + * Parse errors. + */ + public $errors = array(); /** * Create a new Scanner. * - * @param \Masterminds\HTML5\Parser\InputStream $input - * An InputStream to be scanned. + * @param string $data Data to parse. + * @param string $encoding The encoding to use for the data. + * + * @throws Exception If the given data cannot be encoded to UTF-8. + */ + public function __construct($data, $encoding = 'UTF-8') + { + if ($data instanceof InputStream) { + @trigger_error('InputStream objects are deprecated since version 2.4 and will be removed in 3.0. Use strings instead.', E_USER_DEPRECATED); + $data = (string) $data; + } + + $data = UTF8Utils::convertToUTF8($data, $encoding); + + // There is good reason to question whether it makes sense to + // do this here, since most of these checks are done during + // parsing, and since this check doesn't actually *do* anything. + $this->errors = UTF8Utils::checkForIllegalCodepoints($data); + + $data = $this->replaceLinefeeds($data); + + $this->data = $data; + $this->char = 0; + $this->EOF = strlen($data); + } + + /** + * Check if upcomming chars match the given sequence. + * + * This will read the stream for the $sequence. If it's + * found, this will return true. If not, return false. + * Since this unconsumes any chars it reads, the caller + * will still need to read the next sequence, even if + * this returns true. + * + * Example: $this->scanner->sequenceMatches('</script>') will + * see if the input stream is at the start of a + * '</script>' string. + * + * @param string $sequence + * @param bool $caseSensitive + * + * @return bool */ - public function __construct($input) + public function sequenceMatches($sequence, $caseSensitive = true) { - $this->is = $input; + $portion = substr($this->data, $this->char, strlen($sequence)); + + return $caseSensitive ? $portion === $sequence : 0 === strcasecmp($portion, $sequence); } /** @@ -38,7 +94,7 @@ public function __construct($input) */ public function position() { - return $this->is->key(); + return $this->char; } /** @@ -48,23 +104,25 @@ public function position() */ public function peek() { - return $this->is->peek(); + if (($this->char + 1) <= $this->EOF) { + return $this->data[$this->char + 1]; + } + + return false; } /** * Get the next character. - * * Note: This advances the pointer. * * @return string The next character. */ public function next() { - $this->is->next(); - if ($this->is->valid()) { - if ($this->debug) - fprintf(STDOUT, "> %s\n", $this->is->current()); - return $this->is->current(); + ++$this->char; + + if ($this->char < $this->EOF) { + return $this->data[$this->char]; } return false; @@ -72,15 +130,14 @@ public function next() /** * Get the current character. - * * Note, this does not advance the pointer. * * @return string The current character. */ public function current() { - if ($this->is->valid()) { - return $this->is->current(); + if ($this->char < $this->EOF) { + return $this->data[$this->char]; } return false; @@ -88,29 +145,29 @@ public function current() /** * Silently consume N chars. + * + * @param int $count */ public function consume($count = 1) { - for ($i = 0; $i < $count; ++ $i) { - $this->next(); - } + $this->char += $count; } /** * Unconsume some of the data. * This moves the data pointer backwards. * - * @param int $howMany - * The number of characters to move the pointer back. + * @param int $howMany The number of characters to move the pointer back. */ public function unconsume($howMany = 1) { - $this->is->unconsume($howMany); + if (($this->char - $howMany) >= 0) { + $this->char -= $howMany; + } } /** * Get the next group of that contains hex characters. - * * Note, along with getting the characters the pointer in the data will be * moved as well. * @@ -118,12 +175,11 @@ public function unconsume($howMany = 1) */ public function getHex() { - return $this->is->charsWhile(static::CHARS_HEX); + return $this->doCharsWhile(static::CHARS_HEX); } /** * Get the next group of characters that are ASCII Alpha characters. - * * Note, along with getting the characters the pointer in the data will be * moved as well. * @@ -131,12 +187,11 @@ public function getHex() */ public function getAsciiAlpha() { - return $this->is->charsWhile(static::CHARS_ALPHA); + return $this->doCharsWhile(static::CHARS_ALPHA); } /** * Get the next group of characters that are ASCII Alpha characters and numbers. - * * Note, along with getting the characters the pointer in the data will be * moved as well. * @@ -144,12 +199,11 @@ public function getAsciiAlpha() */ public function getAsciiAlphaNum() { - return $this->is->charsWhile(static::CHARS_ALNUM); + return $this->doCharsWhile(static::CHARS_ALNUM); } /** * Get the next group of numbers. - * * Note, along with getting the characters the pointer in the data will be * moved as well. * @@ -157,17 +211,26 @@ public function getAsciiAlphaNum() */ public function getNumeric() { - return $this->is->charsWhile('0123456789'); + return $this->doCharsWhile('0123456789'); } /** * Consume whitespace. - * * Whitespace in HTML5 is: formfeed, tab, newline, space. + * + * @return int The length of the matched whitespaces. */ public function whitespace() { - return $this->is->charsWhile("\n\t\f "); + if ($this->char >= $this->EOF) { + return false; + } + + $len = strspn($this->data, "\n\t\f ", $this->char); + + $this->char += $len; + + return $len; } /** @@ -177,23 +240,37 @@ public function whitespace() */ public function currentLine() { - return $this->is->currentLine(); + if (empty($this->EOF) || 0 === $this->char) { + return 1; + } + + // Add one to $this->char because we want the number for the next + // byte to be processed. + return substr_count($this->data, "\n", 0, min($this->char, $this->EOF)) + 1; } /** * Read chars until something in the mask is encountered. + * + * @param string $mask + * + * @return mixed */ public function charsUntil($mask) { - return $this->is->charsUntil($mask); + return $this->doCharsUntil($mask); } /** * Read chars as long as the mask matches. + * + * @param string $mask + * + * @return int */ public function charsWhile($mask) { - return $this->is->charsWhile($mask); + return $this->doCharsWhile($mask); } /** @@ -205,7 +282,29 @@ public function charsWhile($mask) */ public function columnOffset() { - return $this->is->columnOffset(); + // Short circuit for the first char. + if (0 === $this->char) { + return 0; + } + + // strrpos is weird, and the offset needs to be negative for what we + // want (i.e., the last \n before $this->char). This needs to not have + // one (to make it point to the next character, the one we want the + // position of) added to it because strrpos's behaviour includes the + // final offset byte. + $backwardFrom = $this->char - 1 - strlen($this->data); + $lastLine = strrpos($this->data, "\n", $backwardFrom); + + // However, for here we want the length up until the next byte to be + // processed, so add one to the current byte ($this->char). + if (false !== $lastLine) { + $findLengthOf = substr($this->data, $lastLine + 1, $this->char - 1 - $lastLine); + } else { + // After a newline. + $findLengthOf = substr($this->data, 0, $this->char); + } + + return UTF8Utils::countChars($findLengthOf); } /** @@ -217,6 +316,101 @@ public function columnOffset() */ public function remainingChars() { - return $this->is->remainingChars(); + if ($this->char < $this->EOF) { + $data = substr($this->data, $this->char); + $this->char = $this->EOF; + + return $data; + } + + return ''; // false; + } + + /** + * Replace linefeed characters according to the spec. + * + * @param $data + * + * @return string + */ + private function replaceLinefeeds($data) + { + /* + * U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF) characters are treated specially. + * Any CR characters that are followed by LF characters must be removed, and any CR characters not + * followed by LF characters must be converted to LF characters. Thus, newlines in HTML DOMs are + * represented by LF characters, and there are never any CR characters in the input to the tokenization + * stage. + */ + $crlfTable = array( + "\0" => "\xEF\xBF\xBD", + "\r\n" => "\n", + "\r" => "\n", + ); + + return strtr($data, $crlfTable); + } + + /** + * Read to a particular match (or until $max bytes are consumed). + * + * This operates on byte sequences, not characters. + * + * Matches as far as possible until we reach a certain set of bytes + * and returns the matched substring. + * + * @param string $bytes Bytes to match. + * @param int $max Maximum number of bytes to scan. + * + * @return mixed Index or false if no match is found. You should use strong + * equality when checking the result, since index could be 0. + */ + private function doCharsUntil($bytes, $max = null) + { + if ($this->char >= $this->EOF) { + return false; + } + + if (0 === $max || $max) { + $len = strcspn($this->data, $bytes, $this->char, $max); + } else { + $len = strcspn($this->data, $bytes, $this->char); + } + + $string = (string) substr($this->data, $this->char, $len); + $this->char += $len; + + return $string; + } + + /** + * Returns the string so long as $bytes matches. + * + * Matches as far as possible with a certain set of bytes + * and returns the matched substring. + * + * @param string $bytes A mask of bytes to match. If ANY byte in this mask matches the + * current char, the pointer advances and the char is part of the + * substring. + * @param int $max The max number of chars to read. + * + * @return string + */ + private function doCharsWhile($bytes, $max = null) + { + if ($this->char >= $this->EOF) { + return false; + } + + if (0 === $max || $max) { + $len = strspn($this->data, $bytes, $this->char, $max); + } else { + $len = strspn($this->data, $bytes, $this->char); + } + + $string = (string) substr($this->data, $this->char, $len); + $this->char += $len; + + return $string; } } diff --git a/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php b/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php index 4cac3c2330a9ded61902a819f56b35a788afade7..0c213feb6cef9717680b369e9a77c9de51b1dec5 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php @@ -2,6 +2,7 @@ /** * Loads a string to be parsed. */ + namespace Masterminds\HTML5\Parser; /* @@ -39,16 +40,18 @@ // // - // indicates regular comments +/** + * @deprecated since 2.4, to remove in 3.0. Use a string in the scanner instead. + */ class StringInputStream implements InputStream { - /** * The string data we're parsing. */ private $data; /** - * The current integer byte position we are in $data + * The current integer byte position we are in $data. */ private $char; @@ -65,22 +68,21 @@ class StringInputStream implements InputStream /** * Create a new InputStream wrapper. * - * @param $data Data - * to parse + * @param string $data Data to parse. + * @param string $encoding The encoding to use for the data. + * @param string $debug A fprintf format to use to echo the data on stdout. */ public function __construct($data, $encoding = 'UTF-8', $debug = '') { $data = UTF8Utils::convertToUTF8($data, $encoding); - if ($debug) + if ($debug) { fprintf(STDOUT, $debug, $data, strlen($data)); + } - // There is good reason to question whether it makes sense to - // do this here, since most of these checks are done during - // parsing, and since this check doesn't actually *do* anything. + // There is good reason to question whether it makes sense to + // do this here, since most of these checks are done during + // parsing, and since this check doesn't actually *do* anything. $this->errors = UTF8Utils::checkForIllegalCodepoints($data); - // if (!empty($e)) { - // throw new ParseError("UTF-8 encoding issues: " . implode(', ', $e)); - // } $data = $this->replaceLinefeeds($data); @@ -89,18 +91,27 @@ public function __construct($data, $encoding = 'UTF-8', $debug = '') $this->EOF = strlen($data); } + public function __toString() + { + return $this->data; + } + /** * Replace linefeed characters according to the spec. */ protected function replaceLinefeeds($data) { /* - * U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF) characters are treated specially. Any CR characters that are followed by LF characters must be removed, and any CR characters not followed by LF characters must be converted to LF characters. Thus, newlines in HTML DOMs are represented by LF characters, and there are never any CR characters in the input to the tokenization stage. + * U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF) characters are treated specially. + * Any CR characters that are followed by LF characters must be removed, and any CR characters not + * followed by LF characters must be converted to LF characters. Thus, newlines in HTML DOMs are + * represented by LF characters, and there are never any CR characters in the input to the tokenization + * stage. */ $crlfTable = array( "\0" => "\xEF\xBF\xBD", "\r\n" => "\n", - "\r" => "\n" + "\r" => "\n", ); return strtr($data, $crlfTable); @@ -111,7 +122,7 @@ protected function replaceLinefeeds($data) */ public function currentLine() { - if (empty($this->EOF) || $this->char == 0) { + if (empty($this->EOF) || 0 === $this->char) { return 1; } // Add one to $this->char because we want the number for the next @@ -120,18 +131,15 @@ public function currentLine() } /** - * * @deprecated - * */ public function getCurrentLine() { - return currentLine(); + return $this->currentLine(); } /** * Returns the current column of the current line that the tokenizer is at. - * * Newlines are column 0. The first char after a newline is column 1. * * @return int The column number. @@ -139,7 +147,7 @@ public function getCurrentLine() public function columnOffset() { // Short circuit for the first char. - if ($this->char == 0) { + if (0 === $this->char) { return 0; } // strrpos is weird, and the offset needs to be negative for what we @@ -152,7 +160,7 @@ public function columnOffset() // However, for here we want the length up until the next byte to be // processed, so add one to the current byte ($this->char). - if ($lastLine !== false) { + if (false !== $lastLine) { $findLengthOf = substr($this->data, $lastLine + 1, $this->char - 1 - $lastLine); } else { // After a newline. @@ -163,9 +171,7 @@ public function columnOffset() } /** - * * @deprecated - * */ public function getColumnOffset() { @@ -188,7 +194,7 @@ public function current() */ public function next() { - $this->char ++; + ++$this->char; } /** @@ -202,15 +208,11 @@ public function rewind() /** * Is the current pointer location valid. * - * @return bool Is the current pointer location valid. + * @return bool Whether the current pointer location is valid. */ public function valid() { - if ($this->char < $this->EOF) { - return true; - } - - return false; + return $this->char < $this->EOF; } /** @@ -219,10 +221,10 @@ public function valid() * This reads to the end of the file, and sets the read marker at the * end of the file. * - * @note This performs bounds checking + * Note this performs bounds checking. * * @return string Returns the remaining text. If called when the InputStream is - * already exhausted, it returns an empty string. + * already exhausted, it returns an empty string. */ public function remainingChars() { @@ -244,12 +246,11 @@ public function remainingChars() * Matches as far as possible until we reach a certain set of bytes * and returns the matched substring. * - * @param string $bytes - * Bytes to match. - * @param int $max - * Maximum number of bytes to scan. + * @param string $bytes Bytes to match. + * @param int $max Maximum number of bytes to scan. + * * @return mixed Index or false if no match is found. You should use strong - * equality when checking the result, since index could be 0. + * equality when checking the result, since index could be 0. */ public function charsUntil($bytes, $max = null) { @@ -257,7 +258,7 @@ public function charsUntil($bytes, $max = null) return false; } - if ($max === 0 || $max) { + if (0 === $max || $max) { $len = strcspn($this->data, $bytes, $this->char, $max); } else { $len = strcspn($this->data, $bytes, $this->char); @@ -275,12 +276,12 @@ public function charsUntil($bytes, $max = null) * Matches as far as possible with a certain set of bytes * and returns the matched substring. * - * @param string $bytes - * A mask of bytes to match. If ANY byte in this mask matches the - * current char, the pointer advances and the char is part of the - * substring. - * @param int $max - * The max number of chars to read. + * @param string $bytes A mask of bytes to match. If ANY byte in this mask matches the + * current char, the pointer advances and the char is part of the + * substring. + * @param int $max The max number of chars to read. + * + * @return string */ public function charsWhile($bytes, $max = null) { @@ -288,7 +289,7 @@ public function charsWhile($bytes, $max = null) return false; } - if ($max === 0 || $max) { + if (0 === $max || $max) { $len = strspn($this->data, $bytes, $this->char, $max); } else { $len = strspn($this->data, $bytes, $this->char); @@ -302,13 +303,12 @@ public function charsWhile($bytes, $max = null) /** * Unconsume characters. * - * @param int $howMany - * The number of characters to unconsume. + * @param int $howMany The number of characters to unconsume. */ public function unconsume($howMany = 1) { if (($this->char - $howMany) >= 0) { - $this->char = $this->char - $howMany; + $this->char -= $howMany; } } diff --git a/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php b/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php index c42bc3d86ed968f6301adeaca72e2a93f82afe86..f4e96524bd940b7bd68143352ecbe6e03adb0307 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5\Parser; use Masterminds\HTML5\Elements; @@ -25,7 +26,6 @@ */ class Tokenizer { - protected $scanner; protected $events; @@ -47,8 +47,6 @@ class Tokenizer const CONFORMANT_HTML = 'html'; protected $mode = self::CONFORMANT_HTML; - const WHITE = "\t\n\f "; - /** * Create a new tokenizer. * @@ -56,12 +54,9 @@ class Tokenizer * it a scanner (input) and an event handler (output), and then calling * the Tokenizer::parse() method.` * - * @param \Masterminds\HTML5\Parser\Scanner $scanner - * A scanner initialized with an input stream. - * @param \Masterminds\HTML5\Parser\EventHandler $eventHandler - * An event handler, initialized and ready to receive - * events. - * @param string $mode + * @param Scanner $scanner A scanner initialized with an input stream. + * @param EventHandler $eventHandler An event handler, initialized and ready to receive events. + * @param string $mode */ public function __construct($scanner, $eventHandler, $mode = self::CONFORMANT_HTML) { @@ -103,11 +98,9 @@ public function parse() * Normally, setting is done by the event handler via a special return code on * startTag(), but it can also be set manually using this function. * - * @param integer $textmode - * One of Elements::TEXT_* - * @param string $untilTag - * The tag that should stop RAW or RCDATA mode. Normal mode does not - * use this indicator. + * @param int $textmode One of Elements::TEXT_*. + * @param string $untilTag The tag that should stop RAW or RCDATA mode. Normal mode does not + * use this indicator. */ public function setTextMode($textmode, $untilTag = null) { @@ -117,18 +110,76 @@ public function setTextMode($textmode, $untilTag = null) /** * Consume a character and make a move. - * HTML5 8.2.4.1 + * HTML5 8.2.4.1. */ protected function consumeData() { - // Character Ref - /* - * $this->characterReference() || $this->tagOpen() || $this->eof() || $this->characterData(); - */ - $this->characterReference(); - $this->tagOpen(); - $this->eof(); - $this->characterData(); + $tok = $this->scanner->current(); + + if ('&' === $tok) { + // Character reference + $ref = $this->decodeCharacterReference(); + $this->buffer($ref); + + $tok = $this->scanner->current(); + } + + // Parse tag + if ('<' === $tok) { + // Any buffered text data can go out now. + $this->flushBuffer(); + + $tok = $this->scanner->next(); + + if ('!' === $tok) { + $this->markupDeclaration(); + } elseif ('/' === $tok) { + $this->endTag(); + } elseif ('?' === $tok) { + $this->processingInstruction(); + } elseif (ctype_alpha($tok)) { + $this->tagName(); + } else { + $this->parseError('Illegal tag opening'); + // TODO is this necessary ? + $this->characterData(); + } + + $tok = $this->scanner->current(); + } + + if (false === $tok) { + // Handle end of document + $this->eof(); + } else { + // Parse character + switch ($this->textMode) { + case Elements::TEXT_RAW: + $this->rawText($tok); + break; + + case Elements::TEXT_RCDATA: + $this->rcdata($tok); + break; + + default: + if ('<' === $tok || '&' === $tok) { + break; + } + + // NULL character + if ("\00" === $tok) { + $this->parseError('Received null character.'); + + $this->text .= $tok; + $this->scanner->consume(); + + break; + } + + $this->text .= $this->scanner->charsUntil("<&\0"); + } + } return $this->carryOn; } @@ -143,73 +194,88 @@ protected function consumeData() protected function characterData() { $tok = $this->scanner->current(); - if ($tok === false) { + if (false === $tok) { return false; } switch ($this->textMode) { case Elements::TEXT_RAW: - return $this->rawText(); + return $this->rawText($tok); case Elements::TEXT_RCDATA: - return $this->rcdata(); + return $this->rcdata($tok); default: - if (strspn($tok, "<&")) { + if ('<' === $tok || '&' === $tok) { return false; } - return $this->text(); + + return $this->text($tok); } } /** * This buffers the current token as character data. + * + * @param string $tok The current token. + * + * @return bool */ - protected function text() + protected function text($tok) { - $tok = $this->scanner->current(); - // This should never happen... - if ($tok === false) { + if (false === $tok) { return false; } - // Null - if ($tok === "\00") { - $this->parseError("Received null character."); + + // NULL character + if ("\00" === $tok) { + $this->parseError('Received null character.'); } - // fprintf(STDOUT, "Writing '%s'", $tok); + $this->buffer($tok); - $this->scanner->next(); + $this->scanner->consume(); + return true; } /** * Read text in RAW mode. + * + * @param string $tok The current token. + * + * @return bool */ - protected function rawText() + protected function rawText($tok) { if (is_null($this->untilTag)) { - return $this->text(); + return $this->text($tok); } + $sequence = '</' . $this->untilTag . '>'; $txt = $this->readUntilSequence($sequence); $this->events->text($txt); $this->setTextMode(0); + return $this->endTag(); } /** * Read text in RCDATA mode. + * + * @param string $tok The current token. + * + * @return bool */ - protected function rcdata() + protected function rcdata($tok) { if (is_null($this->untilTag)) { - return $this->text(); + return $this->text($tok); } + $sequence = '</' . $this->untilTag; $txt = ''; - $tok = $this->scanner->current(); $caseSensitive = !Elements::isHtml5Element($this->untilTag); - while ($tok !== false && ! ($tok == '<' && ($this->sequenceMatches($sequence, $caseSensitive)))) { - if ($tok == '&') { + while (false !== $tok && !('<' == $tok && ($this->scanner->sequenceMatches($sequence, $caseSensitive)))) { + if ('&' == $tok) { $txt .= $this->decodeCharacterReference(); $tok = $this->scanner->current(); } else { @@ -219,13 +285,15 @@ protected function rcdata() } $len = strlen($sequence); $this->scanner->consume($len); - $len += strlen($this->scanner->whitespace()); - if ($this->scanner->current() !== '>') { - $this->parseError("Unclosed RCDATA end tag"); + $len += $this->scanner->whitespace(); + if ('>' !== $this->scanner->current()) { + $this->parseError('Unclosed RCDATA end tag'); } + $this->scanner->unconsume($len); $this->events->text($txt); $this->setTextMode(0); + return $this->endTag(); } @@ -234,53 +302,10 @@ protected function rcdata() */ protected function eof() { - if ($this->scanner->current() === false) { - // fprintf(STDOUT, "EOF"); - $this->flushBuffer(); - $this->events->eof(); - $this->carryOn = false; - return true; - } - return false; - } - - /** - * Handle character references (aka entities). - * - * This version is specific to PCDATA, as it buffers data into the - * text buffer. For a generic version, see decodeCharacterReference(). - * - * HTML5 8.2.4.2 - */ - protected function characterReference() - { - $ref = $this->decodeCharacterReference(); - if ($ref !== false) { - $this->buffer($ref); - return true; - } - return false; - } - - /** - * Emit a tagStart event on encountering a tag. - * - * 8.2.4.8 - */ - protected function tagOpen() - { - if ($this->scanner->current() != '<') { - return false; - } - - // Any buffered text data can go out now. + // fprintf(STDOUT, "EOF"); $this->flushBuffer(); - - $this->scanner->next(); - - return $this->markupDeclaration() || $this->endTag() || $this->processingInstruction() || $this->tagName() || - /* This always returns false. */ - $this->parseError("Illegal tag opening") || $this->characterData(); + $this->events->eof(); + $this->carryOn = false; } /** @@ -288,40 +313,32 @@ protected function tagOpen() */ protected function markupDeclaration() { - if ($this->scanner->current() != '!') { - return false; - } - $tok = $this->scanner->next(); // Comment: - if ($tok == '-' && $this->scanner->peek() == '-') { - $this->scanner->next(); // Consume the other '-' - $this->scanner->next(); // Next char. - return $this->comment(); - } + if ('-' == $tok && '-' == $this->scanner->peek()) { + $this->scanner->consume(2); - elseif ($tok == 'D' || $tok == 'd') { // Doctype + return $this->comment(); + } elseif ('D' == $tok || 'd' == $tok) { // Doctype return $this->doctype(); - } - - elseif ($tok == '[') { // CDATA section + } elseif ('[' == $tok) { // CDATA section return $this->cdataSection(); } // FINISH - $this->parseError("Expected <!--, <![CDATA[, or <!DOCTYPE. Got <!%s", $tok); + $this->parseError('Expected <!--, <![CDATA[, or <!DOCTYPE. Got <!%s', $tok); $this->bogusComment('<!'); + return true; } /** - * Consume an end tag. - * 8.2.4.9 + * Consume an end tag. See section 8.2.4.9. */ protected function endTag() { - if ($this->scanner->current() != '/') { + if ('/' != $this->scanner->current()) { return false; } $tok = $this->scanner->next(); @@ -330,44 +347,41 @@ protected function endTag() // > -> parse error // EOF -> parse error // -> parse error - if (! ctype_alpha($tok)) { + if (!ctype_alpha($tok)) { $this->parseError("Expected tag name, got '%s'", $tok); - if ($tok == "\0" || $tok === false) { + if ("\0" == $tok || false === $tok) { return false; } + return $this->bogusComment('</'); } $name = $this->scanner->charsUntil("\n\f \t>"); - $name = $this->mode === self::CONFORMANT_XML ? $name: strtolower($name); + $name = self::CONFORMANT_XML === $this->mode ? $name : strtolower($name); // Trash whitespace. $this->scanner->whitespace(); - if ($this->scanner->current() != '>') { - $this->parseError("Expected >, got '%s'", $this->scanner->current()); + $tok = $this->scanner->current(); + if ('>' != $tok) { + $this->parseError("Expected >, got '%s'", $tok); // We just trash stuff until we get to the next tag close. $this->scanner->charsUntil('>'); } $this->events->endTag($name); - $this->scanner->next(); + $this->scanner->consume(); + return true; } /** - * Consume a tag name and body. - * 8.2.4.10 + * Consume a tag name and body. See section 8.2.4.10. */ protected function tagName() { - $tok = $this->scanner->current(); - if (! ctype_alpha($tok)) { - return false; - } - // We know this is at least one char. - $name = $this->scanner->charsWhile(":_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); - $name = $this->mode === self::CONFORMANT_XML ? $name : strtolower($name); + $name = $this->scanner->charsWhile(':_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'); + $name = self::CONFORMANT_XML === $this->mode ? $name : strtolower($name); $attributes = array(); $selfClose = false; @@ -377,21 +391,18 @@ protected function tagName() do { $this->scanner->whitespace(); $this->attribute($attributes); - } while (! $this->isTagEnd($selfClose)); + } while (!$this->isTagEnd($selfClose)); } catch (ParseError $e) { $selfClose = false; } $mode = $this->events->startTag($name, $attributes, $selfClose); - // Should we do this? What does this buy that selfClose doesn't? - if ($selfClose) { - $this->events->endTag($name); - } elseif (is_int($mode)) { - // fprintf(STDOUT, "Event response says move into mode %d for tag %s", $mode, $name); + + if (is_int($mode)) { $this->setTextMode($mode, $name); } - $this->scanner->next(); + $this->scanner->consume(); return true; } @@ -402,30 +413,34 @@ protected function tagName() protected function isTagEnd(&$selfClose) { $tok = $this->scanner->current(); - if ($tok == '/') { - $this->scanner->next(); + if ('/' == $tok) { + $this->scanner->consume(); $this->scanner->whitespace(); $tok = $this->scanner->current(); - if ($tok == '>') { + if ('>' == $tok) { $selfClose = true; + return true; } - if ($tok === false) { - $this->parseError("Unexpected EOF inside of tag."); + if (false === $tok) { + $this->parseError('Unexpected EOF inside of tag.'); + return true; } // Basically, we skip the / token and go on. // See 8.2.4.43. $this->parseError("Unexpected '%s' inside of a tag.", $tok); + return false; } - if ($tok == '>') { + if ('>' == $tok) { return true; } - if ($tok === false) { - $this->parseError("Unexpected EOF inside of tag."); + if (false === $tok) { + $this->parseError('Unexpected EOF inside of tag.'); + return true; } @@ -434,30 +449,37 @@ protected function isTagEnd(&$selfClose) /** * Parse attributes from inside of a tag. + * + * @param string[] $attributes + * + * @return bool + * + * @throws ParseError */ protected function attribute(&$attributes) { $tok = $this->scanner->current(); - if ($tok == '/' || $tok == '>' || $tok === false) { + if ('/' == $tok || '>' == $tok || false === $tok) { return false; } - if ($tok == '<') { - $this->parseError("Unexepcted '<' inside of attributes list."); + if ('<' == $tok) { + $this->parseError("Unexpected '<' inside of attributes list."); // Push the < back onto the stack. $this->scanner->unconsume(); // Let the caller figure out how to handle this. - throw new ParseError("Start tag inside of attribute."); + throw new ParseError('Start tag inside of attribute.'); } $name = strtolower($this->scanner->charsUntil("/>=\n\f\t ")); - if (strlen($name) == 0) { - $this->parseError("Expected an attribute name, got %s.", $this->scanner->current()); + if (0 == strlen($name)) { + $tok = $this->scanner->current(); + $this->parseError('Expected an attribute name, got %s.', $tok); // Really, only '=' can be the char here. Everything else gets absorbed // under one rule or another. - $name = $this->scanner->current(); - $this->scanner->next(); + $name = $tok; + $this->scanner->consume(); } $isValidAttribute = true; @@ -467,18 +489,17 @@ protected function attribute(&$attributes) // see issue #23: https://github.com/Masterminds/html5-php/issues/23 // and http://www.w3.org/TR/2011/WD-html5-20110525/syntax.html#syntax-attribute-name if (preg_match("/[\x1-\x2C\\/\x3B-\x40\x5B-\x5E\x60\x7B-\x7F]/u", $name)) { - $this->parseError("Unexpected characters in attribute name: %s", $name); + $this->parseError('Unexpected characters in attribute name: %s', $name); $isValidAttribute = false; } // There is no limitation for 1st character in HTML5. // But method "DOMElement::setAttribute" is throwing exception for the // characters below so they have to be filtered. // see issue #23: https://github.com/Masterminds/html5-php/issues/23 // and http://www.w3.org/TR/2011/WD-html5-20110525/syntax.html#syntax-attribute-name - else - if (preg_match("/^[0-9.-]/u", $name)) { - $this->parseError("Unexpected character at the begining of attribute name: %s", $name); - $isValidAttribute = false; - } + elseif (preg_match('/^[0-9.-]/u', $name)) { + $this->parseError('Unexpected character at the begining of attribute name: %s', $name); + $isValidAttribute = false; + } // 8.1.2.3 $this->scanner->whitespace(); @@ -486,19 +507,21 @@ protected function attribute(&$attributes) if ($isValidAttribute) { $attributes[$name] = $val; } + return true; } /** - * Consume an attribute value. - * 8.2.4.37 and after. + * Consume an attribute value. See section 8.2.4.37 and after. + * + * @return string|null */ protected function attributeValue() { - if ($this->scanner->current() != '=') { + if ('=' != $this->scanner->current()) { return null; } - $this->scanner->next(); + $this->scanner->consume(); // 8.1.2.3 $this->scanner->whitespace(); @@ -506,21 +529,24 @@ protected function attributeValue() switch ($tok) { case "\n": case "\f": - case " ": + case ' ': case "\t": // Whitespace here indicates an empty value. return null; case '"': case "'": - $this->scanner->next(); + $this->scanner->consume(); + return $this->quotedAttributeValue($tok); case '>': // case '/': // 8.2.4.37 seems to allow foo=/ as a valid attr. - $this->parseError("Expected attribute value, got tag end."); + $this->parseError('Expected attribute value, got tag end.'); + return null; case '=': case '`': - $this->parseError("Expecting quotes, got %s.", $tok); + $this->parseError('Expecting quotes, got %s.', $tok); + return $this->unquotedAttributeValue(); default: return $this->unquotedAttributeValue(); @@ -530,10 +556,10 @@ protected function attributeValue() /** * Get an attribute value string. * - * @param string $quote - * IMPORTANT: This is a series of chars! Any one of which will be considered - * termination of an attribute's value. E.g. "\"'" will stop at either - * ' or ". + * @param string $quote IMPORTANT: This is a series of chars! Any one of which will be considered + * termination of an attribute's value. E.g. "\"'" will stop at either + * ' or ". + * * @return string The attribute value. */ protected function quotedAttributeValue($quote) @@ -542,81 +568,102 @@ protected function quotedAttributeValue($quote) $val = ''; while (true) { - $tokens = $this->scanner->charsUntil($stoplist.'&'); - if ($tokens !== false) { + $tokens = $this->scanner->charsUntil($stoplist . '&'); + if (false !== $tokens) { $val .= $tokens; } else { break; } $tok = $this->scanner->current(); - if ($tok == '&') { - $val .= $this->decodeCharacterReference(true, $tok); + if ('&' == $tok) { + $val .= $this->decodeCharacterReference(true); continue; } break; } - $this->scanner->next(); + $this->scanner->consume(); + return $val; } protected function unquotedAttributeValue() { - $stoplist = "\t\n\f >"; $val = ''; $tok = $this->scanner->current(); - while (strspn($tok, $stoplist) == 0 && $tok !== false) { - if ($tok == '&') { - $val .= $this->decodeCharacterReference(true); - $tok = $this->scanner->current(); - } else { - if (strspn($tok, "\"'<=`") > 0) { - $this->parseError("Unexpected chars in unquoted attribute value %s", $tok); - } - $val .= $tok; - $tok = $this->scanner->next(); + while (false !== $tok) { + switch ($tok) { + case "\n": + case "\f": + case ' ': + case "\t": + case '>': + break 2; + + case '&': + $val .= $this->decodeCharacterReference(true); + $tok = $this->scanner->current(); + + break; + + case "'": + case '"': + case '<': + case '=': + case '`': + $this->parseError('Unexpected chars in unquoted attribute value %s', $tok); + $val .= $tok; + $tok = $this->scanner->next(); + break; + + default: + $val .= $this->scanner->charsUntil("\t\n\f >&\"'<=`"); + + $tok = $this->scanner->current(); } } + return $val; } /** * Consume malformed markup as if it were a comment. - * 8.2.4.44 + * 8.2.4.44. * * The spec requires that the ENTIRE tag-like thing be enclosed inside of * the comment. So this will generate comments like: * * <!--</+foo>--> * - * @param string $leading - * Prepend any leading characters. This essentially - * negates the need to backtrack, but it's sort of - * a hack. + * @param string $leading Prepend any leading characters. This essentially + * negates the need to backtrack, but it's sort of a hack. + * + * @return bool */ protected function bogusComment($leading = '') { $comment = $leading; $tokens = $this->scanner->charsUntil('>'); - if ($tokens !== false) { + if (false !== $tokens) { $comment .= $tokens; } $tok = $this->scanner->current(); - if ($tok !== false) { + if (false !== $tok) { $comment .= $tok; } $this->flushBuffer(); $this->events->comment($comment); - $this->scanner->next(); + $this->scanner->consume(); return true; } /** * Read a comment. - * * Expects the first tok to be inside of the comment. + * + * @return bool */ protected function comment() { @@ -624,54 +671,60 @@ protected function comment() $comment = ''; // <!-->. Emit an empty comment because 8.2.4.46 says to. - if ($tok == '>') { + if ('>' == $tok) { // Parse error. Emit the comment token. $this->parseError("Expected comment data, got '>'"); $this->events->comment(''); - $this->scanner->next(); + $this->scanner->consume(); + return true; } // Replace NULL with the replacement char. - if ($tok == "\0") { + if ("\0" == $tok) { $tok = UTF8Utils::FFFD; } - while (! $this->isCommentEnd()) { + while (!$this->isCommentEnd()) { $comment .= $tok; $tok = $this->scanner->next(); } $this->events->comment($comment); - $this->scanner->next(); + $this->scanner->consume(); + return true; } /** * Check if the scanner has reached the end of a comment. + * + * @return bool */ protected function isCommentEnd() { $tok = $this->scanner->current(); // EOF - if ($tok === false) { + if (false === $tok) { // Hit the end. - $this->parseError("Unexpected EOF in a comment."); + $this->parseError('Unexpected EOF in a comment.'); + return true; } // If it doesn't start with -, not the end. - if ($tok != '-') { + if ('-' != $tok) { return false; } // Advance one, and test for '->' - if ($this->scanner->next() == '-' && $this->scanner->peek() == '>') { - $this->scanner->next(); // Consume the last '>' + if ('-' == $this->scanner->next() && '>' == $this->scanner->peek()) { + $this->scanner->consume(); // Consume the last '>' return true; } // Unread '-'; $this->scanner->unconsume(1); + return false; } @@ -682,16 +735,18 @@ protected function isCommentEnd() * not Quirksmode is enabled on the event handler. * * @todo This method is a little long. Should probably refactor. + * + * @return bool */ protected function doctype() { - if (strcasecmp($this->scanner->current(), 'D')) { - return false; - } // Check that string is DOCTYPE. - $chars = $this->scanner->charsWhile("DOCTYPEdoctype"); - if (strcasecmp($chars, 'DOCTYPE')) { + if ($this->scanner->sequenceMatches('DOCTYPE', false)) { + $this->scanner->consume(7); + } else { + $chars = $this->scanner->charsWhile('DOCTYPEdoctype'); $this->parseError('Expected DOCTYPE, got %s', $chars); + return $this->bogusComment('<!' . $chars); } @@ -699,18 +754,16 @@ protected function doctype() $tok = $this->scanner->current(); // EOF: die. - if ($tok === false) { + if (false === $tok) { $this->events->doctype('html5', EventHandler::DOCTYPE_NONE, '', true); - return $this->eof(); - } + $this->eof(); - $doctypeName = ''; + return true; + } // NULL char: convert. - if ($tok === "\0") { - $this->parseError("Unexpected null character in DOCTYPE."); - $doctypeName .= UTF8::FFFD; - $tok = $this->scanner->next(); + if ("\0" === $tok) { + $this->parseError('Unexpected null character in DOCTYPE.'); } $stop = " \n\f>"; @@ -721,61 +774,68 @@ protected function doctype() $tok = $this->scanner->current(); // If false, emit a parse error, DOCTYPE, and return. - if ($tok === false) { + if (false === $tok) { $this->parseError('Unexpected EOF in DOCTYPE declaration.'); $this->events->doctype($doctypeName, EventHandler::DOCTYPE_NONE, null, true); + return true; } // Short DOCTYPE, like <!DOCTYPE html> - if ($tok == '>') { + if ('>' == $tok) { // DOCTYPE without a name. - if (strlen($doctypeName) == 0) { - $this->parseError("Expected a DOCTYPE name. Got nothing."); + if (0 == strlen($doctypeName)) { + $this->parseError('Expected a DOCTYPE name. Got nothing.'); $this->events->doctype($doctypeName, 0, null, true); - $this->scanner->next(); + $this->scanner->consume(); + return true; } $this->events->doctype($doctypeName); - $this->scanner->next(); + $this->scanner->consume(); + return true; } $this->scanner->whitespace(); $pub = strtoupper($this->scanner->getAsciiAlpha()); - $white = strlen($this->scanner->whitespace()); + $white = $this->scanner->whitespace(); // Get ID, and flag it as pub or system. - if (($pub == 'PUBLIC' || $pub == 'SYSTEM') && $white > 0) { + if (('PUBLIC' == $pub || 'SYSTEM' == $pub) && $white > 0) { // Get the sys ID. - $type = $pub == 'PUBLIC' ? EventHandler::DOCTYPE_PUBLIC : EventHandler::DOCTYPE_SYSTEM; + $type = 'PUBLIC' == $pub ? EventHandler::DOCTYPE_PUBLIC : EventHandler::DOCTYPE_SYSTEM; $id = $this->quotedString("\0>"); - if ($id === false) { + if (false === $id) { $this->events->doctype($doctypeName, $type, $pub, false); - return false; + + return true; } // Premature EOF. - if ($this->scanner->current() === false) { - $this->parseError("Unexpected EOF in DOCTYPE"); + if (false === $this->scanner->current()) { + $this->parseError('Unexpected EOF in DOCTYPE'); $this->events->doctype($doctypeName, $type, $id, true); + return true; } // Well-formed complete DOCTYPE. $this->scanner->whitespace(); - if ($this->scanner->current() == '>') { + if ('>' == $this->scanner->current()) { $this->events->doctype($doctypeName, $type, $id, false); - $this->scanner->next(); + $this->scanner->consume(); + return true; } // If we get here, we have <!DOCTYPE foo PUBLIC "bar" SOME_JUNK // Throw away the junk, parse error, quirks mode, return true. - $this->scanner->charsUntil(">"); - $this->parseError("Malformed DOCTYPE."); + $this->scanner->charsUntil('>'); + $this->parseError('Malformed DOCTYPE.'); $this->events->doctype($doctypeName, $type, $id, true); - $this->scanner->next(); + $this->scanner->consume(); + return true; } @@ -783,75 +843,81 @@ protected function doctype() // Consume to > and trash. $this->scanner->charsUntil('>'); - $this->parseError("Expected PUBLIC or SYSTEM. Got %s.", $pub); + $this->parseError('Expected PUBLIC or SYSTEM. Got %s.', $pub); $this->events->doctype($doctypeName, 0, null, true); - $this->scanner->next(); + $this->scanner->consume(); + return true; } /** * Utility for reading a quoted string. * - * @param string $stopchars - * Characters (in addition to a close-quote) that should stop the string. - * E.g. sometimes '>' is higher precedence than '"' or "'". - * @return mixed String if one is found (quotations omitted) + * @param string $stopchars Characters (in addition to a close-quote) that should stop the string. + * E.g. sometimes '>' is higher precedence than '"' or "'". + * + * @return mixed String if one is found (quotations omitted). */ protected function quotedString($stopchars) { $tok = $this->scanner->current(); - if ($tok == '"' || $tok == "'") { - $this->scanner->next(); + if ('"' == $tok || "'" == $tok) { + $this->scanner->consume(); $ret = $this->scanner->charsUntil($tok . $stopchars); if ($this->scanner->current() == $tok) { - $this->scanner->next(); + $this->scanner->consume(); } else { // Parse error because no close quote. - $this->parseError("Expected %s, got %s", $tok, $this->scanner->current()); + $this->parseError('Expected %s, got %s', $tok, $this->scanner->current()); } + return $ret; } + return false; } /** * Handle a CDATA section. + * + * @return bool */ protected function cdataSection() { - if ($this->scanner->current() != '[') { - return false; - } $cdata = ''; - $this->scanner->next(); + $this->scanner->consume(); $chars = $this->scanner->charsWhile('CDAT'); - if ($chars != 'CDATA' || $this->scanner->current() != '[') { + if ('CDATA' != $chars || '[' != $this->scanner->current()) { $this->parseError('Expected [CDATA[, got %s', $chars); + return $this->bogusComment('<![' . $chars); } $tok = $this->scanner->next(); do { - if ($tok === false) { + if (false === $tok) { $this->parseError('Unexpected EOF inside CDATA.'); $this->bogusComment('<![CDATA[' . $cdata); + return true; } $cdata .= $tok; $tok = $this->scanner->next(); - } while (! $this->sequenceMatches(']]>')); + } while (!$this->scanner->sequenceMatches(']]>')); // Consume ]]> $this->scanner->consume(3); $this->events->cdata($cdata); + return true; } // ================================================================ // Non-HTML5 // ================================================================ + /** * Handle a processing instruction. * @@ -859,40 +925,44 @@ protected function cdataSection() * treated as "bogus comments". However, since we're not a user * agent, we allow them. We consume until ?> and then issue a * EventListener::processingInstruction() event. + * + * @return bool */ protected function processingInstruction() { - if ($this->scanner->current() != '?') { + if ('?' != $this->scanner->current()) { return false; } $tok = $this->scanner->next(); $procName = $this->scanner->getAsciiAlpha(); - $white = strlen($this->scanner->whitespace()); + $white = $this->scanner->whitespace(); // If not a PI, send to bogusComment. - if (strlen($procName) == 0 || $white == 0 || $this->scanner->current() == false) { + if (0 == strlen($procName) || 0 == $white || false == $this->scanner->current()) { $this->parseError("Expected processing instruction name, got $tok"); $this->bogusComment('<?' . $tok . $procName); + return true; } $data = ''; // As long as it's not the case that the next two chars are ? and >. - while (! ($this->scanner->current() == '?' && $this->scanner->peek() == '>')) { + while (!('?' == $this->scanner->current() && '>' == $this->scanner->peek())) { $data .= $this->scanner->current(); $tok = $this->scanner->next(); - if ($tok === false) { - $this->parseError("Unexpected EOF in processing instruction."); + if (false === $tok) { + $this->parseError('Unexpected EOF in processing instruction.'); $this->events->processingInstruction($procName, $data); + return true; } } - $this->scanner->next(); // > - $this->scanner->next(); // Next token. + $this->scanner->consume(2); // Consume the closing tag $this->events->processingInstruction($procName, $data); + return true; } @@ -903,6 +973,10 @@ protected function processingInstruction() /** * Read from the input stream until we get to the desired sequene * or hit the end of the input stream. + * + * @param string $sequence + * + * @return string */ protected function readUntilSequence($sequence) { @@ -910,19 +984,20 @@ protected function readUntilSequence($sequence) // Optimization for reading larger blocks faster. $first = substr($sequence, 0, 1); - while ($this->scanner->current() !== false) { + while (false !== $this->scanner->current()) { $buffer .= $this->scanner->charsUntil($first); // Stop as soon as we hit the stopping condition. - if ($this->sequenceMatches($sequence, false)) { + if ($this->scanner->sequenceMatches($sequence, false)) { return $buffer; } $buffer .= $this->scanner->current(); - $this->scanner->next(); + $this->scanner->consume(); } // If we get here, we hit the EOF. - $this->parseError("Unexpected EOF during text read."); + $this->parseError('Unexpected EOF during text read.'); + return $buffer; } @@ -935,28 +1010,20 @@ protected function readUntilSequence($sequence) * will still need to read the next sequence, even if * this returns true. * - * Example: $this->sequenceMatches('</script>') will + * Example: $this->scanner->sequenceMatches('</script>') will * see if the input stream is at the start of a * '</script>' string. + * + * @param string $sequence + * @param bool $caseSensitive + * + * @return bool */ protected function sequenceMatches($sequence, $caseSensitive = true) { - $len = strlen($sequence); - $buffer = ''; - for ($i = 0; $i < $len; ++ $i) { - $tok = $this->scanner->current(); - $buffer .= $tok; - - // EOF. Rewind and let the caller handle it. - if ($tok === false) { - $this->scanner->unconsume($i); - return false; - } - $this->scanner->next(); - } + @trigger_error(__METHOD__ . ' method is deprecated since version 2.4 and will be removed in 3.0. Use Scanner::sequenceMatches() instead.', E_USER_DEPRECATED); - $this->scanner->unconsume($len); - return $caseSensitive ? $buffer == $sequence : strcasecmp($buffer, $sequence) === 0; + return $this->scanner->sequenceMatches($sequence, $caseSensitive); } /** @@ -968,7 +1035,7 @@ protected function sequenceMatches($sequence, $caseSensitive = true) */ protected function flushBuffer() { - if ($this->text === '') { + if ('' === $this->text) { return; } $this->events->text($this->text); @@ -979,6 +1046,8 @@ protected function flushBuffer() * Add text to the temporary buffer. * * @see flushBuffer() + * + * @param string $str */ protected function buffer($str) { @@ -990,6 +1059,10 @@ protected function buffer($str) * * A parse error always returns false because it never consumes any * characters. + * + * @param string $msg + * + * @return string */ protected function parseError($msg) { @@ -1003,62 +1076,57 @@ protected function parseError($msg) $line = $this->scanner->currentLine(); $col = $this->scanner->columnOffset(); $this->events->parseError($msg, $line, $col); + return false; } /** * Decode a character reference and return the string. * - * Returns false if the entity could not be found. If $inAttribute is set - * to true, a bare & will be returned as-is. + * If $inAttribute is set to true, a bare & will be returned as-is. + * + * @param bool $inAttribute Set to true if the text is inside of an attribute value. + * false otherwise. * - * @param boolean $inAttribute - * Set to true if the text is inside of an attribute value. - * false otherwise. + * @return string */ protected function decodeCharacterReference($inAttribute = false) { - - // If it fails this, it's definitely not an entity. - if ($this->scanner->current() != '&') { - return false; - } - // Next char after &. $tok = $this->scanner->next(); - $entity = ''; $start = $this->scanner->position(); - if ($tok == false) { + if (false === $tok) { return '&'; } // These indicate not an entity. We return just // the &. - if (strspn($tok, static::WHITE . "&<") == 1) { + if ("\t" === $tok || "\n" === $tok || "\f" === $tok || ' ' === $tok || '&' === $tok || '<' === $tok) { // $this->scanner->next(); return '&'; } // Numeric entity - if ($tok == '#') { + if ('#' === $tok) { $tok = $this->scanner->next(); // Hexidecimal encoding. // X[0-9a-fA-F]+; // x[0-9a-fA-F]+; - if ($tok == 'x' || $tok == 'X') { + if ('x' === $tok || 'X' === $tok) { $tok = $this->scanner->next(); // Consume x // Convert from hex code to char. $hex = $this->scanner->getHex(); if (empty($hex)) { - $this->parseError("Expected &#xHEX;, got &#x%s", $tok); + $this->parseError('Expected &#xHEX;, got &#x%s', $tok); // We unconsume because we don't know what parser rules might // be in effect for the remaining chars. For example. '&#>' // might result in a specific parsing rule inside of tag // contexts, while not inside of pcdata context. $this->scanner->unconsume(2); + return '&'; } $entity = CharacterReference::lookupHex($hex); @@ -1067,17 +1135,17 @@ protected function decodeCharacterReference($inAttribute = false) else { // Convert from decimal to char. $numeric = $this->scanner->getNumeric(); - if ($numeric === false) { - $this->parseError("Expected &#DIGITS;, got &#%s", $tok); + if (false === $numeric) { + $this->parseError('Expected &#DIGITS;, got &#%s', $tok); $this->scanner->unconsume(2); + return '&'; } $entity = CharacterReference::lookupDecimal($numeric); } - } elseif ($tok === '=' && $inAttribute) { + } elseif ('=' === $tok && $inAttribute) { return '&'; } else { // String entity. - // Attempt to consume a string up to a ';'. // [a-zA-Z0-9]+; $cname = $this->scanner->getAsciiAlphaNum(); @@ -1086,11 +1154,12 @@ protected function decodeCharacterReference($inAttribute = false) // When no entity is found provide the name of the unmatched string // and continue on as the & is not part of an entity. The & will // be converted to & elsewhere. - if ($entity == null) { - if (!$inAttribute || strlen($cname) === 0) { + if (null === $entity) { + if (!$inAttribute || '' === $cname) { $this->parseError("No match in entity table for '%s'", $cname); } $this->scanner->unconsume($this->scanner->position() - $start); + return '&'; } } @@ -1099,8 +1168,9 @@ protected function decodeCharacterReference($inAttribute = false) $tok = $this->scanner->current(); // We have an entity. We're done here. - if ($tok == ';') { - $this->scanner->next(); + if (';' === $tok) { + $this->scanner->consume(); + return $entity; } @@ -1108,10 +1178,12 @@ protected function decodeCharacterReference($inAttribute = false) // entire string. Otherwise, failure to match is an error. if ($inAttribute) { $this->scanner->unconsume($this->scanner->position() - $start); + return '&'; } - $this->parseError("Expected &ENTITY;, got &ENTITY%s (no trailing ;) ", $tok); + $this->parseError('Expected &ENTITY;, got &ENTITY%s (no trailing ;) ', $tok); + return '&' . $entity; } } diff --git a/vendor/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php b/vendor/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php index 6236208218a2d3683fb68d0b075a9bf52f623587..00d3951fdf7789608b64c6569af034216a18ba9b 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/TreeBuildingRules.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5\Parser; /** @@ -14,7 +15,6 @@ */ class TreeBuildingRules { - protected static $tags = array( 'li' => 1, 'dd' => 1, @@ -29,20 +29,9 @@ class TreeBuildingRules 'tbody' => 1, 'table' => 1, 'optgroup' => 1, - 'option' => 1 + 'option' => 1, ); - /** - * Build a new rules engine. - * - * @param \DOMDocument $doc - * The DOM document to use for evaluation and modification. - */ - public function __construct($doc) - { - $this->doc = $doc; - } - /** * Returns true if the given tagname has special processing rules. */ @@ -71,7 +60,7 @@ public function evaluate($new, $current) return $this->handleRT($new, $current); case 'optgroup': return $this->closeIfCurrentMatches($new, $current, array( - 'optgroup' + 'optgroup', )); case 'option': return $this->closeIfCurrentMatches($new, $current, array( @@ -79,13 +68,13 @@ public function evaluate($new, $current) )); case 'tr': return $this->closeIfCurrentMatches($new, $current, array( - 'tr' + 'tr', )); case 'td': case 'th': return $this->closeIfCurrentMatches($new, $current, array( 'th', - 'td' + 'td', )); case 'tbody': case 'thead': @@ -95,7 +84,7 @@ public function evaluate($new, $current) return $this->closeIfCurrentMatches($new, $current, array( 'thead', 'tfoot', - 'tbody' + 'tbody', )); } @@ -105,7 +94,7 @@ public function evaluate($new, $current) protected function handleLI($ele, $current) { return $this->closeIfCurrentMatches($ele, $current, array( - 'li' + 'li', )); } @@ -113,7 +102,7 @@ protected function handleDT($ele, $current) { return $this->closeIfCurrentMatches($ele, $current, array( 'dt', - 'dd' + 'dd', )); } @@ -121,14 +110,13 @@ protected function handleRT($ele, $current) { return $this->closeIfCurrentMatches($ele, $current, array( 'rt', - 'rp' + 'rp', )); } protected function closeIfCurrentMatches($ele, $current, $match) { - $tname = $current->tagName; - if (in_array($current->tagName, $match)) { + if (in_array($current->tagName, $match, true)) { $current->parentNode->appendChild($ele); } else { $current->appendChild($ele); diff --git a/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php b/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php index 44affb639e7e264e3bebe0d8c1c55beb663b7425..f6a70bfacea91b568d91a912f67005048f7c4bf7 100644 --- a/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php +++ b/vendor/masterminds/html5/src/HTML5/Parser/UTF8Utils.php @@ -1,8 +1,9 @@ <?php + namespace Masterminds\HTML5\Parser; + /* - * -* Portions based on code from html5lib files with the following copyright: +Portions based on code from html5lib files with the following copyright: Copyright 2009 Geoffrey Sneddon <http://gsnedders.com/> @@ -24,40 +25,44 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -/** - * UTF-8 Utilities - */ + +use Masterminds\HTML5\Exception; + class UTF8Utils { - /** - * The Unicode replacement character.. + * The Unicode replacement character. */ const FFFD = "\xEF\xBF\xBD"; /** * Count the number of characters in a string. + * UTF-8 aware. This will try (in order) iconv, MB, libxml, and finally a custom counter. * - * UTF-8 aware. This will try (in order) iconv, - * MB, libxml, and finally a custom counter. + * @param string $string * - * @todo Move this to a general utility class. + * @return int */ public static function countChars($string) { // Get the length for the string we need. if (function_exists('mb_strlen')) { return mb_strlen($string, 'utf-8'); - } elseif (function_exists('iconv_strlen')) { + } + + if (function_exists('iconv_strlen')) { return iconv_strlen($string, 'utf-8'); - } elseif (function_exists('utf8_decode')) { + } + + if (function_exists('utf8_decode')) { // MPB: Will this work? Won't certain decodes lead to two chars // extrapolated out of 2-byte chars? return strlen(utf8_decode($string)); } + $count = count_chars($string); + // 0x80 = 0x7F - 0 + 1 (one added to get inclusive range) // 0x33 = 0xF4 - 0x2C + 1 (one added to get inclusive range) return array_sum(array_slice($count, 0, 0x80)) + array_sum(array_slice($count, 0xC2, 0x33)); @@ -69,15 +74,20 @@ public static function countChars($string) * This has not yet been tested with charactersets other than UTF-8. * It should work with ISO-8859-1/-13 and standard Latin Win charsets. * - * @param string $data - * The data to convert. - * @param string $encoding - * A valid encoding. Examples: http://www.php.net/manual/en/mbstring.supported-encodings.php + * @param string $data The data to convert + * @param string $encoding A valid encoding. Examples: http://www.php.net/manual/en/mbstring.supported-encodings.php + * + * @return string */ public static function convertToUTF8($data, $encoding = 'UTF-8') { /* - * From the HTML5 spec: Given an encoding, the bytes in the input stream must be converted to Unicode characters for the tokeniser, as described by the rules for that encoding, except that the leading U+FEFF BYTE ORDER MARK character, if any, must not be stripped by the encoding layer (it is stripped by the rule below). Bytes or sequences of bytes in the original byte stream that could not be converted to Unicode characters must be converted to U+FFFD REPLACEMENT CHARACTER code points. + * From the HTML5 spec: Given an encoding, the bytes in the input stream must be converted + * to Unicode characters for the tokeniser, as described by the rules for that encoding, + * except that the leading U+FEFF BYTE ORDER MARK character, if any, must not be stripped + * by the encoding layer (it is stripped by the rule below). Bytes or sequences of bytes + * in the original byte stream that could not be converted to Unicode characters must be + * converted to U+FFFD REPLACEMENT CHARACTER code points. */ // mb_convert_encoding is chosen over iconv because of a bug. The best @@ -98,8 +108,9 @@ public static function convertToUTF8($data, $encoding = 'UTF-8') mb_substitute_character('none'); $data = mb_convert_encoding($data, 'UTF-8', $encoding); mb_substitute_character($save); - } // @todo Get iconv running in at least some environments if that is possible. - elseif (function_exists('iconv') && $encoding != 'auto') { + } + // @todo Get iconv running in at least some environments if that is possible. + elseif (function_exists('iconv') && 'auto' !== $encoding) { // fprintf(STDOUT, "iconv found\n"); // iconv has the following behaviors: // - Overlong representations are ignored. @@ -107,14 +118,13 @@ public static function convertToUTF8($data, $encoding = 'UTF-8') // - Incomplete sequences generate a warning. $data = @iconv($encoding, 'UTF-8//IGNORE', $data); } else { - // we can make a conforming native implementation throw new Exception('Not implemented, please install mbstring or iconv'); } /* * One leading U+FEFF BYTE ORDER MARK character must be ignored if any are present. */ - if (substr($data, 0, 3) === "\xEF\xBB\xBF") { + if ("\xEF\xBB\xBF" === substr($data, 0, 3)) { $data = substr($data, 3); } @@ -124,28 +134,30 @@ public static function convertToUTF8($data, $encoding = 'UTF-8') /** * Checks for Unicode code points that are not valid in a document. * - * @param string $data - * A string to analyze. - * @return array An array of (string) error messages produced by the scanning. + * @param string $data A string to analyze + * + * @return array An array of (string) error messages produced by the scanning */ public static function checkForIllegalCodepoints($data) { - if (! function_exists('preg_match_all')) { - throw\Exception('The PCRE library is not loaded or is not available.'); - } - // Vestigal error handling. $errors = array(); /* - * All U+0000 null characters in the input must be replaced by U+FFFD REPLACEMENT CHARACTERs. Any occurrences of such characters is a parse error. + * All U+0000 null characters in the input must be replaced by U+FFFD REPLACEMENT CHARACTERs. + * Any occurrences of such characters is a parse error. */ - for ($i = 0, $count = substr_count($data, "\0"); $i < $count; $i ++) { + for ($i = 0, $count = substr_count($data, "\0"); $i < $count; ++$i) { $errors[] = 'null-character'; } /* - * Any occurrences of any characters in the ranges U+0001 to U+0008, U+000B, U+000E to U+001F, U+007F to U+009F, U+D800 to U+DFFF , U+FDD0 to U+FDEF, and characters U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, U+2FFFF, U+3FFFE, U+3FFFF, U+4FFFE, U+4FFFF, U+5FFFE, U+5FFFF, U+6FFFE, U+6FFFF, U+7FFFE, U+7FFFF, U+8FFFE, U+8FFFF, U+9FFFE, U+9FFFF, U+AFFFE, U+AFFFF, U+BFFFE, U+BFFFF, U+CFFFE, U+CFFFF, U+DFFFE, U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE, U+FFFFF, U+10FFFE, and U+10FFFF are parse errors. (These are all control characters or permanently undefined Unicode characters.) + * Any occurrences of any characters in the ranges U+0001 to U+0008, U+000B, U+000E to U+001F, U+007F + * to U+009F, U+D800 to U+DFFF , U+FDD0 to U+FDEF, and characters U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, + * U+2FFFE, U+2FFFF, U+3FFFE, U+3FFFF, U+4FFFE, U+4FFFF, U+5FFFE, U+5FFFF, U+6FFFE, U+6FFFF, U+7FFFE, + * U+7FFFF, U+8FFFE, U+8FFFF, U+9FFFE, U+9FFFF, U+AFFFE, U+AFFFF, U+BFFFE, U+BFFFF, U+CFFFE, U+CFFFF, + * U+DFFFE, U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE, U+FFFFF, U+10FFFE, and U+10FFFF are parse errors. + * (These are all control characters or permanently undefined Unicode characters.) */ // Check PCRE is loaded. $count = preg_match_all( @@ -162,7 +174,7 @@ public static function checkForIllegalCodepoints($data) | [\xF0-\xF4][\x8F-\xBF]\xBF[\xBE\xBF] # U+nFFFE and U+nFFFF (1 <= n <= 10_{16}) )/x', $data, $matches); - for ($i = 0; $i < $count; $i ++) { + for ($i = 0; $i < $count; ++$i) { $errors[] = 'invalid-codepoint'; } diff --git a/vendor/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php b/vendor/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php index 4f90f84d23612ff810f2a731e1c2120236c004cd..e9421a12dc14cadbee76ece762e631e7095eb4bc 100644 --- a/vendor/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php +++ b/vendor/masterminds/html5/src/HTML5/Serializer/HTML5Entities.php @@ -3,11 +3,12 @@ * @file * This contains HTML5 entities to use with serializing. * - * The list here is mildly different from the list at \Masterminds\HTML5\Entities because + * The list here is mildly different from the list at Entities because * that list was generated from the w3c. It contains some entities that are * not entirely proper such as &am; which maps to &. This list is meant to be * a fallback for PHP versions prior to PHP 5.4 when dealing with encoding. */ + namespace Masterminds\HTML5\Serializer; /** @@ -17,7 +18,6 @@ */ class HTML5Entities { - public static $map = array( ' ' => '	', "\n" => '
', @@ -1528,6 +1528,6 @@ class HTML5Entities '𝕨' => '𝕨', '𝕩' => '𝕩', '𝕪' => '𝕪', - '𝕫' => '𝕫' + '𝕫' => '𝕫', ); } diff --git a/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php b/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php index a22683c382ed776c3ace800fca4f16f3d2bcd710..41616d57aeab9ff3264b598f3e859dad224d2b93 100644 --- a/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php +++ b/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php @@ -6,6 +6,7 @@ * These output rules are likely to generate output similar to the document that * was parsed. It is not intended to output exactly the document that was parsed. */ + namespace Masterminds\HTML5\Serializer; use Masterminds\HTML5\Elements; @@ -13,10 +14,10 @@ /** * Generate the output html5 based on element rules. */ -class OutputRules implements \Masterminds\HTML5\Serializer\RulesInterface +class OutputRules implements RulesInterface { /** - * Defined in http://www.w3.org/TR/html51/infrastructure.html#html-namespace-0 + * Defined in http://www.w3.org/TR/html51/infrastructure.html#html-namespace-0. */ const NAMESPACE_HTML = 'http://www.w3.org/1999/xhtml'; @@ -31,7 +32,7 @@ class OutputRules implements \Masterminds\HTML5\Serializer\RulesInterface const NAMESPACE_XMLNS = 'http://www.w3.org/2000/xmlns/'; /** - * Holds the HTML5 element names that causes a namespace switch + * Holds the HTML5 element names that causes a namespace switch. * * @var array */ @@ -50,8 +51,9 @@ class OutputRules implements \Masterminds\HTML5\Serializer\RulesInterface const IM_IN_MATHML = 3; /** - * Used as cache to detect if is available ENT_HTML5 - * @var boolean + * Used as cache to detect if is available ENT_HTML5. + * + * @var bool */ private $hasHTML5 = false; @@ -169,12 +171,13 @@ public function __construct($output, $options = array()) // If HHVM, see https://github.com/facebook/hhvm/issues/2727 $this->hasHTML5 = defined('ENT_HTML5') && !defined('HHVM_VERSION'); } + public function addRule(array $rule) { $this->nonBooleanAttributes[] = $rule; } - public function setTraverser(\Masterminds\HTML5\Serializer\Traverser $traverser) + public function setTraverser(Traverser $traverser) { $this->traverser = $traverser; @@ -211,10 +214,10 @@ public function element($ele) // If we are in SVG or MathML there is special handling. // Using if/elseif instead of switch because it's faster in PHP. - if ($name == 'svg') { + if ('svg' == $name) { $this->outputMode = static::IM_IN_SVG; $name = Elements::normalizeSvgElement($name); - } elseif ($name == 'math') { + } elseif ('math' == $name) { $this->outputMode = static::IM_IN_MATHML; } @@ -234,13 +237,13 @@ public function element($ele) } // Close out the SVG or MathML special handling. - if ($name == 'svg' || $name == 'math') { + if ('svg' == $name || 'math' == $name) { $this->outputMode = static::IM_IN_HTML; } } // If not unary, add a closing tag. - if (! Elements::isA($name, Elements::VOID_TAG)) { + if (!Elements::isA($name, Elements::VOID_TAG)) { $this->closeTag($ele); } } @@ -248,13 +251,13 @@ public function element($ele) /** * Write a text node. * - * @param \DOMText $ele - * The text node to write. + * @param \DOMText $ele The text node to write. */ public function text($ele) { if (isset($ele->parentNode) && isset($ele->parentNode->tagName) && Elements::isA($ele->parentNode->localName, Elements::TEXT_RAW)) { $this->wr($ele->data); + return; } @@ -283,20 +286,19 @@ public function processorInstruction($ele) ->wr($ele->data) ->wr('?>'); } + /** - * Write the namespace attributes + * Write the namespace attributes. * - * - * @param \DOMNode $ele - * The element being written. + * @param \DOMNode $ele The element being written. */ protected function namespaceAttrs($ele) { - if (!$this->xpath || $this->xpath->document !== $ele->ownerDocument){ + if (!$this->xpath || $this->xpath->document !== $ele->ownerDocument) { $this->xpath = new \DOMXPath($ele->ownerDocument); } - foreach( $this->xpath->query('namespace::*[not(.=../../namespace::*)]', $ele ) as $nsNode ) { + foreach ($this->xpath->query('namespace::*[not(.=../../namespace::*)]', $ele) as $nsNode) { if (!in_array($nsNode->nodeValue, $this->implicitNamespaces)) { $this->wr(' ')->wr($nsNode->nodeName)->wr('="')->wr($nsNode->nodeValue)->wr('"'); } @@ -309,18 +311,15 @@ protected function namespaceAttrs($ele) * Tags for HTML, MathML, and SVG are in the local name. Otherwise, use the * qualified name (8.3). * - * @param \DOMNode $ele - * The element being written. + * @param \DOMNode $ele The element being written. */ protected function openTag($ele) { $this->wr('<')->wr($this->traverser->isLocalElement($ele) ? $ele->localName : $ele->tagName); - $this->attrs($ele); $this->namespaceAttrs($ele); - if ($this->outputMode == static::IM_IN_HTML) { $this->wr('>'); } // If we are not in html mode we are in SVG, MathML, or XML embedded content. @@ -337,7 +336,7 @@ protected function openTag($ele) protected function attrs($ele) { // FIXME: Needs support for xml, xmlns, xlink, and namespaced elements. - if (! $ele->hasAttributes()) { + if (!$ele->hasAttributes()) { return $this; } @@ -345,7 +344,7 @@ protected function attrs($ele) // value-less attributes. $map = $ele->attributes; $len = $map->length; - for ($i = 0; $i < $len; ++ $i) { + for ($i = 0; $i < $len; ++$i) { $node = $map->item($i); $val = $this->enc($node->value, true); @@ -365,45 +364,42 @@ protected function attrs($ele) $this->wr(' ')->wr($name); - if ((isset($val) && $val !== '') || $this->nonBooleanAttribute($node)) { + if ((isset($val) && '' !== $val) || $this->nonBooleanAttribute($node)) { $this->wr('="')->wr($val)->wr('"'); } } } - protected function nonBooleanAttribute(\DOMAttr $attr) { $ele = $attr->ownerElement; - foreach($this->nonBooleanAttributes as $rule){ - - if(isset($rule['nodeNamespace']) && $rule['nodeNamespace']!==$ele->namespaceURI){ + foreach ($this->nonBooleanAttributes as $rule) { + if (isset($rule['nodeNamespace']) && $rule['nodeNamespace'] !== $ele->namespaceURI) { continue; } - if(isset($rule['attNamespace']) && $rule['attNamespace']!==$attr->namespaceURI){ + if (isset($rule['attNamespace']) && $rule['attNamespace'] !== $attr->namespaceURI) { continue; } - if(isset($rule['nodeName']) && !is_array($rule['nodeName']) && $rule['nodeName']!==$ele->localName){ + if (isset($rule['nodeName']) && !is_array($rule['nodeName']) && $rule['nodeName'] !== $ele->localName) { continue; } - if(isset($rule['nodeName']) && is_array($rule['nodeName']) && !in_array($ele->localName, $rule['nodeName'], true)){ + if (isset($rule['nodeName']) && is_array($rule['nodeName']) && !in_array($ele->localName, $rule['nodeName'], true)) { continue; } - if(isset($rule['attrName']) && !is_array($rule['attrName']) && $rule['attrName']!==$attr->localName){ + if (isset($rule['attrName']) && !is_array($rule['attrName']) && $rule['attrName'] !== $attr->localName) { continue; } - if(isset($rule['attrName']) && is_array($rule['attrName']) && !in_array($attr->localName, $rule['attrName'], true)){ + if (isset($rule['attrName']) && is_array($rule['attrName']) && !in_array($attr->localName, $rule['attrName'], true)) { continue; } - if(isset($rule['xpath'])){ - + if (isset($rule['xpath'])) { $xp = $this->getXPath($attr); - if(isset($rule['prefixes'])){ - foreach($rule['prefixes'] as $nsPrefix => $ns){ + if (isset($rule['prefixes'])) { + foreach ($rule['prefixes'] as $nsPrefix => $ns) { $xp->registerNamespace($nsPrefix, $ns); } } - if(!$xp->evaluate($rule['xpath'], $attr)){ + if (!$xp->evaluate($rule['xpath'], $attr)) { continue; } } @@ -414,10 +410,12 @@ protected function nonBooleanAttribute(\DOMAttr $attr) return false; } - private function getXPath(\DOMNode $node){ - if(!$this->xpath){ + private function getXPath(\DOMNode $node) + { + if (!$this->xpath) { $this->xpath = new \DOMXPath($node->ownerDocument); } + return $this->xpath; } @@ -427,8 +425,7 @@ private function getXPath(\DOMNode $node){ * Tags for HTML, MathML, and SVG are in the local name. Otherwise, use the * qualified name (8.3). * - * @param \DOMNode $ele - * The element being written. + * @param \DOMNode $ele The element being written. */ protected function closeTag($ele) { @@ -440,25 +437,26 @@ protected function closeTag($ele) /** * Write to the output. * - * @param string $text - * The string to put into the output. + * @param string $text The string to put into the output * - * @return \Masterminds\HTML5\Serializer\Traverser $this so it can be used in chaining. + * @return $this */ protected function wr($text) { fwrite($this->out, $text); + return $this; } /** * Write a new line character. * - * @return \Masterminds\HTML5\Serializer\Traverser $this so it can be used in chaining. + * @return $this */ protected function nl() { fwrite($this->out, PHP_EOL); + return $this; } @@ -484,18 +482,15 @@ protected function nl() * * @todo Use the Entities class in php 5.3 to have html5 entities. * - * @param string $text - * text to encode. - * @param boolean $attribute - * True if we are encoding an attrubute, false otherwise + * @param string $text Text to encode. + * @param bool $attribute True if we are encoding an attrubute, false otherwise. * * @return string The encoded text. */ protected function enc($text, $attribute = false) { - // Escape the text rather than convert to named character references. - if (! $this->encode) { + if (!$this->encode) { return $this->escape($text, $attribute); } @@ -507,7 +502,7 @@ protected function enc($text, $attribute = false) } // If a version earlier than 5.4 html5 entities are not entirely handled. // This manually handles them. else { - return strtr($text, \Masterminds\HTML5\Serializer\HTML5Entities::$map); + return strtr($text, HTML5Entities::$map); } } @@ -525,14 +520,11 @@ protected function enc($text, $attribute = false) * * @see http://www.w3.org/TR/2013/CR-html5-20130806/syntax.html#escapingString * - * @param string $text - * text to escape. - * @param boolean $attribute - * True if we are escaping an attrubute, false otherwise + * @param string $text Text to escape. + * @param bool $attribute True if we are escaping an attrubute, false otherwise. */ protected function escape($text, $attribute = false) { - // Not using htmlspecialchars because, while it does escaping, it doesn't // match the requirements of section 8.5. For example, it doesn't handle // non-breaking spaces. @@ -540,14 +532,14 @@ protected function escape($text, $attribute = false) $replace = array( '"' => '"', '&' => '&', - "\xc2\xa0" => ' ' + "\xc2\xa0" => ' ', ); } else { $replace = array( '<' => '<', '>' => '>', '&' => '&', - "\xc2\xa0" => ' ' + "\xc2\xa0" => ' ', ); } diff --git a/vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php b/vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php index 6ef5e5e52243a1ecb034956430960f311dae5d17..69a6ecdad8c46c2af63538ac8582bc33c38dffe5 100644 --- a/vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php +++ b/vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php @@ -3,28 +3,24 @@ * @file * The interface definition for Rules to generate output. */ + namespace Masterminds\HTML5\Serializer; /** - * To create a new rule set for writing output the RulesInterface needs to be - * implemented. - * The resulting class can be specified in the options with the - * key of rules. + * To create a new rule set for writing output the RulesInterface needs to be implemented. + * The resulting class can be specified in the options with the key of rules. * - * For an example implementation see \Masterminds\HTML5\Serializer\OutputRules. + * For an example implementation see Serializer\OutputRules. */ interface RulesInterface { - /** * The class constructor. * * Note, before the rules can be used a traverser must be registered. * - * @param mixed $output - * The output stream to write output to. - * @param array $options - * An array of options. + * @param mixed $output The output stream to write output to. + * @param array $options An array of options. */ public function __construct($output, $options = array()); @@ -33,11 +29,11 @@ public function __construct($output, $options = array()); * * Note, only one traverser can be used by the rules. * - * @param \Masterminds\HTML5\Serializer\Traverser $traverser - * The traverser used in the rules. - * @return \Masterminds\HTML5\Serializer\RulesInterface $this for the current object. + * @param Traverser $traverser The traverser used in the rules. + * + * @return RulesInterface $this for the current object. */ - public function setTraverser(\Masterminds\HTML5\Serializer\Traverser $traverser); + public function setTraverser(Traverser $traverser); /** * Write a document element (\DOMDocument). @@ -92,7 +88,7 @@ public function comment($ele); /** * Write a processor instruction. * - * To learn about processor instructions see \Masterminds\HTML5\InstructionProcessor + * To learn about processor instructions see InstructionProcessor * * Instead of returning the result write it to the output stream ($output) * that was passed into the constructor. diff --git a/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php b/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php index e95dc366488353de7a8c9ccbefc2efc2403f1e14..1e8d7924eb955ea671c83471aaf93d7dddf92722 100644 --- a/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php +++ b/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5\Serializer; /** @@ -12,14 +13,13 @@ */ class Traverser { - /** * Namespaces that should be treated as "local" to HTML5. */ - static $local_ns = array( + protected static $local_ns = array( 'http://www.w3.org/1999/xhtml' => 'html', 'http://www.w3.org/1998/Math/MathML' => 'math', - 'http://www.w3.org/2000/svg' => 'svg' + 'http://www.w3.org/2000/svg' => 'svg', ); protected $dom; @@ -35,16 +35,13 @@ class Traverser /** * Create a traverser. * - * @param DOMNode|DOMNodeList $dom - * The document or node to traverse. - * @param resource $out - * A stream that allows writing. The traverser will output into this - * stream. - * @param array $options - * An array or options for the traverser as key/value pairs. These include: - * - encode_entities: A bool to specify if full encding should happen for all named - * charachter references. Defaults to false which escapes &'<>". - * - output_rules: The path to the class handling the output rules. + * @param \DOMNode|\DOMNodeList $dom The document or node to traverse. + * @param resource $out A stream that allows writing. The traverser will output into this + * stream. + * @param array $options An array of options for the traverser as key/value pairs. These include: + * - encode_entities: A bool to specify if full encding should happen for all named + * charachter references. Defaults to false which escapes &'<>". + * - output_rules: The path to the class handling the output rules. */ public function __construct($dom, $out, RulesInterface $rules, $options = array()) { @@ -59,8 +56,7 @@ public function __construct($dom, $out, RulesInterface $rules, $options = array( /** * Tell the traverser to walk the DOM. * - * @return resource $out - * Returns the output stream. + * @return resource $out Returns the output stream. */ public function walk() { @@ -87,8 +83,7 @@ public function walk() /** * Process a node in the DOM. * - * @param mixed $node - * A node implementing \DOMNode. + * @param mixed $node A node implementing \DOMNode. */ public function node($node) { @@ -119,8 +114,7 @@ public function node($node) /** * Walk through all the nodes on a node list. * - * @param \DOMNodeList $nl - * A list of child elements to walk through. + * @param \DOMNodeList $nl A list of child elements to walk through. */ public function children($nl) { @@ -132,10 +126,9 @@ public function children($nl) /** * Is an element local? * - * @param mixed $ele - * An element that implement \DOMNode. + * @param mixed $ele An element that implement \DOMNode. * - * @return bool True if local and false otherwise. + * @return bool true if local and false otherwise. */ public function isLocalElement($ele) { diff --git a/vendor/masterminds/html5/test/HTML5/ElementsTest.php b/vendor/masterminds/html5/test/HTML5/ElementsTest.php index 629b561bfa97ea66251e4cd0a267229a7cfdf62d..08b5ee425255a40c8ae161083243b843545c63ee 100644 --- a/vendor/masterminds/html5/test/HTML5/ElementsTest.php +++ b/vendor/masterminds/html5/test/HTML5/ElementsTest.php @@ -1,247 +1,247 @@ <?php + namespace Masterminds\HTML5\Tests; use Masterminds\HTML5\Elements; class ElementsTest extends TestCase { - public $html5Elements = array( - "a", - "abbr", - "address", - "area", - "article", - "aside", - "audio", - "b", - "base", - "bdi", - "bdo", - "blockquote", - "body", - "br", - "button", - "canvas", - "caption", - "cite", - "code", - "col", - "colgroup", - "command", + 'a', + 'abbr', + 'address', + 'area', + 'article', + 'aside', + 'audio', + 'b', + 'base', + 'bdi', + 'bdo', + 'blockquote', + 'body', + 'br', + 'button', + 'canvas', + 'caption', + 'cite', + 'code', + 'col', + 'colgroup', + 'command', // "data", - "datalist", - "dd", - "del", - "details", - "dfn", - "dialog", - "div", - "dl", - "dt", - "em", - "embed", - "fieldset", - "figcaption", - "figure", - "footer", - "form", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "head", - "header", - "hgroup", - "hr", - "html", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "legend", - "li", - "link", - "map", - "mark", - "menu", - "meta", - "meter", - "nav", - "noscript", - "object", - "ol", - "optgroup", - "option", - "output", - "p", - "param", - "pre", - "progress", - "q", - "rp", - "rt", - "ruby", - "s", - "samp", - "script", - "section", - "select", - "small", - "source", - "span", - "strong", - "style", - "sub", - "summary", - "sup", - "table", - "tbody", - "td", - "textarea", - "tfoot", - "th", - "thead", - "time", - "title", - "tr", - "track", - "u", - "ul", - "var", - "video", - "wbr" + 'datalist', + 'dd', + 'del', + 'details', + 'dfn', + 'dialog', + 'div', + 'dl', + 'dt', + 'em', + 'embed', + 'fieldset', + 'figcaption', + 'figure', + 'footer', + 'form', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'head', + 'header', + 'hgroup', + 'hr', + 'html', + 'i', + 'iframe', + 'img', + 'input', + 'ins', + 'kbd', + 'keygen', + 'label', + 'legend', + 'li', + 'link', + 'map', + 'mark', + 'menu', + 'meta', + 'meter', + 'nav', + 'noscript', + 'object', + 'ol', + 'optgroup', + 'option', + 'output', + 'p', + 'param', + 'pre', + 'progress', + 'q', + 'rp', + 'rt', + 'ruby', + 's', + 'samp', + 'script', + 'section', + 'select', + 'small', + 'source', + 'span', + 'strong', + 'style', + 'sub', + 'summary', + 'sup', + 'table', + 'tbody', + 'td', + 'textarea', + 'tfoot', + 'th', + 'thead', + 'time', + 'title', + 'tr', + 'track', + 'u', + 'ul', + 'var', + 'video', + 'wbr', ); public $mathmlElements = array( - "maction", - "maligngroup", - "malignmark", - "math", - "menclose", - "merror", - "mfenced", - "mfrac", - "mglyph", - "mi", - "mlabeledtr", - "mlongdiv", - "mmultiscripts", - "mn", - "mo", - "mover", - "mpadded", - "mphantom", - "mroot", - "mrow", - "ms", - "mscarries", - "mscarry", - "msgroup", - "msline", - "mspace", - "msqrt", - "msrow", - "mstack", - "mstyle", - "msub", - "msup", - "msubsup", - "mtable", - "mtd", - "mtext", - "mtr", - "munder", - "munderover" + 'maction', + 'maligngroup', + 'malignmark', + 'math', + 'menclose', + 'merror', + 'mfenced', + 'mfrac', + 'mglyph', + 'mi', + 'mlabeledtr', + 'mlongdiv', + 'mmultiscripts', + 'mn', + 'mo', + 'mover', + 'mpadded', + 'mphantom', + 'mroot', + 'mrow', + 'ms', + 'mscarries', + 'mscarry', + 'msgroup', + 'msline', + 'mspace', + 'msqrt', + 'msrow', + 'mstack', + 'mstyle', + 'msub', + 'msup', + 'msubsup', + 'mtable', + 'mtd', + 'mtext', + 'mtr', + 'munder', + 'munderover', ); public $svgElements = array( - "a", - "altGlyph", - "altGlyphDef", - "altGlyphItem", - "animate", - "animateColor", - "animateMotion", - "animateTransform", - "circle", - "clipPath", - "color-profile", - "cursor", - "defs", - "desc", - "ellipse", - "feBlend", - "feColorMatrix", - "feComponentTransfer", - "feComposite", - "feConvolveMatrix", - "feDiffuseLighting", - "feDisplacementMap", - "feDistantLight", - "feFlood", - "feFuncA", - "feFuncB", - "feFuncG", - "feFuncR", - "feGaussianBlur", - "feImage", - "feMerge", - "feMergeNode", - "feMorphology", - "feOffset", - "fePointLight", - "feSpecularLighting", - "feSpotLight", - "feTile", - "feTurbulence", - "filter", - "font", - "font-face", - "font-face-format", - "font-face-name", - "font-face-src", - "font-face-uri", - "foreignObject", - "g", - "glyph", - "glyphRef", - "hkern", - "image", - "line", - "linearGradient", - "marker", - "mask", - "metadata", - "missing-glyph", - "mpath", - "path", - "pattern", - "polygon", - "polyline", - "radialGradient", - "rect", - "script", - "set", - "stop", - "style", - "svg", - "switch", - "symbol", - "text", - "textPath", - "title", - "tref", - "tspan", - "use", - "view", - "vkern" + 'a', + 'altGlyph', + 'altGlyphDef', + 'altGlyphItem', + 'animate', + 'animateColor', + 'animateMotion', + 'animateTransform', + 'circle', + 'clipPath', + 'color-profile', + 'cursor', + 'defs', + 'desc', + 'ellipse', + 'feBlend', + 'feColorMatrix', + 'feComponentTransfer', + 'feComposite', + 'feConvolveMatrix', + 'feDiffuseLighting', + 'feDisplacementMap', + 'feDistantLight', + 'feFlood', + 'feFuncA', + 'feFuncB', + 'feFuncG', + 'feFuncR', + 'feGaussianBlur', + 'feImage', + 'feMerge', + 'feMergeNode', + 'feMorphology', + 'feOffset', + 'fePointLight', + 'feSpecularLighting', + 'feSpotLight', + 'feTile', + 'feTurbulence', + 'filter', + 'font', + 'font-face', + 'font-face-format', + 'font-face-name', + 'font-face-src', + 'font-face-uri', + 'foreignObject', + 'g', + 'glyph', + 'glyphRef', + 'hkern', + 'image', + 'line', + 'linearGradient', + 'marker', + 'mask', + 'metadata', + 'missing-glyph', + 'mpath', + 'path', + 'pattern', + 'polygon', + 'polyline', + 'radialGradient', + 'rect', + 'script', + 'set', + 'stop', + 'style', + 'svg', + 'switch', + 'symbol', + 'text', + 'textPath', + 'title', + 'tref', + 'tspan', + 'use', + 'view', + 'vkern', ); public function testIsHtml5Element() @@ -255,7 +255,7 @@ public function testIsHtml5Element() $nonhtml5 = array( 'foo', 'bar', - 'baz' + 'baz', ); foreach ($nonhtml5 as $element) { $this->assertFalse(Elements::isHtml5Element($element), 'html5 element test failed on: ' . $element); @@ -269,14 +269,14 @@ public function testIsMathMLElement() foreach ($this->mathmlElements as $element) { $this->assertTrue(Elements::isMathMLElement($element), 'MathML element test failed on: ' . $element); - // MathML is case sensetitive so these should all fail. + // MathML is case sensitive so these should all fail. $this->assertFalse(Elements::isMathMLElement(strtoupper($element)), 'MathML element test failed on: ' . strtoupper($element)); } $nonMathML = array( 'foo', 'bar', - 'baz' + 'baz', ); foreach ($nonMathML as $element) { $this->assertFalse(Elements::isMathMLElement($element), 'MathML element test failed on: ' . $element); @@ -288,14 +288,14 @@ public function testIsSvgElement() foreach ($this->svgElements as $element) { $this->assertTrue(Elements::isSvgElement($element), 'SVG element test failed on: ' . $element); - // SVG is case sensetitive so these should all fail. + // SVG is case sensitive so these should all fail. $this->assertFalse(Elements::isSvgElement(strtoupper($element)), 'SVG element test failed on: ' . strtoupper($element)); } $nonSVG = array( 'foo', 'bar', - 'baz' + 'baz', ); foreach ($nonSVG as $element) { $this->assertFalse(Elements::isSvgElement($element), 'SVG element test failed on: ' . $element); @@ -313,17 +313,17 @@ public function testIsElement() foreach ($this->mathmlElements as $element) { $this->assertTrue(Elements::isElement($element), 'MathML element test failed on: ' . $element); - // MathML is case sensetitive so these should all fail. + // MathML is case sensitive so these should all fail. $this->assertFalse(Elements::isElement(strtoupper($element)), 'MathML element test failed on: ' . strtoupper($element)); } foreach ($this->svgElements as $element) { $this->assertTrue(Elements::isElement($element), 'SVG element test failed on: ' . $element); - // SVG is case sensetitive so these should all fail. But, there is duplication - // html5 and SVG. Since html5 is case insensetitive we need to make sure + // SVG is case sensitive so these should all fail. But, there is duplication + // html5 and SVG. Since html5 is case insensitive we need to make sure // it's not a html5 element first. - if (! in_array($element, $this->html5Elements)) { + if (!in_array($element, $this->html5Elements)) { $this->assertFalse(Elements::isElement(strtoupper($element)), 'SVG element test failed on: ' . strtoupper($element)); } } @@ -331,7 +331,7 @@ public function testIsElement() $nonhtml5 = array( 'foo', 'bar', - 'baz' + 'baz', ); foreach ($nonhtml5 as $element) { $this->assertFalse(Elements::isElement($element), 'html5 element test failed on: ' . $element); @@ -348,10 +348,10 @@ public function testElement() $nonhtml5 = array( 'foo', 'bar', - 'baz' + 'baz', ); foreach ($nonhtml5 as $element) { - $this->assertFalse(Elements::element($element)); + $this->assertEquals(0, Elements::element($element)); } } @@ -373,7 +373,7 @@ public function testIsA() 'embed', 'frame', 'hr', - 'img' + 'img', ); foreach ($voidElements as $element) { @@ -383,7 +383,7 @@ public function testIsA() $nonVoid = array( 'span', 'a', - 'div' + 'div', ); foreach ($nonVoid as $tag) { $this->assertFalse(Elements::isA($tag, Elements::VOID_TAG), 'Void element test failed on: ' . $tag); @@ -393,7 +393,6 @@ public function testIsA() 'address', 'article', 'aside', - 'audio', 'blockquote', 'canvas', 'dd', @@ -422,7 +421,7 @@ public function testIsA() 'table', 'tfoot', 'ul', - 'video' + 'video', ); foreach ($blockTags as $tag) { @@ -432,7 +431,7 @@ public function testIsA() $nonBlockTags = array( 'span', 'img', - 'label' + 'label', ); foreach ($nonBlockTags as $tag) { $this->assertFalse(Elements::isA($tag, Elements::BLOCK_TAG), 'Block tag test failed on: ' . $tag); @@ -447,7 +446,7 @@ public function testNormalizeSvgElement() 'BAR' => 'bar', 'fespecularlighting' => 'feSpecularLighting', 'bAz' => 'baz', - 'foreignobject' => 'foreignObject' + 'foreignobject' => 'foreignObject', ); foreach ($tests as $input => $expected) { @@ -463,7 +462,7 @@ public function testNormalizeSvgAttribute() 'BAR' => 'bar', 'limitingconeangle' => 'limitingConeAngle', 'bAz' => 'baz', - 'patterncontentunits' => 'patternContentUnits' + 'patterncontentunits' => 'patternContentUnits', ); foreach ($tests as $input => $expected) { @@ -476,7 +475,7 @@ public function testNormalizeMathMlAttribute() $tests = array( 'foo' => 'foo', 'definitionurl' => 'definitionURL', - 'BAR' => 'bar' + 'BAR' => 'bar', ); foreach ($tests as $input => $expected) { diff --git a/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/utf-8.html b/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/utf-8.html new file mode 100644 index 0000000000000000000000000000000000000000..fa5a029ce1bbcbced8154472931601deaa3bffa2 --- /dev/null +++ b/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/utf-8.html @@ -0,0 +1,9 @@ +<!doctype html> +<html> +<head> + <meta http-equiv="content-type" content="text/html;charset=utf-8" /> +</head> +<body> + <p>Žťčýů</p> +</body> +</html> diff --git a/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/windows-1252.html b/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/windows-1252.html new file mode 100644 index 0000000000000000000000000000000000000000..f0132da5dee7442ad786dd341fadddf6b0baab38 --- /dev/null +++ b/vendor/masterminds/html5/test/HTML5/Fixtures/encoding/windows-1252.html @@ -0,0 +1,9 @@ +<!doctype html> +<html> +<head> + <meta http-equiv="content-type" content="text/html;charset=windows-1252"> +</head> +<body> + <p>�����</p> +</body> +</html> diff --git a/vendor/masterminds/html5/test/HTML5/Html5Test.php b/vendor/masterminds/html5/test/HTML5/Html5Test.php index 77643c4a9ad53f79535403d9d4aa2135a4cb4d9f..26d52fee17459e8e64986a971336fcd62aa74e3c 100644 --- a/vendor/masterminds/html5/test/HTML5/Html5Test.php +++ b/vendor/masterminds/html5/test/HTML5/Html5Test.php @@ -1,8 +1,15 @@ <?php + namespace Masterminds\HTML5\Tests; +use Masterminds\HTML5; + class Html5Test extends TestCase { + /** + * @var HTML5 + */ + private $html5; public function setUp() { @@ -28,20 +35,19 @@ protected function cycleFragment($fragment) return $out; } - public function testImageTagsInSvg() { - $html = "<!DOCTYPE html> + $html = '<!DOCTYPE html> <html> <head> <title>foo</title> </head> <body> <svg> - <image height=\"10\" width=\"10\"></image> + <image height="10" width="10"></image> </svg> </body> - </html>"; + </html>'; $doc = $this->html5->loadHTML($html); $this->assertInstanceOf('DOMElement', $doc->getElementsByTagName('image')->item(0)); $this->assertEmpty($this->html5->getErrors()); @@ -51,30 +57,57 @@ public function testLoadOptions() { // doc $dom = $this->html5->loadHTML($this->wrap('<t:tag/>'), array( - 'implicitNamespaces' => array('t' => 'http://example.com'), - "xmlNamespaces" => true + 'implicitNamespaces' => array('t' => 'http://example.com'), + 'xmlNamespaces' => true, )); $this->assertInstanceOf('\DOMDocument', $dom); $this->assertEmpty($this->html5->getErrors()); $this->assertFalse($this->html5->hasErrors()); - $xpath = new \DOMXPath( $dom ); - $xpath->registerNamespace( "t", "http://example.com" ); - $this->assertEquals(1, $xpath->query( "//t:tag" )->length); + $xpath = new \DOMXPath($dom); + $xpath->registerNamespace('t', 'http://example.com'); + $this->assertEquals(1, $xpath->query('//t:tag')->length); // doc fragment $frag = $this->html5->loadHTMLFragment('<t:tag/>', array( - 'implicitNamespaces' => array('t' => 'http://example.com'), - "xmlNamespaces" => true + 'implicitNamespaces' => array('t' => 'http://example.com'), + 'xmlNamespaces' => true, )); $this->assertInstanceOf('\DOMDocumentFragment', $frag); $this->assertEmpty($this->html5->getErrors()); $this->assertFalse($this->html5->hasErrors()); $frag->ownerDocument->appendChild($frag); - $xpath = new \DOMXPath( $frag->ownerDocument ); - $xpath->registerNamespace( "t", "http://example.com" ); - $this->assertEquals(1, $xpath->query( "//t:tag" , $frag)->length); + $xpath = new \DOMXPath($frag->ownerDocument); + $xpath->registerNamespace('t', 'http://example.com'); + $this->assertEquals(1, $xpath->query('//t:tag', $frag)->length); + } + + public function testEncodingUtf8() + { + $dom = $this->html5->load(__DIR__ . '/Fixtures/encoding/utf-8.html'); + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + $this->assertFalse($this->html5->hasErrors()); + + $this->assertContains('Žťčýů', $dom->saveHTML()); + } + + public function testEncodingWindows1252() + { + $dom = $this->html5->load(__DIR__ . '/Fixtures/encoding/windows-1252.html', array( + 'encoding' => 'Windows-1252', + )); + + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + $this->assertFalse($this->html5->hasErrors()); + + $dumpedAsUtf8 = mb_convert_encoding($dom->saveHTML(), 'UTF-8', 'Windows-1252'); + $this->assertNotFalse(mb_strpos($dumpedAsUtf8, 'Ž')); + $this->assertNotFalse(mb_strpos($dumpedAsUtf8, 'è')); + $this->assertNotFalse(mb_strpos($dumpedAsUtf8, 'ý')); + $this->assertNotFalse(mb_strpos($dumpedAsUtf8, 'ù')); } public function testErrors() @@ -162,11 +195,11 @@ public function testSave() // Test resource $file = fopen('php://temp', 'w'); $this->html5->save($dom, $file); - $content = stream_get_contents($file, - 1, 0); + $content = stream_get_contents($file, -1, 0); $this->assertRegExp('|<p>This is a test.</p>|', $content); // Test file - $tmpfname = tempnam(sys_get_temp_dir(), "html5-php"); + $tmpfname = tempnam(sys_get_temp_dir(), 'html5-php'); $this->html5->save($dom, $tmpfname); $content = file_get_contents($tmpfname); $this->assertRegExp('|<p>This is a test.</p>|', $content); @@ -197,7 +230,7 @@ public function testConfig() $html5 = $this->getInstance(array( 'foo' => 'bar', - 'encode_entities' => true + 'encode_entities' => true, )); $options = $html5->getOptions(); $this->assertEquals('bar', $options['foo']); @@ -233,11 +266,11 @@ public function testSvg() $list = $dom->getElementsByTagName('svg'); $this->assertNotEmpty($list->length); $svg = $list->item(0); - $this->assertEquals("0 0 3 2", $svg->getAttribute('viewBox')); + $this->assertEquals('0 0 3 2', $svg->getAttribute('viewBox')); $this->assertFalse($svg->hasAttribute('viewbox')); // Test a mixed case tag. - // Note: getElementsByTagName is not case sensetitive. + // Note: getElementsByTagName is not case sensitive. $list = $dom->getElementsByTagName('textPath'); $this->assertNotEmpty($list->length); $textPath = $list->item(0); @@ -292,12 +325,12 @@ public function testUnknownElements() // they are handled as normal elements. Note, to do this is really // an invalid example and you should not embed prefixed xml in html5. $dom = $this->html5->loadHTMLFragment( - "<f:rug> + '<f:rug> <f:name>Big rectangle thing</f:name> <f:width>40</f:width> <f:length>80</f:length> </f:rug> - <sarcasm>um, yeah</sarcasm>"); + <sarcasm>um, yeah</sarcasm>'); $this->assertEmpty($this->html5->getErrors()); $markup = $this->html5->saveHTML($dom); @@ -423,7 +456,7 @@ public function testCaseSensitiveTags() $dom = $this->html5->loadHTML( '<html><body><Button color="red">Error</Button></body></html>', array( - "xmlNamespaces" => true + 'xmlNamespaces' => true, ) ); $out = $this->html5->saveHTML($dom); diff --git a/vendor/masterminds/html5/test/HTML5/Parser/CharacterReferenceTest.php b/vendor/masterminds/html5/test/HTML5/Parser/CharacterReferenceTest.php index 762bcc2610479a91e1e93a8b973c4ab4c8fd8355..a5eee73c893057d22fe0af8029a362146934e95c 100644 --- a/vendor/masterminds/html5/test/HTML5/Parser/CharacterReferenceTest.php +++ b/vendor/masterminds/html5/test/HTML5/Parser/CharacterReferenceTest.php @@ -3,13 +3,13 @@ * @file * Test the Scanner. This requires the InputStream tests are all good. */ + namespace Masterminds\HTML5\Tests\Parser; use Masterminds\HTML5\Parser\CharacterReference; class CharacterReferenceTest extends \Masterminds\HTML5\Tests\TestCase { - public function testLookupName() { $this->assertEquals('&', CharacterReference::lookupName('amp')); diff --git a/vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php b/vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php index a441af837f342dc33acc945d3dfec8f520a7075d..21e9cea299e504d3d14ae9d69936bf1ec668b025 100644 --- a/vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php +++ b/vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php @@ -3,9 +3,9 @@ * @file * Test the Tree Builder. */ + namespace Masterminds\HTML5\Tests\Parser; -use Masterminds\HTML5\Parser\StringInputStream; use Masterminds\HTML5\Parser\Scanner; use Masterminds\HTML5\Parser\Tokenizer; use Masterminds\HTML5\Parser\DOMTreeBuilder; @@ -16,14 +16,14 @@ class DOMTreeBuilderTest extends \Masterminds\HTML5\Tests\TestCase { protected $errors = array(); + /** * Convenience function for parsing. */ protected function parse($string, array $options = array()) { $treeBuilder = new DOMTreeBuilder(false, $options); - $input = new StringInputStream($string); - $scanner = new Scanner($input); + $scanner = new Scanner($string); $parser = new Tokenizer($scanner, $treeBuilder); $parser->parse(); @@ -38,8 +38,7 @@ protected function parse($string, array $options = array()) protected function parseFragment($string) { $treeBuilder = new DOMTreeBuilder(true); - $input = new StringInputStream($string); - $scanner = new Scanner($input); + $scanner = new Scanner($string); $parser = new Tokenizer($scanner, $treeBuilder); $parser->parse(); @@ -50,7 +49,7 @@ protected function parseFragment($string) public function testDocument() { - $html = "<!DOCTYPE html><html></html>"; + $html = '<!DOCTYPE html><html></html>'; $doc = $this->parse($html); $this->assertInstanceOf('\DOMDocument', $doc); @@ -103,9 +102,10 @@ public function testBareAmpersandNotAllowedInAttributes() </body> </html>', $doc->saveXML()); } + public function testBareAmpersandNotAllowedInBody() { - $html = "<!doctype html> + $html = '<!doctype html> <html> <body> a&b @@ -115,7 +115,7 @@ public function testBareAmpersandNotAllowedInBody() a&+ a& -- valid </body> - </html>"; + </html>'; $doc = $this->parse($html); $this->assertCount(5, $this->errors); @@ -134,28 +134,28 @@ public function testBareAmpersandNotAllowedInBody() public function testStrangeCapitalization() { - $html = "<!doctype html> + $html = '<!doctype html> <html> <head> <Title>Hello, world!</TitlE> </head> <body>TheBody<script>foo</script></body> - </html>"; + </html>'; $doc = $this->parse($html); $this->assertInstanceOf('\DOMDocument', $doc); $this->assertEquals('html', $doc->documentElement->tagName); - $xpath = new \DOMXPath( $doc ); - $xpath->registerNamespace( "x", "http://www.w3.org/1999/xhtml" ); + $xpath = new \DOMXPath($doc); + $xpath->registerNamespace('x', 'http://www.w3.org/1999/xhtml'); - $this->assertEquals("Hello, world!", $xpath->query( "//x:title" )->item( 0 )->nodeValue); - $this->assertEquals("foo", $xpath->query( "//x:script" )->item( 0 )->nodeValue); + $this->assertEquals('Hello, world!', $xpath->query('//x:title')->item(0)->nodeValue); + $this->assertEquals('foo', $xpath->query('//x:script')->item(0)->nodeValue); } public function testDocumentWithDisabledNamespaces() { - $html = "<!DOCTYPE html><html></html>"; + $html = '<!DOCTYPE html><html></html>'; $doc = $this->parse($html, array('disable_html_ns' => true)); $this->assertInstanceOf('\DOMDocument', $doc); @@ -167,7 +167,7 @@ public function testDocumentWithATargetDocument() { $targetDom = new \DOMDocument(); - $html = "<!DOCTYPE html><html></html>"; + $html = '<!DOCTYPE html><html></html>'; $doc = $this->parse($html, array('target_document' => $targetDom)); $this->assertInstanceOf('\DOMDocument', $doc); @@ -177,16 +177,16 @@ public function testDocumentWithATargetDocument() public function testDocumentFakeAttrAbsence() { - $html = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\"><body>foo</body></html>"; - $doc = $this->parse($html, array('xmlNamespaces'=>true)); + $html = '<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><body>foo</body></html>'; + $doc = $this->parse($html, array('xmlNamespaces' => true)); $xp = new \DOMXPath($doc); - $this->assertEquals(0, $xp->query("//@html5-php-fake-id-attribute")->length); + $this->assertEquals(0, $xp->query('//@html5-php-fake-id-attribute')->length); } public function testFragment() { - $html = "<div>test</div><span>test2</span>"; + $html = '<div>test</div><span>test2</span>'; $doc = $this->parseFragment($html); $this->assertInstanceOf('\DOMDocumentFragment', $doc); @@ -199,7 +199,7 @@ public function testFragment() public function testElements() { - $html = "<!DOCTYPE html><html><head><title></title></head><body></body></html>"; + $html = '<!DOCTYPE html><html><head><title></title></head><body></body></html>'; $doc = $this->parse($html); $root = $doc->documentElement; @@ -235,8 +235,8 @@ public function testCustomImplicitNamespaces() { $dom = $this->parse('<!DOCTYPE html><html><body><a t:href="bar">foo</a></body></html>', array( 'implicitNamespaces' => array( - 't' => 'http://www.example.com' - ) + 't' => 'http://www.example.com', + ), )); $a = $dom->getElementsByTagName('a')->item(0); $attr = $a->getAttributeNode('t:href'); @@ -244,8 +244,8 @@ public function testCustomImplicitNamespaces() $dom = $this->parse('<!DOCTYPE html><html><body><t:a>foo</t:a></body></html>', array( 'implicitNamespaces' => array( - 't' => 'http://www.example.com' - ) + 't' => 'http://www.example.com', + ), )); $list = $dom->getElementsByTagNameNS('http://www.example.com', 'a'); $this->assertEquals(1, $list->length); @@ -260,7 +260,7 @@ public function testXmlNamespaces() </body> <div>foo</div> </html>', array( - 'xmlNamespaces' => true + 'xmlNamespaces' => true, )); $a = $dom->getElementsByTagName('a')->item(0); $attr = $a->getAttributeNode('t:href'); @@ -285,10 +285,9 @@ public function testXmlNamespaceNesting() <xn:d xmlns:xn="http://www.prefixed.com/xn" xmlns="http://www.prefixed.com/bar5_x" id="bar5"><x id="bar5_x"/></xn:d> </body> </html>', array( - 'xmlNamespaces' => true + 'xmlNamespaces' => true, )); - $this->assertEmpty($this->errors); $div = $dom->getElementById('div'); @@ -301,34 +300,34 @@ public function testXmlNamespaceNesting() $this->assertEquals('http://www.prefixed.com/bar1', $bar1->namespaceURI); $bar2 = $dom->getElementById('bar2'); - $this->assertEquals("http://www.prefixed.com/bar2", $bar2->namespaceURI); + $this->assertEquals('http://www.prefixed.com/bar2', $bar2->namespaceURI); $bar3 = $dom->getElementById('bar3'); - $this->assertEquals("http://www.w3.org/1999/xhtml", $bar3->namespaceURI); + $this->assertEquals('http://www.w3.org/1999/xhtml', $bar3->namespaceURI); $bar4 = $dom->getElementById('bar4'); - $this->assertEquals("http://www.prefixed.com/bar4", $bar4->namespaceURI); + $this->assertEquals('http://www.prefixed.com/bar4', $bar4->namespaceURI); $svg = $dom->getElementById('svg'); - $this->assertEquals("http://www.w3.org/2000/svg", $svg->namespaceURI); + $this->assertEquals('http://www.w3.org/2000/svg', $svg->namespaceURI); $prefixed = $dom->getElementById('prefixed'); - $this->assertEquals("http://www.prefixed.com", $prefixed->namespaceURI); + $this->assertEquals('http://www.prefixed.com', $prefixed->namespaceURI); $prefixed = $dom->getElementById('bar5'); - $this->assertEquals("http://www.prefixed.com/xn", $prefixed->namespaceURI); + $this->assertEquals('http://www.prefixed.com/xn', $prefixed->namespaceURI); $prefixed = $dom->getElementById('bar5_x'); - $this->assertEquals("http://www.prefixed.com/bar5_x", $prefixed->namespaceURI); + $this->assertEquals('http://www.prefixed.com/bar5_x', $prefixed->namespaceURI); } public function testMoveNonInlineElements() { - $doc = $this->parse('<p>line1<br/><hr/>line2</p>'); - $this->assertEquals('<html xmlns="http://www.w3.org/1999/xhtml"><p>line1<br/></p><hr/>line2</html>', $doc->saveXML($doc->documentElement), 'Move non-inline elements outside of inline containers.'); + $doc = $this->parse('<p>line1<br/><hr/>line2</p>'); + $this->assertEquals('<html xmlns="http://www.w3.org/1999/xhtml"><p>line1<br/></p><hr/>line2</html>', $doc->saveXML($doc->documentElement), 'Move non-inline elements outside of inline containers.'); - $doc = $this->parse('<p>line1<div>line2</div></p>'); - $this->assertEquals('<html xmlns="http://www.w3.org/1999/xhtml"><p>line1</p><div>line2</div></html>', $doc->saveXML($doc->documentElement), 'Move non-inline elements outside of inline containers.'); + $doc = $this->parse('<p>line1<div>line2</div></p>'); + $this->assertEquals('<html xmlns="http://www.w3.org/1999/xhtml"><p>line1</p><div>line2</div></html>', $doc->saveXML($doc->documentElement), 'Move non-inline elements outside of inline containers.'); } public function testAttributes() @@ -398,7 +397,7 @@ public function testMathMLAttribute() public function testMissingHtmlTag() { - $html = "<!DOCTYPE html><title>test</title>"; + $html = '<!DOCTYPE html><title>test</title>'; $doc = $this->parse($html); $this->assertEquals('html', $doc->documentElement->tagName); @@ -413,23 +412,23 @@ public function testComment() $comment = $doc->documentElement->childNodes->item(0); $this->assertEquals(XML_COMMENT_NODE, $comment->nodeType); - $this->assertEquals("Hello World.", $comment->data); + $this->assertEquals('Hello World.', $comment->data); $html = '<!--Hello World.--><html></html>'; $doc = $this->parse($html); $comment = $doc->childNodes->item(1); $this->assertEquals(XML_COMMENT_NODE, $comment->nodeType); - $this->assertEquals("Hello World.", $comment->data); + $this->assertEquals('Hello World.', $comment->data); $comment = $doc->childNodes->item(2); $this->assertEquals(XML_ELEMENT_NODE, $comment->nodeType); - $this->assertEquals("html", $comment->tagName); + $this->assertEquals('html', $comment->tagName); } public function testCDATA() { - $html = "<!DOCTYPE html><html><math><![CDATA[test]]></math></html>"; + $html = '<!DOCTYPE html><html><math><![CDATA[test]]></math></html>'; $doc = $this->parse($html); $wrapper = $doc->getElementsByTagName('math')->item(0); @@ -441,7 +440,7 @@ public function testCDATA() public function testText() { - $html = "<!DOCTYPE html><html><head></head><body><math>test</math></body></html>"; + $html = '<!DOCTYPE html><html><head></head><body><math>test</math></body></html>'; $doc = $this->parse($html); $wrapper = $doc->getElementsByTagName('math')->item(0); @@ -451,8 +450,8 @@ public function testText() $this->assertEquals('test', $data->data); // The DomTreeBuilder has special handling for text when in before head mode. - $html = "<!DOCTYPE html><html> - Foo<head></head><body></body></html>"; + $html = '<!DOCTYPE html><html> + Foo<head></head><body></body></html>'; $doc = $this->parse($html); $this->assertEquals('Line 0, Col 0: Unexpected text. Ignoring: Foo', $this->errors[0]); $headElement = $doc->documentElement->firstChild; @@ -461,7 +460,7 @@ public function testText() public function testParseErrors() { - $html = "<!DOCTYPE html><html><math><![CDATA[test"; + $html = '<!DOCTYPE html><html><math><![CDATA[test'; $doc = $this->parse($html); // We're JUST testing that we can access errors. Actual testing of @@ -490,7 +489,7 @@ public function testProcessingInstruction() public function testAutocloseP() { - $html = "<!DOCTYPE html><html><body><p><figure></body></html>"; + $html = '<!DOCTYPE html><html><body><p><figure></body></html>'; $doc = $this->parse($html); $p = $doc->getElementsByTagName('p')->item(0); @@ -578,7 +577,7 @@ public function testNoScript() } /** - * Regression for issue #13 + * Regression for issue #13. */ public function testRegressionHTMLNoBody() { @@ -600,8 +599,7 @@ public function testInstructionProcessor() $is = new InstructionProcessorMock(); $treeBuilder->setInstructionProcessor($is); - $input = new StringInputStream($string); - $scanner = new Scanner($input); + $scanner = new Scanner($string); $parser = new Tokenizer($scanner, $treeBuilder); $parser->parse(); @@ -638,9 +636,74 @@ public function testSelectGroupedOptions() </body> </html> EOM; - $dom = $this->parse($html); + $dom = $this->parse($html); $this->assertSame(3, $dom->getElementById('first')->getElementsByTagName('option')->length); $this->assertSame(2, $dom->getElementById('second')->getElementsByTagName('option')->length); } + + public function testVoidTag() + { + $html = <<<EOM +<!DOCTYPE html> +<html> + <head> + <title>testVoidTag</title> + <meta> + <meta> + </head> + <body></body> +</html> +EOM; + + $dom = $this->parse($html); + $this->assertSame(2, $dom->getElementsByTagName('meta')->length); + $this->assertSame(0, $dom->getElementsByTagName('meta')->item(0)->childNodes->length); + $this->assertSame(0, $dom->getElementsByTagName('meta')->item(1)->childNodes->length); + } + + public function testIgnoreSelfClosingTag() + { + $html = <<<EOM +<!DOCTYPE html> +<html> + <head> + <title>testIllegalSelfClosingTag</title> + </head> + <body> + <div /><span>Hello, World!</span></div> + </body> +</html> +EOM; + + $dom = $this->parse($html); + $this->assertSame(1, $dom->getElementsByTagName('div')->item(0)->childNodes->length); + } + + public function testIAudioInParagraph() + { + $html = <<<EOM +<!DOCTYPE html> +<html> + <head> + <title>testIllegalSelfClosingTag</title> + </head> + <body> + <p> + <audio preload="none" controls="controls"> + <source src="https://example.com/test.mp3" type="audio/mpeg" /> + Your browser does not support the audio element. + </audio> + </p> + </body> +</html>> +</html> +EOM; + + $dom = $this->parse($html); + $audio = $dom->getElementsByTagName('audio')->item(0); + + $this->assertSame('p', $audio->parentNode->nodeName); + $this->assertSame(3, $audio->childNodes->length); + } } diff --git a/vendor/masterminds/html5/test/HTML5/Parser/EventStack.php b/vendor/masterminds/html5/test/HTML5/Parser/EventStack.php index 60e2abe9bf783bc8bc13fe9e376d1d7be6378e41..3d1de7708400324820fd4408802234a77345873b 100644 --- a/vendor/masterminds/html5/test/HTML5/Parser/EventStack.php +++ b/vendor/masterminds/html5/test/HTML5/Parser/EventStack.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5\Tests\Parser; use Masterminds\HTML5\Elements; @@ -16,7 +17,6 @@ */ class EventStack implements EventHandler { - protected $stack; public function __construct() @@ -46,7 +46,7 @@ protected function store($event, $data = null) { $this->stack[] = array( 'name' => $event, - 'data' => $data + 'data' => $data, ); } @@ -56,7 +56,7 @@ public function doctype($name, $type = 0, $id = null, $quirks = false) $name, $type, $id, - $quirks + $quirks, ); $this->store('doctype', $args); } @@ -65,7 +65,7 @@ public function startTag($name, $attributes = array(), $selfClosing = false) { $args = func_get_args(); $this->store('startTag', $args); - if ($name == 'pre' || $name == 'script') { + if ('pre' == $name || 'script' == $name) { return Elements::TEXT_RAW; } } @@ -73,14 +73,14 @@ public function startTag($name, $attributes = array(), $selfClosing = false) public function endTag($name) { $this->store('endTag', array( - $name + $name, )); } public function comment($cdata) { $this->store('comment', array( - $cdata + $cdata, )); } @@ -93,7 +93,7 @@ public function text($cdata) { // fprintf(STDOUT, "Received TEXT event with: " . $cdata); $this->store('text', array( - $cdata + $cdata, )); } diff --git a/vendor/masterminds/html5/test/HTML5/Parser/EventStackError.php b/vendor/masterminds/html5/test/HTML5/Parser/EventStackError.php index e58fdff2652cef11bb85f1af389b800fdf28fcfa..05c0a498f26ecaf674800a84d26fe8bdc279d12c 100644 --- a/vendor/masterminds/html5/test/HTML5/Parser/EventStackError.php +++ b/vendor/masterminds/html5/test/HTML5/Parser/EventStackError.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5\Tests\Parser; class EventStackError extends \Exception diff --git a/vendor/masterminds/html5/test/HTML5/Parser/FileInputStreamTest.html b/vendor/masterminds/html5/test/HTML5/Parser/FileInputStreamTest.html deleted file mode 100644 index a976e8be9f7bc6114a6b15c72860db1c89e9723d..0000000000000000000000000000000000000000 --- a/vendor/masterminds/html5/test/HTML5/Parser/FileInputStreamTest.html +++ /dev/null @@ -1,10 +0,0 @@ -<!doctype html> -<html lang="en"> - <head> - <meta charset="utf-8"> - <title>Test</title> - </head> - <body> - <p>This is a test.</p> - </body> -</html> \ No newline at end of file diff --git a/vendor/masterminds/html5/test/HTML5/Parser/FileInputStreamTest.php b/vendor/masterminds/html5/test/HTML5/Parser/FileInputStreamTest.php deleted file mode 100644 index 71dd828c44cbaf0e1596182c28aaba0aad43593a..0000000000000000000000000000000000000000 --- a/vendor/masterminds/html5/test/HTML5/Parser/FileInputStreamTest.php +++ /dev/null @@ -1,195 +0,0 @@ -<?php -namespace Masterminds\HTML5\Tests\Parser; - -use Masterminds\HTML5\Parser\FileInputStream; - -class FileInputStreamTest extends \Masterminds\HTML5\Tests\TestCase -{ - - public function testConstruct() - { - $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - - $this->assertInstanceOf('\Masterminds\HTML5\Parser\FileInputStream', $s); - } - - public function testNext() - { - $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - - $s->next(); - $this->assertEquals('!', $s->current()); - $s->next(); - $this->assertEquals('d', $s->current()); - } - - public function testKey() - { - $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - - $this->assertEquals(0, $s->key()); - - $s->next(); - $this->assertEquals(1, $s->key()); - } - - public function testPeek() - { - $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - - $this->assertEquals('!', $s->peek()); - - $s->next(); - $this->assertEquals('d', $s->peek()); - } - - public function testCurrent() - { - $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - - $this->assertEquals('<', $s->current()); - - $s->next(); - $this->assertEquals('!', $s->current()); - - $s->next(); - $this->assertEquals('d', $s->current()); - } - - public function testColumnOffset() - { - $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - $this->assertEquals(0, $s->columnOffset()); - $s->next(); - $this->assertEquals(1, $s->columnOffset()); - $s->next(); - $this->assertEquals(2, $s->columnOffset()); - $s->next(); - $this->assertEquals(3, $s->columnOffset()); - - // Make sure we get to the second line - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $this->assertEquals(0, $s->columnOffset()); - - $s->next(); - $canary = $s->current(); // h - $this->assertEquals('h', $canary); - $this->assertEquals(1, $s->columnOffset()); - } - - public function testCurrentLine() - { - $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - - $this->assertEquals(1, $s->currentLine()); - - // Make sure we get to the second line - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $this->assertEquals(2, $s->currentLine()); - - // Make sure we get to the third line - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $s->next(); - $this->assertEquals(3, $s->currentLine()); - } - - public function testRemainingChars() - { - $text = file_get_contents(__DIR__ . '/FileInputStreamTest.html'); - $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - $this->assertEquals($text, $s->remainingChars()); - - $text = substr(file_get_contents(__DIR__ . '/FileInputStreamTest.html'), 1); - $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - $s->next(); // Pop one. - $this->assertEquals($text, $s->remainingChars()); - } - - public function testCharsUnitl() - { - $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - - $this->assertEquals('', $s->charsUntil('<')); - // Pointer at '<', moves to ' ' - $this->assertEquals('<!doctype', $s->charsUntil(' ', 20)); - - // Pointer at ' ', moves to '>' - $this->assertEquals(' html', $s->charsUntil('>')); - - // Pointer at '>', moves to '\n'. - $this->assertEquals('>', $s->charsUntil("\n")); - - // Pointer at '\n', move forward then to the next'\n'. - $s->next(); - $this->assertEquals('<html lang="en">', $s->charsUntil("\n")); - - // Ony get one of the spaces. - $this->assertEquals("\n ", $s->charsUntil('<', 2)); - - // Get the other space. - $this->assertEquals(" ", $s->charsUntil('<')); - - // This should scan to the end of the file. - $text = "<head> - <meta charset=\"utf-8\"> - <title>Test</title> - </head> - <body> - <p>This is a test.</p> - </body> -</html>"; - $this->assertEquals($text, $s->charsUntil("\t")); - } - - public function testCharsWhile() - { - $s = new FileInputStream(__DIR__ . '/FileInputStreamTest.html'); - - $this->assertEquals('<!', $s->charsWhile('!<')); - $this->assertEquals('', $s->charsWhile('>')); - $this->assertEquals('doctype', $s->charsWhile('odcyept')); - $this->assertEquals(' htm', $s->charsWhile('html ', 4)); - } -} diff --git a/vendor/masterminds/html5/test/HTML5/Parser/InstructionProcessorMock.php b/vendor/masterminds/html5/test/HTML5/Parser/InstructionProcessorMock.php index 32a2204826ea256f4cfae88cff33a540a4183bba..4637a802c9d0a6f6cd65e17c76be61a40476b548 100644 --- a/vendor/masterminds/html5/test/HTML5/Parser/InstructionProcessorMock.php +++ b/vendor/masterminds/html5/test/HTML5/Parser/InstructionProcessorMock.php @@ -1,9 +1,9 @@ <?php + namespace Masterminds\HTML5\Tests\Parser; class InstructionProcessorMock implements \Masterminds\HTML5\InstructionProcessor { - public $name = null; public $data = null; @@ -14,9 +14,9 @@ public function process(\DOMElement $element, $name, $data) { $this->name = $name; $this->data = $data; - $this->count ++; + ++$this->count; - $div = $element->ownerDocument->createElement("div"); + $div = $element->ownerDocument->createElement('div'); $div->nodeValue = 'foo'; $element->appendChild($div); diff --git a/vendor/masterminds/html5/test/HTML5/Parser/ScannerTest.php b/vendor/masterminds/html5/test/HTML5/Parser/ScannerTest.php index 8fa5110686f18973d09e47085e31b112d3004e62..9f75c4dbaedefb512d5568ff28d5d3d627b4c0a5 100644 --- a/vendor/masterminds/html5/test/HTML5/Parser/ScannerTest.php +++ b/vendor/masterminds/html5/test/HTML5/Parser/ScannerTest.php @@ -3,6 +3,7 @@ * @file * Test the Scanner. This requires the InputStream tests are all good. */ + namespace Masterminds\HTML5\Tests\Parser; use Masterminds\HTML5\Parser\StringInputStream; @@ -10,21 +11,33 @@ class ScannerTest extends \Masterminds\HTML5\Tests\TestCase { - /** * A canary test to make sure the basics are setup and working. */ - public function testConstruct() + public function testConstructDeprecated() { - $is = new StringInputStream("abc"); + $is = new StringInputStream('abc'); $s = new Scanner($is); $this->assertInstanceOf('\Masterminds\HTML5\Parser\Scanner', $s); } + public function testConstruct() + { + $this->assertInstanceOf('\Masterminds\HTML5\Parser\Scanner', new Scanner('abc')); + } + + public function testNextDeprecated() + { + $s = new Scanner(new StringInputStream('abc')); + + $this->assertEquals('b', $s->next()); + $this->assertEquals('c', $s->next()); + } + public function testNext() { - $s = new Scanner(new StringInputStream("abc")); + $s = new Scanner('abc'); $this->assertEquals('b', $s->next()); $this->assertEquals('c', $s->next()); @@ -32,7 +45,7 @@ public function testNext() public function testPosition() { - $s = new Scanner(new StringInputStream("abc")); + $s = new Scanner('abc'); $this->assertEquals(0, $s->position()); @@ -42,7 +55,7 @@ public function testPosition() public function testPeek() { - $s = new Scanner(new StringInputStream("abc")); + $s = new Scanner('abc'); $this->assertEquals('b', $s->peek()); @@ -52,7 +65,7 @@ public function testPeek() public function testCurrent() { - $s = new Scanner(new StringInputStream("abc")); + $s = new Scanner('abc'); // Before scanning the string begins the current is empty. $this->assertEquals('a', $s->current()); @@ -67,7 +80,7 @@ public function testCurrent() public function testUnconsume() { - $s = new Scanner(new StringInputStream("abcdefghijklmnopqrst")); + $s = new Scanner('abcdefghijklmnopqrst'); // Get initial position. $s->next(); @@ -75,7 +88,7 @@ public function testUnconsume() // Move forward a bunch of positions. $amount = 7; - for ($i = 0; $i < $amount; $i ++) { + for ($i = 0; $i < $amount; ++$i) { $s->next(); } @@ -87,7 +100,7 @@ public function testUnconsume() public function testGetHex() { - $s = new Scanner(new StringInputStream("ab13ck45DE*")); + $s = new Scanner('ab13ck45DE*'); $this->assertEquals('ab13c', $s->getHex()); @@ -97,7 +110,7 @@ public function testGetHex() public function testGetAsciiAlpha() { - $s = new Scanner(new StringInputStream("abcdef1%mnop*")); + $s = new Scanner('abcdef1%mnop*'); $this->assertEquals('abcdef', $s->getAsciiAlpha()); @@ -109,7 +122,7 @@ public function testGetAsciiAlpha() public function testGetAsciiAlphaNum() { - $s = new Scanner(new StringInputStream("abcdef1ghpo#mn94op")); + $s = new Scanner('abcdef1ghpo#mn94op'); $this->assertEquals('abcdef1ghpo', $s->getAsciiAlphaNum()); @@ -120,7 +133,7 @@ public function testGetAsciiAlphaNum() public function testGetNumeric() { - $s = new Scanner(new StringInputStream("1784a 45 9867 #")); + $s = new Scanner('1784a 45 9867 #'); $this->assertEquals('1784', $s->getNumeric()); @@ -132,7 +145,7 @@ public function testGetNumeric() public function testCurrentLine() { - $s = new Scanner(new StringInputStream("1784a\n45\n9867 #\nThis is a test.")); + $s = new Scanner("1784a\n45\n9867 #\nThis is a test."); $this->assertEquals(1, $s->currentLine()); @@ -144,7 +157,7 @@ public function testCurrentLine() public function testColumnOffset() { - $s = new Scanner(new StringInputStream("1784a a\n45 9867 #\nThis is a test.")); + $s = new Scanner("1784a a\n45 9867 #\nThis is a test."); // Move the pointer to the space. $s->getAsciiAlphaNum(); @@ -163,7 +176,7 @@ public function testColumnOffset() public function testRemainingChars() { $string = "\n45\n9867 #\nThis is a test."; - $s = new Scanner(new StringInputStream("1784a\n45\n9867 #\nThis is a test.")); + $s = new Scanner("1784a\n45\n9867 #\nThis is a test."); $s->getAsciiAlphaNum(); $this->assertEquals($string, $s->remainingChars()); diff --git a/vendor/masterminds/html5/test/HTML5/Parser/StringInputStreamTest.php b/vendor/masterminds/html5/test/HTML5/Parser/StringInputStreamTest.php deleted file mode 100644 index f87cc10664b166b994c31a5b987cc2a026d6af57..0000000000000000000000000000000000000000 --- a/vendor/masterminds/html5/test/HTML5/Parser/StringInputStreamTest.php +++ /dev/null @@ -1,327 +0,0 @@ -<?php -namespace Masterminds\HTML5\Tests\Parser; - -use Masterminds\HTML5\Parser\StringInputStream; - -class StringInputStreamTest extends \Masterminds\HTML5\Tests\TestCase -{ - - /** - * A canary test to make sure the basics are setup and working. - */ - public function testConstruct() - { - $s = new StringInputStream("abc"); - - $this->assertInstanceOf('\Masterminds\HTML5\Parser\StringInputStream', $s); - } - - public function testNext() - { - $s = new StringInputStream("abc"); - - $s->next(); - $this->assertEquals('b', $s->current()); - $s->next(); - $this->assertEquals('c', $s->current()); - } - - public function testKey() - { - $s = new StringInputStream("abc"); - - $this->assertEquals(0, $s->key()); - - $s->next(); - $this->assertEquals(1, $s->key()); - } - - public function testPeek() - { - $s = new StringInputStream("abc"); - - $this->assertEquals('b', $s->peek()); - - $s->next(); - $this->assertEquals('c', $s->peek()); - } - - public function testCurrent() - { - $s = new StringInputStream("abc"); - - // Before scanning the string begins the current is empty. - $this->assertEquals('a', $s->current()); - - $s->next(); - $this->assertEquals('b', $s->current()); - - // Test movement through the string. - $s->next(); - $this->assertEquals('c', $s->current()); - } - - public function testColumnOffset() - { - $s = new StringInputStream("abc\ndef\n"); - $this->assertEquals(0, $s->columnOffset()); - $s->next(); - $this->assertEquals(1, $s->columnOffset()); - $s->next(); - $this->assertEquals(2, $s->columnOffset()); - $s->next(); - $this->assertEquals(3, $s->columnOffset()); - $s->next(); // LF - $this->assertEquals(0, $s->columnOffset()); - $s->next(); - $canary = $s->current(); // e - $this->assertEquals('e', $canary); - $this->assertEquals(1, $s->columnOffset()); - - $s = new StringInputStream("abc"); - $this->assertEquals(0, $s->columnOffset()); - $s->next(); - $this->assertEquals(1, $s->columnOffset()); - $s->next(); - $this->assertEquals(2, $s->columnOffset()); - } - - public function testCurrentLine() - { - $txt = "1\n2\n\n\n\n3"; - $stream = new StringInputStream($txt); - $this->assertEquals(1, $stream->currentLine()); - - // Advance over 1 and LF on to line 2 value 2. - $stream->next(); - $stream->next(); - $canary = $stream->current(); - $this->assertEquals(2, $stream->currentLine()); - $this->assertEquals('2', $canary); - - // Advance over 4x LF - $stream->next(); - $stream->next(); - $stream->next(); - $stream->next(); - $stream->next(); - $this->assertEquals(6, $stream->currentLine()); - $this->assertEquals('3', $stream->current()); - - // Make sure it doesn't do 7. - $this->assertEquals(6, $stream->currentLine()); - } - - public function testRemainingChars() - { - $text = "abcd"; - $s = new StringInputStream($text); - $this->assertEquals($text, $s->remainingChars()); - - $text = "abcd"; - $s = new StringInputStream($text); - $s->next(); // Pop one. - $this->assertEquals('bcd', $s->remainingChars()); - } - - public function testCharsUnitl() - { - $text = "abcdefffffffghi"; - $s = new StringInputStream($text); - $this->assertEquals('', $s->charsUntil('a')); - // Pointer at 'a', moves 2 to 'c' - $this->assertEquals('ab', $s->charsUntil('w', 2)); - - // Pointer at 'c', moves to first 'f' - $this->assertEquals('cde', $s->charsUntil('fzxv')); - - // Only get five 'f's - $this->assertEquals('fffff', $s->charsUntil('g', 5)); - - // Get just the last two 'f's - $this->assertEquals('ff', $s->charsUntil('g')); - - // This should scan to the end. - $this->assertEquals('ghi', $s->charsUntil('w', 9)); - } - - public function testCharsWhile() - { - $text = "abcdefffffffghi"; - $s = new StringInputStream($text); - - $this->assertEquals('ab', $s->charsWhile('ba')); - - $this->assertEquals('', $s->charsWhile('a')); - $this->assertEquals('cde', $s->charsWhile('cdeba')); - $this->assertEquals('ff', $s->charsWhile('f', 2)); - $this->assertEquals('fffff', $s->charsWhile('f')); - $this->assertEquals('g', $s->charsWhile('fg')); - $this->assertEquals('hi', $s->charsWhile('fghi', 99)); - } - - public function testBOM() - { - // Ignore in-text BOM. - $stream = new StringInputStream("a\xEF\xBB\xBF"); - $this->assertEquals("a\xEF\xBB\xBF", $stream->remainingChars(), 'A non-leading U+FEFF (BOM/ZWNBSP) should remain'); - - // Strip leading BOM - $leading = new StringInputStream("\xEF\xBB\xBFa"); - $this->assertEquals('a', $leading->current(), 'BOM should be stripped'); - } - - public function testCarriageReturn() - { - // Replace NULL with Unicode replacement. - $stream = new StringInputStream("\0\0\0"); - $this->assertEquals("\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD", $stream->remainingChars(), 'Null character should be replaced by U+FFFD'); - $this->assertEquals(3, count($stream->errors), 'Null character should set parse error: ' . print_r($stream->errors, true)); - - // Remove CR when next to LF. - $stream = new StringInputStream("\r\n"); - $this->assertEquals("\n", $stream->remainingChars(), 'CRLF should be replaced by LF'); - - // Convert CR to LF when on its own. - $stream = new StringInputStream("\r"); - $this->assertEquals("\n", $stream->remainingChars(), 'CR should be replaced by LF'); - } - - public function invalidParseErrorTestHandler($input, $numErrors, $name) - { - $stream = new StringInputStream($input, 'UTF-8'); - $this->assertEquals($input, $stream->remainingChars(), $name . ' (stream content)'); - $this->assertEquals($numErrors, count($stream->errors), $name . ' (number of errors)'); - } - - public function testInvalidReplace() - { - $invalidTest = array( - - // Min/max overlong - "\xC0\x80a" => 'Overlong representation of U+0000', - "\xE0\x80\x80a" => 'Overlong representation of U+0000', - "\xF0\x80\x80\x80a" => 'Overlong representation of U+0000', - "\xF8\x80\x80\x80\x80a" => 'Overlong representation of U+0000', - "\xFC\x80\x80\x80\x80\x80a" => 'Overlong representation of U+0000', - "\xC1\xBFa" => 'Overlong representation of U+007F', - "\xE0\x9F\xBFa" => 'Overlong representation of U+07FF', - "\xF0\x8F\xBF\xBFa" => 'Overlong representation of U+FFFF', - - "a\xDF" => 'Incomplete two byte sequence (missing final byte)', - "a\xEF\xBF" => 'Incomplete three byte sequence (missing final byte)', - "a\xF4\xBF\xBF" => 'Incomplete four byte sequence (missing final byte)', - - // Min/max continuation bytes - "a\x80" => 'Lone 80 continuation byte', - "a\xBF" => 'Lone BF continuation byte', - - // Invalid bytes (these can never occur) - "a\xFE" => 'Invalid FE byte', - "a\xFF" => 'Invalid FF byte' - ); - foreach ($invalidTest as $test => $note) { - $stream = new StringInputStream($test); - $this->assertEquals('a', $stream->remainingChars(), $note); - } - - // MPB: - // It appears that iconv just leaves these alone. Not sure what to - // do. - /* - * $converted = array( "a\xF5\x90\x80\x80" => 'U+110000, off unicode planes.', ); foreach ($converted as $test => $note) { $stream = new StringInputStream($test); $this->assertEquals(2, mb_strlen($stream->remainingChars()), $note); } - */ - } - - public function testInvalidParseError() - { - // C0 controls (except U+0000 and U+000D due to different handling) - $this->invalidParseErrorTestHandler("\x01", 1, 'U+0001 (C0 control)'); - $this->invalidParseErrorTestHandler("\x02", 1, 'U+0002 (C0 control)'); - $this->invalidParseErrorTestHandler("\x03", 1, 'U+0003 (C0 control)'); - $this->invalidParseErrorTestHandler("\x04", 1, 'U+0004 (C0 control)'); - $this->invalidParseErrorTestHandler("\x05", 1, 'U+0005 (C0 control)'); - $this->invalidParseErrorTestHandler("\x06", 1, 'U+0006 (C0 control)'); - $this->invalidParseErrorTestHandler("\x07", 1, 'U+0007 (C0 control)'); - $this->invalidParseErrorTestHandler("\x08", 1, 'U+0008 (C0 control)'); - $this->invalidParseErrorTestHandler("\x09", 0, 'U+0009 (C0 control)'); - $this->invalidParseErrorTestHandler("\x0A", 0, 'U+000A (C0 control)'); - $this->invalidParseErrorTestHandler("\x0B", 1, 'U+000B (C0 control)'); - $this->invalidParseErrorTestHandler("\x0C", 0, 'U+000C (C0 control)'); - $this->invalidParseErrorTestHandler("\x0E", 1, 'U+000E (C0 control)'); - $this->invalidParseErrorTestHandler("\x0F", 1, 'U+000F (C0 control)'); - $this->invalidParseErrorTestHandler("\x10", 1, 'U+0010 (C0 control)'); - $this->invalidParseErrorTestHandler("\x11", 1, 'U+0011 (C0 control)'); - $this->invalidParseErrorTestHandler("\x12", 1, 'U+0012 (C0 control)'); - $this->invalidParseErrorTestHandler("\x13", 1, 'U+0013 (C0 control)'); - $this->invalidParseErrorTestHandler("\x14", 1, 'U+0014 (C0 control)'); - $this->invalidParseErrorTestHandler("\x15", 1, 'U+0015 (C0 control)'); - $this->invalidParseErrorTestHandler("\x16", 1, 'U+0016 (C0 control)'); - $this->invalidParseErrorTestHandler("\x17", 1, 'U+0017 (C0 control)'); - $this->invalidParseErrorTestHandler("\x18", 1, 'U+0018 (C0 control)'); - $this->invalidParseErrorTestHandler("\x19", 1, 'U+0019 (C0 control)'); - $this->invalidParseErrorTestHandler("\x1A", 1, 'U+001A (C0 control)'); - $this->invalidParseErrorTestHandler("\x1B", 1, 'U+001B (C0 control)'); - $this->invalidParseErrorTestHandler("\x1C", 1, 'U+001C (C0 control)'); - $this->invalidParseErrorTestHandler("\x1D", 1, 'U+001D (C0 control)'); - $this->invalidParseErrorTestHandler("\x1E", 1, 'U+001E (C0 control)'); - $this->invalidParseErrorTestHandler("\x1F", 1, 'U+001F (C0 control)'); - - // DEL (U+007F) - $this->invalidParseErrorTestHandler("\x7F", 1, 'U+007F'); - - // C1 Controls - $this->invalidParseErrorTestHandler("\xC2\x80", 1, 'U+0080 (C1 control)'); - $this->invalidParseErrorTestHandler("\xC2\x9F", 1, 'U+009F (C1 control)'); - $this->invalidParseErrorTestHandler("\xC2\xA0", 0, 'U+00A0 (first codepoint above highest C1 control)'); - - // Charcters surrounding surrogates - $this->invalidParseErrorTestHandler("\xED\x9F\xBF", 0, 'U+D7FF (one codepoint below lowest surrogate codepoint)'); - $this->invalidParseErrorTestHandler("\xEF\xBF\xBD", 0, 'U+DE00 (one codepoint above highest surrogate codepoint)'); - - // Permanent noncharacters - $this->invalidParseErrorTestHandler("\xEF\xB7\x90", 1, 'U+FDD0 (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xEF\xB7\xAF", 1, 'U+FDEF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xEF\xBF\xBE", 1, 'U+FFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xEF\xBF\xBF", 1, 'U+FFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF0\x9F\xBF\xBE", 1, 'U+1FFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF0\x9F\xBF\xBF", 1, 'U+1FFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF0\xAF\xBF\xBE", 1, 'U+2FFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF0\xAF\xBF\xBF", 1, 'U+2FFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF0\xBF\xBF\xBE", 1, 'U+3FFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF0\xBF\xBF\xBF", 1, 'U+3FFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF1\x8F\xBF\xBE", 1, 'U+4FFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF1\x8F\xBF\xBF", 1, 'U+4FFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF1\x9F\xBF\xBE", 1, 'U+5FFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF1\x9F\xBF\xBF", 1, 'U+5FFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF1\xAF\xBF\xBE", 1, 'U+6FFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF1\xAF\xBF\xBF", 1, 'U+6FFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF1\xBF\xBF\xBE", 1, 'U+7FFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF1\xBF\xBF\xBF", 1, 'U+7FFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF2\x8F\xBF\xBE", 1, 'U+8FFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF2\x8F\xBF\xBF", 1, 'U+8FFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF2\x9F\xBF\xBE", 1, 'U+9FFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF2\x9F\xBF\xBF", 1, 'U+9FFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF2\xAF\xBF\xBE", 1, 'U+AFFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF2\xAF\xBF\xBF", 1, 'U+AFFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF2\xBF\xBF\xBE", 1, 'U+BFFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF2\xBF\xBF\xBF", 1, 'U+BFFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF3\x8F\xBF\xBE", 1, 'U+CFFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF3\x8F\xBF\xBF", 1, 'U+CFFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF3\x9F\xBF\xBE", 1, 'U+DFFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF3\x9F\xBF\xBF", 1, 'U+DFFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF3\xAF\xBF\xBE", 1, 'U+EFFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF3\xAF\xBF\xBF", 1, 'U+EFFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF3\xBF\xBF\xBE", 1, 'U+FFFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF3\xBF\xBF\xBF", 1, 'U+FFFFF (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF4\x8F\xBF\xBE", 1, 'U+10FFFE (permanent noncharacter)'); - $this->invalidParseErrorTestHandler("\xF4\x8F\xBF\xBF", 1, 'U+10FFFF (permanent noncharacter)'); - - // MPB: These pass on some versions of iconv, and fail on others. Since we aren't in the - // business of writing tests against iconv, I've just commented these out. Should revisit - // at a later point. - /* - * $this->invalidParseErrorTestHandler("\xED\xA0\x80", 1, 'U+D800 (UTF-16 surrogate character)'); $this->invalidParseErrorTestHandler("\xED\xAD\xBF", 1, 'U+DB7F (UTF-16 surrogate character)'); $this->invalidParseErrorTestHandler("\xED\xAE\x80", 1, 'U+DB80 (UTF-16 surrogate character)'); $this->invalidParseErrorTestHandler("\xED\xAF\xBF", 1, 'U+DBFF (UTF-16 surrogate character)'); $this->invalidParseErrorTestHandler("\xED\xB0\x80", 1, 'U+DC00 (UTF-16 surrogate character)'); $this->invalidParseErrorTestHandler("\xED\xBE\x80", 1, 'U+DF80 (UTF-16 surrogate character)'); $this->invalidParseErrorTestHandler("\xED\xBF\xBF", 1, 'U+DFFF (UTF-16 surrogate character)'); // Paired UTF-16 surrogates $this->invalidParseErrorTestHandler("\xED\xA0\x80\xED\xB0\x80", 2, 'U+D800 U+DC00 (paired UTF-16 surrogates)'); $this->invalidParseErrorTestHandler("\xED\xA0\x80\xED\xBF\xBF", 2, 'U+D800 U+DFFF (paired UTF-16 surrogates)'); $this->invalidParseErrorTestHandler("\xED\xAD\xBF\xED\xB0\x80", 2, 'U+DB7F U+DC00 (paired UTF-16 surrogates)'); $this->invalidParseErrorTestHandler("\xED\xAD\xBF\xED\xBF\xBF", 2, 'U+DB7F U+DFFF (paired UTF-16 surrogates)'); $this->invalidParseErrorTestHandler("\xED\xAE\x80\xED\xB0\x80", 2, 'U+DB80 U+DC00 (paired UTF-16 surrogates)'); $this->invalidParseErrorTestHandler("\xED\xAE\x80\xED\xBF\xBF", 2, 'U+DB80 U+DFFF (paired UTF-16 surrogates)'); $this->invalidParseErrorTestHandler("\xED\xAF\xBF\xED\xB0\x80", 2, 'U+DBFF U+DC00 (paired UTF-16 surrogates)'); $this->invalidParseErrorTestHandler("\xED\xAF\xBF\xED\xBF\xBF", 2, 'U+DBFF U+DFFF (paired UTF-16 surrogates)'); - */ - } -} diff --git a/vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php b/vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php index 5e527227e54889d9b56271b2ec4e6cad7c1b9d64..153dd23083fca05bcbce859bb07aa0ab8ad9806c 100644 --- a/vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php +++ b/vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php @@ -1,8 +1,8 @@ <?php + namespace Masterminds\HTML5\Tests\Parser; use Masterminds\HTML5\Parser\UTF8Utils; -use Masterminds\HTML5\Parser\StringInputStream; use Masterminds\HTML5\Parser\Scanner; use Masterminds\HTML5\Parser\Tokenizer; @@ -11,19 +11,20 @@ class TokenizerTest extends \Masterminds\HTML5\Tests\TestCase // ================================================================ // Additional assertions. // ================================================================ + /** * Tests that an event matches both the event type and the expected value. * * @param string $type - * Expected event type. + * Expected event type * @param string $expects - * The value expected in $event['data'][0]. + * The value expected in $event['data'][0] */ public function assertEventEquals($type, $expects, $event) { $this->assertEquals($type, $event['name'], "Event $type for " . print_r($event, true)); if (is_array($expects)) { - $this->assertEquals($expects, $event['data'], "Event $type should equal " . print_r($expects, true) . ": " . print_r($event, true)); + $this->assertEquals($expects, $event['data'], "Event $type should equal " . print_r($expects, true) . ': ' . print_r($event, true)); } else { $this->assertEquals($expects, $event['data'][0], "Event $type should equal $expects: " . print_r($event, true)); } @@ -34,7 +35,7 @@ public function assertEventEquals($type, $expects, $event) */ public function assertEventError($event) { - $this->assertEquals('error', $event['name'], "Expected error for event: " . print_r($event, true)); + $this->assertEquals('error', $event['name'], 'Expected error for event: ' . print_r($event, true)); } /** @@ -66,7 +67,7 @@ protected function isAllGood($name, $depth, $tests, $debug = false) // ================================================================ public function testParse() { - list ($tok, $events) = $this->createTokenizer(''); + list($tok, $events) = $this->createTokenizer(''); $tok->parse(); $e1 = $events->get(0); @@ -78,7 +79,7 @@ public function testParse() public function testWhitespace() { $spaces = ' '; - list ($tok, $events) = $this->createTokenizer($spaces); + list($tok, $events) = $this->createTokenizer($spaces); $tok->parse(); @@ -96,7 +97,7 @@ public function testCharacterReference() '&' => '&', '<' => '<', '&' => '&', - '&' => '&' + '&' => '&', ); $this->isAllGood('text', 2, $good); @@ -134,7 +135,7 @@ public function testBogusComment() '<![CDATA[', '<![CDATA[hellooooo hello', '<? Hello World ?>', - '<? Hello World' + '<? Hello World', ); foreach ($bogus as $str) { $events = $this->parse($str); @@ -152,7 +153,7 @@ public function testEndTag() >' => 'test', '</thisIsTheTagThatDoesntEndItJustGoesOnAndOnMyFriend>' => 'thisisthetagthatdoesntenditjustgoesonandonmyfriend', // See 8.2.4.10, which requires this and does not say error. - '</a<b>' => 'a<b' + '</a<b>' => 'a<b', ); $this->isAllGood('endTag', 2, $succeed); @@ -162,7 +163,7 @@ public function testEndTag() '</a <b>' => 'a', '</a <b <c>' => 'a', '</a is the loneliest letter>' => 'a', - '</a' => 'a' + '</a' => 'a', ); foreach ($fail as $test => $result) { $events = $this->parse($test); @@ -177,7 +178,7 @@ public function testEndTag() $comments = array( '</>' => '</>', '</ >' => '</ >', - '</ a>' => '</ a>' + '</ a>' => '</ a>', ); foreach ($comments as $test => $result) { $events = $this->parse($test); @@ -199,7 +200,7 @@ public function testComment() '<!-- --$i -->' => ' --$i ', '<!----$i-->' => '--$i', "<!--\nHello World.\na-->" => "\nHello World.\na", - '<!-- <!-- -->' => ' <!-- ' + '<!-- <!-- -->' => ' <!-- ', ); foreach ($good as $test => $expected) { $events = $this->parse($test); @@ -210,7 +211,7 @@ public function testComment() '<!-->' => '', '<!--Hello' => 'Hello', "<!--\0Hello" => UTF8Utils::FFFD . 'Hello', - '<!--' => '' + '<!--' => '', ); foreach ($fail as $test => $expected) { $events = $this->parse($test); @@ -226,7 +227,7 @@ public function testCDATASection() '<![CDATA[ This is a test. ]]>' => ' This is a test. ', '<![CDATA[CDATA]]>' => 'CDATA', '<![CDATA[ ]] > ]]>' => ' ]] > ', - '<![CDATA[ ]]>' => ' ' + '<![CDATA[ ]]>' => ' ', ); $this->isAllGood('cdata', 2, $good); } @@ -238,80 +239,80 @@ public function testDoctype() 'html', 0, null, - false + false, ), '<!doctype html>' => array( 'html', 0, null, - false + false, ), '<!DocType html>' => array( 'html', 0, null, - false + false, ), "<!DOCTYPE\nhtml>" => array( 'html', 0, null, - false + false, ), "<!DOCTYPE\fhtml>" => array( 'html', 0, null, - false + false, ), '<!DOCTYPE html PUBLIC "foo bar">' => array( 'html', EventStack::DOCTYPE_PUBLIC, 'foo bar', - false + false, ), "<!DOCTYPE html PUBLIC 'foo bar'>" => array( 'html', EventStack::DOCTYPE_PUBLIC, 'foo bar', - false + false, ), '<!DOCTYPE html PUBLIC "foo bar" >' => array( 'html', EventStack::DOCTYPE_PUBLIC, 'foo bar', - false + false, ), "<!DOCTYPE html \nPUBLIC\n'foo bar'>" => array( 'html', EventStack::DOCTYPE_PUBLIC, 'foo bar', - false + false, ), '<!DOCTYPE html SYSTEM "foo bar">' => array( 'html', EventStack::DOCTYPE_SYSTEM, 'foo bar', - false + false, ), "<!DOCTYPE html SYSTEM 'foo bar'>" => array( 'html', EventStack::DOCTYPE_SYSTEM, 'foo bar', - false + false, ), '<!DOCTYPE html SYSTEM "foo/bar" >' => array( 'html', EventStack::DOCTYPE_SYSTEM, 'foo/bar', - false + false, ), "<!DOCTYPE html \nSYSTEM\n'foo bar'>" => array( 'html', EventStack::DOCTYPE_SYSTEM, 'foo bar', - false - ) + false, + ), ); $this->isAllGood('doctype', 2, $good); @@ -320,43 +321,43 @@ public function testDoctype() null, EventStack::DOCTYPE_NONE, null, - true + true, ), '<!DOCTYPE >' => array( null, EventStack::DOCTYPE_NONE, null, - true + true, ), '<!DOCTYPE foo' => array( 'foo', EventStack::DOCTYPE_NONE, null, - true + true, ), '<!DOCTYPE foo PUB' => array( 'foo', EventStack::DOCTYPE_NONE, null, - true + true, ), '<!DOCTYPE foo PUB>' => array( 'foo', EventStack::DOCTYPE_NONE, null, - true + true, ), '<!DOCTYPE foo PUB "Looks good">' => array( 'foo', EventStack::DOCTYPE_NONE, null, - true + true, ), '<!DOCTYPE foo SYSTME "Looks good"' => array( 'foo', EventStack::DOCTYPE_NONE, null, - true + true, ), // Can't tell whether these are ids or ID types, since the context is chopped. @@ -364,39 +365,39 @@ public function testDoctype() 'foo', EventStack::DOCTYPE_NONE, null, - true + true, ), '<!DOCTYPE foo PUBLIC>' => array( 'foo', EventStack::DOCTYPE_NONE, null, - true + true, ), '<!DOCTYPE foo SYSTEM' => array( 'foo', EventStack::DOCTYPE_NONE, null, - true + true, ), '<!DOCTYPE foo SYSTEM>' => array( 'foo', EventStack::DOCTYPE_NONE, null, - true + true, ), '<!DOCTYPE html SYSTEM "foo bar"' => array( 'html', EventStack::DOCTYPE_SYSTEM, 'foo bar', - true + true, ), '<!DOCTYPE html SYSTEM "foo bar" more stuff>' => array( 'html', EventStack::DOCTYPE_SYSTEM, 'foo bar', - true - ) + true, + ), ); foreach ($bad as $test => $expects) { $events = $this->parse($test); @@ -413,12 +414,12 @@ public function testProcessorInstruction() '<?hph ?>' => 'hph', '<?hph echo "Hello World"; ?>' => array( 'hph', - 'echo "Hello World"; ' + 'echo "Hello World"; ', ), "<?hph \necho 'Hello World';\n?>" => array( 'hph', - "echo 'Hello World';\n" - ) + "echo 'Hello World';\n", + ), ); $this->isAllGood('pi', 2, $good); } @@ -434,7 +435,7 @@ public function testSimpleTags() '<fOO>' => 'foo', '<foo >' => 'foo', "<foo\n\n\n\n>" => 'foo', - '<foo:bar>' => 'foo:bar' + '<foo:bar>' => 'foo:bar', ); $this->isAllGood('startTag', 2, $open); @@ -443,20 +444,21 @@ public function testSimpleTags() '<FOO/>' => 'foo', '<foo />' => 'foo', "<foo\n\n\n\n/>" => 'foo', - '<foo:bar/>' => 'foo:bar' + '<foo:bar/>' => 'foo:bar', ); foreach ($selfClose as $test => $expects) { $events = $this->parse($test); - $this->assertEquals(3, $events->depth(), "Counting events for '$test'" . print_r($events, true)); + $this->assertEquals(2, $events->depth(), "Counting events for '$test'" . print_r($events, true)); $this->assertEventEquals('startTag', $expects, $events->get(0)); - $this->assertEventEquals('endTag', $expects, $events->get(1)); + $event = $events->get(0); + $this->assertTrue($event['data'][2]); } $bad = array( '<foo' => 'foo', '<foo ' => 'foo', '<foo/' => 'foo', - '<foo /' => 'foo' + '<foo /' => 'foo', ); foreach ($bad as $test => $expects) { @@ -474,7 +476,7 @@ public function testTagsWithAttributeAndMissingName() '<color="white">' => 'color', "<class='neaktivni_stranka'>" => 'class', '<bgcolor="white">' => 'bgcolor', - '<class="nom">' => 'class' + '<class="nom">' => 'class', ); foreach ($cases as $html => $expected) { @@ -490,18 +492,18 @@ public function testTagsWithAttributeAndMissingName() public function testTagNotClosedAfterTagName() { $cases = array( - "<noscript<img>" => array( + '<noscript<img>' => array( 'noscript', - 'img' + 'img', ), '<center<a>' => array( 'center', - 'a' + 'a', ), '<br<br>' => array( 'br', - 'br' - ) + 'br', + ), ); foreach ($cases as $html => $expected) { @@ -575,111 +577,111 @@ public function testTagAttributes() '<foo bar="baz">' => array( 'foo', array( - 'bar' => 'baz' + 'bar' => 'baz', ), - false + false, ), '<foo bar=" baz ">' => array( 'foo', array( - 'bar' => ' baz ' + 'bar' => ' baz ', ), - false + false, ), "<foo bar=\"\nbaz\n\">" => array( 'foo', array( - 'bar' => "\nbaz\n" + 'bar' => "\nbaz\n", ), - false + false, ), "<foo bar='baz'>" => array( 'foo', array( - 'bar' => 'baz' + 'bar' => 'baz', ), - false + false, ), '<foo bar="A full sentence.">' => array( 'foo', array( - 'bar' => 'A full sentence.' + 'bar' => 'A full sentence.', ), - false + false, ), "<foo a='1' b=\"2\">" => array( 'foo', array( 'a' => '1', - 'b' => '2' + 'b' => '2', ), - false + false, ), "<foo ns:bar='baz'>" => array( 'foo', array( - 'ns:bar' => 'baz' + 'ns:bar' => 'baz', ), - false + false, ), "<foo a='blue&red'>" => array( 'foo', array( - 'a' => 'blue&red' + 'a' => 'blue&red', ), - false + false, ), "<foo a='blue&red'>" => array( 'foo', array( - 'a' => 'blue&red' + 'a' => 'blue&red', ), - false + false, ), "<foo a='blue&&&red'>" => array( 'foo', array( - 'a' => 'blue&&&red' + 'a' => 'blue&&&red', ), - false + false, ), "<foo a='blue&&red'>" => array( 'foo', array( - 'a' => 'blue&&red' + 'a' => 'blue&&red', ), - false + false, ), "<foo\nbar='baz'\n>" => array( 'foo', array( - 'bar' => 'baz' + 'bar' => 'baz', ), - false + false, ), '<doe a deer>' => array( 'doe', array( 'a' => null, - 'deer' => null + 'deer' => null, ), - false + false, ), '<foo bar=baz>' => array( 'foo', array( - 'bar' => 'baz' + 'bar' => 'baz', ), - false + false, ), // Updated for 8.1.2.3 '<foo bar = "baz" >' => array( 'foo', array( - 'bar' => 'baz' + 'bar' => 'baz', ), - false + false, ), // The spec allows an unquoted value '/'. This will not be a closing @@ -687,17 +689,17 @@ public function testTagAttributes() '<foo bar=/>' => array( 'foo', array( - 'bar' => '/' + 'bar' => '/', ), - false + false, ), '<foo bar=baz/>' => array( 'foo', array( - 'bar' => 'baz/' + 'bar' => 'baz/', ), - false - ) + false, + ), ); $this->isAllGood('startTag', 2, $good); @@ -706,23 +708,23 @@ public function testTagAttributes() '<foo bar="baz"/>' => array( 'foo', array( - 'bar' => 'baz' + 'bar' => 'baz', ), - true + true, ), '<foo BAR="baz"/>' => array( 'foo', array( - 'bar' => 'baz' + 'bar' => 'baz', ), - true + true, ), '<foo BAR="BAZ"/>' => array( 'foo', array( - 'bar' => 'BAZ' + 'bar' => 'BAZ', ), - true + true, ), "<foo a='1' b=\"2\" c=3 d/>" => array( 'foo', @@ -730,12 +732,12 @@ public function testTagAttributes() 'a' => '1', 'b' => '2', 'c' => '3', - 'd' => null + 'd' => null, ), - true - ) + true, + ), ); - $this->isAllGood('startTag', 3, $withEnd); + $this->isAllGood('startTag', 2, $withEnd); // Cause a parse error. $bad = array( @@ -743,30 +745,30 @@ public function testTagAttributes() "<foo a='blue&+dark'>" => array( 'foo', array( - 'a' => 'blue&+dark' + 'a' => 'blue&+dark', ), - false + false, ), '<foo bar=>' => array( 'foo', array( - 'bar' => null + 'bar' => null, ), - false + false, ), '<foo bar="oh' => array( 'foo', array( - 'bar' => 'oh' + 'bar' => 'oh', ), - false + false, ), '<foo bar=oh">' => array( 'foo', array( - 'bar' => 'oh"' + 'bar' => 'oh"', ), - false + false, ), // these attributes are ignored because of current implementation @@ -775,23 +777,23 @@ public function testTagAttributes() '<foo b"="baz">' => array( 'foo', array(), - false + false, ), '<foo 2abc="baz">' => array( 'foo', array(), - false + false, ), '<foo ?="baz">' => array( 'foo', array(), - false + false, ), '<foo foo?bar="baz">' => array( 'foo', array(), - false - ) + false, + ), ) ; foreach ($bad as $test => $expects) { @@ -807,23 +809,23 @@ public function testTagAttributes() 'foo', array( '=' => null, - '"bar"' => null + '"bar"' => null, ), - false + false, ), '<foo////>' => array( 'foo', array(), - true + true, ), // character "&" in unquoted attribute shouldn't cause an infinite loop '<foo bar=index.php?str=1&id=29>' => array( 'foo', array( - 'bar' => 'index.php?str=1&id=29' + 'bar' => 'index.php?str=1&id=29', ), - false - ) + false, + ), ); foreach ($reallyBad as $test => $expects) { $events = $this->parse($test); @@ -840,17 +842,17 @@ public function testTagAttributes() $this->assertEventEquals('startTag', array( 'foo', array( - 'baz' => '1' + 'baz' => '1', ), - false + false, ), $events->get(1)); $this->assertEventEquals('startTag', array( 'bar', array(), - false + false, ), $events->get(2)); $this->assertEventEquals('endTag', array( - 'foo' + 'foo', ), $events->get(3)); } @@ -864,7 +866,7 @@ public function testRawText() "<script>\nhello</script\n</script>" => "\nhello</script\n", '<script>&</script>' => '&', '<script><!--not a comment--></script>' => '<!--not a comment-->', - '<script><![CDATA[not a comment]]></script>' => '<![CDATA[not a comment]]>' + '<script><![CDATA[not a comment]]></script>' => '<![CDATA[not a comment]]>', ); foreach ($good as $test => $expects) { $events = $this->parse($test); @@ -875,7 +877,7 @@ public function testRawText() $bad = array( '<script>&</script' => '&</script', - '<script>Hello world' => 'Hello world' + '<script>Hello world' => 'Hello world', ); foreach ($bad as $test => $expects) { $events = $this->parse($test); @@ -900,7 +902,7 @@ public function testRawText() public function testRcdata() { - list ($tok, $events) = $this->createTokenizer('<title>'<!-- not a comment --></TITLE>'); + list($tok, $events) = $this->createTokenizer('<title>'<!-- not a comment --></TITLE>'); $tok->setTextMode(\Masterminds\HTML5\Elements::TEXT_RCDATA, 'title'); $tok->parse(); $this->assertEventEquals('text', "'<!-- not a comment -->", $events->get(1)); @@ -909,19 +911,19 @@ public function testRcdata() public function testText() { $events = $this->parse('a<br>b'); - $this->assertEquals(4, $events->depth(), "Events: " . print_r($events, true)); + $this->assertEquals(4, $events->depth(), 'Events: ' . print_r($events, true)); $this->assertEventEquals('text', 'a', $events->get(0)); $this->assertEventEquals('startTag', 'br', $events->get(1)); $this->assertEventEquals('text', 'b', $events->get(2)); $events = $this->parse('<a>Test</a>'); - $this->assertEquals(4, $events->depth(), "Events: " . print_r($events, true)); + $this->assertEquals(4, $events->depth(), 'Events: ' . print_r($events, true)); $this->assertEventEquals('startTag', 'a', $events->get(0)); $this->assertEventEquals('text', 'Test', $events->get(1)); $this->assertEventEquals('endTag', 'a', $events->get(2)); $events = $this->parse('<p>0</p><p>1</p>'); - $this->assertEquals(7, $events->depth(), "Events: " . print_r($events, true)); + $this->assertEquals(7, $events->depth(), 'Events: ' . print_r($events, true)); $this->assertEventEquals('startTag', 'p', $events->get(0)); $this->assertEventEquals('text', '0', $events->get(1)); @@ -931,25 +933,24 @@ public function testText() $this->assertEventEquals('text', '1', $events->get(4)); $this->assertEventEquals('endTag', 'p', $events->get(5)); - $events = $this->parse('a<![CDATA[test]]>b'); - $this->assertEquals(4, $events->depth(), "Events: " . print_r($events, true)); + $this->assertEquals(4, $events->depth(), 'Events: ' . print_r($events, true)); $this->assertEventEquals('text', 'a', $events->get(0)); $this->assertEventEquals('cdata', 'test', $events->get(1)); $this->assertEventEquals('text', 'b', $events->get(2)); $events = $this->parse('a<!--test-->b'); - $this->assertEquals(4, $events->depth(), "Events: " . print_r($events, true)); + $this->assertEquals(4, $events->depth(), 'Events: ' . print_r($events, true)); $this->assertEventEquals('text', 'a', $events->get(0)); $this->assertEventEquals('comment', 'test', $events->get(1)); $this->assertEventEquals('text', 'b', $events->get(2)); $events = $this->parse('a&b'); - $this->assertEquals(2, $events->depth(), "Events: " . print_r($events, true)); + $this->assertEquals(2, $events->depth(), 'Events: ' . print_r($events, true)); $this->assertEventEquals('text', 'a&b', $events->get(0)); $events = $this->parse('a²b'); - $this->assertEquals(2, $events->depth(), "Events: " . print_r($events, true)); + $this->assertEquals(2, $events->depth(), 'Events: ' . print_r($events, true)); $this->assertEventEquals('text', 'a²b', $events->get(0)); } @@ -959,20 +960,19 @@ public function testText() protected function createTokenizer($string, $debug = false) { $eventHandler = new EventStack(); - $stream = new StringInputStream($string); - $scanner = new Scanner($stream); + $scanner = new Scanner($string); $scanner->debug = $debug; return array( new Tokenizer($scanner, $eventHandler), - $eventHandler + $eventHandler, ); } public function parse($string, $debug = false) { - list ($tok, $events) = $this->createTokenizer($string, $debug); + list($tok, $events) = $this->createTokenizer($string, $debug); $tok->parse(); return $events; diff --git a/vendor/masterminds/html5/test/HTML5/Parser/TreeBuildingRulesTest.php b/vendor/masterminds/html5/test/HTML5/Parser/TreeBuildingRulesTest.php index de94d06201c1eb95963fd48c30f9409274ee5d2f..45c68bcfb2c22a112d22324a303a2f686a12b406 100644 --- a/vendor/masterminds/html5/test/HTML5/Parser/TreeBuildingRulesTest.php +++ b/vendor/masterminds/html5/test/HTML5/Parser/TreeBuildingRulesTest.php @@ -3,12 +3,12 @@ * @file * Test the Tree Builder's special-case rules. */ + namespace Masterminds\HTML5\Tests\Parser; use Masterminds\HTML5\Parser\TreeBuildingRules; use Masterminds\HTML5\Parser\Tokenizer; use Masterminds\HTML5\Parser\Scanner; -use Masterminds\HTML5\Parser\StringInputStream; use Masterminds\HTML5\Parser\DOMTreeBuilder; /** @@ -16,7 +16,6 @@ */ class TreeBuildingRulesTest extends \Masterminds\HTML5\Tests\TestCase { - const HTML_STUB = '<!DOCTYPE html><html><head><title>test</title></head><body>%s</body></html>'; /** @@ -25,29 +24,31 @@ class TreeBuildingRulesTest extends \Masterminds\HTML5\Tests\TestCase protected function parse($string) { $treeBuilder = new DOMTreeBuilder(); - $scanner = new Scanner(new StringInputStream($string)); + $scanner = new Scanner($string); $parser = new Tokenizer($scanner, $treeBuilder); $parser->parse(); + return $treeBuilder->document(); } + /** * Convenience function for parsing fragments. */ protected function parseFragment($string) { $events = new DOMTreeBuilder(true); - $scanner = new Scanner(new StringInputStream($string)); + $scanner = new Scanner($string); $parser = new Tokenizer($scanner, $events); $parser->parse(); + return $events->fragment(); } public function testTDFragment() { - - $frag = $this->parseFragment("<td>This is a test of the HTML5 parser</td>"); + $frag = $this->parseFragment('<td>This is a test of the HTML5 parser</td>'); $td = $frag->childNodes->item(0); diff --git a/vendor/masterminds/html5/test/HTML5/Parser/UTF8UtilsTest.php b/vendor/masterminds/html5/test/HTML5/Parser/UTF8UtilsTest.php index 0e8555a9cc6c65068f91da6939d28c965397d3d1..72c26a4b3ccdc3d18c8c97612fb3b5d270fbd38c 100644 --- a/vendor/masterminds/html5/test/HTML5/Parser/UTF8UtilsTest.php +++ b/vendor/masterminds/html5/test/HTML5/Parser/UTF8UtilsTest.php @@ -6,21 +6,23 @@ class UTF8UtilsTest extends \Masterminds\HTML5\Tests\TestCase { - public function testConvertToUTF8() { - $out = UTF8Utils::convertToUTF8('éàa', 'ISO-8859-1'); - $this->assertEquals('éà a', $out); - } + public function testConvertToUTF8() + { + $out = UTF8Utils::convertToUTF8('éàa', 'ISO-8859-1'); + $this->assertEquals('éà a', $out); + } - /** - * @todo add tests for invalid codepoints - */ - public function testCheckForIllegalCodepoints() { - $smoke = "Smoke test"; - $err = UTF8Utils::checkForIllegalCodepoints($smoke); - $this->assertEmpty($err); + /** + * @todo add tests for invalid codepoints + */ + public function testCheckForIllegalCodepoints() + { + $smoke = 'Smoke test'; + $err = UTF8Utils::checkForIllegalCodepoints($smoke); + $this->assertEmpty($err); - $data = "Foo Bar \0 Baz"; - $errors = UTF8Utils::checkForIllegalCodepoints($data); - $this->assertContains('null-character', $errors); - } -} \ No newline at end of file + $data = "Foo Bar \0 Baz"; + $errors = UTF8Utils::checkForIllegalCodepoints($data); + $this->assertContains('null-character', $errors); + } +} diff --git a/vendor/masterminds/html5/test/HTML5/Serializer/OutputRulesTest.php b/vendor/masterminds/html5/test/HTML5/Serializer/OutputRulesTest.php index 72253d3482969c0914489301880e09a5b518fff6..913051657831d60dc2c41bb0c5ae317f263ad96a 100644 --- a/vendor/masterminds/html5/test/HTML5/Serializer/OutputRulesTest.php +++ b/vendor/masterminds/html5/test/HTML5/Serializer/OutputRulesTest.php @@ -1,4 +1,5 @@ <?php + namespace Masterminds\HTML5\Tests\Serializer; use Masterminds\HTML5\Serializer\OutputRules; @@ -7,7 +8,6 @@ class OutputRulesTest extends \Masterminds\HTML5\Tests\TestCase { - protected $markup = '<!doctype html> <html lang="en"> <head> @@ -33,7 +33,7 @@ public function setUp() * Using reflection we make a protected method accessible for testing. * * @param string $name - * The name of the method on the Traverser class to test. + * The name of the method on the Traverser class to test * * @return \ReflectionMethod for the specified method */ @@ -65,7 +65,7 @@ public function getOutputRules($options = array()) return array( $r, - $stream + $stream, ); } @@ -79,20 +79,20 @@ public function testDocument() $r->document($dom); $expected = '<!DOCTYPE html>' . PHP_EOL . '<html lang="en"><body>foo</body></html>' . PHP_EOL; - $this->assertEquals($expected, stream_get_contents($stream, - 1, 0)); + $this->assertEquals($expected, stream_get_contents($stream, -1, 0)); } public function testEmptyDocument() { - $dom = $this->html5->loadHTML(''); + $dom = $this->html5->loadHTML(''); - $stream = fopen('php://temp', 'w'); - $r = new OutputRules($stream, $this->html5->getOptions()); - $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); - $r->document($dom); - $expected = '<!DOCTYPE html>' . PHP_EOL; - $this->assertEquals($expected, stream_get_contents($stream, - 1, 0)); + $r->document($dom); + $expected = '<!DOCTYPE html>' . PHP_EOL; + $this->assertEquals($expected, stream_get_contents($stream, -1, 0)); } public function testDoctype() @@ -105,7 +105,7 @@ public function testDoctype() $m = $this->getProtectedMethod('doctype'); $m->invoke($r, 'foo'); - $this->assertEquals("<!DOCTYPE html>" . PHP_EOL, stream_get_contents($stream, - 1, 0)); + $this->assertEquals('<!DOCTYPE html>' . PHP_EOL, stream_get_contents($stream, -1, 0)); } public function testElement() @@ -129,13 +129,13 @@ public function testElement() $list = $dom->getElementsByTagName('div'); $r->element($list->item(0)); - $this->assertEquals('<div id="foo" class="bar baz">foo bar baz</div>', stream_get_contents($stream, - 1, 0)); + $this->assertEquals('<div id="foo" class="bar baz">foo bar baz</div>', stream_get_contents($stream, -1, 0)); } - function testSerializeWithNamespaces() + public function testSerializeWithNamespaces() { $this->html5 = $this->getInstance(array( - 'xmlNamespaces' => true + 'xmlNamespaces' => true, )); $source = ' @@ -153,7 +153,7 @@ function testSerializeWithNamespaces() </html>'; $dom = $this->html5->loadHTML($source, array( - 'xmlNamespaces' => true + 'xmlNamespaces' => true, )); $this->assertFalse($this->html5->hasErrors(), print_r($this->html5->getErrors(), 1)); @@ -162,10 +162,10 @@ function testSerializeWithNamespaces() $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); $t->walk(); - $rendered = stream_get_contents($stream, - 1, 0); + $rendered = stream_get_contents($stream, -1, 0); - $clear = function($s){ - return trim(preg_replace('/[\s]+/', " ", $s)); + $clear = function ($s) { + return trim(preg_replace('/[\s]+/', ' ', $s)); }; $this->assertEquals($clear($source), $clear($rendered)); @@ -205,7 +205,7 @@ public function testElementWithScript() $jQ("#mktFrmSubmit").wrap("<div class=\'buttonSubmit\'></div>"); $jQ(".buttonSubmit").prepend("<span></span>"); }); - </script>', stream_get_contents($stream, - 1, 0)); + </script>', stream_get_contents($stream, -1, 0)); } public function testElementWithStyle() @@ -235,7 +235,7 @@ public function testElementWithStyle() body > .bar { display: none; } - </style>', stream_get_contents($stream, - 1, 0)); + </style>', stream_get_contents($stream, -1, 0)); } public function testOpenTag() @@ -254,7 +254,7 @@ public function testOpenTag() $list = $dom->getElementsByTagName('div'); $m = $this->getProtectedMethod('openTag'); $m->invoke($r, $list->item(0)); - $this->assertEquals('<div id="foo" class="bar baz">', stream_get_contents($stream, - 1, 0)); + $this->assertEquals('<div id="foo" class="bar baz">', stream_get_contents($stream, -1, 0)); } public function testCData() @@ -272,7 +272,7 @@ public function testCData() $list = $dom->getElementsByTagName('div'); $r->cdata($list->item(0)->childNodes->item(0)); - $this->assertEquals('<![CDATA[bar]]>', stream_get_contents($stream, - 1, 0)); + $this->assertEquals('<![CDATA[bar]]>', stream_get_contents($stream, -1, 0)); $dom = $this->html5->loadHTML('<!doctype html> <html lang="en"> @@ -281,7 +281,7 @@ public function testCData() </body> </html>'); - $dom->getElementById('foo')->appendChild(new \DOMCdataSection("]]>Foo<[![CDATA test ]]>")); + $dom->getElementById('foo')->appendChild(new \DOMCdataSection(']]>Foo<[![CDATA test ]]>')); $stream = fopen('php://temp', 'w'); $r = new OutputRules($stream, $this->html5->getOptions()); @@ -289,7 +289,7 @@ public function testCData() $list = $dom->getElementsByTagName('div'); $r->cdata($list->item(0)->childNodes->item(0)); - $this->assertEquals('<![CDATA[]]]]><![CDATA[>Foo<[![CDATA test ]]]]><![CDATA[>]]>', stream_get_contents($stream, - 1, 0)); + $this->assertEquals('<![CDATA[]]]]><![CDATA[>Foo<[![CDATA test ]]]]><![CDATA[>]]>', stream_get_contents($stream, -1, 0)); } public function testComment() @@ -307,7 +307,7 @@ public function testComment() $list = $dom->getElementsByTagName('div'); $r->comment($list->item(0)->childNodes->item(0)); - $this->assertEquals('<!-- foo -->', stream_get_contents($stream, - 1, 0)); + $this->assertEquals('<!-- foo -->', stream_get_contents($stream, -1, 0)); $dom = $this->html5->loadHTML('<!doctype html> <html lang="en"> @@ -326,7 +326,7 @@ public function testComment() // Could not find more definitive guidelines on what this should be. Went with // what the HTML5 spec says and what \DOMDocument::saveXML() produces. - $this->assertEquals('<!--<!-- --> --> Foo -->-->', stream_get_contents($stream, - 1, 0)); + $this->assertEquals('<!--<!-- --> --> Foo -->-->', stream_get_contents($stream, -1, 0)); } public function testText() @@ -344,7 +344,7 @@ public function testText() $list = $dom->getElementsByTagName('script'); $r->text($list->item(0)->childNodes->item(0)); - $this->assertEquals('baz();', stream_get_contents($stream, - 1, 0)); + $this->assertEquals('baz();', stream_get_contents($stream, -1, 0)); $dom = $this->html5->loadHTML('<!doctype html> <html lang="en"> @@ -358,25 +358,25 @@ public function testText() $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); $r->text($foo->firstChild); - $this->assertEquals('<script>alert("hi");</script>', stream_get_contents($stream, - 1, 0)); + $this->assertEquals('<script>alert("hi");</script>', stream_get_contents($stream, -1, 0)); } public function testNl() { - list ($o, $s) = $this->getOutputRules(); + list($o, $s) = $this->getOutputRules(); $m = $this->getProtectedMethod('nl'); $m->invoke($o); - $this->assertEquals(PHP_EOL, stream_get_contents($s, - 1, 0)); + $this->assertEquals(PHP_EOL, stream_get_contents($s, -1, 0)); } public function testWr() { - list ($o, $s) = $this->getOutputRules(); + list($o, $s) = $this->getOutputRules(); $m = $this->getProtectedMethod('wr'); $m->invoke($o, 'foo'); - $this->assertEquals('foo', stream_get_contents($s, - 1, 0)); + $this->assertEquals('foo', stream_get_contents($s, -1, 0)); } public function getEncData() @@ -386,61 +386,62 @@ public function getEncData() false, '&\'<>"', '&\'<>"', - '&'<>"' + '&'<>"', ), array( false, 'This + is. a < test', 'This + is. a < test', - 'This + is. a < test' + 'This + is. a < test', ), array( false, '.+#', '.+#', - '.+#' + '.+#', ), array( true, '.+#\'', '.+#\'', - '.+#'' + '.+#'', ), array( true, '&".<', '&".<', - '&".<' + '&".<', ), array( true, '&\'<>"', '&\'<>"', - '&'<>"' + '&'<>"', ), array( true, "\xc2\xa0\"'", ' "\'', - ' "'' - ) + ' "'', + ), ); } /** * Test basic encoding of text. + * * @dataProvider getEncData */ public function testEnc($isAttribute, $test, $expected, $expectedEncoded) { - list ($o, $s) = $this->getOutputRules(); + list($o, $s) = $this->getOutputRules(); $m = $this->getProtectedMethod('enc'); $this->assertEquals($expected, $m->invoke($o, $test, $isAttribute)); - list ($o, $s) = $this->getOutputRules(array( - 'encode_entities' => true + list($o, $s) = $this->getOutputRules(array( + 'encode_entities' => true, )); $m = $this->getProtectedMethod('enc'); $this->assertEquals($expectedEncoded, $m->invoke($o, $test, $isAttribute)); @@ -448,11 +449,12 @@ public function testEnc($isAttribute, $test, $expected, $expectedEncoded) /** * Test basic encoding of text. + * * @dataProvider getEncData */ public function testEscape($isAttribute, $test, $expected, $expectedEncoded) { - list ($o, $s) = $this->getOutputRules(); + list($o, $s) = $this->getOutputRules(); $m = $this->getProtectedMethod('escape'); $this->assertEquals($expected, $m->invoke($o, $test, $isAttribute)); @@ -473,12 +475,13 @@ public function booleanAttributes() array('<script defer></script>'), ); } + /** * @dataProvider booleanAttributes */ public function testBooleanAttrs($html) { - $dom = $this->html5->loadHTML('<!doctype html><html lang="en"><body>'.$html.'</body></html>'); + $dom = $this->html5->loadHTML('<!doctype html><html lang="en"><body>' . $html . '</body></html>'); $stream = fopen('php://temp', 'w'); $r = new OutputRules($stream, $this->html5->getOptions()); @@ -489,13 +492,12 @@ public function testBooleanAttrs($html) $m = $this->getProtectedMethod('attrs'); $m->invoke($r, $node); - $content = stream_get_contents($stream, - 1, 0); + $content = stream_get_contents($stream, -1, 0); $html = preg_replace('~<[a-z]+(.*)></[a-z]+>~', '\1', $html); $html = preg_replace('~<[a-z]+(.*)/?>~', '\1', $html); $this->assertEquals($content, $html); - } public function testAttrs() @@ -516,7 +518,7 @@ public function testAttrs() $m = $this->getProtectedMethod('attrs'); $m->invoke($r, $list->item(0)); - $content = stream_get_contents($stream, - 1, 0); + $content = stream_get_contents($stream, -1, 0); $this->assertEquals(' id="foo" class="bar baz"', $content); } @@ -544,7 +546,7 @@ public function testSvg() $list = $dom->getElementsByTagName('svg'); $r->element($list->item(0)); - $contents = stream_get_contents($stream, - 1, 0); + $contents = stream_get_contents($stream, -1, 0); $this->assertRegExp('|<svg width="150" height="100" viewBox="0 0 3 2">|', $contents); $this->assertRegExp('|<rect width="1" height="2" x="0" fill="#008d46" />|', $contents); $this->assertRegExp('|<rect id="Bar" x="300" y="100" width="300" height="100" fill="rgb\(255,255,0\)">|', $contents); @@ -573,7 +575,7 @@ public function testMath() $list = $dom->getElementsByTagName('math'); $r->element($list->item(0)); - $content = stream_get_contents($stream, - 1, 0); + $content = stream_get_contents($stream, -1, 0); $this->assertRegExp('|<math>|', $content); $this->assertRegExp('|<csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus">|', $content); } @@ -587,7 +589,7 @@ public function testProcessorInstruction() $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); $r->processorInstruction($dom->firstChild); - $content = stream_get_contents($stream, - 1, 0); + $content = stream_get_contents($stream, -1, 0); $this->assertRegExp('|<\?foo bar \?>|', $content); } @@ -611,7 +613,7 @@ public function testAddressTag() $list = $dom->getElementsByTagName('address'); $r->element($list->item(0)); - $contents = stream_get_contents($stream, - 1, 0); + $contents = stream_get_contents($stream, -1, 0); $this->assertRegExp('|<address>|', $contents); $this->assertRegExp('|<a href="../People/Raggett/">Dave Raggett</a>,|', $contents); @@ -621,7 +623,7 @@ public function testAddressTag() } /** - * Ensure direct DOM manipulation doesn't break TEXT_RAW elements (iframe, script, etc...) + * Ensure direct DOM manipulation doesn't break TEXT_RAW elements (iframe, script, etc...). */ public function testHandlingInvalidRawContent() { @@ -635,16 +637,16 @@ public function testHandlingInvalidRawContent() </body> </html>'); - $badNode = $dom->createElement("p", "Bar"); + $badNode = $dom->createElement('p', 'Bar'); // modify the content of the TEXT_RAW element: <script id="template"> appending dom nodes - $styleElement = $dom->getElementById("template"); + $styleElement = $dom->getElementById('template'); $styleElement->appendChild($badNode); $contents = $this->html5->saveHTML($dom); - $this->assertTrue(strpos($contents, '<script id="template" type="x-tmpl-mustache"> + $this->assertTrue(false !== strpos($contents, '<script id="template" type="x-tmpl-mustache"> <h1>Hello!</h1> - <p>Bar</p></script>')!==false); + <p>Bar</p></script>')); } } diff --git a/vendor/masterminds/html5/test/HTML5/Serializer/TraverserTest.php b/vendor/masterminds/html5/test/HTML5/Serializer/TraverserTest.php index c91463370683ab40ec94fb6bd949c73bde8df862..d4ae7b351702015b96c9c6f86db140c607796cbc 100644 --- a/vendor/masterminds/html5/test/HTML5/Serializer/TraverserTest.php +++ b/vendor/masterminds/html5/test/HTML5/Serializer/TraverserTest.php @@ -1,13 +1,12 @@ <?php + namespace Masterminds\HTML5\Tests\Serializer; use Masterminds\HTML5\Serializer\OutputRules; use Masterminds\HTML5\Serializer\Traverser; -use Masterminds\HTML5\Parser; class TraverserTest extends \Masterminds\HTML5\Tests\TestCase { - protected $markup = '<!doctype html> <html lang="en"> <head> @@ -28,7 +27,7 @@ public function setUp() * Using reflection we make a protected method accessible for testing. * * @param string $name - * The name of the method on the Traverser class to test. + * The name of the method on the Traverser class to test * * @return \ReflectionMethod \ReflectionMethod for the specified method */ @@ -51,7 +50,7 @@ public function getTraverser() // We return both the traverser and stream so we can pull from it. return array( $t, - $stream + $stream, ); } @@ -71,7 +70,7 @@ public function testConstruct() $this->assertInstanceOf('\Masterminds\HTML5\Serializer\Traverser', $t); } - public function testFragment() + public function testFragmentDeprecated() { $html = '<span class="bar">foo</span><span></span><div>bar</div>'; $input = new \Masterminds\HTML5\Parser\StringInputStream($html); @@ -82,12 +81,27 @@ public function testFragment() $stream = fopen('php://temp', 'w'); $r = new OutputRules($stream, $this->html5->getOptions()); $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + $t->walk(); - $out = $t->walk(); - $this->assertEquals($html, stream_get_contents($stream, - 1, 0)); + $this->assertEquals($html, stream_get_contents($stream, -1, 0)); } - public function testProcessorInstruction() + public function testFragment() + { + $html = '<span class="bar">foo</span><span></span><div>bar</div>'; + $dom = $this->html5->parseFragment($html); + + $this->assertInstanceOf('\DOMDocumentFragment', $dom); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + $t->walk(); + + $this->assertEquals($html, stream_get_contents($stream, -1, 0)); + } + + public function testProcessorInstructionDeprecated() { $html = '<?foo bar ?>'; $input = new \Masterminds\HTML5\Parser\StringInputStream($html); @@ -97,9 +111,26 @@ public function testProcessorInstruction() $stream = fopen('php://temp', 'w'); $r = new OutputRules($stream, $this->html5->getOptions()); + + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + $t->walk(); + + $this->assertEquals($html, stream_get_contents($stream, -1, 0)); + } + + public function testProcessorInstruction() + { + $html = '<?foo bar ?>'; + $dom = $this->html5->parseFragment($html); + + $this->assertInstanceOf('\DOMDocumentFragment', $dom); + + $stream = fopen('php://temp', 'w'); + $r = new OutputRules($stream, $this->html5->getOptions()); + $t = new Traverser($dom, $stream, $r, $this->html5->getOptions()); + $t->walk(); - $out = $t->walk(); - $this->assertEquals($html, stream_get_contents($stream, - 1, 0)); + $this->assertEquals($html, stream_get_contents($stream, -1, 0)); } } diff --git a/vendor/masterminds/html5/test/HTML5/TestCase.php b/vendor/masterminds/html5/test/HTML5/TestCase.php index 3cb86454750f235cef5a9704cf53004c93d1313f..990e8c15e25b52c01272f2788c97d6bf763f0f5c 100644 --- a/vendor/masterminds/html5/test/HTML5/TestCase.php +++ b/vendor/masterminds/html5/test/HTML5/TestCase.php @@ -1,11 +1,12 @@ <?php + namespace Masterminds\HTML5\Tests; use Masterminds\HTML5; +use PHPUnit\Framework\TestCase as BaseTestCase; -class TestCase extends \PHPUnit_Framework_TestCase +class TestCase extends BaseTestCase { - const DOC_OPEN = '<!DOCTYPE html><html><head><title>test</title></head><body>'; const DOC_CLOSE = '</body></html>'; diff --git a/vendor/masterminds/html5/test/benchmark/run.php b/vendor/masterminds/html5/test/benchmark/run.php index bee7c2dd6f92cd507a7219c021706e494a90c0be..2ca1907830aa8e85d3ab18eeca2d620a7b1fb11e 100644 --- a/vendor/masterminds/html5/test/benchmark/run.php +++ b/vendor/masterminds/html5/test/benchmark/run.php @@ -1,6 +1,6 @@ <?php -require __DIR__ . "/../../vendor/autoload.php"; +require __DIR__ . '/../../vendor/autoload.php'; $iterations = isset($argv[1]) ? $argv[1] : 100; @@ -9,21 +9,21 @@ $dom = $html5->loadHTML($content); $samples = array(); -for ($i = 0; $i < $iterations; $i++) { +for ($i = 0; $i < $iterations; ++$i) { $t = microtime(true); $dom = $html5->loadHTML($content); $samples[] = microtime(true) - $t; } $time = array_sum($samples) / count($samples); -echo "Loading: " . ($time * 1000) . "\n"; +echo 'Loading: ' . ($time * 1000) . "\n"; $samples = array(); -for ($i = 0; $i < $iterations; $i++) { +for ($i = 0; $i < $iterations; ++$i) { $t = microtime(true); $html5->saveHTML($dom); $samples[] = microtime(true) - $t; } $time = array_sum($samples) / count($samples); -echo "Writing: " . ($time * 1000) . "\n"; +echo 'Writing: ' . ($time * 1000) . "\n"; exit(0); diff --git a/vendor/paragonie/random_compat/build-phar.sh b/vendor/paragonie/random_compat/build-phar.sh deleted file mode 100755 index b4a5ba31cc7bbd042027b4c111e224c4c99f4fc5..0000000000000000000000000000000000000000 --- a/vendor/paragonie/random_compat/build-phar.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -basedir=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) ) - -php -dphar.readonly=0 "$basedir/other/build_phar.php" $* \ No newline at end of file diff --git a/vendor/paragonie/random_compat/composer.json b/vendor/paragonie/random_compat/composer.json index 1c5978c6fbce9c3466a223748b85bc05a9682221..34f1381d57369eb3fb06dc77e7c92541dafc200f 100644 --- a/vendor/paragonie/random_compat/composer.json +++ b/vendor/paragonie/random_compat/composer.json @@ -4,6 +4,7 @@ "keywords": [ "csprng", "random", + "polyfill", "pseudorandom" ], "license": "MIT", diff --git a/vendor/paragonie/random_compat/lib/byte_safe_strings.php b/vendor/paragonie/random_compat/lib/byte_safe_strings.php index 3de86b223c5b130016dee7b84055d8a0f890ca7a..ef24488f9e7bfb577456c1a010a46ecd4ecb2f6c 100644 --- a/vendor/paragonie/random_compat/lib/byte_safe_strings.php +++ b/vendor/paragonie/random_compat/lib/byte_safe_strings.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -28,8 +28,9 @@ if (!is_callable('RandomCompat_strlen')) { if ( - defined('MB_OVERLOAD_STRING') && - ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING + defined('MB_OVERLOAD_STRING') + && + ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING ) { /** * strlen() implementation that isn't brittle to mbstring.func_overload @@ -82,8 +83,8 @@ function RandomCompat_strlen($binary_string) if ( defined('MB_OVERLOAD_STRING') - && - ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING + && + ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING ) { /** * substr() implementation that isn't brittle to mbstring.func_overload @@ -93,7 +94,7 @@ function RandomCompat_strlen($binary_string) * * @param string $binary_string * @param int $start - * @param int $length (optional) + * @param int|null $length (optional) * * @throws TypeError * @@ -118,6 +119,7 @@ function RandomCompat_substr($binary_string, $start, $length = null) * mb_substr($str, 0, NULL, '8bit') returns an empty string on * PHP 5.3, so we have to find the length ourselves. */ + /** @var int $length */ $length = RandomCompat_strlen($binary_string) - $start; } elseif (!is_int($length)) { throw new TypeError( @@ -133,7 +135,12 @@ function RandomCompat_substr($binary_string, $start, $length = null) return ''; } - return (string) mb_substr($binary_string, $start, $length, '8bit'); + return (string) mb_substr( + (string) $binary_string, + (int) $start, + (int) $length, + '8bit' + ); } } else { @@ -145,7 +152,7 @@ function RandomCompat_substr($binary_string, $start, $length = null) * * @param string $binary_string * @param int $start - * @param int $length (optional) + * @param int|null $length (optional) * * @throws TypeError * @@ -172,10 +179,17 @@ function RandomCompat_substr($binary_string, $start, $length = null) ); } - return (string) substr($binary_string, $start, $length); + return (string) substr( + (string )$binary_string, + (int) $start, + (int) $length + ); } - return (string) substr($binary_string, $start); + return (string) substr( + (string) $binary_string, + (int) $start + ); } } } diff --git a/vendor/paragonie/random_compat/lib/cast_to_int.php b/vendor/paragonie/random_compat/lib/cast_to_int.php index 9a4fab99197125859b0c08484c1fe0abb284ad9d..1b1bbfe8dee1be33576a797c2a659444631c0a9a 100644 --- a/vendor/paragonie/random_compat/lib/cast_to_int.php +++ b/vendor/paragonie/random_compat/lib/cast_to_int.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -27,19 +27,19 @@ */ if (!is_callable('RandomCompat_intval')) { - + /** * Cast to an integer if we can, safely. - * + * * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX) * (non-inclusive), it will sanely cast it to an int. If you it's equal to * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats * lose precision, so the <= and => operators might accidentally let a float * through. - * + * * @param int|float $number The number we want to convert to an int * @param bool $fail_open Set to true to not throw an exception - * + * * @return float|int * @psalm-suppress InvalidReturnType * @@ -50,14 +50,16 @@ function RandomCompat_intval($number, $fail_open = false) if (is_int($number) || is_float($number)) { $number += 0; } elseif (is_numeric($number)) { + /** @psalm-suppress InvalidOperand */ $number += 0; } + /** @var int|float $number */ if ( is_float($number) - && + && $number > ~PHP_INT_MAX - && + && $number < PHP_INT_MAX ) { $number = (int) $number; diff --git a/vendor/paragonie/random_compat/lib/error_polyfill.php b/vendor/paragonie/random_compat/lib/error_polyfill.php index 6a91990ce6b7c13e98826257a31eb113ce7c5afc..c02c5c8b4cdbad555c3927c90ee10cb0a454bc9d 100644 --- a/vendor/paragonie/random_compat/lib/error_polyfill.php +++ b/vendor/paragonie/random_compat/lib/error_polyfill.php @@ -1,12 +1,12 @@ <?php /** - * Random_* Compatibility Library + * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects - * + * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises - * + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights @@ -30,7 +30,7 @@ // We can't really avoid making this extend Exception in PHP 5. class Error extends Exception { - + } } @@ -38,12 +38,12 @@ class Error extends Exception if (is_subclass_of('Error', 'Exception')) { class TypeError extends Error { - + } } else { class TypeError extends Exception { - + } } } diff --git a/vendor/paragonie/random_compat/lib/random.php b/vendor/paragonie/random_compat/lib/random.php index df74c8a4b624fa410ec45c5e8f1678cdc73f33a0..36245f5425cbe505fb41fc707f37e7dc740dde35 100644 --- a/vendor/paragonie/random_compat/lib/random.php +++ b/vendor/paragonie/random_compat/lib/random.php @@ -3,12 +3,12 @@ * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * - * @version 2.0.10 - * @released 2017-03-13 + * @version 2.0.17 + * @released 2018-07-04 * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -54,9 +54,9 @@ $RandomCompatDIR = dirname(__FILE__); -require_once $RandomCompatDIR . '/byte_safe_strings.php'; -require_once $RandomCompatDIR . '/cast_to_int.php'; -require_once $RandomCompatDIR . '/error_polyfill.php'; +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'byte_safe_strings.php'; +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'cast_to_int.php'; +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'error_polyfill.php'; if (!is_callable('random_bytes')) { /** @@ -76,9 +76,9 @@ if (extension_loaded('libsodium')) { // See random_bytes_libsodium.php if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { - require_once $RandomCompatDIR . '/random_bytes_libsodium.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium.php'; } elseif (method_exists('Sodium', 'randombytes_buf')) { - require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium_legacy.php'; } } @@ -117,7 +117,7 @@ // place, that is not helpful to us here. // See random_bytes_dev_urandom.php - require_once $RandomCompatDIR . '/random_bytes_dev_urandom.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_dev_urandom.php'; } // Unset variables after use $RandomCompat_basedir = null; @@ -159,7 +159,7 @@ extension_loaded('mcrypt') ) { // See random_bytes_mcrypt.php - require_once $RandomCompatDIR . '/random_bytes_mcrypt.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_mcrypt.php'; } $RandomCompatUrandom = null; @@ -184,7 +184,7 @@ class_exists('COM') $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); if (method_exists($RandomCompatCOMtest, 'GetRandom')) { // See random_bytes_com_dotnet.php - require_once $RandomCompatDIR . '/random_bytes_com_dotnet.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_com_dotnet.php'; } } catch (com_exception $e) { // Don't try to use it. @@ -203,8 +203,9 @@ class_exists('COM') * and hope the developer won't let it fail silently. * * @param mixed $length - * @return void + * @psalm-suppress InvalidReturnType * @throws Exception + * @return string */ function random_bytes($length) { @@ -212,12 +213,13 @@ function random_bytes($length) throw new Exception( 'There is no suitable CSPRNG installed on your system' ); + return ''; } } } if (!is_callable('random_int')) { - require_once $RandomCompatDIR . '/random_int.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_int.php'; } $RandomCompatDIR = null; diff --git a/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php index fc1926e5cac064e4f8d6190338ea3857cffa0cdf..537d02b27a3cdae1925d8ba7013f84334e765016 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php @@ -1,22 +1,22 @@ <?php /** - * Random_* Compatibility Library + * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects - * + * * The MIT License (MIT) - * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises - * + * + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -41,6 +41,7 @@ function random_bytes($bytes) { try { + /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( @@ -54,12 +55,14 @@ function random_bytes($bytes) ); } + /** @var string $buf */ $buf = ''; if (!class_exists('COM')) { throw new Error( 'COM does not exist' ); } + /** @var COM $util */ $util = new COM('CAPICOM.Utilities.1'); $execCount = 0; @@ -68,12 +71,12 @@ function random_bytes($bytes) * get N bytes of random data, then CAPICOM has failed us. */ do { - $buf .= base64_decode($util->GetRandom($bytes, 0)); + $buf .= base64_decode((string) $util->GetRandom($bytes, 0)); if (RandomCompat_strlen($buf) >= $bytes) { /** * Return our random entropy buffer here: */ - return RandomCompat_substr($buf, 0, $bytes); + return (string) RandomCompat_substr($buf, 0, $bytes); } ++$execCount; } while ($execCount < $bytes); @@ -85,4 +88,4 @@ function random_bytes($bytes) 'Could not gather sufficient random data' ); } -} \ No newline at end of file +} diff --git a/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php b/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php index df5b91524e893831af5598318e89cd8ee0c5876f..c4e31ccbbbe5e1cfa002b5af74a748c3df9ecd3d 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php @@ -1,22 +1,22 @@ <?php /** - * Random_* Compatibility Library + * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects - * + * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises - * + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -36,6 +36,7 @@ * random numbers in accordance with best practices * * Why we use /dev/urandom and not /dev/random + * @ref https://www.2uo.de/myths-about-urandom * @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers * * @param int $bytes @@ -46,25 +47,47 @@ */ function random_bytes($bytes) { + /** @var resource $fp */ static $fp = null; + /** * This block should only be run once */ if (empty($fp)) { /** - * We use /dev/urandom if it is a char device. - * We never fall back to /dev/random + * We don't want to ever read C:\dev\random, only /dev/urandom on + * Unix-like operating systems. While we guard against this + * condition in random.php, it doesn't hurt to be defensive in depth + * here. + * + * To that end, we only try to open /dev/urandom if we're on a Unix- + * like operating system (which means the directory separator is set + * to "/" not "\". */ - $fp = fopen('/dev/urandom', 'rb'); - if (!empty($fp)) { - $st = fstat($fp); - if (($st['mode'] & 0170000) !== 020000) { - fclose($fp); - $fp = false; + if (DIRECTORY_SEPARATOR === '/') { + if (!is_readable('/dev/urandom')) { + throw new Exception( + 'Environment misconfiguration: ' . + '/dev/urandom cannot be read.' + ); + } + /** + * We use /dev/urandom if it is a char device. + * We never fall back to /dev/random + */ + /** @var resource|bool $fp */ + $fp = fopen('/dev/urandom', 'rb'); + if (is_resource($fp)) { + /** @var array<string, int> $st */ + $st = fstat($fp); + if (($st['mode'] & 0170000) !== 020000) { + fclose($fp); + $fp = false; + } } } - if (!empty($fp)) { + if (is_resource($fp)) { /** * stream_set_read_buffer() does not exist in HHVM * @@ -83,6 +106,7 @@ function random_bytes($bytes) } try { + /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( @@ -103,7 +127,7 @@ function random_bytes($bytes) * if (empty($fp)) line is logic that should only be run once per * page load. */ - if (!empty($fp)) { + if (is_resource($fp)) { /** * @var int */ @@ -123,29 +147,28 @@ function random_bytes($bytes) */ $read = fread($fp, $remaining); if (!is_string($read)) { - if ($read === false) { - /** - * We cannot safely read from the file. Exit the - * do-while loop and trigger the exception condition - * - * @var string|bool - */ - $buf = false; - break; - } + /** + * We cannot safely read from the file. Exit the + * do-while loop and trigger the exception condition + * + * @var string|bool + */ + $buf = false; + break; } /** * Decrease the number of bytes returned from remaining */ $remaining -= RandomCompat_strlen($read); /** - * @var string|bool + * @var string $buf */ - $buf = $buf . $read; + $buf .= $read; } while ($remaining > 0); /** * Is our result valid? + * @var string|bool $buf */ if (is_string($buf)) { if (RandomCompat_strlen($buf) === $bytes) { diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php index 4af1a242279f7e2f759f13e4d45336d1e2889b9c..2e5629018293c50c939854aed12bb564f0f118a9 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php @@ -1,22 +1,22 @@ <?php /** - * Random_* Compatibility Library + * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects - * + * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises - * + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -43,6 +43,7 @@ function random_bytes($bytes) { try { + /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( @@ -60,6 +61,7 @@ function random_bytes($bytes) * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be * generated in one invocation. */ + /** @var string|bool $buf */ if ($bytes > 2147483647) { $buf = ''; for ($i = 0; $i < $bytes; $i += 1073741824) { @@ -69,10 +71,11 @@ function random_bytes($bytes) $buf .= \Sodium\randombytes_buf($n); } } else { + /** @var string|bool $buf */ $buf = \Sodium\randombytes_buf($bytes); } - if ($buf !== false) { + if (is_string($buf)) { if (RandomCompat_strlen($buf) === $bytes) { return $buf; } diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php index 705af5262bde0e092ca26aff660ae38b8a6e3e87..f78b2199a2b6a23a552d882b933f7639f4103cba 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php @@ -1,22 +1,22 @@ <?php /** - * Random_* Compatibility Library + * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects - * + * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises - * + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -43,6 +43,7 @@ function random_bytes($bytes) { try { + /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( diff --git a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php index aac9c013d4d71037eca77fce585efad4e14d84dc..0b13fa73c5da0e2721c9c37122891d5c1c92b36c 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php @@ -1,22 +1,22 @@ <?php /** - * Random_* Compatibility Library + * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects - * + * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises - * + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -42,6 +42,7 @@ function random_bytes($bytes) { try { + /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( @@ -55,10 +56,11 @@ function random_bytes($bytes) ); } - $buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM); + /** @var string|bool $buf */ + $buf = @mcrypt_create_iv((int) $bytes, (int) MCRYPT_DEV_URANDOM); if ( - $buf !== false - && + is_string($buf) + && RandomCompat_strlen($buf) === $bytes ) { /** diff --git a/vendor/paragonie/random_compat/lib/random_int.php b/vendor/paragonie/random_compat/lib/random_int.php index 5b2143a16297a5ee79ba48f997ef2f39e5d97696..ff80dfa438ac62bb6e3d4e1558221ffc19a4c089 100644 --- a/vendor/paragonie/random_compat/lib/random_int.php +++ b/vendor/paragonie/random_compat/lib/random_int.php @@ -7,7 +7,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -51,6 +51,7 @@ function random_int($min, $max) */ try { + /** @var int $min */ $min = RandomCompat_intval($min); } catch (TypeError $ex) { throw new TypeError( @@ -59,6 +60,7 @@ function random_int($min, $max) } try { + /** @var int $max */ $max = RandomCompat_intval($max); } catch (TypeError $ex) { throw new TypeError( @@ -90,11 +92,18 @@ function random_int($min, $max) * so we can minimize the number of discards */ $attempts = $bits = $bytes = $mask = $valueShift = 0; + /** @var int $attempts */ + /** @var int $bits */ + /** @var int $bytes */ + /** @var int $mask */ + /** @var int $valueShift */ /** * At this point, $range is a positive number greater than 0. It might * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to * a float and we will lose some precision. + * + * @var int|float $range */ $range = $max - $min; @@ -115,6 +124,7 @@ function random_int($min, $max) * @ref http://3v4l.org/XX9r5 (64-bit) */ $bytes = PHP_INT_SIZE; + /** @var int $mask */ $mask = ~0; } else { @@ -129,16 +139,19 @@ function random_int($min, $max) } ++$bits; $range >>= 1; + /** @var int $mask */ $mask = $mask << 1 | 1; } $valueShift = $min; } + /** @var int $val */ $val = 0; /** * Now that we have our parameters set up, let's begin generating * random integers until one falls between $min and $max */ + /** @psalm-suppress RedundantCondition */ do { /** * The rejection probability is at most 0.5, so this corresponds @@ -169,6 +182,7 @@ function random_int($min, $max) for ($i = 0; $i < $bytes; ++$i) { $val |= ord($randomByteString[$i]) << ($i * 8); } + /** @var int $val */ /** * Apply mask diff --git a/vendor/paragonie/random_compat/other/build_phar.php b/vendor/paragonie/random_compat/other/build_phar.php deleted file mode 100644 index 70ef4b2ed838a6bf32d64e3da4c26f9d367e6ab5..0000000000000000000000000000000000000000 --- a/vendor/paragonie/random_compat/other/build_phar.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -$dist = dirname(__DIR__).'/dist'; -if (!is_dir($dist)) { - mkdir($dist, 0755); -} -if (file_exists($dist.'/random_compat.phar')) { - unlink($dist.'/random_compat.phar'); -} -$phar = new Phar( - $dist.'/random_compat.phar', - FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::KEY_AS_FILENAME, - 'random_compat.phar' -); -rename( - dirname(__DIR__).'/lib/random.php', - dirname(__DIR__).'/lib/index.php' -); -$phar->buildFromDirectory(dirname(__DIR__).'/lib'); -rename( - dirname(__DIR__).'/lib/index.php', - dirname(__DIR__).'/lib/random.php' -); - -/** - * If we pass an (optional) path to a private key as a second argument, we will - * sign the Phar with OpenSSL. - * - * If you leave this out, it will produce an unsigned .phar! - */ -if ($argc > 1) { - if (!@is_readable($argv[1])) { - echo 'Could not read the private key file:', $argv[1], "\n"; - exit(255); - } - $pkeyFile = file_get_contents($argv[1]); - - $private = openssl_get_privatekey($pkeyFile); - if ($private !== false) { - $pkey = ''; - openssl_pkey_export($private, $pkey); - $phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey); - - /** - * Save the corresponding public key to the file - */ - if (!@is_readable($dist.'/random_compat.phar.pubkey')) { - $details = openssl_pkey_get_details($private); - file_put_contents( - $dist.'/random_compat.phar.pubkey', - $details['key'] - ); - } - } else { - echo 'An error occurred reading the private key from OpenSSL.', "\n"; - exit(255); - } -} diff --git a/vendor/paragonie/random_compat/psalm-autoload.php b/vendor/paragonie/random_compat/psalm-autoload.php deleted file mode 100644 index d71d1b818c311072207e3ee4abff9f82a10d2fa9..0000000000000000000000000000000000000000 --- a/vendor/paragonie/random_compat/psalm-autoload.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -require_once 'lib/byte_safe_strings.php'; -require_once 'lib/cast_to_int.php'; -require_once 'lib/error_polyfill.php'; -require_once 'other/ide_stubs/libsodium.php'; -require_once 'lib/random.php'; - -$int = random_int(0, 65536); diff --git a/vendor/paragonie/random_compat/psalm.xml b/vendor/paragonie/random_compat/psalm.xml deleted file mode 100644 index 1e91409894aee32a49ef399b0ce6bdd40a93682a..0000000000000000000000000000000000000000 --- a/vendor/paragonie/random_compat/psalm.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> -<psalm - autoloader="psalm-autoload.php" - stopOnFirstError="false" - useDocblockTypes="true" -> - <projectFiles> - <directory name="lib" /> - </projectFiles> - <issueHandlers> - <DuplicateClass errorLevel="info" /> - <InvalidOperand errorLevel="info" /> - <UndefinedConstant errorLevel="info" /> - <MissingReturnType errorLevel="info" /> - </issueHandlers> -</psalm> diff --git a/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php b/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php index a0391a52b8fc10b727c2258a19520c65791fc1ae..4b861c3ef6c31bf99c0fc78d0fc2fbc2711d88aa 100644 --- a/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php +++ b/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php @@ -101,6 +101,9 @@ public function testObjectCastToString() public function testContextCanContainAnything() { + $closed = fopen('php://memory', 'r'); + fclose($closed); + $context = array( 'bool' => true, 'null' => null, @@ -110,6 +113,7 @@ public function testContextCanContainAnything() 'nested' => array('with object' => new DummyTest), 'object' => new \DateTime, 'resource' => fopen('php://memory', 'r'), + 'closed' => $closed, ); $this->getLogger()->warning('Crazy context data', $context); diff --git a/vendor/psr/log/Psr/Log/Test/TestLogger.php b/vendor/psr/log/Psr/Log/Test/TestLogger.php new file mode 100644 index 0000000000000000000000000000000000000000..0cdffe4f9263b98f870b9615c07b005f54b14ca7 --- /dev/null +++ b/vendor/psr/log/Psr/Log/Test/TestLogger.php @@ -0,0 +1,146 @@ +<?php + +namespace Psr\Log\Test; + +use Psr\Log\AbstractLogger; + +/** + * Used for testing purposes. + * + * It records all records and gives you access to them for verification. + * + * @method bool hasEmergency($record) + * @method bool hasAlert($record) + * @method bool hasCritical($record) + * @method bool hasError($record) + * @method bool hasWarning($record) + * @method bool hasNotice($record) + * @method bool hasInfo($record) + * @method bool hasDebug($record) + * + * @method bool hasEmergencyRecords() + * @method bool hasAlertRecords() + * @method bool hasCriticalRecords() + * @method bool hasErrorRecords() + * @method bool hasWarningRecords() + * @method bool hasNoticeRecords() + * @method bool hasInfoRecords() + * @method bool hasDebugRecords() + * + * @method bool hasEmergencyThatContains($message) + * @method bool hasAlertThatContains($message) + * @method bool hasCriticalThatContains($message) + * @method bool hasErrorThatContains($message) + * @method bool hasWarningThatContains($message) + * @method bool hasNoticeThatContains($message) + * @method bool hasInfoThatContains($message) + * @method bool hasDebugThatContains($message) + * + * @method bool hasEmergencyThatMatches($message) + * @method bool hasAlertThatMatches($message) + * @method bool hasCriticalThatMatches($message) + * @method bool hasErrorThatMatches($message) + * @method bool hasWarningThatMatches($message) + * @method bool hasNoticeThatMatches($message) + * @method bool hasInfoThatMatches($message) + * @method bool hasDebugThatMatches($message) + * + * @method bool hasEmergencyThatPasses($message) + * @method bool hasAlertThatPasses($message) + * @method bool hasCriticalThatPasses($message) + * @method bool hasErrorThatPasses($message) + * @method bool hasWarningThatPasses($message) + * @method bool hasNoticeThatPasses($message) + * @method bool hasInfoThatPasses($message) + * @method bool hasDebugThatPasses($message) + */ +class TestLogger extends AbstractLogger +{ + /** + * @var array + */ + public $records = []; + + public $recordsByLevel = []; + + /** + * @inheritdoc + */ + public function log($level, $message, array $context = []) + { + $record = [ + 'level' => $level, + 'message' => $message, + 'context' => $context, + ]; + + $this->recordsByLevel[$record['level']][] = $record; + $this->records[] = $record; + } + + public function hasRecords($level) + { + return isset($this->recordsByLevel[$level]); + } + + public function hasRecord($record, $level) + { + if (is_string($record)) { + $record = ['message' => $record]; + } + return $this->hasRecordThatPasses(function ($rec) use ($record) { + if ($rec['message'] !== $record['message']) { + return false; + } + if (isset($record['context']) && $rec['context'] !== $record['context']) { + return false; + } + return true; + }, $level); + } + + public function hasRecordThatContains($message, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($message) { + return strpos($rec['message'], $message) !== false; + }, $level); + } + + public function hasRecordThatMatches($regex, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($regex) { + return preg_match($regex, $rec['message']) > 0; + }, $level); + } + + public function hasRecordThatPasses(callable $predicate, $level) + { + if (!isset($this->recordsByLevel[$level])) { + return false; + } + foreach ($this->recordsByLevel[$level] as $i => $rec) { + if (call_user_func($predicate, $rec, $i)) { + return true; + } + } + return false; + } + + public function __call($method, $args) + { + if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { + $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; + $level = strtolower($matches[2]); + if (method_exists($this, $genericMethod)) { + $args[] = $level; + return call_user_func_array([$this, $genericMethod], $args); + } + } + throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); + } + + public function reset() + { + $this->records = []; + } +} diff --git a/vendor/psr/log/README.md b/vendor/psr/log/README.md index 574bc1cb2a82ffa07bcc2f7ffee3656eb086ba29..5571a25e8df01732f1b7141b3ccc6835b3bb429c 100644 --- a/vendor/psr/log/README.md +++ b/vendor/psr/log/README.md @@ -7,6 +7,13 @@ This repository holds all interfaces/classes/traits related to Note that this is not a logger of its own. It is merely an interface that describes a logger. See the specification for more details. +Installation +------------ + +```bash +composer require psr/log +``` + Usage ----- diff --git a/vendor/doctrine/inflector/.gitignore b/vendor/ralouphie/getallheaders/.gitignore similarity index 52% rename from vendor/doctrine/inflector/.gitignore rename to vendor/ralouphie/getallheaders/.gitignore index f2cb7f83eee28a8c85a4fa0d5203516019c4aaa1..1324e7d3eb71ace87cf045029d7ed5d74c2f1690 100644 --- a/vendor/doctrine/inflector/.gitignore +++ b/vendor/ralouphie/getallheaders/.gitignore @@ -1,4 +1,5 @@ -vendor/ -composer.lock +.idea +.DS_store +/vendor/ composer.phar -phpunit.xml +composer.lock diff --git a/vendor/ralouphie/getallheaders/.travis.yml b/vendor/ralouphie/getallheaders/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..f45b55fa0c5bf9a9b8fdcdd7657352b17c7b6ce8 --- /dev/null +++ b/vendor/ralouphie/getallheaders/.travis.yml @@ -0,0 +1,18 @@ +language: php + +php: + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - 7.0 + +before_script: + - composer install + +script: + - mkdir -p build/logs + - php vendor/bin/phpunit -c phpunit.xml + +after_script: + - php vendor/bin/coveralls -v \ No newline at end of file diff --git a/vendor/wikimedia/composer-merge-plugin/LICENSE b/vendor/ralouphie/getallheaders/LICENSE similarity index 85% rename from vendor/wikimedia/composer-merge-plugin/LICENSE rename to vendor/ralouphie/getallheaders/LICENSE index 3c9804a6af2d6b844eeebfdda86761a17794b1fc..be5540c2af759b6e32172cbdcda5ccdf58816f2a 100644 --- a/vendor/wikimedia/composer-merge-plugin/LICENSE +++ b/vendor/ralouphie/getallheaders/LICENSE @@ -1,11 +1,13 @@ -Copyright (c) 2015 Bryan Davis, Wikimedia Foundation, and contributors +The MIT License (MIT) + +Copyright (c) 2014 Ralph Khattar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -15,5 +17,5 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/ralouphie/getallheaders/README.md b/vendor/ralouphie/getallheaders/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f3329d66389e452a263a54c9e5ef6e170bd9b6ce --- /dev/null +++ b/vendor/ralouphie/getallheaders/README.md @@ -0,0 +1,19 @@ +getallheaders +============= + +PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3. + +[](https://travis-ci.org/ralouphie/getallheaders) +[](https://coveralls.io/r/ralouphie/getallheaders?branch=master) +[](https://packagist.org/packages/ralouphie/getallheaders) +[](https://packagist.org/packages/ralouphie/getallheaders) +[](https://packagist.org/packages/ralouphie/getallheaders) + + +This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php). + +## Install + +``` +composer require ralouphie/getallheaders +``` diff --git a/vendor/ralouphie/getallheaders/composer.json b/vendor/ralouphie/getallheaders/composer.json new file mode 100644 index 0000000000000000000000000000000000000000..5a0d595c9951d30e63e7f39146d10b4b518bbabd --- /dev/null +++ b/vendor/ralouphie/getallheaders/composer.json @@ -0,0 +1,21 @@ +{ + "name": "ralouphie/getallheaders", + "description": "A polyfill for getallheaders.", + "license": "MIT", + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.0", + "satooshi/php-coveralls": ">=1.0" + }, + "autoload": { + "files": ["src/getallheaders.php"] + } +} \ No newline at end of file diff --git a/vendor/ralouphie/getallheaders/phpunit.xml b/vendor/ralouphie/getallheaders/phpunit.xml new file mode 100644 index 0000000000000000000000000000000000000000..7255b23d942c4cf4eb52c9e3c2091beaebc2f717 --- /dev/null +++ b/vendor/ralouphie/getallheaders/phpunit.xml @@ -0,0 +1,22 @@ +<phpunit + bootstrap="vendor/autoload.php" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + strict="true"> + + <testsuite> + <directory>./tests</directory> + </testsuite> + + <filter> + <whitelist> + <directory suffix=".php">src</directory> + </whitelist> + </filter> + + <logging> + <log type="coverage-clover" target="build/logs/clover.xml"/> + </logging> + +</phpunit> \ No newline at end of file diff --git a/vendor/ralouphie/getallheaders/src/getallheaders.php b/vendor/ralouphie/getallheaders/src/getallheaders.php new file mode 100644 index 0000000000000000000000000000000000000000..c7285a5ba166616c89ea98d7ac3ce5cb05b382aa --- /dev/null +++ b/vendor/ralouphie/getallheaders/src/getallheaders.php @@ -0,0 +1,46 @@ +<?php + +if (!function_exists('getallheaders')) { + + /** + * Get all HTTP header key/values as an associative array for the current request. + * + * @return string[string] The HTTP header key/value pairs. + */ + function getallheaders() + { + $headers = array(); + + $copy_server = array( + 'CONTENT_TYPE' => 'Content-Type', + 'CONTENT_LENGTH' => 'Content-Length', + 'CONTENT_MD5' => 'Content-Md5', + ); + + foreach ($_SERVER as $key => $value) { + if (substr($key, 0, 5) === 'HTTP_') { + $key = substr($key, 5); + if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) { + $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key)))); + $headers[$key] = $value; + } + } elseif (isset($copy_server[$key])) { + $headers[$copy_server[$key]] = $value; + } + } + + if (!isset($headers['Authorization'])) { + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { + $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; + } elseif (isset($_SERVER['PHP_AUTH_USER'])) { + $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''; + $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass); + } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { + $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; + } + } + + return $headers; + } + +} diff --git a/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php b/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php new file mode 100644 index 0000000000000000000000000000000000000000..8e3d1790afb77e2a2e549025082fb337fc838437 --- /dev/null +++ b/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php @@ -0,0 +1,121 @@ +<?php + +class GetAllHeadersTest extends \PHPUnit_Framework_TestCase +{ + + /** + * @dataProvider testWorksData + */ + public function testWorks($test_type, $expected, $server) + { + foreach ($server as $key => $val) { + $_SERVER[$key] = $val; + } + $result = getallheaders(); + $this->assertEquals($expected, $result, "Error testing $test_type works."); + } + + public function testWorksData() + { + return array( + array( + 'normal case', + array( + 'Key-One' => 'foo', + 'Key-Two' => 'bar', + 'Another-Key-For-Testing' => 'baz' + ), + array( + 'HTTP_KEY_ONE' => 'foo', + 'HTTP_KEY_TWO' => 'bar', + 'HTTP_ANOTHER_KEY_FOR_TESTING' => 'baz' + ) + ), + array( + 'Content-Type', + array( + 'Content-Type' => 'two' + ), + array( + 'HTTP_CONTENT_TYPE' => 'one', + 'CONTENT_TYPE' => 'two' + ) + ), + array( + 'Content-Length', + array( + 'Content-Length' => '222' + ), + array( + 'CONTENT_LENGTH' => '222', + 'HTTP_CONTENT_LENGTH' => '111' + ) + ), + array( + 'Content-Length (HTTP_CONTENT_LENGTH only)', + array( + 'Content-Length' => '111' + ), + array( + 'HTTP_CONTENT_LENGTH' => '111' + ) + ), + array( + 'Content-MD5', + array( + 'Content-Md5' => 'aef123' + ), + array( + 'CONTENT_MD5' => 'aef123', + 'HTTP_CONTENT_MD5' => 'fea321' + ) + ), + array( + 'Content-MD5 (HTTP_CONTENT_MD5 only)', + array( + 'Content-Md5' => 'f123' + ), + array( + 'HTTP_CONTENT_MD5' => 'f123' + ) + ), + array( + 'Authorization (normal)', + array( + 'Authorization' => 'testing' + ), + array( + 'HTTP_AUTHORIZATION' => 'testing', + ) + ), + array( + 'Authorization (redirect)', + array( + 'Authorization' => 'testing redirect' + ), + array( + 'REDIRECT_HTTP_AUTHORIZATION' => 'testing redirect', + ) + ), + array( + 'Authorization (PHP_AUTH_USER + PHP_AUTH_PW)', + array( + 'Authorization' => 'Basic ' . base64_encode('foo:bar') + ), + array( + 'PHP_AUTH_USER' => 'foo', + 'PHP_AUTH_PW' => 'bar' + ) + ), + array( + 'Authorization (PHP_AUTH_DIGEST)', + array( + 'Authorization' => 'example-digest' + ), + array( + 'PHP_AUTH_DIGEST' => 'example-digest' + ) + ) + ); + } +} diff --git a/vendor/symfony/class-loader/ApcClassLoader.php b/vendor/symfony/class-loader/ApcClassLoader.php index 0129c480f3948b6cc3826d4250a81cde35668f69..83038d749f78da7261f470da570af3749f77bc7d 100644 --- a/vendor/symfony/class-loader/ApcClassLoader.php +++ b/vendor/symfony/class-loader/ApcClassLoader.php @@ -88,7 +88,7 @@ public function __construct($prefix, $decorated) */ public function register($prepend = false) { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); + spl_autoload_register([$this, 'loadClass'], true, $prepend); } /** @@ -96,7 +96,7 @@ public function register($prepend = false) */ public function unregister() { - spl_autoload_unregister(array($this, 'loadClass')); + spl_autoload_unregister([$this, 'loadClass']); } /** @@ -138,6 +138,6 @@ public function findFile($class) */ public function __call($method, $args) { - return \call_user_func_array(array($this->decorated, $method), $args); + return \call_user_func_array([$this->decorated, $method], $args); } } diff --git a/vendor/symfony/class-loader/ClassCollectionLoader.php b/vendor/symfony/class-loader/ClassCollectionLoader.php index f71220cd62253eb471ad17f45e1b1faa31bd0f9e..5edab01cbd49173100cc1623c9aabd8941f75b56 100644 --- a/vendor/symfony/class-loader/ClassCollectionLoader.php +++ b/vendor/symfony/class-loader/ClassCollectionLoader.php @@ -56,7 +56,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = $classes = array_diff($classes, $declared); // the cache is different depending on which classes are already declared - $name = $name.'-'.substr(hash('sha256', implode('|', $classes)), 0, 5); + $name .= '-'.substr(hash('sha256', implode('|', $classes)), 0, 5); } $classes = array_unique($classes); @@ -108,7 +108,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = if ($autoReload) { // save the resources - self::writeCacheFile($metadata, serialize(array(array_values($files), $classes))); + self::writeCacheFile($metadata, serialize([array_values($files), $classes])); } } @@ -125,7 +125,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = */ public static function inline($classes, $cache, array $excluded) { - $declared = array(); + $declared = []; foreach (self::getOrderedClasses($excluded) as $class) { $declared[$class->getName()] = true; } @@ -147,7 +147,7 @@ public static function inline($classes, $cache, array $excluded) $dontInlineRegex = str_replace('.', $spacesRegex, $dontInlineRegex); $cacheDir = explode('/', str_replace(\DIRECTORY_SEPARATOR, '/', $cacheDir)); - $files = array(); + $files = []; $content = ''; foreach (self::getOrderedClasses($classes) as $class) { if (isset($declared[$class->getName()])) { @@ -176,7 +176,7 @@ public static function inline($classes, $cache, array $excluded) $c = "\nnamespace {require $file;}"; } else { - $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', $c); + $c = preg_replace(['/^\s*<\?php/', '/\?>\s*$/'], '', $c); // fakes namespace declaration for global code if (!$class->inNamespace()) { @@ -220,7 +220,7 @@ public static function fixNamespaceDeclarations($source) $token = $tokens[$i]; if (!isset($token[1]) || 'b"' === $token) { $rawChunk .= $token; - } elseif (\in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { + } elseif (\in_array($token[0], [T_COMMENT, T_DOC_COMMENT])) { // strip comments continue; } elseif (T_NAMESPACE === $token[0]) { @@ -230,7 +230,7 @@ public static function fixNamespaceDeclarations($source) $rawChunk .= $token[1]; // namespace name and whitespaces - while (isset($tokens[++$i][1]) && \in_array($tokens[$i][0], array(T_WHITESPACE, T_NS_SEPARATOR, T_STRING))) { + while (isset($tokens[++$i][1]) && \in_array($tokens[$i][0], [T_WHITESPACE, T_NS_SEPARATOR, T_STRING])) { $rawChunk .= $tokens[$i][1]; } if ('{' === $tokens[$i]) { @@ -289,8 +289,8 @@ public static function enableTokenizer($bool) private static function compressCode($code) { return preg_replace( - array('/^\s+/m', '/\s+$/m', '/([\n\r]+ *[\n\r]+)+/', '/[ \t]+/'), - array('', '', "\n", ' '), + ['/^\s+/m', '/\s+$/m', '/([\n\r]+ *[\n\r]+)+/', '/[ \t]+/'], + ['', '', "\n", ' '], $code ); } @@ -330,8 +330,8 @@ private static function writeCacheFile($file, $content) */ private static function getOrderedClasses(array $classes) { - $map = array(); - self::$seen = array(); + $map = []; + self::$seen = []; foreach ($classes as $class) { try { $reflectionClass = new \ReflectionClass($class); @@ -348,12 +348,12 @@ private static function getOrderedClasses(array $classes) private static function getClassHierarchy(\ReflectionClass $class) { if (isset(self::$seen[$class->getName()])) { - return array(); + return []; } self::$seen[$class->getName()] = true; - $classes = array($class); + $classes = [$class]; $parent = $class; while (($parent = $parent->getParentClass()) && $parent->isUserDefined() && !isset(self::$seen[$parent->getName()])) { self::$seen[$parent->getName()] = true; @@ -361,7 +361,7 @@ private static function getClassHierarchy(\ReflectionClass $class) array_unshift($classes, $parent); } - $traits = array(); + $traits = []; foreach ($classes as $c) { foreach (self::resolveDependencies(self::computeTraitDeps($c), $c) as $trait) { @@ -376,7 +376,7 @@ private static function getClassHierarchy(\ReflectionClass $class) private static function getInterfaces(\ReflectionClass $class) { - $classes = array(); + $classes = []; foreach ($class->getInterfaces() as $interface) { $classes = array_merge($classes, self::getInterfaces($interface)); @@ -394,7 +394,7 @@ private static function getInterfaces(\ReflectionClass $class) private static function computeTraitDeps(\ReflectionClass $class) { $traits = $class->getTraits(); - $deps = array($class->getName() => $traits); + $deps = [$class->getName() => $traits]; while ($trait = array_pop($traits)) { if ($trait->isUserDefined() && !isset(self::$seen[$trait->getName()])) { self::$seen[$trait->getName()] = true; diff --git a/vendor/symfony/class-loader/ClassLoader.php b/vendor/symfony/class-loader/ClassLoader.php index 52cff3bb4c5f456c7c4fb1f684ef8b8c980a8783..d727278ee81b68f24f2484b692650288b21dcb3f 100644 --- a/vendor/symfony/class-loader/ClassLoader.php +++ b/vendor/symfony/class-loader/ClassLoader.php @@ -43,8 +43,8 @@ */ class ClassLoader { - private $prefixes = array(); - private $fallbackDirs = array(); + private $prefixes = []; + private $fallbackDirs = []; private $useIncludePath = false; /** @@ -136,7 +136,7 @@ public function getUseIncludePath() */ public function register($prepend = false) { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); + spl_autoload_register([$this, 'loadClass'], true, $prepend); } /** @@ -144,7 +144,7 @@ public function register($prepend = false) */ public function unregister() { - spl_autoload_unregister(array($this, 'loadClass')); + spl_autoload_unregister([$this, 'loadClass']); } /** diff --git a/vendor/symfony/class-loader/ClassMapGenerator.php b/vendor/symfony/class-loader/ClassMapGenerator.php index 6a96886cf1835e202043540f39b561b2e5e645a6..f32ca3ca27377bdcbbf1fbaede9d9eeea299396b 100644 --- a/vendor/symfony/class-loader/ClassMapGenerator.php +++ b/vendor/symfony/class-loader/ClassMapGenerator.php @@ -31,7 +31,7 @@ class ClassMapGenerator public static function dump($dirs, $file) { $dirs = (array) $dirs; - $maps = array(); + $maps = []; foreach ($dirs as $dir) { $maps = array_merge($maps, static::createMap($dir)); @@ -53,7 +53,7 @@ public static function createMap($dir) $dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir)); } - $map = array(); + $map = []; foreach ($dir as $file) { if (!$file->isFile()) { @@ -93,7 +93,7 @@ private static function findClasses($path) $contents = file_get_contents($path); $tokens = token_get_all($contents); - $classes = array(); + $classes = []; $namespace = ''; for ($i = 0; isset($tokens[$i]); ++$i) { @@ -110,7 +110,7 @@ private static function findClasses($path) $namespace = ''; // If there is a namespace, extract it while (isset($tokens[++$i][1])) { - if (\in_array($tokens[$i][0], array(T_STRING, T_NS_SEPARATOR))) { + if (\in_array($tokens[$i][0], [T_STRING, T_NS_SEPARATOR])) { $namespace .= $tokens[$i][1]; } } @@ -129,7 +129,7 @@ private static function findClasses($path) if (T_DOUBLE_COLON === $tokens[$j][0]) { $isClassConstant = true; break; - } elseif (!\in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) { + } elseif (!\in_array($tokens[$j][0], [T_WHITESPACE, T_DOC_COMMENT, T_COMMENT])) { break; } } diff --git a/vendor/symfony/class-loader/LICENSE b/vendor/symfony/class-loader/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/class-loader/LICENSE +++ b/vendor/symfony/class-loader/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/class-loader/MapClassLoader.php b/vendor/symfony/class-loader/MapClassLoader.php index 7b0dbba43e213f0688a8ffdf8a1d8493b4246986..a9719d6bd2683005bb0b2bd2223b5b2a069f5f40 100644 --- a/vendor/symfony/class-loader/MapClassLoader.php +++ b/vendor/symfony/class-loader/MapClassLoader.php @@ -22,7 +22,7 @@ */ class MapClassLoader { - private $map = array(); + private $map = []; /** * @param array $map A map where keys are classes and values the absolute file path @@ -39,7 +39,7 @@ public function __construct(array $map) */ public function register($prepend = false) { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); + spl_autoload_register([$this, 'loadClass'], true, $prepend); } /** diff --git a/vendor/symfony/class-loader/Psr4ClassLoader.php b/vendor/symfony/class-loader/Psr4ClassLoader.php index d5b8d140a73104b45019526cfcc7818e7b5b33ad..7ea521d82e6e716506487f2a4e33a8a5d3e20e6b 100644 --- a/vendor/symfony/class-loader/Psr4ClassLoader.php +++ b/vendor/symfony/class-loader/Psr4ClassLoader.php @@ -24,7 +24,7 @@ */ class Psr4ClassLoader { - private $prefixes = array(); + private $prefixes = []; /** * @param string $prefix @@ -34,7 +34,7 @@ public function addPrefix($prefix, $baseDir) { $prefix = trim($prefix, '\\').'\\'; $baseDir = rtrim($baseDir, \DIRECTORY_SEPARATOR).\DIRECTORY_SEPARATOR; - $this->prefixes[] = array($prefix, $baseDir); + $this->prefixes[] = [$prefix, $baseDir]; } /** @@ -81,7 +81,7 @@ public function loadClass($class) */ public function register($prepend = false) { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); + spl_autoload_register([$this, 'loadClass'], true, $prepend); } /** @@ -89,6 +89,6 @@ public function register($prepend = false) */ public function unregister() { - spl_autoload_unregister(array($this, 'loadClass')); + spl_autoload_unregister([$this, 'loadClass']); } } diff --git a/vendor/symfony/class-loader/Tests/ApcClassLoaderTest.php b/vendor/symfony/class-loader/Tests/ApcClassLoaderTest.php index ec5066803dba1dd2de7ce0d2184b128383ed81f2..6706acbd362905f413f87c38a4c479af445fdd01 100644 --- a/vendor/symfony/class-loader/Tests/ApcClassLoaderTest.php +++ b/vendor/symfony/class-loader/Tests/ApcClassLoaderTest.php @@ -22,7 +22,7 @@ class ApcClassLoaderTest extends TestCase { protected function setUp() { - if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli'))) { + if (!(filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN))) { $this->markTestSkipped('The apc extension is not enabled.'); } else { apcu_clear_cache(); @@ -31,7 +31,7 @@ protected function setUp() protected function tearDown() { - if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) { + if (filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { apcu_clear_cache(); } } @@ -62,10 +62,10 @@ public function testLoadClass($className, $testClassName, $message) public function getLoadClassTests() { - return array( - array('\\Apc\\Namespaced\\Foo', 'Apc\\Namespaced\\Foo', '->loadClass() loads Apc\Namespaced\Foo class'), - array('Apc_Pearlike_Foo', 'Apc_Pearlike_Foo', '->loadClass() loads Apc_Pearlike_Foo class'), - ); + return [ + ['\\Apc\\Namespaced\\Foo', 'Apc\\Namespaced\\Foo', '->loadClass() loads Apc\Namespaced\Foo class'], + ['Apc_Pearlike_Foo', 'Apc_Pearlike_Foo', '->loadClass() loads Apc_Pearlike_Foo class'], + ]; } /** @@ -76,7 +76,7 @@ public function testLoadClassFromFallback($className, $testClassName, $message) $loader = new ClassLoader(); $loader->addPrefix('Apc\Namespaced', __DIR__.\DIRECTORY_SEPARATOR.'Fixtures'); $loader->addPrefix('Apc_Pearlike_', __DIR__.\DIRECTORY_SEPARATOR.'Fixtures'); - $loader->addPrefix('', array(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/fallback')); + $loader->addPrefix('', [__DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/fallback']); $loader = new ApcClassLoader('test.prefix.fallback', $loader); $loader->loadClass($testClassName); @@ -86,12 +86,12 @@ public function testLoadClassFromFallback($className, $testClassName, $message) public function getLoadClassFromFallbackTests() { - return array( - array('\\Apc\\Namespaced\\Baz', 'Apc\\Namespaced\\Baz', '->loadClass() loads Apc\Namespaced\Baz class'), - array('Apc_Pearlike_Baz', 'Apc_Pearlike_Baz', '->loadClass() loads Apc_Pearlike_Baz class'), - array('\\Apc\\Namespaced\\FooBar', 'Apc\\Namespaced\\FooBar', '->loadClass() loads Apc\Namespaced\Baz class from fallback dir'), - array('Apc_Pearlike_FooBar', 'Apc_Pearlike_FooBar', '->loadClass() loads Apc_Pearlike_Baz class from fallback dir'), - ); + return [ + ['\\Apc\\Namespaced\\Baz', 'Apc\\Namespaced\\Baz', '->loadClass() loads Apc\Namespaced\Baz class'], + ['Apc_Pearlike_Baz', 'Apc_Pearlike_Baz', '->loadClass() loads Apc_Pearlike_Baz class'], + ['\\Apc\\Namespaced\\FooBar', 'Apc\\Namespaced\\FooBar', '->loadClass() loads Apc\Namespaced\Baz class from fallback dir'], + ['Apc_Pearlike_FooBar', 'Apc_Pearlike_FooBar', '->loadClass() loads Apc_Pearlike_Baz class from fallback dir'], + ]; } /** @@ -110,40 +110,40 @@ public function testLoadClassNamespaceCollision($namespaces, $className, $messag public function getLoadClassNamespaceCollisionTests() { - return array( - array( - array( + return [ + [ + [ 'Apc\\NamespaceCollision\\A' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', 'Apc\\NamespaceCollision\\A\\B' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', - ), + ], 'Apc\NamespaceCollision\A\Foo', '->loadClass() loads NamespaceCollision\A\Foo from alpha.', - ), - array( - array( + ], + [ + [ 'Apc\\NamespaceCollision\\A\\B' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', 'Apc\\NamespaceCollision\\A' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', - ), + ], 'Apc\NamespaceCollision\A\Bar', '->loadClass() loads NamespaceCollision\A\Bar from alpha.', - ), - array( - array( + ], + [ + [ 'Apc\\NamespaceCollision\\A' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', 'Apc\\NamespaceCollision\\A\\B' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', - ), + ], 'Apc\NamespaceCollision\A\B\Foo', '->loadClass() loads NamespaceCollision\A\B\Foo from beta.', - ), - array( - array( + ], + [ + [ 'Apc\\NamespaceCollision\\A\\B' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', 'Apc\\NamespaceCollision\\A' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', - ), + ], 'Apc\NamespaceCollision\A\B\Bar', '->loadClass() loads NamespaceCollision\A\B\Bar from beta.', - ), - ); + ], + ]; } /** @@ -162,39 +162,39 @@ public function testLoadClassPrefixCollision($prefixes, $className, $message) public function getLoadClassPrefixCollisionTests() { - return array( - array( - array( + return [ + [ + [ 'ApcPrefixCollision_A_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', 'ApcPrefixCollision_A_B_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', - ), + ], 'ApcPrefixCollision_A_Foo', '->loadClass() loads ApcPrefixCollision_A_Foo from alpha.', - ), - array( - array( + ], + [ + [ 'ApcPrefixCollision_A_B_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', 'ApcPrefixCollision_A_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', - ), + ], 'ApcPrefixCollision_A_Bar', '->loadClass() loads ApcPrefixCollision_A_Bar from alpha.', - ), - array( - array( + ], + [ + [ 'ApcPrefixCollision_A_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', 'ApcPrefixCollision_A_B_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', - ), + ], 'ApcPrefixCollision_A_B_Foo', '->loadClass() loads ApcPrefixCollision_A_B_Foo from beta.', - ), - array( - array( + ], + [ + [ 'ApcPrefixCollision_A_B_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', 'ApcPrefixCollision_A_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', - ), + ], 'ApcPrefixCollision_A_B_Bar', '->loadClass() loads ApcPrefixCollision_A_B_Bar from beta.', - ), - ); + ], + ]; } } diff --git a/vendor/symfony/class-loader/Tests/ClassCollectionLoaderTest.php b/vendor/symfony/class-loader/Tests/ClassCollectionLoaderTest.php index 15a11053c6c0b22999127e8f99fa614cc0e7233a..816f3c39451fda54c6e008c6c8a28cba8fb647c2 100644 --- a/vendor/symfony/class-loader/Tests/ClassCollectionLoaderTest.php +++ b/vendor/symfony/class-loader/Tests/ClassCollectionLoaderTest.php @@ -34,17 +34,17 @@ public function testTraitDependencies() $m = $r->getMethod('getOrderedClasses'); $m->setAccessible(true); - $ordered = $m->invoke(null, array('CTFoo')); + $ordered = $m->invoke(null, ['CTFoo']); $this->assertEquals( - array('TD', 'TC', 'TB', 'TA', 'TZ', 'CTFoo'), + ['TD', 'TC', 'TB', 'TA', 'TZ', 'CTFoo'], array_map(function ($class) { return $class->getName(); }, $ordered) ); - $ordered = $m->invoke(null, array('CTBar')); + $ordered = $m->invoke(null, ['CTBar']); $this->assertEquals( - array('TD', 'TZ', 'TC', 'TB', 'TA', 'CTBar'), + ['TD', 'TZ', 'TC', 'TB', 'TA', 'CTBar'], array_map(function ($class) { return $class->getName(); }, $ordered) ); } @@ -54,12 +54,12 @@ public function testTraitDependencies() */ public function testClassReordering(array $classes) { - $expected = array( + $expected = [ 'ClassesWithParents\\GInterface', 'ClassesWithParents\\CInterface', 'ClassesWithParents\\B', 'ClassesWithParents\\A', - ); + ]; $r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader'); $m = $r->getMethod('getOrderedClasses'); @@ -72,27 +72,27 @@ public function testClassReordering(array $classes) public function getDifferentOrders() { - return array( - array(array( + return [ + [[ 'ClassesWithParents\\A', 'ClassesWithParents\\CInterface', 'ClassesWithParents\\GInterface', 'ClassesWithParents\\B', - )), - array(array( + ]], + [[ 'ClassesWithParents\\B', 'ClassesWithParents\\A', 'ClassesWithParents\\CInterface', - )), - array(array( + ]], + [[ 'ClassesWithParents\\CInterface', 'ClassesWithParents\\B', 'ClassesWithParents\\A', - )), - array(array( + ]], + [[ 'ClassesWithParents\\A', - )), - ); + ]], + ]; } /** @@ -106,7 +106,7 @@ public function testClassWithTraitsReordering(array $classes) require_once __DIR__.'/Fixtures/ClassesWithParents/D.php'; require_once __DIR__.'/Fixtures/ClassesWithParents/E.php'; - $expected = array( + $expected = [ 'ClassesWithParents\\GInterface', 'ClassesWithParents\\CInterface', 'ClassesWithParents\\ATrait', @@ -116,7 +116,7 @@ public function testClassWithTraitsReordering(array $classes) 'ClassesWithParents\\A', 'ClassesWithParents\\D', 'ClassesWithParents\\E', - ); + ]; $r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader'); $m = $r->getMethod('getOrderedClasses'); @@ -129,15 +129,15 @@ public function testClassWithTraitsReordering(array $classes) public function getDifferentOrdersForTraits() { - return array( - array(array( + return [ + [[ 'ClassesWithParents\\E', 'ClassesWithParents\\ATrait', - )), - array(array( + ]], + [[ 'ClassesWithParents\\E', - )), - ); + ]], + ]; } public function testFixClassWithTraitsOrdering() @@ -146,16 +146,16 @@ public function testFixClassWithTraitsOrdering() require_once __DIR__.'/Fixtures/ClassesWithParents/F.php'; require_once __DIR__.'/Fixtures/ClassesWithParents/G.php'; - $classes = array( + $classes = [ 'ClassesWithParents\\F', 'ClassesWithParents\\G', - ); + ]; - $expected = array( + $expected = [ 'ClassesWithParents\\CTrait', 'ClassesWithParents\\F', 'ClassesWithParents\\G', - ); + ]; $r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader'); $m = $r->getMethod('getOrderedClasses'); @@ -176,14 +176,14 @@ public function testFixNamespaceDeclarations($source, $expected) public function getFixNamespaceDeclarationsData() { - return array( - array("namespace;\nclass Foo {}\n", "namespace\n{\nclass Foo {}\n}"), - array("namespace Foo;\nclass Foo {}\n", "namespace Foo\n{\nclass Foo {}\n}"), - array("namespace Bar ;\nclass Foo {}\n", "namespace Bar\n{\nclass Foo {}\n}"), - array("namespace Foo\Bar;\nclass Foo {}\n", "namespace Foo\Bar\n{\nclass Foo {}\n}"), - array("namespace Foo\Bar\Bar\n{\nclass Foo {}\n}\n", "namespace Foo\Bar\Bar\n{\nclass Foo {}\n}"), - array("namespace\n{\nclass Foo {}\n}\n", "namespace\n{\nclass Foo {}\n}"), - ); + return [ + ["namespace;\nclass Foo {}\n", "namespace\n{\nclass Foo {}\n}"], + ["namespace Foo;\nclass Foo {}\n", "namespace Foo\n{\nclass Foo {}\n}"], + ["namespace Bar ;\nclass Foo {}\n", "namespace Bar\n{\nclass Foo {}\n}"], + ["namespace Foo\Bar;\nclass Foo {}\n", "namespace Foo\Bar\n{\nclass Foo {}\n}"], + ["namespace Foo\Bar\Bar\n{\nclass Foo {}\n}\n", "namespace Foo\Bar\Bar\n{\nclass Foo {}\n}"], + ["namespace\n{\nclass Foo {}\n}\n", "namespace\n{\nclass Foo {}\n}"], + ]; } /** @@ -198,14 +198,14 @@ public function testFixNamespaceDeclarationsWithoutTokenizer($source, $expected) public function getFixNamespaceDeclarationsDataWithoutTokenizer() { - return array( - array("namespace;\nclass Foo {}\n", "namespace\n{\nclass Foo {}\n}\n"), - array("namespace Foo;\nclass Foo {}\n", "namespace Foo\n{\nclass Foo {}\n}\n"), - array("namespace Bar ;\nclass Foo {}\n", "namespace Bar\n{\nclass Foo {}\n}\n"), - array("namespace Foo\Bar;\nclass Foo {}\n", "namespace Foo\Bar\n{\nclass Foo {}\n}\n"), - array("namespace Foo\Bar\Bar\n{\nclass Foo {}\n}\n", "namespace Foo\Bar\Bar\n{\nclass Foo {}\n}\n"), - array("\nnamespace\n{\nclass Foo {}\n\$namespace=123;}\n", "\nnamespace\n{\nclass Foo {}\n\$namespace=123;}\n"), - ); + return [ + ["namespace;\nclass Foo {}\n", "namespace\n{\nclass Foo {}\n}\n"], + ["namespace Foo;\nclass Foo {}\n", "namespace Foo\n{\nclass Foo {}\n}\n"], + ["namespace Bar ;\nclass Foo {}\n", "namespace Bar\n{\nclass Foo {}\n}\n"], + ["namespace Foo\Bar;\nclass Foo {}\n", "namespace Foo\Bar\n{\nclass Foo {}\n}\n"], + ["namespace Foo\Bar\Bar\n{\nclass Foo {}\n}\n", "namespace Foo\Bar\Bar\n{\nclass Foo {}\n}\n"], + ["\nnamespace\n{\nclass Foo {}\n\$namespace=123;}\n", "\nnamespace\n{\nclass Foo {}\n\$namespace=123;}\n"], + ]; } /** @@ -217,7 +217,7 @@ public function testUnableToLoadClassException() unlink($file); } - ClassCollectionLoader::load(array('SomeNotExistingClass'), sys_get_temp_dir(), 'foo', false); + ClassCollectionLoader::load(['SomeNotExistingClass'], sys_get_temp_dir(), 'foo', false); } public function testCommentStripping() @@ -227,14 +227,14 @@ public function testCommentStripping() } spl_autoload_register($r = function ($class) { if (0 === strpos($class, 'Namespaced') || 0 === strpos($class, 'Pearlike_')) { - @require_once __DIR__.'/Fixtures/'.str_replace(array('\\', '_'), '/', $class).'.php'; + @require_once __DIR__.'/Fixtures/'.str_replace(['\\', '_'], '/', $class).'.php'; } }); $strictTypes = \defined('HHVM_VERSION') ? '' : "\nnamespace {require __DIR__.'/Fixtures/Namespaced/WithStrictTypes.php';}"; ClassCollectionLoader::load( - array('Namespaced\\WithComments', 'Pearlike_WithComments', 'Namespaced\\WithDirMagic', 'Namespaced\\WithFileMagic', 'Namespaced\\WithHaltCompiler', $strictTypes ? 'Namespaced\\WithStrictTypes' : 'Namespaced\\WithComments'), + ['Namespaced\\WithComments', 'Pearlike_WithComments', 'Namespaced\\WithDirMagic', 'Namespaced\\WithFileMagic', 'Namespaced\\WithHaltCompiler', $strictTypes ? 'Namespaced\\WithStrictTypes' : 'Namespaced\\WithComments'], __DIR__, 'bar', false @@ -279,7 +279,7 @@ class Pearlike_WithComments namespace {require __DIR__.'/Fixtures/Namespaced/WithHaltCompiler.php';} EOF .$strictTypes, - str_replace(array("<?php \n", '\\\\'), array('', '/'), file_get_contents($file)) + str_replace(["<?php \n", '\\\\'], ['', '/'], file_get_contents($file)) ); unlink($file); @@ -291,8 +291,8 @@ public function testInline() @unlink($cache = sys_get_temp_dir().'/inline.php'); - $classes = array(WarmedClass::class); - $excluded = array(DeclaredClass::class); + $classes = [WarmedClass::class]; + $excluded = [DeclaredClass::class]; ClassCollectionLoader::inline($classes, $cache, $excluded); diff --git a/vendor/symfony/class-loader/Tests/ClassLoaderTest.php b/vendor/symfony/class-loader/Tests/ClassLoaderTest.php index 1cc7c4842e58e7e9016c448f6a386d4a77dd1cf7..af8a94bdbd1a70120e823568d2cef32b67c98d74 100644 --- a/vendor/symfony/class-loader/Tests/ClassLoaderTest.php +++ b/vendor/symfony/class-loader/Tests/ClassLoaderTest.php @@ -55,10 +55,10 @@ public function testLoadClass($className, $testClassName, $message) public function getLoadClassTests() { - return array( - array('\\Namespaced2\\Foo', 'Namespaced2\\Foo', '->loadClass() loads Namespaced2\Foo class'), - array('\\Pearlike2_Foo', 'Pearlike2_Foo', '->loadClass() loads Pearlike2_Foo class'), - ); + return [ + ['\\Namespaced2\\Foo', 'Namespaced2\\Foo', '->loadClass() loads Namespaced2\Foo class'], + ['\\Pearlike2_Foo', 'Pearlike2_Foo', '->loadClass() loads Pearlike2_Foo class'], + ]; } /** @@ -75,9 +75,9 @@ public function testLoadNonexistentClass($className, $testClassName, $message) public function getLoadNonexistentClassTests() { - return array( - array('\\Pearlike3_Bar', '\\Pearlike3_Bar', '->loadClass() loads non existing Pearlike3_Bar class with a leading slash'), - ); + return [ + ['\\Pearlike3_Bar', '\\Pearlike3_Bar', '->loadClass() loads non existing Pearlike3_Bar class with a leading slash'], + ]; } public function testAddPrefixSingle() @@ -93,8 +93,8 @@ public function testAddPrefixSingle() public function testAddPrefixesSingle() { $loader = new ClassLoader(); - $loader->addPrefixes(array('Foo' => array('foo', 'foo'))); - $loader->addPrefixes(array('Foo' => array('foo'))); + $loader->addPrefixes(['Foo' => ['foo', 'foo']]); + $loader->addPrefixes(['Foo' => ['foo']]); $prefixes = $loader->getPrefixes(); $this->assertArrayHasKey('Foo', $prefixes); $this->assertCount(1, $prefixes['Foo'], print_r($prefixes, true)); @@ -139,19 +139,19 @@ public function testLoadClassFromFallback($className, $testClassName, $message) $loader = new ClassLoader(); $loader->addPrefix('Namespaced2\\', __DIR__.\DIRECTORY_SEPARATOR.'Fixtures'); $loader->addPrefix('Pearlike2_', __DIR__.\DIRECTORY_SEPARATOR.'Fixtures'); - $loader->addPrefix('', array(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures/fallback')); + $loader->addPrefix('', [__DIR__.\DIRECTORY_SEPARATOR.'Fixtures/fallback']); $loader->loadClass($testClassName); $this->assertTrue(class_exists($className), $message); } public function getLoadClassFromFallbackTests() { - return array( - array('\\Namespaced2\\Baz', 'Namespaced2\\Baz', '->loadClass() loads Namespaced2\Baz class'), - array('\\Pearlike2_Baz', 'Pearlike2_Baz', '->loadClass() loads Pearlike2_Baz class'), - array('\\Namespaced2\\FooBar', 'Namespaced2\\FooBar', '->loadClass() loads Namespaced2\Baz class from fallback dir'), - array('\\Pearlike2_FooBar', 'Pearlike2_FooBar', '->loadClass() loads Pearlike2_Baz class from fallback dir'), - ); + return [ + ['\\Namespaced2\\Baz', 'Namespaced2\\Baz', '->loadClass() loads Namespaced2\Baz class'], + ['\\Pearlike2_Baz', 'Pearlike2_Baz', '->loadClass() loads Pearlike2_Baz class'], + ['\\Namespaced2\\FooBar', 'Namespaced2\\FooBar', '->loadClass() loads Namespaced2\Baz class from fallback dir'], + ['\\Pearlike2_FooBar', 'Pearlike2_FooBar', '->loadClass() loads Pearlike2_Baz class from fallback dir'], + ]; } /** @@ -168,71 +168,71 @@ public function testLoadClassNamespaceCollision($namespaces, $className, $messag public function getLoadClassNamespaceCollisionTests() { - return array( - array( - array( + return [ + [ + [ 'NamespaceCollision\\C' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/alpha', 'NamespaceCollision\\C\\B' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/beta', - ), + ], 'NamespaceCollision\C\Foo', '->loadClass() loads NamespaceCollision\C\Foo from alpha.', - ), - array( - array( + ], + [ + [ 'NamespaceCollision\\C\\B' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/beta', 'NamespaceCollision\\C' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/alpha', - ), + ], 'NamespaceCollision\C\Bar', '->loadClass() loads NamespaceCollision\C\Bar from alpha.', - ), - array( - array( + ], + [ + [ 'NamespaceCollision\\C' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/alpha', 'NamespaceCollision\\C\\B' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/beta', - ), + ], 'NamespaceCollision\C\B\Foo', '->loadClass() loads NamespaceCollision\C\B\Foo from beta.', - ), - array( - array( + ], + [ + [ 'NamespaceCollision\\C\\B' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/beta', 'NamespaceCollision\\C' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/alpha', - ), + ], 'NamespaceCollision\C\B\Bar', '->loadClass() loads NamespaceCollision\C\B\Bar from beta.', - ), - array( - array( + ], + [ + [ 'PrefixCollision_C_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/alpha', 'PrefixCollision_C_B_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/beta', - ), + ], 'PrefixCollision_C_Foo', '->loadClass() loads PrefixCollision_C_Foo from alpha.', - ), - array( - array( + ], + [ + [ 'PrefixCollision_C_B_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/beta', 'PrefixCollision_C_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/alpha', - ), + ], 'PrefixCollision_C_Bar', '->loadClass() loads PrefixCollision_C_Bar from alpha.', - ), - array( - array( + ], + [ + [ 'PrefixCollision_C_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/alpha', 'PrefixCollision_C_B_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/beta', - ), + ], 'PrefixCollision_C_B_Foo', '->loadClass() loads PrefixCollision_C_B_Foo from beta.', - ), - array( - array( + ], + [ + [ 'PrefixCollision_C_B_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/beta', 'PrefixCollision_C_' => __DIR__.\DIRECTORY_SEPARATOR.'Fixtures/alpha', - ), + ], 'PrefixCollision_C_B_Bar', '->loadClass() loads PrefixCollision_C_B_Bar from beta.', - ), - ); + ], + ]; } } diff --git a/vendor/symfony/class-loader/Tests/ClassMapGeneratorTest.php b/vendor/symfony/class-loader/Tests/ClassMapGeneratorTest.php index ad6a1b86ff959f06590dbded7fca405467cef529..91106601839e7d5728c325e3f25300c7c173ce0e 100644 --- a/vendor/symfony/class-loader/Tests/ClassMapGeneratorTest.php +++ b/vendor/symfony/class-loader/Tests/ClassMapGeneratorTest.php @@ -74,8 +74,8 @@ public function testCreateMap($directory, $expected) public function getTestCreateMapTests() { - $data = array( - array(__DIR__.'/Fixtures/Namespaced', array( + $data = [ + [__DIR__.'/Fixtures/Namespaced', [ 'Namespaced\\Bar' => realpath(__DIR__).'/Fixtures/Namespaced/Bar.php', 'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php', 'Namespaced\\Baz' => realpath(__DIR__).'/Fixtures/Namespaced/Baz.php', @@ -84,20 +84,20 @@ public function getTestCreateMapTests() 'Namespaced\\WithHaltCompiler' => realpath(__DIR__).'/Fixtures/Namespaced/WithHaltCompiler.php', 'Namespaced\\WithDirMagic' => realpath(__DIR__).'/Fixtures/Namespaced/WithDirMagic.php', 'Namespaced\\WithFileMagic' => realpath(__DIR__).'/Fixtures/Namespaced/WithFileMagic.php', - )), - array(__DIR__.'/Fixtures/beta/NamespaceCollision', array( + ]], + [__DIR__.'/Fixtures/beta/NamespaceCollision', [ 'NamespaceCollision\\A\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Bar.php', 'NamespaceCollision\\A\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Foo.php', 'NamespaceCollision\\C\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/C/B/Bar.php', 'NamespaceCollision\\C\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/C/B/Foo.php', - )), - array(__DIR__.'/Fixtures/Pearlike', array( + ]], + [__DIR__.'/Fixtures/Pearlike', [ 'Pearlike_Foo' => realpath(__DIR__).'/Fixtures/Pearlike/Foo.php', 'Pearlike_Bar' => realpath(__DIR__).'/Fixtures/Pearlike/Bar.php', 'Pearlike_Baz' => realpath(__DIR__).'/Fixtures/Pearlike/Baz.php', 'Pearlike_WithComments' => realpath(__DIR__).'/Fixtures/Pearlike/WithComments.php', - )), - array(__DIR__.'/Fixtures/classmap', array( + ]], + [__DIR__.'/Fixtures/classmap', [ 'Foo\\Bar\\A' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php', 'Foo\\Bar\\B' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php', 'A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php', @@ -108,19 +108,19 @@ public function getTestCreateMapTests() 'ClassMap\\SomeInterface' => realpath(__DIR__).'/Fixtures/classmap/SomeInterface.php', 'ClassMap\\SomeParent' => realpath(__DIR__).'/Fixtures/classmap/SomeParent.php', 'ClassMap\\SomeClass' => realpath(__DIR__).'/Fixtures/classmap/SomeClass.php', - )), - array(__DIR__.'/Fixtures/php5.4', array( + ]], + [__DIR__.'/Fixtures/php5.4', [ 'TFoo' => __DIR__.'/Fixtures/php5.4/traits.php', 'CFoo' => __DIR__.'/Fixtures/php5.4/traits.php', 'Foo\\TBar' => __DIR__.'/Fixtures/php5.4/traits.php', 'Foo\\IBar' => __DIR__.'/Fixtures/php5.4/traits.php', 'Foo\\TFooBar' => __DIR__.'/Fixtures/php5.4/traits.php', 'Foo\\CBar' => __DIR__.'/Fixtures/php5.4/traits.php', - )), - array(__DIR__.'/Fixtures/php5.5', array( + ]], + [__DIR__.'/Fixtures/php5.5', [ 'ClassCons\\Foo' => __DIR__.'/Fixtures/php5.5/class_cons.php', - )), - ); + ]], + ]; return $data; } @@ -130,12 +130,12 @@ public function testCreateMapFinderSupport() $finder = new \Symfony\Component\Finder\Finder(); $finder->files()->in(__DIR__.'/Fixtures/beta/NamespaceCollision'); - $this->assertEqualsNormalized(array( + $this->assertEqualsNormalized([ 'NamespaceCollision\\A\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Bar.php', 'NamespaceCollision\\A\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Foo.php', 'NamespaceCollision\\C\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/C/B/Bar.php', 'NamespaceCollision\\C\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/C/B/Foo.php', - ), ClassMapGenerator::createMap($finder)); + ], ClassMapGenerator::createMap($finder)); } protected function assertEqualsNormalized($expected, $actual, $message = '') diff --git a/vendor/symfony/class-loader/Tests/Psr4ClassLoaderTest.php b/vendor/symfony/class-loader/Tests/Psr4ClassLoaderTest.php index c34351b04b0763add55928b36904a52004074329..122200e9969ba193bb397655f89898ef20c756a9 100644 --- a/vendor/symfony/class-loader/Tests/Psr4ClassLoaderTest.php +++ b/vendor/symfony/class-loader/Tests/Psr4ClassLoaderTest.php @@ -39,12 +39,12 @@ public function testLoadClass($className) */ public function getLoadClassTests() { - return array( - array('Acme\\DemoLib\\Foo'), - array('Acme\\DemoLib\\Class_With_Underscores'), - array('Acme\\DemoLib\\Lets\\Go\\Deeper\\Foo'), - array('Acme\\DemoLib\\Lets\\Go\\Deeper\\Class_With_Underscores'), - ); + return [ + ['Acme\\DemoLib\\Foo'], + ['Acme\\DemoLib\\Class_With_Underscores'], + ['Acme\\DemoLib\\Lets\\Go\\Deeper\\Foo'], + ['Acme\\DemoLib\\Lets\\Go\\Deeper\\Class_With_Underscores'], + ]; } /** @@ -67,9 +67,9 @@ public function testLoadNonexistentClass($className) */ public function getLoadNonexistentClassTests() { - return array( - array('Acme\\DemoLib\\I_Do_Not_Exist'), - array('UnknownVendor\\SomeLib\\I_Do_Not_Exist'), - ); + return [ + ['Acme\\DemoLib\\I_Do_Not_Exist'], + ['UnknownVendor\\SomeLib\\I_Do_Not_Exist'], + ]; } } diff --git a/vendor/symfony/class-loader/WinCacheClassLoader.php b/vendor/symfony/class-loader/WinCacheClassLoader.php index 75ebb84ce2fb377f763a8eb7d2fd37a1e872b119..a7149ce9daf3ea8507fe995c055aa9fccc754775 100644 --- a/vendor/symfony/class-loader/WinCacheClassLoader.php +++ b/vendor/symfony/class-loader/WinCacheClassLoader.php @@ -87,7 +87,7 @@ public function __construct($prefix, $decorated) */ public function register($prepend = false) { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); + spl_autoload_register([$this, 'loadClass'], true, $prepend); } /** @@ -95,7 +95,7 @@ public function register($prepend = false) */ public function unregister() { - spl_autoload_unregister(array($this, 'loadClass')); + spl_autoload_unregister([$this, 'loadClass']); } /** @@ -137,6 +137,6 @@ public function findFile($class) */ public function __call($method, $args) { - return \call_user_func_array(array($this->decorated, $method), $args); + return \call_user_func_array([$this->decorated, $method], $args); } } diff --git a/vendor/symfony/class-loader/XcacheClassLoader.php b/vendor/symfony/class-loader/XcacheClassLoader.php index a6a9ecc16d541cf801135fdfcb96e42401f9f0c4..56965df4c8ea9c3589f52d4055c7a702bab7eff2 100644 --- a/vendor/symfony/class-loader/XcacheClassLoader.php +++ b/vendor/symfony/class-loader/XcacheClassLoader.php @@ -81,7 +81,7 @@ public function __construct($prefix, $decorated) */ public function register($prepend = false) { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); + spl_autoload_register([$this, 'loadClass'], true, $prepend); } /** @@ -89,7 +89,7 @@ public function register($prepend = false) */ public function unregister() { - spl_autoload_unregister(array($this, 'loadClass')); + spl_autoload_unregister([$this, 'loadClass']); } /** @@ -132,6 +132,6 @@ public function findFile($class) */ public function __call($method, $args) { - return \call_user_func_array(array($this->decorated, $method), $args); + return \call_user_func_array([$this->decorated, $method], $args); } } diff --git a/vendor/symfony/class-loader/phpunit.xml.dist b/vendor/symfony/class-loader/phpunit.xml.dist index 5158b22f27c88130cf152ef8427c6b615b8a585b..2ad0b802d9b05181f4a6e7e3c8e17f9efa560d78 100644 --- a/vendor/symfony/class-loader/phpunit.xml.dist +++ b/vendor/symfony/class-loader/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/console/Application.php b/vendor/symfony/console/Application.php index 1d415636fc3d8c7d325461fd91d212e1a73c5c9b..6cc5f5c580ecf645298894a294658f330fe50a74 100644 --- a/vendor/symfony/console/Application.php +++ b/vendor/symfony/console/Application.php @@ -61,7 +61,7 @@ */ class Application { - private $commands = array(); + private $commands = []; private $wantHelps = false; private $runningCommand; private $name; @@ -74,7 +74,7 @@ class Application private $dispatcher; private $terminal; private $defaultCommand; - private $singleCommand; + private $singleCommand = false; private $initialized; /** @@ -196,17 +196,24 @@ public function run(InputInterface $input = null, OutputInterface $output = null */ public function doRun(InputInterface $input, OutputInterface $output) { - if (true === $input->hasParameterOption(array('--version', '-V'), true)) { + if (true === $input->hasParameterOption(['--version', '-V'], true)) { $output->writeln($this->getLongVersion()); return 0; } + try { + // Makes ArgvInput::getFirstArgument() able to distinguish an option from an argument. + $input->bind($this->getDefinition()); + } catch (ExceptionInterface $e) { + // Errors must be ignored, full binding/validation happens later when the command is known. + } + $name = $this->getCommandName($input); - if (true === $input->hasParameterOption(array('--help', '-h'), true)) { + if (true === $input->hasParameterOption(['--help', '-h'], true)) { if (!$name) { $name = 'help'; - $input = new ArrayInput(array('command_name' => $this->defaultCommand)); + $input = new ArrayInput(['command_name' => $this->defaultCommand]); } else { $this->wantHelps = true; } @@ -217,9 +224,9 @@ public function doRun(InputInterface $input, OutputInterface $output) $definition = $this->getDefinition(); $definition->setArguments(array_merge( $definition->getArguments(), - array( + [ 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name), - ) + ] )); } @@ -521,7 +528,7 @@ public function has($name) */ public function getNamespaces() { - $namespaces = array(); + $namespaces = []; foreach ($this->all() as $command) { $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName())); @@ -588,7 +595,7 @@ public function find($name) { $this->init(); - $aliases = array(); + $aliases = []; $allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands); $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name); $commands = preg_grep('{^'.$expr.'}', $allCommands); @@ -681,7 +688,7 @@ public function all($namespace = null) return $commands; } - $commands = array(); + $commands = []; foreach ($this->commands as $name => $command) { if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) { $commands[$name] = $command; @@ -708,7 +715,7 @@ public function all($namespace = null) */ public static function getAbbreviations($names) { - $abbrevs = array(); + $abbrevs = []; foreach ($names as $name) { for ($len = \strlen($name); $len > 0; --$len) { $abbrev = substr($name, 0, $len); @@ -750,18 +757,18 @@ protected function doRenderException(\Exception $e, OutputInterface $output) if (\defined('HHVM_VERSION') && $width > 1 << 31) { $width = 1 << 31; } - $lines = array(); - foreach ('' !== $message ? preg_split('/\r?\n/', $message) : array() as $line) { + $lines = []; + foreach ('' !== $message ? preg_split('/\r?\n/', $message) : [] as $line) { foreach ($this->splitStringByWidth($line, $width - 4) as $line) { // pre-format lines to get the right string length $lineLength = Helper::strlen($line) + 4; - $lines[] = array($line, $lineLength); + $lines[] = [$line, $lineLength]; $len = max($lineLength, $len); } } - $messages = array(); + $messages = []; if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { $messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a'))); } @@ -783,6 +790,13 @@ protected function doRenderException(\Exception $e, OutputInterface $output) // exception related properties $trace = $e->getTrace(); + array_unshift($trace, [ + 'function' => '', + 'file' => $e->getFile() ?: 'n/a', + 'line' => $e->getLine() ?: 'n/a', + 'args' => [], + ]); + for ($i = 0, $count = \count($trace); $i < $count; ++$i) { $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : ''; $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : ''; @@ -837,7 +851,7 @@ public function getTerminalDimensions() { @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); - return array($this->terminal->getWidth(), $this->terminal->getHeight()); + return [$this->terminal->getWidth(), $this->terminal->getHeight()]; } /** @@ -867,13 +881,13 @@ public function setTerminalDimensions($width, $height) */ protected function configureIO(InputInterface $input, OutputInterface $output) { - if (true === $input->hasParameterOption(array('--ansi'), true)) { + if (true === $input->hasParameterOption(['--ansi'], true)) { $output->setDecorated(true); - } elseif (true === $input->hasParameterOption(array('--no-ansi'), true)) { + } elseif (true === $input->hasParameterOption(['--no-ansi'], true)) { $output->setDecorated(false); } - if (true === $input->hasParameterOption(array('--no-interaction', '-n'), true)) { + if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) { $input->setInteractive(false); } elseif (\function_exists('posix_isatty')) { $inputStream = null; @@ -901,7 +915,7 @@ protected function configureIO(InputInterface $input, OutputInterface $output) default: $shellVerbosity = 0; break; } - if (true === $input->hasParameterOption(array('--quiet', '-q'), true)) { + if (true === $input->hasParameterOption(['--quiet', '-q'], true)) { $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); $shellVerbosity = -1; } else { @@ -1014,7 +1028,7 @@ protected function getCommandName(InputInterface $input) */ protected function getDefaultInputDefinition() { - return new InputDefinition(array( + return new InputDefinition([ new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'), @@ -1024,7 +1038,7 @@ protected function getDefaultInputDefinition() new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'), new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'), new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'), - )); + ]); } /** @@ -1034,7 +1048,7 @@ protected function getDefaultInputDefinition() */ protected function getDefaultCommands() { - return array(new HelpCommand(), new ListCommand()); + return [new HelpCommand(), new ListCommand()]; } /** @@ -1044,12 +1058,12 @@ protected function getDefaultCommands() */ protected function getDefaultHelperSet() { - return new HelperSet(array( + return new HelperSet([ new FormatterHelper(), new DebugFormatterHelper(), new ProcessHelper(), new QuestionHelper(), - )); + ]); } /** @@ -1094,9 +1108,9 @@ public function extractNamespace($name, $limit = null) private function findAlternatives($name, $collection) { $threshold = 1e3; - $alternatives = array(); + $alternatives = []; - $collectionParts = array(); + $collectionParts = []; foreach ($collection as $item) { $collectionParts[$item] = explode(':', $item); } @@ -1155,6 +1169,14 @@ public function setDefaultCommand($commandName, $isSingleCommand = false) return $this; } + /** + * @internal + */ + public function isSingleCommand() + { + return $this->singleCommand; + } + private function splitStringByWidth($string, $width) { // str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly. @@ -1165,7 +1187,7 @@ private function splitStringByWidth($string, $width) } $utf8String = mb_convert_encoding($string, 'utf8', $encoding); - $lines = array(); + $lines = []; $line = ''; foreach (preg_split('//u', $utf8String) as $char) { // test if $char could be appended to current line @@ -1196,7 +1218,7 @@ private function extractAllNamespaces($name) { // -1 as third argument is needed to skip the command short name when exploding $parts = explode(':', $name, -1); - $namespaces = array(); + $namespaces = []; foreach ($parts as $part) { if (\count($namespaces)) { diff --git a/vendor/symfony/console/Command/Command.php b/vendor/symfony/console/Command/Command.php index e602f403d56411d3034069a89dcf5bd9a7d9f004..5f30da7a2a5a9c3155865a43f8938b4400804614 100644 --- a/vendor/symfony/console/Command/Command.php +++ b/vendor/symfony/console/Command/Command.php @@ -37,7 +37,7 @@ class Command private $application; private $name; private $processTitle; - private $aliases = array(); + private $aliases = []; private $definition; private $hidden = false; private $help; @@ -46,8 +46,8 @@ class Command private $applicationDefinitionMerged = false; private $applicationDefinitionMergedWithArgs = false; private $code; - private $synopsis = array(); - private $usages = array(); + private $synopsis = []; + private $usages = []; private $helperSet; /** @@ -150,7 +150,7 @@ protected function configure() * execute() method, you set the code to execute by passing * a Closure to the setCode() method. * - * @return null|int null or 0 if everything went fine, or an error code + * @return int|null null or 0 if everything went fine, or an error code * * @throws LogicException When this abstract method is not implemented * @@ -173,10 +173,14 @@ protected function interact(InputInterface $input, OutputInterface $output) } /** - * Initializes the command just after the input has been validated. + * Initializes the command after the input has been bound and before the input + * is validated. * * This is mainly useful when a lot of commands extends one main command * where some things need to be initialized based on the input arguments and options. + * + * @see InputInterface::bind() + * @see InputInterface::validate() */ protected function initialize(InputInterface $input, OutputInterface $output) { @@ -305,14 +309,13 @@ public function mergeApplicationDefinition($mergeArgs = true) $this->definition->addOptions($this->application->getDefinition()->getOptions()); + $this->applicationDefinitionMerged = true; + if ($mergeArgs) { $currentArguments = $this->definition->getArguments(); $this->definition->setArguments($this->application->getDefinition()->getArguments()); $this->definition->addArguments($currentArguments); - } - $this->applicationDefinitionMerged = true; - if ($mergeArgs) { $this->applicationDefinitionMergedWithArgs = true; } } @@ -365,10 +368,12 @@ public function getNativeDefinition() /** * Adds an argument. * - * @param string $name The argument name - * @param int $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL - * @param string $description A description text - * @param mixed $default The default value (for InputArgument::OPTIONAL mode only) + * @param string $name The argument name + * @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL + * @param string $description A description text + * @param string|string[]|null $default The default value (for InputArgument::OPTIONAL mode only) + * + * @throws InvalidArgumentException When argument mode is not valid * * @return $this */ @@ -382,11 +387,13 @@ public function addArgument($name, $mode = null, $description = '', $default = n /** * Adds an option. * - * @param string $name The option name - * @param string $shortcut The shortcut (can be null) - * @param int $mode The option mode: One of the InputOption::VALUE_* constants - * @param string $description A description text - * @param mixed $default The default value (must be null for InputOption::VALUE_NONE) + * @param string $name The option name + * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the InputOption::VALUE_* constants + * @param string $description A description text + * @param string|string[]|int|bool|null $default The default value (must be null for InputOption::VALUE_NONE) + * + * @throws InvalidArgumentException If option mode is invalid or incompatible * * @return $this */ @@ -526,15 +533,16 @@ public function getHelp() public function getProcessedHelp() { $name = $this->name; + $isSingleCommand = $this->application && $this->application->isSingleCommand(); - $placeholders = array( + $placeholders = [ '%command.name%', '%command.full_name%', - ); - $replacements = array( + ]; + $replacements = [ $name, - $_SERVER['PHP_SELF'].' '.$name, - ); + $isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name, + ]; return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription()); } diff --git a/vendor/symfony/console/Command/HelpCommand.php b/vendor/symfony/console/Command/HelpCommand.php index 1e20b008aab09f8792421aad467cfda52739a5af..23847766b6fdc5bb16634981cb2002c0709f2161 100644 --- a/vendor/symfony/console/Command/HelpCommand.php +++ b/vendor/symfony/console/Command/HelpCommand.php @@ -35,11 +35,11 @@ protected function configure() $this ->setName('help') - ->setDefinition(array( + ->setDefinition([ new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'), - )) + ]) ->setDescription('Displays help for a command') ->setHelp(<<<'EOF' The <info>%command.name%</info> command displays help for a given command: @@ -71,10 +71,10 @@ protected function execute(InputInterface $input, OutputInterface $output) } $helper = new DescriptorHelper(); - $helper->describe($output, $this->command, array( + $helper->describe($output, $this->command, [ 'format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), - )); + ]); $this->command = null; } diff --git a/vendor/symfony/console/Command/ListCommand.php b/vendor/symfony/console/Command/ListCommand.php index 5d932338c6ed075602c4060412c5ceabccc013d5..7259b1263bcd167173215ee4d9caa7effedca552 100644 --- a/vendor/symfony/console/Command/ListCommand.php +++ b/vendor/symfony/console/Command/ListCommand.php @@ -69,11 +69,11 @@ public function getNativeDefinition() protected function execute(InputInterface $input, OutputInterface $output) { $helper = new DescriptorHelper(); - $helper->describe($output, $this->getApplication(), array( + $helper->describe($output, $this->getApplication(), [ 'format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'namespace' => $input->getArgument('namespace'), - )); + ]); } /** @@ -81,10 +81,10 @@ protected function execute(InputInterface $input, OutputInterface $output) */ private function createDefinition() { - return new InputDefinition(array( + return new InputDefinition([ new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'), - )); + ]); } } diff --git a/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php b/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php index 39d53ef8e37d30441b1a8aa47915f888f638f8e3..f656d6a86915e52e53f75da637d4dc12ee06f165 100644 --- a/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php +++ b/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php @@ -38,10 +38,10 @@ public function __construct($commandLoaderServiceId = 'console.command_loader', public function process(ContainerBuilder $container) { $commandServices = $container->findTaggedServiceIds($this->commandTag, true); - $lazyCommandMap = array(); - $lazyCommandRefs = array(); - $serviceIds = array(); - $lazyServiceIds = array(); + $lazyCommandMap = []; + $lazyCommandRefs = []; + $serviceIds = []; + $lazyServiceIds = []; foreach ($commandServices as $id => $tags) { $definition = $container->getDefinition($id); @@ -79,7 +79,7 @@ public function process(ContainerBuilder $container) unset($tags[0]); $lazyCommandMap[$commandName] = $id; $lazyCommandRefs[$id] = new TypedReference($id, $class); - $aliases = array(); + $aliases = []; foreach ($tags as $tag) { if (isset($tag['command'])) { @@ -88,17 +88,17 @@ public function process(ContainerBuilder $container) } } - $definition->addMethodCall('setName', array($commandName)); + $definition->addMethodCall('setName', [$commandName]); if ($aliases) { - $definition->addMethodCall('setAliases', array($aliases)); + $definition->addMethodCall('setAliases', [$aliases]); } } $container ->register($this->commandLoaderServiceId, ContainerCommandLoader::class) ->setPublic(true) - ->setArguments(array(ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap)); + ->setArguments([ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap]); $container->setParameter('console.command.ids', $serviceIds); $container->setParameter('console.lazy_command.ids', $lazyServiceIds); diff --git a/vendor/symfony/console/Descriptor/ApplicationDescription.php b/vendor/symfony/console/Descriptor/ApplicationDescription.php index ef4c673b7bcf36c1250cfec97b7241aa051a632a..79a358fb32ee1ef85ee19e013625f6cdc2cfaa9c 100644 --- a/vendor/symfony/console/Descriptor/ApplicationDescription.php +++ b/vendor/symfony/console/Descriptor/ApplicationDescription.php @@ -97,12 +97,12 @@ public function getCommand($name) private function inspectApplication() { - $this->commands = array(); - $this->namespaces = array(); + $this->commands = []; + $this->namespaces = []; $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null); foreach ($this->sortCommands($all) as $namespace => $commands) { - $names = array(); + $names = []; /** @var Command $command */ foreach ($commands as $name => $command) { @@ -119,7 +119,7 @@ private function inspectApplication() $names[] = $name; } - $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names); + $this->namespaces[$namespace] = ['id' => $namespace, 'commands' => $names]; } } @@ -128,8 +128,8 @@ private function inspectApplication() */ private function sortCommands(array $commands) { - $namespacedCommands = array(); - $globalCommands = array(); + $namespacedCommands = []; + $globalCommands = []; foreach ($commands as $name => $command) { $key = $this->application->extractNamespace($name, 1); if (!$key) { diff --git a/vendor/symfony/console/Descriptor/Descriptor.php b/vendor/symfony/console/Descriptor/Descriptor.php index 151d84f72abf0a9c3189112aa68a85b22bf5596e..d25a708e479ee1438b54fd7937c3794d458faf69 100644 --- a/vendor/symfony/console/Descriptor/Descriptor.php +++ b/vendor/symfony/console/Descriptor/Descriptor.php @@ -34,7 +34,7 @@ abstract class Descriptor implements DescriptorInterface /** * {@inheritdoc} */ - public function describe(OutputInterface $output, $object, array $options = array()) + public function describe(OutputInterface $output, $object, array $options = []) { $this->output = $output; @@ -75,33 +75,33 @@ protected function write($content, $decorated = false) * * @return string|mixed */ - abstract protected function describeInputArgument(InputArgument $argument, array $options = array()); + abstract protected function describeInputArgument(InputArgument $argument, array $options = []); /** * Describes an InputOption instance. * * @return string|mixed */ - abstract protected function describeInputOption(InputOption $option, array $options = array()); + abstract protected function describeInputOption(InputOption $option, array $options = []); /** * Describes an InputDefinition instance. * * @return string|mixed */ - abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array()); + abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []); /** * Describes a Command instance. * * @return string|mixed */ - abstract protected function describeCommand(Command $command, array $options = array()); + abstract protected function describeCommand(Command $command, array $options = []); /** * Describes an Application instance. * * @return string|mixed */ - abstract protected function describeApplication(Application $application, array $options = array()); + abstract protected function describeApplication(Application $application, array $options = []); } diff --git a/vendor/symfony/console/Descriptor/DescriptorInterface.php b/vendor/symfony/console/Descriptor/DescriptorInterface.php index 5d3339a9e608a4da9fba5aabe01f440c880c6a7a..fbc07df879abaceb47a232bc02a3b50e59c6fbb0 100644 --- a/vendor/symfony/console/Descriptor/DescriptorInterface.php +++ b/vendor/symfony/console/Descriptor/DescriptorInterface.php @@ -27,5 +27,5 @@ interface DescriptorInterface * @param object $object * @param array $options */ - public function describe(OutputInterface $output, $object, array $options = array()); + public function describe(OutputInterface $output, $object, array $options = []); } diff --git a/vendor/symfony/console/Descriptor/JsonDescriptor.php b/vendor/symfony/console/Descriptor/JsonDescriptor.php index f60323becd88ea17eceec64877093bf0906655d8..197b843d4b76cc912eba381895327c0b20becb05 100644 --- a/vendor/symfony/console/Descriptor/JsonDescriptor.php +++ b/vendor/symfony/console/Descriptor/JsonDescriptor.php @@ -29,7 +29,7 @@ class JsonDescriptor extends Descriptor /** * {@inheritdoc} */ - protected function describeInputArgument(InputArgument $argument, array $options = array()) + protected function describeInputArgument(InputArgument $argument, array $options = []) { $this->writeData($this->getInputArgumentData($argument), $options); } @@ -37,7 +37,7 @@ protected function describeInputArgument(InputArgument $argument, array $options /** * {@inheritdoc} */ - protected function describeInputOption(InputOption $option, array $options = array()) + protected function describeInputOption(InputOption $option, array $options = []) { $this->writeData($this->getInputOptionData($option), $options); } @@ -45,7 +45,7 @@ protected function describeInputOption(InputOption $option, array $options = arr /** * {@inheritdoc} */ - protected function describeInputDefinition(InputDefinition $definition, array $options = array()) + protected function describeInputDefinition(InputDefinition $definition, array $options = []) { $this->writeData($this->getInputDefinitionData($definition), $options); } @@ -53,7 +53,7 @@ protected function describeInputDefinition(InputDefinition $definition, array $o /** * {@inheritdoc} */ - protected function describeCommand(Command $command, array $options = array()) + protected function describeCommand(Command $command, array $options = []) { $this->writeData($this->getCommandData($command), $options); } @@ -61,17 +61,17 @@ protected function describeCommand(Command $command, array $options = array()) /** * {@inheritdoc} */ - protected function describeApplication(Application $application, array $options = array()) + protected function describeApplication(Application $application, array $options = []) { $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null; $description = new ApplicationDescription($application, $describedNamespace, true); - $commands = array(); + $commands = []; foreach ($description->getCommands() as $command) { $commands[] = $this->getCommandData($command); } - $data = array(); + $data = []; if ('UNKNOWN' !== $application->getName()) { $data['application']['name'] = $application->getName(); if ('UNKNOWN' !== $application->getVersion()) { @@ -105,13 +105,13 @@ private function writeData(array $data, array $options) */ private function getInputArgumentData(InputArgument $argument) { - return array( + return [ 'name' => $argument->getName(), 'is_required' => $argument->isRequired(), 'is_array' => $argument->isArray(), 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()), 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(), - ); + ]; } /** @@ -119,7 +119,7 @@ private function getInputArgumentData(InputArgument $argument) */ private function getInputOptionData(InputOption $option) { - return array( + return [ 'name' => '--'.$option->getName(), 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '', 'accept_value' => $option->acceptValue(), @@ -127,7 +127,7 @@ private function getInputOptionData(InputOption $option) 'is_multiple' => $option->isArray(), 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()), 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(), - ); + ]; } /** @@ -135,17 +135,17 @@ private function getInputOptionData(InputOption $option) */ private function getInputDefinitionData(InputDefinition $definition) { - $inputArguments = array(); + $inputArguments = []; foreach ($definition->getArguments() as $name => $argument) { $inputArguments[$name] = $this->getInputArgumentData($argument); } - $inputOptions = array(); + $inputOptions = []; foreach ($definition->getOptions() as $name => $option) { $inputOptions[$name] = $this->getInputOptionData($option); } - return array('arguments' => $inputArguments, 'options' => $inputOptions); + return ['arguments' => $inputArguments, 'options' => $inputOptions]; } /** @@ -156,13 +156,13 @@ private function getCommandData(Command $command) $command->getSynopsis(); $command->mergeApplicationDefinition(false); - return array( + return [ 'name' => $command->getName(), - 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()), + 'usage' => array_merge([$command->getSynopsis()], $command->getUsages(), $command->getAliases()), 'description' => $command->getDescription(), 'help' => $command->getProcessedHelp(), 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()), 'hidden' => $command->isHidden(), - ); + ]; } } diff --git a/vendor/symfony/console/Descriptor/MarkdownDescriptor.php b/vendor/symfony/console/Descriptor/MarkdownDescriptor.php index 6d8399f9221363a9d376d17b48f76df78971d15a..e6245778f58d58af37dfee93b16c1c3cda65a5c2 100644 --- a/vendor/symfony/console/Descriptor/MarkdownDescriptor.php +++ b/vendor/symfony/console/Descriptor/MarkdownDescriptor.php @@ -31,7 +31,7 @@ class MarkdownDescriptor extends Descriptor /** * {@inheritdoc} */ - public function describe(OutputInterface $output, $object, array $options = array()) + public function describe(OutputInterface $output, $object, array $options = []) { $decorated = $output->isDecorated(); $output->setDecorated(false); @@ -52,7 +52,7 @@ protected function write($content, $decorated = true) /** * {@inheritdoc} */ - protected function describeInputArgument(InputArgument $argument, array $options = array()) + protected function describeInputArgument(InputArgument $argument, array $options = []) { $this->write( '#### `'.($argument->getName() ?: '<none>')."`\n\n" @@ -66,7 +66,7 @@ protected function describeInputArgument(InputArgument $argument, array $options /** * {@inheritdoc} */ - protected function describeInputOption(InputOption $option, array $options = array()) + protected function describeInputOption(InputOption $option, array $options = []) { $name = '--'.$option->getName(); if ($option->getShortcut()) { @@ -86,7 +86,7 @@ protected function describeInputOption(InputOption $option, array $options = arr /** * {@inheritdoc} */ - protected function describeInputDefinition(InputDefinition $definition, array $options = array()) + protected function describeInputDefinition(InputDefinition $definition, array $options = []) { if ($showArguments = \count($definition->getArguments()) > 0) { $this->write('### Arguments'); @@ -112,7 +112,7 @@ protected function describeInputDefinition(InputDefinition $definition, array $o /** * {@inheritdoc} */ - protected function describeCommand(Command $command, array $options = array()) + protected function describeCommand(Command $command, array $options = []) { $command->getSynopsis(); $command->mergeApplicationDefinition(false); @@ -122,7 +122,7 @@ protected function describeCommand(Command $command, array $options = array()) .str_repeat('-', Helper::strlen($command->getName()) + 2)."\n\n" .($command->getDescription() ? $command->getDescription()."\n\n" : '') .'### Usage'."\n\n" - .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) { + .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) { return $carry.'* `'.$usage.'`'."\n"; }) ); @@ -141,7 +141,7 @@ protected function describeCommand(Command $command, array $options = array()) /** * {@inheritdoc} */ - protected function describeApplication(Application $application, array $options = array()) + protected function describeApplication(Application $application, array $options = []) { $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null; $description = new ApplicationDescription($application, $describedNamespace); diff --git a/vendor/symfony/console/Descriptor/TextDescriptor.php b/vendor/symfony/console/Descriptor/TextDescriptor.php index 04dd22598d6e00caa0e037d8e05bd4f8e2904cf8..af9088c7c3358db7d39e5ff3bd1cc9ae57388907 100644 --- a/vendor/symfony/console/Descriptor/TextDescriptor.php +++ b/vendor/symfony/console/Descriptor/TextDescriptor.php @@ -31,7 +31,7 @@ class TextDescriptor extends Descriptor /** * {@inheritdoc} */ - protected function describeInputArgument(InputArgument $argument, array $options = array()) + protected function describeInputArgument(InputArgument $argument, array $options = []) { if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) { $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault())); @@ -54,7 +54,7 @@ protected function describeInputArgument(InputArgument $argument, array $options /** * {@inheritdoc} */ - protected function describeInputOption(InputOption $option, array $options = array()) + protected function describeInputOption(InputOption $option, array $options = []) { if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) { $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault())); @@ -71,7 +71,7 @@ protected function describeInputOption(InputOption $option, array $options = arr } } - $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option)); + $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions([$option]); $synopsis = sprintf('%s%s', $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ', sprintf('--%s%s', $option->getName(), $value) @@ -92,7 +92,7 @@ protected function describeInputOption(InputOption $option, array $options = arr /** * {@inheritdoc} */ - protected function describeInputDefinition(InputDefinition $definition, array $options = array()) + protected function describeInputDefinition(InputDefinition $definition, array $options = []) { $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions()); foreach ($definition->getArguments() as $argument) { @@ -103,7 +103,7 @@ protected function describeInputDefinition(InputDefinition $definition, array $o $this->writeText('<comment>Arguments:</comment>', $options); $this->writeText("\n"); foreach ($definition->getArguments() as $argument) { - $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth))); + $this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth])); $this->writeText("\n"); } } @@ -113,7 +113,7 @@ protected function describeInputDefinition(InputDefinition $definition, array $o } if ($definition->getOptions()) { - $laterOptions = array(); + $laterOptions = []; $this->writeText('<comment>Options:</comment>', $options); foreach ($definition->getOptions() as $option) { @@ -122,11 +122,11 @@ protected function describeInputDefinition(InputDefinition $definition, array $o continue; } $this->writeText("\n"); - $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth))); + $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth])); } foreach ($laterOptions as $option) { $this->writeText("\n"); - $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth))); + $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth])); } } } @@ -134,14 +134,14 @@ protected function describeInputDefinition(InputDefinition $definition, array $o /** * {@inheritdoc} */ - protected function describeCommand(Command $command, array $options = array()) + protected function describeCommand(Command $command, array $options = []) { $command->getSynopsis(true); $command->getSynopsis(false); $command->mergeApplicationDefinition(false); $this->writeText('<comment>Usage:</comment>', $options); - foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) { + foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) { $this->writeText("\n"); $this->writeText(' '.OutputFormatter::escape($usage), $options); } @@ -166,7 +166,7 @@ protected function describeCommand(Command $command, array $options = array()) /** * {@inheritdoc} */ - protected function describeApplication(Application $application, array $options = array()) + protected function describeApplication(Application $application, array $options = []) { $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null; $description = new ApplicationDescription($application, $describedNamespace); @@ -242,7 +242,7 @@ protected function describeApplication(Application $application, array $options /** * {@inheritdoc} */ - private function writeText($content, array $options = array()) + private function writeText($content, array $options = []) { $this->write( isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content, @@ -300,7 +300,7 @@ private function formatDefaultValue($default) */ private function getColumnWidth(array $commands) { - $widths = array(); + $widths = []; foreach ($commands as $command) { if ($command instanceof Command) { diff --git a/vendor/symfony/console/Descriptor/XmlDescriptor.php b/vendor/symfony/console/Descriptor/XmlDescriptor.php index 1a12a1dd67b472c4a76a4eb51305451353486c9f..0cc0c9901f193378d7e83e225f42c304f6462b7a 100644 --- a/vendor/symfony/console/Descriptor/XmlDescriptor.php +++ b/vendor/symfony/console/Descriptor/XmlDescriptor.php @@ -64,7 +64,7 @@ public function getCommandDocument(Command $command) $commandXML->appendChild($usagesXML = $dom->createElement('usages')); - foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) { + foreach (array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()) as $usage) { $usagesXML->appendChild($dom->createElement('usage', $usage)); } @@ -130,7 +130,7 @@ public function getApplicationDocument(Application $application, $namespace = nu /** * {@inheritdoc} */ - protected function describeInputArgument(InputArgument $argument, array $options = array()) + protected function describeInputArgument(InputArgument $argument, array $options = []) { $this->writeDocument($this->getInputArgumentDocument($argument)); } @@ -138,7 +138,7 @@ protected function describeInputArgument(InputArgument $argument, array $options /** * {@inheritdoc} */ - protected function describeInputOption(InputOption $option, array $options = array()) + protected function describeInputOption(InputOption $option, array $options = []) { $this->writeDocument($this->getInputOptionDocument($option)); } @@ -146,7 +146,7 @@ protected function describeInputOption(InputOption $option, array $options = arr /** * {@inheritdoc} */ - protected function describeInputDefinition(InputDefinition $definition, array $options = array()) + protected function describeInputDefinition(InputDefinition $definition, array $options = []) { $this->writeDocument($this->getInputDefinitionDocument($definition)); } @@ -154,7 +154,7 @@ protected function describeInputDefinition(InputDefinition $definition, array $o /** * {@inheritdoc} */ - protected function describeCommand(Command $command, array $options = array()) + protected function describeCommand(Command $command, array $options = []) { $this->writeDocument($this->getCommandDocument($command)); } @@ -162,7 +162,7 @@ protected function describeCommand(Command $command, array $options = array()) /** * {@inheritdoc} */ - protected function describeApplication(Application $application, array $options = array()) + protected function describeApplication(Application $application, array $options = []) { $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null)); } @@ -203,7 +203,7 @@ private function getInputArgumentDocument(InputArgument $argument) $descriptionXML->appendChild($dom->createTextNode($argument->getDescription())); $objectXML->appendChild($defaultsXML = $dom->createElement('defaults')); - $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array())); + $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? [var_export($argument->getDefault(), true)] : ($argument->getDefault() ? [$argument->getDefault()] : [])); foreach ($defaults as $default) { $defaultsXML->appendChild($defaultXML = $dom->createElement('default')); $defaultXML->appendChild($dom->createTextNode($default)); @@ -235,7 +235,7 @@ private function getInputOptionDocument(InputOption $option) $descriptionXML->appendChild($dom->createTextNode($option->getDescription())); if ($option->acceptValue()) { - $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array())); + $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? [var_export($option->getDefault(), true)] : ($option->getDefault() ? [$option->getDefault()] : [])); $objectXML->appendChild($defaultsXML = $dom->createElement('defaults')); if (!empty($defaults)) { diff --git a/vendor/symfony/console/EventListener/ErrorListener.php b/vendor/symfony/console/EventListener/ErrorListener.php index 909d6ea3a1ddba23bd2ff3089574654af2bd873e..212ad1d96ff4f416a6b486da8e374123fb7c194e 100644 --- a/vendor/symfony/console/EventListener/ErrorListener.php +++ b/vendor/symfony/console/EventListener/ErrorListener.php @@ -40,10 +40,10 @@ public function onConsoleError(ConsoleErrorEvent $event) $error = $event->getError(); if (!$inputString = $this->getInputString($event)) { - return $this->logger->error('An error occurred while using the console. Message: "{message}"', array('exception' => $error, 'message' => $error->getMessage())); + return $this->logger->error('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]); } - $this->logger->error('Error thrown while running command "{command}". Message: "{message}"', array('exception' => $error, 'command' => $inputString, 'message' => $error->getMessage())); + $this->logger->error('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]); } public function onConsoleTerminate(ConsoleTerminateEvent $event) @@ -59,18 +59,18 @@ public function onConsoleTerminate(ConsoleTerminateEvent $event) } if (!$inputString = $this->getInputString($event)) { - return $this->logger->debug('The console exited with code "{code}"', array('code' => $exitCode)); + return $this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]); } - $this->logger->debug('Command "{command}" exited with code "{code}"', array('command' => $inputString, 'code' => $exitCode)); + $this->logger->debug('Command "{command}" exited with code "{code}"', ['command' => $inputString, 'code' => $exitCode]); } public static function getSubscribedEvents() { - return array( - ConsoleEvents::ERROR => array('onConsoleError', -128), - ConsoleEvents::TERMINATE => array('onConsoleTerminate', -128), - ); + return [ + ConsoleEvents::ERROR => ['onConsoleError', -128], + ConsoleEvents::TERMINATE => ['onConsoleTerminate', -128], + ]; } private static function getInputString(ConsoleEvent $event) @@ -80,7 +80,7 @@ private static function getInputString(ConsoleEvent $event) if (method_exists($input, '__toString')) { if ($commandName) { - return str_replace(array("'$commandName'", "\"$commandName\""), $commandName, (string) $input); + return str_replace(["'$commandName'", "\"$commandName\""], $commandName, (string) $input); } return (string) $input; diff --git a/vendor/symfony/console/Exception/CommandNotFoundException.php b/vendor/symfony/console/Exception/CommandNotFoundException.php index cb7d1131fa7764d620bda7b2a8b3a519b989d432..d28fceb12948bab2be56c1db5a2b7f8e89444adb 100644 --- a/vendor/symfony/console/Exception/CommandNotFoundException.php +++ b/vendor/symfony/console/Exception/CommandNotFoundException.php @@ -26,7 +26,7 @@ class CommandNotFoundException extends \InvalidArgumentException implements Exce * @param int $code Exception code * @param \Exception $previous Previous exception used for the exception chaining */ - public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null) + public function __construct($message, array $alternatives = [], $code = 0, \Exception $previous = null) { parent::__construct($message, $code, $previous); diff --git a/vendor/symfony/console/Formatter/OutputFormatter.php b/vendor/symfony/console/Formatter/OutputFormatter.php index 57b95eb14035f061fd638abfe5c4a23adb3ee28e..adfcdc8750062e17dc6abf992833cce35def5a61 100644 --- a/vendor/symfony/console/Formatter/OutputFormatter.php +++ b/vendor/symfony/console/Formatter/OutputFormatter.php @@ -21,7 +21,7 @@ class OutputFormatter implements OutputFormatterInterface { private $decorated; - private $styles = array(); + private $styles = []; private $styleStack; /** @@ -65,7 +65,7 @@ public static function escapeTrailingBackslash($text) * @param bool $decorated Whether this formatter should actually decorate strings * @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances */ - public function __construct($decorated = false, array $styles = array()) + public function __construct($decorated = false, array $styles = []) { $this->decorated = (bool) $decorated; @@ -157,7 +157,7 @@ public function format($message) if (!$open && !$tag) { // </> $this->styleStack->pop(); - } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) { + } elseif (false === $style = $this->createStyleFromString($tag)) { $output .= $this->applyCurrentStyle($text); } elseif ($open) { $this->styleStack->push($style); @@ -169,7 +169,7 @@ public function format($message) $output .= $this->applyCurrentStyle(substr($message, $offset)); if (false !== strpos($output, "\0")) { - return strtr($output, array("\0" => '\\', '\\<' => '<')); + return strtr($output, ["\0" => '\\', '\\<' => '<']); } return str_replace('\\<', '<', $output); @@ -203,13 +203,14 @@ private function createStyleFromString($string) $style = new OutputFormatterStyle(); foreach ($matches as $match) { array_shift($match); + $match[0] = strtolower($match[0]); if ('fg' == $match[0]) { - $style->setForeground($match[1]); + $style->setForeground(strtolower($match[1])); } elseif ('bg' == $match[0]) { - $style->setBackground($match[1]); + $style->setBackground(strtolower($match[1])); } elseif ('options' === $match[0]) { - preg_match_all('([^,;]+)', $match[1], $options); + preg_match_all('([^,;]+)', strtolower($match[1]), $options); $options = array_shift($options); foreach ($options as $option) { try { diff --git a/vendor/symfony/console/Formatter/OutputFormatterStyle.php b/vendor/symfony/console/Formatter/OutputFormatterStyle.php index 1f4e0cad1d1ec337b26b790786d9333472b5dbb4..b27439a761355e2a42a4b9a877ae29b8d0204e8d 100644 --- a/vendor/symfony/console/Formatter/OutputFormatterStyle.php +++ b/vendor/symfony/console/Formatter/OutputFormatterStyle.php @@ -20,39 +20,39 @@ */ class OutputFormatterStyle implements OutputFormatterStyleInterface { - private static $availableForegroundColors = array( - 'black' => array('set' => 30, 'unset' => 39), - 'red' => array('set' => 31, 'unset' => 39), - 'green' => array('set' => 32, 'unset' => 39), - 'yellow' => array('set' => 33, 'unset' => 39), - 'blue' => array('set' => 34, 'unset' => 39), - 'magenta' => array('set' => 35, 'unset' => 39), - 'cyan' => array('set' => 36, 'unset' => 39), - 'white' => array('set' => 37, 'unset' => 39), - 'default' => array('set' => 39, 'unset' => 39), - ); - private static $availableBackgroundColors = array( - 'black' => array('set' => 40, 'unset' => 49), - 'red' => array('set' => 41, 'unset' => 49), - 'green' => array('set' => 42, 'unset' => 49), - 'yellow' => array('set' => 43, 'unset' => 49), - 'blue' => array('set' => 44, 'unset' => 49), - 'magenta' => array('set' => 45, 'unset' => 49), - 'cyan' => array('set' => 46, 'unset' => 49), - 'white' => array('set' => 47, 'unset' => 49), - 'default' => array('set' => 49, 'unset' => 49), - ); - private static $availableOptions = array( - 'bold' => array('set' => 1, 'unset' => 22), - 'underscore' => array('set' => 4, 'unset' => 24), - 'blink' => array('set' => 5, 'unset' => 25), - 'reverse' => array('set' => 7, 'unset' => 27), - 'conceal' => array('set' => 8, 'unset' => 28), - ); + private static $availableForegroundColors = [ + 'black' => ['set' => 30, 'unset' => 39], + 'red' => ['set' => 31, 'unset' => 39], + 'green' => ['set' => 32, 'unset' => 39], + 'yellow' => ['set' => 33, 'unset' => 39], + 'blue' => ['set' => 34, 'unset' => 39], + 'magenta' => ['set' => 35, 'unset' => 39], + 'cyan' => ['set' => 36, 'unset' => 39], + 'white' => ['set' => 37, 'unset' => 39], + 'default' => ['set' => 39, 'unset' => 39], + ]; + private static $availableBackgroundColors = [ + 'black' => ['set' => 40, 'unset' => 49], + 'red' => ['set' => 41, 'unset' => 49], + 'green' => ['set' => 42, 'unset' => 49], + 'yellow' => ['set' => 43, 'unset' => 49], + 'blue' => ['set' => 44, 'unset' => 49], + 'magenta' => ['set' => 45, 'unset' => 49], + 'cyan' => ['set' => 46, 'unset' => 49], + 'white' => ['set' => 47, 'unset' => 49], + 'default' => ['set' => 49, 'unset' => 49], + ]; + private static $availableOptions = [ + 'bold' => ['set' => 1, 'unset' => 22], + 'underscore' => ['set' => 4, 'unset' => 24], + 'blink' => ['set' => 5, 'unset' => 25], + 'reverse' => ['set' => 7, 'unset' => 27], + 'conceal' => ['set' => 8, 'unset' => 28], + ]; private $foreground; private $background; - private $options = array(); + private $options = []; /** * Initializes output formatter style. @@ -61,7 +61,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface * @param string|null $background The style background color name * @param array $options The style options */ - public function __construct($foreground = null, $background = null, array $options = array()) + public function __construct($foreground = null, $background = null, array $options = []) { if (null !== $foreground) { $this->setForeground($foreground); @@ -90,11 +90,7 @@ public function setForeground($color = null) } if (!isset(static::$availableForegroundColors[$color])) { - throw new InvalidArgumentException(sprintf( - 'Invalid foreground color specified: "%s". Expected one of (%s)', - $color, - implode(', ', array_keys(static::$availableForegroundColors)) - )); + throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors)))); } $this->foreground = static::$availableForegroundColors[$color]; @@ -116,11 +112,7 @@ public function setBackground($color = null) } if (!isset(static::$availableBackgroundColors[$color])) { - throw new InvalidArgumentException(sprintf( - 'Invalid background color specified: "%s". Expected one of (%s)', - $color, - implode(', ', array_keys(static::$availableBackgroundColors)) - )); + throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors)))); } $this->background = static::$availableBackgroundColors[$color]; @@ -136,11 +128,7 @@ public function setBackground($color = null) public function setOption($option) { if (!isset(static::$availableOptions[$option])) { - throw new InvalidArgumentException(sprintf( - 'Invalid option specified: "%s". Expected one of (%s)', - $option, - implode(', ', array_keys(static::$availableOptions)) - )); + throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); } if (!\in_array(static::$availableOptions[$option], $this->options)) { @@ -158,11 +146,7 @@ public function setOption($option) public function unsetOption($option) { if (!isset(static::$availableOptions[$option])) { - throw new InvalidArgumentException(sprintf( - 'Invalid option specified: "%s". Expected one of (%s)', - $option, - implode(', ', array_keys(static::$availableOptions)) - )); + throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); } $pos = array_search(static::$availableOptions[$option], $this->options); @@ -176,7 +160,7 @@ public function unsetOption($option) */ public function setOptions(array $options) { - $this->options = array(); + $this->options = []; foreach ($options as $option) { $this->setOption($option); @@ -192,8 +176,8 @@ public function setOptions(array $options) */ public function apply($text) { - $setCodes = array(); - $unsetCodes = array(); + $setCodes = []; + $unsetCodes = []; if (null !== $this->foreground) { $setCodes[] = $this->foreground['set']; diff --git a/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php b/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php index 9e7283c2f84ca294d4b50379aa7d6b988c3828c3..5066649912bc831b87021678f20d659a6089da7b 100644 --- a/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php +++ b/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php @@ -36,7 +36,7 @@ public function __construct(OutputFormatterStyleInterface $emptyStyle = null) */ public function reset() { - $this->styles = array(); + $this->styles = []; } /** diff --git a/vendor/symfony/console/Helper/DebugFormatterHelper.php b/vendor/symfony/console/Helper/DebugFormatterHelper.php index f5393edee3d9a2dbe5e6ad8524dd8e27a16cdc2b..16d117553a1cb75ab76844a8af65334053fcf015 100644 --- a/vendor/symfony/console/Helper/DebugFormatterHelper.php +++ b/vendor/symfony/console/Helper/DebugFormatterHelper.php @@ -20,8 +20,8 @@ */ class DebugFormatterHelper extends Helper { - private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default'); - private $started = array(); + private $colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default']; + private $started = []; private $count = -1; /** @@ -35,7 +35,7 @@ class DebugFormatterHelper extends Helper */ public function start($id, $message, $prefix = 'RUN') { - $this->started[$id] = array('border' => ++$this->count % \count($this->colors)); + $this->started[$id] = ['border' => ++$this->count % \count($this->colors)]; return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message); } diff --git a/vendor/symfony/console/Helper/DescriptorHelper.php b/vendor/symfony/console/Helper/DescriptorHelper.php index 54d3b1afc1a4501753d2045557b9127b7af3de0a..f8a3847b49c6efd790b68eeffd2d19c5f32ba844 100644 --- a/vendor/symfony/console/Helper/DescriptorHelper.php +++ b/vendor/symfony/console/Helper/DescriptorHelper.php @@ -29,7 +29,7 @@ class DescriptorHelper extends Helper /** * @var DescriptorInterface[] */ - private $descriptors = array(); + private $descriptors = []; public function __construct() { @@ -54,12 +54,12 @@ public function __construct() * * @throws InvalidArgumentException when the given format is not supported */ - public function describe(OutputInterface $output, $object, array $options = array()) + public function describe(OutputInterface $output, $object, array $options = []) { - $options = array_merge(array( + $options = array_merge([ 'raw_text' => false, 'format' => 'txt', - ), $options); + ], $options); if (!isset($this->descriptors[$options['format']])) { throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format'])); diff --git a/vendor/symfony/console/Helper/FormatterHelper.php b/vendor/symfony/console/Helper/FormatterHelper.php index 79ab2849e51a421319bbc64b9a66e004ed824667..4ad63856dcd5c691479b94d7e469e8c0841e3cae 100644 --- a/vendor/symfony/console/Helper/FormatterHelper.php +++ b/vendor/symfony/console/Helper/FormatterHelper.php @@ -46,18 +46,18 @@ public function formatSection($section, $message, $style = 'info') public function formatBlock($messages, $style, $large = false) { if (!\is_array($messages)) { - $messages = array($messages); + $messages = [$messages]; } $len = 0; - $lines = array(); + $lines = []; foreach ($messages as $message) { $message = OutputFormatter::escape($message); $lines[] = sprintf($large ? ' %s ' : ' %s ', $message); $len = max($this->strlen($message) + ($large ? 4 : 2), $len); } - $messages = $large ? array(str_repeat(' ', $len)) : array(); + $messages = $large ? [str_repeat(' ', $len)] : []; for ($i = 0; isset($lines[$i]); ++$i) { $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i])); } diff --git a/vendor/symfony/console/Helper/Helper.php b/vendor/symfony/console/Helper/Helper.php index 509018552626a94b44f3f0112530e431d834c927..0ddddf6bc5023c1d002b051c0c00677d02250d6f 100644 --- a/vendor/symfony/console/Helper/Helper.php +++ b/vendor/symfony/console/Helper/Helper.php @@ -74,17 +74,17 @@ public static function substr($string, $from, $length = null) public static function formatTime($secs) { - static $timeFormats = array( - array(0, '< 1 sec'), - array(1, '1 sec'), - array(2, 'secs', 1), - array(60, '1 min'), - array(120, 'mins', 60), - array(3600, '1 hr'), - array(7200, 'hrs', 3600), - array(86400, '1 day'), - array(172800, 'days', 86400), - ); + static $timeFormats = [ + [0, '< 1 sec'], + [1, '1 sec'], + [2, 'secs', 1], + [60, '1 min'], + [120, 'mins', 60], + [3600, '1 hr'], + [7200, 'hrs', 3600], + [86400, '1 day'], + [172800, 'days', 86400], + ]; foreach ($timeFormats as $index => $format) { if ($secs >= $format[0]) { diff --git a/vendor/symfony/console/Helper/HelperSet.php b/vendor/symfony/console/Helper/HelperSet.php index 4c44b05f562ce9af598812e385c418c677e4e4c1..c73fecd4751e30e91802f5013bbe89ee889b97c9 100644 --- a/vendor/symfony/console/Helper/HelperSet.php +++ b/vendor/symfony/console/Helper/HelperSet.php @@ -24,13 +24,13 @@ class HelperSet implements \IteratorAggregate /** * @var Helper[] */ - private $helpers = array(); + private $helpers = []; private $command; /** * @param Helper[] $helpers An array of helper */ - public function __construct(array $helpers = array()) + public function __construct(array $helpers = []) { foreach ($helpers as $alias => $helper) { $this->set($helper, \is_int($alias) ? null : $alias); diff --git a/vendor/symfony/console/Helper/ProgressBar.php b/vendor/symfony/console/Helper/ProgressBar.php index bea03e31ba8a01641902cfaecec7a070e4e2dd36..172565514128b0eed2a3554651ea71732f5802c2 100644 --- a/vendor/symfony/console/Helper/ProgressBar.php +++ b/vendor/symfony/console/Helper/ProgressBar.php @@ -38,7 +38,7 @@ final class ProgressBar private $stepWidth; private $percent = 0.0; private $formatLineCount; - private $messages = array(); + private $messages = []; private $overwrite = true; private $terminal; private $firstRun = true; @@ -466,19 +466,16 @@ private function overwrite($message) { if ($this->overwrite) { if (!$this->firstRun) { - // Move the cursor to the beginning of the line - $this->output->write("\x0D"); - - // Erase the line - $this->output->write("\x1B[2K"); - // Erase previous lines if ($this->formatLineCount > 0) { - $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount)); + $message = str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount).$message; } + + // Move the cursor to the beginning of the line and erase the line + $message = "\x0D\x1B[2K$message"; } } elseif ($this->step > 0) { - $this->output->writeln(''); + $message = PHP_EOL.$message; } $this->firstRun = false; @@ -503,8 +500,8 @@ private function determineBestFormat() private static function initPlaceholderFormatters() { - return array( - 'bar' => function (ProgressBar $bar, OutputInterface $output) { + return [ + 'bar' => function (self $bar, OutputInterface $output) { $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth()); $display = str_repeat($bar->getBarCharacter(), $completeBars); if ($completeBars < $bar->getBarWidth()) { @@ -514,10 +511,10 @@ private static function initPlaceholderFormatters() return $display; }, - 'elapsed' => function (ProgressBar $bar) { + 'elapsed' => function (self $bar) { return Helper::formatTime(time() - $bar->getStartTime()); }, - 'remaining' => function (ProgressBar $bar) { + 'remaining' => function (self $bar) { if (!$bar->getMaxSteps()) { throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.'); } @@ -530,7 +527,7 @@ private static function initPlaceholderFormatters() return Helper::formatTime($remaining); }, - 'estimated' => function (ProgressBar $bar) { + 'estimated' => function (self $bar) { if (!$bar->getMaxSteps()) { throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.'); } @@ -543,24 +540,24 @@ private static function initPlaceholderFormatters() return Helper::formatTime($estimated); }, - 'memory' => function (ProgressBar $bar) { + 'memory' => function (self $bar) { return Helper::formatMemory(memory_get_usage(true)); }, - 'current' => function (ProgressBar $bar) { + 'current' => function (self $bar) { return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT); }, - 'max' => function (ProgressBar $bar) { + 'max' => function (self $bar) { return $bar->getMaxSteps(); }, - 'percent' => function (ProgressBar $bar) { + 'percent' => function (self $bar) { return floor($bar->getProgressPercent() * 100); }, - ); + ]; } private static function initFormats() { - return array( + return [ 'normal' => ' %current%/%max% [%bar%] %percent:3s%%', 'normal_nomax' => ' %current% [%bar%]', @@ -572,7 +569,7 @@ private static function initFormats() 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%', 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%', - ); + ]; } /** diff --git a/vendor/symfony/console/Helper/ProgressIndicator.php b/vendor/symfony/console/Helper/ProgressIndicator.php index 9de766a24689aa82bee4ebf73cc17a6422f47e6c..3f5751fae63984fa7846caae6e75026f3b59d254 100644 --- a/vendor/symfony/console/Helper/ProgressIndicator.php +++ b/vendor/symfony/console/Helper/ProgressIndicator.php @@ -48,7 +48,7 @@ public function __construct(OutputInterface $output, $format = null, $indicatorC } if (null === $indicatorValues) { - $indicatorValues = array('-', '\\', '|', '/'); + $indicatorValues = ['-', '\\', '|', '/']; } $indicatorValues = array_values($indicatorValues); @@ -239,25 +239,25 @@ private function getCurrentTimeInMilliseconds() private static function initPlaceholderFormatters() { - return array( - 'indicator' => function (ProgressIndicator $indicator) { + return [ + 'indicator' => function (self $indicator) { return $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)]; }, - 'message' => function (ProgressIndicator $indicator) { + 'message' => function (self $indicator) { return $indicator->message; }, - 'elapsed' => function (ProgressIndicator $indicator) { + 'elapsed' => function (self $indicator) { return Helper::formatTime(time() - $indicator->startTime); }, 'memory' => function () { return Helper::formatMemory(memory_get_usage(true)); }, - ); + ]; } private static function initFormats() { - return array( + return [ 'normal' => ' %indicator% %message%', 'normal_no_ansi' => ' %message%', @@ -266,6 +266,6 @@ private static function initFormats() 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)', 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)', - ); + ]; } } diff --git a/vendor/symfony/console/Helper/QuestionHelper.php b/vendor/symfony/console/Helper/QuestionHelper.php index d9fca30a70fc7a1e15da0bd864ce292c30164506..9c200fe897ea9f7a001097d7e895f58437db0d97 100644 --- a/vendor/symfony/console/Helper/QuestionHelper.php +++ b/vendor/symfony/console/Helper/QuestionHelper.php @@ -47,13 +47,23 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu } if (!$input->isInteractive()) { - if ($question instanceof ChoiceQuestion) { + $default = $question->getDefault(); + + if (null !== $default && $question instanceof ChoiceQuestion) { $choices = $question->getChoices(); - return $choices[$question->getDefault()]; + if (!$question->isMultiselect()) { + return isset($choices[$default]) ? $choices[$default] : $default; + } + + $default = explode(',', $default); + foreach ($default as $k => $v) { + $v = trim($v); + $default[$k] = isset($choices[$v]) ? $choices[$v] : $v; + } } - return $question->getDefault(); + return $default; } if ($input instanceof StreamableInputInterface && $stream = $input->getStream()) { @@ -130,7 +140,7 @@ public static function disableStty() /** * Asks the question to the user. * - * @return bool|mixed|null|string + * @return bool|mixed|string|null * * @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden */ @@ -156,7 +166,7 @@ private function doAsk(OutputInterface $output, Question $question) if (false === $ret) { $ret = fgets($inputStream, 4096); if (false === $ret) { - throw new RuntimeException('Aborted'); + throw new RuntimeException('Aborted.'); } $ret = trim($ret); } @@ -181,7 +191,7 @@ protected function writePrompt(OutputInterface $output, Question $question) $message = $question->getQuestion(); if ($question instanceof ChoiceQuestion) { - $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices()))); + $maxWidth = max(array_map([$this, 'strlen'], array_keys($question->getChoices()))); $messages = (array) $question->getQuestion(); foreach ($question->getChoices() as $key => $value) { @@ -242,8 +252,10 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu while (!feof($inputStream)) { $c = fread($inputStream, 1); - // Backspace Character - if ("\177" === $c) { + // as opposed to fgets(), fread() returns an empty string when the stream content is empty, not false. + if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) { + throw new RuntimeException('Aborted.'); + } elseif ("\177" === $c) { // Backspace Character if (0 === $numMatches && 0 !== $i) { --$i; // Move cursor backwards @@ -296,6 +308,10 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu continue; } else { + if ("\x80" <= $c) { + $c .= fread($inputStream, ["\xC0" => 1, "\xD0" => 1, "\xE0" => 2, "\xF0" => 3][$c & "\xF0"]); + } + $output->write($c); $ret .= $c; ++$i; @@ -370,7 +386,7 @@ private function getHiddenResponse(OutputInterface $output, $inputStream) shell_exec(sprintf('stty %s', $sttyMode)); if (false === $value) { - throw new RuntimeException('Aborted'); + throw new RuntimeException('Aborted.'); } $value = trim($value); @@ -438,7 +454,7 @@ private function getShell() if (file_exists('/usr/bin/env')) { // handle other OSs with bash/zsh/ksh/csh if available to hide the answer $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null"; - foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) { + foreach (['bash', 'zsh', 'ksh', 'csh'] as $sh) { if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) { self::$shell = $sh; break; diff --git a/vendor/symfony/console/Helper/SymfonyQuestionHelper.php b/vendor/symfony/console/Helper/SymfonyQuestionHelper.php index 75f4ee59c71c2b62014d55d608296541886f3213..5937741a2c69ec24f074d73b4609b67662af55a8 100644 --- a/vendor/symfony/console/Helper/SymfonyQuestionHelper.php +++ b/vendor/symfony/console/Helper/SymfonyQuestionHelper.php @@ -86,7 +86,7 @@ protected function writePrompt(OutputInterface $output, Question $question) case $question instanceof ChoiceQuestion: $choices = $question->getChoices(); - $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default])); + $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default)); break; diff --git a/vendor/symfony/console/Helper/Table.php b/vendor/symfony/console/Helper/Table.php index 48e89da4be377c00899ab71e42b88fe013557d29..1c439dc1bfe981a83c3cf61cbeeaeb10d3bf23c9 100644 --- a/vendor/symfony/console/Helper/Table.php +++ b/vendor/symfony/console/Helper/Table.php @@ -27,17 +27,17 @@ class Table /** * Table headers. */ - private $headers = array(); + private $headers = []; /** * Table rows. */ - private $rows = array(); + private $rows = []; /** * Column widths cache. */ - private $effectiveColumnWidths = array(); + private $effectiveColumnWidths = []; /** * Number of columns cache. @@ -59,14 +59,14 @@ class Table /** * @var array */ - private $columnStyles = array(); + private $columnStyles = []; /** * User set column widths. * * @var array */ - private $columnWidths = array(); + private $columnWidths = []; private static $styles; @@ -199,7 +199,7 @@ public function setColumnWidth($columnIndex, $width) */ public function setColumnWidths(array $widths) { - $this->columnWidths = array(); + $this->columnWidths = []; foreach ($widths as $index => $width) { $this->setColumnWidth($index, $width); } @@ -211,7 +211,7 @@ public function setHeaders(array $headers) { $headers = array_values($headers); if (!empty($headers) && !\is_array($headers[0])) { - $headers = array($headers); + $headers = [$headers]; } $this->headers = $headers; @@ -221,7 +221,7 @@ public function setHeaders(array $headers) public function setRows(array $rows) { - $this->rows = array(); + $this->rows = []; return $this->addRows($rows); } @@ -263,15 +263,14 @@ public function setRow($column, array $row) * Renders table to output. * * Example: - * <code> - * +---------------+-----------------------+------------------+ - * | ISBN | Title | Author | - * +---------------+-----------------------+------------------+ - * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | - * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | - * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | - * +---------------+-----------------------+------------------+ - * </code> + * + * +---------------+-----------------------+------------------+ + * | ISBN | Title | Author | + * +---------------+-----------------------+------------------+ + * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | + * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | + * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | + * +---------------+-----------------------+------------------+ */ public function render() { @@ -305,7 +304,9 @@ public function render() /** * Renders horizontal header separator. * - * Example: <code>+-----+-----------+-------+</code> + * Example: + * + * +-----+-----------+-------+ */ private function renderRowSeparator() { @@ -336,7 +337,9 @@ private function renderColumnSeparator() /** * Renders table row. * - * Example: <code>| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |</code> + * Example: + * + * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | * * @param array $row * @param string $cellFormat @@ -399,7 +402,7 @@ private function calculateNumberOfColumns() return; } - $columns = array(0); + $columns = [0]; foreach (array_merge($this->headers, $this->rows) as $row) { if ($row instanceof TableSeparator) { continue; @@ -413,7 +416,7 @@ private function calculateNumberOfColumns() private function buildTableRows($rows) { - $unmergedRows = array(); + $unmergedRows = []; for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) { $rows = $this->fillNextRows($rows, $rowKey); @@ -425,7 +428,7 @@ private function buildTableRows($rows) $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell)); foreach ($lines as $lineKey => $line) { if ($cell instanceof TableCell) { - $line = new TableCell($line, array('colspan' => $cell->getColspan())); + $line = new TableCell($line, ['colspan' => $cell->getColspan()]); } if (0 === $lineKey) { $rows[$rowKey][$column] = $line; @@ -436,7 +439,7 @@ private function buildTableRows($rows) } } - $tableRows = array(); + $tableRows = []; foreach ($rows as $rowKey => $row) { $tableRows[] = $this->fillCells($row); if (isset($unmergedRows[$rowKey])) { @@ -459,27 +462,27 @@ private function buildTableRows($rows) */ private function fillNextRows(array $rows, $line) { - $unmergedRows = array(); + $unmergedRows = []; foreach ($rows[$line] as $column => $cell) { if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) { throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing __toString, %s given.', \gettype($cell))); } if ($cell instanceof TableCell && $cell->getRowspan() > 1) { $nbLines = $cell->getRowspan() - 1; - $lines = array($cell); + $lines = [$cell]; if (strstr($cell, "\n")) { $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell)); $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines; - $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan())); + $rows[$line][$column] = new TableCell($lines[0], ['colspan' => $cell->getColspan()]); unset($lines[0]); } // create a two dimensional array (rowspan x colspan) - $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows); + $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows); foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : ''; - $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan())); + $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, ['colspan' => $cell->getColspan()]); if ($nbLines === $unmergedRowKey - $line) { break; } @@ -492,7 +495,7 @@ private function fillNextRows(array $rows, $line) if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) { foreach ($unmergedRow as $cellKey => $cell) { // insert cell into row at cellKey position - array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell)); + array_splice($rows[$unmergedRowKey], $cellKey, 0, [$cell]); } } else { $row = $this->copyRow($rows, $unmergedRowKey - 1); @@ -501,7 +504,7 @@ private function fillNextRows(array $rows, $line) $row[$column] = $unmergedRow[$column]; } } - array_splice($rows, $unmergedRowKey, 0, array($row)); + array_splice($rows, $unmergedRowKey, 0, [$row]); } } @@ -515,7 +518,7 @@ private function fillNextRows(array $rows, $line) */ private function fillCells($row) { - $newRow = array(); + $newRow = []; foreach ($row as $column => $cell) { $newRow[] = $cell; if ($cell instanceof TableCell && $cell->getColspan() > 1) { @@ -541,7 +544,7 @@ private function copyRow(array $rows, $line) foreach ($row as $cellKey => $cellValue) { $row[$cellKey] = ''; if ($cellValue instanceof TableCell) { - $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan())); + $row[$cellKey] = new TableCell('', ['colspan' => $cellValue->getColspan()]); } } @@ -587,7 +590,7 @@ private function getRowColumns(array $row) private function calculateColumnsWidth(array $rows) { for ($column = 0; $column < $this->numberOfColumns; ++$column) { - $lengths = array(); + $lengths = []; foreach ($rows as $row) { if ($row instanceof TableSeparator) { continue; @@ -609,7 +612,7 @@ private function calculateColumnsWidth(array $rows) $lengths[] = $this->getCellWidth($row, $column); } - $this->effectiveColumnWidths[$column] = max($lengths) + \strlen($this->style->getCellRowContentFormat()) - 2; + $this->effectiveColumnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2; } } @@ -620,7 +623,7 @@ private function calculateColumnsWidth(array $rows) */ private function getColumnSeparatorWidth() { - return \strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar())); + return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar())); } /** @@ -650,7 +653,7 @@ private function getCellWidth(array $row, $column) */ private function cleanup() { - $this->effectiveColumnWidths = array(); + $this->effectiveColumnWidths = []; $this->numberOfColumns = null; } @@ -679,12 +682,12 @@ private static function initStyles() ->setCellHeaderFormat('%s') ; - return array( + return [ 'default' => new TableStyle(), 'borderless' => $borderless, 'compact' => $compact, 'symfony-style-guide' => $styleGuide, - ); + ]; } private function resolveStyle($name) diff --git a/vendor/symfony/console/Helper/TableCell.php b/vendor/symfony/console/Helper/TableCell.php index fb6c9fd37e1c7efcc07d87492f263d49eacb8a0c..cc5145329c188e869fecdf7fee23120baa2a849e 100644 --- a/vendor/symfony/console/Helper/TableCell.php +++ b/vendor/symfony/console/Helper/TableCell.php @@ -19,16 +19,16 @@ class TableCell { private $value; - private $options = array( + private $options = [ 'rowspan' => 1, 'colspan' => 1, - ); + ]; /** * @param string $value * @param array $options */ - public function __construct($value = '', array $options = array()) + public function __construct($value = '', array $options = []) { if (is_numeric($value) && !\is_string($value)) { $value = (string) $value; diff --git a/vendor/symfony/console/Helper/TableSeparator.php b/vendor/symfony/console/Helper/TableSeparator.php index c7b8dc9c22339bedf839087cab8d6b1a5fd9d1dc..e541c53156017fc16a0b3e2d3741014ecc37832e 100644 --- a/vendor/symfony/console/Helper/TableSeparator.php +++ b/vendor/symfony/console/Helper/TableSeparator.php @@ -18,7 +18,7 @@ */ class TableSeparator extends TableCell { - public function __construct(array $options = array()) + public function __construct(array $options = []) { parent::__construct('', $options); } diff --git a/vendor/symfony/console/Helper/TableStyle.php b/vendor/symfony/console/Helper/TableStyle.php index 117e311ebe950187fbcee38adbe68b78bdcf1576..bc9c7e94dbbd9fbaa15e3e60e689089208407e7d 100644 --- a/vendor/symfony/console/Helper/TableStyle.php +++ b/vendor/symfony/console/Helper/TableStyle.php @@ -125,7 +125,7 @@ public function setCrossingChar($crossingChar) /** * Gets crossing character. * - * @return string $crossingChar + * @return string */ public function getCrossingChar() { @@ -237,7 +237,7 @@ public function getBorderFormat() */ public function setPadType($padType) { - if (!\in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) { + if (!\in_array($padType, [STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH], true)) { throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).'); } diff --git a/vendor/symfony/console/Input/ArgvInput.php b/vendor/symfony/console/Input/ArgvInput.php index 213377279841265cb21737646969e88c51083332..f604057ec02551dfe25686c373083907a7252753 100644 --- a/vendor/symfony/console/Input/ArgvInput.php +++ b/vendor/symfony/console/Input/ArgvInput.php @@ -121,7 +121,8 @@ private function parseShortOptionSet($name) $len = \strlen($name); for ($i = 0; $i < $len; ++$i) { if (!$this->definition->hasShortcut($name[$i])) { - throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i])); + $encoding = mb_detect_encoding($name, null, true); + throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding))); } $option = $this->definition->getOptionForShortcut($name[$i]); @@ -173,7 +174,7 @@ private function parseArgument($token) // if input is expecting another argument, add it if ($this->definition->hasArgument($c)) { $arg = $this->definition->getArgument($c); - $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token; + $this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token; // if last argument isArray(), append token to last argument } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) { @@ -228,11 +229,11 @@ private function addLongOption($name, $value) throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name)); } - if (\in_array($value, array('', null), true) && $option->acceptValue() && \count($this->parsed)) { + if (\in_array($value, ['', null], true) && $option->acceptValue() && \count($this->parsed)) { // if option accepts an optional or mandatory argument // let's see if there is one provided $next = array_shift($this->parsed); - if ((isset($next[0]) && '-' !== $next[0]) || \in_array($next, array('', null), true)) { + if ((isset($next[0]) && '-' !== $next[0]) || \in_array($next, ['', null], true)) { $value = $next; } else { array_unshift($this->parsed, $next); @@ -261,8 +262,27 @@ private function addLongOption($name, $value) */ public function getFirstArgument() { - foreach ($this->tokens as $token) { + $isOption = false; + foreach ($this->tokens as $i => $token) { if ($token && '-' === $token[0]) { + if (false !== strpos($token, '=') || !isset($this->tokens[$i + 1])) { + continue; + } + + // If it's a long option, consider that everything after "--" is the option name. + // Otherwise, use the last char (if it's a short option set, only the last one can take a value with space separator) + $name = '-' === $token[1] ? substr($token, 2) : substr($token, -1); + if (!isset($this->options[$name]) && !$this->definition->hasShortcut($name)) { + // noop + } elseif ((isset($this->options[$name]) || isset($this->options[$name = $this->definition->shortcutToName($name)])) && $this->tokens[$i + 1] === $this->options[$name]) { + $isOption = true; + } + + continue; + } + + if ($isOption) { + $isOption = false; continue; } diff --git a/vendor/symfony/console/Input/ArrayInput.php b/vendor/symfony/console/Input/ArrayInput.php index 8b6917fc7c09d8002cf615e5a0e8fb963f350b6a..44c2f0d5c66aac7f1a5393ea3dce70fdaa304c20 100644 --- a/vendor/symfony/console/Input/ArrayInput.php +++ b/vendor/symfony/console/Input/ArrayInput.php @@ -19,7 +19,7 @@ * * Usage: * - * $input = new ArrayInput(array('name' => 'foo', '--bar' => 'foobar')); + * $input = new ArrayInput(['command' => 'foo:bar', 'foo' => 'bar', '--bar' => 'foobar']); * * @author Fabien Potencier <fabien@symfony.com> */ @@ -103,7 +103,7 @@ public function getParameterOption($values, $default = false, $onlyParams = fals */ public function __toString() { - $params = array(); + $params = []; foreach ($this->parameters as $param => $val) { if ($param && '-' === $param[0]) { if (\is_array($val)) { @@ -114,7 +114,7 @@ public function __toString() $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); } } else { - $params[] = \is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val); + $params[] = \is_array($val) ? implode(' ', array_map([$this, 'escapeToken'], $val)) : $this->escapeToken($val); } } diff --git a/vendor/symfony/console/Input/Input.php b/vendor/symfony/console/Input/Input.php index fa5644d1fdbaf58d037e1122e4855ae4428559e4..c1220316dcfff6e99bcc67463d42b2f889cc0b2b 100644 --- a/vendor/symfony/console/Input/Input.php +++ b/vendor/symfony/console/Input/Input.php @@ -29,8 +29,8 @@ abstract class Input implements InputInterface, StreamableInputInterface { protected $definition; protected $stream; - protected $options = array(); - protected $arguments = array(); + protected $options = []; + protected $arguments = []; protected $interactive = true; public function __construct(InputDefinition $definition = null) @@ -48,8 +48,8 @@ public function __construct(InputDefinition $definition = null) */ public function bind(InputDefinition $definition) { - $this->arguments = array(); - $this->options = array(); + $this->arguments = []; + $this->options = []; $this->definition = $definition; $this->parse(); @@ -69,7 +69,7 @@ public function validate() $givenArguments = $this->arguments; $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) { - return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired(); + return !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired(); }); if (\count($missingArguments) > 0) { @@ -150,7 +150,7 @@ public function getOption($name) throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); } - return array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault(); + return \array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault(); } /** diff --git a/vendor/symfony/console/Input/InputArgument.php b/vendor/symfony/console/Input/InputArgument.php index d4c5e35627ab39b5a14e1a5c8e40088bd4392b57..4c2b6a66cac1d47872f154b758bd4e1bbae523e6 100644 --- a/vendor/symfony/console/Input/InputArgument.php +++ b/vendor/symfony/console/Input/InputArgument.php @@ -31,10 +31,10 @@ class InputArgument private $description; /** - * @param string $name The argument name - * @param int $mode The argument mode: self::REQUIRED or self::OPTIONAL - * @param string $description A description text - * @param mixed $default The default value (for self::OPTIONAL mode only) + * @param string $name The argument name + * @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL + * @param string $description A description text + * @param string|string[]|null $default The default value (for self::OPTIONAL mode only) * * @throws InvalidArgumentException When argument mode is not valid */ @@ -86,7 +86,7 @@ public function isArray() /** * Sets the default value. * - * @param mixed $default The default value + * @param string|string[]|null $default The default value * * @throws LogicException When incorrect default value is given */ @@ -98,7 +98,7 @@ public function setDefault($default = null) if ($this->isArray()) { if (null === $default) { - $default = array(); + $default = []; } elseif (!\is_array($default)) { throw new LogicException('A default value for an array argument must be an array.'); } @@ -110,7 +110,7 @@ public function setDefault($default = null) /** * Returns the default value. * - * @return mixed The default value + * @return string|string[]|null The default value */ public function getDefault() { diff --git a/vendor/symfony/console/Input/InputAwareInterface.php b/vendor/symfony/console/Input/InputAwareInterface.php index d0f11e986a3b8d243e92277d59de809b866aae99..5a288de5d45fa88bb0f7c3924280afc918f97404 100644 --- a/vendor/symfony/console/Input/InputAwareInterface.php +++ b/vendor/symfony/console/Input/InputAwareInterface.php @@ -21,8 +21,6 @@ interface InputAwareInterface { /** * Sets the Console Input. - * - * @param InputInterface */ public function setInput(InputInterface $input); } diff --git a/vendor/symfony/console/Input/InputDefinition.php b/vendor/symfony/console/Input/InputDefinition.php index 940cbf3b9ecaddd554730f59016e0eedeaae7fa6..53f41d73f5ce247e677c448cbe5c10a62e6b60ed 100644 --- a/vendor/symfony/console/Input/InputDefinition.php +++ b/vendor/symfony/console/Input/InputDefinition.php @@ -19,10 +19,10 @@ * * Usage: * - * $definition = new InputDefinition(array( - * new InputArgument('name', InputArgument::REQUIRED), - * new InputOption('foo', 'f', InputOption::VALUE_REQUIRED), - * )); + * $definition = new InputDefinition([ + * new InputArgument('name', InputArgument::REQUIRED), + * new InputOption('foo', 'f', InputOption::VALUE_REQUIRED), + * ]); * * @author Fabien Potencier <fabien@symfony.com> */ @@ -38,7 +38,7 @@ class InputDefinition /** * @param array $definition An array of InputArgument and InputOption instance */ - public function __construct(array $definition = array()) + public function __construct(array $definition = []) { $this->setDefinition($definition); } @@ -48,8 +48,8 @@ public function __construct(array $definition = array()) */ public function setDefinition(array $definition) { - $arguments = array(); - $options = array(); + $arguments = []; + $options = []; foreach ($definition as $item) { if ($item instanceof InputOption) { $options[] = $item; @@ -67,9 +67,9 @@ public function setDefinition(array $definition) * * @param InputArgument[] $arguments An array of InputArgument objects */ - public function setArguments($arguments = array()) + public function setArguments($arguments = []) { - $this->arguments = array(); + $this->arguments = []; $this->requiredCount = 0; $this->hasOptional = false; $this->hasAnArrayArgument = false; @@ -81,7 +81,7 @@ public function setArguments($arguments = array()) * * @param InputArgument[] $arguments An array of InputArgument objects */ - public function addArguments($arguments = array()) + public function addArguments($arguments = []) { if (null !== $arguments) { foreach ($arguments as $argument) { @@ -191,7 +191,7 @@ public function getArgumentRequiredCount() */ public function getArgumentDefaults() { - $values = array(); + $values = []; foreach ($this->arguments as $argument) { $values[$argument->getName()] = $argument->getDefault(); } @@ -204,10 +204,10 @@ public function getArgumentDefaults() * * @param InputOption[] $options An array of InputOption objects */ - public function setOptions($options = array()) + public function setOptions($options = []) { - $this->options = array(); - $this->shortcuts = array(); + $this->options = []; + $this->shortcuts = []; $this->addOptions($options); } @@ -216,7 +216,7 @@ public function setOptions($options = array()) * * @param InputOption[] $options An array of InputOption objects */ - public function addOptions($options = array()) + public function addOptions($options = []) { foreach ($options as $option) { $this->addOption($option); @@ -322,7 +322,7 @@ public function getOptionForShortcut($shortcut) */ public function getOptionDefaults() { - $values = array(); + $values = []; foreach ($this->options as $option) { $values[$option->getName()] = $option->getDefault(); } @@ -338,8 +338,10 @@ public function getOptionDefaults() * @return string The InputOption name * * @throws InvalidArgumentException When option given does not exist + * + * @internal */ - private function shortcutToName($shortcut) + public function shortcutToName($shortcut) { if (!isset($this->shortcuts[$shortcut])) { throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut)); @@ -357,7 +359,7 @@ private function shortcutToName($shortcut) */ public function getSynopsis($short = false) { - $elements = array(); + $elements = []; if ($short && $this->getOptions()) { $elements[] = '[options]'; @@ -387,7 +389,7 @@ public function getSynopsis($short = false) if (!$argument->isRequired()) { $element = '['.$element.']'; } elseif ($argument->isArray()) { - $element = $element.' ('.$element.')'; + $element .= ' ('.$element.')'; } if ($argument->isArray()) { diff --git a/vendor/symfony/console/Input/InputInterface.php b/vendor/symfony/console/Input/InputInterface.php index 43810f7ac21bd4d8a722650dbe06790b4bc0d89d..b9bcf3bbcd96dea8cbb7aeda9c6d6bfbfde1bd68 100644 --- a/vendor/symfony/console/Input/InputInterface.php +++ b/vendor/symfony/console/Input/InputInterface.php @@ -61,6 +61,8 @@ public function getParameterOption($values, $default = false, $onlyParams = fals /** * Binds the current Input instance with the given arguments and options. + * + * @throws RuntimeException */ public function bind(InputDefinition $definition); @@ -83,7 +85,7 @@ public function getArguments(); * * @param string $name The argument name * - * @return mixed The argument value + * @return string|string[]|null The argument value * * @throws InvalidArgumentException When argument given doesn't exist */ @@ -92,8 +94,8 @@ public function getArgument($name); /** * Sets an argument value by name. * - * @param string $name The argument name - * @param string $value The argument value + * @param string $name The argument name + * @param string|string[]|null $value The argument value * * @throws InvalidArgumentException When argument given doesn't exist */ @@ -120,7 +122,7 @@ public function getOptions(); * * @param string $name The option name * - * @return mixed The option value + * @return string|string[]|bool|null The option value * * @throws InvalidArgumentException When option given doesn't exist */ @@ -129,8 +131,8 @@ public function getOption($name); /** * Sets an option value by name. * - * @param string $name The option name - * @param string|bool $value The option value + * @param string $name The option name + * @param string|string[]|bool|null $value The option value * * @throws InvalidArgumentException When option given doesn't exist */ diff --git a/vendor/symfony/console/Input/InputOption.php b/vendor/symfony/console/Input/InputOption.php index 9567876c8ace98430f1c6d1b6532bef8662ce1cd..b0bd28f516026b95ff06c703d212cafe01a7d6d4 100644 --- a/vendor/symfony/console/Input/InputOption.php +++ b/vendor/symfony/console/Input/InputOption.php @@ -33,11 +33,11 @@ class InputOption private $description; /** - * @param string $name The option name - * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int $mode The option mode: One of the VALUE_* constants - * @param string $description A description text - * @param mixed $default The default value (must be null for self::VALUE_NONE) + * @param string $name The option name + * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the VALUE_* constants + * @param string $description A description text + * @param string|string[]|int|bool|null $default The default value (must be null for self::VALUE_NONE) * * @throws InvalidArgumentException If option mode is invalid or incompatible */ @@ -89,7 +89,7 @@ public function __construct($name, $shortcut = null, $mode = null, $description /** * Returns the option shortcut. * - * @return string The shortcut + * @return string|null The shortcut */ public function getShortcut() { @@ -149,7 +149,7 @@ public function isArray() /** * Sets the default value. * - * @param mixed $default The default value + * @param string|string[]|int|bool|null $default The default value * * @throws LogicException When incorrect default value is given */ @@ -161,7 +161,7 @@ public function setDefault($default = null) if ($this->isArray()) { if (null === $default) { - $default = array(); + $default = []; } elseif (!\is_array($default)) { throw new LogicException('A default value for an array option must be an array.'); } @@ -173,7 +173,7 @@ public function setDefault($default = null) /** * Returns the default value. * - * @return mixed The default value + * @return string|string[]|int|bool|null The default value */ public function getDefault() { diff --git a/vendor/symfony/console/Input/StringInput.php b/vendor/symfony/console/Input/StringInput.php index eb39ad692778612aa7f5c77c97cf395210dd04a8..32d270faf183853f1faa0575031d34121cdabf91 100644 --- a/vendor/symfony/console/Input/StringInput.php +++ b/vendor/symfony/console/Input/StringInput.php @@ -32,7 +32,7 @@ class StringInput extends ArgvInput */ public function __construct($input) { - parent::__construct(array()); + parent::__construct([]); $this->setTokens($this->tokenize($input)); } @@ -48,13 +48,13 @@ public function __construct($input) */ private function tokenize($input) { - $tokens = array(); + $tokens = []; $length = \strlen($input); $cursor = 0; while ($cursor < $length) { if (preg_match('/\s+/A', $input, $match, null, $cursor)) { } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) { - $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2))); + $tokens[] = $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, \strlen($match[3]) - 2))); } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) { $tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2)); } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) { diff --git a/vendor/symfony/console/LICENSE b/vendor/symfony/console/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/console/LICENSE +++ b/vendor/symfony/console/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/console/Logger/ConsoleLogger.php b/vendor/symfony/console/Logger/ConsoleLogger.php index ea7f9bf250d54643352eed93de98162352f96ec3..e531bb1ca56ce8c6db2a8c2c2c9dd3513c2091e7 100644 --- a/vendor/symfony/console/Logger/ConsoleLogger.php +++ b/vendor/symfony/console/Logger/ConsoleLogger.php @@ -30,7 +30,7 @@ class ConsoleLogger extends AbstractLogger const ERROR = 'error'; private $output; - private $verbosityLevelMap = array( + private $verbosityLevelMap = [ LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL, LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL, LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL, @@ -39,8 +39,8 @@ class ConsoleLogger extends AbstractLogger LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE, LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE, LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG, - ); - private $formatLevelMap = array( + ]; + private $formatLevelMap = [ LogLevel::EMERGENCY => self::ERROR, LogLevel::ALERT => self::ERROR, LogLevel::CRITICAL => self::ERROR, @@ -49,10 +49,10 @@ class ConsoleLogger extends AbstractLogger LogLevel::NOTICE => self::INFO, LogLevel::INFO => self::INFO, LogLevel::DEBUG => self::INFO, - ); + ]; private $errored = false; - public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array()) + public function __construct(OutputInterface $output, array $verbosityLevelMap = [], array $formatLevelMap = []) { $this->output = $output; $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap; @@ -62,7 +62,7 @@ public function __construct(OutputInterface $output, array $verbosityLevelMap = /** * {@inheritdoc} */ - public function log($level, $message, array $context = array()) + public function log($level, $message, array $context = []) { if (!isset($this->verbosityLevelMap[$level])) { throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level)); @@ -111,7 +111,7 @@ private function interpolate($message, array $context) return $message; } - $replacements = array(); + $replacements = []; foreach ($context as $key => $val) { if (null === $val || is_scalar($val) || (\is_object($val) && method_exists($val, '__toString'))) { $replacements["{{$key}}"] = $val; diff --git a/vendor/symfony/console/Output/ConsoleOutput.php b/vendor/symfony/console/Output/ConsoleOutput.php index 3cb0fb1aeb4f3c789c1013be877eccfa6f85c736..61dc7cbdca93277f00323e279f4cc7586fd87507 100644 --- a/vendor/symfony/console/Output/ConsoleOutput.php +++ b/vendor/symfony/console/Output/ConsoleOutput.php @@ -121,11 +121,11 @@ protected function hasStderrSupport() */ private function isRunningOS400() { - $checks = array( + $checks = [ \function_exists('php_uname') ? php_uname('s') : '', getenv('OSTYPE'), PHP_OS, - ); + ]; return false !== stripos(implode(';', $checks), 'OS400'); } diff --git a/vendor/symfony/console/Output/StreamOutput.php b/vendor/symfony/console/Output/StreamOutput.php index 20f45082836f646ba37b0538a2ff48703c9386c7..7ff602763e9da2d144c9f2290536a8bad56172e7 100644 --- a/vendor/symfony/console/Output/StreamOutput.php +++ b/vendor/symfony/console/Output/StreamOutput.php @@ -20,11 +20,11 @@ * * Usage: * - * $output = new StreamOutput(fopen('php://stdout', 'w')); + * $output = new StreamOutput(fopen('php://stdout', 'w')); * * As `StreamOutput` can use any stream, you can also use a file: * - * $output = new StreamOutput(fopen('/path/to/output.log', 'a', false)); + * $output = new StreamOutput(fopen('/path/to/output.log', 'a', false)); * * @author Fabien Potencier <fabien@symfony.com> */ @@ -70,7 +70,11 @@ public function getStream() */ protected function doWrite($message, $newline) { - if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) { + if ($newline) { + $message .= PHP_EOL; + } + + if (false === @fwrite($this->stream, $message)) { // should never happen throw new RuntimeException('Unable to write output.'); } diff --git a/vendor/symfony/console/Question/ChoiceQuestion.php b/vendor/symfony/console/Question/ChoiceQuestion.php index 0a45d74932522920dee37a4897d83e883343d2ad..5cb5056903e43d7a786da65dd2219ff8eb5c5dcc 100644 --- a/vendor/symfony/console/Question/ChoiceQuestion.php +++ b/vendor/symfony/console/Question/ChoiceQuestion.php @@ -144,12 +144,12 @@ private function getDefaultValidator() } $selectedChoices = explode(',', $selectedChoices); } else { - $selectedChoices = array($selected); + $selectedChoices = [$selected]; } - $multiselectChoices = array(); + $multiselectChoices = []; foreach ($selectedChoices as $value) { - $results = array(); + $results = []; foreach ($choices as $key => $choice) { if ($choice === $value) { $results[] = $key; diff --git a/vendor/symfony/console/Question/ConfirmationQuestion.php b/vendor/symfony/console/Question/ConfirmationQuestion.php index 150ab27f303be10fc649e81c654b0ef6c66b5f77..d871fb8a79b0b51ec0d95827553e0d984f0b289b 100644 --- a/vendor/symfony/console/Question/ConfirmationQuestion.php +++ b/vendor/symfony/console/Question/ConfirmationQuestion.php @@ -53,7 +53,7 @@ private function getDefaultNormalizer() return $answer && $answerIsTrue; } - return !$answer || $answerIsTrue; + return '' === $answer || $answerIsTrue; }; } } diff --git a/vendor/symfony/console/Question/Question.php b/vendor/symfony/console/Question/Question.php index 2ca95ac93497992824d2a89175481e6064b88e38..92b9b69362913c11a15e40298ab8ecfb68f17516 100644 --- a/vendor/symfony/console/Question/Question.php +++ b/vendor/symfony/console/Question/Question.php @@ -117,7 +117,7 @@ public function setHiddenFallback($fallback) /** * Gets values for the autocompleter. * - * @return null|iterable + * @return iterable|null */ public function getAutocompleterValues() { @@ -127,7 +127,7 @@ public function getAutocompleterValues() /** * Sets values for the autocompleter. * - * @param null|iterable $values + * @param iterable|null $values * * @return $this * @@ -156,7 +156,7 @@ public function setAutocompleterValues($values) /** * Sets a validator for the question. * - * @param null|callable $validator + * @param callable|null $validator * * @return $this */ @@ -170,7 +170,7 @@ public function setValidator(callable $validator = null) /** * Gets the validator for the question. * - * @return null|callable + * @return callable|null */ public function getValidator() { @@ -182,7 +182,7 @@ public function getValidator() * * Null means an unlimited number of attempts. * - * @param null|int $attempts + * @param int|null $attempts * * @return $this * @@ -204,7 +204,7 @@ public function setMaxAttempts($attempts) * * Null means an unlimited number of attempts. * - * @return null|int + * @return int|null */ public function getMaxAttempts() { diff --git a/vendor/symfony/console/Style/SymfonyStyle.php b/vendor/symfony/console/Style/SymfonyStyle.php index e74ab66270a146a1c380963413c06f0ceffa967f..e0ced01b22744593d8d9898c86aff72233ad174a 100644 --- a/vendor/symfony/console/Style/SymfonyStyle.php +++ b/vendor/symfony/console/Style/SymfonyStyle.php @@ -63,7 +63,7 @@ public function __construct(InputInterface $input, OutputInterface $output) */ public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = true) { - $messages = \is_array($messages) ? array_values($messages) : array($messages); + $messages = \is_array($messages) ? array_values($messages) : [$messages]; $this->autoPrependBlock(); $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape)); @@ -76,10 +76,10 @@ public function block($messages, $type = null, $style = null, $prefix = ' ', $pa public function title($message) { $this->autoPrependBlock(); - $this->writeln(array( + $this->writeln([ sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)), sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))), - )); + ]); $this->newLine(); } @@ -89,10 +89,10 @@ public function title($message) public function section($message) { $this->autoPrependBlock(); - $this->writeln(array( + $this->writeln([ sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)), sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))), - )); + ]); $this->newLine(); } @@ -117,7 +117,7 @@ public function text($message) { $this->autoPrependText(); - $messages = \is_array($message) ? array_values($message) : array($message); + $messages = \is_array($message) ? array_values($message) : [$message]; foreach ($messages as $message) { $this->writeln(sprintf(' %s', $message)); } @@ -376,14 +376,14 @@ private function reduceBuffer($messages) // Preserve the last 4 chars inserted (PHP_EOL on windows is two chars) in the history buffer return array_map(function ($value) { return substr($value, -4); - }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages)); + }, array_merge([$this->bufferedOutput->fetch()], (array) $messages)); } private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false) { $indentLength = 0; $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix); - $lines = array(); + $lines = []; if (null !== $type) { $type = sprintf('[%s] ', $type); diff --git a/vendor/symfony/console/Terminal.php b/vendor/symfony/console/Terminal.php index 3930ca0cdc8e2ebf7fe7af39117fcf49c1c50359..456cca11ca8a6ca02b3301890961698d7b1a491f 100644 --- a/vendor/symfony/console/Terminal.php +++ b/vendor/symfony/console/Terminal.php @@ -91,11 +91,11 @@ private static function getConsoleMode() return; } - $descriptorspec = array( - 1 => array('pipe', 'w'), - 2 => array('pipe', 'w'), - ); - $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true)); + $descriptorspec = [ + 1 => ['pipe', 'w'], + 2 => ['pipe', 'w'], + ]; + $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); if (\is_resource($process)) { $info = stream_get_contents($pipes[1]); fclose($pipes[1]); @@ -103,7 +103,7 @@ private static function getConsoleMode() proc_close($process); if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { - return array((int) $matches[2], (int) $matches[1]); + return [(int) $matches[2], (int) $matches[1]]; } } } @@ -119,12 +119,12 @@ private static function getSttyColumns() return; } - $descriptorspec = array( - 1 => array('pipe', 'w'), - 2 => array('pipe', 'w'), - ); + $descriptorspec = [ + 1 => ['pipe', 'w'], + 2 => ['pipe', 'w'], + ]; - $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true)); + $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); if (\is_resource($process)) { $info = stream_get_contents($pipes[1]); fclose($pipes[1]); diff --git a/vendor/symfony/console/Tester/ApplicationTester.php b/vendor/symfony/console/Tester/ApplicationTester.php index c0f8c7207f2a8a117838736093c76a478a23185f..dc970182ecae6cfa98fe6c4cf18abca6280b2aa0 100644 --- a/vendor/symfony/console/Tester/ApplicationTester.php +++ b/vendor/symfony/console/Tester/ApplicationTester.php @@ -59,14 +59,14 @@ public function __construct(Application $application) * * @return int The command exit code */ - public function run(array $input, $options = array()) + public function run(array $input, $options = []) { $this->input = new ArrayInput($input); if (isset($options['interactive'])) { $this->input->setInteractive($options['interactive']); } - $this->captureStreamsIndependently = array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately']; + $this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately']; if (!$this->captureStreamsIndependently) { $this->output = new StreamOutput(fopen('php://memory', 'w', false)); if (isset($options['decorated'])) { diff --git a/vendor/symfony/console/Tester/CommandTester.php b/vendor/symfony/console/Tester/CommandTester.php index 131ca9b160e9df12350b32f4f60c673a6426f993..f869995eb92d6623ceda0f83b24c4aa82de2c020 100644 --- a/vendor/symfony/console/Tester/CommandTester.php +++ b/vendor/symfony/console/Tester/CommandTester.php @@ -28,7 +28,7 @@ class CommandTester private $command; private $input; private $output; - private $inputs = array(); + private $inputs = []; private $statusCode; public function __construct(Command $command) @@ -50,7 +50,7 @@ public function __construct(Command $command) * * @return int The command exit code */ - public function execute(array $input, array $options = array()) + public function execute(array $input, array $options = []) { // set the command name automatically if the application requires // this argument and no command name was passed @@ -58,13 +58,12 @@ public function execute(array $input, array $options = array()) && (null !== $application = $this->command->getApplication()) && $application->getDefinition()->hasArgument('command') ) { - $input = array_merge(array('command' => $this->command->getName()), $input); + $input = array_merge(['command' => $this->command->getName()], $input); } $this->input = new ArrayInput($input); - if ($this->inputs) { - $this->input->setStream(self::createStream($this->inputs)); - } + // Use an in-memory input stream even if no inputs are set so that QuestionHelper::ask() does not rely on the blocking STDIN. + $this->input->setStream(self::createStream($this->inputs)); if (isset($options['interactive'])) { $this->input->setInteractive($options['interactive']); @@ -148,7 +147,10 @@ private static function createStream(array $inputs) { $stream = fopen('php://memory', 'r+', false); - fwrite($stream, implode(PHP_EOL, $inputs)); + foreach ($inputs as $input) { + fwrite($stream, $input.PHP_EOL); + } + rewind($stream); return $stream; diff --git a/vendor/symfony/console/Tests/ApplicationTest.php b/vendor/symfony/console/Tests/ApplicationTest.php index 3c3b1284d018aaad48a129b2fa4abb7223fd0e6d..ae9d130f502ab1eb3db112ae76a5ae8e6da77e49 100644 --- a/vendor/symfony/console/Tests/ApplicationTest.php +++ b/vendor/symfony/console/Tests/ApplicationTest.php @@ -83,7 +83,7 @@ public function testConstructor() $application = new Application('foo', 'bar'); $this->assertEquals('foo', $application->getName(), '__construct() takes the application name as its first argument'); $this->assertEquals('bar', $application->getVersion(), '__construct() takes the application version as its second argument'); - $this->assertEquals(array('help', 'list'), array_keys($application->all()), '__construct() registered the help and list commands by default'); + $this->assertEquals(['help', 'list'], array_keys($application->all()), '__construct() registered the help and list commands by default'); } public function testSetGetName() @@ -133,9 +133,9 @@ public function testAllWithCommandLoader() $commands = $application->all('foo'); $this->assertCount(1, $commands, '->all() takes a namespace as its first argument'); - $application->setCommandLoader(new FactoryCommandLoader(array( + $application->setCommandLoader(new FactoryCommandLoader([ 'foo:bar1' => function () { return new \Foo1Command(); }, - ))); + ])); $commands = $application->all('foo'); $this->assertCount(2, $commands, '->all() takes a namespace as its first argument'); $this->assertInstanceOf(\FooCommand::class, $commands['foo:bar'], '->all() returns the registered commands'); @@ -157,9 +157,9 @@ public function testAdd() $this->assertEquals($foo, $commands['foo:bar'], '->add() registers a command'); $application = new Application(); - $application->addCommands(array($foo = new \FooCommand(), $foo1 = new \Foo1Command())); + $application->addCommands([$foo = new \FooCommand(), $foo1 = new \Foo1Command()]); $commands = $application->all(); - $this->assertEquals(array($foo, $foo1), array($commands['foo:bar'], $commands['foo:bar1']), '->addCommands() registers an array of commands'); + $this->assertEquals([$foo, $foo1], [$commands['foo:bar'], $commands['foo:bar1']], '->addCommands() registers an array of commands'); } /** @@ -205,9 +205,9 @@ public function testHasGetWithCommandLoader() $this->assertEquals($foo, $application->get('foo:bar'), '->get() returns a command by name'); $this->assertEquals($foo, $application->get('afoobar'), '->get() returns a command by alias'); - $application->setCommandLoader(new FactoryCommandLoader(array( + $application->setCommandLoader(new FactoryCommandLoader([ 'foo:bar1' => function () { return new \Foo1Command(); }, - ))); + ])); $this->assertTrue($application->has('afoobar'), '->has() returns true if an instance is registered for an alias even with command loader'); $this->assertEquals($foo, $application->get('foo:bar'), '->get() returns an instance by name even with command loader'); @@ -225,7 +225,7 @@ public function testSilentHelp() $application->setCatchExceptions(false); $tester = new ApplicationTester($application); - $tester->run(array('-h' => true, '-q' => true), array('decorated' => false)); + $tester->run(['-h' => true, '-q' => true], ['decorated' => false]); $this->assertEmpty($tester->getDisplay(true)); } @@ -245,7 +245,7 @@ public function testGetNamespaces() $application = new Application(); $application->add(new \FooCommand()); $application->add(new \Foo1Command()); - $this->assertEquals(array('foo'), $application->getNamespaces(), '->getNamespaces() returns an array of unique used namespaces'); + $this->assertEquals(['foo'], $application->getNamespaces(), '->getNamespaces() returns an array of unique used namespaces'); } public function testFindNamespace() @@ -367,9 +367,9 @@ public function testFindCaseInsensitiveSuggestions() public function testFindWithCommandLoader() { $application = new Application(); - $application->setCommandLoader(new FactoryCommandLoader(array( + $application->setCommandLoader(new FactoryCommandLoader([ 'foo:bar' => $f = function () { return new \FooCommand(); }, - ))); + ])); $this->assertInstanceOf('FooCommand', $application->find('foo:bar'), '->find() returns a command if its name exists'); $this->assertInstanceOf('Symfony\Component\Console\Command\HelpCommand', $application->find('h'), '->find() returns a command if its name exists'); @@ -400,23 +400,23 @@ public function testFindWithAmbiguousAbbreviations($abbreviation, $expectedExcep public function provideAmbiguousAbbreviations() { - return array( - array('f', 'Command "f" is not defined.'), - array( + return [ + ['f', 'Command "f" is not defined.'], + [ 'a', "Command \"a\" is ambiguous.\nDid you mean one of these?\n". " afoobar The foo:bar command\n". " afoobar1 The foo:bar1 command\n". ' afoobar2 The foo1:bar command', - ), - array( + ], + [ 'foo:b', "Command \"foo:b\" is ambiguous.\nDid you mean one of these?\n". " foo:bar The foo:bar command\n". " foo:bar1 The foo:bar1 command\n". ' foo1:bar The foo1:bar command', - ), - ); + ], + ]; } public function testFindCommandEqualNamespace() @@ -460,10 +460,10 @@ public function testFindAlternativeExceptionMessageSingle($name) public function provideInvalidCommandNamesSingle() { - return array( - array('foo3:barr'), - array('fooo3:bar'), - ); + return [ + ['foo3:barr'], + ['fooo3:bar'], + ]; } public function testFindAlternativeExceptionMessageMultiple() @@ -521,7 +521,7 @@ public function testFindAlternativeCommands() $this->fail('->find() throws a CommandNotFoundException if command does not exist'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e, '->find() throws a CommandNotFoundException if command does not exist'); - $this->assertSame(array(), $e->getAlternatives()); + $this->assertSame([], $e->getAlternatives()); $this->assertEquals(sprintf('Command "%s" is not defined.', $commandName), $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, without alternatives'); } @@ -532,7 +532,7 @@ public function testFindAlternativeCommands() $this->fail('->find() throws a CommandNotFoundException if command does not exist'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e, '->find() throws a CommandNotFoundException if command does not exist'); - $this->assertSame(array('afoobar1', 'foo:bar1'), $e->getAlternatives()); + $this->assertSame(['afoobar1', 'foo:bar1'], $e->getAlternatives()); $this->assertRegExp(sprintf('/Command "%s" is not defined./', $commandName), $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternatives'); $this->assertRegExp('/afoobar1/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternative : "afoobar1"'); $this->assertRegExp('/foo:bar1/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternative : "foo:bar1"'); @@ -543,7 +543,7 @@ public function testFindAlternativeCommands() public function testFindAlternativeCommandsWithAnAlias() { $fooCommand = new \FooCommand(); - $fooCommand->setAliases(array('foo2')); + $fooCommand->setAliases(['foo2']); $application = new Application(); $application->add($fooCommand); @@ -567,7 +567,7 @@ public function testFindAlternativeNamespace() $this->fail('->find() throws a CommandNotFoundException if namespace does not exist'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e, '->find() throws a CommandNotFoundException if namespace does not exist'); - $this->assertSame(array(), $e->getAlternatives()); + $this->assertSame([], $e->getAlternatives()); $this->assertEquals('There are no commands defined in the "Unknown-namespace" namespace.', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, without alternatives'); } @@ -596,7 +596,7 @@ public function testFindAlternativesOutput() $application->add(new \Foo2Command()); $application->add(new \Foo3Command()); - $expectedAlternatives = array( + $expectedAlternatives = [ 'afoobar', 'afoobar1', 'afoobar2', @@ -604,7 +604,7 @@ public function testFindAlternativesOutput() 'foo3:bar', 'foo:bar', 'foo:bar1', - ); + ]; try { $application->find('foo'); @@ -619,10 +619,10 @@ public function testFindAlternativesOutput() public function testFindNamespaceDoesNotFailOnDeepSimilarNamespaces() { - $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getNamespaces'))->getMock(); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(['getNamespaces'])->getMock(); $application->expects($this->once()) ->method('getNamespaces') - ->will($this->returnValue(array('foo:sublong', 'bar:sub'))); + ->will($this->returnValue(['foo:sublong', 'bar:sub'])); $this->assertEquals('foo:sublong', $application->findNamespace('f:sub')); } @@ -649,16 +649,16 @@ public function testSetCatchExceptions() $application->setCatchExceptions(true); $this->assertTrue($application->areExceptionsCaught()); - $tester->run(array('command' => 'foo'), array('decorated' => false)); + $tester->run(['command' => 'foo'], ['decorated' => false]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception1.txt', $tester->getDisplay(true), '->setCatchExceptions() sets the catch exception flag'); - $tester->run(array('command' => 'foo'), array('decorated' => false, 'capture_stderr_separately' => true)); + $tester->run(['command' => 'foo'], ['decorated' => false, 'capture_stderr_separately' => true]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception1.txt', $tester->getErrorOutput(true), '->setCatchExceptions() sets the catch exception flag'); $this->assertSame('', $tester->getDisplay(true)); $application->setCatchExceptions(false); try { - $tester->run(array('command' => 'foo'), array('decorated' => false)); + $tester->run(['command' => 'foo'], ['decorated' => false]); $this->fail('->setCatchExceptions() sets the catch exception flag'); } catch (\Exception $e) { $this->assertInstanceOf('\Exception', $e, '->setCatchExceptions() sets the catch exception flag'); @@ -682,29 +682,29 @@ public function testRenderException() putenv('COLUMNS=120'); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo'), array('decorated' => false, 'capture_stderr_separately' => true)); + $tester->run(['command' => 'foo'], ['decorated' => false, 'capture_stderr_separately' => true]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception1.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exception'); - $tester->run(array('command' => 'foo'), array('decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE, 'capture_stderr_separately' => true)); + $tester->run(['command' => 'foo'], ['decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE, 'capture_stderr_separately' => true]); $this->assertContains('Exception trace', $tester->getErrorOutput(), '->renderException() renders a pretty exception with a stack trace when verbosity is verbose'); - $tester->run(array('command' => 'list', '--foo' => true), array('decorated' => false, 'capture_stderr_separately' => true)); + $tester->run(['command' => 'list', '--foo' => true], ['decorated' => false, 'capture_stderr_separately' => true]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception2.txt', $tester->getErrorOutput(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command'); $application->add(new \Foo3Command()); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo3:bar'), array('decorated' => false, 'capture_stderr_separately' => true)); + $tester->run(['command' => 'foo3:bar'], ['decorated' => false, 'capture_stderr_separately' => true]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions'); - $tester->run(array('command' => 'foo3:bar'), array('decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE)); + $tester->run(['command' => 'foo3:bar'], ['decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]); $this->assertRegExp('/\[Exception\]\s*First exception/', $tester->getDisplay(), '->renderException() renders a pretty exception without code exception when code exception is default and verbosity is verbose'); $this->assertRegExp('/\[Exception\]\s*Second exception/', $tester->getDisplay(), '->renderException() renders a pretty exception without code exception when code exception is 0 and verbosity is verbose'); $this->assertRegExp('/\[Exception \(404\)\]\s*Third exception/', $tester->getDisplay(), '->renderException() renders a pretty exception with code exception when code exception is 404 and verbosity is verbose'); - $tester->run(array('command' => 'foo3:bar'), array('decorated' => true)); + $tester->run(['command' => 'foo3:bar'], ['decorated' => true]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); - $tester->run(array('command' => 'foo3:bar'), array('decorated' => true, 'capture_stderr_separately' => true)); + $tester->run(['command' => 'foo3:bar'], ['decorated' => true, 'capture_stderr_separately' => true]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3decorated.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions'); $application = new Application(); @@ -712,7 +712,7 @@ public function testRenderException() putenv('COLUMNS=32'); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo'), array('decorated' => false, 'capture_stderr_separately' => true)); + $tester->run(['command' => 'foo'], ['decorated' => false, 'capture_stderr_separately' => true]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception4.txt', $tester->getErrorOutput(true), '->renderException() wraps messages when they are bigger than the terminal'); putenv('COLUMNS=120'); } @@ -727,10 +727,10 @@ public function testRenderExceptionWithDoubleWidthCharacters() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo'), array('decorated' => false, 'capture_stderr_separately' => true)); + $tester->run(['command' => 'foo'], ['decorated' => false, 'capture_stderr_separately' => true]); $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_doublewidth1.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions'); - $tester->run(array('command' => 'foo'), array('decorated' => true, 'capture_stderr_separately' => true)); + $tester->run(['command' => 'foo'], ['decorated' => true, 'capture_stderr_separately' => true]); $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_doublewidth1decorated.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions'); $application = new Application(); @@ -740,7 +740,7 @@ public function testRenderExceptionWithDoubleWidthCharacters() throw new \Exception('コマンドの実行中にエラーが発生しました。'); }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo'), array('decorated' => false, 'capture_stderr_separately' => true)); + $tester->run(['command' => 'foo'], ['decorated' => false, 'capture_stderr_separately' => true]); $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_doublewidth2.txt', $tester->getErrorOutput(true), '->renderException() wraps messages when they are bigger than the terminal'); putenv('COLUMNS=120'); } @@ -755,14 +755,14 @@ public function testRenderExceptionEscapesLines() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo'), array('decorated' => false)); + $tester->run(['command' => 'foo'], ['decorated' => false]); $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_escapeslines.txt', $tester->getDisplay(true), '->renderException() escapes lines containing formatting'); putenv('COLUMNS=120'); } public function testRenderExceptionLineBreaks() { - $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getTerminalWidth'))->getMock(); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(['getTerminalWidth'])->getMock(); $application->setAutoExit(false); $application->expects($this->any()) ->method('getTerminalWidth') @@ -772,17 +772,31 @@ public function testRenderExceptionLineBreaks() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo'), array('decorated' => false)); + $tester->run(['command' => 'foo'], ['decorated' => false]); $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_linebreaks.txt', $tester->getDisplay(true), '->renderException() keep multiple line breaks'); } + public function testRenderExceptionStackTraceContainsRootException() + { + $application = new Application(); + $application->setAutoExit(false); + $application->register('foo')->setCode(function () { + throw new \Exception('Verbose exception'); + }); + + $tester = new ApplicationTester($application); + $tester->run(['command' => 'foo'], ['decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]); + + $this->assertContains(sprintf('() at %s:', __FILE__), $tester->getDisplay()); + } + public function testRun() { $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $application->add($command = new \Foo1Command()); - $_SERVER['argv'] = array('cli.php', 'foo:bar1'); + $_SERVER['argv'] = ['cli.php', 'foo:bar1']; ob_start(); $application->run(); @@ -798,63 +812,63 @@ public function testRun() $this->ensureStaticCommandHelp($application); $tester = new ApplicationTester($application); - $tester->run(array(), array('decorated' => false)); + $tester->run([], ['decorated' => false]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run1.txt', $tester->getDisplay(true), '->run() runs the list command if no argument is passed'); - $tester->run(array('--help' => true), array('decorated' => false)); + $tester->run(['--help' => true], ['decorated' => false]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run2.txt', $tester->getDisplay(true), '->run() runs the help command if --help is passed'); - $tester->run(array('-h' => true), array('decorated' => false)); + $tester->run(['-h' => true], ['decorated' => false]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run2.txt', $tester->getDisplay(true), '->run() runs the help command if -h is passed'); - $tester->run(array('command' => 'list', '--help' => true), array('decorated' => false)); + $tester->run(['command' => 'list', '--help' => true], ['decorated' => false]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run3.txt', $tester->getDisplay(true), '->run() displays the help if --help is passed'); - $tester->run(array('command' => 'list', '-h' => true), array('decorated' => false)); + $tester->run(['command' => 'list', '-h' => true], ['decorated' => false]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run3.txt', $tester->getDisplay(true), '->run() displays the help if -h is passed'); - $tester->run(array('--ansi' => true)); + $tester->run(['--ansi' => true]); $this->assertTrue($tester->getOutput()->isDecorated(), '->run() forces color output if --ansi is passed'); - $tester->run(array('--no-ansi' => true)); + $tester->run(['--no-ansi' => true]); $this->assertFalse($tester->getOutput()->isDecorated(), '->run() forces color output to be disabled if --no-ansi is passed'); - $tester->run(array('--version' => true), array('decorated' => false)); + $tester->run(['--version' => true], ['decorated' => false]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run4.txt', $tester->getDisplay(true), '->run() displays the program version if --version is passed'); - $tester->run(array('-V' => true), array('decorated' => false)); + $tester->run(['-V' => true], ['decorated' => false]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_run4.txt', $tester->getDisplay(true), '->run() displays the program version if -v is passed'); - $tester->run(array('command' => 'list', '--quiet' => true)); + $tester->run(['command' => 'list', '--quiet' => true]); $this->assertSame('', $tester->getDisplay(), '->run() removes all output if --quiet is passed'); $this->assertFalse($tester->getInput()->isInteractive(), '->run() sets off the interactive mode if --quiet is passed'); - $tester->run(array('command' => 'list', '-q' => true)); + $tester->run(['command' => 'list', '-q' => true]); $this->assertSame('', $tester->getDisplay(), '->run() removes all output if -q is passed'); $this->assertFalse($tester->getInput()->isInteractive(), '->run() sets off the interactive mode if -q is passed'); - $tester->run(array('command' => 'list', '--verbose' => true)); + $tester->run(['command' => 'list', '--verbose' => true]); $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if --verbose is passed'); - $tester->run(array('command' => 'list', '--verbose' => 1)); + $tester->run(['command' => 'list', '--verbose' => 1]); $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if --verbose=1 is passed'); - $tester->run(array('command' => 'list', '--verbose' => 2)); + $tester->run(['command' => 'list', '--verbose' => 2]); $this->assertSame(Output::VERBOSITY_VERY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to very verbose if --verbose=2 is passed'); - $tester->run(array('command' => 'list', '--verbose' => 3)); + $tester->run(['command' => 'list', '--verbose' => 3]); $this->assertSame(Output::VERBOSITY_DEBUG, $tester->getOutput()->getVerbosity(), '->run() sets the output to debug if --verbose=3 is passed'); - $tester->run(array('command' => 'list', '--verbose' => 4)); + $tester->run(['command' => 'list', '--verbose' => 4]); $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if unknown --verbose level is passed'); - $tester->run(array('command' => 'list', '-v' => true)); + $tester->run(['command' => 'list', '-v' => true]); $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed'); - $tester->run(array('command' => 'list', '-vv' => true)); + $tester->run(['command' => 'list', '-vv' => true]); $this->assertSame(Output::VERBOSITY_VERY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed'); - $tester->run(array('command' => 'list', '-vvv' => true)); + $tester->run(['command' => 'list', '-vvv' => true]); $this->assertSame(Output::VERBOSITY_DEBUG, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed'); $application = new Application(); @@ -863,13 +877,26 @@ public function testRun() $application->add(new \FooCommand()); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo:bar', '--no-interaction' => true), array('decorated' => false)); + $tester->run(['command' => 'foo:bar', '--no-interaction' => true], ['decorated' => false]); $this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if --no-interaction is passed'); - $tester->run(array('command' => 'foo:bar', '-n' => true), array('decorated' => false)); + $tester->run(['command' => 'foo:bar', '-n' => true], ['decorated' => false]); $this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if -n is passed'); } + public function testRunWithGlobalOptionAndNoCommand() + { + $application = new Application(); + $application->setAutoExit(false); + $application->setCatchExceptions(false); + $application->getDefinition()->addOption(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)); + + $output = new StreamOutput(fopen('php://memory', 'w', false)); + $input = new ArgvInput(['cli.php', '--foo', 'bar']); + + $this->assertSame(0, $application->run($input, $output)); + } + /** * Issue #9285. * @@ -886,12 +913,12 @@ public function testVerboseValueNotBreakArguments() $output = new StreamOutput(fopen('php://memory', 'w', false)); - $input = new ArgvInput(array('cli.php', '-v', 'foo:bar')); + $input = new ArgvInput(['cli.php', '-v', 'foo:bar']); $application->run($input, $output); $this->addToAssertionCount(1); - $input = new ArgvInput(array('cli.php', '--verbose', 'foo:bar')); + $input = new ArgvInput(['cli.php', '--verbose', 'foo:bar']); $application->run($input, $output); $this->addToAssertionCount(1); @@ -901,32 +928,80 @@ public function testRunReturnsIntegerExitCode() { $exception = new \Exception('', 4); - $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('doRun'))->getMock(); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(['doRun'])->getMock(); $application->setAutoExit(false); $application->expects($this->once()) ->method('doRun') - ->will($this->throwException($exception)); + ->willThrowException($exception); - $exitCode = $application->run(new ArrayInput(array()), new NullOutput()); + $exitCode = $application->run(new ArrayInput([]), new NullOutput()); $this->assertSame(4, $exitCode, '->run() returns integer exit code extracted from raised exception'); } + public function testRunDispatchesIntegerExitCode() + { + $passedRightValue = false; + + // We can assume here that some other test asserts that the event is dispatched at all + $dispatcher = new EventDispatcher(); + $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use (&$passedRightValue) { + $passedRightValue = (4 === $event->getExitCode()); + }); + + $application = new Application(); + $application->setDispatcher($dispatcher); + $application->setAutoExit(false); + + $application->register('test')->setCode(function (InputInterface $input, OutputInterface $output) { + throw new \Exception('', 4); + }); + + $tester = new ApplicationTester($application); + $tester->run(['command' => 'test']); + + $this->assertTrue($passedRightValue, '-> exit code 4 was passed in the console.terminate event'); + } + public function testRunReturnsExitCodeOneForExceptionCodeZero() { $exception = new \Exception('', 0); - $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('doRun'))->getMock(); + $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(['doRun'])->getMock(); $application->setAutoExit(false); $application->expects($this->once()) ->method('doRun') - ->will($this->throwException($exception)); + ->willThrowException($exception); - $exitCode = $application->run(new ArrayInput(array()), new NullOutput()); + $exitCode = $application->run(new ArrayInput([]), new NullOutput()); $this->assertSame(1, $exitCode, '->run() returns exit code 1 when exception code is 0'); } + public function testRunDispatchesExitCodeOneForExceptionCodeZero() + { + $passedRightValue = false; + + // We can assume here that some other test asserts that the event is dispatched at all + $dispatcher = new EventDispatcher(); + $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use (&$passedRightValue) { + $passedRightValue = (1 === $event->getExitCode()); + }); + + $application = new Application(); + $application->setDispatcher($dispatcher); + $application->setAutoExit(false); + + $application->register('test')->setCode(function (InputInterface $input, OutputInterface $output) { + throw new \Exception(); + }); + + $tester = new ApplicationTester($application); + $tester->run(['command' => 'test']); + + $this->assertTrue($passedRightValue, '-> exit code 1 was passed in the console.terminate event'); + } + /** * @expectedException \LogicException * @expectedExceptionMessage An option with shortcut "e" already exists. @@ -943,12 +1018,12 @@ public function testAddingOptionWithDuplicateShortcut() $application ->register('foo') - ->setAliases(array('f')) - ->setDefinition(array(new InputOption('survey', 'e', InputOption::VALUE_REQUIRED, 'My option with a shortcut.'))) + ->setAliases(['f']) + ->setDefinition([new InputOption('survey', 'e', InputOption::VALUE_REQUIRED, 'My option with a shortcut.')]) ->setCode(function (InputInterface $input, OutputInterface $output) {}) ; - $input = new ArrayInput(array('command' => 'foo')); + $input = new ArrayInput(['command' => 'foo']); $output = new NullOutput(); $application->run($input, $output); @@ -965,22 +1040,22 @@ public function testAddingAlreadySetDefinitionElementData($def) $application->setCatchExceptions(false); $application ->register('foo') - ->setDefinition(array($def)) + ->setDefinition([$def]) ->setCode(function (InputInterface $input, OutputInterface $output) {}) ; - $input = new ArrayInput(array('command' => 'foo')); + $input = new ArrayInput(['command' => 'foo']); $output = new NullOutput(); $application->run($input, $output); } public function getAddingAlreadySetDefinitionElementData() { - return array( - array(new InputArgument('command', InputArgument::REQUIRED)), - array(new InputOption('quiet', '', InputOption::VALUE_NONE)), - array(new InputOption('query', 'q', InputOption::VALUE_NONE)), - ); + return [ + [new InputArgument('command', InputArgument::REQUIRED)], + [new InputOption('quiet', '', InputOption::VALUE_NONE)], + [new InputOption('query', 'q', InputOption::VALUE_NONE)], + ]; } public function testGetDefaultHelperSetReturnsDefaultValues() @@ -1000,7 +1075,7 @@ public function testAddingSingleHelperSetOverwritesDefaultValues() $application->setAutoExit(false); $application->setCatchExceptions(false); - $application->setHelperSet(new HelperSet(array(new FormatterHelper()))); + $application->setHelperSet(new HelperSet([new FormatterHelper()])); $helperSet = $application->getHelperSet(); @@ -1017,7 +1092,7 @@ public function testOverwritingDefaultHelperSetOverwritesDefaultValues() $application->setAutoExit(false); $application->setCatchExceptions(false); - $application->setHelperSet(new HelperSet(array(new FormatterHelper()))); + $application->setHelperSet(new HelperSet([new FormatterHelper()])); $helperSet = $application->getHelperSet(); @@ -1075,7 +1150,7 @@ public function testSettingCustomInputDefinitionOverwritesDefaultValues() $application->setAutoExit(false); $application->setCatchExceptions(false); - $application->setDefinition(new InputDefinition(array(new InputOption('--custom', '-c', InputOption::VALUE_NONE, 'Set the custom input definition.')))); + $application->setDefinition(new InputDefinition([new InputOption('--custom', '-c', InputOption::VALUE_NONE, 'Set the custom input definition.')])); $inputDefinition = $application->getDefinition(); @@ -1104,7 +1179,7 @@ public function testRunWithDispatcher() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo')); + $tester->run(['command' => 'foo']); $this->assertEquals('before.foo.after.'.PHP_EOL, $tester->getDisplay()); } @@ -1124,7 +1199,7 @@ public function testRunWithExceptionAndDispatcher() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo')); + $tester->run(['command' => 'foo']); } public function testRunDispatchesAllEventsWithException() @@ -1140,7 +1215,7 @@ public function testRunDispatchesAllEventsWithException() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo')); + $tester->run(['command' => 'foo']); $this->assertContains('before.foo.error.after.', $tester->getDisplay()); } @@ -1160,7 +1235,7 @@ public function testRunDispatchesAllEventsWithExceptionInListener() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo')); + $tester->run(['command' => 'foo']); $this->assertContains('before.error.after.', $tester->getDisplay()); } @@ -1182,7 +1257,7 @@ public function testRunWithError() $tester = new ApplicationTester($application); try { - $tester->run(array('command' => 'dym')); + $tester->run(['command' => 'dym']); $this->fail('Error expected.'); } catch (\Error $e) { $this->assertSame('dymerr', $e->getMessage()); @@ -1211,7 +1286,7 @@ public function testRunAllowsErrorListenersToSilenceTheException() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo')); + $tester->run(['command' => 'foo']); $this->assertContains('before.error.silenced.after.', $tester->getDisplay()); $this->assertEquals(ConsoleCommandEvent::RETURN_CODE_DISABLED, $tester->getStatusCode()); } @@ -1230,7 +1305,7 @@ public function testConsoleErrorEventIsTriggeredOnCommandNotFound() $application->setAutoExit(false); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'unknown')); + $tester->run(['command' => 'unknown']); $this->assertContains('silenced command not found', $tester->getDisplay()); $this->assertEquals(1, $tester->getStatusCode()); } @@ -1257,7 +1332,7 @@ public function testLegacyExceptionListenersAreStillTriggered() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo')); + $tester->run(['command' => 'foo']); $this->assertContains('before.caught.error.after.', $tester->getDisplay()); $this->assertContains('replaced in caught.', $tester->getDisplay()); } @@ -1279,7 +1354,7 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEvent() $tester = new ApplicationTester($application); try { - $tester->run(array('command' => 'dym')); + $tester->run(['command' => 'dym']); $this->fail('->run() should rethrow PHP errors if not handled via ConsoleErrorEvent.'); } catch (\Error $e) { $this->assertSame($e->getMessage(), 'Class \'UnknownClass\' not found'); @@ -1305,7 +1380,7 @@ public function testRunWithErrorAndDispatcher() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'dym')); + $tester->run(['command' => 'dym']); $this->assertContains('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events'); } @@ -1325,7 +1400,7 @@ public function testRunDispatchesAllEventsWithError() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'dym')); + $tester->run(['command' => 'dym']); $this->assertContains('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events'); } @@ -1345,7 +1420,7 @@ public function testRunWithErrorFailingStatusCode() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'dus')); + $tester->run(['command' => 'dus']); $this->assertSame(1, $tester->getStatusCode(), 'Status code should be 1'); } @@ -1360,7 +1435,7 @@ public function testRunWithDispatcherSkippingCommand() }); $tester = new ApplicationTester($application); - $exitCode = $tester->run(array('command' => 'foo')); + $exitCode = $tester->run(['command' => 'foo']); $this->assertContains('before.after.', $tester->getDisplay()); $this->assertEquals(ConsoleCommandEvent::RETURN_CODE_DISABLED, $exitCode); } @@ -1387,7 +1462,7 @@ public function testRunWithDispatcherAccessingInputOptions() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo', '--no-interaction' => true)); + $tester->run(['command' => 'foo', '--no-interaction' => true]); $this->assertTrue($noInteractionValue); $this->assertFalse($quietValue); @@ -1417,7 +1492,7 @@ public function testRunWithDispatcherAddingInputOptions() }); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo', '--extra' => 'some test value')); + $tester->run(['command' => 'foo', '--extra' => 'some test value']); $this->assertEquals('some test value', $extraValue); } @@ -1437,7 +1512,7 @@ public function testTerminalDimensions() } $application->setTerminalDimensions($width, 80); - $this->assertSame(array($width, 80), $application->getTerminalDimensions()); + $this->assertSame([$width, 80], $application->getTerminalDimensions()); } public function testSetRunCustomDefaultCommand() @@ -1450,14 +1525,14 @@ public function testSetRunCustomDefaultCommand() $application->setDefaultCommand($command->getName()); $tester = new ApplicationTester($application); - $tester->run(array(), array('interactive' => false)); + $tester->run([], ['interactive' => false]); $this->assertEquals('called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); $application = new CustomDefaultCommandApplication(); $application->setAutoExit(false); $tester = new ApplicationTester($application); - $tester->run(array(), array('interactive' => false)); + $tester->run([], ['interactive' => false]); $this->assertEquals('called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); } @@ -1472,7 +1547,7 @@ public function testSetRunCustomDefaultCommandWithOption() $application->setDefaultCommand($command->getName()); $tester = new ApplicationTester($application); - $tester->run(array('--fooopt' => 'opt'), array('interactive' => false)); + $tester->run(['--fooopt' => 'opt'], ['interactive' => false]); $this->assertEquals('called'.PHP_EOL.'opt'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); } @@ -1488,10 +1563,10 @@ public function testSetRunCustomSingleCommand() $tester = new ApplicationTester($application); - $tester->run(array()); + $tester->run([]); $this->assertContains('called', $tester->getDisplay()); - $tester->run(array('--help' => true)); + $tester->run(['--help' => true]); $this->assertContains('The foo:bar command', $tester->getDisplay()); } @@ -1504,9 +1579,9 @@ public function testCanCheckIfTerminalIsInteractive() $application->setAutoExit(false); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'help')); + $tester->run(['command' => 'help']); - $this->assertFalse($tester->getInput()->hasParameterOption(array('--no-interaction', '-n'))); + $this->assertFalse($tester->getInput()->hasParameterOption(['--no-interaction', '-n'])); $inputStream = $tester->getInput()->getStream(); $this->assertEquals($tester->getInput()->isInteractive(), @posix_isatty($inputStream)); @@ -1518,9 +1593,9 @@ public function testRunLazyCommandService() $container->addCompilerPass(new AddConsoleCommandPass()); $container ->register('lazy-command', LazyCommand::class) - ->addTag('console.command', array('command' => 'lazy:command')) - ->addTag('console.command', array('command' => 'lazy:alias')) - ->addTag('console.command', array('command' => 'lazy:alias2')); + ->addTag('console.command', ['command' => 'lazy:command']) + ->addTag('console.command', ['command' => 'lazy:alias']) + ->addTag('console.command', ['command' => 'lazy:alias2']); $container->compile(); $application = new Application(); @@ -1529,17 +1604,17 @@ public function testRunLazyCommandService() $tester = new ApplicationTester($application); - $tester->run(array('command' => 'lazy:command')); + $tester->run(['command' => 'lazy:command']); $this->assertSame("lazy-command called\n", $tester->getDisplay(true)); - $tester->run(array('command' => 'lazy:alias')); + $tester->run(['command' => 'lazy:alias']); $this->assertSame("lazy-command called\n", $tester->getDisplay(true)); - $tester->run(array('command' => 'lazy:alias2')); + $tester->run(['command' => 'lazy:alias2']); $this->assertSame("lazy-command called\n", $tester->getDisplay(true)); $command = $application->get('lazy:command'); - $this->assertSame(array('lazy:alias', 'lazy:alias2'), $command->getAliases()); + $this->assertSame(['lazy:alias', 'lazy:alias2'], $command->getAliases()); } /** @@ -1548,21 +1623,21 @@ public function testRunLazyCommandService() public function testGetDisabledLazyCommand() { $application = new Application(); - $application->setCommandLoader(new FactoryCommandLoader(array('disabled' => function () { return new DisabledCommand(); }))); + $application->setCommandLoader(new FactoryCommandLoader(['disabled' => function () { return new DisabledCommand(); }])); $application->get('disabled'); } public function testHasReturnsFalseForDisabledLazyCommand() { $application = new Application(); - $application->setCommandLoader(new FactoryCommandLoader(array('disabled' => function () { return new DisabledCommand(); }))); + $application->setCommandLoader(new FactoryCommandLoader(['disabled' => function () { return new DisabledCommand(); }])); $this->assertFalse($application->has('disabled')); } public function testAllExcludesDisabledLazyCommand() { $application = new Application(); - $application->setCommandLoader(new FactoryCommandLoader(array('disabled' => function () { return new DisabledCommand(); }))); + $application->setCommandLoader(new FactoryCommandLoader(['disabled' => function () { return new DisabledCommand(); }])); $this->assertArrayNotHasKey('disabled', $application->all()); } @@ -1608,7 +1683,7 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEventWithCatchingEn $tester = new ApplicationTester($application); try { - $tester->run(array('command' => 'dym')); + $tester->run(['command' => 'dym']); $this->fail('->run() should rethrow PHP errors if not handled via ConsoleErrorEvent.'); } catch (\Error $e) { $this->assertSame($e->getMessage(), 'Class \'UnknownClass\' not found'); @@ -1632,7 +1707,7 @@ class CustomApplication extends Application */ protected function getDefaultInputDefinition() { - return new InputDefinition(array(new InputOption('--custom', '-c', InputOption::VALUE_NONE, 'Set the custom input definition.'))); + return new InputDefinition([new InputOption('--custom', '-c', InputOption::VALUE_NONE, 'Set the custom input definition.')]); } /** @@ -1642,7 +1717,7 @@ protected function getDefaultInputDefinition() */ protected function getDefaultHelperSet() { - return new HelperSet(array(new FormatterHelper())); + return new HelperSet([new FormatterHelper()]); } } diff --git a/vendor/symfony/console/Tests/Command/CommandTest.php b/vendor/symfony/console/Tests/Command/CommandTest.php index 6bc3f75b932a62ea88c57507ea437fd1964be66a..b3ce402209a8eaa1d46fe16a12a68dc787adfbc6 100644 --- a/vendor/symfony/console/Tests/Command/CommandTest.php +++ b/vendor/symfony/console/Tests/Command/CommandTest.php @@ -71,7 +71,7 @@ public function testSetGetDefinition() $ret = $command->setDefinition($definition = new InputDefinition()); $this->assertEquals($command, $ret, '->setDefinition() implements a fluent interface'); $this->assertEquals($definition, $command->getDefinition(), '->setDefinition() sets the current InputDefinition instance'); - $command->setDefinition(array(new InputArgument('foo'), new InputOption('bar'))); + $command->setDefinition([new InputArgument('foo'), new InputOption('bar')]); $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument'); $this->assertTrue($command->getDefinition()->hasOption('bar'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument'); $command->setDefinition(new InputDefinition()); @@ -130,10 +130,10 @@ public function testInvalidCommandNames($name) public function provideInvalidCommandNames() { - return array( - array(''), - array('foo:'), - ); + return [ + [''], + ['foo:'], + ]; } public function testGetSetDescription() @@ -166,15 +166,23 @@ public function testGetProcessedHelp() $command = new \TestCommand(); $command->setHelp(''); $this->assertContains('description', $command->getProcessedHelp(), '->getProcessedHelp() falls back to the description'); + + $command = new \TestCommand(); + $command->setHelp('The %command.name% command does... Example: php %command.full_name%.'); + $application = new Application(); + $application->add($command); + $application->setDefaultCommand('namespace:name', true); + $this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly in single command applications'); + $this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name% in single command applications'); } public function testGetSetAliases() { $command = new \TestCommand(); - $this->assertEquals(array('name'), $command->getAliases(), '->getAliases() returns the aliases'); - $ret = $command->setAliases(array('name1')); + $this->assertEquals(['name'], $command->getAliases(), '->getAliases() returns the aliases'); + $ret = $command->setAliases(['name1']); $this->assertEquals($command, $ret, '->setAliases() implements a fluent interface'); - $this->assertEquals(array('name1'), $command->getAliases(), '->setAliases() sets the aliases'); + $this->assertEquals(['name1'], $command->getAliases(), '->setAliases() sets the aliases'); } public function testSetAliasesNull() @@ -223,11 +231,11 @@ public function testGetHelperWithoutHelperSet() public function testMergeApplicationDefinition() { $application1 = new Application(); - $application1->getDefinition()->addArguments(array(new InputArgument('foo'))); - $application1->getDefinition()->addOptions(array(new InputOption('bar'))); + $application1->getDefinition()->addArguments([new InputArgument('foo')]); + $application1->getDefinition()->addOptions([new InputOption('bar')]); $command = new \TestCommand(); $command->setApplication($application1); - $command->setDefinition($definition = new InputDefinition(array(new InputArgument('bar'), new InputOption('foo')))); + $command->setDefinition($definition = new InputDefinition([new InputArgument('bar'), new InputOption('foo')])); $r = new \ReflectionObject($command); $m = $r->getMethod('mergeApplicationDefinition'); @@ -245,11 +253,11 @@ public function testMergeApplicationDefinition() public function testMergeApplicationDefinitionWithoutArgsThenWithArgsAddsArgs() { $application1 = new Application(); - $application1->getDefinition()->addArguments(array(new InputArgument('foo'))); - $application1->getDefinition()->addOptions(array(new InputOption('bar'))); + $application1->getDefinition()->addArguments([new InputArgument('foo')]); + $application1->getDefinition()->addOptions([new InputOption('bar')]); $command = new \TestCommand(); $command->setApplication($application1); - $command->setDefinition($definition = new InputDefinition(array())); + $command->setDefinition($definition = new InputDefinition([])); $r = new \ReflectionObject($command); $m = $r->getMethod('mergeApplicationDefinition'); @@ -269,7 +277,7 @@ public function testRunInteractive() { $tester = new CommandTester(new \TestCommand()); - $tester->execute(array(), array('interactive' => true)); + $tester->execute([], ['interactive' => true]); $this->assertEquals('interact called'.PHP_EOL.'execute called'.PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive'); } @@ -278,7 +286,7 @@ public function testRunNonInteractive() { $tester = new CommandTester(new \TestCommand()); - $tester->execute(array(), array('interactive' => false)); + $tester->execute([], ['interactive' => false]); $this->assertEquals('execute called'.PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive'); } @@ -301,7 +309,7 @@ public function testRunWithInvalidOption() { $command = new \TestCommand(); $tester = new CommandTester($command); - $tester->execute(array('--bar' => true)); + $tester->execute(['--bar' => true]); } public function testRunReturnsIntegerExitCode() @@ -310,7 +318,7 @@ public function testRunReturnsIntegerExitCode() $exitCode = $command->run(new StringInput(''), new NullOutput()); $this->assertSame(0, $exitCode, '->run() returns integer exit code (treats null as 0)'); - $command = $this->getMockBuilder('TestCommand')->setMethods(array('execute'))->getMock(); + $command = $this->getMockBuilder('TestCommand')->setMethods(['execute'])->getMock(); $command->expects($this->once()) ->method('execute') ->will($this->returnValue('2.3')); @@ -356,16 +364,16 @@ public function testSetCode() }); $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); $tester = new CommandTester($command); - $tester->execute(array()); + $tester->execute([]); $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); } public function getSetCodeBindToClosureTests() { - return array( - array(true, 'not bound to the command'), - array(false, 'bound to the command'), - ); + return [ + [true, 'not bound to the command'], + [false, 'bound to the command'], + ]; } /** @@ -381,7 +389,7 @@ public function testSetCodeBindToClosure($previouslyBound, $expected) $command = new \TestCommand(); $command->setCode($code); $tester = new CommandTester($command); - $tester->execute(array()); + $tester->execute([]); $this->assertEquals('interact called'.PHP_EOL.$expected.PHP_EOL, $tester->getDisplay()); } @@ -390,7 +398,7 @@ public function testSetCodeWithStaticClosure() $command = new \TestCommand(); $command->setCode(self::createClosure()); $tester = new CommandTester($command); - $tester->execute(array()); + $tester->execute([]); if (\PHP_VERSION_ID < 70000) { // Cannot bind static closures in PHP 5 @@ -411,10 +419,10 @@ private static function createClosure() public function testSetCodeWithNonClosureCallable() { $command = new \TestCommand(); - $ret = $command->setCode(array($this, 'callableMethodCommand')); + $ret = $command->setCode([$this, 'callableMethodCommand']); $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); $tester = new CommandTester($command); - $tester->execute(array()); + $tester->execute([]); $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); } diff --git a/vendor/symfony/console/Tests/Command/HelpCommandTest.php b/vendor/symfony/console/Tests/Command/HelpCommandTest.php index 30fe2b6e7f8b78e0a36cd7b1ac76afe056f0c9a2..ce9d8d4fe4ccbc4c450a29050ec3fb0e0a987379 100644 --- a/vendor/symfony/console/Tests/Command/HelpCommandTest.php +++ b/vendor/symfony/console/Tests/Command/HelpCommandTest.php @@ -24,7 +24,7 @@ public function testExecuteForCommandAlias() $command = new HelpCommand(); $command->setApplication(new Application()); $commandTester = new CommandTester($command); - $commandTester->execute(array('command_name' => 'li'), array('decorated' => false)); + $commandTester->execute(['command_name' => 'li'], ['decorated' => false]); $this->assertContains('list [options] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); @@ -35,7 +35,7 @@ public function testExecuteForCommand() $command = new HelpCommand(); $commandTester = new CommandTester($command); $command->setCommand(new ListCommand()); - $commandTester->execute(array(), array('decorated' => false)); + $commandTester->execute([], ['decorated' => false]); $this->assertContains('list [options] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); @@ -46,7 +46,7 @@ public function testExecuteForCommandWithXmlOption() $command = new HelpCommand(); $commandTester = new CommandTester($command); $command->setCommand(new ListCommand()); - $commandTester->execute(array('--format' => 'xml')); + $commandTester->execute(['--format' => 'xml']); $this->assertContains('<command', $commandTester->getDisplay(), '->execute() returns an XML help text if --xml is passed'); } @@ -54,7 +54,7 @@ public function testExecuteForApplicationCommand() { $application = new Application(); $commandTester = new CommandTester($application->get('help')); - $commandTester->execute(array('command_name' => 'list')); + $commandTester->execute(['command_name' => 'list']); $this->assertContains('list [options] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); @@ -64,7 +64,7 @@ public function testExecuteForApplicationCommandWithXmlOption() { $application = new Application(); $commandTester = new CommandTester($application->get('help')); - $commandTester->execute(array('command_name' => 'list', '--format' => 'xml')); + $commandTester->execute(['command_name' => 'list', '--format' => 'xml']); $this->assertContains('list [--raw] [--format FORMAT] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); $this->assertContains('<command', $commandTester->getDisplay(), '->execute() returns an XML help text if --format=xml is passed'); } diff --git a/vendor/symfony/console/Tests/Command/ListCommandTest.php b/vendor/symfony/console/Tests/Command/ListCommandTest.php index b39f7ec5454eccd567eaee22b57ccc3f499d6376..57687d4c60342d8370a5b140516c0361e813ccf0 100644 --- a/vendor/symfony/console/Tests/Command/ListCommandTest.php +++ b/vendor/symfony/console/Tests/Command/ListCommandTest.php @@ -21,7 +21,7 @@ public function testExecuteListsCommands() { $application = new Application(); $commandTester = new CommandTester($command = $application->get('list')); - $commandTester->execute(array('command' => $command->getName()), array('decorated' => false)); + $commandTester->execute(['command' => $command->getName()], ['decorated' => false]); $this->assertRegExp('/help\s{2,}Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands'); } @@ -30,7 +30,7 @@ public function testExecuteListsCommandsWithXmlOption() { $application = new Application(); $commandTester = new CommandTester($command = $application->get('list')); - $commandTester->execute(array('command' => $command->getName(), '--format' => 'xml')); + $commandTester->execute(['command' => $command->getName(), '--format' => 'xml']); $this->assertRegExp('/<command id="list" name="list" hidden="0">/', $commandTester->getDisplay(), '->execute() returns a list of available commands in XML if --xml is passed'); } @@ -38,7 +38,7 @@ public function testExecuteListsCommandsWithRawOption() { $application = new Application(); $commandTester = new CommandTester($command = $application->get('list')); - $commandTester->execute(array('command' => $command->getName(), '--raw' => true)); + $commandTester->execute(['command' => $command->getName(), '--raw' => true]); $output = <<<'EOF' help Displays help for a command list Lists commands @@ -54,7 +54,7 @@ public function testExecuteListsCommandsWithNamespaceArgument() $application = new Application(); $application->add(new \FooCommand()); $commandTester = new CommandTester($command = $application->get('list')); - $commandTester->execute(array('command' => $command->getName(), 'namespace' => 'foo', '--raw' => true)); + $commandTester->execute(['command' => $command->getName(), 'namespace' => 'foo', '--raw' => true]); $output = <<<'EOF' foo:bar The foo:bar command @@ -69,7 +69,7 @@ public function testExecuteListsCommandsOrder() $application = new Application(); $application->add(new \Foo6Command()); $commandTester = new CommandTester($command = $application->get('list')); - $commandTester->execute(array('command' => $command->getName()), array('decorated' => false)); + $commandTester->execute(['command' => $command->getName()], ['decorated' => false]); $output = <<<'EOF' Console Tool @@ -101,7 +101,7 @@ public function testExecuteListsCommandsOrderRaw() $application = new Application(); $application->add(new \Foo6Command()); $commandTester = new CommandTester($command = $application->get('list')); - $commandTester->execute(array('command' => $command->getName(), '--raw' => true)); + $commandTester->execute(['command' => $command->getName(), '--raw' => true]); $output = <<<'EOF' help Displays help for a command list Lists commands diff --git a/vendor/symfony/console/Tests/Command/LockableTraitTest.php b/vendor/symfony/console/Tests/Command/LockableTraitTest.php index a622d1b4895f588f036ea3454978fbe018745ad1..6a72706ee457f29fb0974c2ace74b607676c0cef 100644 --- a/vendor/symfony/console/Tests/Command/LockableTraitTest.php +++ b/vendor/symfony/console/Tests/Command/LockableTraitTest.php @@ -33,8 +33,8 @@ public function testLockIsReleased() $command = new \FooLockCommand(); $tester = new CommandTester($command); - $this->assertSame(2, $tester->execute(array())); - $this->assertSame(2, $tester->execute(array())); + $this->assertSame(2, $tester->execute([])); + $this->assertSame(2, $tester->execute([])); } public function testLockReturnsFalseIfAlreadyLockedByAnotherCommand() @@ -51,10 +51,10 @@ public function testLockReturnsFalseIfAlreadyLockedByAnotherCommand() $lock->acquire(); $tester = new CommandTester($command); - $this->assertSame(1, $tester->execute(array())); + $this->assertSame(1, $tester->execute([])); $lock->release(); - $this->assertSame(2, $tester->execute(array())); + $this->assertSame(2, $tester->execute([])); } public function testMultipleLockCallsThrowLogicException() @@ -62,6 +62,6 @@ public function testMultipleLockCallsThrowLogicException() $command = new \FooLock2Command(); $tester = new CommandTester($command); - $this->assertSame(1, $tester->execute(array())); + $this->assertSame(1, $tester->execute([])); } } diff --git a/vendor/symfony/console/Tests/CommandLoader/ContainerCommandLoaderTest.php b/vendor/symfony/console/Tests/CommandLoader/ContainerCommandLoaderTest.php index 78eefd24f1b3ddd921c94ca7144fc0457bacaf52..18d6e77bfba4298ad99d7549118488caaee68c23 100644 --- a/vendor/symfony/console/Tests/CommandLoader/ContainerCommandLoaderTest.php +++ b/vendor/symfony/console/Tests/CommandLoader/ContainerCommandLoaderTest.php @@ -20,10 +20,10 @@ class ContainerCommandLoaderTest extends TestCase { public function testHas() { - $loader = new ContainerCommandLoader(new ServiceLocator(array( + $loader = new ContainerCommandLoader(new ServiceLocator([ 'foo-service' => function () { return new Command('foo'); }, 'bar-service' => function () { return new Command('bar'); }, - )), array('foo' => 'foo-service', 'bar' => 'bar-service')); + ]), ['foo' => 'foo-service', 'bar' => 'bar-service']); $this->assertTrue($loader->has('foo')); $this->assertTrue($loader->has('bar')); @@ -32,10 +32,10 @@ public function testHas() public function testGet() { - $loader = new ContainerCommandLoader(new ServiceLocator(array( + $loader = new ContainerCommandLoader(new ServiceLocator([ 'foo-service' => function () { return new Command('foo'); }, 'bar-service' => function () { return new Command('bar'); }, - )), array('foo' => 'foo-service', 'bar' => 'bar-service')); + ]), ['foo' => 'foo-service', 'bar' => 'bar-service']); $this->assertInstanceOf(Command::class, $loader->get('foo')); $this->assertInstanceOf(Command::class, $loader->get('bar')); @@ -46,16 +46,16 @@ public function testGet() */ public function testGetUnknownCommandThrows() { - (new ContainerCommandLoader(new ServiceLocator(array()), array()))->get('unknown'); + (new ContainerCommandLoader(new ServiceLocator([]), []))->get('unknown'); } public function testGetCommandNames() { - $loader = new ContainerCommandLoader(new ServiceLocator(array( + $loader = new ContainerCommandLoader(new ServiceLocator([ 'foo-service' => function () { return new Command('foo'); }, 'bar-service' => function () { return new Command('bar'); }, - )), array('foo' => 'foo-service', 'bar' => 'bar-service')); + ]), ['foo' => 'foo-service', 'bar' => 'bar-service']); - $this->assertSame(array('foo', 'bar'), $loader->getNames()); + $this->assertSame(['foo', 'bar'], $loader->getNames()); } } diff --git a/vendor/symfony/console/Tests/CommandLoader/FactoryCommandLoaderTest.php b/vendor/symfony/console/Tests/CommandLoader/FactoryCommandLoaderTest.php index 5ee6cd1ec36fdf37e31892455fabf3d8da4b2677..7b9ec837e624f874934db6474435b5e4cb8c4680 100644 --- a/vendor/symfony/console/Tests/CommandLoader/FactoryCommandLoaderTest.php +++ b/vendor/symfony/console/Tests/CommandLoader/FactoryCommandLoaderTest.php @@ -19,10 +19,10 @@ class FactoryCommandLoaderTest extends TestCase { public function testHas() { - $loader = new FactoryCommandLoader(array( + $loader = new FactoryCommandLoader([ 'foo' => function () { return new Command('foo'); }, 'bar' => function () { return new Command('bar'); }, - )); + ]); $this->assertTrue($loader->has('foo')); $this->assertTrue($loader->has('bar')); @@ -31,10 +31,10 @@ public function testHas() public function testGet() { - $loader = new FactoryCommandLoader(array( + $loader = new FactoryCommandLoader([ 'foo' => function () { return new Command('foo'); }, 'bar' => function () { return new Command('bar'); }, - )); + ]); $this->assertInstanceOf(Command::class, $loader->get('foo')); $this->assertInstanceOf(Command::class, $loader->get('bar')); @@ -45,16 +45,16 @@ public function testGet() */ public function testGetUnknownCommandThrows() { - (new FactoryCommandLoader(array()))->get('unknown'); + (new FactoryCommandLoader([]))->get('unknown'); } public function testGetCommandNames() { - $loader = new FactoryCommandLoader(array( + $loader = new FactoryCommandLoader([ 'foo' => function () { return new Command('foo'); }, 'bar' => function () { return new Command('bar'); }, - )); + ]); - $this->assertSame(array('foo', 'bar'), $loader->getNames()); + $this->assertSame(['foo', 'bar'], $loader->getNames()); } } diff --git a/vendor/symfony/console/Tests/DependencyInjection/AddConsoleCommandPassTest.php b/vendor/symfony/console/Tests/DependencyInjection/AddConsoleCommandPassTest.php index 67fbb98643f1ecb28afd37d89c7b70209dc7df35..b97d0a8f91998c1efee9e8a2266098aff3eb5d05 100644 --- a/vendor/symfony/console/Tests/DependencyInjection/AddConsoleCommandPassTest.php +++ b/vendor/symfony/console/Tests/DependencyInjection/AddConsoleCommandPassTest.php @@ -54,7 +54,7 @@ public function testProcess($public) } $this->assertTrue($container->hasParameter('console.command.ids')); - $this->assertSame(array($alias => $id), $container->getParameter('console.command.ids')); + $this->assertSame([$alias => $id], $container->getParameter('console.command.ids')); } public function testProcessRegistersLazyCommands() @@ -63,8 +63,8 @@ public function testProcessRegistersLazyCommands() $command = $container ->register('my-command', MyCommand::class) ->setPublic(false) - ->addTag('console.command', array('command' => 'my:command')) - ->addTag('console.command', array('command' => 'my:alias')) + ->addTag('console.command', ['command' => 'my:command']) + ->addTag('console.command', ['command' => 'my:alias']) ; (new AddConsoleCommandPass())->process($container); @@ -73,11 +73,11 @@ public function testProcessRegistersLazyCommands() $commandLocator = $container->getDefinition((string) $commandLoader->getArgument(0)); $this->assertSame(ContainerCommandLoader::class, $commandLoader->getClass()); - $this->assertSame(array('my:command' => 'my-command', 'my:alias' => 'my-command'), $commandLoader->getArgument(1)); - $this->assertEquals(array(array('my-command' => new ServiceClosureArgument(new TypedReference('my-command', MyCommand::class)))), $commandLocator->getArguments()); - $this->assertSame(array('console.command.symfony_component_console_tests_dependencyinjection_mycommand' => 'my-command'), $container->getParameter('console.command.ids')); - $this->assertSame(array('my-command' => true), $container->getParameter('console.lazy_command.ids')); - $this->assertSame(array(array('setName', array('my:command')), array('setAliases', array(array('my:alias')))), $command->getMethodCalls()); + $this->assertSame(['my:command' => 'my-command', 'my:alias' => 'my-command'], $commandLoader->getArgument(1)); + $this->assertEquals([['my-command' => new ServiceClosureArgument(new TypedReference('my-command', MyCommand::class))]], $commandLocator->getArguments()); + $this->assertSame(['console.command.symfony_component_console_tests_dependencyinjection_mycommand' => 'my-command'], $container->getParameter('console.command.ids')); + $this->assertSame(['my-command' => true], $container->getParameter('console.lazy_command.ids')); + $this->assertSame([['setName', ['my:command']], ['setAliases', [['my:alias']]]], $command->getMethodCalls()); } public function testProcessFallsBackToDefaultName() @@ -96,29 +96,29 @@ public function testProcessFallsBackToDefaultName() $commandLocator = $container->getDefinition((string) $commandLoader->getArgument(0)); $this->assertSame(ContainerCommandLoader::class, $commandLoader->getClass()); - $this->assertSame(array('default' => 'with-default-name'), $commandLoader->getArgument(1)); - $this->assertEquals(array(array('with-default-name' => new ServiceClosureArgument(new TypedReference('with-default-name', NamedCommand::class)))), $commandLocator->getArguments()); - $this->assertSame(array('console.command.symfony_component_console_tests_dependencyinjection_namedcommand' => 'with-default-name'), $container->getParameter('console.command.ids')); - $this->assertSame(array('with-default-name' => true), $container->getParameter('console.lazy_command.ids')); + $this->assertSame(['default' => 'with-default-name'], $commandLoader->getArgument(1)); + $this->assertEquals([['with-default-name' => new ServiceClosureArgument(new TypedReference('with-default-name', NamedCommand::class))]], $commandLocator->getArguments()); + $this->assertSame(['console.command.symfony_component_console_tests_dependencyinjection_namedcommand' => 'with-default-name'], $container->getParameter('console.command.ids')); + $this->assertSame(['with-default-name' => true], $container->getParameter('console.lazy_command.ids')); $container = new ContainerBuilder(); $container ->register('with-default-name', NamedCommand::class) ->setPublic(false) - ->addTag('console.command', array('command' => 'new-name')) + ->addTag('console.command', ['command' => 'new-name']) ; $pass->process($container); - $this->assertSame(array('new-name' => 'with-default-name'), $container->getDefinition('console.command_loader')->getArgument(1)); + $this->assertSame(['new-name' => 'with-default-name'], $container->getDefinition('console.command_loader')->getArgument(1)); } public function visibilityProvider() { - return array( - array(true), - array(false), - ); + return [ + [true], + [false], + ]; } /** diff --git a/vendor/symfony/console/Tests/Descriptor/AbstractDescriptorTest.php b/vendor/symfony/console/Tests/Descriptor/AbstractDescriptorTest.php index 3686e7543b6bbd3657fb31933c70a5abc4961840..320a4fb9f46b61385b13a407afc089fff5d85174 100644 --- a/vendor/symfony/console/Tests/Descriptor/AbstractDescriptorTest.php +++ b/vendor/symfony/console/Tests/Descriptor/AbstractDescriptorTest.php @@ -89,19 +89,19 @@ abstract protected function getFormat(); protected function getDescriptionTestData(array $objects) { - $data = array(); + $data = []; foreach ($objects as $name => $object) { $description = file_get_contents(sprintf('%s/../Fixtures/%s.%s', __DIR__, $name, $this->getFormat())); - $data[] = array($object, $description); + $data[] = [$object, $description]; } return $data; } - protected function assertDescription($expectedDescription, $describedObject, array $options = array()) + protected function assertDescription($expectedDescription, $describedObject, array $options = []) { $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); - $this->getDescriptor()->describe($output, $describedObject, $options + array('raw_output' => true)); + $this->getDescriptor()->describe($output, $describedObject, $options + ['raw_output' => true]); $this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $output->fetch()))); } } diff --git a/vendor/symfony/console/Tests/Descriptor/JsonDescriptorTest.php b/vendor/symfony/console/Tests/Descriptor/JsonDescriptorTest.php index dffcaf6648cefa713628af48a960814a276df64d..fb596b8d7adaf3893d6dfe9de2db6c2245937cc8 100644 --- a/vendor/symfony/console/Tests/Descriptor/JsonDescriptorTest.php +++ b/vendor/symfony/console/Tests/Descriptor/JsonDescriptorTest.php @@ -26,10 +26,10 @@ protected function getFormat() return 'json'; } - protected function assertDescription($expectedDescription, $describedObject, array $options = array()) + protected function assertDescription($expectedDescription, $describedObject, array $options = []) { $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); - $this->getDescriptor()->describe($output, $describedObject, $options + array('raw_output' => true)); + $this->getDescriptor()->describe($output, $describedObject, $options + ['raw_output' => true]); $this->assertEquals(json_decode(trim($expectedDescription), true), json_decode(trim(str_replace(PHP_EOL, "\n", $output->fetch())), true)); } } diff --git a/vendor/symfony/console/Tests/Descriptor/MarkdownDescriptorTest.php b/vendor/symfony/console/Tests/Descriptor/MarkdownDescriptorTest.php index eb80f58b1cc58fdcd3cc2481c9efbba847e3c918..a8f11cb4aeb46dcf0868fd8f763046641a19d804 100644 --- a/vendor/symfony/console/Tests/Descriptor/MarkdownDescriptorTest.php +++ b/vendor/symfony/console/Tests/Descriptor/MarkdownDescriptorTest.php @@ -21,7 +21,7 @@ public function getDescribeCommandTestData() { return $this->getDescriptionTestData(array_merge( ObjectsProvider::getCommands(), - array('command_mbstring' => new DescriptorCommandMbString()) + ['command_mbstring' => new DescriptorCommandMbString()] )); } @@ -29,7 +29,7 @@ public function getDescribeApplicationTestData() { return $this->getDescriptionTestData(array_merge( ObjectsProvider::getApplications(), - array('application_mbstring' => new DescriptorApplicationMbString()) + ['application_mbstring' => new DescriptorApplicationMbString()] )); } diff --git a/vendor/symfony/console/Tests/Descriptor/ObjectsProvider.php b/vendor/symfony/console/Tests/Descriptor/ObjectsProvider.php index b4f34ada19ec65093bc0d4a7a8ed75f49d11533a..d46d6f18baad8068d4192695225e4d52bd8a990f 100644 --- a/vendor/symfony/console/Tests/Descriptor/ObjectsProvider.php +++ b/vendor/symfony/console/Tests/Descriptor/ObjectsProvider.php @@ -26,57 +26,57 @@ class ObjectsProvider { public static function getInputArguments() { - return array( + return [ 'input_argument_1' => new InputArgument('argument_name', InputArgument::REQUIRED), 'input_argument_2' => new InputArgument('argument_name', InputArgument::IS_ARRAY, 'argument description'), 'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'), 'input_argument_4' => new InputArgument('argument_name', InputArgument::REQUIRED, "multiline\nargument description"), 'input_argument_with_style' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', '<comment>style</>'), 'input_argument_with_default_inf_value' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', INF), - ); + ]; } public static function getInputOptions() { - return array( + return [ 'input_option_1' => new InputOption('option_name', 'o', InputOption::VALUE_NONE), 'input_option_2' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', 'default_value'), 'input_option_3' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description'), - 'input_option_4' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'option description', array()), + 'input_option_4' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'option description', []), 'input_option_5' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, "multiline\noption description"), - 'input_option_6' => new InputOption('option_name', array('o', 'O'), InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'), + 'input_option_6' => new InputOption('option_name', ['o', 'O'], InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'), 'input_option_with_style' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description', '<comment>style</>'), - 'input_option_with_style_array' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'option description', array('<comment>Hello</comment>', '<info>world</info>')), + 'input_option_with_style_array' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'option description', ['<comment>Hello</comment>', '<info>world</info>']), 'input_option_with_default_inf_value' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', INF), - ); + ]; } public static function getInputDefinitions() { - return array( + return [ 'input_definition_1' => new InputDefinition(), - 'input_definition_2' => new InputDefinition(array(new InputArgument('argument_name', InputArgument::REQUIRED))), - 'input_definition_3' => new InputDefinition(array(new InputOption('option_name', 'o', InputOption::VALUE_NONE))), - 'input_definition_4' => new InputDefinition(array( + 'input_definition_2' => new InputDefinition([new InputArgument('argument_name', InputArgument::REQUIRED)]), + 'input_definition_3' => new InputDefinition([new InputOption('option_name', 'o', InputOption::VALUE_NONE)]), + 'input_definition_4' => new InputDefinition([ new InputArgument('argument_name', InputArgument::REQUIRED), new InputOption('option_name', 'o', InputOption::VALUE_NONE), - )), - ); + ]), + ]; } public static function getCommands() { - return array( + return [ 'command_1' => new DescriptorCommand1(), 'command_2' => new DescriptorCommand2(), - ); + ]; } public static function getApplications() { - return array( + return [ 'application_1' => new DescriptorApplication1(), 'application_2' => new DescriptorApplication2(), - ); + ]; } } diff --git a/vendor/symfony/console/Tests/Descriptor/TextDescriptorTest.php b/vendor/symfony/console/Tests/Descriptor/TextDescriptorTest.php index c024a522efad92525cb4661f592dc05d94b5b249..26bbd907a73dd43dc732b1b3b88c16007a52bbd9 100644 --- a/vendor/symfony/console/Tests/Descriptor/TextDescriptorTest.php +++ b/vendor/symfony/console/Tests/Descriptor/TextDescriptorTest.php @@ -22,7 +22,7 @@ public function getDescribeCommandTestData() { return $this->getDescriptionTestData(array_merge( ObjectsProvider::getCommands(), - array('command_mbstring' => new DescriptorCommandMbString()) + ['command_mbstring' => new DescriptorCommandMbString()] )); } @@ -30,7 +30,7 @@ public function getDescribeApplicationTestData() { return $this->getDescriptionTestData(array_merge( ObjectsProvider::getApplications(), - array('application_mbstring' => new DescriptorApplicationMbString()) + ['application_mbstring' => new DescriptorApplicationMbString()] )); } @@ -38,7 +38,7 @@ public function testDescribeApplicationWithFilteredNamespace() { $application = new DescriptorApplication2(); - $this->assertDescription(file_get_contents(__DIR__.'/../Fixtures/application_filtered_namespace.txt'), $application, array('namespace' => 'command4')); + $this->assertDescription(file_get_contents(__DIR__.'/../Fixtures/application_filtered_namespace.txt'), $application, ['namespace' => 'command4']); } protected function getDescriptor() diff --git a/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php b/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php index b3f3fb4546d805a29ba71efc316c59585ad3ce86..39766db3d80590029832ee18e127a0277ae88763 100644 --- a/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php +++ b/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php @@ -34,11 +34,11 @@ public function testOnConsoleError() $logger ->expects($this->once()) ->method('error') - ->with('Error thrown while running command "{command}". Message: "{message}"', array('exception' => $error, 'command' => 'test:run --foo=baz buzz', 'message' => 'An error occurred')) + ->with('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => 'test:run --foo=baz buzz', 'message' => 'An error occurred']) ; $listener = new ErrorListener($logger); - $listener->onConsoleError(new ConsoleErrorEvent(new ArgvInput(array('console.php', 'test:run', '--foo=baz', 'buzz')), $this->getOutput(), $error, new Command('test:run'))); + $listener->onConsoleError(new ConsoleErrorEvent(new ArgvInput(['console.php', 'test:run', '--foo=baz', 'buzz']), $this->getOutput(), $error, new Command('test:run'))); } public function testOnConsoleErrorWithNoCommandAndNoInputString() @@ -49,7 +49,7 @@ public function testOnConsoleErrorWithNoCommandAndNoInputString() $logger ->expects($this->once()) ->method('error') - ->with('An error occurred while using the console. Message: "{message}"', array('exception' => $error, 'message' => 'An error occurred')) + ->with('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => 'An error occurred']) ; $listener = new ErrorListener($logger); @@ -62,11 +62,11 @@ public function testOnConsoleTerminateForNonZeroExitCodeWritesToLog() $logger ->expects($this->once()) ->method('debug') - ->with('Command "{command}" exited with code "{code}"', array('command' => 'test:run', 'code' => 255)) + ->with('Command "{command}" exited with code "{code}"', ['command' => 'test:run', 'code' => 255]) ; $listener = new ErrorListener($logger); - $listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArgvInput(array('console.php', 'test:run')), 255)); + $listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArgvInput(['console.php', 'test:run']), 255)); } public function testOnConsoleTerminateForZeroExitCodeDoesNotWriteToLog() @@ -78,16 +78,16 @@ public function testOnConsoleTerminateForZeroExitCodeDoesNotWriteToLog() ; $listener = new ErrorListener($logger); - $listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArgvInput(array('console.php', 'test:run')), 0)); + $listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArgvInput(['console.php', 'test:run']), 0)); } public function testGetSubscribedEvents() { $this->assertEquals( - array( - 'console.error' => array('onConsoleError', -128), - 'console.terminate' => array('onConsoleTerminate', -128), - ), + [ + 'console.error' => ['onConsoleError', -128], + 'console.terminate' => ['onConsoleTerminate', -128], + ], ErrorListener::getSubscribedEvents() ); } @@ -98,12 +98,12 @@ public function testAllKindsOfInputCanBeLogged() $logger ->expects($this->exactly(3)) ->method('debug') - ->with('Command "{command}" exited with code "{code}"', array('command' => 'test:run --foo=bar', 'code' => 255)) + ->with('Command "{command}" exited with code "{code}"', ['command' => 'test:run --foo=bar', 'code' => 255]) ; $listener = new ErrorListener($logger); - $listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArgvInput(array('console.php', 'test:run', '--foo=bar')), 255)); - $listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArrayInput(array('name' => 'test:run', '--foo' => 'bar')), 255)); + $listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArgvInput(['console.php', 'test:run', '--foo=bar']), 255)); + $listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArrayInput(['name' => 'test:run', '--foo' => 'bar']), 255)); $listener->onConsoleTerminate($this->getConsoleTerminateEvent(new StringInput('test:run --foo=bar'), 255)); } @@ -113,7 +113,7 @@ public function testCommandNameIsDisplayedForNonStringableInput() $logger ->expects($this->once()) ->method('debug') - ->with('Command "{command}" exited with code "{code}"', array('command' => 'test:run', 'code' => 255)) + ->with('Command "{command}" exited with code "{code}"', ['command' => 'test:run', 'code' => 255]) ; $listener = new ErrorListener($logger); diff --git a/vendor/symfony/console/Tests/Fixtures/DescriptorCommand1.php b/vendor/symfony/console/Tests/Fixtures/DescriptorCommand1.php index ede05d7a73c0f0cadc6dbdc28fff29f7c9f81f46..14bb20486e8d5017f9443cdaf30f6b5a8f627b25 100644 --- a/vendor/symfony/console/Tests/Fixtures/DescriptorCommand1.php +++ b/vendor/symfony/console/Tests/Fixtures/DescriptorCommand1.php @@ -19,7 +19,7 @@ protected function configure() { $this ->setName('descriptor:command1') - ->setAliases(array('alias1', 'alias2')) + ->setAliases(['alias1', 'alias2']) ->setDescription('command 1 description') ->setHelp('command 1 help') ; diff --git a/vendor/symfony/console/Tests/Fixtures/DescriptorCommand4.php b/vendor/symfony/console/Tests/Fixtures/DescriptorCommand4.php index 13e8e5ba049f62489773d21121f4ac02511df2c0..22dcae0e3c10efcf8fab67869c09db913950eb46 100644 --- a/vendor/symfony/console/Tests/Fixtures/DescriptorCommand4.php +++ b/vendor/symfony/console/Tests/Fixtures/DescriptorCommand4.php @@ -19,7 +19,7 @@ protected function configure() { $this ->setName('descriptor:command4') - ->setAliases(array('descriptor:alias_command4', 'command4:descriptor')) + ->setAliases(['descriptor:alias_command4', 'command4:descriptor']) ; } } diff --git a/vendor/symfony/console/Tests/Fixtures/DummyOutput.php b/vendor/symfony/console/Tests/Fixtures/DummyOutput.php index 866e21437177a0bf6c14fb61b4570627dffd0331..e9cf6ce7dae8bd6ae37c47634d5c6c4d3fc9f5f1 100644 --- a/vendor/symfony/console/Tests/Fixtures/DummyOutput.php +++ b/vendor/symfony/console/Tests/Fixtures/DummyOutput.php @@ -25,7 +25,7 @@ class DummyOutput extends BufferedOutput */ public function getLogs() { - $logs = array(); + $logs = []; foreach (explode(PHP_EOL, trim($this->fetch())) as $message) { preg_match('/^\[(.*)\] (.*)/', $message, $matches); $logs[] = sprintf('%s %s', $matches[1], $matches[2]); diff --git a/vendor/symfony/console/Tests/Fixtures/Foo1Command.php b/vendor/symfony/console/Tests/Fixtures/Foo1Command.php index 254162f320dd74a5fada0a9972eed6269b7d9710..6069576d1540d2f2fa633a5e2153a460078689bd 100644 --- a/vendor/symfony/console/Tests/Fixtures/Foo1Command.php +++ b/vendor/symfony/console/Tests/Fixtures/Foo1Command.php @@ -14,7 +14,7 @@ protected function configure() $this ->setName('foo:bar1') ->setDescription('The foo:bar1 command') - ->setAliases(array('afoobar1')) + ->setAliases(['afoobar1']) ; } diff --git a/vendor/symfony/console/Tests/Fixtures/Foo2Command.php b/vendor/symfony/console/Tests/Fixtures/Foo2Command.php index 8071dc8fb3d86ff80e914f3a3c1dba7914045039..0d9884013ebd7eb472a4d7b91764bce876577506 100644 --- a/vendor/symfony/console/Tests/Fixtures/Foo2Command.php +++ b/vendor/symfony/console/Tests/Fixtures/Foo2Command.php @@ -11,7 +11,7 @@ protected function configure() $this ->setName('foo1:bar') ->setDescription('The foo1:bar command') - ->setAliases(array('afoobar2')) + ->setAliases(['afoobar2']) ; } diff --git a/vendor/symfony/console/Tests/Fixtures/Foo6Command.php b/vendor/symfony/console/Tests/Fixtures/Foo6Command.php index 6ae987e4842558f3039f3d77057b7968f94bd90b..ef5bd7702631b601ba02f2a5cc29990e0c294661 100644 --- a/vendor/symfony/console/Tests/Fixtures/Foo6Command.php +++ b/vendor/symfony/console/Tests/Fixtures/Foo6Command.php @@ -1,6 +1,5 @@ <?php - use Symfony\Component\Console\Command\Command; class Foo6Command extends Command diff --git a/vendor/symfony/console/Tests/Fixtures/FooCommand.php b/vendor/symfony/console/Tests/Fixtures/FooCommand.php index 355e0ad6d63f9853e254763c866982e1af83f1fd..314460044789de9583a9d8b519387d862e79d223 100644 --- a/vendor/symfony/console/Tests/Fixtures/FooCommand.php +++ b/vendor/symfony/console/Tests/Fixtures/FooCommand.php @@ -14,7 +14,7 @@ protected function configure() $this ->setName('foo:bar') ->setDescription('The foo:bar command') - ->setAliases(array('afoobar')) + ->setAliases(['afoobar']) ; } diff --git a/vendor/symfony/console/Tests/Fixtures/FooOptCommand.php b/vendor/symfony/console/Tests/Fixtures/FooOptCommand.php index 9043aa483c20ff8b3bde3c6e0b74ac78111b6d7f..c9054671f94c5e1502c73455277fd0df3cc4179b 100644 --- a/vendor/symfony/console/Tests/Fixtures/FooOptCommand.php +++ b/vendor/symfony/console/Tests/Fixtures/FooOptCommand.php @@ -15,7 +15,7 @@ protected function configure() $this ->setName('foo:bar') ->setDescription('The foo:bar command') - ->setAliases(array('afoobar')) + ->setAliases(['afoobar']) ->addOption('fooopt', 'fo', InputOption::VALUE_OPTIONAL, 'fooopt description') ; } diff --git a/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced1Command.php b/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced1Command.php index fc50c72bfcf874c036435e0bd13fa3fc796622cd..95a4e6152484f2d4888c441c9d16b1d71fce87e1 100644 --- a/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced1Command.php +++ b/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced1Command.php @@ -14,7 +14,7 @@ protected function configure() $this ->setName('foo:bar:baz') ->setDescription('The foo:bar:baz command') - ->setAliases(array('foobarbaz')) + ->setAliases(['foobarbaz']) ; } diff --git a/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced2Command.php b/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced2Command.php index 1cf31ff110c9c5521da03d39c745d3befcdaba96..08c5ff725fe0d711e6fed1ad06ba532ec625f87c 100644 --- a/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced2Command.php +++ b/vendor/symfony/console/Tests/Fixtures/FooSubnamespaced2Command.php @@ -14,7 +14,7 @@ protected function configure() $this ->setName('foo:go:bret') ->setDescription('The foo:bar:go command') - ->setAliases(array('foobargo')) + ->setAliases(['foobargo']) ; } diff --git a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_4.php b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_4.php index 0c5d3fb26ceff43c06a310b70ba95e8c78a11c11..b2f3d99546afb434f5d15b8dbd1ab77b2e9c9af5 100644 --- a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_4.php +++ b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_4.php @@ -20,12 +20,12 @@ //Ensure edge case by appending empty strings to history: $output->write('Lorem ipsum dolor sit amet'); - $output->write(array('', '', '')); + $output->write(['', '', '']); $output->title('Fourth title'); //Ensure have manual control over number of blank lines: $output->writeln('Lorem ipsum dolor sit amet'); - $output->writeln(array('', '')); //Should append an extra blank line + $output->writeln(['', '']); //Should append an extra blank line $output->title('Fifth title'); $output->writeln('Lorem ipsum dolor sit amet'); diff --git a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php index 96433ed5b32d2893b2949fcaa4190b8daa54b289..6fba5737fce39ef7c5c081a4bb88f337d4110009 100644 --- a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php +++ b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php @@ -9,29 +9,29 @@ $output = new SymfonyStyle($input, $output); $output->writeln('Lorem ipsum dolor sit amet'); - $output->listing(array( + $output->listing([ 'Lorem ipsum dolor sit amet', 'consectetur adipiscing elit', - )); + ]); //Even using write: $output->write('Lorem ipsum dolor sit amet'); - $output->listing(array( + $output->listing([ 'Lorem ipsum dolor sit amet', 'consectetur adipiscing elit', - )); + ]); $output->write('Lorem ipsum dolor sit amet'); - $output->text(array( + $output->text([ 'Lorem ipsum dolor sit amet', 'consectetur adipiscing elit', - )); + ]); $output->newLine(); $output->write('Lorem ipsum dolor sit amet'); - $output->comment(array( + $output->comment([ 'Lorem ipsum dolor sit amet', 'consectetur adipiscing elit', - )); + ]); }; diff --git a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_6.php b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_6.php index 8031ec9c30e5ab4788466e694d784596e514353d..3278f6ea05b12bda02c43b8e2a544cad7fffc4b6 100644 --- a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_6.php +++ b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_6.php @@ -8,9 +8,9 @@ return function (InputInterface $input, OutputInterface $output) { $output = new SymfonyStyle($input, $output); - $output->listing(array( + $output->listing([ 'Lorem ipsum dolor sit amet', 'consectetur adipiscing elit', - )); + ]); $output->success('Lorem ipsum dolor sit amet'); }; diff --git a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_7.php b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_7.php index 203eb5b12e6b0edc2b2a869dde02115678b24b3a..037c6ab6b3fe563ad342df339a6b38773689b6ad 100644 --- a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_7.php +++ b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_7.php @@ -9,7 +9,7 @@ $output = new SymfonyStyle($input, $output); $output->title('Title'); $output->askHidden('Hidden question'); - $output->choice('Choice question with default', array('choice1', 'choice2'), 'choice1'); + $output->choice('Choice question with default', ['choice1', 'choice2'], 'choice1'); $output->confirm('Confirmation with yes default', true); $output->text('Duis aute irure dolor in reprehenderit in voluptate velit esse'); }; diff --git a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_8.php b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_8.php index 16b26b523f2d4cec53124d671e2e50dbc9f22835..fe9d484d252b3e352129e8dc0d05677e90d913e5 100644 --- a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_8.php +++ b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_8.php @@ -7,19 +7,19 @@ //Ensure formatting tables when using multiple headers with TableCell return function (InputInterface $input, OutputInterface $output) { - $headers = array( - array(new TableCell('Main table title', array('colspan' => 3))), - array('ISBN', 'Title', 'Author'), - ); + $headers = [ + [new TableCell('Main table title', ['colspan' => 3])], + ['ISBN', 'Title', 'Author'], + ]; - $rows = array( - array( + $rows = [ + [ '978-0521567817', 'De Monarchia', - new TableCell("Dante Alighieri\nspans multiple rows", array('rowspan' => 2)), - ), - array('978-0804169127', 'Divine Comedy'), - ); + new TableCell("Dante Alighieri\nspans multiple rows", ['rowspan' => 2]), + ], + ['978-0804169127', 'Divine Comedy'], + ]; $output = new SymfonyStyle($input, $output); $output->table($headers, $rows); diff --git a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php index 57afdf06b43f0e8a5d5282e804c5476c736a703e..73af4ae1e26147631f2dfbfbdc4c96df30025910 100644 --- a/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php +++ b/vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php @@ -7,5 +7,5 @@ //Ensure that all lines are aligned to the begin of the first line in a multi-line block return function (InputInterface $input, OutputInterface $output) { $output = new SymfonyStyle($input, $output); - $output->block(array('Custom block', 'Second custom block line'), 'CUSTOM', 'fg=white;bg=green', 'X ', true); + $output->block(['Custom block', 'Second custom block line'], 'CUSTOM', 'fg=white;bg=green', 'X ', true); }; diff --git a/vendor/symfony/console/Tests/Fixtures/TestCommand.php b/vendor/symfony/console/Tests/Fixtures/TestCommand.php index dcd32739c4c36efbece6b03a5173b77198d67aca..eb7ccb33f6ca5ecc3d48dcd136a8b8f336fa6dec 100644 --- a/vendor/symfony/console/Tests/Fixtures/TestCommand.php +++ b/vendor/symfony/console/Tests/Fixtures/TestCommand.php @@ -10,7 +10,7 @@ protected function configure() { $this ->setName('namespace:name') - ->setAliases(array('name')) + ->setAliases(['name']) ->setDescription('description') ->setHelp('help') ; diff --git a/vendor/symfony/console/Tests/Fixtures/TestToto.php b/vendor/symfony/console/Tests/Fixtures/TestToto.php index f14805db68e6ced098bba8351110b696c68b8252..2e6a8195938bbd570ab4641ae199f6b2c4413cc2 100644 --- a/vendor/symfony/console/Tests/Fixtures/TestToto.php +++ b/vendor/symfony/console/Tests/Fixtures/TestToto.php @@ -11,7 +11,7 @@ protected function configure() $this ->setName('test-toto') ->setDescription('The test-toto command') - ->setAliases(array('test')) + ->setAliases(['test']) ; } diff --git a/vendor/symfony/console/Tests/Formatter/OutputFormatterStyleTest.php b/vendor/symfony/console/Tests/Formatter/OutputFormatterStyleTest.php index ddf77902c90e985d9d33bea56fb432be6575b60d..d47760fe4e3e7a93a0fa2591ba22f99120f69219 100644 --- a/vendor/symfony/console/Tests/Formatter/OutputFormatterStyleTest.php +++ b/vendor/symfony/console/Tests/Formatter/OutputFormatterStyleTest.php @@ -18,10 +18,10 @@ class OutputFormatterStyleTest extends TestCase { public function testConstructor() { - $style = new OutputFormatterStyle('green', 'black', array('bold', 'underscore')); + $style = new OutputFormatterStyle('green', 'black', ['bold', 'underscore']); $this->assertEquals("\033[32;40;1;4mfoo\033[39;49;22;24m", $style->apply('foo')); - $style = new OutputFormatterStyle('red', null, array('blink')); + $style = new OutputFormatterStyle('red', null, ['blink']); $this->assertEquals("\033[31;5mfoo\033[39;25m", $style->apply('foo')); $style = new OutputFormatterStyle(null, 'white'); @@ -66,7 +66,7 @@ public function testOptions() { $style = new OutputFormatterStyle(); - $style->setOptions(array('reverse', 'conceal')); + $style->setOptions(['reverse', 'conceal']); $this->assertEquals("\033[7;8mfoo\033[27;28m", $style->apply('foo')); $style->setOption('bold'); @@ -78,7 +78,7 @@ public function testOptions() $style->setOption('bold'); $this->assertEquals("\033[8;1mfoo\033[28;22m", $style->apply('foo')); - $style->setOptions(array('bold')); + $style->setOptions(['bold']); $this->assertEquals("\033[1mfoo\033[22m", $style->apply('foo')); try { diff --git a/vendor/symfony/console/Tests/Formatter/OutputFormatterTest.php b/vendor/symfony/console/Tests/Formatter/OutputFormatterTest.php index 4b715c680d3d3e6f450804d4a9a77cf1549e4e62..c5c2daed25d998f773c1a683b99e481c1ec3034a 100644 --- a/vendor/symfony/console/Tests/Formatter/OutputFormatterTest.php +++ b/vendor/symfony/console/Tests/Formatter/OutputFormatterTest.php @@ -184,16 +184,16 @@ public function testInlineStyleOptions($tag, $expected = null, $input = null) public function provideInlineStyleOptionsCases() { - return array( - array('<unknown=_unknown_>'), - array('<unknown=_unknown_;a=1;b>'), - array('<fg=green;>', "\033[32m[test]\033[39m", '[test]'), - array('<fg=green;bg=blue;>', "\033[32;44ma\033[39;49m", 'a'), - array('<fg=green;options=bold>', "\033[32;1mb\033[39;22m", 'b'), - array('<fg=green;options=reverse;>', "\033[32;7m<a>\033[39;27m", '<a>'), - array('<fg=green;options=bold,underscore>', "\033[32;1;4mz\033[39;22;24m", 'z'), - array('<fg=green;options=bold,underscore,reverse;>', "\033[32;1;4;7md\033[39;22;24;27m", 'd'), - ); + return [ + ['<unknown=_unknown_>'], + ['<unknown=_unknown_;a=1;b>'], + ['<fg=green;>', "\033[32m[test]\033[39m", '[test]'], + ['<fg=green;bg=blue;>', "\033[32;44ma\033[39;49m", 'a'], + ['<fg=green;options=bold>', "\033[32;1mb\033[39;22m", 'b'], + ['<fg=green;options=reverse;>', "\033[32;7m<a>\033[39;27m", '<a>'], + ['<fg=green;options=bold,underscore>', "\033[32;1;4mz\033[39;22;24m", 'z'], + ['<fg=green;options=bold,underscore,reverse;>', "\033[32;1;4;7md\033[39;22;24;27m", 'd'], + ]; } /** @@ -209,12 +209,12 @@ public function testInlineStyleOptionsUnknownAreDeprecated($tag, $option) public function provideInlineStyleTagsWithUnknownOptions() { - return array( - array('<options=abc;>', 'abc'), - array('<options=abc,def;>', 'abc'), - array('<fg=green;options=xyz;>', 'xyz'), - array('<fg=green;options=efg,abc>', 'efg'), - ); + return [ + ['<options=abc;>', 'abc'], + ['<options=abc,def;>', 'abc'], + ['<fg=green;options=xyz;>', 'xyz'], + ['<fg=green;options=efg,abc>', 'efg'], + ]; } public function testNonStyleTag() diff --git a/vendor/symfony/console/Tests/Helper/FormatterHelperTest.php b/vendor/symfony/console/Tests/Helper/FormatterHelperTest.php index f5d891a1a3acc4961bfd832afa12687143472c9c..934e11ac1b0a34cd1459575538ead5afa1989b28 100644 --- a/vendor/symfony/console/Tests/Helper/FormatterHelperTest.php +++ b/vendor/symfony/console/Tests/Helper/FormatterHelperTest.php @@ -40,7 +40,7 @@ public function testFormatBlock() $this->assertEquals( '<error> Some text to display </error>'."\n". '<error> foo bar </error>', - $formatter->formatBlock(array('Some text to display', 'foo bar'), 'error'), + $formatter->formatBlock(['Some text to display', 'foo bar'], 'error'), '::formatBlock() formats a message in a block' ); diff --git a/vendor/symfony/console/Tests/Helper/HelperSetTest.php b/vendor/symfony/console/Tests/Helper/HelperSetTest.php index 0fdb2cefbe4214e89599e49a16734f80cd2bdba1..826bc51dcd62be04d17de510f54db7b86dfc49ed 100644 --- a/vendor/symfony/console/Tests/Helper/HelperSetTest.php +++ b/vendor/symfony/console/Tests/Helper/HelperSetTest.php @@ -20,7 +20,7 @@ class HelperSetTest extends TestCase public function testConstructor() { $mock_helper = $this->getGenericMockHelper('fake_helper'); - $helperset = new HelperSet(array('fake_helper_alias' => $mock_helper)); + $helperset = new HelperSet(['fake_helper_alias' => $mock_helper]); $this->assertEquals($mock_helper, $helperset->get('fake_helper_alias'), '__construct sets given helper to helpers'); $this->assertTrue($helperset->has('fake_helper_alias'), '__construct sets helper alias for given helper'); @@ -46,7 +46,7 @@ public function testSet() public function testHas() { - $helperset = new HelperSet(array('fake_helper_alias' => $this->getGenericMockHelper('fake_helper'))); + $helperset = new HelperSet(['fake_helper_alias' => $this->getGenericMockHelper('fake_helper')]); $this->assertTrue($helperset->has('fake_helper'), '->has() finds set helper'); $this->assertTrue($helperset->has('fake_helper_alias'), '->has() finds set helper by alias'); } @@ -55,7 +55,7 @@ public function testGet() { $helper_01 = $this->getGenericMockHelper('fake_helper_01'); $helper_02 = $this->getGenericMockHelper('fake_helper_02'); - $helperset = new HelperSet(array('fake_helper_01_alias' => $helper_01, 'fake_helper_02_alias' => $helper_02)); + $helperset = new HelperSet(['fake_helper_01_alias' => $helper_01, 'fake_helper_02_alias' => $helper_02]); $this->assertEquals($helper_01, $helperset->get('fake_helper_01'), '->get() returns correct helper by name'); $this->assertEquals($helper_01, $helperset->get('fake_helper_01_alias'), '->get() returns correct helper by alias'); $this->assertEquals($helper_02, $helperset->get('fake_helper_02'), '->get() returns correct helper by name'); @@ -101,7 +101,7 @@ public function testIteration() $helperset->set($this->getGenericMockHelper('fake_helper_01', $helperset)); $helperset->set($this->getGenericMockHelper('fake_helper_02', $helperset)); - $helpers = array('fake_helper_01', 'fake_helper_02'); + $helpers = ['fake_helper_01', 'fake_helper_02']; $i = 0; foreach ($helperset as $helper) { diff --git a/vendor/symfony/console/Tests/Helper/HelperTest.php b/vendor/symfony/console/Tests/Helper/HelperTest.php index 1847582444d1f0ba7195484b399068f1fa5aae85..184d86e092aba4bb4fde1b79073cad6a511101f4 100644 --- a/vendor/symfony/console/Tests/Helper/HelperTest.php +++ b/vendor/symfony/console/Tests/Helper/HelperTest.php @@ -18,28 +18,28 @@ class HelperTest extends TestCase { public function formatTimeProvider() { - return array( - array(0, '< 1 sec'), - array(1, '1 sec'), - array(2, '2 secs'), - array(59, '59 secs'), - array(60, '1 min'), - array(61, '1 min'), - array(119, '1 min'), - array(120, '2 mins'), - array(121, '2 mins'), - array(3599, '59 mins'), - array(3600, '1 hr'), - array(7199, '1 hr'), - array(7200, '2 hrs'), - array(7201, '2 hrs'), - array(86399, '23 hrs'), - array(86400, '1 day'), - array(86401, '1 day'), - array(172799, '1 day'), - array(172800, '2 days'), - array(172801, '2 days'), - ); + return [ + [0, '< 1 sec'], + [1, '1 sec'], + [2, '2 secs'], + [59, '59 secs'], + [60, '1 min'], + [61, '1 min'], + [119, '1 min'], + [120, '2 mins'], + [121, '2 mins'], + [3599, '59 mins'], + [3600, '1 hr'], + [7199, '1 hr'], + [7200, '2 hrs'], + [7201, '2 hrs'], + [86399, '23 hrs'], + [86400, '1 day'], + [86401, '1 day'], + [172799, '1 day'], + [172800, '2 days'], + [172801, '2 days'], + ]; } /** diff --git a/vendor/symfony/console/Tests/Helper/ProcessHelperTest.php b/vendor/symfony/console/Tests/Helper/ProcessHelperTest.php index 382c9f4c17627bf7373488902063adb0a29bbda7..044c690d6daf741915c3508f9cc899d4f4dab574 100644 --- a/vendor/symfony/console/Tests/Helper/ProcessHelperTest.php +++ b/vendor/symfony/console/Tests/Helper/ProcessHelperTest.php @@ -26,7 +26,7 @@ class ProcessHelperTest extends TestCase public function testVariousProcessRuns($expected, $cmd, $verbosity, $error) { $helper = new ProcessHelper(); - $helper->setHelperSet(new HelperSet(array(new DebugFormatterHelper()))); + $helper->setHelperSet(new HelperSet([new DebugFormatterHelper()])); $output = $this->getOutputStream($verbosity); $helper->run($output, $cmd, $error); $this->assertEquals($expected, $this->getOutput($output)); @@ -35,7 +35,7 @@ public function testVariousProcessRuns($expected, $cmd, $verbosity, $error) public function testPassedCallbackIsExecuted() { $helper = new ProcessHelper(); - $helper->setHelperSet(new HelperSet(array(new DebugFormatterHelper()))); + $helper->setHelperSet(new HelperSet([new DebugFormatterHelper()])); $output = $this->getOutputStream(StreamOutput::VERBOSITY_NORMAL); $executed = false; @@ -84,24 +84,24 @@ public function provideCommandsAndOutput() EOT; $errorMessage = 'An error occurred'; - $args = new Process(array('php', '-r', 'echo 42;')); + $args = new Process(['php', '-r', 'echo 42;']); $args = $args->getCommandLine(); $successOutputProcessDebug = str_replace("'php' '-r' 'echo 42;'", $args, $successOutputProcessDebug); - return array( - array('', 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERBOSE, null), - array($successOutputVerbose, 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERY_VERBOSE, null), - array($successOutputDebug, 'php -r "echo 42;"', StreamOutput::VERBOSITY_DEBUG, null), - array($successOutputDebugWithTags, 'php -r "echo \'<info>42</info>\';"', StreamOutput::VERBOSITY_DEBUG, null), - array('', 'php -r "syntax error"', StreamOutput::VERBOSITY_VERBOSE, null), - array($syntaxErrorOutputVerbose, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, null), - array($syntaxErrorOutputDebug, 'php -r "fwrite(STDERR, \'error message\');usleep(500000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, null), - array($errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERBOSE, $errorMessage), - array($syntaxErrorOutputVerbose.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, $errorMessage), - array($syntaxErrorOutputDebug.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(500000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, $errorMessage), - array($successOutputProcessDebug, array('php', '-r', 'echo 42;'), StreamOutput::VERBOSITY_DEBUG, null), - array($successOutputDebug, new Process('php -r "echo 42;"'), StreamOutput::VERBOSITY_DEBUG, null), - ); + return [ + ['', 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERBOSE, null], + [$successOutputVerbose, 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERY_VERBOSE, null], + [$successOutputDebug, 'php -r "echo 42;"', StreamOutput::VERBOSITY_DEBUG, null], + [$successOutputDebugWithTags, 'php -r "echo \'<info>42</info>\';"', StreamOutput::VERBOSITY_DEBUG, null], + ['', 'php -r "syntax error"', StreamOutput::VERBOSITY_VERBOSE, null], + [$syntaxErrorOutputVerbose, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, null], + [$syntaxErrorOutputDebug, 'php -r "fwrite(STDERR, \'error message\');usleep(500000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, null], + [$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERBOSE, $errorMessage], + [$syntaxErrorOutputVerbose.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, $errorMessage], + [$syntaxErrorOutputDebug.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(500000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, $errorMessage], + [$successOutputProcessDebug, ['php', '-r', 'echo 42;'], StreamOutput::VERBOSITY_DEBUG, null], + [$successOutputDebug, new Process('php -r "echo 42;"'), StreamOutput::VERBOSITY_DEBUG, null], + ]; } private function getOutputStream($verbosity) diff --git a/vendor/symfony/console/Tests/Helper/ProgressBarTest.php b/vendor/symfony/console/Tests/Helper/ProgressBarTest.php index 4c2de26a8638fcaca61c111c37c303a3861fccf6..e352311ccad0976375662ff0580845cdf5794a5f 100644 --- a/vendor/symfony/console/Tests/Helper/ProgressBarTest.php +++ b/vendor/symfony/console/Tests/Helper/ProgressBarTest.php @@ -752,12 +752,12 @@ public function testFormatsWithoutMax($format) */ public function provideFormat() { - return array( - array('normal'), - array('verbose'), - array('very_verbose'), - array('debug'), - ); + return [ + ['normal'], + ['verbose'], + ['very_verbose'], + ['debug'], + ]; } protected function getOutputStream($decorated = true, $verbosity = StreamOutput::VERBOSITY_NORMAL) diff --git a/vendor/symfony/console/Tests/Helper/ProgressIndicatorTest.php b/vendor/symfony/console/Tests/Helper/ProgressIndicatorTest.php index c85018dece7ef35e4ad207c4525cb553d5e91ede..6c6f86f36e3f99dfa5214e10ba54a9f7d7d2f564 100644 --- a/vendor/symfony/console/Tests/Helper/ProgressIndicatorTest.php +++ b/vendor/symfony/console/Tests/Helper/ProgressIndicatorTest.php @@ -79,7 +79,7 @@ public function testNonDecoratedOutput() public function testCustomIndicatorValues() { - $bar = new ProgressIndicator($output = $this->getOutputStream(), null, 100, array('a', 'b', 'c')); + $bar = new ProgressIndicator($output = $this->getOutputStream(), null, 100, ['a', 'b', 'c']); $bar->start('Starting...'); usleep(101000); @@ -106,7 +106,7 @@ public function testCustomIndicatorValues() */ public function testCannotSetInvalidIndicatorCharacters() { - $bar = new ProgressIndicator($this->getOutputStream(), null, 100, array('1')); + $bar = new ProgressIndicator($this->getOutputStream(), null, 100, ['1']); } /** @@ -161,12 +161,12 @@ public function testFormats($format) */ public function provideFormat() { - return array( - array('normal'), - array('verbose'), - array('very_verbose'), - array('debug'), - ); + return [ + ['normal'], + ['verbose'], + ['very_verbose'], + ['debug'], + ]; } protected function getOutputStream($decorated = true, $verbosity = StreamOutput::VERBOSITY_NORMAL) diff --git a/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php b/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php index 675f95aa010ef02633243bf31fca314ddbaaaebe..46cfe8184278dc3d375199bfa909d7e2730f4168 100644 --- a/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php +++ b/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php @@ -29,10 +29,10 @@ public function testAskChoice() { $questionHelper = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $questionHelper->setHelperSet($helperSet); - $heroes = array('Superman', 'Batman', 'Spiderman'); + $heroes = ['Superman', 'Batman', 'Spiderman']; $inputStream = $this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"); @@ -68,27 +68,84 @@ public function testAskChoice() $question->setMaxAttempts(1); $question->setMultiselect(true); - $this->assertEquals(array('Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); - $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); - $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); + $this->assertEquals(['Batman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Spiderman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Spiderman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1'); $question->setMaxAttempts(1); $question->setMultiselect(true); - $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Batman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 '); $question->setMaxAttempts(1); $question->setMultiselect(true); - $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Batman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, 0); // We are supposed to get the default value since we are not in interactive mode $this->assertEquals('Superman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, true), $this->createOutputInterface(), $question)); } + public function testAskChoiceNonInteractive() + { + $questionHelper = new QuestionHelper(); + + $helperSet = new HelperSet([new FormatterHelper()]); + $questionHelper->setHelperSet($helperSet); + $inputStream = $this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"); + + $heroes = ['Superman', 'Batman', 'Spiderman']; + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0'); + + $this->assertSame('Superman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, 'Batman'); + $this->assertSame('Batman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null); + $this->assertNull($questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0'); + $question->setValidator(null); + $this->assertSame('Superman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + try { + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null); + $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question); + } catch (\InvalidArgumentException $e) { + $this->assertSame('Value "" is invalid', $e->getMessage()); + } + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, 1'); + $question->setMultiselect(true); + $this->assertSame(['Superman', 'Batman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, 1'); + $question->setMultiselect(true); + $question->setValidator(null); + $this->assertSame(['Superman', 'Batman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, Batman'); + $question->setMultiselect(true); + $this->assertSame(['Superman', 'Batman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, null); + $question->setMultiselect(true); + $this->assertNull($questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + try { + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, ''); + $question->setMultiselect(true); + $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question); + } catch (\InvalidArgumentException $e) { + $this->assertSame('Value "" is invalid', $e->getMessage()); + } + } + public function testAsk() { $dialog = new QuestionHelper(); @@ -122,11 +179,11 @@ public function testAskWithAutocomplete() $inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\n"); $dialog = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new Question('Please select a bundle', 'FrameworkBundle'); - $question->setAutocompleterValues(array('AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle')); + $question->setAutocompleterValues(['AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle']); $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); $this->assertEquals('AsseticBundleTest', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); @@ -148,9 +205,9 @@ public function testAskWithAutocompleteWithNonSequentialKeys() $inputStream = $this->getInputStream("\033[A\033[A\n\033[B\033[B\n"); $dialog = new QuestionHelper(); - $dialog->setHelperSet(new HelperSet(array(new FormatterHelper()))); + $dialog->setHelperSet(new HelperSet([new FormatterHelper()])); - $question = new ChoiceQuestion('Please select a bundle', array(1 => 'AcmeDemoBundle', 4 => 'AsseticBundle')); + $question = new ChoiceQuestion('Please select a bundle', [1 => 'AcmeDemoBundle', 4 => 'AsseticBundle']); $question->setMaxAttempts(1); $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); @@ -165,14 +222,14 @@ public function testAskWithAutocompleteWithExactMatch() $inputStream = $this->getInputStream("b\n"); - $possibleChoices = array( + $possibleChoices = [ 'a' => 'berlin', 'b' => 'copenhagen', 'c' => 'amsterdam', - ); + ]; $dialog = new QuestionHelper(); - $dialog->setHelperSet(new HelperSet(array(new FormatterHelper()))); + $dialog->setHelperSet(new HelperSet([new FormatterHelper()])); $question = new ChoiceQuestion('Please select a city', $possibleChoices); $question->setMaxAttempts(1); @@ -180,6 +237,43 @@ public function testAskWithAutocompleteWithExactMatch() $this->assertSame('b', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); } + public function getInputs() + { + return [ + ['$'], // 1 byte character + ['¢'], // 2 bytes character + ['€'], // 3 bytes character + ['𐍈'], // 4 bytes character + ]; + } + + /** + * @dataProvider getInputs + */ + public function testAskWithAutocompleteWithMultiByteCharacter($character) + { + if (!$this->hasSttyAvailable()) { + $this->markTestSkipped('`stty` is required to test autocomplete functionality'); + } + + $inputStream = $this->getInputStream("$character\n"); + + $possibleChoices = [ + '$' => '1 byte character', + '¢' => '2 bytes character', + '€' => '3 bytes character', + '𐍈' => '4 bytes character', + ]; + + $dialog = new QuestionHelper(); + $dialog->setHelperSet(new HelperSet([new FormatterHelper()])); + + $question = new ChoiceQuestion('Please select a character', $possibleChoices); + $question->setMaxAttempts(1); + + $this->assertSame($character, $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); + } + public function testAutocompleteWithTrailingBackslash() { if (!$this->hasSttyAvailable()) { @@ -189,12 +283,12 @@ public function testAutocompleteWithTrailingBackslash() $inputStream = $this->getInputStream('E'); $dialog = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new Question(''); $expectedCompletion = 'ExampleNamespace\\'; - $question->setAutocompleterValues(array($expectedCompletion)); + $question->setAutocompleterValues([$expectedCompletion]); $output = $this->createOutputInterface(); $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $output, $question); @@ -205,11 +299,11 @@ public function testAutocompleteWithTrailingBackslash() // Shell control (esc) sequences are not so important: we only care that // <hl> tag is interpreted correctly and replaced - $irrelevantEscSequences = array( + $irrelevantEscSequences = [ "\0337" => '', // Save cursor position "\0338" => '', // Restore cursor position "\033[K" => '', // Clear line from cursor till the end - ); + ]; $importantActualOutput = strtr($actualOutput, $irrelevantEscSequences); @@ -247,14 +341,14 @@ public function testAskConfirmation($question, $expected, $default = true) public function getAskConfirmationData() { - return array( - array('', true), - array('', false, false), - array('y', true), - array('yes', true), - array('n', false), - array('no', false), - ); + return [ + ['', true], + ['', false, false], + ['y', true], + ['yes', true], + ['n', false], + ['no', false], + ]; } public function testAskConfirmationWithCustomTrueAnswer() @@ -271,12 +365,12 @@ public function testAskConfirmationWithCustomTrueAnswer() public function testAskAndValidate() { $dialog = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $error = 'This is not a color!'; $validator = function ($color) use ($error) { - if (!\in_array($color, array('white', 'black'))) { + if (!\in_array($color, ['white', 'black'])) { throw new \InvalidArgumentException($error); } @@ -304,14 +398,14 @@ public function testAskAndValidate() */ public function testSelectChoiceFromSimpleChoices($providedAnswer, $expectedValue) { - $possibleChoices = array( + $possibleChoices = [ 'My environment 1', 'My environment 2', 'My environment 3', - ); + ]; $dialog = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); @@ -323,14 +417,14 @@ public function testSelectChoiceFromSimpleChoices($providedAnswer, $expectedValu public function simpleAnswerProvider() { - return array( - array(0, 'My environment 1'), - array(1, 'My environment 2'), - array(2, 'My environment 3'), - array('My environment 1', 'My environment 1'), - array('My environment 2', 'My environment 2'), - array('My environment 3', 'My environment 3'), - ); + return [ + [0, 'My environment 1'], + [1, 'My environment 2'], + [2, 'My environment 3'], + ['My environment 1', 'My environment 1'], + ['My environment 2', 'My environment 2'], + ['My environment 3', 'My environment 3'], + ]; } /** @@ -338,14 +432,14 @@ public function simpleAnswerProvider() */ public function testSpecialCharacterChoiceFromMultipleChoiceList($providedAnswer, $expectedValue) { - $possibleChoices = array( + $possibleChoices = [ '.', 'src', - ); + ]; $dialog = new QuestionHelper(); $inputStream = $this->getInputStream($providedAnswer."\n"); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new ChoiceQuestion('Please select the directory', $possibleChoices); @@ -358,10 +452,10 @@ public function testSpecialCharacterChoiceFromMultipleChoiceList($providedAnswer public function specialCharacterInMultipleChoice() { - return array( - array('.', array('.')), - array('., src', array('.', 'src')), - ); + return [ + ['.', ['.']], + ['., src', ['.', 'src']], + ]; } /** @@ -369,15 +463,15 @@ public function specialCharacterInMultipleChoice() */ public function testChoiceFromChoicelistWithMixedKeys($providedAnswer, $expectedValue) { - $possibleChoices = array( + $possibleChoices = [ '0' => 'No environment', '1' => 'My environment 1', 'env_2' => 'My environment 2', 3 => 'My environment 3', - ); + ]; $dialog = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); @@ -389,14 +483,14 @@ public function testChoiceFromChoicelistWithMixedKeys($providedAnswer, $expected public function mixedKeysChoiceListAnswerProvider() { - return array( - array('0', '0'), - array('No environment', '0'), - array('1', '1'), - array('env_2', 'env_2'), - array(3, '3'), - array('My environment 1', '1'), - ); + return [ + ['0', '0'], + ['No environment', '0'], + ['1', '1'], + ['env_2', 'env_2'], + [3, '3'], + ['My environment 1', '1'], + ]; } /** @@ -404,14 +498,14 @@ public function mixedKeysChoiceListAnswerProvider() */ public function testSelectChoiceFromChoiceList($providedAnswer, $expectedValue) { - $possibleChoices = array( + $possibleChoices = [ 'env_1' => 'My environment 1', 'env_2' => 'My environment', 'env_3' => 'My environment', - ); + ]; $dialog = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); @@ -427,14 +521,14 @@ public function testSelectChoiceFromChoiceList($providedAnswer, $expectedValue) */ public function testAmbiguousChoiceFromChoicelist() { - $possibleChoices = array( + $possibleChoices = [ 'env_1' => 'My first environment', 'env_2' => 'My environment', 'env_3' => 'My environment', - ); + ]; $dialog = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); @@ -445,12 +539,12 @@ public function testAmbiguousChoiceFromChoicelist() public function answerProvider() { - return array( - array('env_1', 'env_1'), - array('env_2', 'env_2'), - array('env_3', 'env_3'), - array('My environment 1', 'env_1'), - ); + return [ + ['env_1', 'env_1'], + ['env_2', 'env_2'], + ['env_3', 'env_3'], + ['My environment 1', 'env_1'], + ]; } public function testNoInteraction() @@ -466,22 +560,22 @@ public function testNoInteraction() public function testChoiceOutputFormattingQuestionForUtf8Keys() { $question = 'Lorem ipsum?'; - $possibleChoices = array( + $possibleChoices = [ 'foo' => 'foo', 'żółw' => 'bar', 'łabądź' => 'baz', - ); - $outputShown = array( + ]; + $outputShown = [ $question, ' [<info>foo </info>] foo', ' [<info>żółw </info>] bar', ' [<info>łabądź</info>] baz', - ); + ]; $output = $this->getMockBuilder('\Symfony\Component\Console\Output\OutputInterface')->getMock(); $output->method('getFormatter')->willReturn(new OutputFormatter()); $dialog = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $output->expects($this->once())->method('writeln')->with($this->equalTo($outputShown)); @@ -497,10 +591,10 @@ public function testLegacyAskChoice() { $questionHelper = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $questionHelper->setHelperSet($helperSet); - $heroes = array('Superman', 'Batman', 'Spiderman'); + $heroes = ['Superman', 'Batman', 'Spiderman']; $questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n")); @@ -536,21 +630,21 @@ public function testLegacyAskChoice() $question->setMaxAttempts(1); $question->setMultiselect(true); - $this->assertEquals(array('Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); - $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals(['Batman'], $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Spiderman'], $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Spiderman'], $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1'); $question->setMaxAttempts(1); $question->setMultiselect(true); - $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Batman'], $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 '); $question->setMaxAttempts(1); $question->setMultiselect(true); - $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Batman'], $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); } /** @@ -593,11 +687,11 @@ public function testLegacyAskWithAutocomplete() $dialog = new QuestionHelper(); $dialog->setInputStream($inputStream); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new Question('Please select a bundle', 'FrameworkBundle'); - $question->setAutocompleterValues(array('AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle')); + $question->setAutocompleterValues(['AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle']); $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); $this->assertEquals('AsseticBundleTest', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); @@ -623,9 +717,9 @@ public function testLegacyAskWithAutocompleteWithNonSequentialKeys() $dialog = new QuestionHelper(); $dialog->setInputStream($inputStream); - $dialog->setHelperSet(new HelperSet(array(new FormatterHelper()))); + $dialog->setHelperSet(new HelperSet([new FormatterHelper()])); - $question = new ChoiceQuestion('Please select a bundle', array(1 => 'AcmeDemoBundle', 4 => 'AsseticBundle')); + $question = new ChoiceQuestion('Please select a bundle', [1 => 'AcmeDemoBundle', 4 => 'AsseticBundle']); $question->setMaxAttempts(1); $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); @@ -683,12 +777,12 @@ public function testLegacyAskConfirmationWithCustomTrueAnswer() public function testLegacyAskAndValidate() { $dialog = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $error = 'This is not a color!'; $validator = function ($color) use ($error) { - if (!\in_array($color, array('white', 'black'))) { + if (!\in_array($color, ['white', 'black'])) { throw new \InvalidArgumentException($error); } @@ -718,15 +812,15 @@ public function testLegacyAskAndValidate() */ public function testLegacySelectChoiceFromSimpleChoices($providedAnswer, $expectedValue) { - $possibleChoices = array( + $possibleChoices = [ 'My environment 1', 'My environment 2', 'My environment 3', - ); + ]; $dialog = new QuestionHelper(); $dialog->setInputStream($this->getInputStream($providedAnswer."\n")); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); @@ -742,16 +836,16 @@ public function testLegacySelectChoiceFromSimpleChoices($providedAnswer, $expect */ public function testLegacyChoiceFromChoicelistWithMixedKeys($providedAnswer, $expectedValue) { - $possibleChoices = array( + $possibleChoices = [ '0' => 'No environment', '1' => 'My environment 1', 'env_2' => 'My environment 2', 3 => 'My environment 3', - ); + ]; $dialog = new QuestionHelper(); $dialog->setInputStream($this->getInputStream($providedAnswer."\n")); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); @@ -767,15 +861,15 @@ public function testLegacyChoiceFromChoicelistWithMixedKeys($providedAnswer, $ex */ public function testLegacySelectChoiceFromChoiceList($providedAnswer, $expectedValue) { - $possibleChoices = array( + $possibleChoices = [ 'env_1' => 'My environment 1', 'env_2' => 'My environment', 'env_3' => 'My environment', - ); + ]; $dialog = new QuestionHelper(); $dialog->setInputStream($this->getInputStream($providedAnswer."\n")); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); @@ -792,15 +886,15 @@ public function testLegacySelectChoiceFromChoiceList($providedAnswer, $expectedV */ public function testLegacyAmbiguousChoiceFromChoicelist() { - $possibleChoices = array( + $possibleChoices = [ 'env_1' => 'My first environment', 'env_2' => 'My environment', 'env_3' => 'My environment', - ); + ]; $dialog = new QuestionHelper(); $dialog->setInputStream($this->getInputStream("My environment\n")); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); @@ -816,23 +910,23 @@ public function testLegacyAmbiguousChoiceFromChoicelist() public function testLegacyChoiceOutputFormattingQuestionForUtf8Keys() { $question = 'Lorem ipsum?'; - $possibleChoices = array( + $possibleChoices = [ 'foo' => 'foo', 'żółw' => 'bar', 'łabądź' => 'baz', - ); - $outputShown = array( + ]; + $outputShown = [ $question, ' [<info>foo </info>] foo', ' [<info>żółw </info>] bar', ' [<info>łabądź</info>] baz', - ); + ]; $output = $this->getMockBuilder('\Symfony\Component\Console\Output\OutputInterface')->getMock(); $output->method('getFormatter')->willReturn(new OutputFormatter()); $dialog = new QuestionHelper(); $dialog->setInputStream($this->getInputStream("\n")); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $output->expects($this->once())->method('writeln')->with($this->equalTo($outputShown)); @@ -843,7 +937,7 @@ public function testLegacyChoiceOutputFormattingQuestionForUtf8Keys() /** * @expectedException \Symfony\Component\Console\Exception\RuntimeException - * @expectedExceptionMessage Aborted + * @expectedExceptionMessage Aborted. */ public function testAskThrowsExceptionOnMissingInput() { @@ -853,7 +947,17 @@ public function testAskThrowsExceptionOnMissingInput() /** * @expectedException \Symfony\Component\Console\Exception\RuntimeException - * @expectedExceptionMessage Aborted + * @expectedExceptionMessage Aborted. + */ + public function testAskThrowsExceptionOnMissingInputForChoiceQuestion() + { + $dialog = new QuestionHelper(); + $dialog->ask($this->createStreamableInputInterfaceMock($this->getInputStream('')), $this->createOutputInterface(), new ChoiceQuestion('Choice', ['a', 'b'])); + } + + /** + * @expectedException \Symfony\Component\Console\Exception\RuntimeException + * @expectedExceptionMessage Aborted. */ public function testAskThrowsExceptionOnMissingInputWithValidator() { @@ -875,7 +979,7 @@ public function testAskThrowsExceptionOnMissingInputWithValidator() */ public function testEmptyChoices() { - new ChoiceQuestion('Question', array(), 'irrelevant'); + new ChoiceQuestion('Question', [], 'irrelevant'); } public function testTraversableAutocomplete() @@ -895,11 +999,11 @@ public function testTraversableAutocomplete() $inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\n"); $dialog = new QuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $dialog->setHelperSet($helperSet); $question = new Question('Please select a bundle', 'FrameworkBundle'); - $question->setAutocompleterValues(new AutocompleteValues(array('irrelevant' => 'AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle'))); + $question->setAutocompleterValues(new AutocompleteValues(['irrelevant' => 'AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle'])); $this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); $this->assertEquals('AsseticBundleTest', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); diff --git a/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php b/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php index fff72d4271b59deb74b4bdd2bf35ef5907f0d05a..cf7a78c34ecdad91f3f8882d70e243d6c2cbd423 100644 --- a/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php +++ b/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php @@ -18,10 +18,10 @@ public function testAskChoice() { $questionHelper = new SymfonyQuestionHelper(); - $helperSet = new HelperSet(array(new FormatterHelper())); + $helperSet = new HelperSet([new FormatterHelper()]); $questionHelper->setHelperSet($helperSet); - $heroes = array('Superman', 'Batman', 'Spiderman'); + $heroes = ['Superman', 'Batman', 'Spiderman']; $inputStream = $this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"); @@ -55,25 +55,37 @@ public function testAskChoice() $question->setMaxAttempts(1); $question->setMultiselect(true); - $this->assertEquals(array('Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); - $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); - $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); + $this->assertEquals(['Batman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Spiderman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Spiderman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question)); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1'); $question->setMaxAttempts(1); $question->setMultiselect(true); - $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $output = $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Batman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $output = $this->createOutputInterface(), $question)); $this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 '); $question->setMaxAttempts(1); $question->setMultiselect(true); - $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $output = $this->createOutputInterface(), $question)); + $this->assertEquals(['Superman', 'Batman'], $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $output = $this->createOutputInterface(), $question)); $this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output); } + public function testAskChoiceWithChoiceValueAsDefault() + { + $questionHelper = new SymfonyQuestionHelper(); + $helperSet = new HelperSet([new FormatterHelper()]); + $questionHelper->setHelperSet($helperSet); + $question = new ChoiceQuestion('What is your favorite superhero?', ['Superman', 'Batman', 'Spiderman'], 'Batman'); + $question->setMaxAttempts(1); + + $this->assertSame('Batman', $questionHelper->ask($this->createStreamableInputInterfaceMock($this->getInputStream("Batman\n")), $output = $this->createOutputInterface(), $question)); + $this->assertOutputContains('What is your favorite superhero? [Batman]', $output); + } + public function testAskReturnsNullIfValidatorAllowsIt() { $questionHelper = new SymfonyQuestionHelper(); @@ -112,7 +124,7 @@ public function testLabelTrailingBackslash() /** * @expectedException \Symfony\Component\Console\Exception\RuntimeException - * @expectedExceptionMessage Aborted + * @expectedExceptionMessage Aborted. */ public function testAskThrowsExceptionOnMissingInput() { diff --git a/vendor/symfony/console/Tests/Helper/TableTest.php b/vendor/symfony/console/Tests/Helper/TableTest.php index 3f7c7efce80a1a1c22115401ebff2408a93d08ba..d58a5036de83096e07dfbb524aa35797b78457cb 100644 --- a/vendor/symfony/console/Tests/Helper/TableTest.php +++ b/vendor/symfony/console/Tests/Helper/TableTest.php @@ -85,16 +85,16 @@ public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected, $d public function renderProvider() { - $books = array( - array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), - array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), - array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'), - array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), - ); - - return array( - array( - array('ISBN', 'Title', 'Author'), + $books = [ + ['99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'], + ['9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'], + ['960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'], + ['80-902734-1-6', 'And Then There Were None', 'Agatha Christie'], + ]; + + return [ + [ + ['ISBN', 'Title', 'Author'], $books, 'default', <<<'TABLE' @@ -108,9 +108,9 @@ public function renderProvider() +---------------+--------------------------+------------------+ TABLE - ), - array( - array('ISBN', 'Title', 'Author'), + ], + [ + ['ISBN', 'Title', 'Author'], $books, 'compact', <<<'TABLE' @@ -121,9 +121,9 @@ public function renderProvider() 80-902734-1-6 And Then There Were None Agatha Christie TABLE - ), - array( - array('ISBN', 'Title', 'Author'), + ], + [ + ['ISBN', 'Title', 'Author'], $books, 'borderless', <<<'TABLE' @@ -137,15 +137,15 @@ public function renderProvider() =============== ========================== ================== TABLE - ), - array( - array('ISBN', 'Title'), - array( - array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), - array('9971-5-0210-0'), - array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'), - array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), - ), + ], + [ + ['ISBN', 'Title'], + [ + ['99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'], + ['9971-5-0210-0'], + ['960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'], + ['80-902734-1-6', 'And Then There Were None', 'Agatha Christie'], + ], 'default', <<<'TABLE' +---------------+--------------------------+------------------+ @@ -158,15 +158,15 @@ public function renderProvider() +---------------+--------------------------+------------------+ TABLE - ), - array( - array(), - array( - array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), - array('9971-5-0210-0'), - array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'), - array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), - ), + ], + [ + [], + [ + ['99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'], + ['9971-5-0210-0'], + ['960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'], + ['80-902734-1-6', 'And Then There Were None', 'Agatha Christie'], + ], 'default', <<<'TABLE' +---------------+--------------------------+------------------+ @@ -177,15 +177,15 @@ public function renderProvider() +---------------+--------------------------+------------------+ TABLE - ), - array( - array('ISBN', 'Title', 'Author'), - array( - array('99921-58-10-7', "Divine\nComedy", 'Dante Alighieri'), - array('9971-5-0210-2', "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."), - array('9971-5-0210-2', "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."), - array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"), - ), + ], + [ + ['ISBN', 'Title', 'Author'], + [ + ['99921-58-10-7', "Divine\nComedy", 'Dante Alighieri'], + ['9971-5-0210-2', "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."], + ['9971-5-0210-2', "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."], + ['960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"], + ], 'default', <<<'TABLE' +---------------+----------------------------+-----------------+ @@ -202,10 +202,10 @@ public function renderProvider() +---------------+----------------------------+-----------------+ TABLE - ), - array( - array('ISBN', 'Title'), - array(), + ], + [ + ['ISBN', 'Title'], + [], 'default', <<<'TABLE' +------+-------+ @@ -213,19 +213,19 @@ public function renderProvider() +------+-------+ TABLE - ), - array( - array(), - array(), + ], + [ + [], + [], 'default', '', - ), - 'Cell text with tags used for Output styling' => array( - array('ISBN', 'Title', 'Author'), - array( - array('<info>99921-58-10-7</info>', '<error>Divine Comedy</error>', '<fg=blue;bg=white>Dante Alighieri</fg=blue;bg=white>'), - array('9971-5-0210-0', 'A Tale of Two Cities', '<info>Charles Dickens</>'), - ), + ], + 'Cell text with tags used for Output styling' => [ + ['ISBN', 'Title', 'Author'], + [ + ['<info>99921-58-10-7</info>', '<error>Divine Comedy</error>', '<fg=blue;bg=white>Dante Alighieri</fg=blue;bg=white>'], + ['9971-5-0210-0', 'A Tale of Two Cities', '<info>Charles Dickens</>'], + ], 'default', <<<'TABLE' +---------------+----------------------+-----------------+ @@ -236,13 +236,13 @@ public function renderProvider() +---------------+----------------------+-----------------+ TABLE - ), - 'Cell text with tags not used for Output styling' => array( - array('ISBN', 'Title', 'Author'), - array( - array('<strong>99921-58-10-700</strong>', '<f>Divine Com</f>', 'Dante Alighieri'), - array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), - ), + ], + 'Cell text with tags not used for Output styling' => [ + ['ISBN', 'Title', 'Author'], + [ + ['<strong>99921-58-10-700</strong>', '<f>Divine Com</f>', 'Dante Alighieri'], + ['9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'], + ], 'default', <<<'TABLE' +----------------------------------+----------------------+-----------------+ @@ -253,28 +253,28 @@ public function renderProvider() +----------------------------------+----------------------+-----------------+ TABLE - ), - 'Cell with colspan' => array( - array('ISBN', 'Title', 'Author'), - array( - array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), + ], + 'Cell with colspan' => [ + ['ISBN', 'Title', 'Author'], + [ + ['99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'], new TableSeparator(), - array(new TableCell('Divine Comedy(Dante Alighieri)', array('colspan' => 3))), + [new TableCell('Divine Comedy(Dante Alighieri)', ['colspan' => 3])], new TableSeparator(), - array( - new TableCell('Arduino: A Quick-Start Guide', array('colspan' => 2)), + [ + new TableCell('Arduino: A Quick-Start Guide', ['colspan' => 2]), 'Mark Schmidt', - ), + ], new TableSeparator(), - array( + [ '9971-5-0210-0', - new TableCell("A Tale of \nTwo Cities", array('colspan' => 2)), - ), + new TableCell("A Tale of \nTwo Cities", ['colspan' => 2]), + ], new TableSeparator(), - array( - new TableCell('Cupiditate dicta atque porro, tempora exercitationem modi animi nulla nemo vel nihil!', array('colspan' => 3)), - ), - ), + [ + new TableCell('Cupiditate dicta atque porro, tempora exercitationem modi animi nulla nemo vel nihil!', ['colspan' => 3]), + ], + ], 'default', <<<'TABLE' +-------------------------------+-------------------------------+-----------------------------+ @@ -293,21 +293,21 @@ public function renderProvider() +-------------------------------+-------------------------------+-----------------------------+ TABLE - ), - 'Cell with rowspan' => array( - array('ISBN', 'Title', 'Author'), - array( - array( - new TableCell('9971-5-0210-0', array('rowspan' => 3)), - new TableCell('Divine Comedy', array('rowspan' => 2)), + ], + 'Cell with rowspan' => [ + ['ISBN', 'Title', 'Author'], + [ + [ + new TableCell('9971-5-0210-0', ['rowspan' => 3]), + new TableCell('Divine Comedy', ['rowspan' => 2]), 'Dante Alighieri', - ), - array(), - array("The Lord of \nthe Rings", "J. R. \nR. Tolkien"), + ], + [], + ["The Lord of \nthe Rings", "J. R. \nR. Tolkien"], new TableSeparator(), - array('80-902734-1-6', new TableCell("And Then \nThere \nWere None", array('rowspan' => 3)), 'Agatha Christie'), - array('80-902734-1-7', 'Test'), - ), + ['80-902734-1-6', new TableCell("And Then \nThere \nWere None", ['rowspan' => 3]), 'Agatha Christie'], + ['80-902734-1-7', 'Test'], + ], 'default', <<<'TABLE' +---------------+---------------+-----------------+ @@ -324,23 +324,23 @@ public function renderProvider() +---------------+---------------+-----------------+ TABLE - ), - 'Cell with rowspan and colspan' => array( - array('ISBN', 'Title', 'Author'), - array( - array( - new TableCell('9971-5-0210-0', array('rowspan' => 2, 'colspan' => 2)), + ], + 'Cell with rowspan and colspan' => [ + ['ISBN', 'Title', 'Author'], + [ + [ + new TableCell('9971-5-0210-0', ['rowspan' => 2, 'colspan' => 2]), 'Dante Alighieri', - ), - array('Charles Dickens'), + ], + ['Charles Dickens'], new TableSeparator(), - array( + [ 'Dante Alighieri', - new TableCell('9971-5-0210-0', array('rowspan' => 3, 'colspan' => 2)), - ), - array('J. R. R. Tolkien'), - array('J. R. R'), - ), + new TableCell('9971-5-0210-0', ['rowspan' => 3, 'colspan' => 2]), + ], + ['J. R. R. Tolkien'], + ['J. R. R'], + ], 'default', <<<'TABLE' +------------------+---------+-----------------+ @@ -355,27 +355,27 @@ public function renderProvider() +------------------+---------+-----------------+ TABLE - ), - 'Cell with rowspan and colspan contains new line break' => array( - array('ISBN', 'Title', 'Author'), - array( - array( - new TableCell("9971\n-5-\n021\n0-0", array('rowspan' => 2, 'colspan' => 2)), + ], + 'Cell with rowspan and colspan contains new line break' => [ + ['ISBN', 'Title', 'Author'], + [ + [ + new TableCell("9971\n-5-\n021\n0-0", ['rowspan' => 2, 'colspan' => 2]), 'Dante Alighieri', - ), - array('Charles Dickens'), + ], + ['Charles Dickens'], new TableSeparator(), - array( + [ 'Dante Alighieri', - new TableCell("9971\n-5-\n021\n0-0", array('rowspan' => 2, 'colspan' => 2)), - ), - array('Charles Dickens'), + new TableCell("9971\n-5-\n021\n0-0", ['rowspan' => 2, 'colspan' => 2]), + ], + ['Charles Dickens'], new TableSeparator(), - array( - new TableCell("9971\n-5-\n021\n0-0", array('rowspan' => 2, 'colspan' => 2)), - new TableCell("Dante \nAlighieri", array('rowspan' => 2, 'colspan' => 1)), - ), - ), + [ + new TableCell("9971\n-5-\n021\n0-0", ['rowspan' => 2, 'colspan' => 2]), + new TableCell("Dante \nAlighieri", ['rowspan' => 2, 'colspan' => 1]), + ], + ], 'default', <<<'TABLE' +-----------------+-------+-----------------+ @@ -398,21 +398,21 @@ public function renderProvider() +-----------------+-------+-----------------+ TABLE - ), - 'Cell with rowspan and colspan without using TableSeparator' => array( - array('ISBN', 'Title', 'Author'), - array( - array( - new TableCell("9971\n-5-\n021\n0-0", array('rowspan' => 2, 'colspan' => 2)), + ], + 'Cell with rowspan and colspan without using TableSeparator' => [ + ['ISBN', 'Title', 'Author'], + [ + [ + new TableCell("9971\n-5-\n021\n0-0", ['rowspan' => 2, 'colspan' => 2]), 'Dante Alighieri', - ), - array('Charles Dickens'), - array( + ], + ['Charles Dickens'], + [ 'Dante Alighieri', - new TableCell("9971\n-5-\n021\n0-0", array('rowspan' => 2, 'colspan' => 2)), - ), - array('Charles Dickens'), - ), + new TableCell("9971\n-5-\n021\n0-0", ['rowspan' => 2, 'colspan' => 2]), + ], + ['Charles Dickens'], + ], 'default', <<<'TABLE' +-----------------+-------+-----------------+ @@ -429,17 +429,17 @@ public function renderProvider() +-----------------+-------+-----------------+ TABLE - ), - 'Cell with rowspan and colspan with separator inside a rowspan' => array( - array('ISBN', 'Author'), - array( - array( - new TableCell('9971-5-0210-0', array('rowspan' => 3, 'colspan' => 1)), + ], + 'Cell with rowspan and colspan with separator inside a rowspan' => [ + ['ISBN', 'Author'], + [ + [ + new TableCell('9971-5-0210-0', ['rowspan' => 3, 'colspan' => 1]), 'Dante Alighieri', - ), - array(new TableSeparator()), - array('Charles Dickens'), - ), + ], + [new TableSeparator()], + ['Charles Dickens'], + ], 'default', <<<'TABLE' +---------------+-----------------+ @@ -451,13 +451,13 @@ public function renderProvider() +---------------+-----------------+ TABLE - ), - 'Multiple header lines' => array( - array( - array(new TableCell('Main title', array('colspan' => 3))), - array('ISBN', 'Title', 'Author'), - ), - array(), + ], + 'Multiple header lines' => [ + [ + [new TableCell('Main title', ['colspan' => 3])], + ['ISBN', 'Title', 'Author'], + ], + [], 'default', <<<'TABLE' +------+-------+--------+ @@ -467,17 +467,17 @@ public function renderProvider() +------+-------+--------+ TABLE - ), - 'Row with multiple cells' => array( - array(), - array( - array( - new TableCell('1', array('colspan' => 3)), - new TableCell('2', array('colspan' => 2)), - new TableCell('3', array('colspan' => 2)), - new TableCell('4', array('colspan' => 2)), - ), - ), + ], + 'Row with multiple cells' => [ + [], + [ + [ + new TableCell('1', ['colspan' => 3]), + new TableCell('2', ['colspan' => 2]), + new TableCell('3', ['colspan' => 2]), + new TableCell('4', ['colspan' => 2]), + ], + ], 'default', <<<'TABLE' +---+--+--+---+--+---+--+---+--+ @@ -485,22 +485,22 @@ public function renderProvider() +---+--+--+---+--+---+--+---+--+ TABLE - ), - 'Coslpan and table cells with comment style' => array( - array( - new TableCell('<comment>Long Title</comment>', array('colspan' => 3)), - ), - array( - array( - new TableCell('9971-5-0210-0', array('colspan' => 3)), - ), + ], + 'Coslpan and table cells with comment style' => [ + [ + new TableCell('<comment>Long Title</comment>', ['colspan' => 3]), + ], + [ + [ + new TableCell('9971-5-0210-0', ['colspan' => 3]), + ], new TableSeparator(), - array( + [ 'Dante Alighieri', 'J. R. R. Tolkien', 'J. R. R', - ), - ), + ], + ], 'default', <<<TABLE +-----------------+------------------+---------+ @@ -514,22 +514,22 @@ public function renderProvider() TABLE , true, - ), - 'Row with formatted cells containing a newline' => array( - array(), - array( - array( - new TableCell('<error>Dont break'."\n".'here</error>', array('colspan' => 2)), - ), + ], + 'Row with formatted cells containing a newline' => [ + [], + [ + [ + new TableCell('<error>Dont break'."\n".'here</error>', ['colspan' => 2]), + ], new TableSeparator(), - array( + [ 'foo', - new TableCell('<error>Dont break'."\n".'here</error>', array('rowspan' => 2)), - ), - array( + new TableCell('<error>Dont break'."\n".'here</error>', ['rowspan' => 2]), + ], + [ 'bar', - ), - ), + ], + ], 'default', <<<'TABLE' +-------+------------+ @@ -543,16 +543,16 @@ public function renderProvider() TABLE , true, - ), - ); + ], + ]; } public function testRenderMultiByte() { $table = new Table($output = $this->getOutputStream()); $table - ->setHeaders(array('■■')) - ->setRows(array(array(1234))) + ->setHeaders(['■■']) + ->setRows([[1234]]) ->setStyle('default') ; $table->render(); @@ -574,7 +574,7 @@ public function testTableCellWithNumericIntValue() { $table = new Table($output = $this->getOutputStream()); - $table->setRows(array(array(new TableCell(12345)))); + $table->setRows([[new TableCell(12345)]]); $table->render(); $expected = @@ -592,7 +592,7 @@ public function testTableCellWithNumericFloatValue() { $table = new Table($output = $this->getOutputStream()); - $table->setRows(array(array(new TableCell(12345.01)))); + $table->setRows([[new TableCell(12345.01)]]); $table->render(); $expected = @@ -618,8 +618,8 @@ public function testStyle() Table::setStyleDefinition('dotfull', $style); $table = new Table($output = $this->getOutputStream()); $table - ->setHeaders(array('Foo')) - ->setRows(array(array('Bar'))) + ->setHeaders(['Foo']) + ->setRows([['Bar']]) ->setStyle('dotfull'); $table->render(); @@ -640,14 +640,14 @@ public function testRowSeparator() { $table = new Table($output = $this->getOutputStream()); $table - ->setHeaders(array('Foo')) - ->setRows(array( - array('Bar1'), + ->setHeaders(['Foo']) + ->setRows([ + ['Bar1'], new TableSeparator(), - array('Bar2'), + ['Bar2'], new TableSeparator(), - array('Bar3'), - )); + ['Bar3'], + ]); $table->render(); $expected = @@ -672,9 +672,9 @@ public function testRowSeparator() public function testRenderMultiCalls() { $table = new Table($output = $this->getOutputStream()); - $table->setRows(array( - array(new TableCell('foo', array('colspan' => 2))), - )); + $table->setRows([ + [new TableCell('foo', ['colspan' => 2])], + ]); $table->render(); $table->render(); $table->render(); @@ -700,11 +700,11 @@ public function testColumnStyle() { $table = new Table($output = $this->getOutputStream()); $table - ->setHeaders(array('ISBN', 'Title', 'Author', 'Price')) - ->setRows(array( - array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'), - array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'), - )); + ->setHeaders(['ISBN', 'Title', 'Author', 'Price']) + ->setRows([ + ['99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'], + ['9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'], + ]); $style = new TableStyle(); $style->setPadType(STR_PAD_LEFT); @@ -734,23 +734,23 @@ public function testThrowsWhenTheCellInAnArray() { $table = new Table($output = $this->getOutputStream()); $table - ->setHeaders(array('ISBN', 'Title', 'Author', 'Price')) - ->setRows(array( - array('99921-58-10-7', array(), 'Dante Alighieri', '9.95'), - )); + ->setHeaders(['ISBN', 'Title', 'Author', 'Price']) + ->setRows([ + ['99921-58-10-7', [], 'Dante Alighieri', '9.95'], + ]); $table->render(); } - public function testColumnWith() + public function testColumnWidth() { $table = new Table($output = $this->getOutputStream()); $table - ->setHeaders(array('ISBN', 'Title', 'Author', 'Price')) - ->setRows(array( - array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'), - array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'), - )) + ->setHeaders(['ISBN', 'Title', 'Author', 'Price']) + ->setRows([ + ['99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'], + ['9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'], + ]) ->setColumnWidth(0, 15) ->setColumnWidth(3, 10); @@ -774,16 +774,16 @@ public function testColumnWith() $this->assertEquals($expected, $this->getOutputContent($output)); } - public function testColumnWiths() + public function testColumnWidths() { $table = new Table($output = $this->getOutputStream()); $table - ->setHeaders(array('ISBN', 'Title', 'Author', 'Price')) - ->setRows(array( - array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'), - array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'), - )) - ->setColumnWidths(array(15, 0, -1, 10)); + ->setHeaders(['ISBN', 'Title', 'Author', 'Price']) + ->setRows([ + ['99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'], + ['9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'], + ]) + ->setColumnWidths([15, 0, -1, 10]); $style = new TableStyle(); $style->setPadType(STR_PAD_LEFT); @@ -824,6 +824,42 @@ public function testGetStyleDefinition() Table::getStyleDefinition('absent'); } + public function testBoxedStyleWithColspan() + { + $boxed = new TableStyle(); + $boxed + ->setHorizontalBorderChar('─') + ->setVerticalBorderChar('│') + ->setCrossingChar('┼') + ; + + $table = new Table($output = $this->getOutputStream()); + $table->setStyle($boxed); + $table + ->setHeaders(['ISBN', 'Title', 'Author']) + ->setRows([ + ['99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'], + new TableSeparator(), + [new TableCell('This value spans 3 columns.', ['colspan' => 3])], + ]) + ; + $table->render(); + + $expected = + <<<TABLE +┼───────────────┼───────────────┼─────────────────┼ +│ ISBN │ Title │ Author │ +┼───────────────┼───────────────┼─────────────────┼ +│ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri │ +┼───────────────┼───────────────┼─────────────────┼ +│ This value spans 3 columns. │ +┼───────────────┼───────────────┼─────────────────┼ + +TABLE; + + $this->assertSame($expected, $this->getOutputContent($output)); + } + protected function getOutputStream($decorated = false) { return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, $decorated); diff --git a/vendor/symfony/console/Tests/Input/ArgvInputTest.php b/vendor/symfony/console/Tests/Input/ArgvInputTest.php index 75742409037f3c0260a451dfe544c8468cc02e8b..e20bcdd21bc7c9c3c97a8ce3c7bf98597a7d78f6 100644 --- a/vendor/symfony/console/Tests/Input/ArgvInputTest.php +++ b/vendor/symfony/console/Tests/Input/ArgvInputTest.php @@ -21,23 +21,23 @@ class ArgvInputTest extends TestCase { public function testConstructor() { - $_SERVER['argv'] = array('cli.php', 'foo'); + $_SERVER['argv'] = ['cli.php', 'foo']; $input = new ArgvInput(); $r = new \ReflectionObject($input); $p = $r->getProperty('tokens'); $p->setAccessible(true); - $this->assertEquals(array('foo'), $p->getValue($input), '__construct() automatically get its input from the argv server variable'); + $this->assertEquals(['foo'], $p->getValue($input), '__construct() automatically get its input from the argv server variable'); } public function testParseArguments() { - $input = new ArgvInput(array('cli.php', 'foo')); - $input->bind(new InputDefinition(array(new InputArgument('name')))); - $this->assertEquals(array('name' => 'foo'), $input->getArguments(), '->parse() parses required arguments'); + $input = new ArgvInput(['cli.php', 'foo']); + $input->bind(new InputDefinition([new InputArgument('name')])); + $this->assertEquals(['name' => 'foo'], $input->getArguments(), '->parse() parses required arguments'); - $input->bind(new InputDefinition(array(new InputArgument('name')))); - $this->assertEquals(array('name' => 'foo'), $input->getArguments(), '->parse() is stateless'); + $input->bind(new InputDefinition([new InputArgument('name')])); + $this->assertEquals(['name' => 'foo'], $input->getArguments(), '->parse() is stateless'); } /** @@ -53,128 +53,128 @@ public function testParseOptions($input, $options, $expectedOptions, $message) public function provideOptions() { - return array( - array( - array('cli.php', '--foo'), - array(new InputOption('foo')), - array('foo' => true), + return [ + [ + ['cli.php', '--foo'], + [new InputOption('foo')], + ['foo' => true], '->parse() parses long options without a value', - ), - array( - array('cli.php', '--foo=bar'), - array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), - array('foo' => 'bar'), + ], + [ + ['cli.php', '--foo=bar'], + [new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)], + ['foo' => 'bar'], '->parse() parses long options with a required value (with a = separator)', - ), - array( - array('cli.php', '--foo', 'bar'), - array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), - array('foo' => 'bar'), + ], + [ + ['cli.php', '--foo', 'bar'], + [new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)], + ['foo' => 'bar'], '->parse() parses long options with a required value (with a space separator)', - ), - array( - array('cli.php', '--foo='), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)), - array('foo' => ''), + ], + [ + ['cli.php', '--foo='], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)], + ['foo' => ''], '->parse() parses long options with optional value which is empty (with a = separator) as empty string', - ), - array( - array('cli.php', '--foo=', 'bar'), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)), - array('foo' => ''), + ], + [ + ['cli.php', '--foo=', 'bar'], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)], + ['foo' => ''], '->parse() parses long options with optional value without value specified or an empty string (with a = separator) followed by an argument as empty string', - ), - array( - array('cli.php', 'bar', '--foo'), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)), - array('foo' => null), + ], + [ + ['cli.php', 'bar', '--foo'], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)], + ['foo' => null], '->parse() parses long options with optional value which is empty (with a = separator) preceded by an argument', - ), - array( - array('cli.php', '--foo', '', 'bar'), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)), - array('foo' => ''), + ], + [ + ['cli.php', '--foo', '', 'bar'], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)], + ['foo' => ''], '->parse() parses long options with optional value which is empty as empty string even followed by an argument', - ), - array( - array('cli.php', '--foo'), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)), - array('foo' => null), + ], + [ + ['cli.php', '--foo'], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)], + ['foo' => null], '->parse() parses long options with optional value specified with no separator and no value as null', - ), - array( - array('cli.php', '-f'), - array(new InputOption('foo', 'f')), - array('foo' => true), + ], + [ + ['cli.php', '-f'], + [new InputOption('foo', 'f')], + ['foo' => true], '->parse() parses short options without a value', - ), - array( - array('cli.php', '-fbar'), - array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), - array('foo' => 'bar'), + ], + [ + ['cli.php', '-fbar'], + [new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)], + ['foo' => 'bar'], '->parse() parses short options with a required value (with no separator)', - ), - array( - array('cli.php', '-f', 'bar'), - array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)), - array('foo' => 'bar'), + ], + [ + ['cli.php', '-f', 'bar'], + [new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)], + ['foo' => 'bar'], '->parse() parses short options with a required value (with a space separator)', - ), - array( - array('cli.php', '-f', ''), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)), - array('foo' => ''), + ], + [ + ['cli.php', '-f', ''], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)], + ['foo' => ''], '->parse() parses short options with an optional empty value', - ), - array( - array('cli.php', '-f', '', 'foo'), - array(new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)), - array('foo' => ''), + ], + [ + ['cli.php', '-f', '', 'foo'], + [new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)], + ['foo' => ''], '->parse() parses short options with an optional empty value followed by an argument', - ), - array( - array('cli.php', '-f', '', '-b'), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')), - array('foo' => '', 'bar' => true), + ], + [ + ['cli.php', '-f', '', '-b'], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')], + ['foo' => '', 'bar' => true], '->parse() parses short options with an optional empty value followed by an option', - ), - array( - array('cli.php', '-f', '-b', 'foo'), - array(new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')), - array('foo' => null, 'bar' => true), + ], + [ + ['cli.php', '-f', '-b', 'foo'], + [new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b')], + ['foo' => null, 'bar' => true], '->parse() parses short options with an optional value which is not present', - ), - array( - array('cli.php', '-fb'), - array(new InputOption('foo', 'f'), new InputOption('bar', 'b')), - array('foo' => true, 'bar' => true), + ], + [ + ['cli.php', '-fb'], + [new InputOption('foo', 'f'), new InputOption('bar', 'b')], + ['foo' => true, 'bar' => true], '->parse() parses short options when they are aggregated as a single one', - ), - array( - array('cli.php', '-fb', 'bar'), - array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_REQUIRED)), - array('foo' => true, 'bar' => 'bar'), + ], + [ + ['cli.php', '-fb', 'bar'], + [new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_REQUIRED)], + ['foo' => true, 'bar' => 'bar'], '->parse() parses short options when they are aggregated as a single one and the last one has a required value', - ), - array( - array('cli.php', '-fb', 'bar'), - array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), - array('foo' => true, 'bar' => 'bar'), + ], + [ + ['cli.php', '-fb', 'bar'], + [new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)], + ['foo' => true, 'bar' => 'bar'], '->parse() parses short options when they are aggregated as a single one and the last one has an optional value', - ), - array( - array('cli.php', '-fbbar'), - array(new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), - array('foo' => true, 'bar' => 'bar'), + ], + [ + ['cli.php', '-fbbar'], + [new InputOption('foo', 'f'), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)], + ['foo' => true, 'bar' => 'bar'], '->parse() parses short options when they are aggregated as a single one and the last one has an optional value with no separator', - ), - array( - array('cli.php', '-fbbar'), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)), - array('foo' => 'bbar', 'bar' => null), + ], + [ + ['cli.php', '-fbbar'], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL)], + ['foo' => 'bbar', 'bar' => null], '->parse() parses short options when they are aggregated as a single one and one of them takes a value', - ), - ); + ], + ]; } /** @@ -195,157 +195,170 @@ public function testInvalidInput($argv, $definition, $expectedExceptionMessage) public function provideInvalidInput() { - return array( - array( - array('cli.php', '--foo'), - new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), + return [ + [ + ['cli.php', '--foo'], + new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)]), 'The "--foo" option requires a value.', - ), - array( - array('cli.php', '-f'), - new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), + ], + [ + ['cli.php', '-f'], + new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)]), 'The "--foo" option requires a value.', - ), - array( - array('cli.php', '-ffoo'), - new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))), + ], + [ + ['cli.php', '-ffoo'], + new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_NONE)]), 'The "-o" option does not exist.', - ), - array( - array('cli.php', '--foo=bar'), - new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))), + ], + [ + ['cli.php', '--foo=bar'], + new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_NONE)]), 'The "--foo" option does not accept a value.', - ), - array( - array('cli.php', 'foo', 'bar'), + ], + [ + ['cli.php', 'foo', 'bar'], new InputDefinition(), 'No arguments expected, got "foo".', - ), - array( - array('cli.php', 'foo', 'bar'), - new InputDefinition(array(new InputArgument('number'))), + ], + [ + ['cli.php', 'foo', 'bar'], + new InputDefinition([new InputArgument('number')]), 'Too many arguments, expected arguments "number".', - ), - array( - array('cli.php', 'foo', 'bar', 'zzz'), - new InputDefinition(array(new InputArgument('number'), new InputArgument('county'))), + ], + [ + ['cli.php', 'foo', 'bar', 'zzz'], + new InputDefinition([new InputArgument('number'), new InputArgument('county')]), 'Too many arguments, expected arguments "number" "county".', - ), - array( - array('cli.php', '--foo'), + ], + [ + ['cli.php', '--foo'], new InputDefinition(), 'The "--foo" option does not exist.', - ), - array( - array('cli.php', '-f'), + ], + [ + ['cli.php', '-f'], new InputDefinition(), 'The "-f" option does not exist.', - ), - array( - array('cli.php', '-1'), - new InputDefinition(array(new InputArgument('number'))), + ], + [ + ['cli.php', '-1'], + new InputDefinition([new InputArgument('number')]), 'The "-1" option does not exist.', - ), - ); + ], + [ + ['cli.php', '-fЩ'], + new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_NONE)]), + 'The "-Щ" option does not exist.', + ], + ]; } public function testParseArrayArgument() { - $input = new ArgvInput(array('cli.php', 'foo', 'bar', 'baz', 'bat')); - $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::IS_ARRAY)))); + $input = new ArgvInput(['cli.php', 'foo', 'bar', 'baz', 'bat']); + $input->bind(new InputDefinition([new InputArgument('name', InputArgument::IS_ARRAY)])); - $this->assertEquals(array('name' => array('foo', 'bar', 'baz', 'bat')), $input->getArguments(), '->parse() parses array arguments'); + $this->assertEquals(['name' => ['foo', 'bar', 'baz', 'bat']], $input->getArguments(), '->parse() parses array arguments'); } public function testParseArrayOption() { - $input = new ArgvInput(array('cli.php', '--name=foo', '--name=bar', '--name=baz')); - $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); + $input = new ArgvInput(['cli.php', '--name=foo', '--name=bar', '--name=baz']); + $input->bind(new InputDefinition([new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)])); - $this->assertEquals(array('name' => array('foo', 'bar', 'baz')), $input->getOptions(), '->parse() parses array options ("--option=value" syntax)'); + $this->assertEquals(['name' => ['foo', 'bar', 'baz']], $input->getOptions(), '->parse() parses array options ("--option=value" syntax)'); - $input = new ArgvInput(array('cli.php', '--name', 'foo', '--name', 'bar', '--name', 'baz')); - $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); - $this->assertEquals(array('name' => array('foo', 'bar', 'baz')), $input->getOptions(), '->parse() parses array options ("--option value" syntax)'); + $input = new ArgvInput(['cli.php', '--name', 'foo', '--name', 'bar', '--name', 'baz']); + $input->bind(new InputDefinition([new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)])); + $this->assertEquals(['name' => ['foo', 'bar', 'baz']], $input->getOptions(), '->parse() parses array options ("--option value" syntax)'); - $input = new ArgvInput(array('cli.php', '--name=foo', '--name=bar', '--name=')); - $input->bind(new InputDefinition(array(new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)))); - $this->assertSame(array('name' => array('foo', 'bar', '')), $input->getOptions(), '->parse() parses empty array options as null ("--option=value" syntax)'); + $input = new ArgvInput(['cli.php', '--name=foo', '--name=bar', '--name=']); + $input->bind(new InputDefinition([new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)])); + $this->assertSame(['name' => ['foo', 'bar', '']], $input->getOptions(), '->parse() parses empty array options as null ("--option=value" syntax)'); - $input = new ArgvInput(array('cli.php', '--name', 'foo', '--name', 'bar', '--name', '--anotherOption')); - $input->bind(new InputDefinition(array( + $input = new ArgvInput(['cli.php', '--name', 'foo', '--name', 'bar', '--name', '--anotherOption']); + $input->bind(new InputDefinition([ new InputOption('name', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY), new InputOption('anotherOption', null, InputOption::VALUE_NONE), - ))); - $this->assertSame(array('name' => array('foo', 'bar', null), 'anotherOption' => true), $input->getOptions(), '->parse() parses empty array options ("--option value" syntax)'); + ])); + $this->assertSame(['name' => ['foo', 'bar', null], 'anotherOption' => true], $input->getOptions(), '->parse() parses empty array options ("--option value" syntax)'); } public function testParseNegativeNumberAfterDoubleDash() { - $input = new ArgvInput(array('cli.php', '--', '-1')); - $input->bind(new InputDefinition(array(new InputArgument('number')))); - $this->assertEquals(array('number' => '-1'), $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); - - $input = new ArgvInput(array('cli.php', '-f', 'bar', '--', '-1')); - $input->bind(new InputDefinition(array(new InputArgument('number'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)))); - $this->assertEquals(array('foo' => 'bar'), $input->getOptions(), '->parse() parses arguments with leading dashes as options before having encountered a double-dash sequence'); - $this->assertEquals(array('number' => '-1'), $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); + $input = new ArgvInput(['cli.php', '--', '-1']); + $input->bind(new InputDefinition([new InputArgument('number')])); + $this->assertEquals(['number' => '-1'], $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); + + $input = new ArgvInput(['cli.php', '-f', 'bar', '--', '-1']); + $input->bind(new InputDefinition([new InputArgument('number'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)])); + $this->assertEquals(['foo' => 'bar'], $input->getOptions(), '->parse() parses arguments with leading dashes as options before having encountered a double-dash sequence'); + $this->assertEquals(['number' => '-1'], $input->getArguments(), '->parse() parses arguments with leading dashes as arguments after having encountered a double-dash sequence'); } public function testParseEmptyStringArgument() { - $input = new ArgvInput(array('cli.php', '-f', 'bar', '')); - $input->bind(new InputDefinition(array(new InputArgument('empty'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)))); + $input = new ArgvInput(['cli.php', '-f', 'bar', '']); + $input->bind(new InputDefinition([new InputArgument('empty'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)])); - $this->assertEquals(array('empty' => ''), $input->getArguments(), '->parse() parses empty string arguments'); + $this->assertEquals(['empty' => ''], $input->getArguments(), '->parse() parses empty string arguments'); } public function testGetFirstArgument() { - $input = new ArgvInput(array('cli.php', '-fbbar')); + $input = new ArgvInput(['cli.php', '-fbbar']); $this->assertNull($input->getFirstArgument(), '->getFirstArgument() returns null when there is no arguments'); - $input = new ArgvInput(array('cli.php', '-fbbar', 'foo')); + $input = new ArgvInput(['cli.php', '-fbbar', 'foo']); $this->assertEquals('foo', $input->getFirstArgument(), '->getFirstArgument() returns the first argument from the raw input'); + + $input = new ArgvInput(['cli.php', '--foo', 'fooval', 'bar']); + $input->bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('arg')])); + $this->assertSame('bar', $input->getFirstArgument()); + + $input = new ArgvInput(['cli.php', '-bf', 'fooval', 'argval']); + $input->bind(new InputDefinition([new InputOption('bar', 'b', InputOption::VALUE_NONE), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('arg')])); + $this->assertSame('argval', $input->getFirstArgument()); } public function testHasParameterOption() { - $input = new ArgvInput(array('cli.php', '-f', 'foo')); + $input = new ArgvInput(['cli.php', '-f', 'foo']); $this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input'); - $input = new ArgvInput(array('cli.php', '-etest')); + $input = new ArgvInput(['cli.php', '-etest']); $this->assertTrue($input->hasParameterOption('-e'), '->hasParameterOption() returns true if the given short option is in the raw input'); $this->assertFalse($input->hasParameterOption('-s'), '->hasParameterOption() returns true if the given short option is in the raw input'); - $input = new ArgvInput(array('cli.php', '--foo', 'foo')); + $input = new ArgvInput(['cli.php', '--foo', 'foo']); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input'); - $input = new ArgvInput(array('cli.php', 'foo')); + $input = new ArgvInput(['cli.php', 'foo']); $this->assertFalse($input->hasParameterOption('--foo'), '->hasParameterOption() returns false if the given short option is not in the raw input'); - $input = new ArgvInput(array('cli.php', '--foo=bar')); + $input = new ArgvInput(['cli.php', '--foo=bar']); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given option with provided value is in the raw input'); } public function testHasParameterOptionOnlyOptions() { - $input = new ArgvInput(array('cli.php', '-f', 'foo')); + $input = new ArgvInput(['cli.php', '-f', 'foo']); $this->assertTrue($input->hasParameterOption('-f', true), '->hasParameterOption() returns true if the given short option is in the raw input'); - $input = new ArgvInput(array('cli.php', '--foo', '--', 'foo')); + $input = new ArgvInput(['cli.php', '--foo', '--', 'foo']); $this->assertTrue($input->hasParameterOption('--foo', true), '->hasParameterOption() returns true if the given long option is in the raw input'); - $input = new ArgvInput(array('cli.php', '--foo=bar', 'foo')); + $input = new ArgvInput(['cli.php', '--foo=bar', 'foo']); $this->assertTrue($input->hasParameterOption('--foo', true), '->hasParameterOption() returns true if the given long option with provided value is in the raw input'); - $input = new ArgvInput(array('cli.php', '--', '--foo')); + $input = new ArgvInput(['cli.php', '--', '--foo']); $this->assertFalse($input->hasParameterOption('--foo', true), '->hasParameterOption() returns false if the given option is in the raw input but after an end of options signal'); } public function testHasParameterOptionEdgeCasesAndLimitations() { - $input = new ArgvInput(array('cli.php', '-fh')); + $input = new ArgvInput(['cli.php', '-fh']); // hasParameterOption does not know if the previous short option, -f, // takes a value or not. If -f takes a value, then -fh does NOT include // -h; Otherwise it does. Since we do not know which short options take @@ -363,7 +376,7 @@ public function testHasParameterOptionEdgeCasesAndLimitations() // However, this is not supported. $this->assertFalse($input->hasParameterOption('-hf'), '->hasParameterOption() returns true if the given short option is in the raw input'); - $input = new ArgvInput(array('cli.php', '-f', '-h')); + $input = new ArgvInput(['cli.php', '-f', '-h']); // If hasParameterOption('-fh') is supported for 'cli.php -fh', then // one might also expect that it should also be supported for // 'cli.php -f -h'. However, this is not supported. @@ -372,23 +385,23 @@ public function testHasParameterOptionEdgeCasesAndLimitations() public function testNoWarningOnInvalidParameterOption() { - $input = new ArgvInput(array('cli.php', '-edev')); + $input = new ArgvInput(['cli.php', '-edev']); - $this->assertTrue($input->hasParameterOption(array('-e', ''))); + $this->assertTrue($input->hasParameterOption(['-e', ''])); // No warning thrown - $this->assertFalse($input->hasParameterOption(array('-m', ''))); + $this->assertFalse($input->hasParameterOption(['-m', ''])); - $this->assertEquals('dev', $input->getParameterOption(array('-e', ''))); + $this->assertEquals('dev', $input->getParameterOption(['-e', ''])); // No warning thrown - $this->assertFalse($input->getParameterOption(array('-m', ''))); + $this->assertFalse($input->getParameterOption(['-m', ''])); } public function testToString() { - $input = new ArgvInput(array('cli.php', '-f', 'foo')); + $input = new ArgvInput(['cli.php', '-f', 'foo']); $this->assertEquals('-f foo', (string) $input); - $input = new ArgvInput(array('cli.php', '-f', '--bar=foo', 'a b c d', "A\nB'C")); + $input = new ArgvInput(['cli.php', '-f', '--bar=foo', 'a b c d', "A\nB'C"]); $this->assertEquals('-f --bar=foo '.escapeshellarg('a b c d').' '.escapeshellarg("A\nB'C"), (string) $input); } @@ -403,51 +416,51 @@ public function testGetParameterOptionEqualSign($argv, $key, $default, $onlyPara public function provideGetParameterOptionValues() { - return array( - array(array('app/console', 'foo:bar'), '-e', 'default', false, 'default'), - array(array('app/console', 'foo:bar', '-e', 'dev'), '-e', 'default', false, 'dev'), - array(array('app/console', 'foo:bar', '--env=dev'), '--env', 'default', false, 'dev'), - array(array('app/console', 'foo:bar', '-e', 'dev'), array('-e', '--env'), 'default', false, 'dev'), - array(array('app/console', 'foo:bar', '--env=dev'), array('-e', '--env'), 'default', false, 'dev'), - array(array('app/console', 'foo:bar', '--env=dev', '--en=1'), array('--en'), 'default', false, '1'), - array(array('app/console', 'foo:bar', '--env=dev', '', '--en=1'), array('--en'), 'default', false, '1'), - array(array('app/console', 'foo:bar', '--env', 'val'), '--env', 'default', false, 'val'), - array(array('app/console', 'foo:bar', '--env', 'val', '--dummy'), '--env', 'default', false, 'val'), - array(array('app/console', 'foo:bar', '--', '--env=dev'), '--env', 'default', false, 'dev'), - array(array('app/console', 'foo:bar', '--', '--env=dev'), '--env', 'default', true, 'default'), - ); + return [ + [['app/console', 'foo:bar'], '-e', 'default', false, 'default'], + [['app/console', 'foo:bar', '-e', 'dev'], '-e', 'default', false, 'dev'], + [['app/console', 'foo:bar', '--env=dev'], '--env', 'default', false, 'dev'], + [['app/console', 'foo:bar', '-e', 'dev'], ['-e', '--env'], 'default', false, 'dev'], + [['app/console', 'foo:bar', '--env=dev'], ['-e', '--env'], 'default', false, 'dev'], + [['app/console', 'foo:bar', '--env=dev', '--en=1'], ['--en'], 'default', false, '1'], + [['app/console', 'foo:bar', '--env=dev', '', '--en=1'], ['--en'], 'default', false, '1'], + [['app/console', 'foo:bar', '--env', 'val'], '--env', 'default', false, 'val'], + [['app/console', 'foo:bar', '--env', 'val', '--dummy'], '--env', 'default', false, 'val'], + [['app/console', 'foo:bar', '--', '--env=dev'], '--env', 'default', false, 'dev'], + [['app/console', 'foo:bar', '--', '--env=dev'], '--env', 'default', true, 'default'], + ]; } public function testParseSingleDashAsArgument() { - $input = new ArgvInput(array('cli.php', '-')); - $input->bind(new InputDefinition(array(new InputArgument('file')))); - $this->assertEquals(array('file' => '-'), $input->getArguments(), '->parse() parses single dash as an argument'); + $input = new ArgvInput(['cli.php', '-']); + $input->bind(new InputDefinition([new InputArgument('file')])); + $this->assertEquals(['file' => '-'], $input->getArguments(), '->parse() parses single dash as an argument'); } public function testParseOptionWithValueOptionalGivenEmptyAndRequiredArgument() { - $input = new ArgvInput(array('cli.php', '--foo=', 'bar')); - $input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)))); - $this->assertEquals(array('foo' => null), $input->getOptions(), '->parse() parses optional options with empty value as null'); - $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->parse() parses required arguments'); - - $input = new ArgvInput(array('cli.php', '--foo=0', 'bar')); - $input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)))); - $this->assertEquals(array('foo' => '0'), $input->getOptions(), '->parse() parses optional options with empty value as null'); - $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->parse() parses required arguments'); + $input = new ArgvInput(['cli.php', '--foo=', 'bar']); + $input->bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)])); + $this->assertEquals(['foo' => null], $input->getOptions(), '->parse() parses optional options with empty value as null'); + $this->assertEquals(['name' => 'bar'], $input->getArguments(), '->parse() parses required arguments'); + + $input = new ArgvInput(['cli.php', '--foo=0', 'bar']); + $input->bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::REQUIRED)])); + $this->assertEquals(['foo' => '0'], $input->getOptions(), '->parse() parses optional options with empty value as null'); + $this->assertEquals(['name' => 'bar'], $input->getArguments(), '->parse() parses required arguments'); } public function testParseOptionWithValueOptionalGivenEmptyAndOptionalArgument() { - $input = new ArgvInput(array('cli.php', '--foo=', 'bar')); - $input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::OPTIONAL)))); - $this->assertEquals(array('foo' => null), $input->getOptions(), '->parse() parses optional options with empty value as null'); - $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->parse() parses optional arguments'); - - $input = new ArgvInput(array('cli.php', '--foo=0', 'bar')); - $input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::OPTIONAL)))); - $this->assertEquals(array('foo' => '0'), $input->getOptions(), '->parse() parses optional options with empty value as null'); - $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->parse() parses optional arguments'); + $input = new ArgvInput(['cli.php', '--foo=', 'bar']); + $input->bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::OPTIONAL)])); + $this->assertEquals(['foo' => null], $input->getOptions(), '->parse() parses optional options with empty value as null'); + $this->assertEquals(['name' => 'bar'], $input->getArguments(), '->parse() parses optional arguments'); + + $input = new ArgvInput(['cli.php', '--foo=0', 'bar']); + $input->bind(new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputArgument('name', InputArgument::OPTIONAL)])); + $this->assertEquals(['foo' => '0'], $input->getOptions(), '->parse() parses optional options with empty value as null'); + $this->assertEquals(['name' => 'bar'], $input->getArguments(), '->parse() parses optional arguments'); } } diff --git a/vendor/symfony/console/Tests/Input/ArrayInputTest.php b/vendor/symfony/console/Tests/Input/ArrayInputTest.php index 4bc83b3caffa1f58d2a383b28098676725dee719..afe74831e367a1693a77136809992946d6b85c4a 100644 --- a/vendor/symfony/console/Tests/Input/ArrayInputTest.php +++ b/vendor/symfony/console/Tests/Input/ArrayInputTest.php @@ -21,47 +21,47 @@ class ArrayInputTest extends TestCase { public function testGetFirstArgument() { - $input = new ArrayInput(array()); + $input = new ArrayInput([]); $this->assertNull($input->getFirstArgument(), '->getFirstArgument() returns null if no argument were passed'); - $input = new ArrayInput(array('name' => 'Fabien')); + $input = new ArrayInput(['name' => 'Fabien']); $this->assertEquals('Fabien', $input->getFirstArgument(), '->getFirstArgument() returns the first passed argument'); - $input = new ArrayInput(array('--foo' => 'bar', 'name' => 'Fabien')); + $input = new ArrayInput(['--foo' => 'bar', 'name' => 'Fabien']); $this->assertEquals('Fabien', $input->getFirstArgument(), '->getFirstArgument() returns the first passed argument'); } public function testHasParameterOption() { - $input = new ArrayInput(array('name' => 'Fabien', '--foo' => 'bar')); + $input = new ArrayInput(['name' => 'Fabien', '--foo' => 'bar']); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if an option is present in the passed parameters'); $this->assertFalse($input->hasParameterOption('--bar'), '->hasParameterOption() returns false if an option is not present in the passed parameters'); - $input = new ArrayInput(array('--foo')); + $input = new ArrayInput(['--foo']); $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if an option is present in the passed parameters'); - $input = new ArrayInput(array('--foo', '--', '--bar')); + $input = new ArrayInput(['--foo', '--', '--bar']); $this->assertTrue($input->hasParameterOption('--bar'), '->hasParameterOption() returns true if an option is present in the passed parameters'); $this->assertFalse($input->hasParameterOption('--bar', true), '->hasParameterOption() returns false if an option is present in the passed parameters after an end of options signal'); } public function testGetParameterOption() { - $input = new ArrayInput(array('name' => 'Fabien', '--foo' => 'bar')); + $input = new ArrayInput(['name' => 'Fabien', '--foo' => 'bar']); $this->assertEquals('bar', $input->getParameterOption('--foo'), '->getParameterOption() returns the option of specified name'); $this->assertEquals('default', $input->getParameterOption('--bar', 'default'), '->getParameterOption() returns the default value if an option is not present in the passed parameters'); - $input = new ArrayInput(array('Fabien', '--foo' => 'bar')); + $input = new ArrayInput(['Fabien', '--foo' => 'bar']); $this->assertEquals('bar', $input->getParameterOption('--foo'), '->getParameterOption() returns the option of specified name'); - $input = new ArrayInput(array('--foo', '--', '--bar' => 'woop')); + $input = new ArrayInput(['--foo', '--', '--bar' => 'woop']); $this->assertEquals('woop', $input->getParameterOption('--bar'), '->getParameterOption() returns the correct value if an option is present in the passed parameters'); $this->assertEquals('default', $input->getParameterOption('--bar', 'default', true), '->getParameterOption() returns the default value if an option is present in the passed parameters after an end of options signal'); } public function testParseArguments() { - $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name')))); + $input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name')])); - $this->assertEquals(array('name' => 'foo'), $input->getArguments(), '->parse() parses required arguments'); + $this->assertEquals(['name' => 'foo'], $input->getArguments(), '->parse() parses required arguments'); } /** @@ -76,50 +76,50 @@ public function testParseOptions($input, $options, $expectedOptions, $message) public function provideOptions() { - return array( - array( - array('--foo' => 'bar'), - array(new InputOption('foo')), - array('foo' => 'bar'), + return [ + [ + ['--foo' => 'bar'], + [new InputOption('foo')], + ['foo' => 'bar'], '->parse() parses long options', - ), - array( - array('--foo' => 'bar'), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, '', 'default')), - array('foo' => 'bar'), + ], + [ + ['--foo' => 'bar'], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, '', 'default')], + ['foo' => 'bar'], '->parse() parses long options with a default value', - ), - array( - array(), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, '', 'default')), - array('foo' => 'default'), + ], + [ + [], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, '', 'default')], + ['foo' => 'default'], '->parse() uses the default value for long options with value optional which are not passed', - ), - array( - array('--foo' => null), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, '', 'default')), - array('foo' => null), + ], + [ + ['--foo' => null], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, '', 'default')], + ['foo' => null], '->parse() parses long options with a default value', - ), - array( - array('-f' => 'bar'), - array(new InputOption('foo', 'f')), - array('foo' => 'bar'), + ], + [ + ['-f' => 'bar'], + [new InputOption('foo', 'f')], + ['foo' => 'bar'], '->parse() parses short options', - ), - array( - array('--' => null, '-f' => 'bar'), - array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, '', 'default')), - array('foo' => 'default'), + ], + [ + ['--' => null, '-f' => 'bar'], + [new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL, '', 'default')], + ['foo' => 'default'], '->parse() does not parse opts after an end of options signal', - ), - array( - array('--' => null), - array(), - array(), + ], + [ + ['--' => null], + [], + [], '->parse() does not choke on end of options signal', - ), - ); + ], + ]; } /** @@ -139,39 +139,39 @@ public function testParseInvalidInput($parameters, $definition, $expectedExcepti public function provideInvalidInput() { - return array( - array( - array('foo' => 'foo'), - new InputDefinition(array(new InputArgument('name'))), + return [ + [ + ['foo' => 'foo'], + new InputDefinition([new InputArgument('name')]), 'The "foo" argument does not exist.', - ), - array( - array('--foo' => null), - new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), + ], + [ + ['--foo' => null], + new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)]), 'The "--foo" option requires a value.', - ), - array( - array('--foo' => 'foo'), + ], + [ + ['--foo' => 'foo'], new InputDefinition(), 'The "--foo" option does not exist.', - ), - array( - array('-o' => 'foo'), + ], + [ + ['-o' => 'foo'], new InputDefinition(), 'The "-o" option does not exist.', - ), - ); + ], + ]; } public function testToString() { - $input = new ArrayInput(array('-f' => null, '-b' => 'bar', '--foo' => 'b a z', '--lala' => null, 'test' => 'Foo', 'test2' => "A\nB'C")); + $input = new ArrayInput(['-f' => null, '-b' => 'bar', '--foo' => 'b a z', '--lala' => null, 'test' => 'Foo', 'test2' => "A\nB'C"]); $this->assertEquals('-f -b=bar --foo='.escapeshellarg('b a z').' --lala Foo '.escapeshellarg("A\nB'C"), (string) $input); - $input = new ArrayInput(array('-b' => array('bval_1', 'bval_2'), '--f' => array('fval_1', 'fval_2'))); + $input = new ArrayInput(['-b' => ['bval_1', 'bval_2'], '--f' => ['fval_1', 'fval_2']]); $this->assertSame('-b=bval_1 -b=bval_2 --f=fval_1 --f=fval_2', (string) $input); - $input = new ArrayInput(array('array_arg' => array('val_1', 'val_2'))); + $input = new ArrayInput(['array_arg' => ['val_1', 'val_2']]); $this->assertSame('val_1 val_2', (string) $input); } } diff --git a/vendor/symfony/console/Tests/Input/InputArgumentTest.php b/vendor/symfony/console/Tests/Input/InputArgumentTest.php index 66af98b33b666fdf9b54f55625e099fc8fb2b36b..7561e10abe3629832006aba48b033a735d7ff39c 100644 --- a/vendor/symfony/console/Tests/Input/InputArgumentTest.php +++ b/vendor/symfony/console/Tests/Input/InputArgumentTest.php @@ -54,10 +54,10 @@ public function testInvalidModes($mode) public function provideInvalidModes() { - return array( - array('ANOTHER_ONE'), - array(-1), - ); + return [ + ['ANOTHER_ONE'], + [-1], + ]; } public function testIsArray() @@ -91,8 +91,8 @@ public function testSetDefault() $this->assertEquals('another', $argument->getDefault(), '->setDefault() changes the default value'); $argument = new InputArgument('foo', InputArgument::OPTIONAL | InputArgument::IS_ARRAY); - $argument->setDefault(array(1, 2)); - $this->assertEquals(array(1, 2), $argument->getDefault(), '->setDefault() changes the default value'); + $argument->setDefault([1, 2]); + $this->assertEquals([1, 2], $argument->getDefault(), '->setDefault() changes the default value'); } /** diff --git a/vendor/symfony/console/Tests/Input/InputDefinitionTest.php b/vendor/symfony/console/Tests/Input/InputDefinitionTest.php index d9ff5435b2a71a81a12bb428c2de541a39d6c8be..5fdcb981c6079f38a927c6e029f66145d2f85f74 100644 --- a/vendor/symfony/console/Tests/Input/InputDefinitionTest.php +++ b/vendor/symfony/console/Tests/Input/InputDefinitionTest.php @@ -35,10 +35,10 @@ public function testConstructorArguments() $this->initializeArguments(); $definition = new InputDefinition(); - $this->assertEquals(array(), $definition->getArguments(), '__construct() creates a new InputDefinition object'); + $this->assertEquals([], $definition->getArguments(), '__construct() creates a new InputDefinition object'); - $definition = new InputDefinition(array($this->foo, $this->bar)); - $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getArguments(), '__construct() takes an array of InputArgument objects as its first argument'); + $definition = new InputDefinition([$this->foo, $this->bar]); + $this->assertEquals(['foo' => $this->foo, 'bar' => $this->bar], $definition->getArguments(), '__construct() takes an array of InputArgument objects as its first argument'); } public function testConstructorOptions() @@ -46,10 +46,10 @@ public function testConstructorOptions() $this->initializeOptions(); $definition = new InputDefinition(); - $this->assertEquals(array(), $definition->getOptions(), '__construct() creates a new InputDefinition object'); + $this->assertEquals([], $definition->getOptions(), '__construct() creates a new InputDefinition object'); - $definition = new InputDefinition(array($this->foo, $this->bar)); - $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getOptions(), '__construct() takes an array of InputOption objects as its first argument'); + $definition = new InputDefinition([$this->foo, $this->bar]); + $this->assertEquals(['foo' => $this->foo, 'bar' => $this->bar], $definition->getOptions(), '__construct() takes an array of InputOption objects as its first argument'); } public function testSetArguments() @@ -57,11 +57,11 @@ public function testSetArguments() $this->initializeArguments(); $definition = new InputDefinition(); - $definition->setArguments(array($this->foo)); - $this->assertEquals(array('foo' => $this->foo), $definition->getArguments(), '->setArguments() sets the array of InputArgument objects'); - $definition->setArguments(array($this->bar)); + $definition->setArguments([$this->foo]); + $this->assertEquals(['foo' => $this->foo], $definition->getArguments(), '->setArguments() sets the array of InputArgument objects'); + $definition->setArguments([$this->bar]); - $this->assertEquals(array('bar' => $this->bar), $definition->getArguments(), '->setArguments() clears all InputArgument objects'); + $this->assertEquals(['bar' => $this->bar], $definition->getArguments(), '->setArguments() clears all InputArgument objects'); } public function testAddArguments() @@ -69,10 +69,10 @@ public function testAddArguments() $this->initializeArguments(); $definition = new InputDefinition(); - $definition->addArguments(array($this->foo)); - $this->assertEquals(array('foo' => $this->foo), $definition->getArguments(), '->addArguments() adds an array of InputArgument objects'); - $definition->addArguments(array($this->bar)); - $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getArguments(), '->addArguments() does not clear existing InputArgument objects'); + $definition->addArguments([$this->foo]); + $this->assertEquals(['foo' => $this->foo], $definition->getArguments(), '->addArguments() adds an array of InputArgument objects'); + $definition->addArguments([$this->bar]); + $this->assertEquals(['foo' => $this->foo, 'bar' => $this->bar], $definition->getArguments(), '->addArguments() does not clear existing InputArgument objects'); } public function testAddArgument() @@ -81,9 +81,9 @@ public function testAddArgument() $definition = new InputDefinition(); $definition->addArgument($this->foo); - $this->assertEquals(array('foo' => $this->foo), $definition->getArguments(), '->addArgument() adds a InputArgument object'); + $this->assertEquals(['foo' => $this->foo], $definition->getArguments(), '->addArgument() adds a InputArgument object'); $definition->addArgument($this->bar); - $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getArguments(), '->addArgument() adds a InputArgument object'); + $this->assertEquals(['foo' => $this->foo, 'bar' => $this->bar], $definition->getArguments(), '->addArgument() adds a InputArgument object'); } /** @@ -130,7 +130,7 @@ public function testGetArgument() $this->initializeArguments(); $definition = new InputDefinition(); - $definition->addArguments(array($this->foo)); + $definition->addArguments([$this->foo]); $this->assertEquals($this->foo, $definition->getArgument('foo'), '->getArgument() returns a InputArgument by its name'); } @@ -143,7 +143,7 @@ public function testGetInvalidArgument() $this->initializeArguments(); $definition = new InputDefinition(); - $definition->addArguments(array($this->foo)); + $definition->addArguments([$this->foo]); $definition->getArgument('bar'); } @@ -152,7 +152,7 @@ public function testHasArgument() $this->initializeArguments(); $definition = new InputDefinition(); - $definition->addArguments(array($this->foo)); + $definition->addArguments([$this->foo]); $this->assertTrue($definition->hasArgument('foo'), '->hasArgument() returns true if a InputArgument exists for the given name'); $this->assertFalse($definition->hasArgument('bar'), '->hasArgument() returns false if a InputArgument exists for the given name'); @@ -182,28 +182,28 @@ public function testGetArgumentCount() public function testGetArgumentDefaults() { - $definition = new InputDefinition(array( + $definition = new InputDefinition([ new InputArgument('foo1', InputArgument::OPTIONAL), new InputArgument('foo2', InputArgument::OPTIONAL, '', 'default'), new InputArgument('foo3', InputArgument::OPTIONAL | InputArgument::IS_ARRAY), - // new InputArgument('foo4', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, '', array(1, 2)), - )); - $this->assertEquals(array('foo1' => null, 'foo2' => 'default', 'foo3' => array()), $definition->getArgumentDefaults(), '->getArgumentDefaults() return the default values for each argument'); + // new InputArgument('foo4', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, '', [1, 2]), + ]); + $this->assertEquals(['foo1' => null, 'foo2' => 'default', 'foo3' => []], $definition->getArgumentDefaults(), '->getArgumentDefaults() return the default values for each argument'); - $definition = new InputDefinition(array( - new InputArgument('foo4', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, '', array(1, 2)), - )); - $this->assertEquals(array('foo4' => array(1, 2)), $definition->getArgumentDefaults(), '->getArgumentDefaults() return the default values for each argument'); + $definition = new InputDefinition([ + new InputArgument('foo4', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, '', [1, 2]), + ]); + $this->assertEquals(['foo4' => [1, 2]], $definition->getArgumentDefaults(), '->getArgumentDefaults() return the default values for each argument'); } public function testSetOptions() { $this->initializeOptions(); - $definition = new InputDefinition(array($this->foo)); - $this->assertEquals(array('foo' => $this->foo), $definition->getOptions(), '->setOptions() sets the array of InputOption objects'); - $definition->setOptions(array($this->bar)); - $this->assertEquals(array('bar' => $this->bar), $definition->getOptions(), '->setOptions() clears all InputOption objects'); + $definition = new InputDefinition([$this->foo]); + $this->assertEquals(['foo' => $this->foo], $definition->getOptions(), '->setOptions() sets the array of InputOption objects'); + $definition->setOptions([$this->bar]); + $this->assertEquals(['bar' => $this->bar], $definition->getOptions(), '->setOptions() clears all InputOption objects'); } /** @@ -214,8 +214,8 @@ public function testSetOptionsClearsOptions() { $this->initializeOptions(); - $definition = new InputDefinition(array($this->foo)); - $definition->setOptions(array($this->bar)); + $definition = new InputDefinition([$this->foo]); + $definition->setOptions([$this->bar]); $definition->getOptionForShortcut('f'); } @@ -223,10 +223,10 @@ public function testAddOptions() { $this->initializeOptions(); - $definition = new InputDefinition(array($this->foo)); - $this->assertEquals(array('foo' => $this->foo), $definition->getOptions(), '->addOptions() adds an array of InputOption objects'); - $definition->addOptions(array($this->bar)); - $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getOptions(), '->addOptions() does not clear existing InputOption objects'); + $definition = new InputDefinition([$this->foo]); + $this->assertEquals(['foo' => $this->foo], $definition->getOptions(), '->addOptions() adds an array of InputOption objects'); + $definition->addOptions([$this->bar]); + $this->assertEquals(['foo' => $this->foo, 'bar' => $this->bar], $definition->getOptions(), '->addOptions() does not clear existing InputOption objects'); } public function testAddOption() @@ -235,9 +235,9 @@ public function testAddOption() $definition = new InputDefinition(); $definition->addOption($this->foo); - $this->assertEquals(array('foo' => $this->foo), $definition->getOptions(), '->addOption() adds a InputOption object'); + $this->assertEquals(['foo' => $this->foo], $definition->getOptions(), '->addOption() adds a InputOption object'); $definition->addOption($this->bar); - $this->assertEquals(array('foo' => $this->foo, 'bar' => $this->bar), $definition->getOptions(), '->addOption() adds a InputOption object'); + $this->assertEquals(['foo' => $this->foo, 'bar' => $this->bar], $definition->getOptions(), '->addOption() adds a InputOption object'); } /** @@ -270,7 +270,7 @@ public function testGetOption() { $this->initializeOptions(); - $definition = new InputDefinition(array($this->foo)); + $definition = new InputDefinition([$this->foo]); $this->assertEquals($this->foo, $definition->getOption('foo'), '->getOption() returns a InputOption by its name'); } @@ -282,7 +282,7 @@ public function testGetInvalidOption() { $this->initializeOptions(); - $definition = new InputDefinition(array($this->foo)); + $definition = new InputDefinition([$this->foo]); $definition->getOption('bar'); } @@ -290,7 +290,7 @@ public function testHasOption() { $this->initializeOptions(); - $definition = new InputDefinition(array($this->foo)); + $definition = new InputDefinition([$this->foo]); $this->assertTrue($definition->hasOption('foo'), '->hasOption() returns true if a InputOption exists for the given name'); $this->assertFalse($definition->hasOption('bar'), '->hasOption() returns false if a InputOption exists for the given name'); } @@ -299,7 +299,7 @@ public function testHasShortcut() { $this->initializeOptions(); - $definition = new InputDefinition(array($this->foo)); + $definition = new InputDefinition([$this->foo]); $this->assertTrue($definition->hasShortcut('f'), '->hasShortcut() returns true if a InputOption exists for the given shortcut'); $this->assertFalse($definition->hasShortcut('b'), '->hasShortcut() returns false if a InputOption exists for the given shortcut'); } @@ -308,7 +308,7 @@ public function testGetOptionForShortcut() { $this->initializeOptions(); - $definition = new InputDefinition(array($this->foo)); + $definition = new InputDefinition([$this->foo]); $this->assertEquals($this->foo, $definition->getOptionForShortcut('f'), '->getOptionForShortcut() returns a InputOption by its shortcut'); } @@ -316,7 +316,7 @@ public function testGetOptionForMultiShortcut() { $this->initializeOptions(); - $definition = new InputDefinition(array($this->multi)); + $definition = new InputDefinition([$this->multi]); $this->assertEquals($this->multi, $definition->getOptionForShortcut('m'), '->getOptionForShortcut() returns a InputOption by its shortcut'); $this->assertEquals($this->multi, $definition->getOptionForShortcut('mmm'), '->getOptionForShortcut() returns a InputOption by its shortcut'); } @@ -329,30 +329,30 @@ public function testGetOptionForInvalidShortcut() { $this->initializeOptions(); - $definition = new InputDefinition(array($this->foo)); + $definition = new InputDefinition([$this->foo]); $definition->getOptionForShortcut('l'); } public function testGetOptionDefaults() { - $definition = new InputDefinition(array( + $definition = new InputDefinition([ new InputOption('foo1', null, InputOption::VALUE_NONE), new InputOption('foo2', null, InputOption::VALUE_REQUIRED), new InputOption('foo3', null, InputOption::VALUE_REQUIRED, '', 'default'), new InputOption('foo4', null, InputOption::VALUE_OPTIONAL), new InputOption('foo5', null, InputOption::VALUE_OPTIONAL, '', 'default'), new InputOption('foo6', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY), - new InputOption('foo7', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, '', array(1, 2)), - )); - $defaults = array( + new InputOption('foo7', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, '', [1, 2]), + ]); + $defaults = [ 'foo1' => false, 'foo2' => null, 'foo3' => 'default', 'foo4' => null, 'foo5' => 'default', - 'foo6' => array(), - 'foo7' => array(1, 2), - ); + 'foo6' => [], + 'foo7' => [1, 2], + ]; $this->assertSame($defaults, $definition->getOptionDefaults(), '->getOptionDefaults() returns the default values for all options'); } @@ -366,24 +366,24 @@ public function testGetSynopsis(InputDefinition $definition, $expectedSynopsis, public function getGetSynopsisData() { - return array( - array(new InputDefinition(array(new InputOption('foo'))), '[--foo]', 'puts optional options in square brackets'), - array(new InputDefinition(array(new InputOption('foo', 'f'))), '[-f|--foo]', 'separates shortcut with a pipe'), - array(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))), '[-f|--foo FOO]', 'uses shortcut as value placeholder'), - array(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL))), '[-f|--foo [FOO]]', 'puts optional values in square brackets'), + return [ + [new InputDefinition([new InputOption('foo')]), '[--foo]', 'puts optional options in square brackets'], + [new InputDefinition([new InputOption('foo', 'f')]), '[-f|--foo]', 'separates shortcut with a pipe'], + [new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_REQUIRED)]), '[-f|--foo FOO]', 'uses shortcut as value placeholder'], + [new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL)]), '[-f|--foo [FOO]]', 'puts optional values in square brackets'], - array(new InputDefinition(array(new InputArgument('foo', InputArgument::REQUIRED))), '<foo>', 'puts arguments in angle brackets'), - array(new InputDefinition(array(new InputArgument('foo'))), '[<foo>]', 'puts optional arguments in square brackets'), - array(new InputDefinition(array(new InputArgument('foo', InputArgument::IS_ARRAY))), '[<foo>]...', 'uses an ellipsis for array arguments'), - array(new InputDefinition(array(new InputArgument('foo', InputArgument::REQUIRED | InputArgument::IS_ARRAY))), '<foo> (<foo>)...', 'uses parenthesis and ellipsis for required array arguments'), + [new InputDefinition([new InputArgument('foo', InputArgument::REQUIRED)]), '<foo>', 'puts arguments in angle brackets'], + [new InputDefinition([new InputArgument('foo')]), '[<foo>]', 'puts optional arguments in square brackets'], + [new InputDefinition([new InputArgument('foo', InputArgument::IS_ARRAY)]), '[<foo>]...', 'uses an ellipsis for array arguments'], + [new InputDefinition([new InputArgument('foo', InputArgument::REQUIRED | InputArgument::IS_ARRAY)]), '<foo> (<foo>)...', 'uses parenthesis and ellipsis for required array arguments'], - array(new InputDefinition(array(new InputOption('foo'), new InputArgument('foo', InputArgument::REQUIRED))), '[--foo] [--] <foo>', 'puts [--] between options and arguments'), - ); + [new InputDefinition([new InputOption('foo'), new InputArgument('foo', InputArgument::REQUIRED)]), '[--foo] [--] <foo>', 'puts [--] between options and arguments'], + ]; } public function testGetShortSynopsis() { - $definition = new InputDefinition(array(new InputOption('foo'), new InputOption('bar'), new InputArgument('cat'))); + $definition = new InputDefinition([new InputOption('foo'), new InputOption('bar'), new InputArgument('cat')]); $this->assertEquals('[options] [--] [<cat>]', $definition->getSynopsis(true), '->getSynopsis(true) groups options in [options]'); } diff --git a/vendor/symfony/console/Tests/Input/InputOptionTest.php b/vendor/symfony/console/Tests/Input/InputOptionTest.php index 943bf607f5e5ae2dbbafa71c7c0b288c545a3da3..413cb5270078fc4b6d8db9487a9a32d8d3da3a06 100644 --- a/vendor/symfony/console/Tests/Input/InputOptionTest.php +++ b/vendor/symfony/console/Tests/Input/InputOptionTest.php @@ -39,7 +39,7 @@ public function testShortcut() $this->assertEquals('f', $option->getShortcut(), '__construct() can take a shortcut as its second argument'); $option = new InputOption('foo', '-f|-ff|fff'); $this->assertEquals('f|ff|fff', $option->getShortcut(), '__construct() removes the leading - of the shortcuts'); - $option = new InputOption('foo', array('f', 'ff', '-fff')); + $option = new InputOption('foo', ['f', 'ff', '-fff']); $this->assertEquals('f|ff|fff', $option->getShortcut(), '__construct() removes the leading - of the shortcuts'); $option = new InputOption('foo'); $this->assertNull($option->getShortcut(), '__construct() makes the shortcut null by default'); @@ -90,10 +90,10 @@ public function testInvalidModes($mode) public function provideInvalidModes() { - return array( - array('ANOTHER_ONE'), - array(-1), - ); + return [ + ['ANOTHER_ONE'], + [-1], + ]; } /** @@ -146,7 +146,7 @@ public function testGetDefault() $this->assertNull($option->getDefault(), '->getDefault() returns null if no default value is configured'); $option = new InputOption('foo', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY); - $this->assertEquals(array(), $option->getDefault(), '->getDefault() returns an empty array if option is an array'); + $this->assertEquals([], $option->getDefault(), '->getDefault() returns an empty array if option is an array'); $option = new InputOption('foo', null, InputOption::VALUE_NONE); $this->assertFalse($option->getDefault(), '->getDefault() returns false if the option does not take a value'); @@ -161,8 +161,8 @@ public function testSetDefault() $this->assertEquals('another', $option->getDefault(), '->setDefault() changes the default value'); $option = new InputOption('foo', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY); - $option->setDefault(array(1, 2)); - $this->assertEquals(array(1, 2), $option->getDefault(), '->setDefault() changes the default value'); + $option->setDefault([1, 2]); + $this->assertEquals([1, 2], $option->getDefault(), '->setDefault() changes the default value'); } /** diff --git a/vendor/symfony/console/Tests/Input/InputTest.php b/vendor/symfony/console/Tests/Input/InputTest.php index 7cf1d244a3e4eb4518133f6f1b10403c118c03d1..61608bf27cf4dc8b511e050596728f47366416ae 100644 --- a/vendor/symfony/console/Tests/Input/InputTest.php +++ b/vendor/symfony/console/Tests/Input/InputTest.php @@ -21,30 +21,30 @@ class InputTest extends TestCase { public function testConstructor() { - $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name')))); + $input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name')])); $this->assertEquals('foo', $input->getArgument('name'), '->__construct() takes a InputDefinition as an argument'); } public function testOptions() { - $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name')))); + $input = new ArrayInput(['--name' => 'foo'], new InputDefinition([new InputOption('name')])); $this->assertEquals('foo', $input->getOption('name'), '->getOption() returns the value for the given option'); $input->setOption('name', 'bar'); $this->assertEquals('bar', $input->getOption('name'), '->setOption() sets the value for a given option'); - $this->assertEquals(array('name' => 'bar'), $input->getOptions(), '->getOptions() returns all option values'); + $this->assertEquals(['name' => 'bar'], $input->getOptions(), '->getOptions() returns all option values'); - $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')))); + $input = new ArrayInput(['--name' => 'foo'], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')])); $this->assertEquals('default', $input->getOption('bar'), '->getOption() returns the default value for optional options'); - $this->assertEquals(array('name' => 'foo', 'bar' => 'default'), $input->getOptions(), '->getOptions() returns all option values, even optional ones'); + $this->assertEquals(['name' => 'foo', 'bar' => 'default'], $input->getOptions(), '->getOptions() returns all option values, even optional ones'); - $input = new ArrayInput(array('--name' => 'foo', '--bar' => ''), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')))); + $input = new ArrayInput(['--name' => 'foo', '--bar' => ''], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')])); $this->assertEquals('', $input->getOption('bar'), '->getOption() returns null for options explicitly passed without value (or an empty value)'); - $this->assertEquals(array('name' => 'foo', 'bar' => ''), $input->getOptions(), '->getOptions() returns all option values.'); + $this->assertEquals(['name' => 'foo', 'bar' => ''], $input->getOptions(), '->getOptions() returns all option values.'); - $input = new ArrayInput(array('--name' => 'foo', '--bar' => null), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')))); + $input = new ArrayInput(['--name' => 'foo', '--bar' => null], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')])); $this->assertNull($input->getOption('bar'), '->getOption() returns null for options explicitly passed without value (or an empty value)'); - $this->assertEquals(array('name' => 'foo', 'bar' => null), $input->getOptions(), '->getOptions() returns all option values'); + $this->assertEquals(['name' => 'foo', 'bar' => null], $input->getOptions(), '->getOptions() returns all option values'); } /** @@ -53,7 +53,7 @@ public function testOptions() */ public function testSetInvalidOption() { - $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')))); + $input = new ArrayInput(['--name' => 'foo'], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')])); $input->setOption('foo', 'bar'); } @@ -63,22 +63,22 @@ public function testSetInvalidOption() */ public function testGetInvalidOption() { - $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')))); + $input = new ArrayInput(['--name' => 'foo'], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')])); $input->getOption('foo'); } public function testArguments() { - $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name')))); + $input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name')])); $this->assertEquals('foo', $input->getArgument('name'), '->getArgument() returns the value for the given argument'); $input->setArgument('name', 'bar'); $this->assertEquals('bar', $input->getArgument('name'), '->setArgument() sets the value for a given argument'); - $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->getArguments() returns all argument values'); + $this->assertEquals(['name' => 'bar'], $input->getArguments(), '->getArguments() returns all argument values'); - $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')))); + $input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')])); $this->assertEquals('default', $input->getArgument('bar'), '->getArgument() returns the default value for optional arguments'); - $this->assertEquals(array('name' => 'foo', 'bar' => 'default'), $input->getArguments(), '->getArguments() returns all argument values, even optional ones'); + $this->assertEquals(['name' => 'foo', 'bar' => 'default'], $input->getArguments(), '->getArguments() returns all argument values, even optional ones'); } /** @@ -87,7 +87,7 @@ public function testArguments() */ public function testSetInvalidArgument() { - $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')))); + $input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')])); $input->setArgument('foo', 'bar'); } @@ -97,7 +97,7 @@ public function testSetInvalidArgument() */ public function testGetInvalidArgument() { - $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')))); + $input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')])); $input->getArgument('foo'); } @@ -107,8 +107,8 @@ public function testGetInvalidArgument() */ public function testValidateWithMissingArguments() { - $input = new ArrayInput(array()); - $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED)))); + $input = new ArrayInput([]); + $input->bind(new InputDefinition([new InputArgument('name', InputArgument::REQUIRED)])); $input->validate(); } @@ -118,22 +118,22 @@ public function testValidateWithMissingArguments() */ public function testValidateWithMissingRequiredArguments() { - $input = new ArrayInput(array('bar' => 'baz')); - $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED), new InputArgument('bar', InputArgument::OPTIONAL)))); + $input = new ArrayInput(['bar' => 'baz']); + $input->bind(new InputDefinition([new InputArgument('name', InputArgument::REQUIRED), new InputArgument('bar', InputArgument::OPTIONAL)])); $input->validate(); } public function testValidate() { - $input = new ArrayInput(array('name' => 'foo')); - $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED)))); + $input = new ArrayInput(['name' => 'foo']); + $input->bind(new InputDefinition([new InputArgument('name', InputArgument::REQUIRED)])); $this->assertNull($input->validate()); } public function testSetGetInteractive() { - $input = new ArrayInput(array()); + $input = new ArrayInput([]); $this->assertTrue($input->isInteractive(), '->isInteractive() returns whether the input should be interactive or not'); $input->setInteractive(false); $this->assertFalse($input->isInteractive(), '->setInteractive() changes the interactive flag'); @@ -141,7 +141,7 @@ public function testSetGetInteractive() public function testSetGetStream() { - $input = new ArrayInput(array()); + $input = new ArrayInput([]); $stream = fopen('php://memory', 'r+', false); $input->setStream($stream); $this->assertSame($stream, $input->getStream()); diff --git a/vendor/symfony/console/Tests/Input/StringInputTest.php b/vendor/symfony/console/Tests/Input/StringInputTest.php index f2e3467ef8687e354277d495283abaa4ab74d21f..7f2189452608b48e9d95b5237196520796a6c9a7 100644 --- a/vendor/symfony/console/Tests/Input/StringInputTest.php +++ b/vendor/symfony/console/Tests/Input/StringInputTest.php @@ -33,7 +33,7 @@ public function testTokenize($input, $tokens, $message) public function testInputOptionWithGivenString() { $definition = new InputDefinition( - array(new InputOption('foo', null, InputOption::VALUE_REQUIRED)) + [new InputOption('foo', null, InputOption::VALUE_REQUIRED)] ); // call to bind @@ -44,33 +44,33 @@ public function testInputOptionWithGivenString() public function getTokenizeData() { - return array( - array('', array(), '->tokenize() parses an empty string'), - array('foo', array('foo'), '->tokenize() parses arguments'), - array(' foo bar ', array('foo', 'bar'), '->tokenize() ignores whitespaces between arguments'), - array('"quoted"', array('quoted'), '->tokenize() parses quoted arguments'), - array("'quoted'", array('quoted'), '->tokenize() parses quoted arguments'), - array("'a\rb\nc\td'", array("a\rb\nc\td"), '->tokenize() parses whitespace chars in strings'), - array("'a'\r'b'\n'c'\t'd'", array('a', 'b', 'c', 'd'), '->tokenize() parses whitespace chars between args as spaces'), - array('\"quoted\"', array('"quoted"'), '->tokenize() parses escaped-quoted arguments'), - array("\'quoted\'", array('\'quoted\''), '->tokenize() parses escaped-quoted arguments'), - array('-a', array('-a'), '->tokenize() parses short options'), - array('-azc', array('-azc'), '->tokenize() parses aggregated short options'), - array('-awithavalue', array('-awithavalue'), '->tokenize() parses short options with a value'), - array('-a"foo bar"', array('-afoo bar'), '->tokenize() parses short options with a value'), - array('-a"foo bar""foo bar"', array('-afoo barfoo bar'), '->tokenize() parses short options with a value'), - array('-a\'foo bar\'', array('-afoo bar'), '->tokenize() parses short options with a value'), - array('-a\'foo bar\'\'foo bar\'', array('-afoo barfoo bar'), '->tokenize() parses short options with a value'), - array('-a\'foo bar\'"foo bar"', array('-afoo barfoo bar'), '->tokenize() parses short options with a value'), - array('--long-option', array('--long-option'), '->tokenize() parses long options'), - array('--long-option=foo', array('--long-option=foo'), '->tokenize() parses long options with a value'), - array('--long-option="foo bar"', array('--long-option=foo bar'), '->tokenize() parses long options with a value'), - array('--long-option="foo bar""another"', array('--long-option=foo baranother'), '->tokenize() parses long options with a value'), - array('--long-option=\'foo bar\'', array('--long-option=foo bar'), '->tokenize() parses long options with a value'), - array("--long-option='foo bar''another'", array('--long-option=foo baranother'), '->tokenize() parses long options with a value'), - array("--long-option='foo bar'\"another\"", array('--long-option=foo baranother'), '->tokenize() parses long options with a value'), - array('foo -a -ffoo --long bar', array('foo', '-a', '-ffoo', '--long', 'bar'), '->tokenize() parses when several arguments and options'), - ); + return [ + ['', [], '->tokenize() parses an empty string'], + ['foo', ['foo'], '->tokenize() parses arguments'], + [' foo bar ', ['foo', 'bar'], '->tokenize() ignores whitespaces between arguments'], + ['"quoted"', ['quoted'], '->tokenize() parses quoted arguments'], + ["'quoted'", ['quoted'], '->tokenize() parses quoted arguments'], + ["'a\rb\nc\td'", ["a\rb\nc\td"], '->tokenize() parses whitespace chars in strings'], + ["'a'\r'b'\n'c'\t'd'", ['a', 'b', 'c', 'd'], '->tokenize() parses whitespace chars between args as spaces'], + ['\"quoted\"', ['"quoted"'], '->tokenize() parses escaped-quoted arguments'], + ["\'quoted\'", ['\'quoted\''], '->tokenize() parses escaped-quoted arguments'], + ['-a', ['-a'], '->tokenize() parses short options'], + ['-azc', ['-azc'], '->tokenize() parses aggregated short options'], + ['-awithavalue', ['-awithavalue'], '->tokenize() parses short options with a value'], + ['-a"foo bar"', ['-afoo bar'], '->tokenize() parses short options with a value'], + ['-a"foo bar""foo bar"', ['-afoo barfoo bar'], '->tokenize() parses short options with a value'], + ['-a\'foo bar\'', ['-afoo bar'], '->tokenize() parses short options with a value'], + ['-a\'foo bar\'\'foo bar\'', ['-afoo barfoo bar'], '->tokenize() parses short options with a value'], + ['-a\'foo bar\'"foo bar"', ['-afoo barfoo bar'], '->tokenize() parses short options with a value'], + ['--long-option', ['--long-option'], '->tokenize() parses long options'], + ['--long-option=foo', ['--long-option=foo'], '->tokenize() parses long options with a value'], + ['--long-option="foo bar"', ['--long-option=foo bar'], '->tokenize() parses long options with a value'], + ['--long-option="foo bar""another"', ['--long-option=foo baranother'], '->tokenize() parses long options with a value'], + ['--long-option=\'foo bar\'', ['--long-option=foo bar'], '->tokenize() parses long options with a value'], + ["--long-option='foo bar''another'", ['--long-option=foo baranother'], '->tokenize() parses long options with a value'], + ["--long-option='foo bar'\"another\"", ['--long-option=foo baranother'], '->tokenize() parses long options with a value'], + ['foo -a -ffoo --long bar', ['foo', '-a', '-ffoo', '--long', 'bar'], '->tokenize() parses when several arguments and options'], + ]; } public function testToString() diff --git a/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php b/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php index 95e78fc29f5a0df57a887dba332b60f9dedfb33d..efeec4234e95277f5462a4e2a52767d46329497b 100644 --- a/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php +++ b/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php @@ -39,7 +39,7 @@ public function getLogger() { $this->output = new DummyOutput(OutputInterface::VERBOSITY_VERBOSE); - return new ConsoleLogger($this->output, array( + return new ConsoleLogger($this->output, [ LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL, LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL, LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL, @@ -48,7 +48,7 @@ public function getLogger() LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL, LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL, LogLevel::DEBUG => OutputInterface::VERBOSITY_NORMAL, - )); + ]); } /** @@ -64,7 +64,7 @@ public function getLogs() /** * @dataProvider provideOutputMappingParams */ - public function testOutputMapping($logLevel, $outputVerbosity, $isOutput, $addVerbosityLevelMap = array()) + public function testOutputMapping($logLevel, $outputVerbosity, $isOutput, $addVerbosityLevelMap = []) { $out = new BufferedOutput($outputVerbosity); $logger = new ConsoleLogger($out, $addVerbosityLevelMap); @@ -75,22 +75,22 @@ public function testOutputMapping($logLevel, $outputVerbosity, $isOutput, $addVe public function provideOutputMappingParams() { - $quietMap = array(LogLevel::EMERGENCY => OutputInterface::VERBOSITY_QUIET); - - return array( - array(LogLevel::EMERGENCY, OutputInterface::VERBOSITY_NORMAL, true), - array(LogLevel::WARNING, OutputInterface::VERBOSITY_NORMAL, true), - array(LogLevel::INFO, OutputInterface::VERBOSITY_NORMAL, false), - array(LogLevel::DEBUG, OutputInterface::VERBOSITY_NORMAL, false), - array(LogLevel::INFO, OutputInterface::VERBOSITY_VERBOSE, false), - array(LogLevel::INFO, OutputInterface::VERBOSITY_VERY_VERBOSE, true), - array(LogLevel::DEBUG, OutputInterface::VERBOSITY_VERY_VERBOSE, false), - array(LogLevel::DEBUG, OutputInterface::VERBOSITY_DEBUG, true), - array(LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false), - array(LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, false), - array(LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false, $quietMap), - array(LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, true, $quietMap), - ); + $quietMap = [LogLevel::EMERGENCY => OutputInterface::VERBOSITY_QUIET]; + + return [ + [LogLevel::EMERGENCY, OutputInterface::VERBOSITY_NORMAL, true], + [LogLevel::WARNING, OutputInterface::VERBOSITY_NORMAL, true], + [LogLevel::INFO, OutputInterface::VERBOSITY_NORMAL, false], + [LogLevel::DEBUG, OutputInterface::VERBOSITY_NORMAL, false], + [LogLevel::INFO, OutputInterface::VERBOSITY_VERBOSE, false], + [LogLevel::INFO, OutputInterface::VERBOSITY_VERY_VERBOSE, true], + [LogLevel::DEBUG, OutputInterface::VERBOSITY_VERY_VERBOSE, false], + [LogLevel::DEBUG, OutputInterface::VERBOSITY_DEBUG, true], + [LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false], + [LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, false], + [LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false, $quietMap], + [LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, true, $quietMap], + ]; } public function testHasErrored() @@ -117,28 +117,28 @@ public function testImplements() public function testLogsAtAllLevels($level, $message) { $logger = $this->getLogger(); - $logger->{$level}($message, array('user' => 'Bob')); - $logger->log($level, $message, array('user' => 'Bob')); + $logger->{$level}($message, ['user' => 'Bob']); + $logger->log($level, $message, ['user' => 'Bob']); - $expected = array( + $expected = [ $level.' message of level '.$level.' with context: Bob', $level.' message of level '.$level.' with context: Bob', - ); + ]; $this->assertEquals($expected, $this->getLogs()); } public function provideLevelsAndMessages() { - return array( - LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), - LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), - LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), - LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), - LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), - LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), - LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), - LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), - ); + return [ + LogLevel::EMERGENCY => [LogLevel::EMERGENCY, 'message of level emergency with context: {user}'], + LogLevel::ALERT => [LogLevel::ALERT, 'message of level alert with context: {user}'], + LogLevel::CRITICAL => [LogLevel::CRITICAL, 'message of level critical with context: {user}'], + LogLevel::ERROR => [LogLevel::ERROR, 'message of level error with context: {user}'], + LogLevel::WARNING => [LogLevel::WARNING, 'message of level warning with context: {user}'], + LogLevel::NOTICE => [LogLevel::NOTICE, 'message of level notice with context: {user}'], + LogLevel::INFO => [LogLevel::INFO, 'message of level info with context: {user}'], + LogLevel::DEBUG => [LogLevel::DEBUG, 'message of level debug with context: {user}'], + ]; } /** @@ -153,56 +153,56 @@ public function testThrowsOnInvalidLevel() public function testContextReplacement() { $logger = $this->getLogger(); - $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); + $logger->info('{Message {nothing} {user} {foo.bar} a}', ['user' => 'Bob', 'foo.bar' => 'Bar']); - $expected = array('info {Message {nothing} Bob Bar a}'); + $expected = ['info {Message {nothing} Bob Bar a}']; $this->assertEquals($expected, $this->getLogs()); } public function testObjectCastToString() { if (method_exists($this, 'createPartialMock')) { - $dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', array('__toString')); + $dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']); } else { - $dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', array('__toString')); + $dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']); } $dummy->method('__toString')->will($this->returnValue('DUMMY')); $this->getLogger()->warning($dummy); - $expected = array('warning DUMMY'); + $expected = ['warning DUMMY']; $this->assertEquals($expected, $this->getLogs()); } public function testContextCanContainAnything() { - $context = array( + $context = [ 'bool' => true, 'null' => null, 'string' => 'Foo', 'int' => 0, 'float' => 0.5, - 'nested' => array('with object' => new DummyTest()), + 'nested' => ['with object' => new DummyTest()], 'object' => new \DateTime(), 'resource' => fopen('php://memory', 'r'), - ); + ]; $this->getLogger()->warning('Crazy context data', $context); - $expected = array('warning Crazy context data'); + $expected = ['warning Crazy context data']; $this->assertEquals($expected, $this->getLogs()); } public function testContextExceptionKeyCanBeExceptionOrOtherValues() { $logger = $this->getLogger(); - $logger->warning('Random message', array('exception' => 'oops')); - $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); + $logger->warning('Random message', ['exception' => 'oops']); + $logger->critical('Uncaught Exception!', ['exception' => new \LogicException('Fail')]); - $expected = array( + $expected = [ 'warning Random message', 'critical Uncaught Exception!', - ); + ]; $this->assertEquals($expected, $this->getLogs()); } } diff --git a/vendor/symfony/console/Tests/Output/OutputTest.php b/vendor/symfony/console/Tests/Output/OutputTest.php index fbd4e8498908922c7268ee5fdc8a8c57b5e62f74..58659f285608fee508994303cb8d81b1a3240b70 100644 --- a/vendor/symfony/console/Tests/Output/OutputTest.php +++ b/vendor/symfony/console/Tests/Output/OutputTest.php @@ -77,7 +77,7 @@ public function testWriteWithVerbosityQuiet() public function testWriteAnArrayOfMessages() { $output = new TestOutput(); - $output->writeln(array('foo', 'bar')); + $output->writeln(['foo', 'bar']); $this->assertEquals("foo\nbar\n", $output->output, '->writeln() can take an array of messages to output'); } @@ -93,10 +93,10 @@ public function testWriteRawMessage($message, $type, $expectedOutput) public function provideWriteArguments() { - return array( - array('<info>foo</info>', Output::OUTPUT_RAW, "<info>foo</info>\n"), - array('<info>foo</info>', Output::OUTPUT_PLAIN, "foo\n"), - ); + return [ + ['<info>foo</info>', Output::OUTPUT_RAW, "<info>foo</info>\n"], + ['<info>foo</info>', Output::OUTPUT_PLAIN, "foo\n"], + ]; } public function testWriteWithDecorationTurnedOff() @@ -109,7 +109,7 @@ public function testWriteWithDecorationTurnedOff() public function testWriteDecoratedMessage() { - $fooStyle = new OutputFormatterStyle('yellow', 'red', array('blink')); + $fooStyle = new OutputFormatterStyle('yellow', 'red', ['blink']); $output = new TestOutput(); $output->getFormatter()->setStyle('FOO', $fooStyle); $output->setDecorated(true); @@ -150,13 +150,13 @@ public function testWriteWithVerbosityOption($verbosity, $expected, $msg) public function verbosityProvider() { - return array( - array(Output::VERBOSITY_QUIET, '2', '->write() in QUIET mode only outputs when an explicit QUIET verbosity is passed'), - array(Output::VERBOSITY_NORMAL, '123', '->write() in NORMAL mode outputs anything below an explicit VERBOSE verbosity'), - array(Output::VERBOSITY_VERBOSE, '1234', '->write() in VERBOSE mode outputs anything below an explicit VERY_VERBOSE verbosity'), - array(Output::VERBOSITY_VERY_VERBOSE, '12345', '->write() in VERY_VERBOSE mode outputs anything below an explicit DEBUG verbosity'), - array(Output::VERBOSITY_DEBUG, '123456', '->write() in DEBUG mode outputs everything'), - ); + return [ + [Output::VERBOSITY_QUIET, '2', '->write() in QUIET mode only outputs when an explicit QUIET verbosity is passed'], + [Output::VERBOSITY_NORMAL, '123', '->write() in NORMAL mode outputs anything below an explicit VERBOSE verbosity'], + [Output::VERBOSITY_VERBOSE, '1234', '->write() in VERBOSE mode outputs anything below an explicit VERY_VERBOSE verbosity'], + [Output::VERBOSITY_VERY_VERBOSE, '12345', '->write() in VERY_VERBOSE mode outputs anything below an explicit DEBUG verbosity'], + [Output::VERBOSITY_DEBUG, '123456', '->write() in DEBUG mode outputs everything'], + ]; } } diff --git a/vendor/symfony/console/Tests/Question/ConfirmationQuestionTest.php b/vendor/symfony/console/Tests/Question/ConfirmationQuestionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..83899772a82dbdf301fcf42477e562d19c990d7e --- /dev/null +++ b/vendor/symfony/console/Tests/Question/ConfirmationQuestionTest.php @@ -0,0 +1,62 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Tests\Question; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Question\ConfirmationQuestion; + +class ConfirmationQuestionTest extends TestCase +{ + /** + * @dataProvider normalizerUsecases + */ + public function testDefaultRegexUsecases($default, $answers, $expected, $message) + { + $sut = new ConfirmationQuestion('A question', $default); + + foreach ($answers as $answer) { + $normalizer = $sut->getNormalizer(); + $actual = $normalizer($answer); + $this->assertEquals($expected, $actual, sprintf($message, $answer)); + } + } + + public function normalizerUsecases() + { + return [ + [ + true, + ['y', 'Y', 'yes', 'YES', 'yEs', ''], + true, + 'When default is true, the normalizer must return true for "%s"', + ], + [ + true, + ['n', 'N', 'no', 'NO', 'nO', 'foo', '1', '0'], + false, + 'When default is true, the normalizer must return false for "%s"', + ], + [ + false, + ['y', 'Y', 'yes', 'YES', 'yEs'], + true, + 'When default is false, the normalizer must return true for "%s"', + ], + [ + false, + ['n', 'N', 'no', 'NO', 'nO', 'foo', '1', '0', ''], + false, + 'When default is false, the normalizer must return false for "%s"', + ], + ]; + } +} diff --git a/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php b/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php index 308030bbcf22b60a5700843651096d74de436e59..e6e061f4416b6ca0ab859973cd78087e6248aa0b 100644 --- a/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php +++ b/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php @@ -48,7 +48,7 @@ public function testOutputs($inputCommandFilepath, $outputFilepath) { $code = require $inputCommandFilepath; $this->command->setCode($code); - $this->tester->execute(array(), array('interactive' => false, 'decorated' => false)); + $this->tester->execute([], ['interactive' => false, 'decorated' => false]); $this->assertStringEqualsFile($outputFilepath, $this->tester->getDisplay(true)); } @@ -59,7 +59,7 @@ public function testInteractiveOutputs($inputCommandFilepath, $outputFilepath) { $code = require $inputCommandFilepath; $this->command->setCode($code); - $this->tester->execute(array(), array('interactive' => true, 'decorated' => false)); + $this->tester->execute([], ['interactive' => true, 'decorated' => false]); $this->assertStringEqualsFile($outputFilepath, $this->tester->getDisplay(true)); } diff --git a/vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php b/vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php index 57e7136d5580e49863bc9181610c07b504496b71..74c3562001fca1bfcf20a9a43e1ed86ddec30b49 100644 --- a/vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php +++ b/vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php @@ -31,7 +31,7 @@ protected function setUp() ; $this->tester = new ApplicationTester($this->application); - $this->tester->run(array('command' => 'foo', 'foo' => 'bar'), array('interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE)); + $this->tester->run(['command' => 'foo', 'foo' => 'bar'], ['interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]); } protected function tearDown() diff --git a/vendor/symfony/console/Tests/Tester/CommandTesterTest.php b/vendor/symfony/console/Tests/Tester/CommandTesterTest.php index 58eb8103fcc9aabdd0f8a0518ee8647c7accf643..f916b1821fcc899c6374534995c97c98162b81aa 100644 --- a/vendor/symfony/console/Tests/Tester/CommandTesterTest.php +++ b/vendor/symfony/console/Tests/Tester/CommandTesterTest.php @@ -17,6 +17,7 @@ use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Output\Output; +use Symfony\Component\Console\Question\ChoiceQuestion; use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Tester\CommandTester; @@ -34,7 +35,7 @@ protected function setUp() $this->command->setCode(function ($input, $output) { $output->writeln('foo'); }); $this->tester = new CommandTester($this->command); - $this->tester->execute(array('foo' => 'bar'), array('interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE)); + $this->tester->execute(['foo' => 'bar'], ['interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]); } protected function tearDown() @@ -84,19 +85,19 @@ public function testCommandFromApplication() $tester = new CommandTester($application->find('foo')); // check that there is no need to pass the command name here - $this->assertEquals(0, $tester->execute(array())); + $this->assertEquals(0, $tester->execute([])); } public function testCommandWithInputs() { - $questions = array( + $questions = [ 'What\'s your name?', 'How are you?', 'Where do you come from?', - ); + ]; $command = new Command('foo'); - $command->setHelperSet(new HelperSet(array(new QuestionHelper()))); + $command->setHelperSet(new HelperSet([new QuestionHelper()])); $command->setCode(function ($input, $output) use ($questions, $command) { $helper = $command->getHelper('question'); $helper->ask($input, $output, new Question($questions[0])); @@ -105,8 +106,33 @@ public function testCommandWithInputs() }); $tester = new CommandTester($command); - $tester->setInputs(array('Bobby', 'Fine', 'France')); - $tester->execute(array()); + $tester->setInputs(['Bobby', 'Fine', 'France']); + $tester->execute([]); + + $this->assertEquals(0, $tester->getStatusCode()); + $this->assertEquals(implode('', $questions), $tester->getDisplay(true)); + } + + public function testCommandWithDefaultInputs() + { + $questions = [ + 'What\'s your name?', + 'How are you?', + 'Where do you come from?', + ]; + + $command = new Command('foo'); + $command->setHelperSet(new HelperSet([new QuestionHelper()])); + $command->setCode(function ($input, $output) use ($questions, $command) { + $helper = $command->getHelper('question'); + $helper->ask($input, $output, new Question($questions[0], 'Bobby')); + $helper->ask($input, $output, new Question($questions[1], 'Fine')); + $helper->ask($input, $output, new Question($questions[2], 'France')); + }); + + $tester = new CommandTester($command); + $tester->setInputs(['', '', '']); + $tester->execute([]); $this->assertEquals(0, $tester->getStatusCode()); $this->assertEquals(implode('', $questions), $tester->getDisplay(true)); @@ -114,37 +140,64 @@ public function testCommandWithInputs() /** * @expectedException \RuntimeException - * @expectedMessage Aborted + * @expectedExceptionMessage Aborted. */ public function testCommandWithWrongInputsNumber() { - $questions = array( + $questions = [ + 'What\'s your name?', + 'How are you?', + 'Where do you come from?', + ]; + + $command = new Command('foo'); + $command->setHelperSet(new HelperSet([new QuestionHelper()])); + $command->setCode(function ($input, $output) use ($questions, $command) { + $helper = $command->getHelper('question'); + $helper->ask($input, $output, new ChoiceQuestion('choice', ['a', 'b'])); + $helper->ask($input, $output, new Question($questions[0])); + $helper->ask($input, $output, new Question($questions[1])); + $helper->ask($input, $output, new Question($questions[2])); + }); + + $tester = new CommandTester($command); + $tester->setInputs(['a', 'Bobby', 'Fine']); + $tester->execute([]); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Aborted. + */ + public function testCommandWithQuestionsButNoInputs() + { + $questions = [ 'What\'s your name?', 'How are you?', 'Where do you come from?', - ); + ]; $command = new Command('foo'); - $command->setHelperSet(new HelperSet(array(new QuestionHelper()))); + $command->setHelperSet(new HelperSet([new QuestionHelper()])); $command->setCode(function ($input, $output) use ($questions, $command) { $helper = $command->getHelper('question'); + $helper->ask($input, $output, new ChoiceQuestion('choice', ['a', 'b'])); $helper->ask($input, $output, new Question($questions[0])); $helper->ask($input, $output, new Question($questions[1])); $helper->ask($input, $output, new Question($questions[2])); }); $tester = new CommandTester($command); - $tester->setInputs(array('Bobby', 'Fine')); - $tester->execute(array()); + $tester->execute([]); } public function testSymfonyStyleCommandWithInputs() { - $questions = array( + $questions = [ 'What\'s your name?', 'How are you?', 'Where do you come from?', - ); + ]; $command = new Command('foo'); $command->setCode(function ($input, $output) use ($questions, $command) { @@ -155,8 +208,8 @@ public function testSymfonyStyleCommandWithInputs() }); $tester = new CommandTester($command); - $tester->setInputs(array('Bobby', 'Fine', 'France')); - $tester->execute(array()); + $tester->setInputs(['Bobby', 'Fine', 'France']); + $tester->execute([]); $this->assertEquals(0, $tester->getStatusCode()); } diff --git a/vendor/symfony/console/composer.json b/vendor/symfony/console/composer.json index ab348abd8d632e60439d6a325dce1cc7c79e7e5c..d994a460451c62e0219268b9fd7930434818b707 100644 --- a/vendor/symfony/console/composer.json +++ b/vendor/symfony/console/composer.json @@ -28,11 +28,14 @@ "symfony/process": "~3.3|~4.0", "psr/log": "~1.0" }, + "provide": { + "psr/log-implementation": "1.0" + }, "suggest": { "symfony/event-dispatcher": "", "symfony/lock": "", "symfony/process": "", - "psr/log-implementation": "For using the console logger" + "psr/log": "For using the console logger" }, "conflict": { "symfony/dependency-injection": "<3.4", diff --git a/vendor/symfony/console/phpunit.xml.dist b/vendor/symfony/console/phpunit.xml.dist index 32569d63c4af92e03d41ff9a5cf928922efa4bc0..15e7e52a975c6adb61bd88978b52b541a9f48425 100644 --- a/vendor/symfony/console/phpunit.xml.dist +++ b/vendor/symfony/console/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/debug/BufferingLogger.php b/vendor/symfony/debug/BufferingLogger.php index a2ed75b9dc9f1f8833a7595abf1dd12506bbc159..e7db3a4ce4c6af5f4e79dbc04b4578afb73d292b 100644 --- a/vendor/symfony/debug/BufferingLogger.php +++ b/vendor/symfony/debug/BufferingLogger.php @@ -20,17 +20,17 @@ */ class BufferingLogger extends AbstractLogger { - private $logs = array(); + private $logs = []; - public function log($level, $message, array $context = array()) + public function log($level, $message, array $context = []) { - $this->logs[] = array($level, $message, $context); + $this->logs[] = [$level, $message, $context]; } public function cleanLogs() { $logs = $this->logs; - $this->logs = array(); + $this->logs = []; return $logs; } diff --git a/vendor/symfony/debug/Debug.php b/vendor/symfony/debug/Debug.php index c296d0f65a41dd843340172660aa5696779ac9b9..498d30935c9718e49ac23d682f60d03a68f010e8 100644 --- a/vendor/symfony/debug/Debug.php +++ b/vendor/symfony/debug/Debug.php @@ -42,10 +42,10 @@ public static function enable($errorReportingLevel = E_ALL, $displayErrors = tru error_reporting(E_ALL); } - if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) { + if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) { ini_set('display_errors', 0); ExceptionHandler::register(); - } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) { + } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) { // CLI - display errors only if they're not already logged to STDERR ini_set('display_errors', 1); } diff --git a/vendor/symfony/debug/DebugClassLoader.php b/vendor/symfony/debug/DebugClassLoader.php index dff57e69bd1fb7dfe70d260c15aaffae30c49c81..310f7d4e2247c2b0a291a500f0f456d24f201036 100644 --- a/vendor/symfony/debug/DebugClassLoader.php +++ b/vendor/symfony/debug/DebugClassLoader.php @@ -26,16 +26,16 @@ class DebugClassLoader { private $classLoader; private $isFinder; - private $loaded = array(); + private $loaded = []; private static $caseCheck; - private static $checkedClasses = array(); - private static $final = array(); - private static $finalMethods = array(); - private static $deprecated = array(); - private static $internal = array(); - private static $internalMethods = array(); - private static $php7Reserved = array('int' => 1, 'float' => 1, 'bool' => 1, 'string' => 1, 'true' => 1, 'false' => 1, 'null' => 1); - private static $darwinCache = array('/' => array('/', array())); + private static $checkedClasses = []; + private static $final = []; + private static $finalMethods = []; + private static $deprecated = []; + private static $internal = []; + private static $internalMethods = []; + private static $php7Reserved = ['int' => 1, 'float' => 1, 'bool' => 1, 'string' => 1, 'true' => 1, 'false' => 1, 'null' => 1]; + private static $darwinCache = ['/' => ['/', []]]; public function __construct(callable $classLoader) { @@ -95,7 +95,7 @@ class_exists('Psr\Log\LogLevel'); foreach ($functions as $function) { if (!\is_array($function) || !$function[0] instanceof self) { - $function = array(new static($function), 'loadClass'); + $function = [new static($function), 'loadClass']; } spl_autoload_register($function); @@ -124,13 +124,19 @@ public static function disable() } } + /** + * @return string|null + */ + public function findFile($class) + { + return $this->isFinder ? $this->classLoader[0]->findFile($class) ?: null : null; + } + /** * Loads the given class or interface. * * @param string $class The name of the class * - * @return bool|null True, if loaded - * * @throws \RuntimeException */ public function loadClass($class) @@ -140,14 +146,14 @@ public function loadClass($class) try { if ($this->isFinder && !isset($this->loaded[$class])) { $this->loaded[$class] = true; - if ($file = $this->classLoader[0]->findFile($class) ?: false) { - $wasCached = \function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file); - + if (!$file = $this->classLoader[0]->findFile($class) ?: false) { + // no-op + } elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) { require $file; - if ($wasCached) { - return; - } + return; + } else { + require $file; } } else { \call_user_func($this->classLoader, $class); @@ -184,200 +190,232 @@ private function checkClass($class, $file = null) throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: "%s" vs "%s".', $class, $name)); } - // Don't trigger deprecations for classes in the same vendor - if (2 > $len = 1 + (\strpos($name, '\\') ?: \strpos($name, '_'))) { - $len = 0; - $ns = ''; - } else { - $ns = \substr($name, 0, $len); + $deprecations = $this->checkAnnotations($refl, $name); + + if (isset(self::$php7Reserved[\strtolower($refl->getShortName())])) { + $deprecations[] = sprintf('The "%s" class uses the reserved name "%s", it will break on PHP 7 and higher', $name, $refl->getShortName()); } - // Detect annotations on the class - if (false !== $doc = $refl->getDocComment()) { - foreach (array('final', 'deprecated', 'internal') as $annotation) { - if (false !== \strpos($doc, $annotation) && preg_match('#\n \* @'.$annotation.'(?:( .+?)\.?)?\r?\n \*(?: @|/$)#s', $doc, $notice)) { - self::${$annotation}[$name] = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; - } - } + foreach ($deprecations as $message) { + @trigger_error($message, E_USER_DEPRECATED); } + } - $parentAndTraits = \class_uses($name, false); - if ($parent = \get_parent_class($class)) { - $parentAndTraits[] = $parent; + if (!$file) { + return; + } - if (!isset(self::$checkedClasses[$parent])) { - $this->checkClass($parent); - } + if (!$exists) { + if (false !== strpos($class, '/')) { + throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class)); + } + + throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); + } - if (isset(self::$final[$parent])) { - @trigger_error(sprintf('The "%s" class is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $parent, self::$final[$parent], $name), E_USER_DEPRECATED); + if (self::$caseCheck && $message = $this->checkCase($refl, $file, $class)) { + throw new \RuntimeException(sprintf('Case mismatch between class and real file names: "%s" vs "%s" in "%s".', $message[0], $message[1], $message[2])); + } + } + + public function checkAnnotations(\ReflectionClass $refl, $class) + { + $deprecations = []; + + // Don't trigger deprecations for classes in the same vendor + if (2 > $len = 1 + (\strpos($class, '\\') ?: \strpos($class, '_'))) { + $len = 0; + $ns = ''; + } else { + $ns = \str_replace('_', '\\', \substr($class, 0, $len)); + } + + // Detect annotations on the class + if (false !== $doc = $refl->getDocComment()) { + foreach (['final', 'deprecated', 'internal'] as $annotation) { + if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { + self::${$annotation}[$class] = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : ''; } } + } - // Detect if the parent is annotated - foreach ($parentAndTraits + $this->getOwnInterfaces($name, $parent) as $use) { - if (!isset(self::$checkedClasses[$use])) { - $this->checkClass($use); - } - if (isset(self::$deprecated[$use]) && \strncmp($ns, $use, $len)) { - $type = class_exists($name, false) ? 'class' : (interface_exists($name, false) ? 'interface' : 'trait'); - $verb = class_exists($use, false) || interface_exists($name, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses'); + $parent = \get_parent_class($class); + $parentAndOwnInterfaces = $this->getOwnInterfaces($class, $parent); + if ($parent) { + $parentAndOwnInterfaces[$parent] = $parent; - @trigger_error(sprintf('The "%s" %s %s "%s" that is deprecated%s.', $name, $type, $verb, $use, self::$deprecated[$use]), E_USER_DEPRECATED); - } - if (isset(self::$internal[$use]) && \strncmp($ns, $use, $len)) { - @trigger_error(sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $name), E_USER_DEPRECATED); - } + if (!isset(self::$checkedClasses[$parent])) { + $this->checkClass($parent); } - // Inherit @final and @internal annotations for methods - self::$finalMethods[$name] = array(); - self::$internalMethods[$name] = array(); - foreach ($parentAndTraits as $use) { - foreach (array('finalMethods', 'internalMethods') as $property) { - if (isset(self::${$property}[$use])) { - self::${$property}[$name] = self::${$property}[$name] ? self::${$property}[$use] + self::${$property}[$name] : self::${$property}[$use]; - } - } + if (isset(self::$final[$parent])) { + $deprecations[] = sprintf('The "%s" class is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $parent, self::$final[$parent], $class); } + } - $isClass = \class_exists($name, false); - foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $method) { - if ($method->class !== $name) { - continue; - } + // Detect if the parent is annotated + foreach ($parentAndOwnInterfaces + \class_uses($class, false) as $use) { + if (!isset(self::$checkedClasses[$use])) { + $this->checkClass($use); + } + if (isset(self::$deprecated[$use]) && \strncmp($ns, \str_replace('_', '\\', $use), $len)) { + $type = class_exists($class, false) ? 'class' : (interface_exists($class, false) ? 'interface' : 'trait'); + $verb = class_exists($use, false) || interface_exists($class, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses'); - // Method from a trait - if ($method->getFilename() !== $refl->getFileName()) { - continue; - } + $deprecations[] = sprintf('The "%s" %s %s "%s" that is deprecated%s.', $class, $type, $verb, $use, self::$deprecated[$use]); + } + if (isset(self::$internal[$use]) && \strncmp($ns, \str_replace('_', '\\', $use), $len)) { + $deprecations[] = sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $class); + } + } - if ($isClass && $parent && isset(self::$finalMethods[$parent][$method->name])) { - list($declaringClass, $message) = self::$finalMethods[$parent][$method->name]; - @trigger_error(sprintf('The "%s::%s()" method is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $declaringClass, $method->name, $message, $name), E_USER_DEPRECATED); - } + if (\trait_exists($class)) { + return $deprecations; + } - foreach ($parentAndTraits as $use) { - if (isset(self::$internalMethods[$use][$method->name])) { - list($declaringClass, $message) = self::$internalMethods[$use][$method->name]; - if (\strncmp($ns, $declaringClass, $len)) { - @trigger_error(sprintf('The "%s::%s()" method is considered internal%s. It may change without further notice. You should not extend it from "%s".', $declaringClass, $method->name, $message, $name), E_USER_DEPRECATED); - } - } + // Inherit @final and @internal annotations for methods + self::$finalMethods[$class] = []; + self::$internalMethods[$class] = []; + foreach ($parentAndOwnInterfaces as $use) { + foreach (['finalMethods', 'internalMethods'] as $property) { + if (isset(self::${$property}[$use])) { + self::${$property}[$class] = self::${$property}[$class] ? self::${$property}[$use] + self::${$property}[$class] : self::${$property}[$use]; } + } + } - // Detect method annotations - if (false === $doc = $method->getDocComment()) { - continue; - } + foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $method) { + if ($method->class !== $class) { + continue; + } - foreach (array('final', 'internal') as $annotation) { - if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { - $message = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; - self::${$annotation.'Methods'}[$name][$method->name] = array($name, $message); - } + if ($parent && isset(self::$finalMethods[$parent][$method->name])) { + list($declaringClass, $message) = self::$finalMethods[$parent][$method->name]; + $deprecations[] = sprintf('The "%s::%s()" method is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $declaringClass, $method->name, $message, $class); + } + + if (isset(self::$internalMethods[$class][$method->name])) { + list($declaringClass, $message) = self::$internalMethods[$class][$method->name]; + if (\strncmp($ns, $declaringClass, $len)) { + $deprecations[] = sprintf('The "%s::%s()" method is considered internal%s. It may change without further notice. You should not extend it from "%s".', $declaringClass, $method->name, $message, $class); } } - if (isset(self::$php7Reserved[\strtolower($refl->getShortName())])) { - @trigger_error(sprintf('The "%s" class uses the reserved name "%s", it will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED); + // Detect method annotations + if (false === $doc = $method->getDocComment()) { + continue; } - } - if ($file) { - if (!$exists) { - if (false !== strpos($class, '/')) { - throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class)); + foreach (['final', 'internal'] as $annotation) { + if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { + $message = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : ''; + self::${$annotation.'Methods'}[$class][$method->name] = [$class, $message]; } - - throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); } - if (self::$caseCheck) { - $real = explode('\\', $class.strrchr($file, '.')); - $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file)); + } + + return $deprecations; + } - $i = \count($tail) - 1; - $j = \count($real) - 1; + public function checkCase(\ReflectionClass $refl, $file, $class) + { + $real = explode('\\', $class.strrchr($file, '.')); + $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file)); - while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) { - --$i; - --$j; - } + $i = \count($tail) - 1; + $j = \count($real) - 1; - array_splice($tail, 0, $i + 1); - } - if (self::$caseCheck && $tail) { - $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail); - $tailLen = \strlen($tail); - $real = $refl->getFileName(); - - if (2 === self::$caseCheck) { - // realpath() on MacOSX doesn't normalize the case of characters - - $i = 1 + strrpos($real, '/'); - $file = substr($real, $i); - $real = substr($real, 0, $i); - - if (isset(self::$darwinCache[$real])) { - $kDir = $real; - } else { - $kDir = strtolower($real); - - if (isset(self::$darwinCache[$kDir])) { - $real = self::$darwinCache[$kDir][0]; - } else { - $dir = getcwd(); - chdir($real); - $real = getcwd().'/'; - chdir($dir); - - $dir = $real; - $k = $kDir; - $i = \strlen($dir) - 1; - while (!isset(self::$darwinCache[$k])) { - self::$darwinCache[$k] = array($dir, array()); - self::$darwinCache[$dir] = &self::$darwinCache[$k]; - - while ('/' !== $dir[--$i]) { - } - $k = substr($k, 0, ++$i); - $dir = substr($dir, 0, $i--); - } - } - } + while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) { + --$i; + --$j; + } - $dirFiles = self::$darwinCache[$kDir][1]; - - if (isset($dirFiles[$file])) { - $kFile = $file; - } else { - $kFile = strtolower($file); - - if (!isset($dirFiles[$kFile])) { - foreach (scandir($real, 2) as $f) { - if ('.' !== $f[0]) { - $dirFiles[$f] = $f; - if ($f === $file) { - $kFile = $k = $file; - } elseif ($f !== $k = strtolower($f)) { - $dirFiles[$k] = $f; - } - } - } - self::$darwinCache[$kDir][1] = $dirFiles; - } - } + array_splice($tail, 0, $i + 1); + + if (!$tail) { + return; + } + + $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail); + $tailLen = \strlen($tail); + $real = $refl->getFileName(); - $real .= $dirFiles[$kFile]; + if (2 === self::$caseCheck) { + $real = $this->darwinRealpath($real); + } + + if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true) + && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false) + ) { + return [substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)]; + } + } + + /** + * `realpath` on MacOSX doesn't normalize the case of characters. + */ + private function darwinRealpath($real) + { + $i = 1 + strrpos($real, '/'); + $file = substr($real, $i); + $real = substr($real, 0, $i); + + if (isset(self::$darwinCache[$real])) { + $kDir = $real; + } else { + $kDir = strtolower($real); + + if (isset(self::$darwinCache[$kDir])) { + $real = self::$darwinCache[$kDir][0]; + } else { + $dir = getcwd(); + chdir($real); + $real = getcwd().'/'; + chdir($dir); + + $dir = $real; + $k = $kDir; + $i = \strlen($dir) - 1; + while (!isset(self::$darwinCache[$k])) { + self::$darwinCache[$k] = [$dir, []]; + self::$darwinCache[$dir] = &self::$darwinCache[$k]; + + while ('/' !== $dir[--$i]) { + } + $k = substr($k, 0, ++$i); + $dir = substr($dir, 0, $i--); } + } + } + + $dirFiles = self::$darwinCache[$kDir][1]; + + if (!isset($dirFiles[$file]) && ') : eval()\'d code' === substr($file, -17)) { + // Get the file name from "file_name.php(123) : eval()'d code" + $file = substr($file, 0, strrpos($file, '(', -17)); + } - if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true) - && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false) - ) { - throw new \RuntimeException(sprintf('Case mismatch between class and real file names: "%s" vs "%s" in "%s".', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1))); + if (isset($dirFiles[$file])) { + return $real .= $dirFiles[$file]; + } + + $kFile = strtolower($file); + + if (!isset($dirFiles[$kFile])) { + foreach (scandir($real, 2) as $f) { + if ('.' !== $f[0]) { + $dirFiles[$f] = $f; + if ($f === $file) { + $kFile = $k = $file; + } elseif ($f !== $k = strtolower($f)) { + $dirFiles[$k] = $f; + } } } + self::$darwinCache[$kDir][1] = $dirFiles; } + + return $real .= $dirFiles[$kFile]; } /** diff --git a/vendor/symfony/debug/ErrorHandler.php b/vendor/symfony/debug/ErrorHandler.php index 69a72804177924a353da9e9516e635375ad69854..d871b91538c22b95bdd51538f341bcbeb5d5dd00 100644 --- a/vendor/symfony/debug/ErrorHandler.php +++ b/vendor/symfony/debug/ErrorHandler.php @@ -48,7 +48,7 @@ */ class ErrorHandler { - private $levels = array( + private $levels = [ E_DEPRECATED => 'Deprecated', E_USER_DEPRECATED => 'User Deprecated', E_NOTICE => 'Notice', @@ -64,25 +64,25 @@ class ErrorHandler E_PARSE => 'Parse Error', E_ERROR => 'Error', E_CORE_ERROR => 'Core Error', - ); - - private $loggers = array( - E_DEPRECATED => array(null, LogLevel::INFO), - E_USER_DEPRECATED => array(null, LogLevel::INFO), - E_NOTICE => array(null, LogLevel::WARNING), - E_USER_NOTICE => array(null, LogLevel::WARNING), - E_STRICT => array(null, LogLevel::WARNING), - E_WARNING => array(null, LogLevel::WARNING), - E_USER_WARNING => array(null, LogLevel::WARNING), - E_COMPILE_WARNING => array(null, LogLevel::WARNING), - E_CORE_WARNING => array(null, LogLevel::WARNING), - E_USER_ERROR => array(null, LogLevel::CRITICAL), - E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL), - E_COMPILE_ERROR => array(null, LogLevel::CRITICAL), - E_PARSE => array(null, LogLevel::CRITICAL), - E_ERROR => array(null, LogLevel::CRITICAL), - E_CORE_ERROR => array(null, LogLevel::CRITICAL), - ); + ]; + + private $loggers = [ + E_DEPRECATED => [null, LogLevel::INFO], + E_USER_DEPRECATED => [null, LogLevel::INFO], + E_NOTICE => [null, LogLevel::WARNING], + E_USER_NOTICE => [null, LogLevel::WARNING], + E_STRICT => [null, LogLevel::WARNING], + E_WARNING => [null, LogLevel::WARNING], + E_USER_WARNING => [null, LogLevel::WARNING], + E_COMPILE_WARNING => [null, LogLevel::WARNING], + E_CORE_WARNING => [null, LogLevel::WARNING], + E_USER_ERROR => [null, LogLevel::CRITICAL], + E_RECOVERABLE_ERROR => [null, LogLevel::CRITICAL], + E_COMPILE_ERROR => [null, LogLevel::CRITICAL], + E_PARSE => [null, LogLevel::CRITICAL], + E_ERROR => [null, LogLevel::CRITICAL], + E_CORE_ERROR => [null, LogLevel::CRITICAL], + ]; private $thrownErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED private $scopedErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED @@ -97,10 +97,10 @@ class ErrorHandler private $bootstrappingLogger; private static $reservedMemory; - private static $stackedErrors = array(); - private static $stackedErrorLevels = array(); + private static $stackedErrors = []; + private static $stackedErrorLevels = []; private static $toStringException = null; - private static $silencedErrorCache = array(); + private static $silencedErrorCache = []; private static $silencedErrorCount = 0; private static $exitCode = 0; @@ -123,10 +123,10 @@ public static function register(self $handler = null, $replace = true) $handler = new static(); } - if (null === $prev = set_error_handler(array($handler, 'handleError'))) { + if (null === $prev = set_error_handler([$handler, 'handleError'])) { restore_error_handler(); // Specifying the error types earlier would expose us to https://bugs.php.net/63206 - set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors); + set_error_handler([$handler, 'handleError'], $handler->thrownErrors | $handler->loggedErrors); $handler->isRoot = true; } @@ -140,12 +140,12 @@ public static function register(self $handler = null, $replace = true) } else { $handlerIsRegistered = true; } - if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) { + if (\is_array($prev = set_exception_handler([$handler, 'handleException'])) && $prev[0] instanceof self) { restore_exception_handler(); if (!$handlerIsRegistered) { $handler = $prev[0]; } elseif ($handler !== $prev[0] && $replace) { - set_exception_handler(array($handler, 'handleException')); + set_exception_handler([$handler, 'handleException']); $p = $prev[0]->setExceptionHandler(null); $handler->setExceptionHandler($p); $prev[0]->setExceptionHandler($p); @@ -178,12 +178,12 @@ public function __construct(BufferingLogger $bootstrappingLogger = null) */ public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false) { - $loggers = array(); + $loggers = []; if (\is_array($levels)) { foreach ($levels as $type => $logLevel) { if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) { - $loggers[$type] = array($logger, $logLevel); + $loggers[$type] = [$logger, $logLevel]; } } } else { @@ -214,15 +214,15 @@ public function setLoggers(array $loggers) { $prevLogged = $this->loggedErrors; $prev = $this->loggers; - $flush = array(); + $flush = []; foreach ($loggers as $type => $log) { if (!isset($prev[$type])) { throw new \InvalidArgumentException('Unknown error type: '.$type); } if (!\is_array($log)) { - $log = array($log); - } elseif (!array_key_exists(0, $log)) { + $log = [$log]; + } elseif (!\array_key_exists(0, $log)) { throw new \InvalidArgumentException('No logger provided'); } if (null === $log[0]) { @@ -358,9 +358,9 @@ private function reRegister($prev) if ($handler === $this) { restore_error_handler(); if ($this->isRoot) { - set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors); + set_error_handler([$this, 'handleError'], $this->thrownErrors | $this->loggedErrors); } else { - set_error_handler(array($this, 'handleError')); + set_error_handler([$this, 'handleError']); } } } @@ -397,10 +397,10 @@ public function handleError($type, $message, $file, $line) $scope = $this->scopedErrors & $type; if (4 < $numArgs = \func_num_args()) { - $context = $scope ? (func_get_arg(4) ?: array()) : array(); + $context = $scope ? (func_get_arg(4) ?: []) : []; $backtrace = 5 < $numArgs ? func_get_arg(5) : null; // defined on HHVM } else { - $context = array(); + $context = []; $backtrace = null; } @@ -426,19 +426,19 @@ public function handleError($type, $message, $file, $line) self::$toStringException = null; } elseif (!$throw && !($type & $level)) { if (!isset(self::$silencedErrorCache[$id = $file.':'.$line])) { - $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3), $type, $file, $line, false) : array(); + $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3), $type, $file, $line, false) : []; $errorAsException = new SilencedErrorContext($type, $file, $line, $lightTrace); } elseif (isset(self::$silencedErrorCache[$id][$message])) { $lightTrace = null; $errorAsException = self::$silencedErrorCache[$id][$message]; ++$errorAsException->count; } else { - $lightTrace = array(); + $lightTrace = []; $errorAsException = null; } if (100 < ++self::$silencedErrorCount) { - self::$silencedErrorCache = $lightTrace = array(); + self::$silencedErrorCache = $lightTrace = []; self::$silencedErrorCount = 1; } if ($errorAsException) { @@ -460,7 +460,7 @@ public function handleError($type, $message, $file, $line) $lightTrace = $this->cleanTrace($backtrace, $type, $file, $line, $throw); $this->traceReflector->setValue($errorAsException, $lightTrace); } else { - $this->traceReflector->setValue($errorAsException, array()); + $this->traceReflector->setValue($errorAsException, []); } } @@ -510,19 +510,28 @@ public function handleError($type, $message, $file, $line) if ($this->isRecursive) { $log = 0; } elseif (self::$stackedErrorLevels) { - self::$stackedErrors[] = array( + self::$stackedErrors[] = [ $this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $logMessage, - $errorAsException ? array('exception' => $errorAsException) : array(), - ); + $errorAsException ? ['exception' => $errorAsException] : [], + ]; } else { + if (!\defined('HHVM_VERSION')) { + $currentErrorHandler = set_error_handler('var_dump'); + restore_error_handler(); + } + try { $this->isRecursive = true; $level = ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG; - $this->loggers[$type][0]->log($level, $logMessage, $errorAsException ? array('exception' => $errorAsException) : array()); + $this->loggers[$type][0]->log($level, $logMessage, $errorAsException ? ['exception' => $errorAsException] : []); } finally { $this->isRecursive = false; + + if (!\defined('HHVM_VERSION')) { + set_error_handler($currentErrorHandler); + } } } @@ -551,12 +560,12 @@ public function handleException($exception, array $error = null) if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) { if ($exception instanceof FatalErrorException) { if ($exception instanceof FatalThrowableError) { - $error = array( + $error = [ 'type' => $type, 'message' => $message = $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), - ); + ]; } else { $message = 'Fatal '.$exception->getMessage(); } @@ -568,7 +577,7 @@ public function handleException($exception, array $error = null) } if ($this->loggedErrors & $type) { try { - $this->loggers[$type][0]->log($this->loggers[$type][1], $message, array('exception' => $exception)); + $this->loggers[$type][0]->log($this->loggers[$type][1], $message, ['exception' => $exception]); } catch (\Exception $handlerException) { } catch (\Throwable $handlerException) { } @@ -612,7 +621,7 @@ public static function handleFatalError(array $error = null) } $handler = self::$reservedMemory = null; - $handlers = array(); + $handlers = []; $previousHandler = null; $sameHandlerLimit = 10; @@ -643,7 +652,7 @@ public static function handleFatalError(array $error = null) $handler[0]->setExceptionHandler($h); } $handler = $handler[0]; - $handlers = array(); + $handlers = []; if ($exit = null === $error) { $error = error_get_last(); @@ -727,7 +736,7 @@ public static function unstackErrors() if (empty(self::$stackedErrorLevels)) { $errors = self::$stackedErrors; - self::$stackedErrors = array(); + self::$stackedErrors = []; foreach ($errors as $error) { $error[0]->log($error[1], $error[2], $error[3]); @@ -744,11 +753,11 @@ public static function unstackErrors() */ protected function getFatalErrorHandlers() { - return array( + return [ new UndefinedFunctionFatalErrorHandler(), new UndefinedMethodFatalErrorHandler(), new ClassNotFoundFatalErrorHandler(), - ); + ]; } private function cleanTrace($backtrace, $type, $file, $line, $throw) diff --git a/vendor/symfony/debug/Exception/ContextErrorException.php b/vendor/symfony/debug/Exception/ContextErrorException.php index 554139da3bf1d2e163f6c47d93ddc37f6d7f6163..930f3777632756d0bb26a97492df6e23ec83b70f 100644 --- a/vendor/symfony/debug/Exception/ContextErrorException.php +++ b/vendor/symfony/debug/Exception/ContextErrorException.php @@ -20,9 +20,9 @@ */ class ContextErrorException extends \ErrorException { - private $context = array(); + private $context = []; - public function __construct($message, $code, $severity, $filename, $lineno, $context = array()) + public function __construct($message, $code, $severity, $filename, $lineno, $context = []) { parent::__construct($message, $code, $severity, $filename, $lineno); $this->context = $context; diff --git a/vendor/symfony/debug/Exception/FatalErrorException.php b/vendor/symfony/debug/Exception/FatalErrorException.php index 8d996a422b142fba27fe5a8b9889ec51d9c40d6e..0f70ef929904aa0596be08ec84a078ef9c62ca55 100644 --- a/vendor/symfony/debug/Exception/FatalErrorException.php +++ b/vendor/symfony/debug/Exception/FatalErrorException.php @@ -66,7 +66,7 @@ public function __construct($message, $code, $severity, $filename, $lineno, $tra array_splice($trace, 0, $traceOffset); } } else { - $trace = array(); + $trace = []; } $this->setTrace($trace); diff --git a/vendor/symfony/debug/Exception/FlattenException.php b/vendor/symfony/debug/Exception/FlattenException.php index f76cf23f33777134d4c30b5af9a51bbbf3ca9cd6..9514bdc5e38f3fe74d9e58f5f83cf5efe478bf42 100644 --- a/vendor/symfony/debug/Exception/FlattenException.php +++ b/vendor/symfony/debug/Exception/FlattenException.php @@ -33,7 +33,7 @@ class FlattenException private $file; private $line; - public static function create(\Exception $exception, $statusCode = null, array $headers = array()) + public static function create(\Exception $exception, $statusCode = null, array $headers = []) { $e = new static(); $e->setMessage($exception->getMessage()); @@ -70,13 +70,13 @@ public static function create(\Exception $exception, $statusCode = null, array $ public function toArray() { - $exceptions = array(); - foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) { - $exceptions[] = array( + $exceptions = []; + foreach (array_merge([$this], $this->getAllPrevious()) as $exception) { + $exceptions[] = [ 'message' => $exception->getMessage(), 'class' => $exception->getClass(), 'trace' => $exception->getTrace(), - ); + ]; } return $exceptions; @@ -164,7 +164,7 @@ public function setPrevious(self $previous) public function getAllPrevious() { - $exceptions = array(); + $exceptions = []; $e = $this; while ($e = $e->getPrevious()) { $exceptions[] = $e; @@ -185,8 +185,8 @@ public function setTraceFromException(\Exception $exception) public function setTrace($trace, $file, $line) { - $this->trace = array(); - $this->trace[] = array( + $this->trace = []; + $this->trace[] = [ 'namespace' => '', 'short_class' => '', 'class' => '', @@ -194,8 +194,8 @@ public function setTrace($trace, $file, $line) 'function' => '', 'file' => $file, 'line' => $line, - 'args' => array(), - ); + 'args' => [], + ]; foreach ($trace as $entry) { $class = ''; $namespace = ''; @@ -205,7 +205,7 @@ public function setTrace($trace, $file, $line) $namespace = implode('\\', $parts); } - $this->trace[] = array( + $this->trace[] = [ 'namespace' => $namespace, 'short_class' => $class, 'class' => isset($entry['class']) ? $entry['class'] : '', @@ -213,41 +213,41 @@ public function setTrace($trace, $file, $line) 'function' => isset($entry['function']) ? $entry['function'] : null, 'file' => isset($entry['file']) ? $entry['file'] : null, 'line' => isset($entry['line']) ? $entry['line'] : null, - 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(), - ); + 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [], + ]; } } private function flattenArgs($args, $level = 0, &$count = 0) { - $result = array(); + $result = []; foreach ($args as $key => $value) { if (++$count > 1e4) { - return array('array', '*SKIPPED over 10000 entries*'); + return ['array', '*SKIPPED over 10000 entries*']; } if ($value instanceof \__PHP_Incomplete_Class) { // is_object() returns false on PHP<=7.1 - $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value)); + $result[$key] = ['incomplete-object', $this->getClassNameFromIncomplete($value)]; } elseif (\is_object($value)) { - $result[$key] = array('object', \get_class($value)); + $result[$key] = ['object', \get_class($value)]; } elseif (\is_array($value)) { if ($level > 10) { - $result[$key] = array('array', '*DEEP NESTED ARRAY*'); + $result[$key] = ['array', '*DEEP NESTED ARRAY*']; } else { - $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count)); + $result[$key] = ['array', $this->flattenArgs($value, $level + 1, $count)]; } } elseif (null === $value) { - $result[$key] = array('null', null); + $result[$key] = ['null', null]; } elseif (\is_bool($value)) { - $result[$key] = array('boolean', $value); + $result[$key] = ['boolean', $value]; } elseif (\is_int($value)) { - $result[$key] = array('integer', $value); + $result[$key] = ['integer', $value]; } elseif (\is_float($value)) { - $result[$key] = array('float', $value); + $result[$key] = ['float', $value]; } elseif (\is_resource($value)) { - $result[$key] = array('resource', get_resource_type($value)); + $result[$key] = ['resource', get_resource_type($value)]; } else { - $result[$key] = array('string', (string) $value); + $result[$key] = ['string', (string) $value]; } } diff --git a/vendor/symfony/debug/Exception/SilencedErrorContext.php b/vendor/symfony/debug/Exception/SilencedErrorContext.php index 4be83491b9df73b5358f62b9fcf5e5015332a504..f862b74f45d7f6f97453b6ba4b91cc0cab6a63c7 100644 --- a/vendor/symfony/debug/Exception/SilencedErrorContext.php +++ b/vendor/symfony/debug/Exception/SilencedErrorContext.php @@ -25,7 +25,7 @@ class SilencedErrorContext implements \JsonSerializable private $line; private $trace; - public function __construct($severity, $file, $line, array $trace = array(), $count = 1) + public function __construct($severity, $file, $line, array $trace = [], $count = 1) { $this->severity = $severity; $this->file = $file; @@ -56,12 +56,12 @@ public function getTrace() public function JsonSerialize() { - return array( + return [ 'severity' => $this->severity, 'file' => $this->file, 'line' => $this->line, 'trace' => $this->trace, 'count' => $this->count, - ); + ]; } } diff --git a/vendor/symfony/debug/ExceptionHandler.php b/vendor/symfony/debug/ExceptionHandler.php index f18ee2a9f0923e44a8d6134c834cb01b447ecd60..2f3d56601271c6e7d1ee72888855cb1a57d0515b 100644 --- a/vendor/symfony/debug/ExceptionHandler.php +++ b/vendor/symfony/debug/ExceptionHandler.php @@ -56,10 +56,10 @@ public static function register($debug = true, $charset = null, $fileLinkFormat { $handler = new static($debug, $charset, $fileLinkFormat); - $prev = set_exception_handler(array($handler, 'handle')); + $prev = set_exception_handler([$handler, 'handle']); if (\is_array($prev) && $prev[0] instanceof ErrorHandler) { restore_exception_handler(); - $prev[0]->setExceptionHandler(array($handler, 'handle')); + $prev[0]->setExceptionHandler([$handler, 'handle']); } return $handler; @@ -377,7 +377,7 @@ private function formatPath($path, $line) if (\is_string($fmt)) { $i = strpos($f = $fmt, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f); - $fmt = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); + $fmt = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); for ($i = 1; isset($fmt[$i]); ++$i) { if (0 === strpos($path, $k = $fmt[$i++])) { @@ -386,7 +386,7 @@ private function formatPath($path, $line) } } - $link = strtr($fmt[0], array('%f' => $path, '%l' => $line)); + $link = strtr($fmt[0], ['%f' => $path, '%l' => $line]); } else { $link = $fmt->format($path, $line); } @@ -403,7 +403,7 @@ private function formatPath($path, $line) */ private function formatArgs(array $args) { - $result = array(); + $result = []; foreach ($args as $key => $item) { if ('object' === $item[0]) { $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1])); diff --git a/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php index 2b59c14692f43a92b88e1bea4e5c76738d32a30b..1ac18ac8f5657b66ecc5f9e6d5db9626224910c8 100644 --- a/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ b/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php @@ -40,7 +40,7 @@ public function handleError(array $error, FatalErrorException $exception) return; } - foreach (array('class', 'interface', 'trait') as $typeName) { + foreach (['class', 'interface', 'trait'] as $typeName) { $prefix = ucfirst($typeName).' \''; $prefixLen = \strlen($prefix); if (0 !== strpos($error['message'], $prefix)) { @@ -86,11 +86,11 @@ public function handleError(array $error, FatalErrorException $exception) private function getClassCandidates($class) { if (!\is_array($functions = spl_autoload_functions())) { - return array(); + return []; } // find Symfony and Composer autoloaders - $classes = array(); + $classes = []; foreach ($functions as $function) { if (!\is_array($function)) { @@ -134,10 +134,10 @@ private function getClassCandidates($class) private function findClassInPath($path, $class, $prefix) { if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) { - return array(); + return []; } - $classes = array(); + $classes = []; $filename = $class.'.php'; foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) { @@ -157,9 +157,9 @@ private function findClassInPath($path, $class, $prefix) */ private function convertFileToClass($path, $file, $prefix) { - $candidates = array( + $candidates = [ // namespaced class - $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file), + $namespacedClass = str_replace([$path.\DIRECTORY_SEPARATOR, '.php', '/'], ['', '', '\\'], $file), // namespaced class (with target dir) $prefix.$namespacedClass, // namespaced class (with target dir and separator) @@ -170,7 +170,7 @@ private function convertFileToClass($path, $file, $prefix) str_replace('\\', '_', $prefix.$namespacedClass), // PEAR class (with target dir and separator) str_replace('\\', '_', $prefix.'\\'.$namespacedClass), - ); + ]; if ($prefix) { $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); }); diff --git a/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php index db2418037748b773929ac6c4413ee82e6ddf93bd..9eddeba5a64a30963c46c2243a88676067e5b41a 100644 --- a/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php +++ b/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php @@ -53,7 +53,7 @@ public function handleError(array $error, FatalErrorException $exception) $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName); } - $candidates = array(); + $candidates = []; foreach (get_defined_functions() as $type => $definedFunctionNames) { foreach ($definedFunctionNames as $definedFunctionName) { if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) { diff --git a/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php index 618a2c208b71b4ab333df0409140ed12203fae5b..1318cb13baf8cc905772352b9510e198a59ce85c 100644 --- a/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php +++ b/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php @@ -41,7 +41,7 @@ public function handleError(array $error, FatalErrorException $exception) return new UndefinedMethodException($message, $exception); } - $candidates = array(); + $candidates = []; foreach ($methods as $definedMethodName) { $lev = levenshtein($methodName, $definedMethodName); if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) { diff --git a/vendor/symfony/debug/LICENSE b/vendor/symfony/debug/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/debug/LICENSE +++ b/vendor/symfony/debug/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/debug/Resources/ext/README.md b/vendor/symfony/debug/Resources/ext/README.md index 25dccf07664704efe155f18faea23e28d74b7aac..2df00ecd29971348b8e063f5a9d0f18f322c82a2 100644 --- a/vendor/symfony/debug/Resources/ext/README.md +++ b/vendor/symfony/debug/Resources/ext/README.md @@ -25,41 +25,41 @@ function symfony_zval_info($key, $array, $options = 0) return null; } - $info = array( + $info = [ 'type' => gettype($array[$key]), 'zval_hash' => /* hashed memory address of $array[$key] */, 'zval_refcount' => /* internal zval refcount of $array[$key] */, 'zval_isref' => /* is_ref status of $array[$key] */, - ); + ]; switch ($info['type']) { case 'object': - $info += array( + $info += [ 'object_class' => get_class($array[$key]), 'object_refcount' => /* internal object refcount of $array[$key] */, 'object_hash' => spl_object_hash($array[$key]), 'object_handle' => /* internal object handle $array[$key] */, - ); + ]; break; case 'resource': - $info += array( + $info += [ 'resource_handle' => (int) $array[$key], 'resource_type' => get_resource_type($array[$key]), 'resource_refcount' => /* internal resource refcount of $array[$key] */, - ); + ]; break; case 'array': - $info += array( + $info += [ 'array_count' => count($array[$key]), - ); + ]; break; case 'string': - $info += array( + $info += [ 'strlen' => strlen($array[$key]), - ); + ]; break; } diff --git a/vendor/symfony/debug/Resources/ext/tests/001.phpt b/vendor/symfony/debug/Resources/ext/tests/001.phpt index 4a87cd3180b03ab36b275fc0be9392adc86bed98..86a9427c72f158b2b7c39e91b87dc42b3c3b8b88 100644 --- a/vendor/symfony/debug/Resources/ext/tests/001.phpt +++ b/vendor/symfony/debug/Resources/ext/tests/001.phpt @@ -11,7 +11,7 @@ $int = 42; $float = 42.42; $str = 'foobar'; $object = new StdClass(); -$array = array('foo', 'bar'); +$array = ['foo', 'bar']; $resource = tmpfile(); $null = null; $bool = true; @@ -19,7 +19,7 @@ $bool = true; $anotherint = 42; $refcount2 = &$anotherint; -$var = array( +$var = [ 'int' => $int, 'float' => $float, 'str' => $str, @@ -29,7 +29,7 @@ $var = array( 'null' => $null, 'bool' => $bool, 'refcount' => &$refcount2, -); +]; var_dump(symfony_zval_info('int', $var)); var_dump(symfony_zval_info('float', $var)); diff --git a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php index 0219f5335086990e8203c83d0ee8a94907733348..c6bc3f7d88b5e3717b21621d126b25bc2bab40ca 100644 --- a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php +++ b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php @@ -28,14 +28,14 @@ protected function setUp() { $this->errorReporting = error_reporting(E_ALL); $this->loader = new ClassLoader(); - spl_autoload_register(array($this->loader, 'loadClass'), true, true); + spl_autoload_register([$this->loader, 'loadClass'], true, true); DebugClassLoader::enable(); } protected function tearDown() { DebugClassLoader::disable(); - spl_autoload_unregister(array($this->loader, 'loadClass')); + spl_autoload_unregister([$this->loader, 'loadClass']); error_reporting($this->errorReporting); } @@ -45,7 +45,7 @@ public function testIdempotence() $functions = spl_autoload_functions(); foreach ($functions as $function) { - if (is_array($function) && $function[0] instanceof DebugClassLoader) { + if (\is_array($function) && $function[0] instanceof DebugClassLoader) { $reflClass = new \ReflectionClass($function[0]); $reflProp = $reflClass->getProperty('classLoader'); $reflProp->setAccessible(true); @@ -81,7 +81,7 @@ public function testUnsilencing() if (\PHP_VERSION_ID >= 70000) { $this->markTestSkipped('PHP7 throws exceptions, unsilencing is not required anymore.'); } - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('HHVM is not handled in this test case.'); } @@ -106,7 +106,7 @@ public function testStacking() if (class_exists('Symfony\Component\Debug\Exception\ContextErrorException', false)) { $this->markTestSkipped('The ContextErrorException class is already loaded.'); } - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('HHVM is not handled in this test case.'); } @@ -192,7 +192,7 @@ public function testDeprecatedSuper($class, $super, $type) { set_error_handler(function () { return false; }); $e = error_reporting(0); - trigger_error('', E_USER_DEPRECATED); + @trigger_error('', E_USER_DEPRECATED); class_exists('Test\\'.__NAMESPACE__.'\\'.$class, true); @@ -202,20 +202,20 @@ class_exists('Test\\'.__NAMESPACE__.'\\'.$class, true); $lastError = error_get_last(); unset($lastError['file'], $lastError['line']); - $xError = array( + $xError = [ 'type' => E_USER_DEPRECATED, 'message' => 'The "Test\Symfony\Component\Debug\Tests\\'.$class.'" class '.$type.' "Symfony\Component\Debug\Tests\Fixtures\\'.$super.'" that is deprecated but this is a test deprecation notice.', - ); + ]; $this->assertSame($xError, $lastError); } public function provideDeprecatedSuper() { - return array( - array('DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'), - array('DeprecatedParentClass', 'DeprecatedClass', 'extends'), - ); + return [ + ['DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'], + ['DeprecatedParentClass', 'DeprecatedClass', 'extends'], + ]; } public function testInterfaceExtendsDeprecatedInterface() @@ -232,10 +232,10 @@ class_exists('Test\\'.__NAMESPACE__.'\\NonDeprecatedInterfaceClass', true); $lastError = error_get_last(); unset($lastError['file'], $lastError['line']); - $xError = array( + $xError = [ 'type' => E_USER_NOTICE, 'message' => '', - ); + ]; $this->assertSame($xError, $lastError); } @@ -254,10 +254,10 @@ class_exists('Symfony\Bridge\Debug\Tests\Fixtures\ExtendsDeprecatedParent', true $lastError = error_get_last(); unset($lastError['file'], $lastError['line']); - $xError = array( + $xError = [ 'type' => E_USER_NOTICE, 'message' => '', - ); + ]; $this->assertSame($xError, $lastError); } @@ -280,56 +280,60 @@ class_exists('Test\\'.__NAMESPACE__.'\\Float', true); $lastError = error_get_last(); unset($lastError['file'], $lastError['line']); - $xError = array( + $xError = [ 'type' => E_USER_DEPRECATED, 'message' => 'The "Test\Symfony\Component\Debug\Tests\Float" class uses the reserved name "Float", it will break on PHP 7 and higher', - ); + ]; $this->assertSame($xError, $lastError); } public function testExtendedFinalClass() { - set_error_handler(function () { return false; }); - $e = error_reporting(0); - trigger_error('', E_USER_NOTICE); + $deprecations = []; + set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); + $e = error_reporting(E_USER_DEPRECATED); - class_exists('Test\\'.__NAMESPACE__.'\\ExtendsFinalClass', true); + require __DIR__.'/Fixtures/FinalClasses.php'; + + $i = 1; + while (class_exists($finalClass = __NAMESPACE__.'\\Fixtures\\FinalClass'.$i++, false)) { + spl_autoload_call($finalClass); + class_exists('Test\\'.__NAMESPACE__.'\\Extends'.substr($finalClass, strrpos($finalClass, '\\') + 1), true); + } error_reporting($e); restore_error_handler(); - $lastError = error_get_last(); - unset($lastError['file'], $lastError['line']); - - $xError = array( - 'type' => E_USER_DEPRECATED, - 'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass" class is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass".', - ); - - $this->assertSame($xError, $lastError); + $this->assertSame([ + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass1" class is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass1".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass2" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass2".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass3" class is considered final comment with @@@ and ***. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass3".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass4" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass4".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass5" class is considered final multiline comment. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass5".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass6" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass6".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass7" class is considered final another multiline comment... It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass7".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass8" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass8".', + ], $deprecations); } public function testExtendedFinalMethod() { - set_error_handler(function () { return false; }); - $e = error_reporting(0); - trigger_error('', E_USER_NOTICE); + $deprecations = []; + set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); + $e = error_reporting(E_USER_DEPRECATED); class_exists(__NAMESPACE__.'\\Fixtures\\ExtendedFinalMethod', true); error_reporting($e); restore_error_handler(); - $lastError = error_get_last(); - unset($lastError['file'], $lastError['line']); - - $xError = array( - 'type' => E_USER_DEPRECATED, - 'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".', - ); + $xError = [ + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod2()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".', + ]; - $this->assertSame($xError, $lastError); + $this->assertSame($xError, $deprecations); } public function testExtendedDeprecatedMethodDoesntTriggerAnyNotice() @@ -346,12 +350,12 @@ class_exists('Test\\'.__NAMESPACE__.'\\ExtendsAnnotatedClass', true); $lastError = error_get_last(); unset($lastError['file'], $lastError['line']); - $this->assertSame(array('type' => E_USER_NOTICE, 'message' => ''), $lastError); + $this->assertSame(['type' => E_USER_NOTICE, 'message' => ''], $lastError); } public function testInternalsUse() { - $deprecations = array(); + $deprecations = []; set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); $e = error_reporting(E_USER_DEPRECATED); @@ -360,12 +364,31 @@ class_exists('Test\\'.__NAMESPACE__.'\\ExtendsInternals', true); error_reporting($e); restore_error_handler(); - $this->assertSame($deprecations, array( - 'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal since version 3.4. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".', + $this->assertSame($deprecations, [ 'The "Symfony\Component\Debug\Tests\Fixtures\InternalInterface" interface is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".', + 'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal since version 3.4. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".', 'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait" trait is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".', - 'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait2::internalMethod()" method is considered internal since version 3.4. It may change without further notice. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".', - )); + 'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass::internalMethod()" method is considered internal since version 3.4. It may change without further notice. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".', + ]); + } + + public function testUseTraitWithInternalMethod() + { + $deprecations = []; + set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); + $e = error_reporting(E_USER_DEPRECATED); + + class_exists('Test\\'.__NAMESPACE__.'\\UseTraitWithInternalMethod', true); + + error_reporting($e); + restore_error_handler(); + + $this->assertSame([], $deprecations); + } + + public function testEvaluatedCode() + { + $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\DefinitionInEvaluatedCode', true)); } } @@ -377,12 +400,12 @@ public function loadClass($class) public function getClassMap() { - return array(__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php'); + return [__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php']; } public function findFile($class) { - $fixtureDir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR; + $fixtureDir = __DIR__.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR; if (__NAMESPACE__.'\TestingUnsilencing' === $class) { eval('-- parse error --'); @@ -391,7 +414,7 @@ public function findFile($class) } elseif (__NAMESPACE__.'\TestingCaseMismatch' === $class) { eval('namespace '.__NAMESPACE__.'; class TestingCaseMisMatch {}'); } elseif (__NAMESPACE__.'\Fixtures\Psr4CaseMismatch' === $class) { - return $fixtureDir.'psr4'.DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php'; + return $fixtureDir.'psr4'.\DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php'; } elseif (__NAMESPACE__.'\Fixtures\NotPSR0' === $class) { return $fixtureDir.'reallyNotPsr0.php'; } elseif (__NAMESPACE__.'\Fixtures\NotPSR0bis' === $class) { @@ -406,8 +429,9 @@ public function findFile($class) eval('namespace Test\\'.__NAMESPACE__.'; class NonDeprecatedInterfaceClass implements \\'.__NAMESPACE__.'\Fixtures\NonDeprecatedInterface {}'); } elseif ('Test\\'.__NAMESPACE__.'\Float' === $class) { eval('namespace Test\\'.__NAMESPACE__.'; class Float {}'); - } elseif ('Test\\'.__NAMESPACE__.'\ExtendsFinalClass' === $class) { - eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsFinalClass extends \\'.__NAMESPACE__.'\Fixtures\FinalClass {}'); + } elseif (0 === strpos($class, 'Test\\'.__NAMESPACE__.'\ExtendsFinalClass')) { + $classShortName = substr($class, strrpos($class, '\\') + 1); + eval('namespace Test\\'.__NAMESPACE__.'; class '.$classShortName.' extends \\'.__NAMESPACE__.'\Fixtures\\'.substr($classShortName, 7).' {}'); } elseif ('Test\\'.__NAMESPACE__.'\ExtendsAnnotatedClass' === $class) { eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsAnnotatedClass extends \\'.__NAMESPACE__.'\Fixtures\AnnotatedClass { public function deprecatedMethod() { } @@ -420,6 +444,8 @@ public function internalMethod() { } }'); } elseif ('Test\\'.__NAMESPACE__.'\ExtendsInternalsParent' === $class) { eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsInternalsParent extends \\'.__NAMESPACE__.'\Fixtures\InternalClass implements \\'.__NAMESPACE__.'\Fixtures\InternalInterface { }'); + } elseif ('Test\\'.__NAMESPACE__.'\UseTraitWithInternalMethod' === $class) { + eval('namespace Test\\'.__NAMESPACE__.'; class UseTraitWithInternalMethod { use \\'.__NAMESPACE__.'\Fixtures\TraitWithInternalMethod; }'); } } } diff --git a/vendor/symfony/debug/Tests/ErrorHandlerTest.php b/vendor/symfony/debug/Tests/ErrorHandlerTest.php index a8d40e849b6d95af9301f97d64b22539098970b3..c1dea75bbd90ee349b824c82b4446c85eca5f723 100644 --- a/vendor/symfony/debug/Tests/ErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/ErrorHandlerTest.php @@ -13,9 +13,12 @@ use PHPUnit\Framework\TestCase; use Psr\Log\LogLevel; +use Psr\Log\NullLogger; use Symfony\Component\Debug\BufferingLogger; use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\Exception\SilencedErrorContext; +use Symfony\Component\Debug\Tests\Fixtures\ErrorHandlerThatUsesThePreviousOne; +use Symfony\Component\Debug\Tests\Fixtures\LoggerThatSetAnErrorHandler; /** * ErrorHandlerTest. @@ -38,13 +41,13 @@ public function testRegister() $this->assertSame($handler, ErrorHandler::register($newHandler, false)); $h = set_error_handler('var_dump'); restore_error_handler(); - $this->assertSame(array($handler, 'handleError'), $h); + $this->assertSame([$handler, 'handleError'], $h); try { $this->assertSame($newHandler, ErrorHandler::register($newHandler, true)); $h = set_error_handler('var_dump'); restore_error_handler(); - $this->assertSame(array($newHandler, 'handleError'), $h); + $this->assertSame([$newHandler, 'handleError'], $h); } catch (\Exception $e) { } @@ -74,12 +77,12 @@ public function testErrorGetLast() try { @trigger_error('Hello', E_USER_WARNING); - $expected = array( + $expected = [ 'type' => E_USER_WARNING, 'message' => 'Hello', 'file' => __FILE__, 'line' => __LINE__ - 5, - ); + ]; $this->assertSame($expected, error_get_last()); } catch (\Exception $e) { restore_error_handler(); @@ -145,26 +148,26 @@ public function testDefaultLogger() $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $handler->setDefaultLogger($logger, E_NOTICE); - $handler->setDefaultLogger($logger, array(E_USER_NOTICE => LogLevel::CRITICAL)); - - $loggers = array( - E_DEPRECATED => array(null, LogLevel::INFO), - E_USER_DEPRECATED => array(null, LogLevel::INFO), - E_NOTICE => array($logger, LogLevel::WARNING), - E_USER_NOTICE => array($logger, LogLevel::CRITICAL), - E_STRICT => array(null, LogLevel::WARNING), - E_WARNING => array(null, LogLevel::WARNING), - E_USER_WARNING => array(null, LogLevel::WARNING), - E_COMPILE_WARNING => array(null, LogLevel::WARNING), - E_CORE_WARNING => array(null, LogLevel::WARNING), - E_USER_ERROR => array(null, LogLevel::CRITICAL), - E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL), - E_COMPILE_ERROR => array(null, LogLevel::CRITICAL), - E_PARSE => array(null, LogLevel::CRITICAL), - E_ERROR => array(null, LogLevel::CRITICAL), - E_CORE_ERROR => array(null, LogLevel::CRITICAL), - ); - $this->assertSame($loggers, $handler->setLoggers(array())); + $handler->setDefaultLogger($logger, [E_USER_NOTICE => LogLevel::CRITICAL]); + + $loggers = [ + E_DEPRECATED => [null, LogLevel::INFO], + E_USER_DEPRECATED => [null, LogLevel::INFO], + E_NOTICE => [$logger, LogLevel::WARNING], + E_USER_NOTICE => [$logger, LogLevel::CRITICAL], + E_STRICT => [null, LogLevel::WARNING], + E_WARNING => [null, LogLevel::WARNING], + E_USER_WARNING => [null, LogLevel::WARNING], + E_COMPILE_WARNING => [null, LogLevel::WARNING], + E_CORE_WARNING => [null, LogLevel::WARNING], + E_USER_ERROR => [null, LogLevel::CRITICAL], + E_RECOVERABLE_ERROR => [null, LogLevel::CRITICAL], + E_COMPILE_ERROR => [null, LogLevel::CRITICAL], + E_PARSE => [null, LogLevel::CRITICAL], + E_ERROR => [null, LogLevel::CRITICAL], + E_CORE_ERROR => [null, LogLevel::CRITICAL], + ]; + $this->assertSame($loggers, $handler->setLoggers([])); } finally { restore_error_handler(); restore_exception_handler(); @@ -176,14 +179,14 @@ public function testHandleError() try { $handler = ErrorHandler::register(); $handler->throwAt(0, true); - $this->assertFalse($handler->handleError(0, 'foo', 'foo.php', 12, array())); + $this->assertFalse($handler->handleError(0, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); $handler = ErrorHandler::register(); $handler->throwAt(3, true); - $this->assertFalse($handler->handleError(4, 'foo', 'foo.php', 12, array())); + $this->assertFalse($handler->handleError(4, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); @@ -191,7 +194,7 @@ public function testHandleError() $handler = ErrorHandler::register(); $handler->throwAt(3, true); try { - $handler->handleError(4, 'foo', 'foo.php', 12, array()); + $handler->handleError(4, 'foo', 'foo.php', 12, []); } catch (\ErrorException $e) { $this->assertSame('Parse Error: foo', $e->getMessage()); $this->assertSame(4, $e->getSeverity()); @@ -204,14 +207,14 @@ public function testHandleError() $handler = ErrorHandler::register(); $handler->throwAt(E_USER_DEPRECATED, true); - $this->assertFalse($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array())); + $this->assertFalse($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); $handler = ErrorHandler::register(); $handler->throwAt(E_DEPRECATED, true); - $this->assertFalse($handler->handleError(E_DEPRECATED, 'foo', 'foo.php', 12, array())); + $this->assertFalse($handler->handleError(E_DEPRECATED, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); @@ -236,7 +239,7 @@ public function testHandleError() $handler = ErrorHandler::register(); $handler->setDefaultLogger($logger, E_USER_DEPRECATED); - $this->assertTrue($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array())); + $this->assertTrue($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); @@ -320,7 +323,9 @@ public function testHandleDeprecation() $handler = new ErrorHandler(); $handler->setDefaultLogger($logger); - @$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, array()); + @$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, []); + + restore_error_handler(); } /** @@ -382,12 +387,12 @@ public function testErrorStacking() ->expects($this->exactly(2)) ->method('log') ->withConsecutive( - array($this->equalTo(LogLevel::WARNING), $this->equalTo('Dummy log')), - array($this->equalTo(LogLevel::DEBUG), $this->equalTo('User Warning: Silenced warning')) + [$this->equalTo(LogLevel::WARNING), $this->equalTo('Dummy log')], + [$this->equalTo(LogLevel::DEBUG), $this->equalTo('User Warning: Silenced warning')] ) ; - $handler->setDefaultLogger($logger, array(E_USER_WARNING => LogLevel::WARNING)); + $handler->setDefaultLogger($logger, [E_USER_WARNING => LogLevel::WARNING]); ErrorHandler::stackErrors(); @trigger_error('Silenced warning', E_USER_WARNING); @@ -404,27 +409,27 @@ public function testBootstrappingLogger() $bootLogger = new BufferingLogger(); $handler = new ErrorHandler($bootLogger); - $loggers = array( - E_DEPRECATED => array($bootLogger, LogLevel::INFO), - E_USER_DEPRECATED => array($bootLogger, LogLevel::INFO), - E_NOTICE => array($bootLogger, LogLevel::WARNING), - E_USER_NOTICE => array($bootLogger, LogLevel::WARNING), - E_STRICT => array($bootLogger, LogLevel::WARNING), - E_WARNING => array($bootLogger, LogLevel::WARNING), - E_USER_WARNING => array($bootLogger, LogLevel::WARNING), - E_COMPILE_WARNING => array($bootLogger, LogLevel::WARNING), - E_CORE_WARNING => array($bootLogger, LogLevel::WARNING), - E_USER_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_RECOVERABLE_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_COMPILE_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_PARSE => array($bootLogger, LogLevel::CRITICAL), - E_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_CORE_ERROR => array($bootLogger, LogLevel::CRITICAL), - ); - - $this->assertSame($loggers, $handler->setLoggers(array())); - - $handler->handleError(E_DEPRECATED, 'Foo message', __FILE__, 123, array()); + $loggers = [ + E_DEPRECATED => [$bootLogger, LogLevel::INFO], + E_USER_DEPRECATED => [$bootLogger, LogLevel::INFO], + E_NOTICE => [$bootLogger, LogLevel::WARNING], + E_USER_NOTICE => [$bootLogger, LogLevel::WARNING], + E_STRICT => [$bootLogger, LogLevel::WARNING], + E_WARNING => [$bootLogger, LogLevel::WARNING], + E_USER_WARNING => [$bootLogger, LogLevel::WARNING], + E_COMPILE_WARNING => [$bootLogger, LogLevel::WARNING], + E_CORE_WARNING => [$bootLogger, LogLevel::WARNING], + E_USER_ERROR => [$bootLogger, LogLevel::CRITICAL], + E_RECOVERABLE_ERROR => [$bootLogger, LogLevel::CRITICAL], + E_COMPILE_ERROR => [$bootLogger, LogLevel::CRITICAL], + E_PARSE => [$bootLogger, LogLevel::CRITICAL], + E_ERROR => [$bootLogger, LogLevel::CRITICAL], + E_CORE_ERROR => [$bootLogger, LogLevel::CRITICAL], + ]; + + $this->assertSame($loggers, $handler->setLoggers([])); + + $handler->handleError(E_DEPRECATED, 'Foo message', __FILE__, 123, []); $logs = $bootLogger->cleanLogs(); @@ -440,14 +445,14 @@ public function testBootstrappingLogger() $this->assertSame(123, $exception->getLine()); $this->assertSame(E_DEPRECATED, $exception->getSeverity()); - $bootLogger->log(LogLevel::WARNING, 'Foo message', array('exception' => $exception)); + $bootLogger->log(LogLevel::WARNING, 'Foo message', ['exception' => $exception]); $mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $mockLogger->expects($this->once()) ->method('log') - ->with(LogLevel::WARNING, 'Foo message', array('exception' => $exception)); + ->with(LogLevel::WARNING, 'Foo message', ['exception' => $exception]); - $handler->setLoggers(array(E_DEPRECATED => array($mockLogger, LogLevel::WARNING))); + $handler->setLoggers([E_DEPRECATED => [$mockLogger, LogLevel::WARNING]]); } /** @@ -463,7 +468,7 @@ public function testSettingLoggerWhenExceptionIsBuffered() $mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $mockLogger->expects($this->once()) ->method('log') - ->with(LogLevel::CRITICAL, 'Uncaught Exception: Foo message', array('exception' => $exception)); + ->with(LogLevel::CRITICAL, 'Uncaught Exception: Foo message', ['exception' => $exception]); $handler->setExceptionHandler(function () use ($handler, $mockLogger) { $handler->setDefaultLogger($mockLogger); @@ -480,12 +485,12 @@ public function testHandleFatalError() try { $handler = ErrorHandler::register(); - $error = array( + $error = [ 'type' => E_PARSE, 'message' => 'foo', 'file' => 'bar', 'line' => 123, - ); + ]; $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); @@ -553,16 +558,16 @@ public function testHandleFatalErrorOnHHVM() $handler->setDefaultLogger($logger, E_ERROR); - $error = array( + $error = [ 'type' => E_ERROR + 0x1000000, // This error level is used by HHVM for fatal errors 'message' => 'foo', 'file' => 'bar', 'line' => 123, - 'context' => array(123), - 'backtrace' => array(456), - ); + 'context' => [123], + 'backtrace' => [456], + ]; - \call_user_func_array(array($handler, 'handleError'), $error); + \call_user_func_array([$handler, 'handleError'], $error); $handler->handleFatalError($error); } finally { restore_error_handler(); @@ -583,4 +588,58 @@ public function testCustomExceptionHandler() $handler->handleException(new \Exception()); } + + /** + * @dataProvider errorHandlerWhenLoggingProvider + */ + public function testErrorHandlerWhenLogging($previousHandlerWasDefined, $loggerSetsAnotherHandler, $nextHandlerIsDefined) + { + try { + if ($previousHandlerWasDefined) { + set_error_handler('count'); + } + + $logger = $loggerSetsAnotherHandler ? new LoggerThatSetAnErrorHandler() : new NullLogger(); + + $handler = ErrorHandler::register(); + $handler->setDefaultLogger($logger); + + if ($nextHandlerIsDefined) { + $handler = ErrorHandlerThatUsesThePreviousOne::register(); + } + + @trigger_error('foo', E_USER_DEPRECATED); + @trigger_error('bar', E_USER_DEPRECATED); + + $this->assertSame([$handler, 'handleError'], set_error_handler('var_dump')); + + if ($logger instanceof LoggerThatSetAnErrorHandler) { + $this->assertCount(2, $logger->cleanLogs()); + } + + restore_error_handler(); + + if ($previousHandlerWasDefined) { + restore_error_handler(); + } + + if ($nextHandlerIsDefined) { + restore_error_handler(); + } + } finally { + restore_error_handler(); + restore_exception_handler(); + } + } + + public function errorHandlerWhenLoggingProvider() + { + foreach ([false, true] as $previousHandlerWasDefined) { + foreach ([false, true] as $loggerSetsAnotherHandler) { + foreach ([false, true] as $nextHandlerIsDefined) { + yield [$previousHandlerWasDefined, $loggerSetsAnotherHandler, $nextHandlerIsDefined]; + } + } + } + } } diff --git a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php index ce9f355530e67d022633e10fc653e5366cb73dd7..f755a78cfcb5280c4ac7f467c04b35bbbc627051 100644 --- a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php +++ b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php @@ -54,7 +54,7 @@ public function testStatusCode() $flattened = FlattenException::create(new ConflictHttpException()); $this->assertEquals('409', $flattened->getStatusCode()); - $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST'))); + $flattened = FlattenException::create(new MethodNotAllowedHttpException(['POST'])); $this->assertEquals('405', $flattened->getStatusCode()); $flattened = FlattenException::create(new AccessDeniedHttpException()); @@ -89,23 +89,23 @@ public function testStatusCode() public function testHeadersForHttpException() { - $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST'))); - $this->assertEquals(array('Allow' => 'POST'), $flattened->getHeaders()); + $flattened = FlattenException::create(new MethodNotAllowedHttpException(['POST'])); + $this->assertEquals(['Allow' => 'POST'], $flattened->getHeaders()); $flattened = FlattenException::create(new UnauthorizedHttpException('Basic realm="My Realm"')); - $this->assertEquals(array('WWW-Authenticate' => 'Basic realm="My Realm"'), $flattened->getHeaders()); + $this->assertEquals(['WWW-Authenticate' => 'Basic realm="My Realm"'], $flattened->getHeaders()); $flattened = FlattenException::create(new ServiceUnavailableHttpException('Fri, 31 Dec 1999 23:59:59 GMT')); - $this->assertEquals(array('Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'), $flattened->getHeaders()); + $this->assertEquals(['Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'], $flattened->getHeaders()); $flattened = FlattenException::create(new ServiceUnavailableHttpException(120)); - $this->assertEquals(array('Retry-After' => 120), $flattened->getHeaders()); + $this->assertEquals(['Retry-After' => 120], $flattened->getHeaders()); $flattened = FlattenException::create(new TooManyRequestsHttpException('Fri, 31 Dec 1999 23:59:59 GMT')); - $this->assertEquals(array('Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'), $flattened->getHeaders()); + $this->assertEquals(['Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'], $flattened->getHeaders()); $flattened = FlattenException::create(new TooManyRequestsHttpException(120)); - $this->assertEquals(array('Retry-After' => 120), $flattened->getHeaders()); + $this->assertEquals(['Retry-After' => 120], $flattened->getHeaders()); } /** @@ -135,7 +135,7 @@ public function testPrevious(\Exception $exception) $this->assertSame($flattened2, $flattened->getPrevious()); - $this->assertSame(array($flattened2), $flattened->getAllPrevious()); + $this->assertSame([$flattened2], $flattened->getAllPrevious()); } /** @@ -176,25 +176,25 @@ public function testFile(\Exception $exception) public function testToArray(\Exception $exception) { $flattened = FlattenException::create($exception); - $flattened->setTrace(array(), 'foo.php', 123); + $flattened->setTrace([], 'foo.php', 123); - $this->assertEquals(array( - array( + $this->assertEquals([ + [ 'message' => 'test', 'class' => 'Exception', - 'trace' => array(array( + 'trace' => [[ 'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => '', 'file' => 'foo.php', 'line' => 123, - 'args' => array(), - )), - ), - ), $flattened->toArray()); + 'args' => [], + ]], + ], + ], $flattened->toArray()); } public function flattenDataProvider() { - return array( - array(new \Exception('test', 123)), - ); + return [ + [new \Exception('test', 123)], + ]; } public function testArguments() @@ -204,15 +204,15 @@ public function testArguments() $incomplete = unserialize('O:14:"BogusTestClass":0:{}'); - $exception = $this->createException(array( - (object) array('foo' => 1), + $exception = $this->createException([ + (object) ['foo' => 1], new NotFoundHttpException(), $incomplete, $dh, $fh, function () {}, - array(1, 2), - array('foo' => 123), + [1, 2], + ['foo' => 123], null, true, false, @@ -222,7 +222,7 @@ function () {}, '', INF, NAN, - )); + ]); $flattened = FlattenException::create($exception); $trace = $flattened->getTrace(); @@ -233,26 +233,26 @@ function () {}, fclose($fh); $i = 0; - $this->assertSame(array('object', 'stdClass'), $array[$i++]); - $this->assertSame(array('object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'), $array[$i++]); - $this->assertSame(array('incomplete-object', 'BogusTestClass'), $array[$i++]); - $this->assertSame(array('resource', \defined('HHVM_VERSION') ? 'Directory' : 'stream'), $array[$i++]); - $this->assertSame(array('resource', 'stream'), $array[$i++]); + $this->assertSame(['object', 'stdClass'], $array[$i++]); + $this->assertSame(['object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'], $array[$i++]); + $this->assertSame(['incomplete-object', 'BogusTestClass'], $array[$i++]); + $this->assertSame(['resource', \defined('HHVM_VERSION') ? 'Directory' : 'stream'], $array[$i++]); + $this->assertSame(['resource', 'stream'], $array[$i++]); $args = $array[$i++]; $this->assertSame($args[0], 'object'); $this->assertTrue('Closure' === $args[1] || is_subclass_of($args[1], '\Closure'), 'Expect object class name to be Closure or a subclass of Closure.'); - $this->assertSame(array('array', array(array('integer', 1), array('integer', 2))), $array[$i++]); - $this->assertSame(array('array', array('foo' => array('integer', 123))), $array[$i++]); - $this->assertSame(array('null', null), $array[$i++]); - $this->assertSame(array('boolean', true), $array[$i++]); - $this->assertSame(array('boolean', false), $array[$i++]); - $this->assertSame(array('integer', 0), $array[$i++]); - $this->assertSame(array('float', 0.0), $array[$i++]); - $this->assertSame(array('string', '0'), $array[$i++]); - $this->assertSame(array('string', ''), $array[$i++]); - $this->assertSame(array('float', INF), $array[$i++]); + $this->assertSame(['array', [['integer', 1], ['integer', 2]]], $array[$i++]); + $this->assertSame(['array', ['foo' => ['integer', 123]]], $array[$i++]); + $this->assertSame(['null', null], $array[$i++]); + $this->assertSame(['boolean', true], $array[$i++]); + $this->assertSame(['boolean', false], $array[$i++]); + $this->assertSame(['integer', 0], $array[$i++]); + $this->assertSame(['float', 0.0], $array[$i++]); + $this->assertSame(['string', '0'], $array[$i++]); + $this->assertSame(['string', ''], $array[$i++]); + $this->assertSame(['float', INF], $array[$i++]); // assertEquals() does not like NAN values. $this->assertEquals($array[$i][0], 'float'); @@ -262,7 +262,7 @@ function () {}, public function testRecursionInArguments() { $a = null; - $a = array('foo', array(2, &$a)); + $a = ['foo', [2, &$a]]; $exception = $this->createException($a); $flattened = FlattenException::create($exception); @@ -272,7 +272,7 @@ public function testRecursionInArguments() public function testTooBigArray() { - $a = array(); + $a = []; for ($i = 0; $i < 20; ++$i) { for ($j = 0; $j < 50; ++$j) { for ($k = 0; $k < 10; ++$k) { @@ -287,7 +287,7 @@ public function testTooBigArray() $flattened = FlattenException::create($exception); $trace = $flattened->getTrace(); - $this->assertSame($trace[1]['args'][0], array('array', array('array', '*SKIPPED over 10000 entries*'))); + $this->assertSame($trace[1]['args'][0], ['array', ['array', '*SKIPPED over 10000 entries*']]); $serializeTrace = serialize($trace); diff --git a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php b/vendor/symfony/debug/Tests/ExceptionHandlerTest.php index 6ff6a74f4f99e90684ac22d33e64dbd2f42f821e..e166136cbbed4ce6efce9e85002278ba5bd232d0 100644 --- a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php +++ b/vendor/symfony/debug/Tests/ExceptionHandlerTest.php @@ -62,10 +62,10 @@ public function testStatusCode() $this->assertContains('Sorry, the page you are looking for could not be found.', $response); - $expectedHeaders = array( - array('HTTP/1.0 404', true, null), - array('Content-Type: text/html; charset=iso8859-1', true, null), - ); + $expectedHeaders = [ + ['HTTP/1.0 404', true, null], + ['Content-Type: text/html; charset=iso8859-1', true, null], + ]; $this->assertSame($expectedHeaders, testHeader()); } @@ -75,14 +75,14 @@ public function testHeaders() $handler = new ExceptionHandler(false, 'iso8859-1'); ob_start(); - $handler->sendPhpResponse(new MethodNotAllowedHttpException(array('POST'))); + $handler->sendPhpResponse(new MethodNotAllowedHttpException(['POST'])); $response = ob_get_clean(); - $expectedHeaders = array( - array('HTTP/1.0 405', true, null), - array('Allow: POST', false, null), - array('Content-Type: text/html; charset=iso8859-1', true, null), - ); + $expectedHeaders = [ + ['HTTP/1.0 405', true, null], + ['Allow: POST', false, null], + ['Content-Type: text/html; charset=iso8859-1', true, null], + ]; $this->assertSame($expectedHeaders, testHeader()); } @@ -101,7 +101,7 @@ public function testHandle() { $exception = new \Exception('foo'); - $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock(); + $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock(); $handler ->expects($this->exactly(2)) ->method('sendPhpResponse'); @@ -119,7 +119,7 @@ public function testHandleOutOfMemoryException() { $exception = new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__); - $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock(); + $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock(); $handler ->expects($this->once()) ->method('sendPhpResponse'); diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php index 5cdac2f12afc2ab355bae6d9ec038c9ae634bb98..8e615ac640be9201a1fded2d8775fceb55e84afb 100644 --- a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php @@ -72,85 +72,85 @@ public function provideClassNotFoundData() $autoloader = new ComposerClassLoader(); $autoloader->add('Symfony\Component\Debug\Exception\\', realpath(__DIR__.'/../../Exception')); - $debugClassLoader = new DebugClassLoader(array($autoloader, 'loadClass')); + $debugClassLoader = new DebugClassLoader([$autoloader, 'loadClass']); - return array( - array( - array( + return [ + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'WhizBangFactory\' not found', - ), + ], "Attempted to load class \"WhizBangFactory\" from the global namespace.\nDid you forget a \"use\" statement?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\WhizBangFactory\' not found', - ), + ], "Attempted to load class \"WhizBangFactory\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'UndefinedFunctionException\' not found', - ), + ], "Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'PEARClass\' not found', - ), + ], "Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony_Component_Debug_Tests_Fixtures_PEARClass\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), + ], "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), + ], "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - array($autoloader, 'loadClass'), - ), - array( - array( + [$autoloader, 'loadClass'], + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), + ], "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - array($debugClassLoader, 'loadClass'), - ), - array( - array( + [$debugClassLoader, 'loadClass'], + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), + ], "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?", function ($className) { /* do nothing here */ }, - ), - ); + ], + ]; } public function testCannotRedeclareClass() @@ -161,12 +161,12 @@ public function testCannotRedeclareClass() require_once __DIR__.'/../FIXTURES2/REQUIREDTWICE.PHP'; - $error = array( + $error = [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\RequiredTwice\' not found', - ); + ]; $handler = new ClassNotFoundFatalErrorHandler(); $exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line'])); diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php index 1dc2120045c2cd4a13a1c5b641453d99fe1e9420..2de44a25ef15688bbda63275bbd5b17c83ca2926 100644 --- a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php @@ -35,44 +35,44 @@ public function testUndefinedFunction($error, $translatedMessage) public function provideUndefinedFunctionData() { - return array( - array( - array( + return [ + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined function test_namespaced_function()', - ), + ], "Attempted to call function \"test_namespaced_function\" from the global namespace.\nDid you mean to call \"\\symfony\\component\\debug\\tests\\fatalerrorhandler\\test_namespaced_function\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined function Foo\\Bar\\Baz\\test_namespaced_function()', - ), + ], "Attempted to call function \"test_namespaced_function\" from namespace \"Foo\\Bar\\Baz\".\nDid you mean to call \"\\symfony\\component\\debug\\tests\\fatalerrorhandler\\test_namespaced_function\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined function foo()', - ), + ], 'Attempted to call function "foo" from the global namespace.', - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined function Foo\\Bar\\Baz\\foo()', - ), + ], 'Attempted to call function "foo" from namespace "Foo\Bar\Baz".', - ), - ); + ], + ]; } } diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php index 739e5b2b15b7ddddaf5376dfc32fc5b960202fbf..268a841351ec45990530a823f3e6de20c61af058 100644 --- a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php @@ -34,43 +34,43 @@ public function testUndefinedMethod($error, $translatedMessage) public function provideUndefinedMethodData() { - return array( - array( - array( + return [ + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined method SplObjectStorage::what()', - ), + ], 'Attempted to call an undefined method named "what" of class "SplObjectStorage".', - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined method SplObjectStorage::walid()', - ), + ], "Attempted to call an undefined method named \"walid\" of class \"SplObjectStorage\".\nDid you mean to call \"valid\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined method SplObjectStorage::offsetFet()', - ), + ], "Attempted to call an undefined method named \"offsetFet\" of class \"SplObjectStorage\".\nDid you mean to call e.g. \"offsetGet\", \"offsetSet\" or \"offsetUnset\"?", - ), - array( - array( - 'type' => 1, - 'message' => 'Call to undefined method class@anonymous::test()', - 'file' => '/home/possum/work/symfony/test.php', - 'line' => 11, - ), + ], + [ + [ + 'type' => 1, + 'message' => 'Call to undefined method class@anonymous::test()', + 'file' => '/home/possum/work/symfony/test.php', + 'line' => 11, + ], 'Attempted to call an undefined method named "test" of class "class@anonymous".', - ), - ); + ], + ]; } } diff --git a/vendor/symfony/debug/Tests/Fixtures/DefinitionInEvaluatedCode.php b/vendor/symfony/debug/Tests/Fixtures/DefinitionInEvaluatedCode.php new file mode 100644 index 0000000000000000000000000000000000000000..ff6976e0fb1d702f85807e7595d4e500bb3a9dbf --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/DefinitionInEvaluatedCode.php @@ -0,0 +1,11 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +eval(' + namespace Symfony\Component\Debug\Tests\Fixtures; + + class DefinitionInEvaluatedCode + { + } +'); diff --git a/vendor/symfony/debug/Tests/Fixtures/ErrorHandlerThatUsesThePreviousOne.php b/vendor/symfony/debug/Tests/Fixtures/ErrorHandlerThatUsesThePreviousOne.php new file mode 100644 index 0000000000000000000000000000000000000000..d449c40cc76dbec78c4e921bab2565f733b2e9d8 --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/ErrorHandlerThatUsesThePreviousOne.php @@ -0,0 +1,22 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +class ErrorHandlerThatUsesThePreviousOne +{ + private static $previous; + + public static function register() + { + $handler = new static(); + + self::$previous = set_error_handler([$handler, 'handleError']); + + return $handler; + } + + public function handleError($type, $message, $file, $line, $context) + { + return \call_user_func(self::$previous, $type, $message, $file, $line, $context); + } +} diff --git a/vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php b/vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php index 2bd337e5a2db0058ca9c38a82d2a0f20ea0a81e6..050d19ff5e720d52a4c5cb16d78d92b1697e9305 100644 --- a/vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php +++ b/vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php @@ -4,6 +4,8 @@ class ExtendedFinalMethod extends FinalMethod { + use FinalMethod2Trait; + /** * {@inheritdoc} */ diff --git a/vendor/symfony/debug/Tests/Fixtures/FinalClass.php b/vendor/symfony/debug/Tests/Fixtures/FinalClass.php deleted file mode 100644 index 2cf26b19e4fc8f17f28b3353195681d9e07cde85..0000000000000000000000000000000000000000 --- a/vendor/symfony/debug/Tests/Fixtures/FinalClass.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace Symfony\Component\Debug\Tests\Fixtures; - -/** - * @final since version 3.3. - */ -class FinalClass -{ -} diff --git a/vendor/symfony/debug/Tests/Fixtures/FinalClasses.php b/vendor/symfony/debug/Tests/Fixtures/FinalClasses.php new file mode 100644 index 0000000000000000000000000000000000000000..0f51f9f46f62789a2e32e40c8774a3a22d60f7ba --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/FinalClasses.php @@ -0,0 +1,84 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +/** + * @final since version 3.3. + */ +class FinalClass1 +{ + // simple comment +} + +/** + * @final + */ +class FinalClass2 +{ + // no comment +} + +/** + * @final comment with @@@ and *** + * + * @author John Doe + */ +class FinalClass3 +{ + // with comment and a tag after +} + +/** + * @final + * @author John Doe + */ +class FinalClass4 +{ + // without comment and a tag after +} + +/** + * @author John Doe + * + * + * @final multiline + * comment + */ +class FinalClass5 +{ + // with comment and a tag before +} + +/** + * @author John Doe + * + * @final + */ +class FinalClass6 +{ + // without comment and a tag before +} + +/** + * @author John Doe + * + * @final another + * + * multiline comment... + * + * @return string + */ +class FinalClass7 +{ + // with comment and a tag before and after +} + +/** + * @author John Doe + * @final + * @return string + */ +class FinalClass8 +{ + // without comment and a tag before and after +} diff --git a/vendor/symfony/debug/Tests/Fixtures/FinalMethod.php b/vendor/symfony/debug/Tests/Fixtures/FinalMethod.php index 92ec421863f3f2795747b2fdc1783d155220f000..98a47524c43e627fbe97d1cfe7f43b46c90c1042 100644 --- a/vendor/symfony/debug/Tests/Fixtures/FinalMethod.php +++ b/vendor/symfony/debug/Tests/Fixtures/FinalMethod.php @@ -11,6 +11,13 @@ public function finalMethod() { } + /** + * @final + */ + public function finalMethod2() + { + } + public function anotherMethod() { } diff --git a/vendor/symfony/debug/Tests/Fixtures/FinalMethod2Trait.php b/vendor/symfony/debug/Tests/Fixtures/FinalMethod2Trait.php new file mode 100644 index 0000000000000000000000000000000000000000..8547f3afed7abfa0c139ed845a4a7f3c54344e2a --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/FinalMethod2Trait.php @@ -0,0 +1,10 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +trait FinalMethod2Trait +{ + public function finalMethod2() + { + } +} diff --git a/vendor/symfony/debug/Tests/Fixtures/LoggerThatSetAnErrorHandler.php b/vendor/symfony/debug/Tests/Fixtures/LoggerThatSetAnErrorHandler.php new file mode 100644 index 0000000000000000000000000000000000000000..dd8563627a1f44ef4139530a4ef06db1efb6dd73 --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/LoggerThatSetAnErrorHandler.php @@ -0,0 +1,15 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +use Symfony\Component\Debug\BufferingLogger; + +class LoggerThatSetAnErrorHandler extends BufferingLogger +{ + public function log($level, $message, array $context = []) + { + set_error_handler('is_string'); + parent::log($level, $message, $context); + restore_error_handler(); + } +} diff --git a/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php b/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php index 40a5fb7f8c852a23c84782dabc02f7bf5d2abb2e..24ac8926d28fff1cca7e344014f9e7b874132829 100644 --- a/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php +++ b/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php @@ -18,7 +18,7 @@ public function __toString() } catch (\Exception $e) { // Using user_error() here is on purpose so we do not forget // that this alias also should work alongside with trigger_error(). - return user_error($e, E_USER_ERROR); + return trigger_error($e, E_USER_ERROR); } } } diff --git a/vendor/symfony/debug/Tests/Fixtures/TraitWithInternalMethod.php b/vendor/symfony/debug/Tests/Fixtures/TraitWithInternalMethod.php new file mode 100644 index 0000000000000000000000000000000000000000..4c3dae37ab52c6cf45998a164e5f61c89705c7d7 --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/TraitWithInternalMethod.php @@ -0,0 +1,13 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +trait TraitWithInternalMethod +{ + /** + * @internal + */ + public function foo() + { + } +} diff --git a/vendor/symfony/debug/Tests/HeaderMock.php b/vendor/symfony/debug/Tests/HeaderMock.php index 3d8d84c5a4c456723224350048bd33b076a5b2ef..d7564db4854b8aefd0ada8454a3f2a142df3e292 100644 --- a/vendor/symfony/debug/Tests/HeaderMock.php +++ b/vendor/symfony/debug/Tests/HeaderMock.php @@ -25,11 +25,11 @@ function header($str, $replace = true, $status = null) function testHeader() { - static $headers = array(); + static $headers = []; if (!$h = \func_get_args()) { $h = $headers; - $headers = array(); + $headers = []; return $h; } diff --git a/vendor/symfony/debug/Tests/phpt/debug_class_loader.phpt b/vendor/symfony/debug/Tests/phpt/debug_class_loader.phpt index b1e9c8390dec716a359c7c41b1d3736713f5903a..26b3abf4d7179a86dbb13736815abbf4ed144454 100644 --- a/vendor/symfony/debug/Tests/phpt/debug_class_loader.phpt +++ b/vendor/symfony/debug/Tests/phpt/debug_class_loader.phpt @@ -24,3 +24,4 @@ class_exists(ExtendedFinalMethod::class); ?> --EXPECTF-- The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod". +The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod2()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod". diff --git a/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt b/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt index 74cf2e91710017f8d28c90c4ddbfd7817bfa648b..9cd44388c3166ecf379e826c47a32a54e4af636c 100644 --- a/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt +++ b/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt @@ -1,5 +1,7 @@ --TEST-- Test catching fatal errors when handlers are nested +--INI-- +display_errors=0 --FILE-- <?php @@ -24,7 +26,6 @@ if (true) { ?> --EXPECTF-- -Fatal error: Class 'Symfony\Component\Debug\missing' not found in %s on line %d object(Symfony\Component\Debug\Exception\ClassNotFoundException)#%d (8) { ["message":protected]=> string(131) "Attempted to load class "missing" from namespace "Symfony\Component\Debug". @@ -38,8 +39,7 @@ Did you forget a "use" statement for another namespace?" ["line":protected]=> int(%d) ["trace":"Exception":private]=> - array(0) { - } + array(%d) {%A} ["previous":"Exception":private]=> NULL ["severity":protected]=> diff --git a/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt b/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt index 3f4559543064c107b503ada0a43108477ec85d8a..b743d93ad7c805871ff013b048c3946b84a42051 100644 --- a/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt +++ b/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt @@ -14,7 +14,7 @@ require $vendor.'/vendor/autoload.php'; if (true) { class TestLogger extends \Psr\Log\AbstractLogger { - public function log($level, $message, array $context = array()) + public function log($level, $message, array $context = []) { echo $message, "\n"; } diff --git a/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt b/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt index 2b74e5c6857f38d57884fddd2a1d10346fee542f..b3f0e0eb0995a95a69f3cebe350beb71c8daacf8 100644 --- a/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt +++ b/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt @@ -17,9 +17,9 @@ ini_set('display_errors', 0); $eHandler = set_error_handler('var_dump'); $xHandler = set_exception_handler('var_dump'); -var_dump(array( +var_dump([ $eHandler[0] === $xHandler[0] ? 'Error and exception handlers do match' : 'Error and exception handlers are different', -)); +]); $eHandler[0]->setExceptionHandler('print_r'); diff --git a/vendor/symfony/debug/phpunit.xml.dist b/vendor/symfony/debug/phpunit.xml.dist index 12e58612bc5f585d43ce911f823a63c1339b2883..a51bbff93586161a8a8438e6765626d75ecfcb82 100644 --- a/vendor/symfony/debug/phpunit.xml.dist +++ b/vendor/symfony/debug/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/dependency-injection/Argument/BoundArgument.php b/vendor/symfony/dependency-injection/Argument/BoundArgument.php index f72f2110744c1cbb7707130ee47d575d520a3852..a20698440c3cfb4ae6abd2561395e56daf065cdc 100644 --- a/vendor/symfony/dependency-injection/Argument/BoundArgument.php +++ b/vendor/symfony/dependency-injection/Argument/BoundArgument.php @@ -33,7 +33,7 @@ public function __construct($value) */ public function getValues() { - return array($this->value, $this->identifier, $this->used); + return [$this->value, $this->identifier, $this->used]; } /** diff --git a/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php b/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php index 2fec5d26d0fc57b7acf4225a8cea25c4b20961fd..6331affa48387f2fa695df2920c602d7be62c4e1 100644 --- a/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php +++ b/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php @@ -25,7 +25,7 @@ class ServiceClosureArgument implements ArgumentInterface public function __construct(Reference $reference) { - $this->values = array($reference); + $this->values = [$reference]; } /** @@ -41,7 +41,7 @@ public function getValues() */ public function setValues(array $values) { - if (array(0) !== array_keys($values) || !($values[0] instanceof Reference || null === $values[0])) { + if ([0] !== array_keys($values) || !($values[0] instanceof Reference || null === $values[0])) { throw new InvalidArgumentException('A ServiceClosureArgument must hold one and only one Reference.'); } diff --git a/vendor/symfony/dependency-injection/Argument/TaggedIteratorArgument.php b/vendor/symfony/dependency-injection/Argument/TaggedIteratorArgument.php index 19e0d2b97152ccf3fdc1f86505b626b461e6ea5f..f00e533919f9b2be7105764ee993493fdc952e59 100644 --- a/vendor/symfony/dependency-injection/Argument/TaggedIteratorArgument.php +++ b/vendor/symfony/dependency-injection/Argument/TaggedIteratorArgument.php @@ -25,7 +25,7 @@ class TaggedIteratorArgument extends IteratorArgument */ public function __construct($tag) { - parent::__construct(array()); + parent::__construct([]); $this->tag = (string) $tag; } diff --git a/vendor/symfony/dependency-injection/ChildDefinition.php b/vendor/symfony/dependency-injection/ChildDefinition.php index 85cc86038fedb60f9527396e2491dd53a1b39fd9..29fbd48f2d17c06462359215133db4c0517bb258 100644 --- a/vendor/symfony/dependency-injection/ChildDefinition.php +++ b/vendor/symfony/dependency-injection/ChildDefinition.php @@ -71,7 +71,7 @@ public function setParent($parent) */ public function getArgument($index) { - if (array_key_exists('index_'.$index, $this->arguments)) { + if (\array_key_exists('index_'.$index, $this->arguments)) { return $this->arguments['index_'.$index]; } diff --git a/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php b/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php index 19f01b8536cb450138cc93e74b9bc5c7ca630cd3..fc4047f902e13da37eeb220fc00d144bf38c7d8c 100644 --- a/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php @@ -34,15 +34,18 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass implements Repe private $graph; private $currentDefinition; private $onlyConstructorArguments; + private $hasProxyDumper; private $lazy; private $expressionLanguage; + private $byConstructor; /** * @param bool $onlyConstructorArguments Sets this Service Reference pass to ignore method calls */ - public function __construct($onlyConstructorArguments = false) + public function __construct($onlyConstructorArguments = false, $hasProxyDumper = true) { $this->onlyConstructorArguments = (bool) $onlyConstructorArguments; + $this->hasProxyDumper = (bool) $hasProxyDumper; } /** @@ -62,6 +65,7 @@ public function process(ContainerBuilder $container) $this->graph = $container->getCompiler()->getServiceReferenceGraph(); $this->graph->clear(); $this->lazy = false; + $this->byConstructor = false; foreach ($container->getAliases() as $id => $alias) { $targetId = $this->getDefinitionId((string) $alias); @@ -83,7 +87,7 @@ protected function processValue($value, $isRoot = false) return $value; } if ($value instanceof Expression) { - $this->getExpressionLanguage()->compile((string) $value, array('this' => 'container')); + $this->getExpressionLanguage()->compile((string) $value, ['this' => 'container']); return $value; } @@ -97,8 +101,9 @@ protected function processValue($value, $isRoot = false) $targetId, $targetDefinition, $value, - $this->lazy || ($targetDefinition && $targetDefinition->isLazy()), - ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior() + $this->lazy || ($this->hasProxyDumper && $targetDefinition && $targetDefinition->isLazy()), + ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior(), + $this->byConstructor ); return $value; @@ -111,11 +116,16 @@ protected function processValue($value, $isRoot = false) return $value; } $this->currentDefinition = $value; + } elseif ($this->currentDefinition === $value) { + return $value; } $this->lazy = false; + $byConstructor = $this->byConstructor; + $this->byConstructor = true; $this->processValue($value->getFactory()); $this->processValue($value->getArguments()); + $this->byConstructor = $byConstructor; if (!$this->onlyConstructorArguments) { $this->processValue($value->getProperties()); diff --git a/vendor/symfony/dependency-injection/Compiler/AutowirePass.php b/vendor/symfony/dependency-injection/Compiler/AutowirePass.php index e542e30ea6f5714487c4de313486aaee925867ec..252b304f118f59f2c0cc2f850d76cf7f21e2cc1e 100644 --- a/vendor/symfony/dependency-injection/Compiler/AutowirePass.php +++ b/vendor/symfony/dependency-injection/Compiler/AutowirePass.php @@ -28,13 +28,13 @@ */ class AutowirePass extends AbstractRecursivePass { - private $definedTypes = array(); + private $definedTypes = []; private $types; private $ambiguousServiceTypes; - private $autowired = array(); + private $autowired = []; private $lastFailure; private $throwOnAutowiringException; - private $autowiringExceptions = array(); + private $autowiringExceptions = []; private $strictMode; /** @@ -63,16 +63,16 @@ public function getAutowiringExceptions() public function process(ContainerBuilder $container) { // clear out any possibly stored exceptions from before - $this->autowiringExceptions = array(); + $this->autowiringExceptions = []; $this->strictMode = $container->hasParameter('container.autowiring.strict_mode') && $container->getParameter('container.autowiring.strict_mode'); try { parent::process($container); } finally { - $this->definedTypes = array(); + $this->definedTypes = []; $this->types = null; $this->ambiguousServiceTypes = null; - $this->autowired = array(); + $this->autowired = []; } } @@ -89,7 +89,7 @@ public static function createResourceForClass(\ReflectionClass $reflectionClass) { @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', E_USER_DEPRECATED); - $metadata = array(); + $metadata = []; foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { if (!$reflectionMethod->isStatic()) { @@ -147,7 +147,7 @@ private function doProcessValue($value, $isRoot = false) } if ($constructor) { - array_unshift($methodCalls, array($constructor, $value->getArguments())); + array_unshift($methodCalls, [$constructor, $value->getArguments()]); } $methodCalls = $this->autowireCalls($reflectionClass, $methodCalls); @@ -214,7 +214,7 @@ private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, a } foreach ($parameters as $index => $parameter) { - if (array_key_exists($index, $arguments) && '' !== $arguments[$index]) { + if (\array_key_exists($index, $arguments) && '' !== $arguments[$index]) { continue; } @@ -327,9 +327,9 @@ private function getAutowiredReference(TypedReference $reference, $deprecationMe */ private function populateAvailableTypes($onlyAutowiringTypes = false) { - $this->types = array(); + $this->types = []; if (!$onlyAutowiringTypes) { - $this->ambiguousServiceTypes = array(); + $this->ambiguousServiceTypes = []; } foreach ($this->container->getDefinitions() as $id => $definition) { @@ -401,7 +401,7 @@ private function set($type, $id) // keep an array of all services matching this type if (!isset($this->ambiguousServiceTypes[$type])) { - $this->ambiguousServiceTypes[$type] = array($this->types[$type]); + $this->ambiguousServiceTypes[$type] = [$this->types[$type]]; unset($this->types[$type]); } $this->ambiguousServiceTypes[$type][] = $id; @@ -452,7 +452,17 @@ private function createAutowiredDefinition($type) private function createTypeNotFoundMessage(TypedReference $reference, $label) { - if (!$r = $this->container->getReflectionClass($type = $reference->getType(), false)) { + $trackResources = $this->container->isTrackingResources(); + $this->container->setResourceTracking(false); + try { + if ($r = $this->container->getReflectionClass($type = $reference->getType(), false)) { + $alternatives = $this->createTypeAlternatives($reference); + } + } finally { + $this->container->setResourceTracking($trackResources); + } + + if (!$r) { // either $type does not exist or a parent class does not exist try { $resource = new ClassExistenceResource($type, false); @@ -465,7 +475,6 @@ private function createTypeNotFoundMessage(TypedReference $reference, $label) $message = sprintf('has type "%s" but this class %s.', $type, $parentMsg ? sprintf('is missing a parent class (%s)', $parentMsg) : 'was not found'); } else { - $alternatives = $this->createTypeAlternatives($reference); $message = $this->container->has($type) ? 'this service is abstract' : 'no such service exists'; $message = sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $alternatives); @@ -512,7 +521,7 @@ private function createTypeAlternatives(TypedReference $reference) */ private static function getResourceMetadataForMethod(\ReflectionMethod $method) { - $methodArgumentsMetadata = array(); + $methodArgumentsMetadata = []; foreach ($method->getParameters() as $parameter) { try { $class = $parameter->getClass(); @@ -522,11 +531,11 @@ private static function getResourceMetadataForMethod(\ReflectionMethod $method) } $isVariadic = method_exists($parameter, 'isVariadic') && $parameter->isVariadic(); - $methodArgumentsMetadata[] = array( + $methodArgumentsMetadata[] = [ 'class' => $class, 'isOptional' => $parameter->isOptional(), 'defaultValue' => ($parameter->isOptional() && !$isVariadic) ? $parameter->getDefaultValue() : null, - ); + ]; } return $methodArgumentsMetadata; @@ -534,7 +543,7 @@ private static function getResourceMetadataForMethod(\ReflectionMethod $method) private function getAliasesSuggestionForType($type, $extraContext = null) { - $aliases = array(); + $aliases = []; foreach (class_parents($type) + class_implements($type) as $parent) { if ($this->container->has($parent) && !$this->container->findDefinition($parent)->isAbstract()) { $aliases[] = $parent; diff --git a/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php b/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php index 6c744f88f6a9492805482b4d593fd279ee5182a0..efb9df7b94318c0d9a9501eb6a8775571caa3c81 100644 --- a/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php @@ -34,7 +34,7 @@ protected function processValue($value, $isRoot = false) return $value; } - $alreadyCalledMethods = array(); + $alreadyCalledMethods = []; foreach ($value->getMethodCalls() as list($method)) { $alreadyCalledMethods[strtolower($method)] = true; diff --git a/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php b/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php index ac7866b2bab86a690e63840c228ba4b9007030e4..55d911c4f3e60bc3b9b1f88b626bb7d7e0fcde47 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php @@ -36,9 +36,9 @@ public function process(ContainerBuilder $container) { $graph = $container->getCompiler()->getServiceReferenceGraph(); - $this->checkedNodes = array(); + $this->checkedNodes = []; foreach ($graph->getNodes() as $id => $node) { - $this->currentPath = array($id); + $this->currentPath = [$id]; $this->checkOutEdges($node->getOutEdges()); } diff --git a/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php b/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php index 6f70352b251d19ebd759aa2b2a76b11af556accc..0e9005415a30bbfd7ee06e2b3d6b12376e434c88 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php @@ -66,13 +66,7 @@ public function process(ContainerBuilder $container) )); } - throw new RuntimeException(sprintf( - 'The definition for "%s" has no class. If you intend to inject ' - .'this service dynamically at runtime, please mark it as synthetic=true. ' - .'If this is an abstract definition solely used by child definitions, ' - .'please add abstract=true, otherwise specify a class to get rid of this error.', - $id - )); + throw new RuntimeException(sprintf('The definition for "%s" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.', $id)); } // tag attribute values must be scalars @@ -89,7 +83,7 @@ public function process(ContainerBuilder $container) if ($definition->isPublic() && !$definition->isPrivate()) { $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); if (null !== $usedEnvs) { - throw new EnvParameterException(array($resolvedId), null, 'A service name ("%s") cannot contain dynamic values.'); + throw new EnvParameterException([$resolvedId], null, 'A service name ("%s") cannot contain dynamic values.'); } } } @@ -98,7 +92,7 @@ public function process(ContainerBuilder $container) if ($alias->isPublic() && !$alias->isPrivate()) { $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); if (null !== $usedEnvs) { - throw new EnvParameterException(array($resolvedId), null, 'An alias name ("%s") cannot contain dynamic values.'); + throw new EnvParameterException([$resolvedId], null, 'An alias name ("%s") cannot contain dynamic values.'); } } } diff --git a/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php b/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php index 323dc6f28783cdf965779ecef69c16db2befcb02..8f2a3bdf706cf8adfcfe2170b9321113a44cc179 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php @@ -34,12 +34,7 @@ protected function processValue($value, $isRoot = false) $targetDefinition = $this->container->getDefinition((string) $value); if ($targetDefinition->isAbstract()) { - throw new RuntimeException(sprintf( - 'The definition "%s" has a reference to an abstract definition "%s". ' - .'Abstract definitions cannot be the target of references.', - $this->currentId, - $value - )); + throw new RuntimeException(sprintf('The definition "%s" has a reference to an abstract definition "%s". Abstract definitions cannot be the target of references.', $this->currentId, $value)); } } diff --git a/vendor/symfony/dependency-injection/Compiler/Compiler.php b/vendor/symfony/dependency-injection/Compiler/Compiler.php index d5c01a640fce55a415d04e727482b29f7fa804bb..a6ae94d8cacc73e1b5776eee657d93a61a3f8f7d 100644 --- a/vendor/symfony/dependency-injection/Compiler/Compiler.php +++ b/vendor/symfony/dependency-injection/Compiler/Compiler.php @@ -22,7 +22,7 @@ class Compiler { private $passConfig; - private $log = array(); + private $log = []; private $loggingFormatter; private $serviceReferenceGraph; @@ -141,7 +141,7 @@ public function compile(ContainerBuilder $container) $pass->process($container); } } catch (\Exception $e) { - $usedEnvs = array(); + $usedEnvs = []; $prev = $e; do { diff --git a/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php b/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php index c3b26e3f1655a9457a2c10636f8e0f1a5ba7ecfe..bbd857e154e51163f83ce14c4bdf230aec9140bc 100644 --- a/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php +++ b/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php @@ -32,8 +32,9 @@ public function process(ContainerBuilder $container) if (!$decorated = $definition->getDecoratedService()) { continue; } - $definitions->insert(array($id, $definition), array($decorated[2], --$order)); + $definitions->insert([$id, $definition], [$decorated[2], --$order]); } + $decoratingDefinitions = []; foreach ($definitions as list($id, $definition)) { list($inner, $renamedId) = $definition->getDecoratedService(); @@ -53,18 +54,25 @@ public function process(ContainerBuilder $container) $container->setAlias($renamedId, new Alias($container->normalizeId($alias), false)); } else { $decoratedDefinition = $container->getDefinition($inner); - $definition->setTags(array_merge($decoratedDefinition->getTags(), $definition->getTags())); - if ($types = array_merge($decoratedDefinition->getAutowiringTypes(false), $definition->getAutowiringTypes(false))) { - $definition->setAutowiringTypes($types); - } $public = $decoratedDefinition->isPublic(); $private = $decoratedDefinition->isPrivate(); $decoratedDefinition->setPublic(false); - $decoratedDefinition->setTags(array()); - if ($decoratedDefinition->getAutowiringTypes(false)) { - $decoratedDefinition->setAutowiringTypes(array()); - } $container->setDefinition($renamedId, $decoratedDefinition); + $decoratingDefinitions[$inner] = $decoratedDefinition; + } + + if (isset($decoratingDefinitions[$inner])) { + $decoratingDefinition = $decoratingDefinitions[$inner]; + $definition->setTags(array_merge($decoratingDefinition->getTags(), $definition->getTags())); + $autowiringTypes = $decoratingDefinition->getAutowiringTypes(false); + if ($types = array_merge($autowiringTypes, $definition->getAutowiringTypes(false))) { + $definition->setAutowiringTypes($types); + } + $decoratingDefinition->setTags([]); + if ($autowiringTypes) { + $decoratingDefinition->setAutowiringTypes([]); + } + $decoratingDefinitions[$inner] = $definition; } $container->setAlias($inner, $id)->setPublic($public)->setPrivate($private); diff --git a/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php b/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php index 1279fcaa706391ab23de0a701a50b841e5f5c139..d688fb59fd1fd2592d28151c6e83d6c5b4e0c429 100644 --- a/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php +++ b/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php @@ -41,14 +41,14 @@ public function process(ContainerBuilder $container) if (!method_exists(\ReflectionMethod::class, 'getReturnType')) { return; } - $resolveClassPassChanges = null !== $this->resolveClassPass ? $this->resolveClassPass->getChanges() : array(); + $resolveClassPassChanges = null !== $this->resolveClassPass ? $this->resolveClassPass->getChanges() : []; foreach ($container->getDefinitions() as $id => $definition) { $this->updateDefinition($container, $id, $definition, $resolveClassPassChanges); } } - private function updateDefinition(ContainerBuilder $container, $id, Definition $definition, array $resolveClassPassChanges, array $previous = array()) + private function updateDefinition(ContainerBuilder $container, $id, Definition $definition, array $resolveClassPassChanges, array $previous = []) { // circular reference if (isset($previous[$id])) { diff --git a/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php b/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php index 05eb72d9746f4151eb99cdb95d9b1d5824abe6ea..326ee19323ca43a1ba67d6f3589db0a5973b4abf 100644 --- a/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php @@ -23,8 +23,8 @@ */ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements RepeatablePassInterface { - private $cloningIds = array(); - private $inlinedServiceIds = array(); + private $cloningIds = []; + private $inlinedServiceIds = []; /** * {@inheritdoc} @@ -126,14 +126,20 @@ private function isInlineableDefinition($id, Definition $definition, ServiceRefe return false; } - $ids = array(); + $ids = []; + $isReferencedByConstructor = false; foreach ($graph->getNode($id)->getInEdges() as $edge) { - if ($edge->isWeak()) { + $isReferencedByConstructor = $isReferencedByConstructor || $edge->isReferencedByConstructor(); + if ($edge->isWeak() || $edge->isLazy()) { return false; } $ids[] = $edge->getSourceNode()->getId(); } + if (!$ids) { + return true; + } + if (\count(array_unique($ids)) > 1) { return false; } @@ -142,6 +148,6 @@ private function isInlineableDefinition($id, Definition $definition, ServiceRefe return false; } - return !$ids || $this->container->getDefinition($ids[0])->isShared(); + return $this->container->getDefinition($ids[0])->isShared(); } } diff --git a/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php b/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php index 71cfa2d51dc19635146d0ced70077acb0db73154..63f8013c313fbbdec92b0f8fd76cff9942d6aa7c 100644 --- a/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php +++ b/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php @@ -110,7 +110,7 @@ public function freezeAfterProcessing(Extension $extension, ContainerBuilder $co // Extension::processConfiguration() wasn't called, we cannot know how configs were merged return; } - $this->processedEnvPlaceholders = array(); + $this->processedEnvPlaceholders = []; // serialize config and container to catch env vars nested in object graphs $config = serialize($config).serialize($container->getDefinitions()).serialize($container->getAliases()).serialize($container->getParameterBag()->all()); diff --git a/vendor/symfony/dependency-injection/Compiler/PassConfig.php b/vendor/symfony/dependency-injection/Compiler/PassConfig.php index 31104fb1fe82069dc011a8c03d1c62ed24bd80d5..77f4e953157c789883d12ea23ad257cf8e417978 100644 --- a/vendor/symfony/dependency-injection/Compiler/PassConfig.php +++ b/vendor/symfony/dependency-injection/Compiler/PassConfig.php @@ -29,9 +29,9 @@ class PassConfig const TYPE_REMOVE = 'removing'; private $mergePass; - private $afterRemovingPasses = array(); - private $beforeOptimizationPasses = array(); - private $beforeRemovingPasses = array(); + private $afterRemovingPasses = []; + private $beforeOptimizationPasses = []; + private $beforeRemovingPasses = []; private $optimizationPasses; private $removingPasses; @@ -39,24 +39,24 @@ public function __construct() { $this->mergePass = new MergeExtensionConfigurationPass(); - $this->beforeOptimizationPasses = array( - 100 => array( + $this->beforeOptimizationPasses = [ + 100 => [ $resolveClassPass = new ResolveClassPass(), new ResolveInstanceofConditionalsPass(), new RegisterEnvVarProcessorsPass(), - ), - -1000 => array(new ExtensionCompilerPass()), - ); + ], + -1000 => [new ExtensionCompilerPass()], + ]; - $this->optimizationPasses = array(array( + $this->optimizationPasses = [[ new ResolveChildDefinitionsPass(), new ServiceLocatorTagPass(), + new RegisterServiceSubscribersPass(), new DecoratorServicePass(), new ResolveParameterPlaceHoldersPass(false), new ResolveFactoryClassPass(), new FactoryReturnTypePass($resolveClassPass), new CheckDefinitionValidityPass(), - new RegisterServiceSubscribersPass(), new ResolveNamedArgumentsPass(), new AutowireRequiredMethodsPass(), new ResolveBindingsPass(), @@ -69,28 +69,28 @@ public function __construct() new CheckCircularReferencesPass(), new CheckReferenceValidityPass(), new CheckArgumentsValidityPass(false), - )); + ]]; - $this->beforeRemovingPasses = array( - -100 => array( + $this->beforeRemovingPasses = [ + -100 => [ new ResolvePrivatesPass(), - ), - ); + ], + ]; - $this->removingPasses = array(array( + $this->removingPasses = [[ new RemovePrivateAliasesPass(), new ReplaceAliasByActualDefinitionPass(), new RemoveAbstractDefinitionsPass(), - new RepeatedPass(array( + new RepeatedPass([ new AnalyzeServiceReferencesPass(), new InlineServiceDefinitionsPass(), new AnalyzeServiceReferencesPass(), new RemoveUnusedDefinitionsPass(), - )), + ]), new DefinitionErrorExceptionPass(), new CheckExceptionOnInvalidReferenceBehaviorPass(), new ResolveHotPathPass(), - )); + ]]; } /** @@ -101,7 +101,7 @@ public function __construct() public function getPasses() { return array_merge( - array($this->mergePass), + [$this->mergePass], $this->getBeforeOptimizationPasses(), $this->getOptimizationPasses(), $this->getBeforeRemovingPasses(), @@ -142,7 +142,7 @@ public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_O $passes = &$this->$property; if (!isset($passes[$priority])) { - $passes[$priority] = array(); + $passes[$priority] = []; } $passes[$priority][] = $pass; } @@ -219,7 +219,7 @@ public function setMergePass(CompilerPassInterface $pass) */ public function setAfterRemovingPasses(array $passes) { - $this->afterRemovingPasses = array($passes); + $this->afterRemovingPasses = [$passes]; } /** @@ -229,7 +229,7 @@ public function setAfterRemovingPasses(array $passes) */ public function setBeforeOptimizationPasses(array $passes) { - $this->beforeOptimizationPasses = array($passes); + $this->beforeOptimizationPasses = [$passes]; } /** @@ -239,7 +239,7 @@ public function setBeforeOptimizationPasses(array $passes) */ public function setBeforeRemovingPasses(array $passes) { - $this->beforeRemovingPasses = array($passes); + $this->beforeRemovingPasses = [$passes]; } /** @@ -249,7 +249,7 @@ public function setBeforeRemovingPasses(array $passes) */ public function setOptimizationPasses(array $passes) { - $this->optimizationPasses = array($passes); + $this->optimizationPasses = [$passes]; } /** @@ -259,7 +259,7 @@ public function setOptimizationPasses(array $passes) */ public function setRemovingPasses(array $passes) { - $this->removingPasses = array($passes); + $this->removingPasses = [$passes]; } /** @@ -272,7 +272,7 @@ public function setRemovingPasses(array $passes) private function sortPasses(array $passes) { if (0 === \count($passes)) { - return array(); + return []; } krsort($passes); diff --git a/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php b/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php index ed9b0b7f1e9480c37c669d0d84de5d1ff8d15a75..daff3495acdb746b6d95d4db0ecf2e171c6d8ccb 100644 --- a/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php +++ b/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php @@ -38,7 +38,7 @@ trait PriorityTaggedServiceTrait */ private function findAndSortTaggedServices($tagName, ContainerBuilder $container) { - $services = array(); + $services = []; foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $attributes) { $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0; diff --git a/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php b/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php index e206b0ced887604ed822400bc2ce2ae630163b17..b4d0d0550613130530af2f0cc4afdb2c2bb788d3 100644 --- a/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php @@ -27,13 +27,13 @@ */ class RegisterEnvVarProcessorsPass implements CompilerPassInterface { - private static $allowedTypes = array('array', 'bool', 'float', 'int', 'string'); + private static $allowedTypes = ['array', 'bool', 'float', 'int', 'string']; public function process(ContainerBuilder $container) { $bag = $container->getParameterBag(); - $types = array(); - $processors = array(); + $types = []; + $processors = []; foreach ($container->findTaggedServiceIds('container.env_var_processor') as $id => $tags) { if (!$r = $container->getReflectionClass($class = $container->getDefinition($id)->getClass())) { throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); @@ -58,7 +58,7 @@ public function process(ContainerBuilder $container) if ($processors) { $container->register('container.env_var_processors_locator', ServiceLocator::class) ->setPublic(true) - ->setArguments(array($processors)) + ->setArguments([$processors]) ; } } diff --git a/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php b/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php index 0a7dcd7e9dece93a4970666f7be4c618e75e7871..bf1387c04ed171b62fe6f9f7f23912cb26ff961e 100644 --- a/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php @@ -31,7 +31,7 @@ protected function processValue($value, $isRoot = false) return parent::processValue($value, $isRoot); } - $serviceMap = array(); + $serviceMap = []; $autowire = $value->isAutowired(); foreach ($value->getTag('container.service_subscriber') as $attributes) { @@ -40,13 +40,13 @@ protected function processValue($value, $isRoot = false) continue; } ksort($attributes); - if (array() !== array_diff(array_keys($attributes), array('id', 'key'))) { + if ([] !== array_diff(array_keys($attributes), ['id', 'key'])) { throw new InvalidArgumentException(sprintf('The "container.service_subscriber" tag accepts only the "key" and "id" attributes, "%s" given for service "%s".', implode('", "', array_keys($attributes)), $this->currentId)); } - if (!array_key_exists('id', $attributes)) { + if (!\array_key_exists('id', $attributes)) { throw new InvalidArgumentException(sprintf('Missing "id" attribute on "container.service_subscriber" tag with key="%s" for service "%s".', $attributes['key'], $this->currentId)); } - if (!array_key_exists('key', $attributes)) { + if (!\array_key_exists('key', $attributes)) { $attributes['key'] = $attributes['id']; } if (isset($serviceMap[$attributes['key']])) { @@ -64,7 +64,7 @@ protected function processValue($value, $isRoot = false) } $class = $r->name; - $subscriberMap = array(); + $subscriberMap = []; $declaringClass = (new \ReflectionMethod($class, 'getSubscribedServices'))->class; foreach ($class::getSubscribedServices() as $key => $type) { @@ -94,7 +94,7 @@ protected function processValue($value, $isRoot = false) throw new InvalidArgumentException(sprintf('Service %s not exist in the map returned by "%s::getSubscribedServices()" for service "%s".', $message, $class, $this->currentId)); } - $value->addTag('container.service_subscriber.locator', array('id' => (string) ServiceLocatorTagPass::register($this->container, $subscriberMap, $this->currentId))); + $value->addTag('container.service_subscriber.locator', ['id' => (string) ServiceLocatorTagPass::register($this->container, $subscriberMap, $this->currentId)]); return parent::processValue($value); } diff --git a/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php b/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php index 5a8548a1958ad5572babfe6e544da4007a3ab743..a1013f66c00b0f73af8d33e83e94ecef57679235 100644 --- a/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php @@ -45,8 +45,8 @@ public function process(ContainerBuilder $container) if ($graph->hasNode($id)) { $edges = $graph->getNode($id)->getInEdges(); - $referencingAliases = array(); - $sourceIds = array(); + $referencingAliases = []; + $sourceIds = []; foreach ($edges as $edge) { if ($edge->isWeak()) { continue; @@ -60,7 +60,7 @@ public function process(ContainerBuilder $container) } $isReferenced = (\count(array_unique($sourceIds)) - \count($referencingAliases)) > 0; } else { - $referencingAliases = array(); + $referencingAliases = []; $isReferenced = false; } diff --git a/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php b/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php index 8e2067659245476f84029a00577e7375b5998b34..472bf9415ad69cc63b48b97681dc1ebe2b81d8c4 100644 --- a/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php @@ -33,8 +33,8 @@ class ReplaceAliasByActualDefinitionPass extends AbstractRecursivePass public function process(ContainerBuilder $container) { // First collect all alias targets that need to be replaced - $seenAliasTargets = array(); - $replacements = array(); + $seenAliasTargets = []; + $replacements = []; foreach ($container->getAliases() as $definitionId => $target) { $targetId = $container->normalizeId($target); // Special case: leave this target alone @@ -69,7 +69,7 @@ public function process(ContainerBuilder $container) $this->replacements = $replacements; parent::process($container); - $this->replacements = array(); + $this->replacements = []; } /** diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php index bcf265ab472358ac415c7ca1960a7847d0b5dc50..20b262b6d461c224988f8ec94d3a34db03b998ea 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php @@ -25,9 +25,9 @@ */ class ResolveBindingsPass extends AbstractRecursivePass { - private $usedBindings = array(); - private $unusedBindings = array(); - private $errorMessages = array(); + private $usedBindings = []; + private $unusedBindings = []; + private $errorMessages = []; /** * {@inheritdoc} @@ -48,9 +48,9 @@ public function process(ContainerBuilder $container) throw new InvalidArgumentException($message); } } finally { - $this->usedBindings = array(); - $this->unusedBindings = array(); - $this->errorMessages = array(); + $this->usedBindings = []; + $this->unusedBindings = []; + $this->errorMessages = []; } } @@ -80,7 +80,7 @@ protected function processValue($value, $isRoot = false) $this->usedBindings[$bindingId] = true; unset($this->unusedBindings[$bindingId]); } elseif (!isset($this->usedBindings[$bindingId])) { - $this->unusedBindings[$bindingId] = array($key, $this->currentId); + $this->unusedBindings[$bindingId] = [$key, $this->currentId]; } if (isset($key[0]) && '$' === $key[0]) { @@ -100,7 +100,7 @@ protected function processValue($value, $isRoot = false) try { if ($constructor = $this->getConstructor($value, false)) { - $calls[] = array($constructor, $value->getArguments()); + $calls[] = [$constructor, $value->getArguments()]; } } catch (RuntimeException $e) { $this->errorMessages[] = $e->getMessage(); @@ -119,11 +119,11 @@ protected function processValue($value, $isRoot = false) } foreach ($reflectionMethod->getParameters() as $key => $parameter) { - if (array_key_exists($key, $arguments) && '' !== $arguments[$key]) { + if (\array_key_exists($key, $arguments) && '' !== $arguments[$key]) { continue; } - if (array_key_exists('$'.$parameter->name, $bindings)) { + if (\array_key_exists('$'.$parameter->name, $bindings)) { $arguments[$key] = $this->getBindingValue($bindings['$'.$parameter->name]); continue; diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php index 8cbccdaa3ba9faee748b64504f7e8ec844a6e3bd..539395a43742ec1bcadeb35d130f2e6bf05b7a04 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php @@ -15,6 +15,7 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\ExceptionInterface; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; /** * This replaces all ChildDefinition instances with their equivalent fully @@ -25,6 +26,8 @@ */ class ResolveChildDefinitionsPass extends AbstractRecursivePass { + private $currentPath; + protected function processValue($value, $isRoot = false) { if (!$value instanceof Definition) { @@ -36,6 +39,7 @@ protected function processValue($value, $isRoot = false) $value = $this->container->getDefinition($this->currentId); } if ($value instanceof ChildDefinition) { + $this->currentPath = []; $value = $this->resolveDefinition($value); if ($isRoot) { $this->container->setDefinition($this->currentId, $value); @@ -56,6 +60,8 @@ private function resolveDefinition(ChildDefinition $definition) { try { return $this->doResolveDefinition($definition); + } catch (ServiceCircularReferenceException $e) { + throw $e; } catch (ExceptionInterface $e) { $r = new \ReflectionProperty($e, 'message'); $r->setAccessible(true); @@ -71,6 +77,13 @@ private function doResolveDefinition(ChildDefinition $definition) throw new RuntimeException(sprintf('Parent definition "%s" does not exist.', $parent)); } + $searchKey = array_search($parent, $this->currentPath); + $this->currentPath[] = $parent; + + if (false !== $searchKey) { + throw new ServiceCircularReferenceException($parent, \array_slice($this->currentPath, $searchKey)); + } + $parentDef = $this->container->findDefinition($parent); if ($parentDef instanceof ChildDefinition) { $id = $this->currentId; diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php index 910cb9de98642883e08a660f13f31d6ddd67087d..b1c1b4f884e01431bdebb08fb6d3475d1f7f2150 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php @@ -20,7 +20,7 @@ */ class ResolveClassPass implements CompilerPassInterface { - private $changes = array(); + private $changes = []; /** * {@inheritdoc} @@ -49,7 +49,7 @@ public function process(ContainerBuilder $container) public function getChanges() { $changes = $this->changes; - $this->changes = array(); + $this->changes = []; return $changes; } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveHotPathPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveHotPathPass.php index 2888cf4d396dc8695557565a8355e3704ee91d6f..4e025113acdb8326aee95a8b9536fec25e7685c5 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveHotPathPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveHotPathPass.php @@ -24,7 +24,7 @@ class ResolveHotPathPass extends AbstractRecursivePass { private $tagName; - private $resolvedIds = array(); + private $resolvedIds = []; public function __construct($tagName = 'container.hot_path') { @@ -40,7 +40,7 @@ public function process(ContainerBuilder $container) parent::process($container); $container->getDefinition('service_container')->clearTag($this->tagName); } finally { - $this->resolvedIds = array(); + $this->resolvedIds = []; } } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php index 20507cfb56980a510ba8e1819f0ed8dcde86bab0..69e3796df0c4f7fe92432ff6bad79b1325d2e4f1 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php @@ -50,7 +50,7 @@ public function process(ContainerBuilder $container) private function processDefinition(ContainerBuilder $container, $id, Definition $definition) { $instanceofConditionals = $definition->getInstanceofConditionals(); - $autoconfiguredInstanceof = $definition->isAutoconfigured() ? $container->getAutoconfiguredInstanceof() : array(); + $autoconfiguredInstanceof = $definition->isAutoconfigured() ? $container->getAutoconfiguredInstanceof() : []; if (!$instanceofConditionals && !$autoconfiguredInstanceof) { return $definition; } @@ -61,9 +61,9 @@ private function processDefinition(ContainerBuilder $container, $id, Definition $conditionals = $this->mergeConditionals($autoconfiguredInstanceof, $instanceofConditionals, $container); - $definition->setInstanceofConditionals(array()); + $definition->setInstanceofConditionals([]); $parent = $shared = null; - $instanceofTags = array(); + $instanceofTags = []; foreach ($conditionals as $interface => $instanceofDefs) { if ($interface !== $class && (!$container->getReflectionClass($class, false))) { @@ -81,7 +81,7 @@ private function processDefinition(ContainerBuilder $container, $id, Definition $parent = 'instanceof.'.$interface.'.'.$key.'.'.$id; $container->setDefinition($parent, $instanceofDef); $instanceofTags[] = $instanceofDef->getTags(); - $instanceofDef->setTags(array()); + $instanceofDef->setTags([]); if (isset($instanceofDef->getChanges()['shared'])) { $shared = $instanceofDef->isShared(); @@ -94,7 +94,7 @@ private function processDefinition(ContainerBuilder $container, $id, Definition $abstract = $container->setDefinition('abstract.instanceof.'.$id, $definition); // cast Definition to ChildDefinition - $definition->setBindings(array()); + $definition->setBindings([]); $definition = serialize($definition); $definition = substr_replace($definition, '53', 2, 2); $definition = substr_replace($definition, 'Child', 44, 0); @@ -121,11 +121,11 @@ private function processDefinition(ContainerBuilder $container, $id, Definition // reset fields with "merge" behavior $abstract - ->setBindings(array()) - ->setArguments(array()) - ->setMethodCalls(array()) + ->setBindings([]) + ->setArguments([]) + ->setMethodCalls([]) ->setDecoratedService(null) - ->setTags(array()) + ->setTags([]) ->setAbstract(true); } @@ -135,7 +135,7 @@ private function processDefinition(ContainerBuilder $container, $id, Definition private function mergeConditionals(array $autoconfiguredInstanceof, array $instanceofConditionals, ContainerBuilder $container) { // make each value an array of ChildDefinition - $conditionals = array_map(function ($childDef) { return array($childDef); }, $autoconfiguredInstanceof); + $conditionals = array_map(function ($childDef) { return [$childDef]; }, $autoconfiguredInstanceof); foreach ($instanceofConditionals as $interface => $instanceofDef) { // make sure the interface/class exists (but don't validate automaticInstanceofConditionals) @@ -144,7 +144,7 @@ private function mergeConditionals(array $autoconfiguredInstanceof, array $insta } if (!isset($autoconfiguredInstanceof[$interface])) { - $conditionals[$interface] = array(); + $conditionals[$interface] = []; } $conditionals[$interface][] = $instanceofDef; diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php index 90cf64adbec35dec57ecfb77b1a8a6382aeea238..0b79280110f65703d66254b566a5bd3d8394f884 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php @@ -33,12 +33,12 @@ protected function processValue($value, $isRoot = false) } $calls = $value->getMethodCalls(); - $calls[] = array('__construct', $value->getArguments()); + $calls[] = ['__construct', $value->getArguments()]; foreach ($calls as $i => $call) { list($method, $arguments) = $call; $parameters = null; - $resolvedArguments = array(); + $resolvedArguments = []; foreach ($arguments as $key => $argument) { if (\is_int($key)) { @@ -49,6 +49,7 @@ protected function processValue($value, $isRoot = false) if (null === $parameters) { $r = $this->getReflectionMethod($value, $method); $class = $r instanceof \ReflectionMethod ? $r->class : $this->currentId; + $method = $r->getName(); $parameters = $r->getParameters(); } @@ -70,7 +71,7 @@ protected function processValue($value, $isRoot = false) $typeFound = false; foreach ($parameters as $j => $p) { - if (!array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, true) === $key) { + if (!\array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, true) === $key) { $resolvedArguments[$j] = $argument; $typeFound = true; } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php index 9a59a73ec5e12f9d9702c0f061313ed40d00a828..8c942b524ea3baf2e36d218b01aa630a407c395f 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php @@ -42,7 +42,7 @@ public function process(ContainerBuilder $container) try { parent::process($container); - $aliases = array(); + $aliases = []; foreach ($container->getAliases() as $name => $target) { $this->currentId = $name; $aliases[$this->bag->resolveValue($name)] = $target; diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php index 8ffb245c12f2c2397a0378393ed5321cc96af8d5..b80e45256cbed5d57dfbc175f5c91ec5af60a75d 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php @@ -63,10 +63,10 @@ protected function processValue($value, $isRoot = false) */ private function getDefinitionId($id, ContainerBuilder $container) { - $seen = array(); + $seen = []; while ($container->hasAlias($id)) { if (isset($seen[$id])) { - throw new ServiceCircularReferenceException($id, array_keys($seen)); + throw new ServiceCircularReferenceException($id, array_merge(array_keys($seen), [$id])); } $seen[$id] = true; $id = $container->normalizeId($container->getAlias($id)); diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php b/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php index 5a0703e833583294055644f45609eaedaf16fcba..93e489c8f6a67a15cd96ff91815240436ca2e670 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php @@ -102,7 +102,7 @@ public static function register(ContainerBuilder $container, array $refMap, $cal // to derivate customized instances from the prototype one. $container->register($id .= '.'.$callerId, ServiceLocator::class) ->setPublic(false) - ->setFactory(array(new Reference($locatorId), 'withContext')) + ->setFactory([new Reference($locatorId), 'withContext']) ->addArgument($callerId) ->addArgument(new Reference('service_container')); } diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php index 4d36ae7678f1545c0efd0e59a42348483fa27b77..23d4745ed3d9ffc2cede4f6bce669f91e93d1f9f 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php @@ -28,7 +28,7 @@ class ServiceReferenceGraph /** * @var ServiceReferenceGraphNode[] */ - private $nodes = array(); + private $nodes = []; /** * Checks if the graph has a specific node. @@ -78,7 +78,7 @@ public function clear() foreach ($this->nodes as $node) { $node->clear(); } - $this->nodes = array(); + $this->nodes = []; } /** @@ -91,11 +91,13 @@ public function clear() * @param string $reference * @param bool $lazy * @param bool $weak + * @param bool $byConstructor */ - public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, bool $lazy = false, bool $weak = false*/) + public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, bool $lazy = false, bool $weak = false, bool $byConstructor = false*/) { $lazy = \func_num_args() >= 6 ? func_get_arg(5) : false; $weak = \func_num_args() >= 7 ? func_get_arg(6) : false; + $byConstructor = \func_num_args() >= 8 ? func_get_arg(7) : false; if (null === $sourceId || null === $destId) { return; @@ -103,7 +105,7 @@ public function connect($sourceId, $sourceValue, $destId, $destValue = null, $re $sourceNode = $this->createNode($sourceId, $sourceValue); $destNode = $this->createNode($destId, $destValue); - $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak); + $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak, $byConstructor); $sourceNode->addOutEdge($edge); $destNode->addInEdge($edge); diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php index 018905394f0cfb7646278a9d23c6291801127874..5b8c84b6d61f67bd2fb4b936f2d4dc35a604c453 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php @@ -25,6 +25,7 @@ class ServiceReferenceGraphEdge private $value; private $lazy; private $weak; + private $byConstructor; /** * @param ServiceReferenceGraphNode $sourceNode @@ -32,14 +33,16 @@ class ServiceReferenceGraphEdge * @param mixed $value * @param bool $lazy * @param bool $weak + * @param bool $byConstructor */ - public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null, $lazy = false, $weak = false) + public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null, $lazy = false, $weak = false, $byConstructor = false) { $this->sourceNode = $sourceNode; $this->destNode = $destNode; $this->value = $value; $this->lazy = $lazy; $this->weak = $weak; + $this->byConstructor = $byConstructor; } /** @@ -91,4 +94,14 @@ public function isWeak() { return $this->weak; } + + /** + * Returns true if the edge links with a constructor argument. + * + * @return bool + */ + public function isReferencedByConstructor() + { + return $this->byConstructor; + } } diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php index 36b99f1a825382b9b90de50c20262583fecf5beb..6abd6c86af703dead5a59d5bb32d43828fd20e3e 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php @@ -24,8 +24,8 @@ class ServiceReferenceGraphNode { private $id; - private $inEdges = array(); - private $outEdges = array(); + private $inEdges = []; + private $outEdges = []; private $value; /** @@ -113,6 +113,6 @@ public function getValue() */ public function clear() { - $this->inEdges = $this->outEdges = array(); + $this->inEdges = $this->outEdges = []; } } diff --git a/vendor/symfony/dependency-injection/Config/AutowireServiceResource.php b/vendor/symfony/dependency-injection/Config/AutowireServiceResource.php index 0eac93964b94c123275a386b93eaddac6147602f..0c3d8f5758e46e034c833ef4eb5b127045a3fe44 100644 --- a/vendor/symfony/dependency-injection/Config/AutowireServiceResource.php +++ b/vendor/symfony/dependency-injection/Config/AutowireServiceResource.php @@ -23,7 +23,7 @@ class AutowireServiceResource implements SelfCheckingResourceInterface, \Seriali { private $class; private $filePath; - private $autowiringMetadata = array(); + private $autowiringMetadata = []; public function __construct($class, $path, array $autowiringMetadata) { @@ -58,15 +58,21 @@ public function __toString() return 'service.autowire.'.$this->class; } + /** + * @internal + */ public function serialize() { - return serialize(array($this->class, $this->filePath, $this->autowiringMetadata)); + return serialize([$this->class, $this->filePath, $this->autowiringMetadata]); } + /** + * @internal + */ public function unserialize($serialized) { if (\PHP_VERSION_ID >= 70000) { - list($this->class, $this->filePath, $this->autowiringMetadata) = unserialize($serialized, array('allowed_classes' => false)); + list($this->class, $this->filePath, $this->autowiringMetadata) = unserialize($serialized, ['allowed_classes' => false]); } else { list($this->class, $this->filePath, $this->autowiringMetadata) = unserialize($serialized); } diff --git a/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php b/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php index 072f0580aada7aaac207ffa23d2f24dad648ac07..7560c3356d978ebead02b361ea412f6b1da92c11 100644 --- a/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php +++ b/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php @@ -39,7 +39,7 @@ public function __toString() } /** - * {@inheritdoc} + * @internal */ public function serialize() { @@ -47,7 +47,7 @@ public function serialize() } /** - * {@inheritdoc} + * @internal */ public function unserialize($serialized) { diff --git a/vendor/symfony/dependency-injection/Container.php b/vendor/symfony/dependency-injection/Container.php index 5dfa1da59dc503c6ac73abc73810f21bd7615282..e822643439c2f5f1d8d6297cd50c19b2fdb73fa3 100644 --- a/vendor/symfony/dependency-injection/Container.php +++ b/vendor/symfony/dependency-injection/Container.php @@ -40,26 +40,26 @@ class Container implements ResettableContainerInterface { protected $parameterBag; - protected $services = array(); - protected $fileMap = array(); - protected $methodMap = array(); - protected $aliases = array(); - protected $loading = array(); - protected $resolving = array(); - protected $syntheticIds = array(); + protected $services = []; + protected $fileMap = []; + protected $methodMap = []; + protected $aliases = []; + protected $loading = []; + protected $resolving = []; + protected $syntheticIds = []; /** * @internal */ - protected $privates = array(); + protected $privates = []; /** * @internal */ - protected $normalizedIds = array(); + protected $normalizedIds = []; - private $underscoreMap = array('_' => '', '.' => '_', '\\' => '_'); - private $envCache = array(); + private $underscoreMap = ['_' => '', '.' => '_', '\\' => '_']; + private $envCache = []; private $compiled = false; private $getEnv; @@ -294,7 +294,7 @@ public function get($id, $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERE } if (isset($this->loading[$id])) { - throw new ServiceCircularReferenceException($id, array_keys($this->loading)); + throw new ServiceCircularReferenceException($id, array_merge(array_keys($this->loading), [$id])); } $this->loading[$id] = true; @@ -331,13 +331,13 @@ public function get($id, $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERE throw new ServiceNotFoundException($id); } if (isset($this->syntheticIds[$id])) { - throw new ServiceNotFoundException($id, null, null, array(), sprintf('The "%s" service is synthetic, it needs to be set at boot time before it can be used.', $id)); + throw new ServiceNotFoundException($id, null, null, [], sprintf('The "%s" service is synthetic, it needs to be set at boot time before it can be used.', $id)); } if (isset($this->getRemovedIds()[$id])) { - throw new ServiceNotFoundException($id, null, null, array(), sprintf('The "%s" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.', $id)); + throw new ServiceNotFoundException($id, null, null, [], sprintf('The "%s" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.', $id)); } - $alternatives = array(); + $alternatives = []; foreach ($this->getServiceIds() as $knownId) { $lev = levenshtein($id, $knownId); if ($lev <= \strlen($id) / 3 || false !== strpos($knownId, $id)) { @@ -380,7 +380,7 @@ public function initialized($id) */ public function reset() { - $this->services = array(); + $this->services = []; } /** @@ -390,7 +390,7 @@ public function reset() */ public function getServiceIds() { - $ids = array(); + $ids = []; if (!$this->methodMap && !$this instanceof ContainerBuilder && __CLASS__ !== static::class) { // We only check the convention-based factory in a compiled container (i.e. a child class other than a ContainerBuilder, @@ -415,7 +415,7 @@ public function getServiceIds() */ public function getRemovedIds() { - return array(); + return []; } /** @@ -427,7 +427,7 @@ public function getRemovedIds() */ public static function camelize($id) { - return strtr(ucwords(strtr($id, array('_' => ' ', '.' => '_ ', '\\' => '_ '))), array(' ' => '')); + return strtr(ucwords(strtr($id, ['_' => ' ', '.' => '_ ', '\\' => '_ '])), [' ' => '']); } /** @@ -439,7 +439,7 @@ public static function camelize($id) */ public static function underscore($id) { - return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), str_replace('_', '.', $id))); + return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], str_replace('_', '.', $id))); } /** @@ -466,11 +466,11 @@ protected function getEnv($name) if (isset($this->resolving[$envName = "env($name)"])) { throw new ParameterCircularReferenceException(array_keys($this->resolving)); } - if (isset($this->envCache[$name]) || array_key_exists($name, $this->envCache)) { + if (isset($this->envCache[$name]) || \array_key_exists($name, $this->envCache)) { return $this->envCache[$name]; } if (!$this->has($id = 'container.env_var_processors_locator')) { - $this->set($id, new ServiceLocator(array())); + $this->set($id, new ServiceLocator([])); } if (!$this->getEnv) { $this->getEnv = new \ReflectionMethod($this, __FUNCTION__); diff --git a/vendor/symfony/dependency-injection/ContainerAwareInterface.php b/vendor/symfony/dependency-injection/ContainerAwareInterface.php index d78491bb9633572af40871684da4843bb569651e..e7b9d575ece50637213e1222073e8cab5a8be7ff 100644 --- a/vendor/symfony/dependency-injection/ContainerAwareInterface.php +++ b/vendor/symfony/dependency-injection/ContainerAwareInterface.php @@ -18,5 +18,8 @@ */ interface ContainerAwareInterface { + /** + * Sets the container. + */ public function setContainer(ContainerInterface $container = null); } diff --git a/vendor/symfony/dependency-injection/ContainerBuilder.php b/vendor/symfony/dependency-injection/ContainerBuilder.php index c2b73e70c84dc34a5049d5485ae7fa37ee4c836c..0c1966a42e255f3771d0039867cb5c71c4cf0df6 100644 --- a/vendor/symfony/dependency-injection/ContainerBuilder.php +++ b/vendor/symfony/dependency-injection/ContainerBuilder.php @@ -53,29 +53,29 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * @var ExtensionInterface[] */ - private $extensions = array(); + private $extensions = []; /** * @var ExtensionInterface[] */ - private $extensionsByNs = array(); + private $extensionsByNs = []; /** * @var Definition[] */ - private $definitions = array(); + private $definitions = []; /** * @var Alias[] */ - private $aliasDefinitions = array(); + private $aliasDefinitions = []; /** * @var ResourceInterface[] */ - private $resources = array(); + private $resources = []; - private $extensionConfigs = array(); + private $extensionConfigs = []; /** * @var Compiler @@ -97,34 +97,33 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * @var ExpressionFunctionProviderInterface[] */ - private $expressionLanguageProviders = array(); + private $expressionLanguageProviders = []; /** * @var string[] with tag names used by findTaggedServiceIds */ - private $usedTags = array(); + private $usedTags = []; /** * @var string[][] a map of env var names to their placeholders */ - private $envPlaceholders = array(); + private $envPlaceholders = []; /** * @var int[] a map of env vars to their resolution counter */ - private $envCounters = array(); + private $envCounters = []; /** * @var string[] the list of vendor directories */ private $vendors; - private $autoconfiguredInstanceof = array(); + private $autoconfiguredInstanceof = []; - private $removedIds = array(); - private $alreadyLoading = array(); + private $removedIds = []; - private static $internalTypes = array( + private static $internalTypes = [ 'int' => true, 'float' => true, 'string' => true, @@ -136,7 +135,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface 'callable' => true, 'iterable' => true, 'mixed' => true, - ); + ]; public function __construct(ParameterBagInterface $parameterBag = null) { @@ -365,11 +364,11 @@ public function getReflectionClass($class, $throw = true) try { if (isset($this->classReflectors[$class])) { $classReflector = $this->classReflectors[$class]; - } elseif ($this->trackResources) { + } elseif (class_exists(ClassExistenceResource::class)) { $resource = new ClassExistenceResource($class, false); $classReflector = $resource->isFresh(0) ? false : new \ReflectionClass($class); } else { - $classReflector = new \ReflectionClass($class); + $classReflector = class_exists($class) ? new \ReflectionClass($class) : false; } } catch (\ReflectionException $e) { if ($throw) { @@ -450,7 +449,7 @@ public function loadFromExtension($extension, array $values = null) } if (\func_num_args() < 2) { - $values = array(); + $values = []; } $namespace = $this->getExtension($extension)->getAlias(); @@ -588,22 +587,32 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV return $this->doGet($id, $invalidBehavior); } - private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, array &$inlineServices = array()) + private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, array &$inlineServices = null, $isConstructorArgument = false) { $id = $this->normalizeId($id); if (isset($inlineServices[$id])) { return $inlineServices[$id]; } - if (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior) { - return parent::get($id, $invalidBehavior); + if (null === $inlineServices) { + $isConstructorArgument = true; + $inlineServices = []; } - if ($service = parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)) { - return $service; + try { + if (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior) { + return parent::get($id, $invalidBehavior); + } + if ($service = parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)) { + return $service; + } + } catch (ServiceCircularReferenceException $e) { + if ($isConstructorArgument) { + throw $e; + } } if (!isset($this->definitions[$id]) && isset($this->aliasDefinitions[$id])) { - return $this->doGet((string) $this->aliasDefinitions[$id], $invalidBehavior, $inlineServices); + return $this->doGet((string) $this->aliasDefinitions[$id], $invalidBehavior, $inlineServices, $isConstructorArgument); } try { @@ -616,16 +625,17 @@ private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_ throw $e; } - $loading = isset($this->alreadyLoading[$id]) ? 'loading' : 'alreadyLoading'; - $this->{$loading}[$id] = true; + if ($isConstructorArgument) { + $this->loading[$id] = true; + } try { - $service = $this->createService($definition, $inlineServices, $id); + return $this->createService($definition, $inlineServices, $isConstructorArgument, $id); } finally { - unset($this->{$loading}[$id]); + if ($isConstructorArgument) { + unset($this->loading[$id]); + } } - - return $service; } /** @@ -637,10 +647,10 @@ private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_ * the parameters passed to the container constructor to have precedence * over the loaded ones. * - * $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); - * $loader = new LoaderXXX($container); - * $loader->load('resource_name'); - * $container->register('foo', 'stdClass'); + * $container = new ContainerBuilder(new ParameterBag(['foo' => 'bar'])); + * $loader = new LoaderXXX($container); + * $loader->load('resource_name'); + * $container->register('foo', 'stdClass'); * * In the above example, even if the loaded resource defines a foo * parameter, the value will still be 'bar' as defined in the ContainerBuilder @@ -666,7 +676,7 @@ public function merge(self $container) foreach ($this->extensions as $name => $extension) { if (!isset($this->extensionConfigs[$name])) { - $this->extensionConfigs[$name] = array(); + $this->extensionConfigs[$name] = []; } $this->extensionConfigs[$name] = array_merge($this->extensionConfigs[$name], $container->getExtensionConfig($name)); @@ -676,7 +686,7 @@ public function merge(self $container) $envPlaceholders = $container->getParameterBag()->getEnvPlaceholders(); $this->getParameterBag()->mergeEnvPlaceholders($container->getParameterBag()); } else { - $envPlaceholders = array(); + $envPlaceholders = []; } foreach ($container->envCounters as $env => $count) { @@ -709,7 +719,7 @@ public function merge(self $container) public function getExtensionConfig($name) { if (!isset($this->extensionConfigs[$name])) { - $this->extensionConfigs[$name] = array(); + $this->extensionConfigs[$name] = []; } return $this->extensionConfigs[$name]; @@ -724,7 +734,7 @@ public function getExtensionConfig($name) public function prependExtensionConfig($name, array $config) { if (!isset($this->extensionConfigs[$name])) { - $this->extensionConfigs[$name] = array(); + $this->extensionConfigs[$name] = []; } array_unshift($this->extensionConfigs[$name], $config); @@ -783,7 +793,7 @@ public function compile(/*$resolveEnvPlaceholders = false*/) } } - $this->extensionConfigs = array(); + $this->extensionConfigs = []; if ($bag instanceof EnvPlaceholderParameterBag) { if ($resolveEnvPlaceholders) { @@ -837,7 +847,7 @@ public function addAliases(array $aliases) */ public function setAliases(array $aliases) { - $this->aliasDefinitions = array(); + $this->aliasDefinitions = []; $this->addAliases($aliases); } @@ -949,7 +959,7 @@ public function register($id, $class = null) * an autowired definition. * * @param string $id The service identifier - * @param null|string $class The service class + * @param string|null $class The service class * * @return Definition The created definition */ @@ -977,7 +987,7 @@ public function addDefinitions(array $definitions) */ public function setDefinitions(array $definitions) { - $this->definitions = array(); + $this->definitions = []; $this->addDefinitions($definitions); } @@ -1061,7 +1071,7 @@ public function findDefinition($id) { $id = $this->normalizeId($id); - $seen = array(); + $seen = []; while (isset($this->aliasDefinitions[$id])) { $id = (string) $this->aliasDefinitions[$id]; @@ -1092,7 +1102,7 @@ public function findDefinition($id) * @throws RuntimeException When the service is a synthetic service * @throws InvalidArgumentException When configure callable is not callable */ - private function createService(Definition $definition, array &$inlineServices, $id = null, $tryProxy = true) + private function createService(Definition $definition, array &$inlineServices, $isConstructorArgument = false, $id = null, $tryProxy = true) { if (null === $id && isset($inlineServices[$h = spl_object_hash($definition)])) { return $inlineServices[$h]; @@ -1110,16 +1120,14 @@ private function createService(Definition $definition, array &$inlineServices, $ @trigger_error($definition->getDeprecationMessage($id), E_USER_DEPRECATED); } - if ($tryProxy && $definition->isLazy()) { - $proxy = $this - ->getProxyInstantiator() - ->instantiateProxy( - $this, - $definition, - $id, function () use ($definition, &$inlineServices, $id) { - return $this->createService($definition, $inlineServices, $id, false); - } - ); + if ($tryProxy && $definition->isLazy() && !$tryProxy = !($proxy = $this->proxyInstantiator) || $proxy instanceof RealServiceInstantiator) { + $proxy = $proxy->instantiateProxy( + $this, + $definition, + $id, function () use ($definition, &$inlineServices, $id) { + return $this->createService($definition, $inlineServices, true, $id, false); + } + ); $this->shareService($definition, $proxy, $id, $inlineServices); return $proxy; @@ -1131,19 +1139,21 @@ private function createService(Definition $definition, array &$inlineServices, $ require_once $parameterBag->resolveValue($definition->getFile()); } - $arguments = $this->doResolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())), $inlineServices); - - if (null !== $id && $definition->isShared() && isset($this->services[$id]) && ($tryProxy || !$definition->isLazy())) { - return $this->services[$id]; - } + $arguments = $this->doResolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())), $inlineServices, $isConstructorArgument); if (null !== $factory = $definition->getFactory()) { if (\is_array($factory)) { - $factory = array($this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices), $factory[1]); + $factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]]; } elseif (!\is_string($factory)) { throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory', $id)); } + } + if (null !== $id && $definition->isShared() && isset($this->services[$id]) && ($tryProxy || !$definition->isLazy())) { + return $this->services[$id]; + } + + if (null !== $factory) { $service = \call_user_func_array($factory, $arguments); if (!$definition->isDeprecated() && \is_array($factory) && \is_string($factory[0])) { @@ -1159,7 +1169,7 @@ private function createService(Definition $definition, array &$inlineServices, $ $service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments); // don't trigger deprecations for internal uses // @deprecated since version 3.3, to be removed in 4.0 along with the deprecated class - $deprecationWhitelist = array('event_dispatcher' => ContainerAwareEventDispatcher::class); + $deprecationWhitelist = ['event_dispatcher' => ContainerAwareEventDispatcher::class]; if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ") && (!isset($deprecationWhitelist[$id]) || $deprecationWhitelist[$id] !== $class)) { @trigger_error(sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), E_USER_DEPRECATED); @@ -1214,11 +1224,11 @@ public function resolveServices($value) return $this->doResolveServices($value); } - private function doResolveServices($value, array &$inlineServices = array()) + private function doResolveServices($value, array &$inlineServices = [], $isConstructorArgument = false) { if (\is_array($value)) { foreach ($value as $k => $v) { - $value[$k] = $this->doResolveServices($v, $inlineServices); + $value[$k] = $this->doResolveServices($v, $inlineServices, $isConstructorArgument); } } elseif ($value instanceof ServiceClosureArgument) { $reference = $value->getValues()[0]; @@ -1261,13 +1271,13 @@ private function doResolveServices($value, array &$inlineServices = array()) return $count; }); } elseif ($value instanceof Reference) { - $value = $this->doGet((string) $value, $value->getInvalidBehavior(), $inlineServices); + $value = $this->doGet((string) $value, $value->getInvalidBehavior(), $inlineServices, $isConstructorArgument); } elseif ($value instanceof Definition) { - $value = $this->createService($value, $inlineServices); + $value = $this->createService($value, $inlineServices, $isConstructorArgument); } elseif ($value instanceof Parameter) { $value = $this->getParameter((string) $value); } elseif ($value instanceof Expression) { - $value = $this->getExpressionLanguage()->evaluate($value, array('container' => $this)); + $value = $this->getExpressionLanguage()->evaluate($value, ['container' => $this]); } return $value; @@ -1278,14 +1288,14 @@ private function doResolveServices($value, array &$inlineServices = array()) * * Example: * - * $container->register('foo')->addTag('my.tag', array('hello' => 'world')); + * $container->register('foo')->addTag('my.tag', ['hello' => 'world']); * - * $serviceIds = $container->findTaggedServiceIds('my.tag'); - * foreach ($serviceIds as $serviceId => $tags) { - * foreach ($tags as $tag) { - * echo $tag['hello']; + * $serviceIds = $container->findTaggedServiceIds('my.tag'); + * foreach ($serviceIds as $serviceId => $tags) { + * foreach ($tags as $tag) { + * echo $tag['hello']; + * } * } - * } * * @param string $name * @param bool $throwOnAbstract @@ -1295,7 +1305,7 @@ private function doResolveServices($value, array &$inlineServices = array()) public function findTaggedServiceIds($name, $throwOnAbstract = false) { $this->usedTags[] = $name; - $tags = array(); + $tags = []; foreach ($this->getDefinitions() as $id => $definition) { if ($definition->hasTag($name)) { if ($throwOnAbstract && $definition->isAbstract()) { @@ -1315,7 +1325,7 @@ public function findTaggedServiceIds($name, $throwOnAbstract = false) */ public function findTags() { - $tags = array(); + $tags = []; foreach ($this->getDefinitions() as $id => $definition) { $tags = array_merge(array_keys($definition->getTags()), $tags); } @@ -1395,7 +1405,7 @@ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs } if (\is_array($value)) { - $result = array(); + $result = []; foreach ($value as $k => $v) { $result[\is_string($k) ? $this->resolveEnvPlaceholders($k, $format, $usedEnvs) : $k] = $this->resolveEnvPlaceholders($v, $format, $usedEnvs); } @@ -1463,7 +1473,7 @@ public function getEnvCounters() */ public function getNormalizedIds() { - $normalizedIds = array(); + $normalizedIds = []; foreach ($this->normalizedIds as $k => $v) { if ($v !== (string) $k) { @@ -1505,7 +1515,7 @@ public function normalizeId($id) */ public static function getServiceConditionals($value) { - $services = array(); + $services = []; if (\is_array($value)) { foreach ($value as $v) { @@ -1529,7 +1539,7 @@ public static function getServiceConditionals($value) */ public static function getInitializedConditionals($value) { - $services = array(); + $services = []; if (\is_array($value)) { foreach ($value as $v) { @@ -1553,7 +1563,7 @@ public static function hash($value) { $hash = substr(base64_encode(hash('sha256', serialize($value), true)), 0, 7); - return str_replace(array('/', '+'), array('.', '_'), strtolower($hash)); + return str_replace(['/', '+'], ['.', '_'], strtolower($hash)); } /** @@ -1584,20 +1594,6 @@ protected function getEnv($name) } } - /** - * Retrieves the currently set proxy instantiator or instantiates one. - * - * @return InstantiatorInterface - */ - private function getProxyInstantiator() - { - if (!$this->proxyInstantiator) { - $this->proxyInstantiator = new RealServiceInstantiator(); - } - - return $this->proxyInstantiator; - } - private function callMethod($service, $call, array &$inlineServices) { foreach (self::getServiceConditionals($call[1]) as $s) { @@ -1611,7 +1607,7 @@ private function callMethod($service, $call, array &$inlineServices) } } - \call_user_func_array(array($service, $call[0]), $this->doResolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1])), $inlineServices)); + \call_user_func_array([$service, $call[0]], $this->doResolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1])), $inlineServices)); } /** @@ -1627,7 +1623,7 @@ private function shareService(Definition $definition, $service, $id, array &$inl if (null !== $id && $definition->isShared()) { $this->services[$id] = $service; - unset($this->loading[$id], $this->alreadyLoading[$id]); + unset($this->loading[$id]); } } diff --git a/vendor/symfony/dependency-injection/Definition.php b/vendor/symfony/dependency-injection/Definition.php index 2740098f8b65cac9d229293ce5c5a53e0bb7de17..ee58034713b0bf62a00dffa9d7e842708da49f16 100644 --- a/vendor/symfony/dependency-injection/Definition.php +++ b/vendor/symfony/dependency-injection/Definition.php @@ -28,12 +28,12 @@ class Definition private $shared = true; private $deprecated = false; private $deprecationTemplate; - private $properties = array(); - private $calls = array(); - private $instanceof = array(); + private $properties = []; + private $calls = []; + private $instanceof = []; private $autoconfigured = false; private $configurator; - private $tags = array(); + private $tags = []; private $public = true; private $private = true; private $synthetic = false; @@ -41,12 +41,12 @@ class Definition private $lazy = false; private $decoratedService; private $autowired = false; - private $autowiringTypes = array(); - private $changes = array(); - private $bindings = array(); - private $errors = array(); + private $autowiringTypes = []; + private $changes = []; + private $bindings = []; + private $errors = []; - protected $arguments = array(); + protected $arguments = []; private static $defaultDeprecationTemplate = 'The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.'; @@ -54,7 +54,7 @@ class Definition * @param string|null $class The service class * @param array $arguments An array of arguments to pass to the service constructor */ - public function __construct($class = null, array $arguments = array()) + public function __construct($class = null, array $arguments = []) { if (null !== $class) { $this->setClass($class); @@ -109,7 +109,7 @@ public function setFactory($factory) /** * Gets the factory. * - * @return string|array The PHP function or an array containing a class/Reference and a method to call + * @return string|array|null The PHP function or an array containing a class/Reference and a method to call */ public function getFactory() { @@ -119,8 +119,8 @@ public function getFactory() /** * Sets the service that this service is decorating. * - * @param null|string $id The decorated service id, use null to remove decoration - * @param null|string $renamedId The new decorated service id + * @param string|null $id The decorated service id, use null to remove decoration + * @param string|null $renamedId The new decorated service id * @param int $priority The priority of decoration * * @return $this @@ -138,7 +138,7 @@ public function setDecoratedService($id, $renamedId = null, $priority = 0) if (null === $id) { $this->decoratedService = null; } else { - $this->decoratedService = array($id, $renamedId, (int) $priority); + $this->decoratedService = [$id, $renamedId, (int) $priority]; } return $this; @@ -147,7 +147,7 @@ public function setDecoratedService($id, $renamedId = null, $priority = 0) /** * Gets the service that this service is decorating. * - * @return null|array An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated + * @return array|null An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated */ public function getDecoratedService() { @@ -263,7 +263,7 @@ public function replaceArgument($index, $argument) throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, \count($this->arguments) - 1)); } - if (!array_key_exists($index, $this->arguments)) { + if (!\array_key_exists($index, $this->arguments)) { throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist.', $index)); } @@ -308,7 +308,7 @@ public function getArguments() */ public function getArgument($index) { - if (!array_key_exists($index, $this->arguments)) { + if (!\array_key_exists($index, $this->arguments)) { throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist.', $index)); } @@ -320,9 +320,9 @@ public function getArgument($index) * * @return $this */ - public function setMethodCalls(array $calls = array()) + public function setMethodCalls(array $calls = []) { - $this->calls = array(); + $this->calls = []; foreach ($calls as $call) { $this->addMethodCall($call[0], $call[1]); } @@ -340,12 +340,12 @@ public function setMethodCalls(array $calls = array()) * * @throws InvalidArgumentException on empty $method param */ - public function addMethodCall($method, array $arguments = array()) + public function addMethodCall($method, array $arguments = []) { if (empty($method)) { throw new InvalidArgumentException('Method name cannot be empty.'); } - $this->calls[] = array($method, $arguments); + $this->calls[] = [$method, $arguments]; return $this; } @@ -400,7 +400,7 @@ public function getMethodCalls() /** * Sets the definition templates to conditionally apply on the current definition, keyed by parent interface/class. * - * @param $instanceof ChildDefinition[] + * @param ChildDefinition[] $instanceof * * @return $this */ @@ -476,7 +476,7 @@ public function getTags() */ public function getTag($name) { - return isset($this->tags[$name]) ? $this->tags[$name] : array(); + return isset($this->tags[$name]) ? $this->tags[$name] : []; } /** @@ -487,7 +487,7 @@ public function getTag($name) * * @return $this */ - public function addTag($name, array $attributes = array()) + public function addTag($name, array $attributes = []) { $this->tags[$name][] = $attributes; @@ -527,7 +527,7 @@ public function clearTag($name) */ public function clearTags() { - $this->tags = array(); + $this->tags = []; return $this; } @@ -816,7 +816,7 @@ public function setAutowiringTypes(array $types) { @trigger_error('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead.', E_USER_DEPRECATED); - $this->autowiringTypes = array(); + $this->autowiringTypes = []; foreach ($types as $type) { $this->autowiringTypes[$type] = true; diff --git a/vendor/symfony/dependency-injection/Dumper/DumperInterface.php b/vendor/symfony/dependency-injection/Dumper/DumperInterface.php index dd001e4ed080c4441bf25b3af568b325ba0088b2..1ea775ddfe032340fd56091bd02675520d230ac7 100644 --- a/vendor/symfony/dependency-injection/Dumper/DumperInterface.php +++ b/vendor/symfony/dependency-injection/Dumper/DumperInterface.php @@ -25,5 +25,5 @@ interface DumperInterface * * @return string The representation of the service container */ - public function dump(array $options = array()); + public function dump(array $options = []); } diff --git a/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php b/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php index 9a087991c827241597e9eee3c7c7a5437b9bf7d2..f06e6e80d50317b251805e23fc79fc67a430cf06 100644 --- a/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php @@ -32,14 +32,14 @@ class GraphvizDumper extends Dumper { private $nodes; private $edges; - private $options = array( - 'graph' => array('ratio' => 'compress'), - 'node' => array('fontsize' => 11, 'fontname' => 'Arial', 'shape' => 'record'), - 'edge' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => 'grey', 'arrowhead' => 'open', 'arrowsize' => 0.5), - 'node.instance' => array('fillcolor' => '#9999ff', 'style' => 'filled'), - 'node.definition' => array('fillcolor' => '#eeeeee'), - 'node.missing' => array('fillcolor' => '#ff9999', 'style' => 'filled'), - ); + private $options = [ + 'graph' => ['ratio' => 'compress'], + 'node' => ['fontsize' => 11, 'fontname' => 'Arial', 'shape' => 'record'], + 'edge' => ['fontsize' => 9, 'fontname' => 'Arial', 'color' => 'grey', 'arrowhead' => 'open', 'arrowsize' => 0.5], + 'node.instance' => ['fillcolor' => '#9999ff', 'style' => 'filled'], + 'node.definition' => ['fillcolor' => '#eeeeee'], + 'node.missing' => ['fillcolor' => '#ff9999', 'style' => 'filled'], + ]; /** * Dumps the service container as a graphviz graph. @@ -55,9 +55,9 @@ class GraphvizDumper extends Dumper * * @return string The dot representation of the service container */ - public function dump(array $options = array()) + public function dump(array $options = []) { - foreach (array('graph', 'node', 'edge', 'node.instance', 'node.definition', 'node.missing') as $key) { + foreach (['graph', 'node', 'edge', 'node.instance', 'node.definition', 'node.missing'] as $key) { if (isset($options[$key])) { $this->options[$key] = array_merge($this->options[$key], $options[$key]); } @@ -65,7 +65,7 @@ public function dump(array $options = array()) $this->nodes = $this->findNodes(); - $this->edges = array(); + $this->edges = []; foreach ($this->container->getDefinitions() as $id => $definition) { $this->edges[$id] = array_merge( $this->findEdges($id, $definition->getArguments(), true, ''), @@ -129,7 +129,7 @@ private function addEdges() */ private function findEdges($id, array $arguments, $required, $name, $lazy = false) { - $edges = array(); + $edges = []; foreach ($arguments as $argument) { if ($argument instanceof Parameter) { $argument = $this->container->hasParameter($argument) ? $this->container->getParameter($argument) : null; @@ -141,14 +141,22 @@ private function findEdges($id, array $arguments, $required, $name, $lazy = fals $lazyEdge = $lazy; if (!$this->container->has((string) $argument)) { - $this->nodes[(string) $argument] = array('name' => $name, 'required' => $required, 'class' => '', 'attributes' => $this->options['node.missing']); + $this->nodes[(string) $argument] = ['name' => $name, 'required' => $required, 'class' => '', 'attributes' => $this->options['node.missing']]; } elseif ('service_container' !== (string) $argument) { $lazyEdge = $lazy || $this->container->getDefinition((string) $argument)->isLazy(); } - $edges[] = array('name' => $name, 'required' => $required, 'to' => $argument, 'lazy' => $lazyEdge); + $edges[] = ['name' => $name, 'required' => $required, 'to' => $argument, 'lazy' => $lazyEdge]; } elseif ($argument instanceof ArgumentInterface) { $edges = array_merge($edges, $this->findEdges($id, $argument->getValues(), $required, $name, true)); + } elseif ($argument instanceof Definition) { + $edges = array_merge($edges, + $this->findEdges($id, $argument->getArguments(), $required, ''), + $this->findEdges($id, $argument->getProperties(), false, '') + ); + foreach ($argument->getMethodCalls() as $call) { + $edges = array_merge($edges, $this->findEdges($id, $call[1], false, $call[0].'()')); + } } elseif (\is_array($argument)) { $edges = array_merge($edges, $this->findEdges($id, $argument, $required, $name, $lazy)); } @@ -164,7 +172,7 @@ private function findEdges($id, array $arguments, $required, $name, $lazy = fals */ private function findNodes() { - $nodes = array(); + $nodes = []; $container = $this->cloneContainer(); @@ -180,17 +188,17 @@ private function findNodes() } catch (ParameterNotFoundException $e) { } - $nodes[$id] = array('class' => str_replace('\\', '\\\\', $class), 'attributes' => array_merge($this->options['node.definition'], array('style' => $definition->isShared() ? 'filled' : 'dotted'))); + $nodes[$id] = ['class' => str_replace('\\', '\\\\', $class), 'attributes' => array_merge($this->options['node.definition'], ['style' => $definition->isShared() ? 'filled' : 'dotted'])]; $container->setDefinition($id, new Definition('stdClass')); } foreach ($container->getServiceIds() as $id) { - if (array_key_exists($id, $container->getAliases())) { + if (\array_key_exists($id, $container->getAliases())) { continue; } if (!$container->hasDefinition($id)) { - $nodes[$id] = array('class' => str_replace('\\', '\\\\', \get_class($container->get($id))), 'attributes' => $this->options['node.instance']); + $nodes[$id] = ['class' => str_replace('\\', '\\\\', \get_class($container->get($id))), 'attributes' => $this->options['node.instance']]; } } @@ -245,7 +253,7 @@ private function endDot() */ private function addAttributes(array $attributes) { - $code = array(); + $code = []; foreach ($attributes as $k => $v) { $code[] = sprintf('%s="%s"', $k, $v); } @@ -262,7 +270,7 @@ private function addAttributes(array $attributes) */ private function addOptions(array $options) { - $code = array(); + $code = []; foreach ($options as $k => $v) { $code[] = sprintf('%s="%s"', $k, $v); } @@ -291,7 +299,7 @@ private function dotize($id) */ private function getAliases($id) { - $aliases = array(); + $aliases = []; foreach ($this->container->getAliases() as $alias => $origin) { if ($id == $origin) { $aliases[] = $alias; diff --git a/vendor/symfony/dependency-injection/Dumper/PhpDumper.php b/vendor/symfony/dependency-injection/Dumper/PhpDumper.php index 71e776310b270b0bf4c54ed6abadc86478d82653..0a1385ecc4a0afc984b4014385aed43e68694c96 100644 --- a/vendor/symfony/dependency-injection/Dumper/PhpDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/PhpDumper.php @@ -15,6 +15,7 @@ use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; +use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -54,7 +55,9 @@ class PhpDumper extends Dumper private $definitionVariables; private $referenceVariables; private $variableCount; - private $reservedVariables = array('instance', 'class'); + private $inlinedDefinitions; + private $serviceCalls; + private $reservedVariables = ['instance', 'class', 'this']; private $expressionLanguage; private $targetDirRegex; private $targetDirMaxMatches; @@ -65,8 +68,8 @@ class PhpDumper extends Dumper private $asFiles; private $hotPathTag; private $inlineRequires; - private $inlinedRequires = array(); - private $circularReferences = array(); + private $inlinedRequires = []; + private $circularReferences = []; /** * @var ProxyDumper @@ -107,11 +110,11 @@ public function setProxyDumper(ProxyDumper $proxyDumper) * * @throws EnvParameterException When an env var exists but has not been dumped */ - public function dump(array $options = array()) + public function dump(array $options = []) { $this->targetDirRegex = null; - $this->inlinedRequires = array(); - $options = array_merge(array( + $this->inlinedRequires = []; + $options = array_merge([ 'class' => 'ProjectServiceContainer', 'base_class' => 'Container', 'namespace' => '', @@ -120,7 +123,7 @@ public function dump(array $options = array()) 'hot_path_tag' => 'container.hot_path', 'inline_class_loader_parameter' => 'container.dumper.inline_class_loader', 'build_time' => time(), - ), $options); + ], $options); $this->namespace = $options['namespace']; $this->asFiles = $options['as_files']; @@ -138,14 +141,32 @@ public function dump(array $options = array()) $this->initializeMethodNamesMap('Container' === $baseClass ? Container::class : $baseClass); - (new AnalyzeServiceReferencesPass())->process($this->container); - $this->circularReferences = array(); - $checkedNodes = array(); + if ($this->getProxyDumper() instanceof NullDumper) { + (new AnalyzeServiceReferencesPass(true, false))->process($this->container); + try { + (new CheckCircularReferencesPass())->process($this->container); + } catch (ServiceCircularReferenceException $e) { + $path = $e->getPath(); + end($path); + $path[key($path)] .= '". Try running "composer require symfony/proxy-manager-bridge'; + + throw new ServiceCircularReferenceException($e->getServiceId(), $path); + } + } + + (new AnalyzeServiceReferencesPass(false, !$this->getProxyDumper() instanceof NullDumper))->process($this->container); + $checkedNodes = []; + $this->circularReferences = []; foreach ($this->container->getCompiler()->getServiceReferenceGraph()->getNodes() as $id => $node) { - $currentPath = array($id => $id); - $this->analyzeCircularReferences($node->getOutEdges(), $checkedNodes, $currentPath); + if (!$node->getValue() instanceof Definition) { + continue; + } + if (!isset($checkedNodes[$id])) { + $this->analyzeCircularReferences($id, $node->getOutEdges(), $checkedNodes); + } } $this->container->getCompiler()->getServiceReferenceGraph()->clear(); + $checkedNodes = []; $this->docStar = $options['debug'] ? '*' : ''; @@ -190,15 +211,15 @@ public function dump(array $options = array()) // This file has been auto-generated by the Symfony Dependency Injection Component for internal use. EOF; - $files = array(); + $files = []; if ($ids = array_keys($this->container->getRemovedIds())) { sort($ids); - $c = "<?php\n\nreturn array(\n"; + $c = "<?php\n\nreturn [\n"; foreach ($ids as $id) { $c .= ' '.$this->doExport($id)." => true,\n"; } - $files['removed-ids.php'] = $c .= ");\n"; + $files['removed-ids.php'] = $c .= "];\n"; } foreach ($this->generateServiceFiles() as $file => $c) { @@ -209,7 +230,7 @@ public function dump(array $options = array()) } $files[$options['class'].'.php'] = $code; $hash = ucfirst(strtr(ContainerBuilder::hash($files), '._', 'xx')); - $code = array(); + $code = []; foreach ($files as $file => $c) { $code["Container{$hash}/{$file}"] = $c; @@ -237,11 +258,11 @@ public function dump(array $options = array()) \\class_alias(\\Container{$hash}\\{$options['class']}::class, {$options['class']}::class, false); } -return new \\Container{$hash}\\{$options['class']}(array( +return new \\Container{$hash}\\{$options['class']}([ 'container.build_hash' => '$hash', 'container.build_id' => '$id', 'container.build_time' => $time, -), __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}'); +], __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}'); EOF; } else { @@ -251,10 +272,10 @@ public function dump(array $options = array()) } $this->targetDirRegex = null; - $this->inlinedRequires = array(); - $this->circularReferences = array(); + $this->inlinedRequires = []; + $this->circularReferences = []; - $unusedEnvs = array(); + $unusedEnvs = []; foreach ($this->container->getEnvCounters() as $env => $use) { if (!$use) { $unusedEnvs[] = $env; @@ -281,86 +302,56 @@ private function getProxyDumper() return $this->proxyDumper; } - /** - * Generates Service local temp variables. - * - * @return string - */ - private function addServiceLocalTempVariables($cId, Definition $definition, \SplObjectStorage $inlinedDefinitions, \SplObjectStorage $allInlinedDefinitions) + private function analyzeCircularReferences($sourceId, array $edges, &$checkedNodes, &$currentPath = []) { - $allCalls = $calls = $behavior = array(); - - foreach ($allInlinedDefinitions as $def) { - $arguments = array($def->getArguments(), $def->getFactory(), $def->getProperties(), $def->getMethodCalls(), $def->getConfigurator()); - $this->getServiceCallsFromArguments($arguments, $allCalls, false, $cId, $behavior, $allInlinedDefinitions[$def]); - } - - $isPreInstance = isset($inlinedDefinitions[$definition]) && isset($this->circularReferences[$cId]) && !$this->getProxyDumper()->isProxyCandidate($definition) && $definition->isShared(); - foreach ($inlinedDefinitions as $def) { - $this->getServiceCallsFromArguments(array($def->getArguments(), $def->getFactory()), $calls, $isPreInstance, $cId); - if ($def !== $definition) { - $arguments = array($def->getProperties(), $def->getMethodCalls(), $def->getConfigurator()); - $this->getServiceCallsFromArguments($arguments, $calls, $isPreInstance && !$this->hasReference($cId, $arguments, true), $cId); - } - } - if (!isset($inlinedDefinitions[$definition])) { - $arguments = array($definition->getProperties(), $definition->getMethodCalls(), $definition->getConfigurator()); - $this->getServiceCallsFromArguments($arguments, $calls, false, $cId); - } + $checkedNodes[$sourceId] = true; + $currentPath[$sourceId] = $sourceId; - $code = ''; - foreach ($calls as $id => $callCount) { - if ('service_container' === $id || $id === $cId || isset($this->referenceVariables[$id])) { - continue; - } - if ($callCount <= 1 && $allCalls[$id] <= 1) { - continue; - } - - $name = $this->getNextVariableName(); - $this->referenceVariables[$id] = new Variable($name); - - $reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $behavior[$id] ? new Reference($id, $behavior[$id]) : null; - $code .= sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($id, $reference)); - } - - if ('' !== $code) { - if ($isPreInstance) { - $code .= <<<EOTXT - - if (isset(\$this->services['$cId'])) { - return \$this->services['$cId']; - } - -EOTXT; - } - - $code .= "\n"; - } - - return $code; - } - - private function analyzeCircularReferences(array $edges, &$checkedNodes, &$currentPath) - { foreach ($edges as $edge) { $node = $edge->getDestNode(); $id = $node->getId(); - if ($node->getValue() && ($edge->isLazy() || $edge->isWeak())) { + if (!$node->getValue() instanceof Definition || $sourceId === $id || $edge->isLazy() || $edge->isWeak()) { // no-op } elseif (isset($currentPath[$id])) { + $currentId = $id; foreach (array_reverse($currentPath) as $parentId) { - $this->circularReferences[$parentId][$id] = $id; - $id = $parentId; + $this->circularReferences[$parentId][$currentId] = $currentId; + if ($parentId === $id) { + break; + } + $currentId = $parentId; } } elseif (!isset($checkedNodes[$id])) { - $checkedNodes[$id] = true; - $currentPath[$id] = $id; - $this->analyzeCircularReferences($node->getOutEdges(), $checkedNodes, $currentPath); - unset($currentPath[$id]); + $this->analyzeCircularReferences($id, $node->getOutEdges(), $checkedNodes, $currentPath); + } elseif (isset($this->circularReferences[$id])) { + $this->connectCircularReferences($id, $currentPath); } } + unset($currentPath[$sourceId]); + } + + private function connectCircularReferences($sourceId, &$currentPath, &$subPath = []) + { + $subPath[$sourceId] = $sourceId; + $currentPath[$sourceId] = $sourceId; + + foreach ($this->circularReferences[$sourceId] as $id) { + if (isset($currentPath[$id])) { + $currentId = $id; + foreach (array_reverse($currentPath) as $parentId) { + $this->circularReferences[$parentId][$currentId] = $currentId; + if ($parentId === $id) { + break; + } + $currentId = $parentId; + } + } elseif (!isset($subPath[$id]) && isset($this->circularReferences[$id])) { + $this->connectCircularReferences($id, $currentPath, $subPath); + } + } + unset($currentPath[$sourceId]); + unset($subPath[$sourceId]); } private function collectLineage($class, array &$lineage) @@ -396,7 +387,7 @@ private function collectLineage($class, array &$lineage) private function generateProxyClasses() { - $alreadyGenerated = array(); + $alreadyGenerated = []; $definitions = $this->container->getDefinitions(); $strip = '' === $this->docStar && method_exists('Symfony\Component\HttpKernel\Kernel', 'stripComments'); $proxyDumper = $this->getProxyDumper(); @@ -411,7 +402,9 @@ private function generateProxyClasses() $alreadyGenerated[$class] = true; // register class' reflector for resource tracking $this->container->getReflectionClass($class); - $proxyCode = "\n".$proxyDumper->getProxyCode($definition); + if ("\n" === $proxyCode = "\n".$proxyDumper->getProxyCode($definition)) { + continue; + } if ($strip) { $proxyCode = "<?php\n".$proxyCode; $proxyCode = substr(Kernel::stripComments($proxyCode), 5); @@ -425,23 +418,21 @@ private function generateProxyClasses() * * @return string */ - private function addServiceInclude($cId, Definition $definition, \SplObjectStorage $inlinedDefinitions) + private function addServiceInclude($cId, Definition $definition) { $code = ''; if ($this->inlineRequires && !$this->isHotPath($definition)) { - $lineage = $calls = $behavior = array(); - foreach ($inlinedDefinitions as $def) { + $lineage = []; + foreach ($this->inlinedDefinitions as $def) { if (!$def->isDeprecated() && \is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass())) { $this->collectLineage($class, $lineage); } - $arguments = array($def->getArguments(), $def->getFactory(), $def->getProperties(), $def->getMethodCalls(), $def->getConfigurator()); - $this->getServiceCallsFromArguments($arguments, $calls, false, $cId, $behavior, $inlinedDefinitions[$def]); } - foreach ($calls as $id => $callCount) { + foreach ($this->serviceCalls as $id => list($callCount, $behavior)) { if ('service_container' !== $id && $id !== $cId - && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE !== $behavior[$id] + && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE !== $behavior && $this->container->has($id) && $this->isTrivialInstance($def = $this->container->findDefinition($id)) && \is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass()) @@ -455,7 +446,7 @@ private function addServiceInclude($cId, Definition $definition, \SplObjectStora } } - foreach ($inlinedDefinitions as $def) { + foreach ($this->inlinedDefinitions as $def) { if ($file = $def->getFile()) { $code .= sprintf(" include_once %s;\n", $this->dumpValue($file)); } @@ -468,59 +459,6 @@ private function addServiceInclude($cId, Definition $definition, \SplObjectStora return $code; } - /** - * Generates the inline definition of a service. - * - * @return string - * - * @throws RuntimeException When the factory definition is incomplete - * @throws ServiceCircularReferenceException When a circular reference is detected - */ - private function addServiceInlinedDefinitions($id, Definition $definition, \SplObjectStorage $inlinedDefinitions, &$isSimpleInstance) - { - $code = ''; - - foreach ($inlinedDefinitions as $def) { - if ($definition === $def) { - continue; - } - if ($inlinedDefinitions[$def] <= 1 && !$def->getMethodCalls() && !$def->getProperties() && !$def->getConfigurator() && false === strpos($this->dumpValue($def->getClass()), '$')) { - continue; - } - if (isset($this->definitionVariables[$def])) { - $name = $this->definitionVariables[$def]; - } else { - $name = $this->getNextVariableName(); - $this->definitionVariables[$def] = new Variable($name); - } - - // a construct like: - // $a = new ServiceA(ServiceB $b); $b = new ServiceB(ServiceA $a); - // this is an indication for a wrong implementation, you can circumvent this problem - // by setting up your service structure like this: - // $b = new ServiceB(); - // $a = new ServiceA(ServiceB $b); - // $b->setServiceA(ServiceA $a); - if (isset($inlinedDefinitions[$definition]) && $this->hasReference($id, array($def->getArguments(), $def->getFactory()))) { - throw new ServiceCircularReferenceException($id, array($id)); - } - - $code .= $this->addNewInstance($def, '$'.$name, ' = ', $id); - - if (!$this->hasReference($id, array($def->getProperties(), $def->getMethodCalls(), $def->getConfigurator()), true)) { - $code .= $this->addServiceProperties($def, $name); - $code .= $this->addServiceMethodCalls($def, $name); - $code .= $this->addServiceConfigurator($def, $name); - } else { - $isSimpleInstance = false; - } - - $code .= "\n"; - } - - return $code; - } - /** * Generates the service instance. * @@ -557,13 +495,7 @@ private function addServiceInstance($id, Definition $definition, $isSimpleInstan $instantiation .= ' = '; } - $code = $this->addNewInstance($definition, $return, $instantiation, $id); - - if (!$isSimpleInstance) { - $code .= "\n"; - } - - return $code; + return $this->addNewInstance($definition, $return, $instantiation, $id); } /** @@ -608,10 +540,6 @@ private function isTrivialInstance(Definition $definition) } } - if (false !== strpos($this->dumpLiteralClass($this->dumpValue($definition->getClass())), '$')) { - return false; - } - return true; } @@ -627,7 +555,7 @@ private function addServiceMethodCalls(Definition $definition, $variableName = ' { $calls = ''; foreach ($definition->getMethodCalls() as $call) { - $arguments = array(); + $arguments = []; foreach ($call[1] as $value) { $arguments[] = $this->dumpValue($value); } @@ -648,42 +576,6 @@ private function addServiceProperties(Definition $definition, $variableName = 'i return $code; } - /** - * Generates the inline definition setup. - * - * @return string - * - * @throws ServiceCircularReferenceException when the container contains a circular reference - */ - private function addServiceInlinedDefinitionsSetup($id, Definition $definition, \SplObjectStorage $inlinedDefinitions, $isSimpleInstance) - { - $this->referenceVariables[$id] = new Variable('instance'); - - $code = ''; - foreach ($inlinedDefinitions as $def) { - if ($definition === $def || !$this->hasReference($id, array($def->getProperties(), $def->getMethodCalls(), $def->getConfigurator()), true)) { - continue; - } - - // if the instance is simple, the return statement has already been generated - // so, the only possible way to get there is because of a circular reference - if ($isSimpleInstance) { - throw new ServiceCircularReferenceException($id, array($id)); - } - - $name = (string) $this->definitionVariables[$def]; - $code .= $this->addServiceProperties($def, $name); - $code .= $this->addServiceMethodCalls($def, $name); - $code .= $this->addServiceConfigurator($def, $name); - } - - if ('' !== $code && ($definition->getProperties() || $definition->getMethodCalls() || $definition->getConfigurator())) { - $code .= "\n"; - } - - return $code; - } - /** * Adds configurator definition. * @@ -700,7 +592,8 @@ private function addServiceConfigurator(Definition $definition, $variableName = if (\is_array($callable)) { if ($callable[0] instanceof Reference - || ($callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0]))) { + || ($callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0])) + ) { return sprintf(" %s->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } @@ -714,7 +607,7 @@ private function addServiceConfigurator(Definition $definition, $variableName = return sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } - return sprintf(" \\call_user_func(array(%s, '%s'), \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); + return sprintf(" \\call_user_func([%s, '%s'], \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } return sprintf(" %s(\$%s);\n", $callable, $variableName); @@ -732,24 +625,23 @@ private function addServiceConfigurator(Definition $definition, $variableName = private function addService($id, Definition $definition, &$file = null) { $this->definitionVariables = new \SplObjectStorage(); - $this->referenceVariables = array(); + $this->referenceVariables = []; $this->variableCount = 0; + $this->referenceVariables[$id] = new Variable('instance'); - $return = array(); + $return = []; if ($class = $definition->getClass()) { - $class = $this->container->resolveEnvPlaceholders($class); + $class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class); $return[] = sprintf(0 === strpos($class, '%') ? '@return object A %1$s instance' : '@return \%s', ltrim($class, '\\')); } elseif ($definition->getFactory()) { $factory = $definition->getFactory(); if (\is_string($factory)) { $return[] = sprintf('@return object An instance returned by %s()', $factory); } elseif (\is_array($factory) && (\is_string($factory[0]) || $factory[0] instanceof Definition || $factory[0] instanceof Reference)) { - if (\is_string($factory[0]) || $factory[0] instanceof Reference) { - $return[] = sprintf('@return object An instance returned by %s::%s()', (string) $factory[0], $factory[1]); - } elseif ($factory[0] instanceof Definition) { - $return[] = sprintf('@return object An instance returned by %s::%s()', $factory[0]->getClass(), $factory[1]); - } + $class = $factory[0] instanceof Definition ? $factory[0]->getClass() : (string) $factory[0]; + $class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class); + $return[] = sprintf('@return object An instance returned by %s::%s()', $class, $factory[1]); } } @@ -769,6 +661,7 @@ private function addService($id, Definition $definition, &$file = null) $autowired = $definition->isAutowired() ? ' autowired' : ''; if ($definition->isLazy()) { + unset($this->circularReferences[$id]); $lazyInitialization = '$lazyLoad = true'; } else { $lazyInitialization = ''; @@ -793,6 +686,11 @@ protected function {$methodName}($lazyInitialization) EOF; } + $this->serviceCalls = []; + $this->inlinedDefinitions = $this->getDefinitionsFromArguments([$definition], null, $this->serviceCalls); + + $code .= $this->addServiceInclude($id, $definition); + if ($this->getProxyDumper()->isProxyCandidate($definition)) { $factoryCode = $asFile ? "\$this->load('%s.php', false)" : '$this->%s(false)'; $code .= $this->getProxyDumper()->getProxyFactoryCode($definition, $id, sprintf($factoryCode, $methodName)); @@ -802,42 +700,131 @@ protected function {$methodName}($lazyInitialization) $code .= sprintf(" @trigger_error(%s, E_USER_DEPRECATED);\n\n", $this->export($definition->getDeprecationMessage($id))); } - $inlinedDefinitions = $this->getDefinitionsFromArguments(array($definition)); - $constructorDefinitions = $this->getDefinitionsFromArguments(array($definition->getArguments(), $definition->getFactory())); - $otherDefinitions = new \SplObjectStorage(); + $code .= $this->addInlineService($id, $definition); - foreach ($inlinedDefinitions as $def) { - if ($def === $definition || isset($constructorDefinitions[$def])) { - $constructorDefinitions[$def] = $inlinedDefinitions[$def]; - } else { - $otherDefinitions[$def] = $inlinedDefinitions[$def]; + if ($asFile) { + $code = implode("\n", array_map(function ($line) { return $line ? substr($line, 8) : $line; }, explode("\n", $code))); + } else { + $code .= " }\n"; + } + + $this->definitionVariables = $this->inlinedDefinitions = null; + $this->referenceVariables = $this->serviceCalls = null; + + return $code; + } + + private function addInlineVariables($id, Definition $definition, array $arguments, $forConstructor) + { + $code = ''; + + foreach ($arguments as $argument) { + if (\is_array($argument)) { + $code .= $this->addInlineVariables($id, $definition, $argument, $forConstructor); + } elseif ($argument instanceof Reference) { + $code .= $this->addInlineReference($id, $definition, $this->container->normalizeId($argument), $forConstructor); + } elseif ($argument instanceof Definition) { + $code .= $this->addInlineService($id, $definition, $argument, $forConstructor); } } - $isSimpleInstance = !$definition->getProperties() && !$definition->getMethodCalls() && !$definition->getConfigurator(); + return $code; + } + + private function addInlineReference($id, Definition $definition, $targetId, $forConstructor) + { + list($callCount, $behavior) = $this->serviceCalls[$targetId]; + + while ($this->container->hasAlias($targetId)) { + $targetId = (string) $this->container->getAlias($targetId); + } + + if ($id === $targetId) { + return $this->addInlineService($id, $definition, $definition); + } - $code .= - $this->addServiceInclude($id, $definition, $inlinedDefinitions). - $this->addServiceLocalTempVariables($id, $definition, $constructorDefinitions, $inlinedDefinitions). - $this->addServiceInlinedDefinitions($id, $definition, $constructorDefinitions, $isSimpleInstance). - $this->addServiceInstance($id, $definition, $isSimpleInstance). - $this->addServiceLocalTempVariables($id, $definition, $otherDefinitions, $inlinedDefinitions). - $this->addServiceInlinedDefinitions($id, $definition, $otherDefinitions, $isSimpleInstance). - $this->addServiceInlinedDefinitionsSetup($id, $definition, $inlinedDefinitions, $isSimpleInstance). - $this->addServiceProperties($definition). - $this->addServiceMethodCalls($definition). - $this->addServiceConfigurator($definition). - (!$isSimpleInstance ? "\n return \$instance;\n" : '') - ; + if ('service_container' === $targetId || isset($this->referenceVariables[$targetId])) { + return ''; + } - if ($asFile) { - $code = implode("\n", array_map(function ($line) { return $line ? substr($line, 8) : $line; }, explode("\n", $code))); + $hasSelfRef = isset($this->circularReferences[$id][$targetId]); + $forConstructor = $forConstructor && !isset($this->definitionVariables[$definition]); + $code = $hasSelfRef && !$forConstructor ? $this->addInlineService($id, $definition, $definition) : ''; + + if (isset($this->referenceVariables[$targetId]) || (2 > $callCount && (!$hasSelfRef || !$forConstructor))) { + return $code; + } + + $name = $this->getNextVariableName(); + $this->referenceVariables[$targetId] = new Variable($name); + + $reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $behavior ? new Reference($targetId, $behavior) : null; + $code .= sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference)); + + if (!$hasSelfRef || !$forConstructor) { + return $code; + } + + $code .= sprintf(<<<'EOTXT' + + if (isset($this->%s['%s'])) { + return $this->%1$s['%2$s']; + } + +EOTXT + , + 'services', + $id + ); + + return $code; + } + + private function addInlineService($id, Definition $definition, Definition $inlineDef = null, $forConstructor = true) + { + $isSimpleInstance = $isRootInstance = null === $inlineDef; + + if (isset($this->definitionVariables[$inlineDef = $inlineDef ?: $definition])) { + return ''; + } + + $arguments = [$inlineDef->getArguments(), $inlineDef->getFactory()]; + + $code = $this->addInlineVariables($id, $definition, $arguments, $forConstructor); + + if ($arguments = array_filter([$inlineDef->getProperties(), $inlineDef->getMethodCalls(), $inlineDef->getConfigurator()])) { + $isSimpleInstance = false; + } elseif ($definition !== $inlineDef && 2 > $this->inlinedDefinitions[$inlineDef]) { + return $code; + } + + if (isset($this->definitionVariables[$inlineDef])) { + $isSimpleInstance = false; } else { - $code .= " }\n"; + $name = $definition === $inlineDef ? 'instance' : $this->getNextVariableName(); + $this->definitionVariables[$inlineDef] = new Variable($name); + $code .= '' !== $code ? "\n" : ''; + + if ('instance' === $name) { + $code .= $this->addServiceInstance($id, $definition, $isSimpleInstance); + } else { + $code .= $this->addNewInstance($inlineDef, '$'.$name, ' = ', $id); + } + + if ('' !== $inline = $this->addInlineVariables($id, $definition, $arguments, false)) { + $code .= "\n".$inline."\n"; + } elseif ($arguments && 'instance' === $name) { + $code .= "\n"; + } + + $code .= $this->addServiceProperties($inlineDef, $name); + $code .= $this->addServiceMethodCalls($inlineDef, $name); + $code .= $this->addServiceConfigurator($inlineDef, $name); } - $this->definitionVariables = null; - $this->referenceVariables = null; + if ($isRootInstance && !$isSimpleInstance) { + $code .= "\n return \$instance;\n"; + } return $code; } @@ -883,7 +870,7 @@ private function addNewInstance(Definition $definition, $return, $instantiation, $class = $this->dumpValue($definition->getClass()); $return = ' '.$return.$instantiation; - $arguments = array(); + $arguments = []; foreach ($definition->getArguments() as $value) { $arguments[] = $this->dumpValue($value); } @@ -914,7 +901,7 @@ private function addNewInstance(Definition $definition, $return, $instantiation, return $return.sprintf("(%s)->%s(%s);\n", $class, $callable[1], $arguments ? implode(', ', $arguments) : ''); } - return $return.sprintf("\\call_user_func(array(%s, '%s')%s);\n", $class, $callable[1], $arguments ? ', '.implode(', ', $arguments) : ''); + return $return.sprintf("\\call_user_func([%s, '%s']%s);\n", $class, $callable[1], $arguments ? ', '.implode(', ', $arguments) : ''); } return $return.sprintf("%s(%s);\n", $this->dumpLiteralClass($this->dumpValue($callable)), $arguments ? implode(', ', $arguments) : ''); @@ -961,7 +948,7 @@ private function startClass($class, $baseClass, $baseClassWithNamespace) class $class extends $baseClass { private \$parameters; - private \$targetDirs = array(); + private \$targetDirs = []; public function __construct() { @@ -979,7 +966,7 @@ public function __construct() } if ($this->asFiles) { $code = str_replace('$parameters', "\$buildParameters;\n private \$containerDir;\n private \$parameters", $code); - $code = str_replace('__construct()', '__construct(array $buildParameters = array(), $containerDir = __DIR__)', $code); + $code = str_replace('__construct()', '__construct(array $buildParameters = [], $containerDir = __DIR__)', $code); $code .= " \$this->buildParameters = \$buildParameters;\n"; $code .= " \$this->containerDir = \$containerDir;\n"; } @@ -1001,7 +988,7 @@ public function __construct() $code .= " \$this->parameters = \$this->getDefaultParameters();\n\n"; } - $code .= " \$this->services = array();\n"; + $code .= " \$this->services = [];\n"; } else { $arguments = $this->container->getParameterBag()->all() ? 'new ParameterBag($this->getDefaultParameters())' : null; $code .= " parent::__construct($arguments);\n"; @@ -1099,7 +1086,7 @@ private function addNormalizedIds() } } - return $code ? " \$this->normalizedIds = array(\n".$code." );\n" : ''; + return $code ? " \$this->normalizedIds = [\n".$code." ];\n" : ''; } /** @@ -1118,7 +1105,7 @@ private function addSyntheticIds() } } - return $code ? " \$this->syntheticIds = array(\n{$code} );\n" : ''; + return $code ? " \$this->syntheticIds = [\n{$code} ];\n" : ''; } /** @@ -1138,10 +1125,13 @@ private function addRemovedIds() $ids = array_keys($ids); sort($ids); foreach ($ids as $id) { + if (preg_match('/^\d+_[^~]++~[._a-zA-Z\d]{7}$/', $id)) { + continue; + } $code .= ' '.$this->doExport($id)." => true,\n"; } - $code = "array(\n{$code} )"; + $code = "[\n{$code} ]"; } return <<<EOF @@ -1170,7 +1160,7 @@ private function addMethodMap() } } - return $code ? " \$this->methodMap = array(\n{$code} );\n" : ''; + return $code ? " \$this->methodMap = [\n{$code} ];\n" : ''; } /** @@ -1189,7 +1179,7 @@ private function addFileMap() } } - return $code ? " \$this->fileMap = array(\n{$code} );\n" : ''; + return $code ? " \$this->fileMap = [\n{$code} ];\n" : ''; } /** @@ -1221,9 +1211,9 @@ private function addPrivateServices() return ''; } - $out = " \$this->privates = array(\n"; + $out = " \$this->privates = [\n"; $out .= $code; - $out .= " );\n"; + $out .= " ];\n"; return $out; } @@ -1236,10 +1226,10 @@ private function addPrivateServices() private function addAliases() { if (!$aliases = $this->container->getAliases()) { - return $this->container->isCompiled() ? "\n \$this->aliases = array();\n" : ''; + return $this->container->isCompiled() ? "\n \$this->aliases = [];\n" : ''; } - $code = " \$this->aliases = array(\n"; + $code = " \$this->aliases = [\n"; ksort($aliases); foreach ($aliases as $alias => $id) { $id = $this->container->normalizeId($id); @@ -1249,7 +1239,7 @@ private function addAliases() $code .= ' '.$this->doExport($alias).' => '.$this->doExport($id).",\n"; } - return $code." );\n"; + return $code." ];\n"; } private function addInlineRequires() @@ -1258,11 +1248,11 @@ private function addInlineRequires() return ''; } - $lineage = array(); + $lineage = []; foreach ($this->container->findTaggedServiceIds($this->hotPathTag) as $id => $tags) { $definition = $this->container->getDefinition($id); - $inlinedDefinitions = $this->getDefinitionsFromArguments(array($definition)); + $inlinedDefinitions = $this->getDefinitionsFromArguments([$definition]); foreach ($inlinedDefinitions as $def) { if (\is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass())) { @@ -1294,9 +1284,9 @@ private function addDefaultParametersMethod() return ''; } - $php = array(); - $dynamicPhp = array(); - $normalizedParams = array(); + $php = []; + $dynamicPhp = []; + $normalizedParams = []; foreach ($this->container->getParameterBag()->all() as $key => $value) { if ($key !== $resolvedKey = $this->container->resolveEnvPlaceholders($key)) { @@ -1305,8 +1295,8 @@ private function addDefaultParametersMethod() if ($key !== $lcKey = strtolower($key)) { $normalizedParams[] = sprintf(' %s => %s,', $this->export($lcKey), $this->export($key)); } - $export = $this->exportParameters(array($value)); - $export = explode('0 => ', substr(rtrim($export, " )\n"), 7, -1), 2); + $export = $this->exportParameters([$value]); + $export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2); if (preg_match("/\\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDirs\[\d++\])/", $export[1])) { $dynamicPhp[$key] = sprintf('%scase %s: $value = %s; break;', $export[0], $this->export($key), $export[1]); @@ -1314,7 +1304,8 @@ private function addDefaultParametersMethod() $php[] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]); } } - $parameters = sprintf("array(\n%s\n%s)", implode("\n", $php), str_repeat(' ', 8)); + + $parameters = sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', 8)); $code = ''; if ($this->container->isCompiled()) { @@ -1390,19 +1381,19 @@ public function getParameterBag() EOF; $getDynamicParameter = sprintf($getDynamicParameter, implode("\n", $dynamicPhp)); } else { - $loadedDynamicParameters = 'array()'; + $loadedDynamicParameters = '[]'; $getDynamicParameter = str_repeat(' ', 8).'throw new InvalidArgumentException(sprintf(\'The dynamic parameter "%s" must be defined.\', $name));'; } $code .= <<<EOF private \$loadedDynamicParameters = {$loadedDynamicParameters}; - private \$dynamicParameters = array(); + private \$dynamicParameters = []; /*{$this->docStar} * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string \$name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -1416,7 +1407,7 @@ private function getDynamicParameter(\$name) EOF; - $code .= ' private $normalizedParameterNames = '.($normalizedParams ? sprintf("array(\n%s\n );", implode("\n", $normalizedParams)) : 'array();')."\n"; + $code .= ' private $normalizedParameterNames = '.($normalizedParams ? sprintf("[\n%s\n ];", implode("\n", $normalizedParams)) : '[];')."\n"; $code .= <<<'EOF' private function normalizeParameterName($name) @@ -1468,7 +1459,7 @@ protected function getDefaultParameters() */ private function exportParameters(array $parameters, $path = '', $indent = 12) { - $php = array(); + $php = []; foreach ($parameters as $key => $value) { if (\is_array($value)) { $value = $this->exportParameters($value, $path.'/'.$key, $indent + 4); @@ -1489,7 +1480,7 @@ private function exportParameters(array $parameters, $path = '', $indent = 12) $php[] = sprintf('%s%s => %s,', str_repeat(' ', $indent), $this->export($key), $value); } - return sprintf("array(\n%s\n%s)", implode("\n", $php), str_repeat(' ', $indent - 4)); + return sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', $indent - 4)); } /** @@ -1530,11 +1521,11 @@ private function wrapServiceConditionals($value, $code) * * @param string $value * - * @return null|string + * @return string|null */ private function getServiceConditionals($value) { - $conditions = array(); + $conditions = []; foreach (ContainerBuilder::getInitializedConditionals($value) as $service) { if (!$this->container->hasDefinition($service)) { return 'false'; @@ -1556,117 +1547,39 @@ private function getServiceConditionals($value) return implode(' && ', $conditions); } - /** - * Builds service calls from arguments. - */ - private function getServiceCallsFromArguments(array $arguments, array &$calls, $isPreInstance, $callerId, array &$behavior = array(), $step = 1) + private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null, array &$calls = []) { + if (null === $definitions) { + $definitions = new \SplObjectStorage(); + } + foreach ($arguments as $argument) { if (\is_array($argument)) { - $this->getServiceCallsFromArguments($argument, $calls, $isPreInstance, $callerId, $behavior, $step); + $this->getDefinitionsFromArguments($argument, $definitions, $calls); } elseif ($argument instanceof Reference) { $id = $this->container->normalizeId($argument); if (!isset($calls[$id])) { - $calls[$id] = (int) ($isPreInstance && isset($this->circularReferences[$callerId][$id])); - } - if (!isset($behavior[$id])) { - $behavior[$id] = $argument->getInvalidBehavior(); + $calls[$id] = [0, $argument->getInvalidBehavior()]; } else { - $behavior[$id] = min($behavior[$id], $argument->getInvalidBehavior()); + $calls[$id][1] = min($calls[$id][1], $argument->getInvalidBehavior()); } - $calls[$id] += $step; - } - } - } - - private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null) - { - if (null === $definitions) { - $definitions = new \SplObjectStorage(); - } - - foreach ($arguments as $argument) { - if (\is_array($argument)) { - $this->getDefinitionsFromArguments($argument, $definitions); + ++$calls[$id][0]; } elseif (!$argument instanceof Definition) { // no-op } elseif (isset($definitions[$argument])) { $definitions[$argument] = 1 + $definitions[$argument]; } else { $definitions[$argument] = 1; - $this->getDefinitionsFromArguments($argument->getArguments(), $definitions); - $this->getDefinitionsFromArguments(array($argument->getFactory()), $definitions); - $this->getDefinitionsFromArguments($argument->getProperties(), $definitions); - $this->getDefinitionsFromArguments($argument->getMethodCalls(), $definitions); - $this->getDefinitionsFromArguments(array($argument->getConfigurator()), $definitions); - // move current definition last in the list - $nbOccurences = $definitions[$argument]; - unset($definitions[$argument]); - $definitions[$argument] = $nbOccurences; + $arguments = [$argument->getArguments(), $argument->getFactory(), $argument->getProperties(), $argument->getMethodCalls(), $argument->getConfigurator()]; + $this->getDefinitionsFromArguments($arguments, $definitions, $calls); } } return $definitions; } - /** - * Checks if a service id has a reference. - * - * @param string $id - * @param array $arguments - * @param bool $deep - * @param array $visited - * - * @return bool - */ - private function hasReference($id, array $arguments, $deep = false, array &$visited = array()) - { - if (!isset($this->circularReferences[$id])) { - return false; - } - - foreach ($arguments as $argument) { - if (\is_array($argument)) { - if ($this->hasReference($id, $argument, $deep, $visited)) { - return true; - } - - continue; - } elseif ($argument instanceof Reference) { - $argumentId = $this->container->normalizeId($argument); - if ($id === $argumentId) { - return true; - } - - if (!$deep || isset($visited[$argumentId]) || !isset($this->circularReferences[$id][$argumentId])) { - continue; - } - - $visited[$argumentId] = true; - - $service = $this->container->getDefinition($argumentId); - } elseif ($argument instanceof Definition) { - $service = $argument; - } else { - continue; - } - - // if the proxy manager is enabled, disable searching for references in lazy services, - // as these services will be instantiated lazily and don't have direct related references. - if ($service->isLazy() && !$this->getProxyDumper() instanceof NullDumper) { - continue; - } - - if ($this->hasReference($id, array($service->getArguments(), $service->getFactory(), $service->getProperties(), $service->getMethodCalls(), $service->getConfigurator()), $deep, $visited)) { - return true; - } - } - - return false; - } - /** * Dumps values. * @@ -1683,14 +1596,14 @@ private function dumpValue($value, $interpolate = true) if ($value && $interpolate && false !== $param = array_search($value, $this->container->getParameterBag()->all(), true)) { return $this->dumpValue("%$param%"); } - $code = array(); + $code = []; foreach ($value as $k => $v) { $code[] = sprintf('%s => %s', $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate)); } - return sprintf('array(%s)', implode(', ', $code)); + return sprintf('[%s]', implode(', ', $code)); } elseif ($value instanceof ArgumentInterface) { - $scope = array($this->definitionVariables, $this->referenceVariables, $this->variableCount); + $scope = [$this->definitionVariables, $this->referenceVariables]; $this->definitionVariables = $this->referenceVariables = null; try { @@ -1708,14 +1621,14 @@ private function dumpValue($value, $interpolate = true) } if ($value instanceof IteratorArgument) { - $operands = array(0); - $code = array(); + $operands = [0]; + $code = []; $code[] = 'new RewindableGenerator(function () {'; if (!$values = $value->getValues()) { $code[] = ' return new \EmptyIterator();'; } else { - $countCode = array(); + $countCode = []; $countCode[] = 'function () {'; foreach ($values as $k => $v) { @@ -1737,7 +1650,7 @@ private function dumpValue($value, $interpolate = true) return implode("\n", $code); } } finally { - list($this->definitionVariables, $this->referenceVariables, $this->variableCount) = $scope; + list($this->definitionVariables, $this->referenceVariables) = $scope; } } elseif ($value instanceof Definition) { if (null !== $this->definitionVariables && $this->definitionVariables->contains($value)) { @@ -1753,7 +1666,7 @@ private function dumpValue($value, $interpolate = true) throw new RuntimeException('Cannot dump definitions which have a configurator.'); } - $arguments = array(); + $arguments = []; foreach ($value->getArguments() as $argument) { $arguments[] = $this->dumpValue($argument); } @@ -1780,7 +1693,7 @@ private function dumpValue($value, $interpolate = true) return sprintf('(%s)->%s(%s)', $class, $factory[1], implode(', ', $arguments)); } - return sprintf("\\call_user_func(array(%s, '%s')%s)", $class, $factory[1], \count($arguments) > 0 ? ', '.implode(', ', $arguments) : ''); + return sprintf("\\call_user_func([%s, '%s']%s)", $class, $factory[1], \count($arguments) > 0 ? ', '.implode(', ', $arguments) : ''); } if ($factory[0] instanceof Reference) { @@ -1807,7 +1720,7 @@ private function dumpValue($value, $interpolate = true) return $this->getServiceCall($id, $value); } elseif ($value instanceof Expression) { - return $this->getExpressionLanguage()->compile((string) $value, array('this' => 'container')); + return $this->getExpressionLanguage()->compile((string) $value, ['this' => 'container']); } elseif ($value instanceof Parameter) { return $this->dumpParameter($value); } elseif (true === $interpolate && \is_string($value)) { @@ -1911,6 +1824,7 @@ private function getServiceCall($id, Reference $reference = null) if ($definition->isShared()) { $code = sprintf('$this->services[\'%s\'] = %s', $id, $code); } + $code = "($code)"; } elseif ($this->asFiles && $definition->isShared() && !$this->isHotPath($definition)) { $code = sprintf("\$this->load('%s.php')", $this->generateMethodName($id)); } else { @@ -1936,8 +1850,8 @@ private function getServiceCall($id, Reference $reference = null) */ private function initializeMethodNamesMap($class) { - $this->serviceIdToMethodNameMap = array(); - $this->usedMethodNames = array(); + $this->serviceIdToMethodNameMap = []; + $this->usedMethodNames = []; if ($reflectionClass = $this->container->getReflectionClass($class)) { foreach ($reflectionClass->getMethods() as $method) { diff --git a/vendor/symfony/dependency-injection/Dumper/XmlDumper.php b/vendor/symfony/dependency-injection/Dumper/XmlDumper.php index 1dcef12dabd3999fd69b5ef47893600149616967..36e3e121d23bc1e8678db742a4f8602f072d32d6 100644 --- a/vendor/symfony/dependency-injection/Dumper/XmlDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/XmlDumper.php @@ -40,7 +40,7 @@ class XmlDumper extends Dumper * * @return string An xml string representing of the service container */ - public function dump(array $options = array()) + public function dump(array $options = []) { $this->document = new \DOMDocument('1.0', 'utf-8'); $this->document->formatOutput = true; @@ -306,7 +306,7 @@ private function convertParameters(array $parameters, $type, \DOMElement $parent $text = $this->document->createTextNode(self::phpToXml((string) $value)); $element->appendChild($text); } else { - if (\in_array($value, array('null', 'true', 'false'), true)) { + if (\in_array($value, ['null', 'true', 'false'], true)) { $element->setAttribute('type', 'string'); } $text = $this->document->createTextNode(self::phpToXml($value)); @@ -323,7 +323,7 @@ private function convertParameters(array $parameters, $type, \DOMElement $parent */ private function escape(array $arguments) { - $args = array(); + $args = []; foreach ($arguments as $k => $v) { if (\is_array($v)) { $args[$k] = $this->escape($v); diff --git a/vendor/symfony/dependency-injection/Dumper/YamlDumper.php b/vendor/symfony/dependency-injection/Dumper/YamlDumper.php index 35441023de5b54fef19f1f58fee8a850d4f6d949..8f3fcddf3079efbb005aee31a38a142255e63287 100644 --- a/vendor/symfony/dependency-injection/Dumper/YamlDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/YamlDumper.php @@ -41,7 +41,7 @@ class YamlDumper extends Dumper * * @return string A YAML string representing of the service container */ - public function dump(array $options = array()) + public function dump(array $options = []) { if (!class_exists('Symfony\Component\Yaml\Dumper')) { throw new RuntimeException('Unable to dump the container as the Symfony Yaml Component is not installed.'); @@ -80,7 +80,7 @@ private function addService($id, Definition $definition) $tagsCode = ''; foreach ($definition->getTags() as $name => $tags) { foreach ($tags as $attributes) { - $att = array(); + $att = []; foreach ($attributes as $key => $value) { $att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value)); } @@ -224,7 +224,7 @@ private function addParameters() $parameters = $this->prepareParameters($this->container->getParameterBag()->all(), $this->container->isCompiled()); - return $this->dumper->dump(array('parameters' => $parameters), 2); + return $this->dumper->dump(['parameters' => $parameters], 2); } /** @@ -238,9 +238,9 @@ private function dumpCallable($callable) { if (\is_array($callable)) { if ($callable[0] instanceof Reference) { - $callable = array($this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]); + $callable = [$this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]]; } else { - $callable = array($callable[0], $callable[1]); + $callable = [$callable[0], $callable[1]]; } } @@ -275,7 +275,7 @@ private function dumpValue($value) } if (\is_array($value)) { - $code = array(); + $code = []; foreach ($value as $k => $v) { $code[$k] = $this->dumpValue($v); } @@ -344,7 +344,7 @@ private function getExpressionCall($expression) */ private function prepareParameters(array $parameters, $escape = true) { - $filtered = array(); + $filtered = []; foreach ($parameters as $key => $value) { if (\is_array($value)) { $value = $this->prepareParameters($value, $escape); @@ -365,7 +365,7 @@ private function prepareParameters(array $parameters, $escape = true) */ private function escape(array $arguments) { - $args = array(); + $args = []; foreach ($arguments as $k => $v) { if (\is_array($v)) { $args[$k] = $this->escape($v); diff --git a/vendor/symfony/dependency-injection/EnvVarProcessor.php b/vendor/symfony/dependency-injection/EnvVarProcessor.php index 13568079bb68050d7e50f315e8489944e6493c06..a23b83436bbe5edb62f9d165b1ea76d598de7bdf 100644 --- a/vendor/symfony/dependency-injection/EnvVarProcessor.php +++ b/vendor/symfony/dependency-injection/EnvVarProcessor.php @@ -32,7 +32,7 @@ public function __construct(ContainerInterface $container) */ public static function getProvidedTypes() { - return array( + return [ 'base64' => 'string', 'bool' => 'bool', 'const' => 'bool|int|float|string|array', @@ -42,7 +42,7 @@ public static function getProvidedTypes() 'json' => 'array', 'resolve' => 'string', 'string' => 'string', - ); + ]; } /** diff --git a/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php b/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php index 7a30f629d518356104325394f668f7c5f0f47bd7..b08f2e8559776c18cb63ce75574f75f062982671 100644 --- a/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php +++ b/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php @@ -32,7 +32,7 @@ class ParameterNotFoundException extends InvalidArgumentException * @param string[] $alternatives Some parameter name alternatives * @param string|null $nonNestedAlternative The alternative parameter name when the user expected dot notation for nested parameters */ - public function __construct($key, $sourceId = null, $sourceKey = null, \Exception $previous = null, array $alternatives = array(), $nonNestedAlternative = null) + public function __construct($key, $sourceId = null, $sourceKey = null, \Exception $previous = null, array $alternatives = [], $nonNestedAlternative = null) { $this->key = $key; $this->sourceId = $sourceId; diff --git a/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php b/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php index 9a0128c834647acd6c2615ce5396944e2e741c07..280dabf33fc512933e3d12e346fe06f79702cfa7 100644 --- a/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php +++ b/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php @@ -24,7 +24,7 @@ class ServiceNotFoundException extends InvalidArgumentException implements NotFo private $sourceId; private $alternatives; - public function __construct($id, $sourceId = null, \Exception $previous = null, array $alternatives = array(), $msg = null) + public function __construct($id, $sourceId = null, \Exception $previous = null, array $alternatives = [], $msg = null) { if (null !== $msg) { // no-op diff --git a/vendor/symfony/dependency-injection/ExpressionLanguage.php b/vendor/symfony/dependency-injection/ExpressionLanguage.php index 051d41b84ba4b8974bb684eaa3dc3039299b15ae..0c1780b8b1aacfbf5b0f7b633efb1f099a508c64 100644 --- a/vendor/symfony/dependency-injection/ExpressionLanguage.php +++ b/vendor/symfony/dependency-injection/ExpressionLanguage.php @@ -25,7 +25,7 @@ class ExpressionLanguage extends BaseExpressionLanguage /** * {@inheritdoc} */ - public function __construct($cache = null, array $providers = array(), callable $serviceCompiler = null) + public function __construct($cache = null, array $providers = [], callable $serviceCompiler = null) { // prepend the default provider to let users override it easily array_unshift($providers, new ExpressionLanguageProvider($serviceCompiler)); diff --git a/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php b/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php index e2084aa85da6d88b7e59352aee83b053482c1da7..9198ca0a40a9a9acdad6fc021adea59587904ebe 100644 --- a/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php +++ b/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php @@ -33,7 +33,7 @@ public function __construct(callable $serviceCompiler = null) public function getFunctions() { - return array( + return [ new ExpressionFunction('service', $this->serviceCompiler ?: function ($arg) { return sprintf('$this->get(%s)', $arg); }, function (array $variables, $value) { @@ -45,6 +45,6 @@ public function getFunctions() }, function (array $variables, $value) { return $variables['container']->getParameter($value); }), - ); + ]; } } diff --git a/vendor/symfony/dependency-injection/Extension/Extension.php b/vendor/symfony/dependency-injection/Extension/Extension.php index 1bafdbebd08d02e94f96d8b939edb3bfc8333cd0..a9389862ccbe226e99b82e5bb157b91c1f2abeda 100644 --- a/vendor/symfony/dependency-injection/Extension/Extension.php +++ b/vendor/symfony/dependency-injection/Extension/Extension.php @@ -25,7 +25,7 @@ */ abstract class Extension implements ExtensionInterface, ConfigurationExtensionInterface { - private $processedConfigs = array(); + private $processedConfigs = []; /** * {@inheritdoc} @@ -104,7 +104,7 @@ final public function getProcessedConfigs() try { return $this->processedConfigs; } finally { - $this->processedConfigs = array(); + $this->processedConfigs = []; } } @@ -115,7 +115,7 @@ final public function getProcessedConfigs() */ protected function isConfigEnabled(ContainerBuilder $container, array $config) { - if (!array_key_exists('enabled', $config)) { + if (!\array_key_exists('enabled', $config)) { throw new InvalidArgumentException("The config array has no 'enabled' key."); } diff --git a/vendor/symfony/dependency-injection/LICENSE b/vendor/symfony/dependency-injection/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/dependency-injection/LICENSE +++ b/vendor/symfony/dependency-injection/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php b/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php index 3b0b57ef0f6b9edab6eb039f45e9bd83cebc027d..532e768684f30ccbd4430508aeb966e3b8b1a84d 100644 --- a/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php +++ b/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php @@ -17,7 +17,7 @@ /** * {@inheritdoc} * - * Noop proxy instantiator - simply produces the real service instead of a proxy instance. + * Noop proxy instantiator - produces the real service instead of a proxy instance. * * @author Marco Pivetta <ocramius@gmail.com> */ diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php index d11347aeabe53b363e4827ccec025e52c1d2cc52..f7222d0ed50e85442672ef33bb1615f8b9237a73 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php @@ -28,7 +28,7 @@ abstract class AbstractConfigurator public function __call($method, $args) { if (method_exists($this, 'set'.$method)) { - return \call_user_func_array(array($this, 'set'.$method), $args); + return \call_user_func_array([$this, 'set'.$method], $args); } throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method)); diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/AbstractServiceConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/AbstractServiceConfigurator.php index 40b6c2f3897235675652ec65ddb2045855bf4ff4..0a565787fdf10e01986dd60c3e633f2d3d466874 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/AbstractServiceConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/AbstractServiceConfigurator.php @@ -18,9 +18,9 @@ abstract class AbstractServiceConfigurator extends AbstractConfigurator { protected $parent; protected $id; - private $defaultTags = array(); + private $defaultTags = []; - public function __construct(ServicesConfigurator $parent, Definition $definition, $id = null, array $defaultTags = array()) + public function __construct(ServicesConfigurator $parent, Definition $definition, $id = null, array $defaultTags = []) { $this->parent = $parent; $this->definition = $definition; @@ -36,7 +36,7 @@ public function __destruct() $this->definition->addTag($name, $attributes); } } - $this->defaultTags = array(); + $this->defaultTags = []; } /** diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php index 631c92a68026676f6deeb6b38964f921510b7df1..662ba95d1ba6d36a9559efb454ba39971678ed9a 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php @@ -37,7 +37,7 @@ class DefaultsConfigurator extends AbstractServiceConfigurator * * @throws InvalidArgumentException when an invalid tag name or attribute is provided */ - final public function tag($name, array $attributes = array()) + final public function tag($name, array $attributes = []) { if (!\is_string($name) || '' === $name) { throw new InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.'); diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/PrototypeConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/PrototypeConfigurator.php index 76e7829e8fe9925fc359ab53c0727f5404238939..d80c8b13389f2d7587b0a232a2f9c82c59c9532d 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/PrototypeConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/PrototypeConfigurator.php @@ -49,7 +49,7 @@ public function __construct(ServicesConfigurator $parent, PhpFileLoader $loader, $definition->setAutowired($defaults->isAutowired()); $definition->setAutoconfigured($defaults->isAutoconfigured()); $definition->setBindings($defaults->getBindings()); - $definition->setChanges(array()); + $definition->setChanges([]); $this->loader = $loader; $this->resource = $resource; diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php index c9673b6c7a730875dd3397827c13e065b86f8d38..e7677eb5e6dc69d1bf086554d5339a811aad7126 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php @@ -38,7 +38,7 @@ public function __construct(ContainerBuilder $container, PhpFileLoader $loader, $this->container = $container; $this->loader = $loader; $this->instanceof = &$instanceof; - $instanceof = array(); + $instanceof = []; } /** @@ -83,7 +83,7 @@ final public function set($id, $class = null) $definition->setAutowired($defaults->isAutowired()); $definition->setAutoconfigured($defaults->isAutoconfigured()); $definition->setBindings($defaults->getBindings()); - $definition->setChanges(array()); + $definition->setChanges([]); $configurator = new ServiceConfigurator($this->container, $this->instanceof, $allowParent, $this, $definition, $id, $defaults->getTags()); @@ -136,7 +136,7 @@ final public function get($id) $allowParent = !$this->defaults->getChanges() && empty($this->instanceof); $definition = $this->container->getDefinition($id); - return new ServiceConfigurator($this->container, $definition->getInstanceofConditionals(), $allowParent, $this, $definition, $id, array()); + return new ServiceConfigurator($this->container, $definition->getInstanceofConditionals(), $allowParent, $this, $definition, $id, []); } /** diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php index abc14e2155591b0504ec5612fdb3a83a0dba748c..8e6b17a19d289325a70ac92f02bb39828ae3382a 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php @@ -25,7 +25,7 @@ trait CallTrait * * @throws InvalidArgumentException on empty $method param */ - final public function call($method, array $arguments = array()) + final public function call($method, array $arguments = []) { $this->definition->addMethodCall($method, static::processValue($arguments, true)); diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php index 0891fd90612d4f962104b2710c79b2282da6ec04..173ad15f0695113fbc0449913a9b4a5b613d6080 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php @@ -18,8 +18,8 @@ trait DecorateTrait /** * Sets the service that this service is decorating. * - * @param null|string $id The decorated service id, use null to remove decoration - * @param null|string $renamedId The new decorated service id + * @param string|null $id The decorated service id, use null to remove decoration + * @param string|null $renamedId The new decorated service id * @param int $priority The priority of decoration * * @return $this diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php index c165b6503e7975add9509110435f7cb6d1e18181..d17339f88b692840884ea6c145707f19e0e8b637 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php @@ -23,7 +23,7 @@ trait TagTrait * * @return $this */ - final public function tag($name, array $attributes = array()) + final public function tag($name, array $attributes = []) { if (!\is_string($name) || '' === $name) { throw new InvalidArgumentException(sprintf('The tag name for service "%s" must be a non-empty string.', $this->id)); diff --git a/vendor/symfony/dependency-injection/Loader/FileLoader.php b/vendor/symfony/dependency-injection/Loader/FileLoader.php index d5e2327ed046c38b009a1f01a0ebf96dd0442c53..a428c6e35f6c4d46bf55d7dd57c8d932bbf267a8 100644 --- a/vendor/symfony/dependency-injection/Loader/FileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/FileLoader.php @@ -28,7 +28,7 @@ abstract class FileLoader extends BaseFileLoader { protected $container; protected $isLoadingInstanceof = false; - protected $instanceof = array(); + protected $instanceof = []; public function __construct(ContainerBuilder $container, FileLocatorInterface $locator) { @@ -57,8 +57,8 @@ public function registerClasses(Definition $prototype, $namespace, $resource, $e $classes = $this->findClasses($namespace, $resource, $exclude); // prepare for deep cloning $serializedPrototype = serialize($prototype); - $interfaces = array(); - $singlyImplemented = array(); + $interfaces = []; + $singlyImplemented = []; foreach ($classes as $class => $errorMessage) { if (interface_exists($class, false)) { @@ -105,7 +105,7 @@ private function findClasses($namespace, $pattern, $excludePattern) { $parameterBag = $this->container->getParameterBag(); - $excludePaths = array(); + $excludePaths = []; $excludePrefix = null; if ($excludePattern) { $excludePattern = $parameterBag->unescapeValue($parameterBag->resolveValue($excludePattern)); @@ -120,7 +120,7 @@ private function findClasses($namespace, $pattern, $excludePattern) } $pattern = $parameterBag->unescapeValue($parameterBag->resolveValue($pattern)); - $classes = array(); + $classes = []; $extRegexp = \defined('HHVM_VERSION') ? '/\\.(?:php|hh)$/' : '/\\.php$/'; $prefixLen = null; foreach ($this->glob($pattern, true, $resource) as $path => $info) { diff --git a/vendor/symfony/dependency-injection/Loader/IniFileLoader.php b/vendor/symfony/dependency-injection/Loader/IniFileLoader.php index ed3709104a6fbea822170c272ef51d9073823d88..307a3eefbbe562dfbfe7e89caf30d42026f9f922 100644 --- a/vendor/symfony/dependency-injection/Loader/IniFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/IniFileLoader.php @@ -32,7 +32,7 @@ public function load($resource, $type = null) // first pass to catch parsing errors $result = parse_ini_file($path, true); - if (false === $result || array() === $result) { + if (false === $result || [] === $result) { throw new InvalidArgumentException(sprintf('The "%s" file is not valid.', $resource)); } @@ -70,7 +70,9 @@ public function supports($resource, $type = null) private function phpize($value) { // trim on the right as comments removal keep whitespaces - $value = rtrim($value); + if ($value !== $v = rtrim($value)) { + $value = '""' === substr_replace($v, '', 1, -1) ? substr($v, 1, -1) : $v; + } $lowercaseValue = strtolower($value); switch (true) { diff --git a/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php b/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php index eafa9612ed33b8b5549cc7f7ff3a3dab9a6770e7..fd2a20a8768f74b6ec29ce80ca93bc6472d5020c 100644 --- a/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php @@ -63,7 +63,7 @@ public function load($resource, $type = null) try { $this->parseDefinitions($xml, $path, $defaults); } finally { - $this->instanceof = array(); + $this->instanceof = []; } } @@ -134,11 +134,11 @@ private function parseDefinitions(\DOMDocument $xml, $file, $defaults) } $this->setCurrentDir(\dirname($file)); - $this->instanceof = array(); + $this->instanceof = []; $this->isLoadingInstanceof = true; $instanceof = $xpath->query('//container:services/container:instanceof'); foreach ($instanceof as $service) { - $this->setDefinition((string) $service->getAttribute('id'), $this->parseDefinition($service, $file, array())); + $this->setDefinition((string) $service->getAttribute('id'), $this->parseDefinition($service, $file, [])); } $this->isLoadingInstanceof = false; @@ -164,12 +164,12 @@ private function getServiceDefaults(\DOMDocument $xml, $file) $xpath->registerNamespace('container', self::NS); if (null === $defaultsNode = $xpath->query('//container:services/container:defaults')->item(0)) { - return array(); + return []; } - $defaults = array( + $defaults = [ 'tags' => $this->getChildren($defaultsNode, 'tag'), 'bind' => array_map(function ($v) { return new BoundArgument($v); }, $this->getArgumentsAsPhp($defaultsNode, 'bind', $file)), - ); + ]; foreach ($defaults['tags'] as $tag) { if ('' === $tag->getAttribute('name')) { @@ -253,10 +253,10 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) $definition->setAutoconfigured($defaults['autoconfigure']); } - $definition->setChanges(array()); + $definition->setChanges([]); } - foreach (array('class', 'public', 'shared', 'synthetic', 'lazy', 'abstract') as $key) { + foreach (['class', 'public', 'shared', 'synthetic', 'lazy', 'abstract'] as $key) { if ($value = $service->getAttribute($key)) { $method = 'set'.$key; $definition->$method(XmlUtils::phpize($value)); @@ -297,7 +297,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) $class = $factory->hasAttribute('class') ? $factory->getAttribute('class') : null; } - $definition->setFactory(array($class, $factory->getAttribute('method'))); + $definition->setFactory([$class, $factory->getAttribute('method')]); } } @@ -312,7 +312,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) $class = $configurator->getAttribute('class'); } - $definition->setConfigurator(array($class, $configurator->getAttribute('method'))); + $definition->setConfigurator([$class, $configurator->getAttribute('method')]); } } @@ -327,13 +327,13 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) } foreach ($tags as $tag) { - $parameters = array(); + $parameters = []; foreach ($tag->attributes as $name => $node) { if ('name' === $name) { continue; } - if (false !== strpos($name, '-') && false === strpos($name, '_') && !array_key_exists($normalizedName = str_replace('-', '_', $name), $parameters)) { + if (false !== strpos($name, '-') && false === strpos($name, '_') && !\array_key_exists($normalizedName = str_replace('-', '_', $name), $parameters)) { $parameters[$normalizedName] = XmlUtils::phpize($node->nodeValue); } // keep not normalized key @@ -381,9 +381,9 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults) private function parseFileToDOM($file) { try { - $dom = XmlUtils::loadFile($file, array($this, 'validateSchema')); + $dom = XmlUtils::loadFile($file, [$this, 'validateSchema']); } catch (\InvalidArgumentException $e) { - throw new InvalidArgumentException(sprintf('Unable to parse file "%s".', $file), $e->getCode(), $e); + throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s', $file, $e->getMessage()), $e->getCode(), $e); } $this->validateExtensions($dom, $file); @@ -400,9 +400,9 @@ private function parseFileToDOM($file) */ private function processAnonymousServices(\DOMDocument $xml, $file, $defaults) { - $definitions = array(); + $definitions = []; $count = 0; - $suffix = ContainerBuilder::hash($file); + $suffix = '~'.ContainerBuilder::hash($file); $xpath = new \DOMXPath($xml); $xpath->registerNamespace('container', self::NS); @@ -412,11 +412,11 @@ private function processAnonymousServices(\DOMDocument $xml, $file, $defaults) foreach ($nodes as $node) { if ($services = $this->getChildren($node, 'service')) { // give it a unique name - $id = sprintf('%d_%s', ++$count, preg_replace('/^.*\\\\/', '', $services[0]->getAttribute('class')).'~'.$suffix); + $id = sprintf('%d_%s', ++$count, preg_replace('/^.*\\\\/', '', $services[0]->getAttribute('class')).$suffix); $node->setAttribute('id', $id); $node->setAttribute('service', $id); - $definitions[$id] = array($services[0], $file, false); + $definitions[$id] = [$services[0], $file, false]; $services[0]->setAttribute('id', $id); // anonymous services are always private @@ -434,14 +434,14 @@ private function processAnonymousServices(\DOMDocument $xml, $file, $defaults) // give it a unique name $id = sprintf('%d_%s', ++$count, preg_replace('/^.*\\\\/', '', $node->getAttribute('class')).$suffix); $node->setAttribute('id', $id); - $definitions[$id] = array($node, $file, true); + $definitions[$id] = [$node, $file, true]; } } // resolve definitions uksort($definitions, 'strnatcmp'); foreach (array_reverse($definitions) as $id => list($domElement, $file, $wild)) { - if (null !== $definition = $this->parseDefinition($domElement, $file, $wild ? $defaults : array())) { + if (null !== $definition = $this->parseDefinition($domElement, $file, $wild ? $defaults : [])) { $this->setDefinition($id, $definition); } @@ -465,7 +465,7 @@ private function processAnonymousServices(\DOMDocument $xml, $file, $defaults) */ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase = true, $isChildDefinition = false) { - $arguments = array(); + $arguments = []; foreach ($this->getChildren($node, $name) as $arg) { if ($arg->hasAttribute('name')) { $arg->setAttribute('key', $arg->getAttribute('name')); @@ -496,7 +496,7 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase = switch ($arg->getAttribute('type')) { case 'service': - if (!$arg->getAttribute('id')) { + if ('' === $arg->getAttribute('id')) { throw new InvalidArgumentException(sprintf('Tag "<%s>" with type="service" has no or empty "id" attribute in "%s".', $name, $file)); } if ($arg->hasAttribute('strict')) { @@ -549,11 +549,11 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase = * @param \DOMNode $node * @param mixed $name * - * @return array + * @return \DOMElement[] */ private function getChildren(\DOMNode $node, $name) { - $children = array(); + $children = []; foreach ($node->childNodes as $child) { if ($child instanceof \DOMElement && $child->localName === $name && self::NS === $child->namespaceURI) { $children[] = $child; @@ -574,7 +574,7 @@ private function getChildren(\DOMNode $node, $name) */ public function validateSchema(\DOMDocument $dom) { - $schemaLocations = array('http://symfony.com/schema/dic/services' => str_replace('\\', '/', __DIR__.'/schema/dic/services/services-1.0.xsd')); + $schemaLocations = ['http://symfony.com/schema/dic/services' => str_replace('\\', '/', __DIR__.'/schema/dic/services/services-1.0.xsd')]; if ($element = $dom->documentElement->getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation')) { $items = preg_split('/\s+/', $element); @@ -595,7 +595,7 @@ public function validateSchema(\DOMDocument $dom) } } - $tmpfiles = array(); + $tmpfiles = []; $imports = ''; foreach ($schemaLocations as $namespace => $location) { $parts = explode('/', $location); @@ -650,7 +650,7 @@ public function validateSchema(\DOMDocument $dom) private function validateAlias(\DOMElement $alias, $file) { foreach ($alias->attributes as $name => $node) { - if (!\in_array($name, array('alias', 'id', 'public'))) { + if (!\in_array($name, ['alias', 'id', 'public'])) { @trigger_error(sprintf('Using the attribute "%s" is deprecated for the service "%s" which is defined as an alias in "%s". Allowed attributes for service aliases are "alias", "id" and "public". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $name, $alias->getAttribute('id'), $file), E_USER_DEPRECATED); } } @@ -680,13 +680,7 @@ private function validateExtensions(\DOMDocument $dom, $file) // can it be handled by an extension? if (!$this->container->hasExtension($node->namespaceURI)) { $extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getNamespace(); }, $this->container->getExtensions())); - throw new InvalidArgumentException(sprintf( - 'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', - $node->tagName, - $file, - $node->namespaceURI, - $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none' - )); + throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); } } } @@ -705,7 +699,7 @@ private function loadFromExtensions(\DOMDocument $xml) $values = static::convertDomElementToArray($node); if (!\is_array($values)) { - $values = array(); + $values = []; } $this->container->loadFromExtension($node->namespaceURI, $values); diff --git a/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php b/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php index 11fd120b19f1a5977648791c3366a51cca978d60..a3a799024e499aad0e975a46179210f2a9d51f51 100644 --- a/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php @@ -36,7 +36,7 @@ */ class YamlFileLoader extends FileLoader { - private static $serviceKeywords = array( + private static $serviceKeywords = [ 'alias' => 'alias', 'parent' => 'parent', 'class' => 'class', @@ -60,9 +60,9 @@ class YamlFileLoader extends FileLoader 'autowiring_types' => 'autowiring_types', 'autoconfigure' => 'autoconfigure', 'bind' => 'bind', - ); + ]; - private static $prototypeKeywords = array( + private static $prototypeKeywords = [ 'resource' => 'resource', 'namespace' => 'namespace', 'exclude' => 'exclude', @@ -81,9 +81,9 @@ class YamlFileLoader extends FileLoader 'autowire' => 'autowire', 'autoconfigure' => 'autoconfigure', 'bind' => 'bind', - ); + ]; - private static $instanceofKeywords = array( + private static $instanceofKeywords = [ 'shared' => 'shared', 'lazy' => 'lazy', 'public' => 'public', @@ -92,15 +92,15 @@ class YamlFileLoader extends FileLoader 'calls' => 'calls', 'tags' => 'tags', 'autowire' => 'autowire', - ); + ]; - private static $defaultsKeywords = array( + private static $defaultsKeywords = [ 'public' => 'public', 'tags' => 'tags', 'autowire' => 'autowire', 'autoconfigure' => 'autoconfigure', 'bind' => 'bind', - ); + ]; private $yamlParser; @@ -142,12 +142,12 @@ public function load($resource, $type = null) // services $this->anonymousServicesCount = 0; - $this->anonymousServicesSuffix = ContainerBuilder::hash($path); + $this->anonymousServicesSuffix = '~'.ContainerBuilder::hash($path); $this->setCurrentDir(\dirname($path)); try { $this->parseDefinitions($content, $path); } finally { - $this->instanceof = array(); + $this->instanceof = []; } } @@ -160,11 +160,11 @@ public function supports($resource, $type = null) return false; } - if (null === $type && \in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yaml', 'yml'), true)) { + if (null === $type && \in_array(pathinfo($resource, PATHINFO_EXTENSION), ['yaml', 'yml'], true)) { return true; } - return \in_array($type, array('yaml', 'yml'), true); + return \in_array($type, ['yaml', 'yml'], true); } /** @@ -186,7 +186,7 @@ private function parseImports(array $content, $file) $defaultDirectory = \dirname($file); foreach ($content['imports'] as $import) { if (!\is_array($import)) { - $import = array('resource' => $import); + $import = ['resource' => $import]; } if (!isset($import['resource'])) { throw new InvalidArgumentException(sprintf('An import should provide a resource in %s. Check your YAML syntax.', $file)); @@ -213,14 +213,14 @@ private function parseDefinitions(array $content, $file) throw new InvalidArgumentException(sprintf('The "services" key should contain an array in %s. Check your YAML syntax.', $file)); } - if (array_key_exists('_instanceof', $content['services'])) { + if (\array_key_exists('_instanceof', $content['services'])) { $instanceof = $content['services']['_instanceof']; unset($content['services']['_instanceof']); if (!\is_array($instanceof)) { throw new InvalidArgumentException(sprintf('Service "_instanceof" key must be an array, "%s" given in "%s".', \gettype($instanceof), $file)); } - $this->instanceof = array(); + $this->instanceof = []; $this->isLoadingInstanceof = true; foreach ($instanceof as $id => $service) { if (!$service || !\is_array($service)) { @@ -229,7 +229,7 @@ private function parseDefinitions(array $content, $file) if (\is_string($service) && 0 === strpos($service, '@')) { throw new InvalidArgumentException(sprintf('Type definition "%s" cannot be an alias within "_instanceof" in %s. Check your YAML syntax.', $id, $file)); } - $this->parseDefinition($id, $service, $file, array()); + $this->parseDefinition($id, $service, $file, []); } } @@ -250,8 +250,8 @@ private function parseDefinitions(array $content, $file) */ private function parseDefaults(array &$content, $file) { - if (!array_key_exists('_defaults', $content['services'])) { - return array(); + if (!\array_key_exists('_defaults', $content['services'])) { + return []; } $defaults = $content['services']['_defaults']; unset($content['services']['_defaults']); @@ -273,7 +273,7 @@ private function parseDefaults(array &$content, $file) foreach ($tags as $tag) { if (!\is_array($tag)) { - $tag = array('name' => $tag); + $tag = ['name' => $tag]; } if (!isset($tag['name'])) { @@ -346,11 +346,11 @@ private function parseDefinition($id, $service, $file, array $defaults) } if (\is_array($service) && $this->isUsingShortSyntax($service)) { - $service = array('arguments' => $service); + $service = ['arguments' => $service]; } if (null === $service) { - $service = array(); + $service = []; } if (!\is_array($service)) { @@ -361,14 +361,14 @@ private function parseDefinition($id, $service, $file, array $defaults) if (isset($service['alias'])) { $this->container->setAlias($id, $alias = new Alias($service['alias'])); - if (array_key_exists('public', $service)) { + if (\array_key_exists('public', $service)) { $alias->setPublic($service['public']); } elseif (isset($defaults['public'])) { $alias->setPublic($defaults['public']); } foreach ($service as $key => $value) { - if (!\in_array($key, array('alias', 'public'))) { + if (!\in_array($key, ['alias', 'public'])) { @trigger_error(sprintf('The configuration key "%s" is unsupported for the service "%s" which is defined as an alias in "%s". Allowed configuration keys for service aliases are "alias" and "public". The YamlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $key, $id, $file), E_USER_DEPRECATED); } } @@ -411,7 +411,7 @@ private function parseDefinition($id, $service, $file, array $defaults) $definition->setAutoconfigured($defaults['autoconfigure']); } - $definition->setChanges(array()); + $definition->setChanges([]); } if (isset($service['class'])) { @@ -438,7 +438,7 @@ private function parseDefinition($id, $service, $file, array $defaults) $definition->setAbstract($service['abstract']); } - if (array_key_exists('deprecated', $service)) { + if (\array_key_exists('deprecated', $service)) { $definition->setDeprecated(true, $service['deprecated']); } @@ -470,10 +470,10 @@ private function parseDefinition($id, $service, $file, array $defaults) foreach ($service['calls'] as $call) { if (isset($call['method'])) { $method = $call['method']; - $args = isset($call['arguments']) ? $this->resolveServices($call['arguments'], $file) : array(); + $args = isset($call['arguments']) ? $this->resolveServices($call['arguments'], $file) : []; } else { $method = $call[0]; - $args = isset($call[1]) ? $this->resolveServices($call[1], $file) : array(); + $args = isset($call[1]) ? $this->resolveServices($call[1], $file) : []; } if (!\is_array($args)) { @@ -483,7 +483,7 @@ private function parseDefinition($id, $service, $file, array $defaults) } } - $tags = isset($service['tags']) ? $service['tags'] : array(); + $tags = isset($service['tags']) ? $service['tags'] : []; if (!\is_array($tags)) { throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file)); } @@ -494,7 +494,7 @@ private function parseDefinition($id, $service, $file, array $defaults) foreach ($tags as $tag) { if (!\is_array($tag)) { - $tag = array('name' => $tag); + $tag = ['name' => $tag]; } if (!isset($tag['name'])) { @@ -550,7 +550,7 @@ private function parseDefinition($id, $service, $file, array $defaults) if (isset($defaults['bind']) || isset($service['bind'])) { // deep clone, to avoid multiple process of the same instance in the passes - $bindings = isset($defaults['bind']) ? unserialize(serialize($defaults['bind'])) : array(); + $bindings = isset($defaults['bind']) ? unserialize(serialize($defaults['bind'])) : []; if (isset($service['bind'])) { if (!\is_array($service['bind'])) { @@ -571,11 +571,11 @@ private function parseDefinition($id, $service, $file, array $defaults) } } - if (array_key_exists('namespace', $service) && !array_key_exists('resource', $service)) { + if (\array_key_exists('namespace', $service) && !\array_key_exists('resource', $service)) { throw new InvalidArgumentException(sprintf('A "resource" attribute must be set when the "namespace" attribute is set for service "%s" in %s. Check your YAML syntax.', $id, $file)); } - if (array_key_exists('resource', $service)) { + if (\array_key_exists('resource', $service)) { if (!\is_string($service['resource'])) { throw new InvalidArgumentException(sprintf('A "resource" attribute must be of type string for service "%s" in %s. Check your YAML syntax.', $id, $file)); } @@ -595,7 +595,7 @@ private function parseDefinition($id, $service, $file, array $defaults) * @param string $id A service identifier * @param string $file A parsed file * - * @throws InvalidArgumentException When errors are occuried + * @throws InvalidArgumentException When errors occur * * @return string|array A parsed callable */ @@ -609,7 +609,7 @@ private function parseCallable($callable, $parameter, $id, $file) if (false !== strpos($callable, ':') && false === strpos($callable, '::')) { $parts = explode(':', $callable); - return array($this->resolveServices('@'.$parts[0], $file), $parts[1]); + return [$this->resolveServices('@'.$parts[0], $file), $parts[1]]; } return $callable; @@ -617,7 +617,7 @@ private function parseCallable($callable, $parameter, $id, $file) if (\is_array($callable)) { if (isset($callable[0]) && isset($callable[1])) { - return array($this->resolveServices($callable[0], $file), $callable[1]); + return [$this->resolveServices($callable[0], $file), $callable[1]]; } if ('factory' === $parameter && isset($callable[1]) && null === $callable[0]) { @@ -666,7 +666,7 @@ protected function loadFile($file) try { $configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS); } catch (ParseException $e) { - throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e); + throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s', $file, $e->getMessage()), 0, $e); } finally { restore_error_handler(); } @@ -695,19 +695,13 @@ private function validate($content, $file) } foreach ($content as $namespace => $data) { - if (\in_array($namespace, array('imports', 'parameters', 'services'))) { + if (\in_array($namespace, ['imports', 'parameters', 'services'])) { continue; } if (!$this->container->hasExtension($namespace)) { $extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions())); - throw new InvalidArgumentException(sprintf( - 'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', - $namespace, - $file, - $namespace, - $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none' - )); + throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', $namespace, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); } } @@ -753,10 +747,10 @@ private function resolveServices($value, $file, $isParameter = false) $isLoadingInstanceof = $this->isLoadingInstanceof; $this->isLoadingInstanceof = false; $instanceof = $this->instanceof; - $this->instanceof = array(); + $this->instanceof = []; $id = sprintf('%d_%s', ++$this->anonymousServicesCount, preg_replace('/^.*\\\\/', '', isset($argument['class']) ? $argument['class'] : '').$this->anonymousServicesSuffix); - $this->parseDefinition($id, $argument, $file, array()); + $this->parseDefinition($id, $argument, $file, []); if (!$this->container->hasDefinition($id)) { throw new InvalidArgumentException(sprintf('Creating an alias using the tag "!service" is not allowed in "%s".', $file)); @@ -817,12 +811,12 @@ private function resolveServices($value, $file, $isParameter = false) private function loadFromExtensions(array $content) { foreach ($content as $namespace => $values) { - if (\in_array($namespace, array('imports', 'parameters', 'services'))) { + if (\in_array($namespace, ['imports', 'parameters', 'services'])) { continue; } if (!\is_array($values) && null !== $values) { - $values = array(); + $values = []; } $this->container->loadFromExtension($namespace, $values); diff --git a/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php b/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php index 12bc7612f9f0cc880e5ed4542377c8d91b3bfec6..e453a774e1e668202a1799b92f64319d263a72d2 100644 --- a/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php +++ b/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php @@ -19,8 +19,8 @@ */ class EnvPlaceholderParameterBag extends ParameterBag { - private $envPlaceholders = array(); - private $providedTypes = array(); + private $envPlaceholders = []; + private $providedTypes = []; /** * {@inheritdoc} diff --git a/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php b/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php index ad65ad960f527b866a12f8f2527fe529e07a874e..a5199937e233fec391e6405cb051e25d10b07838 100644 --- a/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php +++ b/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php @@ -28,7 +28,7 @@ class FrozenParameterBag extends ParameterBag * * @param array $parameters An array of parameters */ - public function __construct(array $parameters = array()) + public function __construct(array $parameters = []) { $this->parameters = $parameters; $this->resolved = true; diff --git a/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php b/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php index e06fd344c05a027307ee5a74b006c95aaae4cf0a..c4e702181fe688d1e7b46a4d65e26ca0e3042cf3 100644 --- a/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php +++ b/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php @@ -22,15 +22,15 @@ */ class ParameterBag implements ParameterBagInterface { - protected $parameters = array(); + protected $parameters = []; protected $resolved = false; - private $normalizedNames = array(); + private $normalizedNames = []; /** * @param array $parameters An array of parameters */ - public function __construct(array $parameters = array()) + public function __construct(array $parameters = []) { $this->add($parameters); } @@ -40,7 +40,7 @@ public function __construct(array $parameters = array()) */ public function clear() { - $this->parameters = array(); + $this->parameters = []; } /** @@ -70,12 +70,12 @@ public function get($name) { $name = $this->normalizeName($name); - if (!array_key_exists($name, $this->parameters)) { + if (!\array_key_exists($name, $this->parameters)) { if (!$name) { throw new ParameterNotFoundException($name); } - $alternatives = array(); + $alternatives = []; foreach ($this->parameters as $key => $parameterValue) { $lev = levenshtein($name, $key); if ($lev <= \strlen($name) / 3 || false !== strpos($key, $name)) { @@ -121,7 +121,7 @@ public function set($name, $value) */ public function has($name) { - return array_key_exists($this->normalizeName($name), $this->parameters); + return \array_key_exists($this->normalizeName($name), $this->parameters); } /** @@ -143,7 +143,7 @@ public function resolve() return; } - $parameters = array(); + $parameters = []; foreach ($this->parameters as $key => $value) { try { $value = $this->resolveValue($value); @@ -171,10 +171,10 @@ public function resolve() * @throws ParameterCircularReferenceException if a circular reference if detected * @throws RuntimeException when a given parameter has a type problem */ - public function resolveValue($value, array $resolving = array()) + public function resolveValue($value, array $resolving = []) { if (\is_array($value)) { - $args = array(); + $args = []; foreach ($value as $k => $v) { $args[\is_string($k) ? $this->resolveValue($k, $resolving) : $k] = $this->resolveValue($v, $resolving); } @@ -201,7 +201,7 @@ public function resolveValue($value, array $resolving = array()) * @throws ParameterCircularReferenceException if a circular reference if detected * @throws RuntimeException when a given parameter has a type problem */ - public function resolveString($value, array $resolving = array()) + public function resolveString($value, array $resolving = []) { // we do this to deal with non string values (Boolean, integer, ...) // as the preg_replace_callback throw an exception when trying @@ -259,7 +259,7 @@ public function escapeValue($value) } if (\is_array($value)) { - $result = array(); + $result = []; foreach ($value as $k => $v) { $result[$k] = $this->escapeValue($v); } @@ -280,7 +280,7 @@ public function unescapeValue($value) } if (\is_array($value)) { - $result = array(); + $result = []; foreach ($value as $k => $v) { $result[$k] = $this->unescapeValue($v); } diff --git a/vendor/symfony/dependency-injection/ServiceLocator.php b/vendor/symfony/dependency-injection/ServiceLocator.php index bdedc88e8b6c137dd561fa84c80cad9a56c50fdb..a4f5bf99453d7febd656d3669015e69e35ecac77 100644 --- a/vendor/symfony/dependency-injection/ServiceLocator.php +++ b/vendor/symfony/dependency-injection/ServiceLocator.php @@ -22,7 +22,7 @@ class ServiceLocator implements PsrContainerInterface { private $factories; - private $loading = array(); + private $loading = []; private $externalId; private $container; @@ -48,7 +48,7 @@ public function has($id) public function get($id) { if (!isset($this->factories[$id])) { - throw new ServiceNotFoundException($id, end($this->loading) ?: null, null, array(), $this->createServiceNotFoundMessage($id)); + throw new ServiceNotFoundException($id, end($this->loading) ?: null, null, [], $this->createServiceNotFoundMessage($id)); } if (isset($this->loading[$id])) { @@ -94,39 +94,40 @@ private function createServiceNotFoundMessage($id) $class = isset($class[2]['object']) ? \get_class($class[2]['object']) : null; $externalId = $this->externalId ?: $class; - $msg = sprintf('Service "%s" not found: ', $id); + $msg = []; + $msg[] = sprintf('Service "%s" not found:', $id); if (!$this->container) { $class = null; } elseif ($this->container->has($id) || isset($this->container->getRemovedIds()[$id])) { - $msg .= 'even though it exists in the app\'s container, '; + $msg[] = 'even though it exists in the app\'s container,'; } else { try { $this->container->get($id); $class = null; } catch (ServiceNotFoundException $e) { if ($e->getAlternatives()) { - $msg .= sprintf(' did you mean %s? Anyway, ', $this->formatAlternatives($e->getAlternatives(), 'or')); + $msg[] = sprintf('did you mean %s? Anyway,', $this->formatAlternatives($e->getAlternatives(), 'or')); } else { $class = null; } } } if ($externalId) { - $msg .= sprintf('the container inside "%s" is a smaller service locator that %s', $externalId, $this->formatAlternatives()); + $msg[] = sprintf('the container inside "%s" is a smaller service locator that %s', $externalId, $this->formatAlternatives()); } else { - $msg .= sprintf('the current service locator %s', $this->formatAlternatives()); + $msg[] = sprintf('the current service locator %s', $this->formatAlternatives()); } if (!$class) { // no-op } elseif (is_subclass_of($class, ServiceSubscriberInterface::class)) { - $msg .= sprintf(' Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "%s::getSubscribedServices()".', preg_replace('/([^\\\\]++\\\\)++/', '', $class)); + $msg[] = sprintf('Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "%s::getSubscribedServices()".', preg_replace('/([^\\\\]++\\\\)++/', '', $class)); } else { - $msg .= 'Try using dependency injection instead.'; + $msg[] = 'Try using dependency injection instead.'; } - return $msg; + return implode(' ', $msg); } private function formatAlternatives(array $alternatives = null, $separator = 'and') diff --git a/vendor/symfony/dependency-injection/ServiceSubscriberInterface.php b/vendor/symfony/dependency-injection/ServiceSubscriberInterface.php index 7024484bd8aee57631db50cc42cb250e61db7940..10c238754421de2eedefbb1f2af90b09725ee86c 100644 --- a/vendor/symfony/dependency-injection/ServiceSubscriberInterface.php +++ b/vendor/symfony/dependency-injection/ServiceSubscriberInterface.php @@ -33,16 +33,16 @@ interface ServiceSubscriberInterface * * For mandatory dependencies: * - * * array('logger' => 'Psr\Log\LoggerInterface') means the objects use the "logger" name + * * ['logger' => 'Psr\Log\LoggerInterface'] means the objects use the "logger" name * internally to fetch a service which must implement Psr\Log\LoggerInterface. - * * array('Psr\Log\LoggerInterface') is a shortcut for - * * array('Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface') + * * ['Psr\Log\LoggerInterface'] is a shortcut for + * * ['Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface'] * * otherwise: * - * * array('logger' => '?Psr\Log\LoggerInterface') denotes an optional dependency - * * array('?Psr\Log\LoggerInterface') is a shortcut for - * * array('Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface') + * * ['logger' => '?Psr\Log\LoggerInterface'] denotes an optional dependency + * * ['?Psr\Log\LoggerInterface'] is a shortcut for + * * ['Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface'] * * @return array The required service types, optionally keyed by service names */ diff --git a/vendor/symfony/dependency-injection/Tests/ChildDefinitionTest.php b/vendor/symfony/dependency-injection/Tests/ChildDefinitionTest.php index a941b960746befecc11416ba49e6811b59db787b..cbae0eaaaa9eeb80aff7315e19b648b884d8d9c5 100644 --- a/vendor/symfony/dependency-injection/Tests/ChildDefinitionTest.php +++ b/vendor/symfony/dependency-injection/Tests/ChildDefinitionTest.php @@ -22,7 +22,7 @@ public function testConstructor() $def = new ChildDefinition('foo'); $this->assertSame('foo', $def->getParent()); - $this->assertSame(array(), $def->getChanges()); + $this->assertSame([], $def->getChanges()); } /** @@ -38,17 +38,17 @@ public function testSetProperty($property, $changeKey) $this->assertNull($def->$getter()); $this->assertSame($def, $def->$setter('foo')); $this->assertSame('foo', $def->$getter()); - $this->assertSame(array($changeKey => true), $def->getChanges()); + $this->assertSame([$changeKey => true], $def->getChanges()); } public function getPropertyTests() { - return array( - array('class', 'class'), - array('factory', 'factory'), - array('configurator', 'configurator'), - array('file', 'file'), - ); + return [ + ['class', 'class'], + ['factory', 'factory'], + ['configurator', 'configurator'], + ['file', 'file'], + ]; } public function testSetPublic() @@ -58,7 +58,7 @@ public function testSetPublic() $this->assertTrue($def->isPublic()); $this->assertSame($def, $def->setPublic(false)); $this->assertFalse($def->isPublic()); - $this->assertSame(array('public' => true), $def->getChanges()); + $this->assertSame(['public' => true], $def->getChanges()); } public function testSetLazy() @@ -68,7 +68,7 @@ public function testSetLazy() $this->assertFalse($def->isLazy()); $this->assertSame($def, $def->setLazy(false)); $this->assertFalse($def->isLazy()); - $this->assertSame(array('lazy' => true), $def->getChanges()); + $this->assertSame(['lazy' => true], $def->getChanges()); } public function testSetAutowired() @@ -78,16 +78,16 @@ public function testSetAutowired() $this->assertFalse($def->isAutowired()); $this->assertSame($def, $def->setAutowired(true)); $this->assertTrue($def->isAutowired()); - $this->assertSame(array('autowired' => true), $def->getChanges()); + $this->assertSame(['autowired' => true], $def->getChanges()); } public function testSetArgument() { $def = new ChildDefinition('foo'); - $this->assertSame(array(), $def->getArguments()); + $this->assertSame([], $def->getArguments()); $this->assertSame($def, $def->replaceArgument(0, 'foo')); - $this->assertSame(array('index_0' => 'foo'), $def->getArguments()); + $this->assertSame(['index_0' => 'foo'], $def->getArguments()); } /** @@ -104,7 +104,7 @@ public function testReplaceArgument() { $def = new ChildDefinition('foo'); - $def->setArguments(array(0 => 'foo', 1 => 'bar')); + $def->setArguments([0 => 'foo', 1 => 'bar']); $this->assertSame('foo', $def->getArgument(0)); $this->assertSame('bar', $def->getArgument(1)); @@ -112,11 +112,11 @@ public function testReplaceArgument() $this->assertSame('foo', $def->getArgument(0)); $this->assertSame('baz', $def->getArgument(1)); - $this->assertSame(array(0 => 'foo', 1 => 'bar', 'index_1' => 'baz'), $def->getArguments()); + $this->assertSame([0 => 'foo', 1 => 'bar', 'index_1' => 'baz'], $def->getArguments()); $this->assertSame($def, $def->replaceArgument('$bar', 'val')); $this->assertSame('val', $def->getArgument('$bar')); - $this->assertSame(array(0 => 'foo', 1 => 'bar', 'index_1' => 'baz', '$bar' => 'val'), $def->getArguments()); + $this->assertSame([0 => 'foo', 1 => 'bar', 'index_1' => 'baz', '$bar' => 'val'], $def->getArguments()); } /** @@ -126,7 +126,7 @@ public function testGetArgumentShouldCheckBounds() { $def = new ChildDefinition('foo'); - $def->setArguments(array(0 => 'foo')); + $def->setArguments([0 => 'foo']); $def->replaceArgument(0, 'foo'); $def->getArgument(1); @@ -152,6 +152,6 @@ public function testCannotCallSetAutoconfigured() public function testCannotCallSetInstanceofConditionals() { $def = new ChildDefinition('foo'); - $def->setInstanceofConditionals(array('Foo' => new ChildDefinition(''))); + $def->setInstanceofConditionals(['Foo' => new ChildDefinition('')]); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php index 8d44fad8611e2b20bdeb36ab2f83954f8b7ad886..0bd94a3e609cb5fae872777edb0bc1a252e81182 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php @@ -32,7 +32,7 @@ public function testProcess() $b = $container ->register('b') - ->addMethodCall('setA', array($ref2 = new Reference('a'))) + ->addMethodCall('setA', [$ref2 = new Reference('a')]) ; $c = $container @@ -48,7 +48,7 @@ public function testProcess() $e = $container ->register('e') - ->setConfigurator(array($ref6 = new Reference('b'), 'methodName')) + ->setConfigurator([$ref6 = new Reference('b'), 'methodName']) ; $graph = $this->process($container); @@ -94,7 +94,7 @@ public function testProcessMarksEdgesLazyWhenReferencedFromIteratorArgument() $container ->register('c') ->addArgument($ref1 = new Reference('a')) - ->addArgument(new IteratorArgument(array($ref2 = new Reference('b')))) + ->addArgument(new IteratorArgument([$ref2 = new Reference('b')])) ; $graph = $this->process($container); @@ -119,7 +119,7 @@ public function testProcessDetectsReferencesFromInlinedDefinitions() $container ->register('b') - ->addArgument(new Definition(null, array($ref = new Reference('a')))) + ->addArgument(new Definition(null, [$ref = new Reference('a')])) ; $graph = $this->process($container); @@ -138,7 +138,7 @@ public function testProcessDetectsReferencesFromIteratorArguments() $container ->register('b') - ->addArgument(new IteratorArgument(array($ref = new Reference('a')))) + ->addArgument(new IteratorArgument([$ref = new Reference('a')])) ; $graph = $this->process($container); @@ -156,7 +156,7 @@ public function testProcessDetectsReferencesFromInlinedFactoryDefinitions() ; $factory = new Definition(); - $factory->setFactory(array(new Reference('a'), 'a')); + $factory->setFactory([new Reference('a'), 'a']); $container ->register('b') @@ -178,8 +178,8 @@ public function testProcessDoesNotSaveDuplicateReferences() ; $container ->register('b') - ->addArgument(new Definition(null, array($ref1 = new Reference('a')))) - ->addArgument(new Definition(null, array($ref2 = new Reference('a')))) + ->addArgument(new Definition(null, [$ref1 = new Reference('a')])) + ->addArgument(new Definition(null, [$ref2 = new Reference('a')])) ; $graph = $this->process($container); @@ -193,11 +193,11 @@ public function testProcessDetectsFactoryReferences() $container ->register('foo', 'stdClass') - ->setFactory(array('stdClass', 'getInstance')); + ->setFactory(['stdClass', 'getInstance']); $container ->register('bar', 'stdClass') - ->setFactory(array(new Reference('foo'), 'getInstance')); + ->setFactory([new Reference('foo'), 'getInstance']); $graph = $this->process($container); @@ -207,7 +207,7 @@ public function testProcessDetectsFactoryReferences() protected function process(ContainerBuilder $container) { - $pass = new RepeatedPass(array(new AnalyzeServiceReferencesPass())); + $pass = new RepeatedPass([new AnalyzeServiceReferencesPass()]); $pass->process($container); return $container->getCompiler()->getServiceReferenceGraph(); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AutoAliasServicePassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AutoAliasServicePassTest.php index f76001a11abf778035217b487ff9092bed597772..d029636a7cc5d02564413a048f09234bcae63e37 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AutoAliasServicePassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AutoAliasServicePassTest.php @@ -25,7 +25,7 @@ public function testProcessWithMissingParameter() $container = new ContainerBuilder(); $container->register('example') - ->addTag('auto_alias', array('format' => '%non_existing%.example')); + ->addTag('auto_alias', ['format' => '%non_existing%.example']); $pass = new AutoAliasServicePass(); $pass->process($container); @@ -39,7 +39,7 @@ public function testProcessWithMissingFormat() $container = new ContainerBuilder(); $container->register('example') - ->addTag('auto_alias', array()); + ->addTag('auto_alias', []); $container->setParameter('existing', 'mysql'); $pass = new AutoAliasServicePass(); @@ -51,7 +51,7 @@ public function testProcessWithNonExistingAlias() $container = new ContainerBuilder(); $container->register('example', 'Symfony\Component\DependencyInjection\Tests\Compiler\ServiceClassDefault') - ->addTag('auto_alias', array('format' => '%existing%.example')); + ->addTag('auto_alias', ['format' => '%existing%.example']); $container->setParameter('existing', 'mysql'); $pass = new AutoAliasServicePass(); @@ -65,7 +65,7 @@ public function testProcessWithExistingAlias() $container = new ContainerBuilder(); $container->register('example', 'Symfony\Component\DependencyInjection\Tests\Compiler\ServiceClassDefault') - ->addTag('auto_alias', array('format' => '%existing%.example')); + ->addTag('auto_alias', ['format' => '%existing%.example']); $container->register('mysql.example', 'Symfony\Component\DependencyInjection\Tests\Compiler\ServiceClassMysql'); $container->setParameter('existing', 'mysql'); @@ -83,7 +83,7 @@ public function testProcessWithManualAlias() $container = new ContainerBuilder(); $container->register('example', 'Symfony\Component\DependencyInjection\Tests\Compiler\ServiceClassDefault') - ->addTag('auto_alias', array('format' => '%existing%.example')); + ->addTag('auto_alias', ['format' => '%existing%.example']); $container->register('mysql.example', 'Symfony\Component\DependencyInjection\Tests\Compiler\ServiceClassMysql'); $container->register('mariadb.example', 'Symfony\Component\DependencyInjection\Tests\Compiler\ServiceClassMariaDb'); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AutowireExceptionPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AutowireExceptionPassTest.php index a9c3445cefdd8f453f42e0517f7eb188a733aba8..5bcb1234223a957ce546329b4d0095b35a86a0da 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AutowireExceptionPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AutowireExceptionPassTest.php @@ -31,13 +31,13 @@ public function testThrowsException() $autowireException = new AutowiringFailedException('foo_service_id', 'An autowiring exception message'); $autowirePass->expects($this->any()) ->method('getAutowiringExceptions') - ->will($this->returnValue(array($autowireException))); + ->will($this->returnValue([$autowireException])); $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class) ->getMock(); $inlinePass->expects($this->any()) ->method('getInlinedServiceIds') - ->will($this->returnValue(array())); + ->will($this->returnValue([])); $container = new ContainerBuilder(); $container->register('foo_service_id'); @@ -60,18 +60,18 @@ public function testThrowExceptionIfServiceInlined() $autowireException = new AutowiringFailedException('a_service', 'An autowiring exception message'); $autowirePass->expects($this->any()) ->method('getAutowiringExceptions') - ->will($this->returnValue(array($autowireException))); + ->will($this->returnValue([$autowireException])); $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class) ->getMock(); $inlinePass->expects($this->any()) ->method('getInlinedServiceIds') - ->will($this->returnValue(array( + ->will($this->returnValue([ // a_service inlined into b_service - 'a_service' => array('b_service'), + 'a_service' => ['b_service'], // b_service inlined into c_service - 'b_service' => array('c_service'), - ))); + 'b_service' => ['c_service'], + ])); $container = new ContainerBuilder(); // ONLY register c_service in the final container @@ -95,18 +95,18 @@ public function testDoNotThrowExceptionIfServiceInlinedButRemoved() $autowireException = new AutowiringFailedException('a_service', 'An autowiring exception message'); $autowirePass->expects($this->any()) ->method('getAutowiringExceptions') - ->will($this->returnValue(array($autowireException))); + ->will($this->returnValue([$autowireException])); $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class) ->getMock(); $inlinePass->expects($this->any()) ->method('getInlinedServiceIds') - ->will($this->returnValue(array( + ->will($this->returnValue([ // a_service inlined into b_service - 'a_service' => array('b_service'), + 'a_service' => ['b_service'], // b_service inlined into c_service - 'b_service' => array('c_service'), - ))); + 'b_service' => ['c_service'], + ])); // do NOT register c_service in the container $container = new ContainerBuilder(); @@ -126,13 +126,13 @@ public function testNoExceptionIfServiceRemoved() $autowireException = new AutowiringFailedException('non_existent_service'); $autowirePass->expects($this->any()) ->method('getAutowiringExceptions') - ->will($this->returnValue(array($autowireException))); + ->will($this->returnValue([$autowireException])); $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class) ->getMock(); $inlinePass->expects($this->any()) ->method('getInlinedServiceIds') - ->will($this->returnValue(array())); + ->will($this->returnValue([])); $container = new ContainerBuilder(); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php index a21687723771375369fac36bf68c826e462927a7..6bd49fa5c6f828be530f3210b7afa77a24e22089 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php @@ -434,22 +434,22 @@ public function testSomeSpecificArgumentsAreSet() ->setAutowired(true) // set the 2nd (index 1) argument only: autowire the first and third // args are: A, Foo, Dunglas - ->setArguments(array( + ->setArguments([ 1 => new Reference('foo'), - 3 => array('bar'), - )); + 3 => ['bar'], + ]); (new ResolveClassPass())->process($container); (new AutowirePass())->process($container); $definition = $container->getDefinition('multiple'); $this->assertEquals( - array( + [ new TypedReference(A::class, A::class, MultipleArguments::class), new Reference('foo'), new TypedReference(Dunglas::class, Dunglas::class, MultipleArguments::class), - array('bar'), - ), + ['bar'], + ], $definition->getArguments() ); } @@ -465,7 +465,7 @@ public function testScalarArgsCannotBeAutowired() $container->register(A::class); $container->register(Dunglas::class); $container->register('arg_no_type_hint', __NAMESPACE__.'\MultipleArguments') - ->setArguments(array(1 => 'foo')) + ->setArguments([1 => 'foo']) ->setAutowired(true); (new ResolveClassPass())->process($container); @@ -518,12 +518,12 @@ public function testOptionalScalarArgsDontMessUpOrder() $definition = $container->getDefinition('with_optional_scalar'); $this->assertEquals( - array( + [ new TypedReference(A::class, A::class, MultipleArgumentsOptionalScalar::class), // use the default value 'default_val', new TypedReference(Lille::class, Lille::class), - ), + ], $definition->getArguments() ); } @@ -542,10 +542,10 @@ public function testOptionalScalarArgsNotPassedIfLast() $definition = $container->getDefinition('with_optional_scalar_last'); $this->assertEquals( - array( + [ new TypedReference(A::class, A::class, MultipleArgumentsOptionalScalarLast::class), new TypedReference(Lille::class, Lille::class, MultipleArgumentsOptionalScalarLast::class), - ), + ], $definition->getArguments() ); } @@ -562,7 +562,7 @@ public function testOptionalArgsNoRequiredForCoreClasses() $definition = $container->getDefinition('foo'); $this->assertEquals( - array('foo.txt'), + ['foo.txt'], $definition->getArguments() ); } @@ -579,7 +579,7 @@ public function testSetterInjection() $container ->register('setter_injection', SetterInjection::class) ->setAutowired(true) - ->addMethodCall('setWithCallsConfigured', array('manual_arg1', 'manual_arg2')) + ->addMethodCall('setWithCallsConfigured', ['manual_arg1', 'manual_arg2']) ; (new ResolveClassPass())->process($container); @@ -589,18 +589,18 @@ public function testSetterInjection() $methodCalls = $container->getDefinition('setter_injection')->getMethodCalls(); $this->assertEquals( - array('setWithCallsConfigured', 'setFoo', 'setDependencies', 'setChildMethodWithoutDocBlock'), + ['setWithCallsConfigured', 'setFoo', 'setDependencies', 'setChildMethodWithoutDocBlock'], array_column($methodCalls, 0) ); // test setWithCallsConfigured args $this->assertEquals( - array('manual_arg1', 'manual_arg2'), + ['manual_arg1', 'manual_arg2'], $methodCalls[0][1] ); // test setFoo args $this->assertEquals( - array(new TypedReference(Foo::class, Foo::class, SetterInjection::class)), + [new TypedReference(Foo::class, Foo::class, SetterInjection::class)], $methodCalls[1][1] ); } @@ -616,7 +616,7 @@ public function testExplicitMethodInjection() $container ->register('setter_injection', SetterInjection::class) ->setAutowired(true) - ->addMethodCall('notASetter', array()) + ->addMethodCall('notASetter', []) ; (new ResolveClassPass())->process($container); @@ -626,11 +626,11 @@ public function testExplicitMethodInjection() $methodCalls = $container->getDefinition('setter_injection')->getMethodCalls(); $this->assertEquals( - array('notASetter', 'setFoo', 'setDependencies', 'setWithCallsConfigured', 'setChildMethodWithoutDocBlock'), + ['notASetter', 'setFoo', 'setDependencies', 'setWithCallsConfigured', 'setChildMethodWithoutDocBlock'], array_column($methodCalls, 0) ); $this->assertEquals( - array(new TypedReference(A::class, A::class, SetterInjection::class)), + [new TypedReference(A::class, A::class, SetterInjection::class)], $methodCalls[0][1] ); } @@ -645,7 +645,7 @@ public function testTypedReference() $container ->register('bar', Bar::class) - ->setProperty('a', array(new TypedReference(A::class, A::class, Bar::class))) + ->setProperty('a', [new TypedReference(A::class, A::class, Bar::class)]) ; $pass = new AutowirePass(); @@ -682,10 +682,10 @@ public function testCreateResourceForClass($className, $isEqual) public function getCreateResourceTests() { - return array( - array('IdenticalClassResource', true), - array('ClassChangedConstructorArgs', false), - ); + return [ + ['IdenticalClassResource', true], + ['ClassChangedConstructorArgs', false], + ]; } public function testIgnoreServiceWithClassNotExisting() @@ -773,12 +773,12 @@ public function testEmptyStringIsKept() $container->register(Lille::class); $container->register('foo', __NAMESPACE__.'\MultipleArgumentsOptionalScalar') ->setAutowired(true) - ->setArguments(array('', '')); + ->setArguments(['', '']); (new ResolveClassPass())->process($container); (new AutowirePass())->process($container); - $this->assertEquals(array(new TypedReference(A::class, A::class, MultipleArgumentsOptionalScalar::class), '', new TypedReference(Lille::class, Lille::class)), $container->getDefinition('foo')->getArguments()); + $this->assertEquals([new TypedReference(A::class, A::class, MultipleArgumentsOptionalScalar::class), '', new TypedReference(Lille::class, Lille::class)], $container->getDefinition('foo')->getArguments()); } public function testWithFactory() @@ -787,13 +787,13 @@ public function testWithFactory() $container->register(Foo::class); $definition = $container->register('a', A::class) - ->setFactory(array(A::class, 'create')) + ->setFactory([A::class, 'create']) ->setAutowired(true); (new ResolveClassPass())->process($container); (new AutowirePass())->process($container); - $this->assertEquals(array(new TypedReference(Foo::class, Foo::class, A::class)), $definition->getArguments()); + $this->assertEquals([new TypedReference(Foo::class, Foo::class, A::class)], $definition->getArguments()); } /** @@ -805,14 +805,14 @@ public function testNotWireableCalls($method, $expectedMsg) $container = new ContainerBuilder(); $foo = $container->register('foo', NotWireable::class)->setAutowired(true) - ->addMethodCall('setBar', array()) - ->addMethodCall('setOptionalNotAutowireable', array()) - ->addMethodCall('setOptionalNoTypeHint', array()) - ->addMethodCall('setOptionalArgNoAutowireable', array()) + ->addMethodCall('setBar', []) + ->addMethodCall('setOptionalNotAutowireable', []) + ->addMethodCall('setOptionalNoTypeHint', []) + ->addMethodCall('setOptionalArgNoAutowireable', []) ; if ($method) { - $foo->addMethodCall($method, array()); + $foo->addMethodCall($method, []); } if (method_exists($this, 'expectException')) { @@ -829,11 +829,11 @@ public function testNotWireableCalls($method, $expectedMsg) public function provideNotWireableCalls() { - return array( - array('setNotAutowireable', 'Cannot autowire service "foo": argument "$n" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setNotAutowireable()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class was not found.'), - array('setDifferentNamespace', 'Cannot autowire service "foo": argument "$n" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setDifferentNamespace()" references class "stdClass" but no such service exists. It cannot be auto-registered because it is from a different root namespace.'), - array(null, 'Invalid service "foo": method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setProtectedMethod()" must be public.'), - ); + return [ + ['setNotAutowireable', 'Cannot autowire service "foo": argument "$n" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setNotAutowireable()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class was not found.'], + ['setDifferentNamespace', 'Cannot autowire service "foo": argument "$n" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setDifferentNamespace()" references class "stdClass" but no such service exists. It cannot be auto-registered because it is from a different root namespace.'], + [null, 'Invalid service "foo": method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setProtectedMethod()" must be public.'], + ]; } /** @@ -867,7 +867,7 @@ public function testTypedReferenceDeprecationNotice() $container->setAlias(AInterface::class, 'aClass'); $container ->register('bar', Bar::class) - ->setProperty('a', array(new TypedReference(A::class, A::class, Bar::class))) + ->setProperty('a', [new TypedReference(A::class, A::class, Bar::class)]) ; $pass = new AutowirePass(); @@ -922,6 +922,6 @@ public function testInlineServicesAreNotCandidates() $pass = new AutowirePass(); $pass->process($container); - $this->assertSame(array(), $container->getDefinition('autowired')->getArguments()); + $this->assertSame([], $container->getDefinition('autowired')->getArguments()); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php index 07c9f9d774e3e1f4a936e0228e701c9371309fa0..644b32d20465e46bd8c5acf82fa971ce4b9a4528 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php @@ -32,7 +32,7 @@ public function testSetterInjection() $container ->register('setter_injection', SetterInjection::class) ->setAutowired(true) - ->addMethodCall('setWithCallsConfigured', array('manual_arg1', 'manual_arg2')); + ->addMethodCall('setWithCallsConfigured', ['manual_arg1', 'manual_arg2']); (new ResolveClassPass())->process($container); (new AutowireRequiredMethodsPass())->process($container); @@ -40,17 +40,17 @@ public function testSetterInjection() $methodCalls = $container->getDefinition('setter_injection')->getMethodCalls(); $this->assertEquals( - array('setWithCallsConfigured', 'setFoo', 'setDependencies', 'setChildMethodWithoutDocBlock'), + ['setWithCallsConfigured', 'setFoo', 'setDependencies', 'setChildMethodWithoutDocBlock'], array_column($methodCalls, 0) ); // test setWithCallsConfigured args $this->assertEquals( - array('manual_arg1', 'manual_arg2'), + ['manual_arg1', 'manual_arg2'], $methodCalls[0][1] ); // test setFoo args - $this->assertEquals(array(), $methodCalls[1][1]); + $this->assertEquals([], $methodCalls[1][1]); } public function testExplicitMethodInjection() @@ -64,7 +64,7 @@ public function testExplicitMethodInjection() $container ->register('setter_injection', SetterInjection::class) ->setAutowired(true) - ->addMethodCall('notASetter', array()); + ->addMethodCall('notASetter', []); (new ResolveClassPass())->process($container); (new AutowireRequiredMethodsPass())->process($container); @@ -72,9 +72,9 @@ public function testExplicitMethodInjection() $methodCalls = $container->getDefinition('setter_injection')->getMethodCalls(); $this->assertEquals( - array('notASetter', 'setFoo', 'setDependencies', 'setWithCallsConfigured', 'setChildMethodWithoutDocBlock'), + ['notASetter', 'setFoo', 'setDependencies', 'setWithCallsConfigured', 'setChildMethodWithoutDocBlock'], array_column($methodCalls, 0) ); - $this->assertEquals(array(), $methodCalls[0][1]); + $this->assertEquals([], $methodCalls[0][1]); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckArgumentsValidityPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckArgumentsValidityPassTest.php index d121689ff9c6a69b52b5903dcd1048bc0e758d2f..c1e47b308e76050bb457201718e43950621c7460 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckArgumentsValidityPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckArgumentsValidityPassTest.php @@ -24,20 +24,20 @@ public function testProcess() { $container = new ContainerBuilder(); $definition = $container->register('foo'); - $definition->setArguments(array(null, 1, 'a')); - $definition->setMethodCalls(array( - array('bar', array('a', 'b')), - array('baz', array('c', 'd')), - )); + $definition->setArguments([null, 1, 'a']); + $definition->setMethodCalls([ + ['bar', ['a', 'b']], + ['baz', ['c', 'd']], + ]); $pass = new CheckArgumentsValidityPass(); $pass->process($container); - $this->assertEquals(array(null, 1, 'a'), $container->getDefinition('foo')->getArguments()); - $this->assertEquals(array( - array('bar', array('a', 'b')), - array('baz', array('c', 'd')), - ), $container->getDefinition('foo')->getMethodCalls()); + $this->assertEquals([null, 1, 'a'], $container->getDefinition('foo')->getArguments()); + $this->assertEquals([ + ['bar', ['a', 'b']], + ['baz', ['c', 'd']], + ], $container->getDefinition('foo')->getMethodCalls()); } /** @@ -57,19 +57,19 @@ public function testException(array $arguments, array $methodCalls) public function definitionProvider() { - return array( - array(array(null, 'a' => 'a'), array()), - array(array(1 => 1), array()), - array(array(), array(array('baz', array(null, 'a' => 'a')))), - array(array(), array(array('baz', array(1 => 1)))), - ); + return [ + [[null, 'a' => 'a'], []], + [[1 => 1], []], + [[], [['baz', [null, 'a' => 'a']]]], + [[], [['baz', [1 => 1]]]], + ]; } public function testNoException() { $container = new ContainerBuilder(); $definition = $container->register('foo'); - $definition->setArguments(array(null, 'a' => 'a')); + $definition->setArguments([null, 'a' => 'a']); $pass = new CheckArgumentsValidityPass(false); $pass->process($container); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php index a87dc44a9cb2ef400652f2daaf3205b72efb6d21..8423c5616b3b9d8c6b084c49450042cceacc293f 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php @@ -55,11 +55,11 @@ public function testProcessWithFactory() $container ->register('a', 'stdClass') - ->setFactory(array(new Reference('b'), 'getInstance')); + ->setFactory([new Reference('b'), 'getInstance']); $container ->register('b', 'stdClass') - ->setFactory(array(new Reference('a'), 'getInstance')); + ->setFactory([new Reference('a'), 'getInstance']); $this->process($container); } @@ -88,7 +88,7 @@ public function testProcessDetectsIndirectCircularReferenceWithFactory() $container ->register('b', 'stdClass') - ->setFactory(array(new Reference('c'), 'getInstance')); + ->setFactory([new Reference('c'), 'getInstance']); $container->register('c')->addArgument(new Reference('a')); @@ -112,7 +112,7 @@ public function testProcessIgnoresMethodCalls() { $container = new ContainerBuilder(); $container->register('a')->addArgument(new Reference('b')); - $container->register('b')->addMethodCall('setA', array(new Reference('a'))); + $container->register('b')->addMethodCall('setA', [new Reference('a')]); $this->process($container); @@ -135,7 +135,7 @@ public function testProcessIgnoresIteratorArguments() { $container = new ContainerBuilder(); $container->register('a')->addArgument(new Reference('b')); - $container->register('b')->addArgument(new IteratorArgument(array(new Reference('a')))); + $container->register('b')->addArgument(new IteratorArgument([new Reference('a')])); $this->process($container); @@ -147,11 +147,11 @@ protected function process(ContainerBuilder $container) { $compiler = new Compiler(); $passConfig = $compiler->getPassConfig(); - $passConfig->setOptimizationPasses(array( + $passConfig->setOptimizationPasses([ new AnalyzeServiceReferencesPass(true), new CheckCircularReferencesPass(), - )); - $passConfig->setRemovingPasses(array()); + ]); + $passConfig->setRemovingPasses([]); $compiler->compile($container); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckDefinitionValidityPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckDefinitionValidityPassTest.php index f698ed02dc744d766a8de648ed23135ae04c546f..e1dd60b662be9c807a1e304695f92a746da39fab 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckDefinitionValidityPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckDefinitionValidityPassTest.php @@ -55,10 +55,10 @@ public function testProcess() public function testValidTags() { $container = new ContainerBuilder(); - $container->register('a', 'class')->addTag('foo', array('bar' => 'baz')); - $container->register('b', 'class')->addTag('foo', array('bar' => null)); - $container->register('c', 'class')->addTag('foo', array('bar' => 1)); - $container->register('d', 'class')->addTag('foo', array('bar' => 1.1)); + $container->register('a', 'class')->addTag('foo', ['bar' => 'baz']); + $container->register('b', 'class')->addTag('foo', ['bar' => null]); + $container->register('c', 'class')->addTag('foo', ['bar' => 1]); + $container->register('d', 'class')->addTag('foo', ['bar' => 1.1]); $this->process($container); @@ -71,7 +71,7 @@ public function testValidTags() public function testInvalidTags() { $container = new ContainerBuilder(); - $container->register('a', 'class')->addTag('foo', array('bar' => array('baz' => 'baz'))); + $container->register('a', 'class')->addTag('foo', ['bar' => ['baz' => 'baz']]); $this->process($container); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php index 631c344ff6cb1000e62495bb8b47d4869d1a944f..38717eaf1fd5d1fe81bbf3abaac8d921252e7fb1 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php @@ -74,7 +74,7 @@ public function testProcessDefinitionWithBindings() $container ->register('b') - ->setBindings(array(new BoundArgument(new Reference('a')))) + ->setBindings([new BoundArgument(new Reference('a'))]) ; $this->process($container); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php index 34347d8cd192aa7309ca6a9cff749859b0e97552..29fc5cc5784d548e6cd3617a93a54a58a45edfae 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php @@ -130,18 +130,18 @@ public function testProcessMovesTagsFromDecoratedDefinitionToDecoratingDefinitio $container = new ContainerBuilder(); $container ->register('foo') - ->setTags(array('bar' => array('attr' => 'baz'))) + ->setTags(['bar' => ['attr' => 'baz']]) ; $container ->register('baz') - ->setTags(array('foobar' => array('attr' => 'bar'))) + ->setTags(['foobar' => ['attr' => 'bar']]) ->setDecoratedService('foo') ; $this->process($container); $this->assertEmpty($container->getDefinition('baz.inner')->getTags()); - $this->assertEquals(array('bar' => array('attr' => 'baz'), 'foobar' => array('attr' => 'bar')), $container->getDefinition('baz')->getTags()); + $this->assertEquals(['bar' => ['attr' => 'baz'], 'foobar' => ['attr' => 'bar']], $container->getDefinition('baz')->getTags()); } /** @@ -164,10 +164,33 @@ public function testProcessMergesAutowiringTypesInDecoratingDefinitionAndRemoveT $this->process($container); - $this->assertEquals(array('Bar', 'Foo'), $container->getDefinition('child')->getAutowiringTypes()); + $this->assertEquals(['Bar', 'Foo'], $container->getDefinition('child')->getAutowiringTypes()); $this->assertEmpty($container->getDefinition('child.inner')->getAutowiringTypes()); } + public function testProcessMovesTagsFromDecoratedDefinitionToDecoratingDefinitionMultipleTimes() + { + $container = new ContainerBuilder(); + $container + ->register('foo') + ->setPublic(true) + ->setTags(['bar' => ['attr' => 'baz']]) + ; + $container + ->register('deco1') + ->setDecoratedService('foo', null, 50) + ; + $container + ->register('deco2') + ->setDecoratedService('foo', null, 2) + ; + + $this->process($container); + + $this->assertEmpty($container->getDefinition('deco1')->getTags()); + $this->assertEquals(['bar' => ['attr' => 'baz']], $container->getDefinition('deco2')->getTags()); + } + protected function process(ContainerBuilder $container) { $repeatedPass = new DecoratorServicePass(); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/DefinitionErrorExceptionPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/DefinitionErrorExceptionPassTest.php index e0585e21324b3ca9abb33b8f735b84091c4dfd32..ce6f0496e0527e48e186d69c0b34d83726d8107b 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/DefinitionErrorExceptionPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/DefinitionErrorExceptionPassTest.php @@ -29,9 +29,9 @@ public function testThrowsException() $def->addError('Things went wrong!'); $def->addError('Now something else!'); $container->register('foo_service_id') - ->setArguments(array( + ->setArguments([ $def, - )); + ]); $pass = new DefinitionErrorExceptionPass(); $pass->process($container); @@ -42,9 +42,9 @@ public function testNoExceptionThrown() $container = new ContainerBuilder(); $def = new Definition(); $container->register('foo_service_id') - ->setArguments(array( + ->setArguments([ $def, - )); + ]); $pass = new DefinitionErrorExceptionPass(); $pass->process($container); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php index bfb61c373f72bea04119563ad3ae23ba79e44c8d..87f07c7005ebd1840d825a47c9bdc5117071d1c3 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php @@ -31,15 +31,15 @@ public function testProcess() $container = new ContainerBuilder(); $factory = $container->register('factory'); - $factory->setFactory(array(FactoryDummy::class, 'createFactory')); + $factory->setFactory([FactoryDummy::class, 'createFactory']); $container->setAlias('alias_factory', 'factory'); $foo = $container->register('foo'); - $foo->setFactory(array(new Reference('alias_factory'), 'create')); + $foo->setFactory([new Reference('alias_factory'), 'create']); $bar = $container->register('bar', __CLASS__); - $bar->setFactory(array(new Reference('factory'), 'create')); + $bar->setFactory([new Reference('factory'), 'create']); $pass = new FactoryReturnTypePass(); $pass->process($container); @@ -80,13 +80,13 @@ public function testReturnTypes($factory, $returnType, $hhvmSupport = true) public function returnTypesProvider() { - return array( + return [ // must be loaded before the function as they are in the same file - array(array(FactoryDummy::class, 'createBuiltin'), null, false), - array(array(FactoryDummy::class, 'createParent'), FactoryParent::class), - array(array(FactoryDummy::class, 'createSelf'), FactoryDummy::class), - array(factoryFunction::class, FactoryDummy::class), - ); + [[FactoryDummy::class, 'createBuiltin'], null, false], + [[FactoryDummy::class, 'createParent'], FactoryParent::class], + [[FactoryDummy::class, 'createSelf'], FactoryDummy::class], + [factoryFunction::class, FactoryDummy::class], + ]; } public function testCircularReference() @@ -94,10 +94,10 @@ public function testCircularReference() $container = new ContainerBuilder(); $factory = $container->register('factory'); - $factory->setFactory(array(new Reference('factory2'), 'createSelf')); + $factory->setFactory([new Reference('factory2'), 'createSelf']); $factory2 = $container->register('factory2'); - $factory2->setFactory(array(new Reference('factory'), 'create')); + $factory2->setFactory([new Reference('factory'), 'create']); $pass = new FactoryReturnTypePass(); $pass->process($container); @@ -115,7 +115,7 @@ public function testCompile() $container = new ContainerBuilder(); $factory = $container->register('factory'); - $factory->setFactory(array(FactoryDummy::class, 'createFactory')); + $factory->setFactory([FactoryDummy::class, 'createFactory']); $container->compile(); $this->assertEquals(FactoryDummy::class, $container->getDefinition('factory')->getClass()); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php index b2ad6f9476fa1a0d3e8af58322023f1d5de02e57..6e5c80a7d5cd0c79da87204b8982b9bdc072144d 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php @@ -33,7 +33,7 @@ public function testProcess() $container ->register('service') - ->setArguments(array(new Reference('inlinable.service'))) + ->setArguments([new Reference('inlinable.service')]) ; $this->process($container); @@ -54,7 +54,7 @@ public function testProcessDoesNotInlinesWhenAliasedServiceIsShared() $container ->register('service') - ->setArguments(array($ref = new Reference('foo'))) + ->setArguments([$ref = new Reference('foo')]) ; $this->process($container); @@ -79,7 +79,7 @@ public function testProcessDoesInlineNonSharedService() $container ->register('service') - ->setArguments(array(new Reference('foo'), $ref = new Reference('moo'), new Reference('bar'))) + ->setArguments([new Reference('foo'), $ref = new Reference('moo'), new Reference('bar')]) ; $this->process($container); @@ -103,7 +103,7 @@ public function testProcessDoesNotInlineMixedServicesLoop() $container ->register('bar') ->setPublic(false) - ->addMethodCall('setFoo', array(new Reference('foo'))) + ->addMethodCall('setFoo', [new Reference('foo')]) ; $this->process($container); @@ -126,7 +126,7 @@ public function testProcessThrowsOnNonSharedLoops() $container ->register('bar') ->setShared(false) - ->addMethodCall('setFoo', array(new Reference('foo'))) + ->addMethodCall('setFoo', [new Reference('foo')]) ; $this->process($container); @@ -173,7 +173,7 @@ public function testProcessInlinesIfMultipleReferencesButAllFromTheSameDefinitio $b = $container ->register('b') ->addArgument(new Reference('a')) - ->addArgument(new Definition(null, array(new Reference('a')))) + ->addArgument(new Definition(null, [new Reference('a')])) ; $this->process($container); @@ -193,14 +193,14 @@ public function testProcessInlinesPrivateFactoryReference() $b = $container ->register('b') ->setPublic(false) - ->setFactory(array(new Reference('a'), 'a')) + ->setFactory([new Reference('a'), 'a']) ; $container ->register('foo') - ->setArguments(array( + ->setArguments([ $ref = new Reference('b'), - )); + ]); $this->process($container); @@ -217,15 +217,15 @@ public function testProcessDoesNotInlinePrivateFactoryIfReferencedMultipleTimesW $container ->register('b') ->setPublic(false) - ->setFactory(array(new Reference('a'), 'a')) + ->setFactory([new Reference('a'), 'a']) ; $container ->register('foo') - ->setArguments(array( + ->setArguments([ $ref1 = new Reference('b'), $ref2 = new Reference('b'), - )) + ]) ; $this->process($container); @@ -243,19 +243,19 @@ public function testProcessDoesNotInlineReferenceWhenUsedByInlineFactory() $container ->register('b') ->setPublic(false) - ->setFactory(array(new Reference('a'), 'a')) + ->setFactory([new Reference('a'), 'a']) ; $inlineFactory = new Definition(); $inlineFactory->setPublic(false); - $inlineFactory->setFactory(array(new Reference('b'), 'b')); + $inlineFactory->setFactory([new Reference('b'), 'b']); $container ->register('foo') - ->setArguments(array( + ->setArguments([ $ref = new Reference('b'), $inlineFactory, - )) + ]) ; $this->process($container); @@ -274,7 +274,7 @@ public function testProcessDoesNotInlineWhenServiceIsPrivateButLazy() $container ->register('service') - ->setArguments(array($ref = new Reference('foo'))) + ->setArguments([$ref = new Reference('foo')]) ; $this->process($container); @@ -289,7 +289,7 @@ public function testProcessDoesNotInlineWhenServiceReferencesItself() $container ->register('foo') ->setPublic(false) - ->addMethodCall('foo', array($ref = new Reference('foo'))) + ->addMethodCall('foo', [$ref = new Reference('foo')]) ; $this->process($container); @@ -307,11 +307,11 @@ public function testProcessDoesNotSetLazyArgumentValuesAfterInlining() ; $container ->register('service-closure') - ->setArguments(array(new ServiceClosureArgument(new Reference('inline')))) + ->setArguments([new ServiceClosureArgument(new Reference('inline'))]) ; $container ->register('iterator') - ->setArguments(array(new IteratorArgument(array(new Reference('inline'))))) + ->setArguments([new IteratorArgument([new Reference('inline')])]) ; $this->process($container); @@ -342,19 +342,19 @@ public function testGetInlinedServiceIdData() $container ->register('other_service') - ->setArguments(array(new Reference('inlinable.service'))) + ->setArguments([new Reference('inlinable.service')]) ; $inlinePass = new InlineServiceDefinitionsPass(); - $repeatedPass = new RepeatedPass(array(new AnalyzeServiceReferencesPass(), $inlinePass)); + $repeatedPass = new RepeatedPass([new AnalyzeServiceReferencesPass(), $inlinePass]); $repeatedPass->process($container); - $this->assertEquals(array('inlinable.service' => array('other_service')), $inlinePass->getInlinedServiceIds()); + $this->assertEquals(['inlinable.service' => ['other_service']], $inlinePass->getInlinedServiceIds()); } protected function process(ContainerBuilder $container) { - $repeatedPass = new RepeatedPass(array(new AnalyzeServiceReferencesPass(), new InlineServiceDefinitionsPass())); + $repeatedPass = new RepeatedPass([new AnalyzeServiceReferencesPass(), new InlineServiceDefinitionsPass()]); $repeatedPass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php index 09ba6ab45cb62b423bdcd368a3b60b4320cc4216..10c34aa489d45fd8d54fa8c438fb6a262ae6513d 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php @@ -17,6 +17,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; /** * This class tests the integration of the different compiler passes. @@ -96,7 +97,7 @@ public function testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDe $container ->register('a', '\stdClass') ->addArgument(new Reference('b')) - ->addMethodCall('setC', array(new Reference('c'))) + ->addMethodCall('setC', [new Reference('c')]) ; $container @@ -117,6 +118,21 @@ public function testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDe $this->assertFalse($container->hasDefinition('c'), 'Service C was not inlined.'); } + public function testCanDecorateServiceSubscriber() + { + $container = new ContainerBuilder(); + $container->register(ServiceSubscriberStub::class) + ->addTag('container.service_subscriber') + ->setPublic(true); + + $container->register(DecoratedServiceSubscriber::class) + ->setDecoratedService(ServiceSubscriberStub::class); + + $container->compile(); + + $this->assertInstanceOf(DecoratedServiceSubscriber::class, $container->get(ServiceSubscriberStub::class)); + } + /** * @dataProvider getYamlCompileTests */ @@ -139,8 +155,8 @@ public function testYamlContainerCompiles($directory, $actualServiceId, $expecte $expectedService = $container->getDefinition($expectedServiceId); // reset changes, we don't care if these differ - $actualService->setChanges(array()); - $expectedService->setChanges(array()); + $actualService->setChanges([]); + $expectedService->setChanges([]); $this->assertEquals($expectedService, $actualService); } @@ -149,64 +165,76 @@ public function getYamlCompileTests() { $container = new ContainerBuilder(); $container->registerForAutoconfiguration(IntegrationTestStub::class); - yield array( + yield [ 'autoconfigure_child_not_applied', 'child_service', 'child_service_expected', $container, - ); + ]; $container = new ContainerBuilder(); $container->registerForAutoconfiguration(IntegrationTestStub::class); - yield array( + yield [ 'autoconfigure_parent_child', 'child_service', 'child_service_expected', $container, - ); + ]; $container = new ContainerBuilder(); $container->registerForAutoconfiguration(IntegrationTestStub::class) ->addTag('from_autoconfigure'); - yield array( + yield [ 'autoconfigure_parent_child_tags', 'child_service', 'child_service_expected', $container, - ); + ]; - yield array( + yield [ 'child_parent', 'child_service', 'child_service_expected', - ); + ]; - yield array( + yield [ 'defaults_child_tags', 'child_service', 'child_service_expected', - ); + ]; - yield array( + yield [ 'defaults_instanceof_importance', 'main_service', 'main_service_expected', - ); + ]; - yield array( + yield [ 'defaults_parent_child', 'child_service', 'child_service_expected', - ); + ]; - yield array( + yield [ 'instanceof_parent_child', 'child_service', 'child_service_expected', - ); + ]; } } +class ServiceSubscriberStub implements ServiceSubscriberInterface +{ + public static function getSubscribedServices() + { + return []; + } +} + +class DecoratedServiceSubscriber +{ +} + class IntegrationTestStub extends IntegrationTestStubParent { } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php index 3ebd3f5e5c981b8ca9b81f1c837aaa8906b739b6..667ae388648ae7862bbecf11f34eddac755d04a5 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php @@ -25,7 +25,7 @@ class MergeExtensionConfigurationPassTest extends TestCase { public function testExpressionLanguageProviderForwarding() { - $tmpProviders = array(); + $tmpProviders = []; $extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock(); $extension->expects($this->any()) @@ -46,18 +46,18 @@ public function testExpressionLanguageProviderForwarding() $provider = $this->getMockBuilder('Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface')->getMock(); $container = new ContainerBuilder(new ParameterBag()); $container->registerExtension($extension); - $container->prependExtensionConfig('foo', array('bar' => true)); + $container->prependExtensionConfig('foo', ['bar' => true]); $container->addExpressionLanguageProvider($provider); $pass = new MergeExtensionConfigurationPass(); $pass->process($container); - $this->assertEquals(array($provider), $tmpProviders); + $this->assertEquals([$provider], $tmpProviders); } public function testExtensionLoadGetAMergeExtensionConfigurationContainerBuilderInstance() { - $extension = $this->getMockBuilder(FooExtension::class)->setMethods(array('load'))->getMock(); + $extension = $this->getMockBuilder(FooExtension::class)->setMethods(['load'])->getMock(); $extension->expects($this->once()) ->method('load') ->with($this->isType('array'), $this->isInstanceOf(MergeExtensionConfigurationContainerBuilder::class)) @@ -65,7 +65,7 @@ public function testExtensionLoadGetAMergeExtensionConfigurationContainerBuilder $container = new ContainerBuilder(new ParameterBag()); $container->registerExtension($extension); - $container->prependExtensionConfig('foo', array()); + $container->prependExtensionConfig('foo', []); $pass = new MergeExtensionConfigurationPass(); $pass->process($container); @@ -73,14 +73,14 @@ public function testExtensionLoadGetAMergeExtensionConfigurationContainerBuilder public function testExtensionConfigurationIsTrackedByDefault() { - $extension = $this->getMockBuilder(FooExtension::class)->setMethods(array('getConfiguration'))->getMock(); + $extension = $this->getMockBuilder(FooExtension::class)->setMethods(['getConfiguration'])->getMock(); $extension->expects($this->exactly(2)) ->method('getConfiguration') ->will($this->returnValue(new FooConfiguration())); $container = new ContainerBuilder(new ParameterBag()); $container->registerExtension($extension); - $container->prependExtensionConfig('foo', array('bar' => true)); + $container->prependExtensionConfig('foo', ['bar' => true]); $pass = new MergeExtensionConfigurationPass(); $pass->process($container); @@ -92,14 +92,14 @@ public function testOverriddenEnvsAreMerged() { $container = new ContainerBuilder(); $container->registerExtension(new FooExtension()); - $container->prependExtensionConfig('foo', array('bar' => '%env(FOO)%')); - $container->prependExtensionConfig('foo', array('bar' => '%env(BAR)%', 'baz' => '%env(BAZ)%')); + $container->prependExtensionConfig('foo', ['bar' => '%env(FOO)%']); + $container->prependExtensionConfig('foo', ['bar' => '%env(BAR)%', 'baz' => '%env(BAZ)%']); $pass = new MergeExtensionConfigurationPass(); $pass->process($container); - $this->assertSame(array('BAZ', 'FOO'), array_keys($container->getParameterBag()->getEnvPlaceholders())); - $this->assertSame(array('BAZ' => 1, 'FOO' => 0), $container->getEnvCounters()); + $this->assertSame(['BAZ', 'FOO'], array_keys($container->getParameterBag()->getEnvPlaceholders())); + $this->assertSame(['BAZ' => 1, 'FOO' => 0], $container->getEnvCounters()); } /** @@ -110,7 +110,7 @@ public function testProcessedEnvsAreIncompatibleWithResolve() { $container = new ContainerBuilder(); $container->registerExtension(new BarExtension()); - $container->prependExtensionConfig('bar', array()); + $container->prependExtensionConfig('bar', []); (new MergeExtensionConfigurationPass())->process($container); } @@ -119,7 +119,7 @@ public function testThrowingExtensionsGetMergedBag() { $container = new ContainerBuilder(); $container->registerExtension(new ThrowingExtension()); - $container->prependExtensionConfig('throwing', array('bar' => '%env(FOO)%')); + $container->prependExtensionConfig('throwing', ['bar' => '%env(FOO)%']); try { $pass = new MergeExtensionConfigurationPass(); @@ -128,7 +128,7 @@ public function testThrowingExtensionsGetMergedBag() } catch (\Exception $e) { } - $this->assertSame(array('FOO'), array_keys($container->getParameterBag()->getEnvPlaceholders())); + $this->assertSame(['FOO'], array_keys($container->getParameterBag()->getEnvPlaceholders())); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php index 1fd772ee690ec2f8e11134b5e14997f6c999aac1..9470e526fa27b01f75c5b63aff9632b784afcdcb 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php @@ -23,7 +23,7 @@ class PassConfigTest extends TestCase public function testPassOrdering() { $config = new PassConfig(); - $config->setBeforeOptimizationPasses(array()); + $config->setBeforeOptimizationPasses([]); $pass1 = $this->getMockBuilder(CompilerPassInterface::class)->getMock(); $config->addPass($pass1, PassConfig::TYPE_BEFORE_OPTIMIZATION, 10); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/PriorityTaggedServiceTraitTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/PriorityTaggedServiceTraitTest.php index 61e3fa947a47d56a24eb08d21e6707654dd1efc0..57682b5da566629ebd0c09076fe7bfe2946c91ac 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/PriorityTaggedServiceTraitTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/PriorityTaggedServiceTraitTest.php @@ -20,27 +20,27 @@ class PriorityTaggedServiceTraitTest extends TestCase { public function testThatCacheWarmersAreProcessedInPriorityOrder() { - $services = array( - 'my_service1' => array('my_custom_tag' => array('priority' => 100)), - 'my_service2' => array('my_custom_tag' => array('priority' => 200)), - 'my_service3' => array('my_custom_tag' => array('priority' => -501)), - 'my_service4' => array('my_custom_tag' => array()), - 'my_service5' => array('my_custom_tag' => array('priority' => -1)), - 'my_service6' => array('my_custom_tag' => array('priority' => -500)), - 'my_service7' => array('my_custom_tag' => array('priority' => -499)), - 'my_service8' => array('my_custom_tag' => array('priority' => 1)), - 'my_service9' => array('my_custom_tag' => array('priority' => -2)), - 'my_service10' => array('my_custom_tag' => array('priority' => -1000)), - 'my_service11' => array('my_custom_tag' => array('priority' => -1001)), - 'my_service12' => array('my_custom_tag' => array('priority' => -1002)), - 'my_service13' => array('my_custom_tag' => array('priority' => -1003)), - 'my_service14' => array('my_custom_tag' => array('priority' => -1000)), - 'my_service15' => array('my_custom_tag' => array('priority' => 1)), - 'my_service16' => array('my_custom_tag' => array('priority' => -1)), - 'my_service17' => array('my_custom_tag' => array('priority' => 200)), - 'my_service18' => array('my_custom_tag' => array('priority' => 100)), - 'my_service19' => array('my_custom_tag' => array()), - ); + $services = [ + 'my_service1' => ['my_custom_tag' => ['priority' => 100]], + 'my_service2' => ['my_custom_tag' => ['priority' => 200]], + 'my_service3' => ['my_custom_tag' => ['priority' => -501]], + 'my_service4' => ['my_custom_tag' => []], + 'my_service5' => ['my_custom_tag' => ['priority' => -1]], + 'my_service6' => ['my_custom_tag' => ['priority' => -500]], + 'my_service7' => ['my_custom_tag' => ['priority' => -499]], + 'my_service8' => ['my_custom_tag' => ['priority' => 1]], + 'my_service9' => ['my_custom_tag' => ['priority' => -2]], + 'my_service10' => ['my_custom_tag' => ['priority' => -1000]], + 'my_service11' => ['my_custom_tag' => ['priority' => -1001]], + 'my_service12' => ['my_custom_tag' => ['priority' => -1002]], + 'my_service13' => ['my_custom_tag' => ['priority' => -1003]], + 'my_service14' => ['my_custom_tag' => ['priority' => -1000]], + 'my_service15' => ['my_custom_tag' => ['priority' => 1]], + 'my_service16' => ['my_custom_tag' => ['priority' => -1]], + 'my_service17' => ['my_custom_tag' => ['priority' => 200]], + 'my_service18' => ['my_custom_tag' => ['priority' => 100]], + 'my_service19' => ['my_custom_tag' => []], + ]; $container = new ContainerBuilder(); @@ -52,7 +52,7 @@ public function testThatCacheWarmersAreProcessedInPriorityOrder() } } - $expected = array( + $expected = [ new Reference('my_service2'), new Reference('my_service17'), new Reference('my_service1'), @@ -72,7 +72,7 @@ public function testThatCacheWarmersAreProcessedInPriorityOrder() new Reference('my_service11'), new Reference('my_service12'), new Reference('my_service13'), - ); + ]; $priorityTaggedServiceTraitImplementation = new PriorityTaggedServiceTraitImplementation(); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php index cddb62dce9826d9c353dfec54d45bb2a62c816b0..3d3fdf7694702f9954572fba4f7d9fd9beb7e2e5 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php @@ -28,18 +28,18 @@ public function testSimpleProcessor() $this->assertTrue($container->has('container.env_var_processors_locator')); $this->assertInstanceOf(SimpleProcessor::class, $container->get('container.env_var_processors_locator')->get('foo')); - $expected = array( - 'foo' => array('string'), - 'base64' => array('string'), - 'bool' => array('bool'), - 'const' => array('bool', 'int', 'float', 'string', 'array'), - 'file' => array('string'), - 'float' => array('float'), - 'int' => array('int'), - 'json' => array('array'), - 'resolve' => array('string'), - 'string' => array('string'), - ); + $expected = [ + 'foo' => ['string'], + 'base64' => ['string'], + 'bool' => ['bool'], + 'const' => ['bool', 'int', 'float', 'string', 'array'], + 'file' => ['string'], + 'float' => ['float'], + 'int' => ['int'], + 'json' => ['array'], + 'resolve' => ['string'], + 'string' => ['string'], + ]; $this->assertSame($expected, $container->getParameterBag()->getProvidedTypes()); } @@ -75,7 +75,7 @@ public function getEnv($prefix, $name, \Closure $getEnv) public static function getProvidedTypes() { - return array('foo' => 'string'); + return ['foo' => 'string']; } } @@ -83,6 +83,6 @@ class BadProcessor extends SimpleProcessor { public static function getProvidedTypes() { - return array('foo' => 'string|foo'); + return ['foo' => 'string|foo']; } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/RegisterServiceSubscribersPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/RegisterServiceSubscribersPassTest.php index 42f994e821d97b7c763db866c1488194b917d918..0356c9713318404e53a9b45aac71e494601bab98 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/RegisterServiceSubscribersPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/RegisterServiceSubscribersPassTest.php @@ -53,7 +53,7 @@ public function testInvalidAttributes() $container = new ContainerBuilder(); $container->register('foo', TestServiceSubscriber::class) - ->addTag('container.service_subscriber', array('bar' => '123')) + ->addTag('container.service_subscriber', ['bar' => '123']) ; (new RegisterServiceSubscribersPass())->process($container); @@ -78,12 +78,12 @@ public function testNoAttributes() $this->assertFalse($locator->isPublic()); $this->assertSame(ServiceLocator::class, $locator->getClass()); - $expected = array( + $expected = [ TestServiceSubscriber::class => new ServiceClosureArgument(new TypedReference(TestServiceSubscriber::class, TestServiceSubscriber::class, TestServiceSubscriber::class)), CustomDefinition::class => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)), 'bar' => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class)), 'baz' => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)), - ); + ]; $this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0)); } @@ -95,8 +95,8 @@ public function testWithAttributes() $container->register('foo', TestServiceSubscriber::class) ->setAutowired(true) ->addArgument(new Reference(PsrContainerInterface::class)) - ->addTag('container.service_subscriber', array('key' => 'bar', 'id' => 'bar')) - ->addTag('container.service_subscriber', array('key' => 'bar', 'id' => 'baz')) // should be ignored: the first wins + ->addTag('container.service_subscriber', ['key' => 'bar', 'id' => 'bar']) + ->addTag('container.service_subscriber', ['key' => 'bar', 'id' => 'baz']) // should be ignored: the first wins ; (new RegisterServiceSubscribersPass())->process($container); @@ -108,12 +108,12 @@ public function testWithAttributes() $this->assertFalse($locator->isPublic()); $this->assertSame(ServiceLocator::class, $locator->getClass()); - $expected = array( + $expected = [ TestServiceSubscriber::class => new ServiceClosureArgument(new TypedReference(TestServiceSubscriber::class, TestServiceSubscriber::class, TestServiceSubscriber::class)), CustomDefinition::class => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)), 'bar' => new ServiceClosureArgument(new TypedReference('bar', CustomDefinition::class, TestServiceSubscriber::class)), 'baz' => new ServiceClosureArgument(new TypedReference(CustomDefinition::class, CustomDefinition::class, TestServiceSubscriber::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)), - ); + ]; $this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0)); } @@ -128,10 +128,10 @@ public function testExtraServiceSubscriber() $container->register('foo_service', TestServiceSubscriber::class) ->setAutowired(true) ->addArgument(new Reference(PsrContainerInterface::class)) - ->addTag('container.service_subscriber', array( + ->addTag('container.service_subscriber', [ 'key' => 'test', 'id' => TestServiceSubscriber::class, - )) + ]) ; $container->register(TestServiceSubscriber::class, TestServiceSubscriber::class); $container->compile(); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php index fd26561a247fd7c476624976de6b953dfd904063..1dfdd9dde893b83cfcf6b57af4659fd4ce596416 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php @@ -35,7 +35,7 @@ public function testProcess() ; $container ->register('moo') - ->setArguments(array(new Reference('bar'))) + ->setArguments([new Reference('bar')]) ; $this->process($container); @@ -54,7 +54,7 @@ public function testProcessRemovesUnusedDefinitionsRecursively() ; $container ->register('bar') - ->setArguments(array(new Reference('foo'))) + ->setArguments([new Reference('foo')]) ->setPublic(false) ; @@ -73,7 +73,7 @@ public function testProcessWorksWithInlinedDefinitions() ; $container ->register('bar') - ->setArguments(array(new Definition(null, array(new Reference('foo'))))) + ->setArguments([new Definition(null, [new Reference('foo')])]) ; $this->process($container); @@ -88,12 +88,12 @@ public function testProcessWontRemovePrivateFactory() $container ->register('foo', 'stdClass') - ->setFactory(array('stdClass', 'getInstance')) + ->setFactory(['stdClass', 'getInstance']) ->setPublic(false); $container ->register('bar', 'stdClass') - ->setFactory(array(new Reference('foo'), 'getInstance')) + ->setFactory([new Reference('foo'), 'getInstance']) ->setPublic(false); $container @@ -113,7 +113,7 @@ public function testProcessConsiderEnvVariablesAsUsedEvenInPrivateServices() $container->setParameter('env(FOOBAR)', 'test'); $container ->register('foo') - ->setArguments(array('%env(FOOBAR)%')) + ->setArguments(['%env(FOOBAR)%']) ->setPublic(false) ; @@ -131,7 +131,7 @@ public function testProcessConsiderEnvVariablesAsUsedEvenInPrivateServices() protected function process(ContainerBuilder $container) { - $repeatedPass = new RepeatedPass(array(new AnalyzeServiceReferencesPass(), new RemoveUnusedDefinitionsPass())); + $repeatedPass = new RepeatedPass([new AnalyzeServiceReferencesPass(), new RemoveUnusedDefinitionsPass()]); $repeatedPass->process($container); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php index 7574e7943b4cb4e6dcc1ba812e1ca8c1d5e20e74..f9c755c35e1846c498a102def469c35b80e7e7e3 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php @@ -26,7 +26,7 @@ public function testProcess() $container = new ContainerBuilder(); $aDefinition = $container->register('a', '\stdClass'); - $aDefinition->setFactory(array(new Reference('b'), 'createA')); + $aDefinition->setFactory([new Reference('b'), 'createA']); $bDefinition = new Definition('\stdClass'); $bDefinition->setPublic(false); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php index d59b95af5c406f2fb9d5c4b63dcb42ece4942b40..5118b416f93fa4ee7b352507a678b6cfa9a52082 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php @@ -30,10 +30,10 @@ public function testProcess() { $container = new ContainerBuilder(); - $bindings = array(CaseSensitiveClass::class => new BoundArgument(new Reference('foo'))); + $bindings = [CaseSensitiveClass::class => new BoundArgument(new Reference('foo'))]; $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); - $definition->setArguments(array(1 => '123')); + $definition->setArguments([1 => '123']); $definition->addMethodCall('setSensitiveClass'); $definition->setBindings($bindings); @@ -43,8 +43,8 @@ public function testProcess() $pass = new ResolveBindingsPass(); $pass->process($container); - $this->assertEquals(array(new Reference('foo'), '123'), $definition->getArguments()); - $this->assertEquals(array(array('setSensitiveClass', array(new Reference('foo')))), $definition->getMethodCalls()); + $this->assertEquals([new Reference('foo'), '123'], $definition->getArguments()); + $this->assertEquals([['setSensitiveClass', [new Reference('foo')]]], $definition->getMethodCalls()); } /** @@ -56,7 +56,7 @@ public function testUnusedBinding() $container = new ContainerBuilder(); $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); - $definition->setBindings(array('$quz' => '123')); + $definition->setBindings(['$quz' => '123']); $pass = new ResolveBindingsPass(); $pass->process($container); @@ -71,7 +71,7 @@ public function testMissingParent() $container = new ContainerBuilder(); $definition = $container->register(ParentNotExists::class, ParentNotExists::class); - $definition->setBindings(array('$quz' => '123')); + $definition->setBindings(['$quz' => '123']); $pass = new ResolveBindingsPass(); $pass->process($container); @@ -81,7 +81,7 @@ public function testTypedReferenceSupport() { $container = new ContainerBuilder(); - $bindings = array(CaseSensitiveClass::class => new BoundArgument(new Reference('foo'))); + $bindings = [CaseSensitiveClass::class => new BoundArgument(new Reference('foo'))]; // Explicit service id $definition1 = $container->register('def1', NamedArgumentsDummy::class); @@ -95,8 +95,8 @@ public function testTypedReferenceSupport() $pass = new ResolveBindingsPass(); $pass->process($container); - $this->assertEquals(array($typedRef), $container->getDefinition('def1')->getArguments()); - $this->assertEquals(array(new Reference('foo')), $container->getDefinition('def2')->getArguments()); + $this->assertEquals([$typedRef], $container->getDefinition('def1')->getArguments()); + $this->assertEquals([new Reference('foo')], $container->getDefinition('def2')->getArguments()); } public function testScalarSetter() @@ -104,11 +104,11 @@ public function testScalarSetter() $container = new ContainerBuilder(); $definition = $container->autowire('foo', ScalarSetter::class); - $definition->setBindings(array('$defaultLocale' => 'fr')); + $definition->setBindings(['$defaultLocale' => 'fr']); (new AutowireRequiredMethodsPass())->process($container); (new ResolveBindingsPass())->process($container); - $this->assertEquals(array(array('setDefaultLocale', array('fr'))), $definition->getMethodCalls()); + $this->assertEquals([['setDefaultLocale', ['fr']]], $definition->getMethodCalls()); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php index d30728a48b33b08fbee2e87edc3d010ebb1ae554..4eca8f70738848418f0306ee20f07a472ee51755 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php @@ -22,7 +22,7 @@ class ResolveChildDefinitionsPassTest extends TestCase public function testProcess() { $container = new ContainerBuilder(); - $container->register('parent', 'foo')->setArguments(array('moo', 'b'))->setProperty('foo', 'moo'); + $container->register('parent', 'foo')->setArguments(['moo', 'b'])->setProperty('foo', 'moo'); $container->setDefinition('child', new ChildDefinition('parent')) ->replaceArgument(0, 'a') ->setProperty('foo', 'bar') @@ -34,8 +34,8 @@ public function testProcess() $def = $container->getDefinition('child'); $this->assertNotInstanceOf(ChildDefinition::class, $def); $this->assertEquals('bar', $def->getClass()); - $this->assertEquals(array('a', 'b'), $def->getArguments()); - $this->assertEquals(array('foo' => 'bar'), $def->getProperties()); + $this->assertEquals(['a', 'b'], $def->getArguments()); + $this->assertEquals(['foo' => 'bar'], $def->getProperties()); } public function testProcessAppendsMethodCallsAlways() @@ -44,21 +44,21 @@ public function testProcessAppendsMethodCallsAlways() $container ->register('parent') - ->addMethodCall('foo', array('bar')) + ->addMethodCall('foo', ['bar']) ; $container ->setDefinition('child', new ChildDefinition('parent')) - ->addMethodCall('bar', array('foo')) + ->addMethodCall('bar', ['foo']) ; $this->process($container); $def = $container->getDefinition('child'); - $this->assertEquals(array( - array('foo', array('bar')), - array('bar', array('foo')), - ), $def->getMethodCalls()); + $this->assertEquals([ + ['foo', ['bar']], + ['bar', ['foo']], + ], $def->getMethodCalls()); } public function testProcessDoesNotCopyAbstract() @@ -115,7 +115,7 @@ public function testProcessDoesNotCopyTags() $this->process($container); $def = $container->getDefinition('child'); - $this->assertEquals(array(), $def->getTags()); + $this->assertEquals([], $def->getTags()); } public function testProcessDoesNotCopyDecoratedService() @@ -162,7 +162,7 @@ public function testProcessHandlesMultipleInheritance() $container ->register('parent', 'foo') - ->setArguments(array('foo', 'bar', 'c')) + ->setArguments(['foo', 'bar', 'c']) ; $container @@ -178,7 +178,7 @@ public function testProcessHandlesMultipleInheritance() $this->process($container); $def = $container->getDefinition('child2'); - $this->assertEquals(array('a', 'b', 'c'), $def->getArguments()); + $this->assertEquals(['a', 'b', 'c'], $def->getArguments()); $this->assertEquals('foo', $def->getClass()); } @@ -251,10 +251,10 @@ public function testDeepDefinitionsResolving() $container->register('parent', 'parentClass'); $container->register('sibling', 'siblingClass') ->setConfigurator(new ChildDefinition('parent'), 'foo') - ->setFactory(array(new ChildDefinition('parent'), 'foo')) + ->setFactory([new ChildDefinition('parent'), 'foo']) ->addArgument(new ChildDefinition('parent')) ->setProperty('prop', new ChildDefinition('parent')) - ->addMethodCall('meth', array(new ChildDefinition('parent'))) + ->addMethodCall('meth', [new ChildDefinition('parent')]) ; $this->process($container); @@ -292,7 +292,7 @@ public function testSetDecoratedServiceOnServiceHasParent() $this->process($container); - $this->assertEquals(array('foo', 'foo_inner', 5), $container->getDefinition('child1')->getDecoratedService()); + $this->assertEquals(['foo', 'foo_inner', 5], $container->getDefinition('child1')->getDecoratedService()); } public function testDecoratedServiceCopiesDeprecatedStatusFromParent() @@ -345,10 +345,10 @@ public function testProcessMergeAutowiringTypes() $this->process($container); $childDef = $container->getDefinition('child'); - $this->assertEquals(array('Foo', 'Bar'), $childDef->getAutowiringTypes()); + $this->assertEquals(['Foo', 'Bar'], $childDef->getAutowiringTypes()); $parentDef = $container->getDefinition('parent'); - $this->assertSame(array('Foo'), $parentDef->getAutowiringTypes()); + $this->assertSame(['Foo'], $parentDef->getAutowiringTypes()); } public function testProcessResolvesAliases() @@ -369,17 +369,17 @@ public function testProcessSetsArguments() { $container = new ContainerBuilder(); - $container->register('parent', 'ParentClass')->setArguments(array(0)); - $container->setDefinition('child', (new ChildDefinition('parent'))->setArguments(array( + $container->register('parent', 'ParentClass')->setArguments([0]); + $container->setDefinition('child', (new ChildDefinition('parent'))->setArguments([ 1, 'index_0' => 2, 'foo' => 3, - ))); + ])); $this->process($container); $def = $container->getDefinition('child'); - $this->assertSame(array(2, 1, 'foo' => 3), $def->getArguments()); + $this->assertSame([2, 1, 'foo' => 3], $def->getArguments()); } public function testBindings() @@ -387,20 +387,20 @@ public function testBindings() $container = new ContainerBuilder(); $container->register('parent', 'stdClass') - ->setBindings(array('a' => '1', 'b' => '2')) + ->setBindings(['a' => '1', 'b' => '2']) ; $child = $container->setDefinition('child', new ChildDefinition('parent')) - ->setBindings(array('b' => 'B', 'c' => 'C')) + ->setBindings(['b' => 'B', 'c' => 'C']) ; $this->process($container); - $bindings = array(); + $bindings = []; foreach ($container->getDefinition('child')->getBindings() as $k => $v) { $bindings[$k] = $v->getValues()[0]; } - $this->assertEquals(array('b' => 'B', 'c' => 'C', 'a' => '1'), $bindings); + $this->assertEquals(['b' => 'B', 'c' => 'C', 'a' => '1'], $bindings); } public function testSetAutoconfiguredOnServiceIsParent() @@ -431,4 +431,21 @@ protected function process(ContainerBuilder $container) $pass = new ResolveChildDefinitionsPass(); $pass->process($container); } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + * @expectedExceptionMessageRegExp /^Circular reference detected for service "c", path: "c -> b -> a -> c"./ + */ + public function testProcessDetectsChildDefinitionIndirectCircularReference() + { + $container = new ContainerBuilder(); + + $container->register('a'); + + $container->setDefinition('b', new ChildDefinition('a')); + $container->setDefinition('c', new ChildDefinition('b')); + $container->setDefinition('a', new ChildDefinition('c')); + + $this->process($container); + } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveClassPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveClassPassTest.php index acbcf1dda2d8ce5c0253a4e21e84ec0d96ffc4fa..48df3843dc5b1bc8a2d6b9948587325f9b7b2413 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveClassPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveClassPassTest.php @@ -34,8 +34,8 @@ public function testResolveClassFromId($serviceId) public function provideValidClassId() { - yield array('Acme\UnknownClass'); - yield array(CaseSensitiveClass::class); + yield ['Acme\UnknownClass']; + yield [CaseSensitiveClass::class]; } /** @@ -53,9 +53,9 @@ public function testWontResolveClassFromId($serviceId) public function provideInvalidClassId() { - yield array(\stdClass::class); - yield array('bar'); - yield array('\DateTime'); + yield [\stdClass::class]; + yield ['bar']; + yield ['\DateTime']; } public function testNonFqcnChildDefinition() diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php index 39ae7f4f622971c3c36dcf9bc7dc854bfdf59eba..407c803cbc7cbea2e9fc39d63197f19ced84ecbf 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php @@ -24,7 +24,7 @@ class ResolveDefinitionTemplatesPassTest extends TestCase public function testProcess() { $container = new ContainerBuilder(); - $container->register('parent', 'foo')->setArguments(array('moo', 'b'))->setProperty('foo', 'moo'); + $container->register('parent', 'foo')->setArguments(['moo', 'b'])->setProperty('foo', 'moo'); $container->setDefinition('child', new ChildDefinition('parent')) ->replaceArgument(0, 'a') ->setProperty('foo', 'bar') @@ -36,8 +36,8 @@ public function testProcess() $def = $container->getDefinition('child'); $this->assertNotInstanceOf(ChildDefinition::class, $def); $this->assertEquals('bar', $def->getClass()); - $this->assertEquals(array('a', 'b'), $def->getArguments()); - $this->assertEquals(array('foo' => 'bar'), $def->getProperties()); + $this->assertEquals(['a', 'b'], $def->getArguments()); + $this->assertEquals(['foo' => 'bar'], $def->getProperties()); } public function testProcessAppendsMethodCallsAlways() @@ -46,21 +46,21 @@ public function testProcessAppendsMethodCallsAlways() $container ->register('parent') - ->addMethodCall('foo', array('bar')) + ->addMethodCall('foo', ['bar']) ; $container ->setDefinition('child', new ChildDefinition('parent')) - ->addMethodCall('bar', array('foo')) + ->addMethodCall('bar', ['foo']) ; $this->process($container); $def = $container->getDefinition('child'); - $this->assertEquals(array( - array('foo', array('bar')), - array('bar', array('foo')), - ), $def->getMethodCalls()); + $this->assertEquals([ + ['foo', ['bar']], + ['bar', ['foo']], + ], $def->getMethodCalls()); } public function testProcessDoesNotCopyAbstract() @@ -117,7 +117,7 @@ public function testProcessDoesNotCopyTags() $this->process($container); $def = $container->getDefinition('child'); - $this->assertEquals(array(), $def->getTags()); + $this->assertEquals([], $def->getTags()); } public function testProcessDoesNotCopyDecoratedService() @@ -164,7 +164,7 @@ public function testProcessHandlesMultipleInheritance() $container ->register('parent', 'foo') - ->setArguments(array('foo', 'bar', 'c')) + ->setArguments(['foo', 'bar', 'c']) ; $container @@ -180,7 +180,7 @@ public function testProcessHandlesMultipleInheritance() $this->process($container); $def = $container->getDefinition('child2'); - $this->assertEquals(array('a', 'b', 'c'), $def->getArguments()); + $this->assertEquals(['a', 'b', 'c'], $def->getArguments()); $this->assertEquals('foo', $def->getClass()); } @@ -253,10 +253,10 @@ public function testDeepDefinitionsResolving() $container->register('parent', 'parentClass'); $container->register('sibling', 'siblingClass') ->setConfigurator(new ChildDefinition('parent'), 'foo') - ->setFactory(array(new ChildDefinition('parent'), 'foo')) + ->setFactory([new ChildDefinition('parent'), 'foo']) ->addArgument(new ChildDefinition('parent')) ->setProperty('prop', new ChildDefinition('parent')) - ->addMethodCall('meth', array(new ChildDefinition('parent'))) + ->addMethodCall('meth', [new ChildDefinition('parent')]) ; $this->process($container); @@ -294,7 +294,7 @@ public function testSetDecoratedServiceOnServiceHasParent() $this->process($container); - $this->assertEquals(array('foo', 'foo_inner', 5), $container->getDefinition('child1')->getDecoratedService()); + $this->assertEquals(['foo', 'foo_inner', 5], $container->getDefinition('child1')->getDecoratedService()); } public function testDecoratedServiceCopiesDeprecatedStatusFromParent() @@ -347,10 +347,10 @@ public function testProcessMergeAutowiringTypes() $this->process($container); $childDef = $container->getDefinition('child'); - $this->assertEquals(array('Foo', 'Bar'), $childDef->getAutowiringTypes()); + $this->assertEquals(['Foo', 'Bar'], $childDef->getAutowiringTypes()); $parentDef = $container->getDefinition('parent'); - $this->assertSame(array('Foo'), $parentDef->getAutowiringTypes()); + $this->assertSame(['Foo'], $parentDef->getAutowiringTypes()); } public function testProcessResolvesAliases() @@ -371,17 +371,17 @@ public function testProcessSetsArguments() { $container = new ContainerBuilder(); - $container->register('parent', 'ParentClass')->setArguments(array(0)); - $container->setDefinition('child', (new ChildDefinition('parent'))->setArguments(array( + $container->register('parent', 'ParentClass')->setArguments([0]); + $container->setDefinition('child', (new ChildDefinition('parent'))->setArguments([ 1, 'index_0' => 2, 'foo' => 3, - ))); + ])); $this->process($container); $def = $container->getDefinition('child'); - $this->assertSame(array(2, 1, 'foo' => 3), $def->getArguments()); + $this->assertSame([2, 1, 'foo' => 3], $def->getArguments()); } public function testSetAutoconfiguredOnServiceIsParent() diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveFactoryClassPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveFactoryClassPassTest.php index 96453c30381e23ce838f31774a7811d7f3448d30..3438fad0689f3bfd5a3b58f44cbe68b9fb2758c5 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveFactoryClassPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveFactoryClassPassTest.php @@ -24,12 +24,12 @@ public function testProcess() $container = new ContainerBuilder(); $factory = $container->register('factory', 'Foo\Bar'); - $factory->setFactory(array(null, 'create')); + $factory->setFactory([null, 'create']); $pass = new ResolveFactoryClassPass(); $pass->process($container); - $this->assertSame(array('Foo\Bar', 'create'), $factory->getFactory()); + $this->assertSame(['Foo\Bar', 'create'], $factory->getFactory()); } public function testInlinedDefinitionFactoryIsProcessed() @@ -37,21 +37,21 @@ public function testInlinedDefinitionFactoryIsProcessed() $container = new ContainerBuilder(); $factory = $container->register('factory'); - $factory->setFactory(array((new Definition('Baz\Qux'))->setFactory(array(null, 'getInstance')), 'create')); + $factory->setFactory([(new Definition('Baz\Qux'))->setFactory([null, 'getInstance']), 'create']); $pass = new ResolveFactoryClassPass(); $pass->process($container); - $this->assertSame(array('Baz\Qux', 'getInstance'), $factory->getFactory()[0]->getFactory()); + $this->assertSame(['Baz\Qux', 'getInstance'], $factory->getFactory()[0]->getFactory()); } public function provideFulfilledFactories() { - return array( - array(array('Foo\Bar', 'create')), - array(array(new Reference('foo'), 'create')), - array(array(new Definition('Baz'), 'create')), - ); + return [ + [['Foo\Bar', 'create']], + [[new Reference('foo'), 'create']], + [[new Definition('Baz'), 'create']], + ]; } /** @@ -80,7 +80,7 @@ public function testNotAnyClassThrowsException() $container = new ContainerBuilder(); $factory = $container->register('factory'); - $factory->setFactory(array(null, 'create')); + $factory->setFactory([null, 'create']); $pass = new ResolveFactoryClassPass(); $pass->process($container); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveHotPathPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveHotPathPassTest.php index d2ba590047caa6206bcd0984cecf02d389f644bf..a2fece0580b86dbf883e23326df5e7513b448f85 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveHotPathPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveHotPathPassTest.php @@ -26,9 +26,9 @@ public function testProcess() $container->register('foo') ->addTag('container.hot_path') - ->addArgument(new IteratorArgument(array(new Reference('lazy')))) + ->addArgument(new IteratorArgument([new Reference('lazy')])) ->addArgument(new Reference('service_container')) - ->addArgument(new Definition('', array(new Reference('bar')))) + ->addArgument(new Definition('', [new Reference('bar')])) ->addArgument(new Reference('baz', ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE)) ->addArgument(new Reference('missing')) ; diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php index ad6f79d4051b121c12dfa623e755153be71d4e95..26560b4ca32490979cffe23b1b0320e532c4eb1d 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php @@ -23,10 +23,10 @@ class ResolveInstanceofConditionalsPassTest extends TestCase public function testProcess() { $container = new ContainerBuilder(); - $def = $container->register('foo', self::class)->addTag('tag')->setAutowired(true)->setChanges(array()); - $def->setInstanceofConditionals(array( - parent::class => (new ChildDefinition(''))->setProperty('foo', 'bar')->addTag('baz', array('attr' => 123)), - )); + $def = $container->register('foo', self::class)->addTag('tag')->setAutowired(true)->setChanges([]); + $def->setInstanceofConditionals([ + parent::class => (new ChildDefinition(''))->setProperty('foo', 'bar')->addTag('baz', ['attr' => 123]), + ]); (new ResolveInstanceofConditionalsPass())->process($container); @@ -36,11 +36,11 @@ public function testProcess() $this->assertInstanceOf(ChildDefinition::class, $def); $this->assertTrue($def->isAutowired()); $this->assertSame($parent, $def->getParent()); - $this->assertSame(array('tag' => array(array()), 'baz' => array(array('attr' => 123))), $def->getTags()); + $this->assertSame(['tag' => [[]], 'baz' => [['attr' => 123]]], $def->getTags()); $parent = $container->getDefinition($parent); - $this->assertSame(array('foo' => 'bar'), $parent->getProperties()); - $this->assertSame(array(), $parent->getTags()); + $this->assertSame(['foo' => 'bar'], $parent->getProperties()); + $this->assertSame([], $parent->getTags()); } public function testProcessInheritance() @@ -49,10 +49,10 @@ public function testProcessInheritance() $def = $container ->register('parent', parent::class) - ->addMethodCall('foo', array('foo')); - $def->setInstanceofConditionals(array( - parent::class => (new ChildDefinition(''))->addMethodCall('foo', array('bar')), - )); + ->addMethodCall('foo', ['foo']); + $def->setInstanceofConditionals([ + parent::class => (new ChildDefinition(''))->addMethodCall('foo', ['bar']), + ]); $def = (new ChildDefinition('parent'))->setClass(self::class); $container->setDefinition('child', $def); @@ -60,10 +60,10 @@ public function testProcessInheritance() (new ResolveInstanceofConditionalsPass())->process($container); (new ResolveChildDefinitionsPass())->process($container); - $expected = array( - array('foo', array('bar')), - array('foo', array('foo')), - ); + $expected = [ + ['foo', ['bar']], + ['foo', ['foo']], + ]; $this->assertSame($expected, $container->getDefinition('parent')->getMethodCalls()); $this->assertSame($expected, $container->getDefinition('child')->getMethodCalls()); @@ -74,9 +74,9 @@ public function testProcessDoesReplaceShared() $container = new ContainerBuilder(); $def = $container->register('foo', 'stdClass'); - $def->setInstanceofConditionals(array( + $def->setInstanceofConditionals([ 'stdClass' => (new ChildDefinition(''))->setShared(false), - )); + ]); (new ResolveInstanceofConditionalsPass())->process($container); @@ -90,10 +90,10 @@ public function testProcessHandlesMultipleInheritance() $def = $container->register('foo', self::class)->setShared(true); - $def->setInstanceofConditionals(array( + $def->setInstanceofConditionals([ parent::class => (new ChildDefinition(''))->setLazy(true)->setShared(false), self::class => (new ChildDefinition(''))->setAutowired(true), - )); + ]); (new ResolveInstanceofConditionalsPass())->process($container); (new ResolveChildDefinitionsPass())->process($container); @@ -108,11 +108,11 @@ public function testProcessUsesAutoconfiguredInstanceof() { $container = new ContainerBuilder(); $def = $container->register('normal_service', self::class); - $def->setInstanceofConditionals(array( + $def->setInstanceofConditionals([ parent::class => (new ChildDefinition('')) ->addTag('local_instanceof_tag') ->setFactory('locally_set_factory'), - )); + ]); $def->setAutoconfigured(true); $container->registerForAutoconfiguration(parent::class) ->addTag('autoconfigured_tag') @@ -128,7 +128,7 @@ public function testProcessUsesAutoconfiguredInstanceof() // factory from the specific instanceof overrides global one $this->assertEquals('locally_set_factory', $def->getFactory()); // tags are merged, the locally set one is first - $this->assertSame(array('local_instanceof_tag' => array(array()), 'autoconfigured_tag' => array(array())), $def->getTags()); + $this->assertSame(['local_instanceof_tag' => [[]], 'autoconfigured_tag' => [[]]], $def->getTags()); } public function testAutoconfigureInstanceofDoesNotDuplicateTags() @@ -137,31 +137,31 @@ public function testAutoconfigureInstanceofDoesNotDuplicateTags() $def = $container->register('normal_service', self::class); $def ->addTag('duplicated_tag') - ->addTag('duplicated_tag', array('and_attributes' => 1)) + ->addTag('duplicated_tag', ['and_attributes' => 1]) ; - $def->setInstanceofConditionals(array( + $def->setInstanceofConditionals([ parent::class => (new ChildDefinition(''))->addTag('duplicated_tag'), - )); + ]); $def->setAutoconfigured(true); $container->registerForAutoconfiguration(parent::class) - ->addTag('duplicated_tag', array('and_attributes' => 1)) + ->addTag('duplicated_tag', ['and_attributes' => 1]) ; (new ResolveInstanceofConditionalsPass())->process($container); (new ResolveChildDefinitionsPass())->process($container); $def = $container->getDefinition('normal_service'); - $this->assertSame(array('duplicated_tag' => array(array(), array('and_attributes' => 1))), $def->getTags()); + $this->assertSame(['duplicated_tag' => [[], ['and_attributes' => 1]]], $def->getTags()); } public function testProcessDoesNotUseAutoconfiguredInstanceofIfNotEnabled() { $container = new ContainerBuilder(); $def = $container->register('normal_service', self::class); - $def->setInstanceofConditionals(array( + $def->setInstanceofConditionals([ parent::class => (new ChildDefinition('')) ->addTag('foo_tag'), - )); + ]); $container->registerForAutoconfiguration(parent::class) ->setAutowired(true); @@ -180,10 +180,10 @@ public function testBadInterfaceThrowsException() { $container = new ContainerBuilder(); $def = $container->register('normal_service', self::class); - $def->setInstanceofConditionals(array( + $def->setInstanceofConditionals([ 'App\\FakeInterface' => (new ChildDefinition('')) ->addTag('foo_tag'), - )); + ]); (new ResolveInstanceofConditionalsPass())->process($container); } @@ -236,9 +236,9 @@ public function testMergeReset() ->addMethodCall('setB') ->setDecoratedService('foo') ->addTag('t') - ->setInstanceofConditionals(array( + ->setInstanceofConditionals([ parent::class => (new ChildDefinition(''))->addTag('bar'), - )) + ]) ; (new ResolveInstanceofConditionalsPass())->process($container); @@ -255,13 +255,13 @@ public function testMergeReset() public function testBindings() { $container = new ContainerBuilder(); - $def = $container->register('foo', self::class)->setBindings(array('$toto' => 123)); - $def->setInstanceofConditionals(array(parent::class => new ChildDefinition(''))); + $def = $container->register('foo', self::class)->setBindings(['$toto' => 123]); + $def->setInstanceofConditionals([parent::class => new ChildDefinition('')]); (new ResolveInstanceofConditionalsPass())->process($container); $bindings = $container->getDefinition('foo')->getBindings(); - $this->assertSame(array('$toto'), array_keys($bindings)); + $this->assertSame(['$toto'], array_keys($bindings)); $this->assertInstanceOf(BoundArgument::class, $bindings['$toto']); $this->assertSame(123, $bindings['$toto']->getValues()[0]); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php index 61bad48a54668ad977ea6d56802db702877f7da0..817cc64ce31d76ab2ce279a970dc63010344c1a9 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php @@ -25,17 +25,17 @@ public function testProcess() $container = new ContainerBuilder(); $def = $container ->register('foo') - ->setArguments(array( + ->setArguments([ new Reference('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE), new Reference('baz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), - )) - ->addMethodCall('foo', array(new Reference('moo', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))) + ]) + ->addMethodCall('foo', [new Reference('moo', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]) ; $this->process($container); $arguments = $def->getArguments(); - $this->assertSame(array(null, null), $arguments); + $this->assertSame([null, null], $arguments); $this->assertCount(0, $def->getMethodCalls()); } @@ -45,19 +45,19 @@ public function testProcessIgnoreInvalidArgumentInCollectionArgument() $container->register('baz'); $def = $container ->register('foo') - ->setArguments(array( - array( + ->setArguments([ + [ new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), $baz = new Reference('baz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), new Reference('moo', ContainerInterface::NULL_ON_INVALID_REFERENCE), - ), - )) + ], + ]) ; $this->process($container); $arguments = $def->getArguments(); - $this->assertSame(array($baz, null), $arguments[0]); + $this->assertSame([$baz, null], $arguments[0]); } public function testProcessKeepMethodCallOnInvalidArgumentInCollectionArgument() @@ -66,20 +66,20 @@ public function testProcessKeepMethodCallOnInvalidArgumentInCollectionArgument() $container->register('baz'); $def = $container ->register('foo') - ->addMethodCall('foo', array( - array( + ->addMethodCall('foo', [ + [ new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), $baz = new Reference('baz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), new Reference('moo', ContainerInterface::NULL_ON_INVALID_REFERENCE), - ), - )) + ], + ]) ; $this->process($container); $calls = $def->getMethodCalls(); $this->assertCount(1, $def->getMethodCalls()); - $this->assertSame(array($baz, null), $calls[0][1][0]); + $this->assertSame([$baz, null], $calls[0][1][0]); } public function testProcessIgnoreNonExistentServices() @@ -87,7 +87,7 @@ public function testProcessIgnoreNonExistentServices() $container = new ContainerBuilder(); $def = $container ->register('foo') - ->setArguments(array(new Reference('bar'))) + ->setArguments([new Reference('bar')]) ; $this->process($container); @@ -106,7 +106,7 @@ public function testProcessRemovesPropertiesOnInvalid() $this->process($container); - $this->assertEquals(array(), $def->getProperties()); + $this->assertEquals([], $def->getProperties()); } public function testProcessRemovesArgumentsOnInvalid() @@ -114,17 +114,17 @@ public function testProcessRemovesArgumentsOnInvalid() $container = new ContainerBuilder(); $def = $container ->register('foo') - ->addArgument(array( - array( + ->addArgument([ + [ new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), new ServiceClosureArgument(new Reference('baz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)), - ), - )) + ], + ]) ; $this->process($container); - $this->assertSame(array(array(array())), $def->getArguments()); + $this->assertSame([[[]]], $def->getArguments()); } protected function process(ContainerBuilder $container) diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveNamedArgumentsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveNamedArgumentsPassTest.php index fe681b41df7885182783319165c66c8fdcbf2d3f..e25d96f5396c2b33dd55647f8819e497ef312d51 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveNamedArgumentsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveNamedArgumentsPassTest.php @@ -16,8 +16,10 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; +use Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummyWithoutReturnTypes; use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy; use Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy; +use Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1; /** * @author Kévin Dunglas <dunglas@gmail.com> @@ -29,18 +31,18 @@ public function testProcess() $container = new ContainerBuilder(); $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); - $definition->setArguments(array( + $definition->setArguments([ 2 => 'http://api.example.com', '$apiKey' => '123', 0 => new Reference('foo'), - )); - $definition->addMethodCall('setApiKey', array('$apiKey' => '123')); + ]); + $definition->addMethodCall('setApiKey', ['$apiKey' => '123']); $pass = new ResolveNamedArgumentsPass(); $pass->process($container); - $this->assertEquals(array(0 => new Reference('foo'), 1 => '123', 2 => 'http://api.example.com'), $definition->getArguments()); - $this->assertEquals(array(array('setApiKey', array('123'))), $definition->getMethodCalls()); + $this->assertEquals([0 => new Reference('foo'), 1 => '123', 2 => 'http://api.example.com'], $definition->getArguments()); + $this->assertEquals([['setApiKey', ['123']]], $definition->getMethodCalls()); } public function testWithFactory() @@ -49,13 +51,13 @@ public function testWithFactory() $container->register('factory', NoConstructor::class); $definition = $container->register('foo', NoConstructor::class) - ->setFactory(array(new Reference('factory'), 'create')) - ->setArguments(array('$apiKey' => '123')); + ->setFactory([new Reference('factory'), 'create']) + ->setArguments(['$apiKey' => '123']); $pass = new ResolveNamedArgumentsPass(); $pass->process($container); - $this->assertSame(array(0 => '123'), $definition->getArguments()); + $this->assertSame([0 => '123'], $definition->getArguments()); } /** @@ -66,7 +68,7 @@ public function testClassNull() $container = new ContainerBuilder(); $definition = $container->register(NamedArgumentsDummy::class); - $definition->setArguments(array('$apiKey' => '123')); + $definition->setArguments(['$apiKey' => '123']); $pass = new ResolveNamedArgumentsPass(); $pass->process($container); @@ -80,7 +82,7 @@ public function testClassNotExist() $container = new ContainerBuilder(); $definition = $container->register(NotExist::class, NotExist::class); - $definition->setArguments(array('$apiKey' => '123')); + $definition->setArguments(['$apiKey' => '123']); $pass = new ResolveNamedArgumentsPass(); $pass->process($container); @@ -94,7 +96,7 @@ public function testClassNoConstructor() $container = new ContainerBuilder(); $definition = $container->register(NoConstructor::class, NoConstructor::class); - $definition->setArguments(array('$apiKey' => '123')); + $definition->setArguments(['$apiKey' => '123']); $pass = new ResolveNamedArgumentsPass(); $pass->process($container); @@ -102,13 +104,32 @@ public function testClassNoConstructor() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException + * @expectedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy": method "__construct()" has no argument named "$notFound". Check your service definition. */ public function testArgumentNotFound() { $container = new ContainerBuilder(); $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); - $definition->setArguments(array('$notFound' => '123')); + $definition->setArguments(['$notFound' => '123']); + + $pass = new ResolveNamedArgumentsPass(); + $pass->process($container); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException + * @expectedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1": method "Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummyWithoutReturnTypes::createTestDefinition1()" has no argument named "$notFound". Check your service definition. + */ + public function testCorrectMethodReportedInException() + { + $container = new ContainerBuilder(); + + $container->register(FactoryDummyWithoutReturnTypes::class, FactoryDummyWithoutReturnTypes::class); + + $definition = $container->register(TestDefinition1::class, TestDefinition1::class); + $definition->setFactory([FactoryDummyWithoutReturnTypes::class, 'createTestDefinition1']); + $definition->setArguments(['$notFound' => '123']); $pass = new ResolveNamedArgumentsPass(); $pass->process($container); @@ -119,12 +140,12 @@ public function testTypedArgument() $container = new ContainerBuilder(); $definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class); - $definition->setArguments(array('$apiKey' => '123', CaseSensitiveClass::class => new Reference('foo'))); + $definition->setArguments(['$apiKey' => '123', CaseSensitiveClass::class => new Reference('foo')]); $pass = new ResolveNamedArgumentsPass(); $pass->process($container); - $this->assertEquals(array(new Reference('foo'), '123'), $definition->getArguments()); + $this->assertEquals([new Reference('foo'), '123'], $definition->getArguments()); } public function testResolvesMultipleArgumentsOfTheSameType() @@ -132,12 +153,12 @@ public function testResolvesMultipleArgumentsOfTheSameType() $container = new ContainerBuilder(); $definition = $container->register(SimilarArgumentsDummy::class, SimilarArgumentsDummy::class); - $definition->setArguments(array(CaseSensitiveClass::class => new Reference('foo'), '$token' => 'qwerty')); + $definition->setArguments([CaseSensitiveClass::class => new Reference('foo'), '$token' => 'qwerty']); $pass = new ResolveNamedArgumentsPass(); $pass->process($container); - $this->assertEquals(array(new Reference('foo'), 'qwerty', new Reference('foo')), $definition->getArguments()); + $this->assertEquals([new Reference('foo'), 'qwerty', new Reference('foo')], $definition->getArguments()); } public function testResolvePrioritizeNamedOverType() @@ -145,12 +166,12 @@ public function testResolvePrioritizeNamedOverType() $container = new ContainerBuilder(); $definition = $container->register(SimilarArgumentsDummy::class, SimilarArgumentsDummy::class); - $definition->setArguments(array(CaseSensitiveClass::class => new Reference('foo'), '$token' => 'qwerty', '$class1' => new Reference('bar'))); + $definition->setArguments([CaseSensitiveClass::class => new Reference('foo'), '$token' => 'qwerty', '$class1' => new Reference('bar')]); $pass = new ResolveNamedArgumentsPass(); $pass->process($container); - $this->assertEquals(array(new Reference('bar'), 'qwerty', new Reference('foo')), $definition->getArguments()); + $this->assertEquals([new Reference('bar'), 'qwerty', new Reference('foo')], $definition->getArguments()); } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php index a34e007de7f00b81541b8886f5e809bfd9cd189f..5aa6471751f24b18e00837ab7b6161d0bb441a66 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php @@ -36,22 +36,22 @@ public function testClassParametersShouldBeResolved() public function testFactoryParametersShouldBeResolved() { - $this->assertSame(array('FooFactory', 'getFoo'), $this->fooDefinition->getFactory()); + $this->assertSame(['FooFactory', 'getFoo'], $this->fooDefinition->getFactory()); } public function testArgumentParametersShouldBeResolved() { - $this->assertSame(array('bar', array('bar' => 'baz')), $this->fooDefinition->getArguments()); + $this->assertSame(['bar', ['bar' => 'baz']], $this->fooDefinition->getArguments()); } public function testMethodCallParametersShouldBeResolved() { - $this->assertSame(array(array('foobar', array('bar', array('bar' => 'baz')))), $this->fooDefinition->getMethodCalls()); + $this->assertSame([['foobar', ['bar', ['bar' => 'baz']]]], $this->fooDefinition->getMethodCalls()); } public function testPropertyParametersShouldBeResolved() { - $this->assertSame(array('bar' => 'baz'), $this->fooDefinition->getProperties()); + $this->assertSame(['bar' => 'baz'], $this->fooDefinition->getProperties()); } public function testFileParametersShouldBeResolved() @@ -78,7 +78,7 @@ private function createContainerBuilder() $containerBuilder->setParameter('foo.class', 'Foo'); $containerBuilder->setParameter('foo.factory.class', 'FooFactory'); $containerBuilder->setParameter('foo.arg1', 'bar'); - $containerBuilder->setParameter('foo.arg2', array('%foo.arg1%' => 'baz')); + $containerBuilder->setParameter('foo.arg2', ['%foo.arg1%' => 'baz']); $containerBuilder->setParameter('foo.method', 'foobar'); $containerBuilder->setParameter('foo.property.name', 'bar'); $containerBuilder->setParameter('foo.property.value', 'baz'); @@ -86,12 +86,12 @@ private function createContainerBuilder() $containerBuilder->setParameter('alias.id', 'bar'); $fooDefinition = $containerBuilder->register('foo', '%foo.class%'); - $fooDefinition->setFactory(array('%foo.factory.class%', 'getFoo')); - $fooDefinition->setArguments(array('%foo.arg1%', array('%foo.arg1%' => 'baz'))); - $fooDefinition->addMethodCall('%foo.method%', array('%foo.arg1%', '%foo.arg2%')); + $fooDefinition->setFactory(['%foo.factory.class%', 'getFoo']); + $fooDefinition->setArguments(['%foo.arg1%', ['%foo.arg1%' => 'baz']]); + $fooDefinition->addMethodCall('%foo.method%', ['%foo.arg1%', '%foo.arg2%']); $fooDefinition->setProperty('%foo.property.name%', '%foo.property.value%'); $fooDefinition->setFile('%foo.file%'); - $fooDefinition->setBindings(array('$baz' => '%env(BAZ)%')); + $fooDefinition->setBindings(['$baz' => '%env(BAZ)%']); $containerBuilder->setAlias('%alias.id%', 'foo'); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php index 6fb619718a646d801590082725a37754f1126811..55b47057b1fd506fcd57f993bac3e2a9d08f8972 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php @@ -26,7 +26,7 @@ public function testProcess() $container->setAlias('bar', 'foo'); $def = $container ->register('moo') - ->setArguments(array(new Reference('bar'))) + ->setArguments([new Reference('bar')]) ; $this->process($container); @@ -42,7 +42,7 @@ public function testProcessRecursively() $container->setAlias('moo', 'bar'); $def = $container ->register('foobar') - ->setArguments(array(new Reference('moo'))) + ->setArguments([new Reference('moo')]) ; $this->process($container); @@ -68,10 +68,10 @@ public function testResolveFactory() $container->register('factory', 'Factory'); $container->setAlias('factory_alias', new Alias('factory')); $foo = new Definition(); - $foo->setFactory(array(new Reference('factory_alias'), 'createFoo')); + $foo->setFactory([new Reference('factory_alias'), 'createFoo']); $container->setDefinition('foo', $foo); $bar = new Definition(); - $bar->setFactory(array('Factory', 'createFoo')); + $bar->setFactory(['Factory', 'createFoo']); $container->setDefinition('bar', $bar); $this->process($container); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveTaggedIteratorArgumentPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveTaggedIteratorArgumentPassTest.php index a219f860078b797527f88d5474bcf6a8bde4f36f..2322817e86662b5f406d2438234eeb57f1450a86 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveTaggedIteratorArgumentPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveTaggedIteratorArgumentPassTest.php @@ -26,15 +26,15 @@ public function testProcess() { $container = new ContainerBuilder(); $container->register('a', 'stdClass')->addTag('foo'); - $container->register('b', 'stdClass')->addTag('foo', array('priority' => 20)); - $container->register('c', 'stdClass')->addTag('foo', array('priority' => 10)); + $container->register('b', 'stdClass')->addTag('foo', ['priority' => 20]); + $container->register('c', 'stdClass')->addTag('foo', ['priority' => 10]); $container->register('d', 'stdClass')->setProperty('foos', new TaggedIteratorArgument('foo')); (new ResolveTaggedIteratorArgumentPass())->process($container); $properties = $container->getDefinition('d')->getProperties(); $expected = new TaggedIteratorArgument('foo'); - $expected->setValues(array(new Reference('b'), new Reference('c'), new Reference('a'))); + $expected->setValues([new Reference('b'), new Reference('c'), new Reference('a')]); $this->assertEquals($expected, $properties['foos']); } } diff --git a/vendor/symfony/dependency-injection/Tests/Config/AutowireServiceResourceTest.php b/vendor/symfony/dependency-injection/Tests/Config/AutowireServiceResourceTest.php index 64d99e6375b8f256bccdace7878c6e93733d71fc..153e0807ef862694ba7733471f40a73dfc96833a 100644 --- a/vendor/symfony/dependency-injection/Tests/Config/AutowireServiceResourceTest.php +++ b/vendor/symfony/dependency-injection/Tests/Config/AutowireServiceResourceTest.php @@ -38,7 +38,7 @@ protected function setUp() $this->resource = new AutowireServiceResource( $this->class, $this->file, - array() + [] ); } @@ -73,7 +73,7 @@ public function testIsNotFreshChangedResource() $oldResource = new AutowireServiceResource( $this->class, $this->file, - array('will_be_different') + ['will_be_different'] ); // test with a stale file *and* a resource that *will* be different than the actual @@ -95,7 +95,7 @@ public function testNotFreshIfClassNotFound() $resource = new AutowireServiceResource( 'Some\Non\Existent\Class', $this->file, - array() + [] ); $this->assertFalse($resource->isFresh($this->getStaleFileTime()), '->isFresh() returns false if the class no longer exists'); diff --git a/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceCheckerTest.php b/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceCheckerTest.php index a91934b3ef8f029ed02dfd78c3bc205f1c4ca349..fc2d85ecf9560dec843b5bd77150d824114d065d 100644 --- a/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceCheckerTest.php +++ b/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceCheckerTest.php @@ -30,7 +30,7 @@ class ContainerParametersResourceCheckerTest extends TestCase protected function setUp() { - $this->resource = new ContainerParametersResource(array('locales' => array('fr', 'en'), 'default_locale' => 'fr')); + $this->resource = new ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']); $this->container = $this->getMockBuilder(ContainerInterface::class)->getMock(); $this->resourceChecker = new ContainerParametersResourceChecker($this->container); } @@ -52,26 +52,26 @@ public function testIsFresh(callable $mockContainer, $expected) public function isFreshProvider() { - yield 'not fresh on missing parameter' => array(function (\PHPUnit_Framework_MockObject_MockObject $container) { + yield 'not fresh on missing parameter' => [function (\PHPUnit_Framework_MockObject_MockObject $container) { $container->method('hasParameter')->with('locales')->willReturn(false); - }, false); + }, false]; - yield 'not fresh on different value' => array(function (\PHPUnit_Framework_MockObject_MockObject $container) { - $container->method('getParameter')->with('locales')->willReturn(array('nl', 'es')); - }, false); + yield 'not fresh on different value' => [function (\PHPUnit_Framework_MockObject_MockObject $container) { + $container->method('getParameter')->with('locales')->willReturn(['nl', 'es']); + }, false]; - yield 'fresh on every identical parameters' => array(function (\PHPUnit_Framework_MockObject_MockObject $container) { + yield 'fresh on every identical parameters' => [function (\PHPUnit_Framework_MockObject_MockObject $container) { $container->expects($this->exactly(2))->method('hasParameter')->willReturn(true); $container->expects($this->exactly(2))->method('getParameter') ->withConsecutive( - array($this->equalTo('locales')), - array($this->equalTo('default_locale')) + [$this->equalTo('locales')], + [$this->equalTo('default_locale')] ) - ->will($this->returnValueMap(array( - array('locales', array('fr', 'en')), - array('default_locale', 'fr'), - ))) + ->will($this->returnValueMap([ + ['locales', ['fr', 'en']], + ['default_locale', 'fr'], + ])) ; - }, true); + }, true]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceTest.php b/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceTest.php index 4da4766f272539506a0bce51e1a30aba242f97fc..e177ac16b80f74380284b615caf383982ad3cd2d 100644 --- a/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceTest.php +++ b/vendor/symfony/dependency-injection/Tests/Config/ContainerParametersResourceTest.php @@ -21,7 +21,7 @@ class ContainerParametersResourceTest extends TestCase protected function setUp() { - $this->resource = new ContainerParametersResource(array('locales' => array('fr', 'en'), 'default_locale' => 'fr')); + $this->resource = new ContainerParametersResource(['locales' => ['fr', 'en'], 'default_locale' => 'fr']); } public function testToString() @@ -38,6 +38,6 @@ public function testSerializeUnserialize() public function testGetParameters() { - $this->assertSame(array('locales' => array('fr', 'en'), 'default_locale' => 'fr'), $this->resource->getParameters()); + $this->assertSame(['locales' => ['fr', 'en'], 'default_locale' => 'fr'], $this->resource->getParameters()); } } diff --git a/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php b/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php index e370157d41fa6a23708e561b47ef69c4ed2ef833..40afaa169d02e49874e46f09e1749260bdb071db 100644 --- a/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php +++ b/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php @@ -62,10 +62,10 @@ public function testDefaultRegisteredDefinitions() public function testDefinitions() { $builder = new ContainerBuilder(); - $definitions = array( + $definitions = [ 'foo' => new Definition('Bar\FooClass'), 'bar' => new Definition('BarClass'), - ); + ]; $builder->setDefinitions($definitions); $this->assertEquals($definitions, $builder->getDefinitions(), '->setDefinitions() sets the service definitions'); $this->assertTrue($builder->hasDefinition('foo'), '->hasDefinition() returns true if a service definition exists'); @@ -75,7 +75,7 @@ public function testDefinitions() $this->assertEquals($foo, $builder->getDefinition('foobar'), '->getDefinition() returns a service definition if defined'); $this->assertSame($builder->setDefinition('foobar', $foo = new Definition('FooBarClass')), $foo, '->setDefinition() implements a fluid interface by returning the service reference'); - $builder->addDefinitions($defs = array('foobar' => new Definition('FooBarClass'))); + $builder->addDefinitions($defs = ['foobar' => new Definition('FooBarClass')]); $this->assertEquals(array_merge($definitions, $defs), $builder->getDefinitions(), '->addDefinitions() adds the service definitions'); try { @@ -150,7 +150,7 @@ public function testGetReturnsNullIfServiceDoesNotExistAndInvalidReferenceIsUsed public function testGetThrowsCircularReferenceExceptionIfServiceHasReferenceToItself() { $builder = new ContainerBuilder(); - $builder->register('baz', 'stdClass')->setArguments(array(new Reference('baz'))); + $builder->register('baz', 'stdClass')->setArguments([new Reference('baz')]); $builder->get('baz'); } @@ -221,13 +221,13 @@ public function testGetServiceIds() $builder->bar = $bar = new \stdClass(); $builder->register('bar', 'stdClass'); $this->assertEquals( - array( + [ 'service_container', 'foo', 'bar', 'Psr\Container\ContainerInterface', 'Symfony\Component\DependencyInjection\ContainerInterface', - ), + ], $builder->getServiceIds(), '->getServiceIds() returns all defined service ids' ); @@ -284,7 +284,7 @@ public function testGetAliases() public function testSetAliases() { $builder = new ContainerBuilder(); - $builder->setAliases(array('bar' => 'foo', 'foobar' => 'foo')); + $builder->setAliases(['bar' => 'foo', 'foobar' => 'foo']); $aliases = $builder->getAliases(); $this->assertArrayHasKey('bar', $aliases); @@ -294,8 +294,8 @@ public function testSetAliases() public function testAddAliases() { $builder = new ContainerBuilder(); - $builder->setAliases(array('bar' => 'foo')); - $builder->addAliases(array('foobar' => 'foo')); + $builder->setAliases(['bar' => 'foo']); + $builder->addAliases(['foobar' => 'foo']); $aliases = $builder->getAliases(); $this->assertArrayHasKey('bar', $aliases); @@ -317,7 +317,7 @@ public function testAliasesKeepInvalidBehavior() $builder = new ContainerBuilder(); $aliased = new Definition('stdClass'); - $aliased->addMethodCall('setBar', array(new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))); + $aliased->addMethodCall('setBar', [new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); $builder->setDefinition('aliased', $aliased); $builder->setAlias('alias', 'aliased'); @@ -373,18 +373,18 @@ public function testCreateServiceArguments() { $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); - $builder->register('foo1', 'Bar\FooClass')->addArgument(array('foo' => '%value%', '%value%' => 'foo', new Reference('bar'), '%%unescape_it%%')); + $builder->register('foo1', 'Bar\FooClass')->addArgument(['foo' => '%value%', '%value%' => 'foo', new Reference('bar'), '%%unescape_it%%']); $builder->setParameter('value', 'bar'); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar'), '%unescape_it%'), $builder->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition'); + $this->assertEquals(['foo' => 'bar', 'bar' => 'foo', $builder->get('bar'), '%unescape_it%'], $builder->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition'); } public function testCreateServiceFactory() { $builder = new ContainerBuilder(); $builder->register('foo', 'Bar\FooClass')->setFactory('Bar\FooClass::getInstance'); - $builder->register('qux', 'Bar\FooClass')->setFactory(array('Bar\FooClass', 'getInstance')); - $builder->register('bar', 'Bar\FooClass')->setFactory(array(new Definition('Bar\FooClass'), 'getInstance')); - $builder->register('baz', 'Bar\FooClass')->setFactory(array(new Reference('bar'), 'getInstance')); + $builder->register('qux', 'Bar\FooClass')->setFactory(['Bar\FooClass', 'getInstance']); + $builder->register('bar', 'Bar\FooClass')->setFactory([new Definition('Bar\FooClass'), 'getInstance']); + $builder->register('baz', 'Bar\FooClass')->setFactory([new Reference('bar'), 'getInstance']); $this->assertTrue($builder->get('foo')->called, '->createService() calls the factory method to create the service instance'); $this->assertTrue($builder->get('qux')->called, '->createService() calls the factory method to create the service instance'); @@ -396,38 +396,38 @@ public function testCreateServiceMethodCalls() { $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); - $builder->register('foo1', 'Bar\FooClass')->addMethodCall('setBar', array(array('%value%', new Reference('bar')))); + $builder->register('foo1', 'Bar\FooClass')->addMethodCall('setBar', [['%value%', new Reference('bar')]]); $builder->setParameter('value', 'bar'); - $this->assertEquals(array('bar', $builder->get('bar')), $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments'); + $this->assertEquals(['bar', $builder->get('bar')], $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments'); } public function testCreateServiceMethodCallsWithEscapedParam() { $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); - $builder->register('foo1', 'Bar\FooClass')->addMethodCall('setBar', array(array('%%unescape_it%%'))); + $builder->register('foo1', 'Bar\FooClass')->addMethodCall('setBar', [['%%unescape_it%%']]); $builder->setParameter('value', 'bar'); - $this->assertEquals(array('%unescape_it%'), $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments'); + $this->assertEquals(['%unescape_it%'], $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments'); } public function testCreateServiceProperties() { $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); - $builder->register('foo1', 'Bar\FooClass')->setProperty('bar', array('%value%', new Reference('bar'), '%%unescape_it%%')); + $builder->register('foo1', 'Bar\FooClass')->setProperty('bar', ['%value%', new Reference('bar'), '%%unescape_it%%']); $builder->setParameter('value', 'bar'); - $this->assertEquals(array('bar', $builder->get('bar'), '%unescape_it%'), $builder->get('foo1')->bar, '->createService() replaces the values in the properties'); + $this->assertEquals(['bar', $builder->get('bar'), '%unescape_it%'], $builder->get('foo1')->bar, '->createService() replaces the values in the properties'); } public function testCreateServiceConfigurator() { $builder = new ContainerBuilder(); $builder->register('foo1', 'Bar\FooClass')->setConfigurator('sc_configure'); - $builder->register('foo2', 'Bar\FooClass')->setConfigurator(array('%class%', 'configureStatic')); + $builder->register('foo2', 'Bar\FooClass')->setConfigurator(['%class%', 'configureStatic']); $builder->setParameter('class', 'BazClass'); $builder->register('baz', 'BazClass'); - $builder->register('foo3', 'Bar\FooClass')->setConfigurator(array(new Reference('baz'), 'configure')); - $builder->register('foo4', 'Bar\FooClass')->setConfigurator(array($builder->getDefinition('baz'), 'configure')); + $builder->register('foo3', 'Bar\FooClass')->setConfigurator([new Reference('baz'), 'configure']); + $builder->register('foo4', 'Bar\FooClass')->setConfigurator([$builder->getDefinition('baz'), 'configure']); $builder->register('foo5', 'Bar\FooClass')->setConfigurator('foo'); $this->assertTrue($builder->get('foo1')->configured, '->createService() calls the configurator'); @@ -449,10 +449,10 @@ public function testCreateServiceWithIteratorArgument() $builder->register('bar', 'stdClass'); $builder ->register('lazy_context', 'LazyContext') - ->setArguments(array( - new IteratorArgument(array('k1' => new Reference('bar'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))), - new IteratorArgument(array()), - )) + ->setArguments([ + new IteratorArgument(['k1' => new Reference('bar'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]), + new IteratorArgument([]), + ]) ; $lazyContext = $builder->get('lazy_context'); @@ -494,7 +494,7 @@ public function testCreateServiceWithExpression() $builder = new ContainerBuilder(); $builder->setParameter('bar', 'bar'); $builder->register('bar', 'BarClass'); - $builder->register('foo', 'Bar\FooClass')->addArgument(array('foo' => new Expression('service("bar").foo ~ parameter("bar")'))); + $builder->register('foo', 'Bar\FooClass')->addArgument(['foo' => new Expression('service("bar").foo ~ parameter("bar")')]); $this->assertEquals('foobar', $builder->get('foo')->arguments['foo']); } @@ -503,7 +503,7 @@ public function testResolveServices() $builder = new ContainerBuilder(); $builder->register('foo', 'Bar\FooClass'); $this->assertEquals($builder->get('foo'), $builder->resolveServices(new Reference('foo')), '->resolveServices() resolves service references to service instances'); - $this->assertEquals(array('foo' => array('foo', $builder->get('foo'))), $builder->resolveServices(array('foo' => array('foo', new Reference('foo')))), '->resolveServices() resolves service references to service instances in nested arrays'); + $this->assertEquals(['foo' => ['foo', $builder->get('foo')]], $builder->resolveServices(['foo' => ['foo', new Reference('foo')]]), '->resolveServices() resolves service references to service instances in nested arrays'); $this->assertEquals($builder->get('foo'), $builder->resolveServices(new Expression('service("foo")')), '->resolveServices() resolves expressions'); } @@ -531,25 +531,25 @@ public function testResolveServicesWithCustomDefinitionClass() public function testMerge() { - $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); + $container = new ContainerBuilder(new ParameterBag(['bar' => 'foo'])); $container->setResourceTracking(false); - $config = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); + $config = new ContainerBuilder(new ParameterBag(['foo' => 'bar'])); $container->merge($config); - $this->assertEquals(array('bar' => 'foo', 'foo' => 'bar'), $container->getParameterBag()->all(), '->merge() merges current parameters with the loaded ones'); + $this->assertEquals(['bar' => 'foo', 'foo' => 'bar'], $container->getParameterBag()->all(), '->merge() merges current parameters with the loaded ones'); - $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); + $container = new ContainerBuilder(new ParameterBag(['bar' => 'foo'])); $container->setResourceTracking(false); - $config = new ContainerBuilder(new ParameterBag(array('foo' => '%bar%'))); + $config = new ContainerBuilder(new ParameterBag(['foo' => '%bar%'])); $container->merge($config); $container->compile(); - $this->assertEquals(array('bar' => 'foo', 'foo' => 'foo'), $container->getParameterBag()->all(), '->merge() evaluates the values of the parameters towards already defined ones'); + $this->assertEquals(['bar' => 'foo', 'foo' => 'foo'], $container->getParameterBag()->all(), '->merge() evaluates the values of the parameters towards already defined ones'); - $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); + $container = new ContainerBuilder(new ParameterBag(['bar' => 'foo'])); $container->setResourceTracking(false); - $config = new ContainerBuilder(new ParameterBag(array('foo' => '%bar%', 'baz' => '%foo%'))); + $config = new ContainerBuilder(new ParameterBag(['foo' => '%bar%', 'baz' => '%foo%'])); $container->merge($config); $container->compile(); - $this->assertEquals(array('bar' => 'foo', 'foo' => 'foo', 'baz' => 'foo'), $container->getParameterBag()->all(), '->merge() evaluates the values of the parameters towards already defined ones'); + $this->assertEquals(['bar' => 'foo', 'foo' => 'foo', 'baz' => 'foo'], $container->getParameterBag()->all(), '->merge() evaluates the values of the parameters towards already defined ones'); $container = new ContainerBuilder(); $container->setResourceTracking(false); @@ -559,7 +559,7 @@ public function testMerge() $config->setDefinition('baz', new Definition('BazClass')); $config->setAlias('alias_for_foo', 'foo'); $container->merge($config); - $this->assertEquals(array('service_container', 'foo', 'bar', 'baz'), array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones'); + $this->assertEquals(['service_container', 'foo', 'bar', 'baz'], array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones'); $aliases = $container->getAliases(); $this->assertArrayHasKey('alias_for_foo', $aliases); @@ -576,16 +576,16 @@ public function testMerge() $bag = new EnvPlaceholderParameterBag(); $bag->get('env(Foo)'); $config = new ContainerBuilder($bag); - $this->assertSame(array('%env(Bar)%'), $config->resolveEnvPlaceholders(array($bag->get('env(Bar)')))); + $this->assertSame(['%env(Bar)%'], $config->resolveEnvPlaceholders([$bag->get('env(Bar)')])); $container->merge($config); - $this->assertEquals(array('Foo' => 0, 'Bar' => 1), $container->getEnvCounters()); + $this->assertEquals(['Foo' => 0, 'Bar' => 1], $container->getEnvCounters()); $container = new ContainerBuilder(); $config = new ContainerBuilder(); $childDefA = $container->registerForAutoconfiguration('AInterface'); $childDefB = $config->registerForAutoconfiguration('BInterface'); $container->merge($config); - $this->assertSame(array('AInterface' => $childDefA, 'BInterface' => $childDefB), $container->getAutoconfiguredInstanceof()); + $this->assertSame(['AInterface' => $childDefA, 'BInterface' => $childDefB], $container->getAutoconfiguredInstanceof()); } /** @@ -620,7 +620,7 @@ public function testResolveEnvValuesWithArray() { $_ENV['ANOTHER_DUMMY_ENV_VAR'] = 'dummy'; - $dummyArray = array('1' => 'one', '2' => 'two'); + $dummyArray = ['1' => 'one', '2' => 'two']; $container = new ContainerBuilder(); $container->setParameter('dummy', '%env(ANOTHER_DUMMY_ENV_VAR)%'); @@ -673,7 +673,7 @@ public function testCompileWithArrayResolveEnv() $container->setParameter('foo', '%env(json:ARRAY)%'); $container->compile(true); - $this->assertSame(array('foo' => 'bar'), $container->getParameter('foo')); + $this->assertSame(['foo' => 'bar'], $container->getParameter('foo')); putenv('ARRAY'); } @@ -688,7 +688,7 @@ public function testCompileWithArrayAndAnotherResolveEnv() $container->setParameter('bar', '%env(DUMMY_ENV_VAR)%'); $container->compile(true); - $this->assertSame(array('foo' => 'bar'), $container->getParameter('foo')); + $this->assertSame(['foo' => 'bar'], $container->getParameter('foo')); $this->assertSame('abc', $container->getParameter('bar')); putenv('DUMMY_ENV_VAR'); @@ -745,9 +745,9 @@ public function testCastEnv() $container->register('foo', 'stdClass') ->setPublic(true) - ->setProperties(array( + ->setProperties([ 'fake' => '%env(int:FAKE)%', - )); + ]); $container->compile(true); @@ -761,9 +761,9 @@ public function testEnvAreNullable() $container->register('foo', 'stdClass') ->setPublic(true) - ->setProperties(array( + ->setProperties([ 'fake' => '%env(int:FAKE)%', - )); + ]); $container->compile(true); @@ -775,23 +775,23 @@ public function testEnvInId() $container = include __DIR__.'/Fixtures/containers/container_env_in_id.php'; $container->compile(true); - $expected = array( + $expected = [ 'service_container', 'foo', 'bar', 'bar_%env(BAR)%', - ); + ]; $this->assertSame($expected, array_keys($container->getDefinitions())); - $expected = array( + $expected = [ PsrContainerInterface::class => true, ContainerInterface::class => true, 'baz_%env(BAR)%' => true, 'bar_%env(BAR)%' => true, - ); + ]; $this->assertSame($expected, $container->getRemovedIds()); - $this->assertSame(array('baz_bar'), array_keys($container->getDefinition('foo')->getArgument(1))); + $this->assertSame(['baz_bar'], array_keys($container->getDefinition('foo')->getArgument(1))); } /** @@ -829,17 +829,17 @@ public function testfindTaggedServiceIds() $builder = new ContainerBuilder(); $builder ->register('foo', 'Bar\FooClass') - ->addTag('foo', array('foo' => 'foo')) - ->addTag('bar', array('bar' => 'bar')) - ->addTag('foo', array('foofoo' => 'foofoo')) + ->addTag('foo', ['foo' => 'foo']) + ->addTag('bar', ['bar' => 'bar']) + ->addTag('foo', ['foofoo' => 'foofoo']) ; - $this->assertEquals($builder->findTaggedServiceIds('foo'), array( - 'foo' => array( - array('foo' => 'foo'), - array('foofoo' => 'foofoo'), - ), - ), '->findTaggedServiceIds() returns an array of service ids and its tag attributes'); - $this->assertEquals(array(), $builder->findTaggedServiceIds('foobar'), '->findTaggedServiceIds() returns an empty array if there is annotated services'); + $this->assertEquals($builder->findTaggedServiceIds('foo'), [ + 'foo' => [ + ['foo' => 'foo'], + ['foofoo' => 'foofoo'], + ], + ], '->findTaggedServiceIds() returns an array of service ids and its tag attributes'); + $this->assertEquals([], $builder->findTaggedServiceIds('foobar'), '->findTaggedServiceIds() returns an empty array if there is annotated services'); } public function testFindUnusedTags() @@ -847,11 +847,11 @@ public function testFindUnusedTags() $builder = new ContainerBuilder(); $builder ->register('foo', 'Bar\FooClass') - ->addTag('kernel.event_listener', array('foo' => 'foo')) - ->addTag('kenrel.event_listener', array('bar' => 'bar')) + ->addTag('kernel.event_listener', ['foo' => 'foo']) + ->addTag('kenrel.event_listener', ['bar' => 'bar']) ; $builder->findTaggedServiceIds('kernel.event_listener'); - $this->assertEquals(array('kenrel.event_listener'), $builder->findUnusedTags(), '->findUnusedTags() returns an array with unused tags'); + $this->assertEquals(['kenrel.event_listener'], $builder->findUnusedTags(), '->findUnusedTags() returns an array with unused tags'); } public function testFindDefinition() @@ -981,15 +981,15 @@ public function testResources() $container = new ContainerBuilder(); $container->addResource($a = new FileResource(__DIR__.'/Fixtures/xml/services1.xml')); $container->addResource($b = new FileResource(__DIR__.'/Fixtures/xml/services2.xml')); - $resources = array(); + $resources = []; foreach ($container->getResources() as $resource) { if (false === strpos($resource, '.php')) { $resources[] = $resource; } } - $this->assertEquals(array($a, $b), $resources, '->getResources() returns an array of resources read for the current configuration'); - $this->assertSame($container, $container->setResources(array())); - $this->assertEquals(array(), $container->getResources()); + $this->assertEquals([$a, $b], $resources, '->getResources() returns an array of resources read for the current configuration'); + $this->assertSame($container, $container->setResources([])); + $this->assertEquals([], $container->getResources()); } public function testFileExists() @@ -1002,14 +1002,14 @@ public function testFileExists() $this->assertTrue($container->fileExists((string) $a) && $container->fileExists((string) $b) && $container->fileExists($dir)); - $resources = array(); + $resources = []; foreach ($container->getResources() as $resource) { if (false === strpos($resource, '.php')) { $resources[] = $resource; } } - $this->assertEquals(array($A, $a, $b, $c), $resources, '->getResources() returns an array of resources read for the current configuration'); + $this->assertEquals([$A, $a, $b, $c], $resources, '->getResources() returns an array of resources read for the current configuration'); } public function testExtension() @@ -1040,28 +1040,28 @@ public function testRegisteredAndLoadedExtension() { $extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock(); $extension->expects($this->exactly(2))->method('getAlias')->will($this->returnValue('project')); - $extension->expects($this->once())->method('load')->with(array(array('foo' => 'bar'))); + $extension->expects($this->once())->method('load')->with([['foo' => 'bar']]); $container = new ContainerBuilder(); $container->setResourceTracking(false); $container->registerExtension($extension); - $container->loadFromExtension('project', array('foo' => 'bar')); + $container->loadFromExtension('project', ['foo' => 'bar']); $container->compile(); } public function testPrivateServiceUser() { $fooDefinition = new Definition('BarClass'); - $fooUserDefinition = new Definition('BarUserClass', array(new Reference('bar'))); + $fooUserDefinition = new Definition('BarUserClass', [new Reference('bar')]); $container = new ContainerBuilder(); $container->setResourceTracking(false); $fooDefinition->setPublic(false); - $container->addDefinitions(array( + $container->addDefinitions([ 'bar' => $fooDefinition, 'bar_user' => $fooUserDefinition->setPublic(true), - )); + ]); $container->compile(); $this->assertInstanceOf('BarClass', $container->get('bar_user')->bar); @@ -1116,15 +1116,15 @@ public function testExtensionConfig() $configs = $container->getExtensionConfig('foo'); $this->assertEmpty($configs); - $first = array('foo' => 'bar'); + $first = ['foo' => 'bar']; $container->prependExtensionConfig('foo', $first); $configs = $container->getExtensionConfig('foo'); - $this->assertEquals(array($first), $configs); + $this->assertEquals([$first], $configs); - $second = array('ding' => 'dong'); + $second = ['ding' => 'dong']; $container->prependExtensionConfig('foo', $second); $configs = $container->getExtensionConfig('foo'); - $this->assertEquals(array($second, $first), $configs); + $this->assertEquals([$second, $first], $configs); } public function testAbstractAlias() @@ -1184,7 +1184,7 @@ public function testInlinedDefinitions() $container->register('bar', 'BarClass') ->setProperty('foo', $definition) - ->addMethodCall('setBaz', array($definition)); + ->addMethodCall('setBaz', [$definition]); $barUser = $container->get('bar_user'); $bar = $container->get('bar'); @@ -1202,11 +1202,11 @@ public function testThrowsCircularExceptionForCircularAliases() { $builder = new ContainerBuilder(); - $builder->setAliases(array( + $builder->setAliases([ 'foo' => new Alias('app.test_class'), 'app.test_class' => new Alias('App\\TestClass'), 'App\\TestClass' => new Alias('app.test_class'), - )); + ]); $builder->findDefinition('foo'); } @@ -1317,12 +1317,12 @@ public function testServiceLocator() $container = new ContainerBuilder(); $container->register('foo_service', ServiceLocator::class) ->setPublic(true) - ->addArgument(array( + ->addArgument([ 'bar' => new ServiceClosureArgument(new Reference('bar_service')), 'baz' => new ServiceClosureArgument(new TypedReference('baz_service', 'stdClass')), - )) + ]) ; - $container->register('bar_service', 'stdClass')->setArguments(array(new Reference('baz_service')))->setPublic(true); + $container->register('bar_service', 'stdClass')->setArguments([new Reference('baz_service')])->setPublic(true); $container->register('baz_service', 'stdClass')->setPublic(false); $container->compile(); @@ -1343,7 +1343,7 @@ public function testUninitializedReference() $this->assertNull($bar->closures[0]()); $this->assertNull($bar->closures[1]()); $this->assertNull($bar->closures[2]()); - $this->assertSame(array(), iterator_to_array($bar->iter)); + $this->assertSame([], iterator_to_array($bar->iter)); $container = include __DIR__.'/Fixtures/containers/container_uninitialized_ref.php'; $container->compile(); @@ -1359,7 +1359,7 @@ public function testUninitializedReference() $this->assertEquals(new \stdClass(), $bar->closures[0]()); $this->assertNull($bar->closures[1]()); $this->assertEquals(new \stdClass(), $bar->closures[2]()); - $this->assertEquals(array('foo1' => new \stdClass(), 'foo3' => new \stdClass()), iterator_to_array($bar->iter)); + $this->assertEquals(['foo1' => new \stdClass(), 'foo3' => new \stdClass()], iterator_to_array($bar->iter)); } /** @@ -1375,16 +1375,27 @@ public function testAlmostCircular($visibility) $foo2 = $container->get('foo2'); $this->assertSame($foo2, $foo2->bar->foobar->foo); - $this->assertSame(array(), (array) $container->get('foobar4')); + $this->assertSame([], (array) $container->get('foobar4')); $foo5 = $container->get('foo5'); $this->assertSame($foo5, $foo5->bar->foo); + + $manager = $container->get('manager'); + $this->assertEquals(new \stdClass(), $manager); + + $manager = $container->get('manager2'); + $this->assertEquals(new \stdClass(), $manager); + + $foo6 = $container->get('foo6'); + $this->assertEquals((object) ['bar6' => (object) []], $foo6); + + $this->assertInstanceOf(\stdClass::class, $container->get('root')); } public function provideAlmostCircular() { - yield array('public'); - yield array('private'); + yield ['public']; + yield ['private']; } public function testRegisterForAutoconfiguration() @@ -1392,7 +1403,7 @@ public function testRegisterForAutoconfiguration() $container = new ContainerBuilder(); $childDefA = $container->registerForAutoconfiguration('AInterface'); $childDefB = $container->registerForAutoconfiguration('BInterface'); - $this->assertSame(array('AInterface' => $childDefA, 'BInterface' => $childDefB), $container->getAutoconfiguredInstanceof()); + $this->assertSame(['AInterface' => $childDefA, 'BInterface' => $childDefB], $container->getAutoconfiguredInstanceof()); // when called multiple times, the same instance is returned $this->assertSame($childDefA, $container->registerForAutoconfiguration('AInterface')); @@ -1425,7 +1436,7 @@ public function testPrivateServiceTriggersDeprecation() */ public function testParameterWithMixedCase() { - $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); + $container = new ContainerBuilder(new ParameterBag(['foo' => 'bar'])); $container->register('foo', 'stdClass') ->setPublic(true) ->setProperty('foo', '%FOO%'); @@ -1438,20 +1449,20 @@ public function testParameterWithMixedCase() public function testArgumentsHaveHigherPriorityThanBindings() { $container = new ContainerBuilder(); - $container->register('class.via.bindings', CaseSensitiveClass::class)->setArguments(array( + $container->register('class.via.bindings', CaseSensitiveClass::class)->setArguments([ 'via-bindings', - )); - $container->register('class.via.argument', CaseSensitiveClass::class)->setArguments(array( + ]); + $container->register('class.via.argument', CaseSensitiveClass::class)->setArguments([ 'via-argument', - )); - $container->register('foo', SimilarArgumentsDummy::class)->setPublic(true)->setBindings(array( + ]); + $container->register('foo', SimilarArgumentsDummy::class)->setPublic(true)->setBindings([ CaseSensitiveClass::class => new Reference('class.via.bindings'), '$token' => '1234', - ))->setArguments(array( + ])->setArguments([ '$class1' => new Reference('class.via.argument'), - )); + ]); - $this->assertSame(array('service_container', 'class.via.bindings', 'class.via.argument', 'foo', 'Psr\Container\ContainerInterface', 'Symfony\Component\DependencyInjection\ContainerInterface'), $container->getServiceIds()); + $this->assertSame(['service_container', 'class.via.bindings', 'class.via.argument', 'foo', 'Psr\Container\ContainerInterface', 'Symfony\Component\DependencyInjection\ContainerInterface'], $container->getServiceIds()); $container->compile(); @@ -1468,10 +1479,26 @@ public function testUninitializedSyntheticReference() $container->compile(); - $this->assertEquals((object) array('foo' => null), $container->get('bar')); + $this->assertEquals((object) ['foo' => null], $container->get('bar')); + + $container->set('foo', (object) [123]); + $this->assertEquals((object) ['foo' => (object) [123]], $container->get('bar')); + } + + public function testDecoratedSelfReferenceInvolvingPrivateServices() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass') + ->setPublic(false) + ->setProperty('bar', new Reference('foo')); + $container->register('baz', 'stdClass') + ->setPublic(false) + ->setProperty('inner', new Reference('baz.inner')) + ->setDecoratedService('foo'); + + $container->compile(); - $container->set('foo', (object) array(123)); - $this->assertEquals((object) array('foo' => (object) array(123)), $container->get('bar')); + $this->assertSame(['service_container'], array_keys($container->getDefinitions())); } } diff --git a/vendor/symfony/dependency-injection/Tests/ContainerTest.php b/vendor/symfony/dependency-injection/Tests/ContainerTest.php index a57f787972f22cacbd4924d274dc28d94a57ac85..d2616a34ba6b422d9b0c56fd6aadf74677048c8d 100644 --- a/vendor/symfony/dependency-injection/Tests/ContainerTest.php +++ b/vendor/symfony/dependency-injection/Tests/ContainerTest.php @@ -25,8 +25,8 @@ public function testConstructor() $sc = new Container(); $this->assertSame($sc, $sc->get('service_container'), '__construct() automatically registers itself as a service'); - $sc = new Container(new ParameterBag(array('foo' => 'bar'))); - $this->assertEquals(array('foo' => 'bar'), $sc->getParameterBag()->all(), '__construct() takes an array of parameters as its first argument'); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); + $this->assertEquals(['foo' => 'bar'], $sc->getParameterBag()->all(), '__construct() takes an array of parameters as its first argument'); } /** @@ -39,18 +39,18 @@ public function testCamelize($id, $expected) public function dataForTestCamelize() { - return array( - array('foo_bar', 'FooBar'), - array('foo.bar', 'Foo_Bar'), - array('foo.bar_baz', 'Foo_BarBaz'), - array('foo._bar', 'Foo_Bar'), - array('foo_.bar', 'Foo_Bar'), - array('_foo', 'Foo'), - array('.foo', '_Foo'), - array('foo_', 'Foo'), - array('foo.', 'Foo_'), - array('foo\bar', 'Foo_Bar'), - ); + return [ + ['foo_bar', 'FooBar'], + ['foo.bar', 'Foo_Bar'], + ['foo.bar_baz', 'Foo_BarBaz'], + ['foo._bar', 'Foo_Bar'], + ['foo_.bar', 'Foo_Bar'], + ['_foo', 'Foo'], + ['.foo', '_Foo'], + ['foo_', 'Foo'], + ['foo.', 'Foo_'], + ['foo\bar', 'Foo_Bar'], + ]; } /** @@ -63,24 +63,24 @@ public function testUnderscore($id, $expected) public function dataForTestUnderscore() { - return array( - array('FooBar', 'foo_bar'), - array('Foo_Bar', 'foo.bar'), - array('Foo_BarBaz', 'foo.bar_baz'), - array('FooBar_BazQux', 'foo_bar.baz_qux'), - array('_Foo', '.foo'), - array('Foo_', 'foo.'), - ); + return [ + ['FooBar', 'foo_bar'], + ['Foo_Bar', 'foo.bar'], + ['Foo_BarBaz', 'foo.bar_baz'], + ['FooBar_BazQux', 'foo_bar.baz_qux'], + ['_Foo', '.foo'], + ['Foo_', 'foo.'], + ]; } public function testCompile() { - $sc = new Container(new ParameterBag(array('foo' => 'bar'))); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); $this->assertFalse($sc->getParameterBag()->isResolved(), '->compile() resolves the parameter bag'); $sc->compile(); $this->assertTrue($sc->getParameterBag()->isResolved(), '->compile() resolves the parameter bag'); $this->assertInstanceOf('Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag', $sc->getParameterBag(), '->compile() changes the parameter bag to a FrozenParameterBag instance'); - $this->assertEquals(array('foo' => 'bar'), $sc->getParameterBag()->all(), '->compile() copies the current parameters to the new parameter bag'); + $this->assertEquals(['foo' => 'bar'], $sc->getParameterBag()->all(), '->compile() copies the current parameters to the new parameter bag'); } /** @@ -90,7 +90,7 @@ public function testCompile() */ public function testIsFrozen() { - $sc = new Container(new ParameterBag(array('foo' => 'bar'))); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); $this->assertFalse($sc->isFrozen(), '->isFrozen() returns false if the parameters are not frozen'); $sc->compile(); $this->assertTrue($sc->isFrozen(), '->isFrozen() returns true if the parameters are frozen'); @@ -98,7 +98,7 @@ public function testIsFrozen() public function testIsCompiled() { - $sc = new Container(new ParameterBag(array('foo' => 'bar'))); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); $this->assertFalse($sc->isCompiled(), '->isCompiled() returns false if the container is not compiled'); $sc->compile(); $this->assertTrue($sc->isCompiled(), '->isCompiled() returns true if the container is compiled'); @@ -106,19 +106,19 @@ public function testIsCompiled() public function testIsCompiledWithFrozenParameters() { - $sc = new Container(new FrozenParameterBag(array('foo' => 'bar'))); + $sc = new Container(new FrozenParameterBag(['foo' => 'bar'])); $this->assertFalse($sc->isCompiled(), '->isCompiled() returns false if the container is not compiled but the parameter bag is already frozen'); } public function testGetParameterBag() { $sc = new Container(); - $this->assertEquals(array(), $sc->getParameterBag()->all(), '->getParameterBag() returns an empty array if no parameter has been defined'); + $this->assertEquals([], $sc->getParameterBag()->all(), '->getParameterBag() returns an empty array if no parameter has been defined'); } public function testGetSetParameter() { - $sc = new Container(new ParameterBag(array('foo' => 'bar'))); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); $sc->setParameter('bar', 'foo'); $this->assertEquals('foo', $sc->getParameter('bar'), '->setParameter() sets the value of a new parameter'); @@ -141,7 +141,7 @@ public function testGetSetParameter() */ public function testGetSetParameterWithMixedCase() { - $sc = new Container(new ParameterBag(array('foo' => 'bar'))); + $sc = new Container(new ParameterBag(['foo' => 'bar'])); $sc->setParameter('Foo', 'baz1'); $this->assertEquals('baz1', $sc->getParameter('foo'), '->setParameter() converts the key to lowercase'); @@ -153,11 +153,11 @@ public function testGetServiceIds() $sc = new Container(); $sc->set('foo', $obj = new \stdClass()); $sc->set('bar', $obj = new \stdClass()); - $this->assertEquals(array('service_container', 'foo', 'bar'), $sc->getServiceIds(), '->getServiceIds() returns all defined service ids'); + $this->assertEquals(['service_container', 'foo', 'bar'], $sc->getServiceIds(), '->getServiceIds() returns all defined service ids'); $sc = new ProjectServiceContainer(); $sc->set('foo', $obj = new \stdClass()); - $this->assertEquals(array('service_container', 'internal', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'internal_dependency', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by factory methods in the method map, followed by service ids defined by set()'); + $this->assertEquals(['service_container', 'internal', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'internal_dependency', 'foo'], $sc->getServiceIds(), '->getServiceIds() returns defined service ids by factory methods in the method map, followed by service ids defined by set()'); } /** @@ -169,7 +169,7 @@ public function testGetLegacyServiceIds() $sc = new LegacyProjectServiceContainer(); $sc->set('foo', $obj = new \stdClass()); - $this->assertEquals(array('internal', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'service_container', 'foo'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by getXXXService() methods, followed by service ids defined by set()'); + $this->assertEquals(['internal', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'service_container', 'foo'], $sc->getServiceIds(), '->getServiceIds() returns defined service ids by getXXXService() methods, followed by service ids defined by set()'); } public function testSet() @@ -557,7 +557,7 @@ class ProjectServiceContainer extends Container public $__foo_baz; public $__internal; protected $privates; - protected $methodMap = array( + protected $methodMap = [ 'internal' => 'getInternalService', 'bar' => 'getBarService', 'foo_bar' => 'getFooBarService', @@ -566,7 +566,7 @@ class ProjectServiceContainer extends Container 'throw_exception' => 'getThrowExceptionService', 'throws_exception_on_service_configuration' => 'getThrowsExceptionOnServiceConfigurationService', 'internal_dependency' => 'getInternalDependencyService', - ); + ]; public function __construct() { @@ -576,11 +576,11 @@ public function __construct() $this->__foo_bar = new \stdClass(); $this->__foo_baz = new \stdClass(); $this->__internal = new \stdClass(); - $this->privates = array( + $this->privates = [ 'internal' => true, 'synthetic' => true, - ); - $this->aliases = array('alias' => 'bar'); + ]; + $this->aliases = ['alias' => 'bar']; $this->syntheticIds['synthetic'] = true; } @@ -646,8 +646,8 @@ public function __construct() $this->__foo_bar = new \stdClass(); $this->__foo_baz = new \stdClass(); $this->__internal = new \stdClass(); - $this->privates = array('internal' => true); - $this->aliases = array('alias' => 'bar'); + $this->privates = ['internal' => true]; + $this->aliases = ['alias' => 'bar']; } protected function getInternalService() diff --git a/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php b/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php index 6ec9d33f5892c77b0b287c9bcdbe20b44580e7a9..fe132af484732bc28fd17445d58e5631c82ddeba 100644 --- a/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php +++ b/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php @@ -58,16 +58,16 @@ public function testCrossCheck($fixture, $type) $r = new \ReflectionProperty(ContainerBuilder::class, 'normalizedIds'); $r->setAccessible(true); - $r->setValue($container2, array()); - $r->setValue($container1, array()); + $r->setValue($container2, []); + $r->setValue($container1, []); $this->assertEquals(serialize($container2), serialize($container1), 'loading a dump from a previously loaded container returns the same container'); - $services1 = array(); + $services1 = []; foreach ($container1 as $id => $service) { $services1[$id] = serialize($service); } - $services2 = array(); + $services2 = []; foreach ($container2 as $id => $service) { $services2[$id] = serialize($service); } @@ -79,17 +79,17 @@ public function testCrossCheck($fixture, $type) public function crossCheckLoadersDumpers() { - return array( - array('services1.xml', 'xml'), - array('services2.xml', 'xml'), - array('services6.xml', 'xml'), - array('services8.xml', 'xml'), - array('services9.xml', 'xml'), - array('services1.yml', 'yaml'), - array('services2.yml', 'yaml'), - array('services6.yml', 'yaml'), - array('services8.yml', 'yaml'), - array('services9.yml', 'yaml'), - ); + return [ + ['services1.xml', 'xml'], + ['services2.xml', 'xml'], + ['services6.xml', 'xml'], + ['services8.xml', 'xml'], + ['services9.xml', 'xml'], + ['services1.yml', 'yaml'], + ['services2.yml', 'yaml'], + ['services6.yml', 'yaml'], + ['services8.yml', 'yaml'], + ['services9.yml', 'yaml'], + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/DefinitionDecoratorTest.php b/vendor/symfony/dependency-injection/Tests/DefinitionDecoratorTest.php index 92a212ec416a61f0b0b8635f5d77135eee6f19e7..ac58d3455183b6c7266957822f3d35020a0c7aed 100644 --- a/vendor/symfony/dependency-injection/Tests/DefinitionDecoratorTest.php +++ b/vendor/symfony/dependency-injection/Tests/DefinitionDecoratorTest.php @@ -24,7 +24,7 @@ public function testConstructor() $def = new DefinitionDecorator('foo'); $this->assertEquals('foo', $def->getParent()); - $this->assertEquals(array(), $def->getChanges()); + $this->assertEquals([], $def->getChanges()); } /** @@ -40,17 +40,17 @@ public function testSetProperty($property, $changeKey) $this->assertNull($def->$getter()); $this->assertSame($def, $def->$setter('foo')); $this->assertEquals('foo', $def->$getter()); - $this->assertEquals(array($changeKey => true), $def->getChanges()); + $this->assertEquals([$changeKey => true], $def->getChanges()); } public function getPropertyTests() { - return array( - array('class', 'class'), - array('factory', 'factory'), - array('configurator', 'configurator'), - array('file', 'file'), - ); + return [ + ['class', 'class'], + ['factory', 'factory'], + ['configurator', 'configurator'], + ['file', 'file'], + ]; } public function testSetPublic() @@ -60,7 +60,7 @@ public function testSetPublic() $this->assertTrue($def->isPublic()); $this->assertSame($def, $def->setPublic(false)); $this->assertFalse($def->isPublic()); - $this->assertEquals(array('public' => true), $def->getChanges()); + $this->assertEquals(['public' => true], $def->getChanges()); } public function testSetLazy() @@ -70,7 +70,7 @@ public function testSetLazy() $this->assertFalse($def->isLazy()); $this->assertSame($def, $def->setLazy(false)); $this->assertFalse($def->isLazy()); - $this->assertEquals(array('lazy' => true), $def->getChanges()); + $this->assertEquals(['lazy' => true], $def->getChanges()); } public function testSetAutowired() @@ -80,16 +80,16 @@ public function testSetAutowired() $this->assertFalse($def->isAutowired()); $this->assertSame($def, $def->setAutowired(true)); $this->assertTrue($def->isAutowired()); - $this->assertSame(array('autowired' => true), $def->getChanges()); + $this->assertSame(['autowired' => true], $def->getChanges()); } public function testSetArgument() { $def = new DefinitionDecorator('foo'); - $this->assertEquals(array(), $def->getArguments()); + $this->assertEquals([], $def->getArguments()); $this->assertSame($def, $def->replaceArgument(0, 'foo')); - $this->assertEquals(array('index_0' => 'foo'), $def->getArguments()); + $this->assertEquals(['index_0' => 'foo'], $def->getArguments()); } /** @@ -106,7 +106,7 @@ public function testReplaceArgument() { $def = new DefinitionDecorator('foo'); - $def->setArguments(array(0 => 'foo', 1 => 'bar')); + $def->setArguments([0 => 'foo', 1 => 'bar']); $this->assertEquals('foo', $def->getArgument(0)); $this->assertEquals('bar', $def->getArgument(1)); @@ -114,7 +114,7 @@ public function testReplaceArgument() $this->assertEquals('foo', $def->getArgument(0)); $this->assertEquals('baz', $def->getArgument(1)); - $this->assertEquals(array(0 => 'foo', 1 => 'bar', 'index_1' => 'baz'), $def->getArguments()); + $this->assertEquals([0 => 'foo', 1 => 'bar', 'index_1' => 'baz'], $def->getArguments()); } /** @@ -124,7 +124,7 @@ public function testGetArgumentShouldCheckBounds() { $def = new DefinitionDecorator('foo'); - $def->setArguments(array(0 => 'foo')); + $def->setArguments([0 => 'foo']); $def->replaceArgument(0, 'foo'); $def->getArgument(1); diff --git a/vendor/symfony/dependency-injection/Tests/DefinitionTest.php b/vendor/symfony/dependency-injection/Tests/DefinitionTest.php index 5fe4236ad938428bfec15bebad94bcb3c63a8b08..3581fe855037e3c2f53bb6a3d071967e0def6987 100644 --- a/vendor/symfony/dependency-injection/Tests/DefinitionTest.php +++ b/vendor/symfony/dependency-injection/Tests/DefinitionTest.php @@ -20,10 +20,10 @@ public function testConstructor() { $def = new Definition('stdClass'); $this->assertEquals('stdClass', $def->getClass(), '__construct() takes the class name as its first argument'); - $this->assertSame(array('class' => true), $def->getChanges()); + $this->assertSame(['class' => true], $def->getChanges()); - $def = new Definition('stdClass', array('foo')); - $this->assertEquals(array('foo'), $def->getArguments(), '__construct() takes an optional array of arguments as its second argument'); + $def = new Definition('stdClass', ['foo']); + $this->assertEquals(['foo'], $def->getArguments(), '__construct() takes an optional array of arguments as its second argument'); } public function testSetGetFactory() @@ -34,8 +34,8 @@ public function testSetGetFactory() $this->assertEquals('foo', $def->getFactory(), '->getFactory() returns the factory'); $def->setFactory('Foo::bar'); - $this->assertEquals(array('Foo', 'bar'), $def->getFactory(), '->setFactory() converts string static method call to the array'); - $this->assertSame(array('factory' => true), $def->getChanges()); + $this->assertEquals(['Foo', 'bar'], $def->getFactory(), '->setFactory() converts string static method call to the array'); + $this->assertSame(['factory' => true], $def->getChanges()); } public function testSetGetClass() @@ -50,20 +50,20 @@ public function testSetGetDecoratedService() $def = new Definition('stdClass'); $this->assertNull($def->getDecoratedService()); $def->setDecoratedService('foo', 'foo.renamed', 5); - $this->assertEquals(array('foo', 'foo.renamed', 5), $def->getDecoratedService()); + $this->assertEquals(['foo', 'foo.renamed', 5], $def->getDecoratedService()); $def->setDecoratedService(null); $this->assertNull($def->getDecoratedService()); $def = new Definition('stdClass'); $this->assertNull($def->getDecoratedService()); $def->setDecoratedService('foo', 'foo.renamed'); - $this->assertEquals(array('foo', 'foo.renamed', 0), $def->getDecoratedService()); + $this->assertEquals(['foo', 'foo.renamed', 0], $def->getDecoratedService()); $def->setDecoratedService(null); $this->assertNull($def->getDecoratedService()); $def = new Definition('stdClass'); $def->setDecoratedService('foo'); - $this->assertEquals(array('foo', null, 0), $def->getDecoratedService()); + $this->assertEquals(['foo', null, 0], $def->getDecoratedService()); $def->setDecoratedService(null); $this->assertNull($def->getDecoratedService()); @@ -82,23 +82,23 @@ public function testSetGetDecoratedService() public function testArguments() { $def = new Definition('stdClass'); - $this->assertSame($def, $def->setArguments(array('foo')), '->setArguments() implements a fluent interface'); - $this->assertEquals(array('foo'), $def->getArguments(), '->getArguments() returns the arguments'); + $this->assertSame($def, $def->setArguments(['foo']), '->setArguments() implements a fluent interface'); + $this->assertEquals(['foo'], $def->getArguments(), '->getArguments() returns the arguments'); $this->assertSame($def, $def->addArgument('bar'), '->addArgument() implements a fluent interface'); - $this->assertEquals(array('foo', 'bar'), $def->getArguments(), '->addArgument() adds an argument'); + $this->assertEquals(['foo', 'bar'], $def->getArguments(), '->addArgument() adds an argument'); } public function testMethodCalls() { $def = new Definition('stdClass'); - $this->assertSame($def, $def->setMethodCalls(array(array('foo', array('foo')))), '->setMethodCalls() implements a fluent interface'); - $this->assertEquals(array(array('foo', array('foo'))), $def->getMethodCalls(), '->getMethodCalls() returns the methods to call'); - $this->assertSame($def, $def->addMethodCall('bar', array('bar')), '->addMethodCall() implements a fluent interface'); - $this->assertEquals(array(array('foo', array('foo')), array('bar', array('bar'))), $def->getMethodCalls(), '->addMethodCall() adds a method to call'); + $this->assertSame($def, $def->setMethodCalls([['foo', ['foo']]]), '->setMethodCalls() implements a fluent interface'); + $this->assertEquals([['foo', ['foo']]], $def->getMethodCalls(), '->getMethodCalls() returns the methods to call'); + $this->assertSame($def, $def->addMethodCall('bar', ['bar']), '->addMethodCall() implements a fluent interface'); + $this->assertEquals([['foo', ['foo']], ['bar', ['bar']]], $def->getMethodCalls(), '->addMethodCall() adds a method to call'); $this->assertTrue($def->hasMethodCall('bar'), '->hasMethodCall() returns true if first argument is a method to call registered'); $this->assertFalse($def->hasMethodCall('no_registered'), '->hasMethodCall() returns false if first argument is not a method to call registered'); $this->assertSame($def, $def->removeMethodCall('bar'), '->removeMethodCall() implements a fluent interface'); - $this->assertEquals(array(array('foo', array('foo'))), $def->getMethodCalls(), '->removeMethodCall() removes a method to call'); + $this->assertEquals([['foo', ['foo']]], $def->getMethodCalls(), '->removeMethodCall() removes a method to call'); } /** @@ -179,12 +179,12 @@ public function testSetDeprecatedWithInvalidDeprecationTemplate($message) public function invalidDeprecationMessageProvider() { - return array( - "With \rs" => array("invalid \r message %service_id%"), - "With \ns" => array("invalid \n message %service_id%"), - 'With */s' => array('invalid */ message %service_id%'), - 'message not containing require %service_id% variable' => array('this is deprecated'), - ); + return [ + "With \rs" => ["invalid \r message %service_id%"], + "With \ns" => ["invalid \n message %service_id%"], + 'With */s' => ['invalid */ message %service_id%'], + 'message not containing require %service_id% variable' => ['this is deprecated'], + ]; } public function testSetGetConfigurator() @@ -198,18 +198,18 @@ public function testClearTags() { $def = new Definition('stdClass'); $this->assertSame($def, $def->clearTags(), '->clearTags() implements a fluent interface'); - $def->addTag('foo', array('foo' => 'bar')); + $def->addTag('foo', ['foo' => 'bar']); $def->clearTags(); - $this->assertEquals(array(), $def->getTags(), '->clearTags() removes all current tags'); + $this->assertEquals([], $def->getTags(), '->clearTags() removes all current tags'); } public function testClearTag() { $def = new Definition('stdClass'); $this->assertSame($def, $def->clearTags(), '->clearTags() implements a fluent interface'); - $def->addTag('1foo1', array('foo1' => 'bar1')); - $def->addTag('2foo2', array('foo2' => 'bar2')); - $def->addTag('3foo3', array('foo3' => 'bar3')); + $def->addTag('1foo1', ['foo1' => 'bar1']); + $def->addTag('2foo2', ['foo2' => 'bar2']); + $def->addTag('3foo3', ['foo3' => 'bar3']); $def->clearTag('2foo2'); $this->assertTrue($def->hasTag('1foo1')); $this->assertFalse($def->hasTag('2foo2')); @@ -222,18 +222,18 @@ public function testClearTag() public function testTags() { $def = new Definition('stdClass'); - $this->assertEquals(array(), $def->getTag('foo'), '->getTag() returns an empty array if the tag is not defined'); + $this->assertEquals([], $def->getTag('foo'), '->getTag() returns an empty array if the tag is not defined'); $this->assertFalse($def->hasTag('foo')); $this->assertSame($def, $def->addTag('foo'), '->addTag() implements a fluent interface'); $this->assertTrue($def->hasTag('foo')); - $this->assertEquals(array(array()), $def->getTag('foo'), '->getTag() returns attributes for a tag name'); - $def->addTag('foo', array('foo' => 'bar')); - $this->assertEquals(array(array(), array('foo' => 'bar')), $def->getTag('foo'), '->addTag() can adds the same tag several times'); - $def->addTag('bar', array('bar' => 'bar')); - $this->assertEquals($def->getTags(), array( - 'foo' => array(array(), array('foo' => 'bar')), - 'bar' => array(array('bar' => 'bar')), - ), '->getTags() returns all tags'); + $this->assertEquals([[]], $def->getTag('foo'), '->getTag() returns attributes for a tag name'); + $def->addTag('foo', ['foo' => 'bar']); + $this->assertEquals([[], ['foo' => 'bar']], $def->getTag('foo'), '->addTag() can adds the same tag several times'); + $def->addTag('bar', ['bar' => 'bar']); + $this->assertEquals($def->getTags(), [ + 'foo' => [[], ['foo' => 'bar']], + 'bar' => [['bar' => 'bar']], + ], '->getTags() returns all tags'); } public function testSetArgument() @@ -241,17 +241,17 @@ public function testSetArgument() $def = new Definition('stdClass'); $def->addArgument('foo'); - $this->assertSame(array('foo'), $def->getArguments()); + $this->assertSame(['foo'], $def->getArguments()); $this->assertSame($def, $def->replaceArgument(0, 'moo')); - $this->assertSame(array('moo'), $def->getArguments()); + $this->assertSame(['moo'], $def->getArguments()); $def->addArgument('moo'); $def ->replaceArgument(0, 'foo') ->replaceArgument(1, 'bar') ; - $this->assertSame(array('foo', 'bar'), $def->getArguments()); + $this->assertSame(['foo', 'bar'], $def->getArguments()); } /** @@ -291,18 +291,18 @@ public function testSetGetProperties() { $def = new Definition('stdClass'); - $this->assertEquals(array(), $def->getProperties()); - $this->assertSame($def, $def->setProperties(array('foo' => 'bar'))); - $this->assertEquals(array('foo' => 'bar'), $def->getProperties()); + $this->assertEquals([], $def->getProperties()); + $this->assertSame($def, $def->setProperties(['foo' => 'bar'])); + $this->assertEquals(['foo' => 'bar'], $def->getProperties()); } public function testSetProperty() { $def = new Definition('stdClass'); - $this->assertEquals(array(), $def->getProperties()); + $this->assertEquals([], $def->getProperties()); $this->assertSame($def, $def->setProperty('foo', 'bar')); - $this->assertEquals(array('foo' => 'bar'), $def->getProperties()); + $this->assertEquals(['foo' => 'bar'], $def->getProperties()); } public function testAutowired() @@ -321,12 +321,12 @@ public function testChangesNoChanges() { $def = new Definition(); - $this->assertSame(array(), $def->getChanges()); + $this->assertSame([], $def->getChanges()); } public function testGetChangesWithChanges() { - $def = new Definition('stdClass', array('fooarg')); + $def = new Definition('stdClass', ['fooarg']); $def->setAbstract(true); $def->setAutowired(true); @@ -340,13 +340,13 @@ public function testGetChangesWithChanges() $def->setShared(true); $def->setSynthetic(true); // changes aren't tracked for these, class or arguments - $def->setInstanceofConditionals(array()); + $def->setInstanceofConditionals([]); $def->addTag('foo_tag'); $def->addMethodCall('methodCall'); $def->setProperty('fooprop', true); $def->setAutoconfigured(true); - $this->assertSame(array( + $this->assertSame([ 'class' => true, 'autowired' => true, 'configurator' => true, @@ -358,10 +358,10 @@ public function testGetChangesWithChanges() 'public' => true, 'shared' => true, 'autoconfigured' => true, - ), $def->getChanges()); + ], $def->getChanges()); - $def->setChanges(array()); - $this->assertSame(array(), $def->getChanges()); + $def->setChanges([]); + $this->assertSame([], $def->getChanges()); } /** @@ -371,13 +371,13 @@ public function testTypes() { $def = new Definition('stdClass'); - $this->assertEquals(array(), $def->getAutowiringTypes()); - $this->assertSame($def, $def->setAutowiringTypes(array('Foo'))); - $this->assertEquals(array('Foo'), $def->getAutowiringTypes()); + $this->assertEquals([], $def->getAutowiringTypes()); + $this->assertSame($def, $def->setAutowiringTypes(['Foo'])); + $this->assertEquals(['Foo'], $def->getAutowiringTypes()); $this->assertSame($def, $def->addAutowiringType('Bar')); $this->assertTrue($def->hasAutowiringType('Bar')); $this->assertSame($def, $def->removeAutowiringType('Foo')); - $this->assertEquals(array('Bar'), $def->getAutowiringTypes()); + $this->assertEquals(['Bar'], $def->getAutowiringTypes()); } public function testShouldAutoconfigure() @@ -394,6 +394,6 @@ public function testAddError() $this->assertEmpty($def->getErrors()); $def->addError('First error'); $def->addError('Second error'); - $this->assertSame(array('First error', 'Second error'), $def->getErrors()); + $this->assertSame(['First error', 'Second error'], $def->getErrors()); } } diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php index ffdd0730c7781c4b5602c3e9969b66caa56e9fad..ea11c7c533a3d7c141150b5622fc93a71510b3d8 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php @@ -13,7 +13,9 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Dumper\GraphvizDumper; +use Symfony\Component\DependencyInjection\Reference; class GraphvizDumperTest extends TestCase { @@ -32,36 +34,36 @@ public function testDump() $container = include self::$fixturesPath.'/containers/container9.php'; $dumper = new GraphvizDumper($container); - $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services9.dot')), $dumper->dump(), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services9.dot', $dumper->dump(), '->dump() dumps services'); $container = include self::$fixturesPath.'/containers/container10.php'; $dumper = new GraphvizDumper($container); - $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services10.dot')), $dumper->dump(), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services10.dot', $dumper->dump(), '->dump() dumps services'); $container = include self::$fixturesPath.'/containers/container10.php'; $dumper = new GraphvizDumper($container); - $this->assertEquals($dumper->dump(array( - 'graph' => array('ratio' => 'normal'), - 'node' => array('fontsize' => 13, 'fontname' => 'Verdana', 'shape' => 'square'), - 'edge' => array('fontsize' => 12, 'fontname' => 'Verdana', 'color' => 'white', 'arrowhead' => 'closed', 'arrowsize' => 1), - 'node.instance' => array('fillcolor' => 'green', 'style' => 'empty'), - 'node.definition' => array('fillcolor' => 'grey'), - 'node.missing' => array('fillcolor' => 'red', 'style' => 'empty'), - )), str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services10-1.dot')), '->dump() dumps services'); + $this->assertEquals($dumper->dump([ + 'graph' => ['ratio' => 'normal'], + 'node' => ['fontsize' => 13, 'fontname' => 'Verdana', 'shape' => 'square'], + 'edge' => ['fontsize' => 12, 'fontname' => 'Verdana', 'color' => 'white', 'arrowhead' => 'closed', 'arrowsize' => 1], + 'node.instance' => ['fillcolor' => 'green', 'style' => 'empty'], + 'node.definition' => ['fillcolor' => 'grey'], + 'node.missing' => ['fillcolor' => 'red', 'style' => 'empty'], + ]), file_get_contents(self::$fixturesPath.'/graphviz/services10-1.dot'), '->dump() dumps services'); } public function testDumpWithFrozenContainer() { $container = include self::$fixturesPath.'/containers/container13.php'; $dumper = new GraphvizDumper($container); - $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services13.dot')), $dumper->dump(), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services13.dot', $dumper->dump(), '->dump() dumps services'); } public function testDumpWithFrozenCustomClassContainer() { $container = include self::$fixturesPath.'/containers/container14.php'; $dumper = new GraphvizDumper($container); - $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services14.dot')), $dumper->dump(), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services14.dot', $dumper->dump(), '->dump() dumps services'); } public function testDumpWithUnresolvedParameter() @@ -69,6 +71,18 @@ public function testDumpWithUnresolvedParameter() $container = include self::$fixturesPath.'/containers/container17.php'; $dumper = new GraphvizDumper($container); - $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services17.dot')), $dumper->dump(), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services17.dot', $dumper->dump(), '->dump() dumps services'); + } + + public function testDumpWithInlineDefinition() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->addArgument( + (new Definition('stdClass'))->addArgument(new Reference('bar')) + ); + $container->register('bar', 'stdClass'); + $dumper = new GraphvizDumper($container); + + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services_inline.dot', $dumper->dump(), '->dump() dumps nested references'); } } diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php index e90edd50283b4e5e7d348fdb7700fe97fe588cf8..6d985eaca360b0c57ef72054a218845740489a4a 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php @@ -23,6 +23,7 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\EnvVarProcessorInterface; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Parameter; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; @@ -53,14 +54,14 @@ public function testDump() $dumper = new PhpDumper($container); $this->assertStringEqualsFile(self::$fixturesPath.'/php/services1.php', $dumper->dump(), '->dump() dumps an empty container as an empty PHP class'); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services1-1.php', $dumper->dump(array('class' => 'Container', 'base_class' => 'AbstractContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Dump')), '->dump() takes a class and a base_class options'); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services1-1.php', $dumper->dump(['class' => 'Container', 'base_class' => 'AbstractContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Dump']), '->dump() takes a class and a base_class options'); } public function testDumpOptimizationString() { $definition = new Definition(); $definition->setClass('stdClass'); - $definition->addArgument(array( + $definition->addArgument([ 'only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', @@ -72,7 +73,7 @@ public function testDumpOptimizationString() 'optimize concatenation from the start' => '%empty_value%start', 'optimize concatenation at the end' => 'end%empty_value%', 'new line' => "string with \nnew line", - )); + ]); $definition->setPublic(true); $container = new ContainerBuilder(); @@ -91,7 +92,7 @@ public function testDumpRelativeDir() $definition = new Definition(); $definition->setClass('stdClass'); $definition->addArgument('%foo%'); - $definition->addArgument(array('%foo%' => '%buz%/')); + $definition->addArgument(['%foo%' => '%buz%/']); $definition->setPublic(true); $container = new ContainerBuilder(); @@ -103,7 +104,7 @@ public function testDumpRelativeDir() $container->compile(); $dumper = new PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services12.php', $dumper->dump(array('file' => __FILE__)), '->dump() dumps __DIR__ relative strings'); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services12.php', $dumper->dump(['file' => __FILE__]), '->dump() dumps __DIR__ relative strings'); } public function testDumpCustomContainerClassWithoutConstructor() @@ -113,7 +114,7 @@ public function testDumpCustomContainerClassWithoutConstructor() $dumper = new PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/custom_container_class_without_constructor.php', $dumper->dump(array('base_class' => 'NoConstructorContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container'))); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/custom_container_class_without_constructor.php', $dumper->dump(['base_class' => 'NoConstructorContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container'])); } public function testDumpCustomContainerClassConstructorWithoutArguments() @@ -123,7 +124,7 @@ public function testDumpCustomContainerClassConstructorWithoutArguments() $dumper = new PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/custom_container_class_constructor_without_arguments.php', $dumper->dump(array('base_class' => 'ConstructorWithoutArgumentsContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container'))); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/custom_container_class_constructor_without_arguments.php', $dumper->dump(['base_class' => 'ConstructorWithoutArgumentsContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container'])); } public function testDumpCustomContainerClassWithOptionalArgumentLessConstructor() @@ -133,7 +134,7 @@ public function testDumpCustomContainerClassWithOptionalArgumentLessConstructor( $dumper = new PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/custom_container_class_with_optional_constructor_arguments.php', $dumper->dump(array('base_class' => 'ConstructorWithOptionalArgumentsContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container'))); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/custom_container_class_with_optional_constructor_arguments.php', $dumper->dump(['base_class' => 'ConstructorWithOptionalArgumentsContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container'])); } public function testDumpCustomContainerClassWithMandatoryArgumentLessConstructor() @@ -143,7 +144,7 @@ public function testDumpCustomContainerClassWithMandatoryArgumentLessConstructor $dumper = new PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/custom_container_class_with_mandatory_constructor_arguments.php', $dumper->dump(array('base_class' => 'ConstructorWithMandatoryArgumentsContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container'))); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/custom_container_class_with_mandatory_constructor_arguments.php', $dumper->dump(['base_class' => 'ConstructorWithMandatoryArgumentsContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container'])); } /** @@ -160,12 +161,12 @@ public function testExportParameters($parameters) public function provideInvalidParameters() { - return array( - array(array('foo' => new Definition('stdClass'))), - array(array('foo' => new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")'))), - array(array('foo' => new Reference('foo'))), - array(array('foo' => new Variable('foo'))), - ); + return [ + [['foo' => new Definition('stdClass')]], + [['foo' => new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]], + [['foo' => new Reference('foo')]], + [['foo' => new Variable('foo')]], + ]; } public function testAddParameters() @@ -213,7 +214,7 @@ public function testDumpAsFiles() $container->getDefinition('bar')->addTag('hot'); $container->compile(); $dumper = new PhpDumper($container); - $dump = print_r($dumper->dump(array('as_files' => true, 'file' => __DIR__, 'hot_path_tag' => 'hot')), true); + $dump = print_r($dumper->dump(['as_files' => true, 'file' => __DIR__, 'hot_path_tag' => 'hot']), true); if ('\\' === \DIRECTORY_SEPARATOR) { $dump = str_replace('\\\\Fixtures\\\\includes\\\\foo.php', '/Fixtures/includes/foo.php', $dump); } @@ -237,7 +238,7 @@ public function testAddServiceIdWithUnsupportedCharacters() $container->register('bar$!', 'FooClass')->setPublic(true); $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => $class))); + eval('?>'.$dumper->dump(['class' => $class])); $this->assertTrue(method_exists($class, 'getBarService')); $this->assertTrue(method_exists($class, 'getBar2Service')); @@ -251,7 +252,7 @@ public function testConflictingServiceIds() $container->register('foobar', 'FooClass')->setPublic(true); $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => $class))); + eval('?>'.$dumper->dump(['class' => $class])); $this->assertTrue(method_exists($class, 'getFooBarService')); $this->assertTrue(method_exists($class, 'getFoobar2Service')); @@ -265,10 +266,10 @@ public function testConflictingMethodsWithParent() $container->register('foo_bar', 'FooClass')->setPublic(true); $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array( + eval('?>'.$dumper->dump([ 'class' => $class, 'base_class' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\containers\CustomContainer', - ))); + ])); $this->assertTrue(method_exists($class, 'getBar2Service')); $this->assertTrue(method_exists($class, 'getFoobar2Service')); @@ -293,12 +294,12 @@ public function testInvalidFactories($factory) public function provideInvalidFactories() { - return array( - array(array('', 'method')), - array(array('class', '')), - array(array('...', 'method')), - array(array('class', '...')), - ); + return [ + [['', 'method']], + [['class', '']], + [['...', 'method']], + [['class', '...']], + ]; } public function testAliases() @@ -307,7 +308,7 @@ public function testAliases() $container->setParameter('foo_bar', 'foo_bar'); $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Aliases'))); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Aliases'])); $container = new \Symfony_DI_PhpDumper_Test_Aliases(); $foo = $container->get('foo'); @@ -321,7 +322,7 @@ public function testFrozenContainerWithoutAliases() $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Frozen_No_Aliases'))); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Frozen_No_Aliases'])); $container = new \Symfony_DI_PhpDumper_Test_Frozen_No_Aliases(); $this->assertFalse($container->has('foo')); @@ -371,12 +372,12 @@ public function testEnvParameter() $container->compile(); $dumper = new PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services26.php', $dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_EnvParameters', 'file' => self::$fixturesPath.'/php/services26.php'))); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services26.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_EnvParameters', 'file' => self::$fixturesPath.'/php/services26.php'])); require self::$fixturesPath.'/php/services26.php'; $container = new \Symfony_DI_PhpDumper_Test_EnvParameters(); $this->assertSame($rand, $container->getParameter('baz')); - $this->assertSame(array(123, 'abc'), $container->getParameter('json')); + $this->assertSame([123, 'abc'], $container->getParameter('json')); $this->assertSame('sqlite:///foo/bar/var/data.db', $container->getParameter('db_dsn')); putenv('Baz'); } @@ -388,10 +389,10 @@ public function testResolvedBase64EnvParameters() $container->setParameter('hello', '%env(base64:foo)%'); $container->compile(true); - $expected = array( - 'env(foo)' => 'd29ybGQ=', - 'hello' => 'world', - ); + $expected = [ + 'env(foo)' => 'd29ybGQ=', + 'hello' => 'world', + ]; $this->assertSame($expected, $container->getParameterBag()->all()); } @@ -405,7 +406,7 @@ public function testDumpedBase64EnvParameters() $dumper = new PhpDumper($container); $dumper->dump(); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_base64_env.php', $dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Base64Parameters'))); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_base64_env.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Base64Parameters'])); require self::$fixturesPath.'/php/services_base64_env.php'; $container = new \Symfony_DI_PhpDumper_Test_Base64Parameters(); @@ -423,7 +424,7 @@ public function testCustomEnvParameters() $dumper = new PhpDumper($container); $dumper->dump(); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_rot13_env.php', $dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Rot13Parameters'))); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_rot13_env.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Rot13Parameters'])); require self::$fixturesPath.'/php/services_rot13_env.php'; $container = new \Symfony_DI_PhpDumper_Test_Rot13Parameters(); @@ -465,7 +466,7 @@ public function testCircularDynamicEnv() $container->compile(); $dumper = new PhpDumper($container); - $dump = $dumper->dump(array('class' => $class = __FUNCTION__)); + $dump = $dumper->dump(['class' => $class = __FUNCTION__]); eval('?>'.$dump); $container = new $class(); @@ -481,7 +482,7 @@ public function testCircularDynamicEnv() public function testInlinedDefinitionReferencingServiceContainer() { $container = new ContainerBuilder(); - $container->register('foo', 'stdClass')->addMethodCall('add', array(new Reference('service_container')))->setPublic(false); + $container->register('foo', 'stdClass')->addMethodCall('add', [new Reference('service_container')])->setPublic(false); $container->register('bar', 'stdClass')->addArgument(new Reference('foo'))->setPublic(true); $container->compile(); @@ -516,7 +517,7 @@ public function testInitializePropertiesBeforeMethodCalls() $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls'))); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls'])); $container = new \Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls(); $this->assertTrue($container->get('bar')->callPassed(), '->dump() initializes properties before method calls'); @@ -530,50 +531,22 @@ public function testCircularReferenceAllowanceForLazyServices() $container->compile(); $dumper = new PhpDumper($container); + $dumper->setProxyDumper(new \DummyProxyDumper()); $dumper->dump(); $this->addToAssertionCount(1); - } - - public function testCircularReferenceAllowanceForInlinedDefinitionsForLazyServices() - { - /* - * test graph: - * [connection] -> [event_manager] --> [entity_manager](lazy) - * | - * --(call)- addEventListener ("@lazy_service") - * - * [lazy_service](lazy) -> [entity_manager](lazy) - * - */ - - $container = new ContainerBuilder(); - - $eventManagerDefinition = new Definition('stdClass'); - - $connectionDefinition = $container->register('connection', 'stdClass')->setPublic(true); - $connectionDefinition->addArgument($eventManagerDefinition); - - $container->register('entity_manager', 'stdClass') - ->setPublic(true) - ->setLazy(true) - ->addArgument(new Reference('connection')); - - $lazyServiceDefinition = $container->register('lazy_service', 'stdClass'); - $lazyServiceDefinition->setPublic(true); - $lazyServiceDefinition->setLazy(true); - $lazyServiceDefinition->addArgument(new Reference('entity_manager')); - - $eventManagerDefinition->addMethodCall('addEventListener', array(new Reference('lazy_service'))); - - $container->compile(); $dumper = new PhpDumper($container); - $dumper->setProxyDumper(new \DummyProxyDumper()); - $dumper->dump(); + $message = 'Circular reference detected for service "foo", path: "foo -> bar -> foo". Try running "composer require symfony/proxy-manager-bridge".'; + if (method_exists($this, 'expectException')) { + $this->expectException(ServiceCircularReferenceException::class); + $this->expectExceptionMessage($message); + } else { + $this->setExpectedException(ServiceCircularReferenceException::class, $message); + } - $this->addToAssertionCount(1); + $dumper->dump(); } public function testDedupLazyProxy() @@ -598,15 +571,15 @@ public function testLazyArgumentProvideGenerator() $container ->register('lazy_context', 'LazyContext') ->setPublic(true) - ->setArguments(array( - new IteratorArgument(array('k1' => new Reference('lazy_referenced'), 'k2' => new Reference('service_container'))), - new IteratorArgument(array()), - )) + ->setArguments([ + new IteratorArgument(['k1' => new Reference('lazy_referenced'), 'k2' => new Reference('service_container')]), + new IteratorArgument([]), + ]) ; $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Lazy_Argument_Provide_Generator'))); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Lazy_Argument_Provide_Generator'])); $container = new \Symfony_DI_PhpDumper_Test_Lazy_Argument_Provide_Generator(); $lazyContext = $container->get('lazy_context'); @@ -645,8 +618,8 @@ public function testNormalizedId() public function testDumpContainerBuilderWithFrozenConstructorIncludingPrivateServices() { $container = new ContainerBuilder(); - $container->register('foo_service', 'stdClass')->setArguments(array(new Reference('baz_service')))->setPublic(true); - $container->register('bar_service', 'stdClass')->setArguments(array(new Reference('baz_service')))->setPublic(true); + $container->register('foo_service', 'stdClass')->setArguments([new Reference('baz_service')])->setPublic(true); + $container->register('bar_service', 'stdClass')->setArguments([new Reference('baz_service')])->setPublic(true); $container->register('baz_service', 'stdClass')->setPublic(false); $container->compile(); @@ -660,20 +633,20 @@ public function testServiceLocator() $container = new ContainerBuilder(); $container->register('foo_service', ServiceLocator::class) ->setPublic(true) - ->addArgument(array( + ->addArgument([ 'bar' => new ServiceClosureArgument(new Reference('bar_service')), 'baz' => new ServiceClosureArgument(new TypedReference('baz_service', 'stdClass')), 'nil' => $nil = new ServiceClosureArgument(new Reference('nil')), - )) + ]) ; // no method calls $container->register('translator.loader_1', 'stdClass')->setPublic(true); $container->register('translator.loader_1_locator', ServiceLocator::class) ->setPublic(false) - ->addArgument(array( + ->addArgument([ 'translator.loader_1' => new ServiceClosureArgument(new Reference('translator.loader_1')), - )); + ]); $container->register('translator_1', StubbedTranslator::class) ->setPublic(true) ->addArgument(new Reference('translator.loader_1_locator')); @@ -682,29 +655,29 @@ public function testServiceLocator() $container->register('translator.loader_2', 'stdClass')->setPublic(true); $container->register('translator.loader_2_locator', ServiceLocator::class) ->setPublic(false) - ->addArgument(array( + ->addArgument([ 'translator.loader_2' => new ServiceClosureArgument(new Reference('translator.loader_2')), - )); + ]); $container->register('translator_2', StubbedTranslator::class) ->setPublic(true) ->addArgument(new Reference('translator.loader_2_locator')) - ->addMethodCall('addResource', array('db', new Reference('translator.loader_2'), 'nl')); + ->addMethodCall('addResource', ['db', new Reference('translator.loader_2'), 'nl']); // two method calls $container->register('translator.loader_3', 'stdClass')->setPublic(true); $container->register('translator.loader_3_locator', ServiceLocator::class) ->setPublic(false) - ->addArgument(array( + ->addArgument([ 'translator.loader_3' => new ServiceClosureArgument(new Reference('translator.loader_3')), - )); + ]); $container->register('translator_3', StubbedTranslator::class) ->setPublic(true) ->addArgument(new Reference('translator.loader_3_locator')) - ->addMethodCall('addResource', array('db', new Reference('translator.loader_3'), 'nl')) - ->addMethodCall('addResource', array('db', new Reference('translator.loader_3'), 'en')); + ->addMethodCall('addResource', ['db', new Reference('translator.loader_3'), 'nl']) + ->addMethodCall('addResource', ['db', new Reference('translator.loader_3'), 'en']); - $nil->setValues(array(null)); - $container->register('bar_service', 'stdClass')->setArguments(array(new Reference('baz_service')))->setPublic(true); + $nil->setValues([null]); + $container->register('bar_service', 'stdClass')->setArguments([new Reference('baz_service')])->setPublic(true); $container->register('baz_service', 'stdClass')->setPublic(false); $container->compile(); @@ -720,10 +693,10 @@ public function testServiceSubscriber() ->setPublic(true) ->setAutowired(true) ->addArgument(new Reference(ContainerInterface::class)) - ->addTag('container.service_subscriber', array( + ->addTag('container.service_subscriber', [ 'key' => 'bar', 'id' => TestServiceSubscriber::class, - )) + ]) ; $container->register(TestServiceSubscriber::class, TestServiceSubscriber::class)->setPublic(true); @@ -745,11 +718,11 @@ public function testPrivateWithIgnoreOnInvalidReference() ->setPublic(false); $container->register('bar', 'BarClass') ->setPublic(true) - ->addMethodCall('setBaz', array(new Reference('not_invalid', SymfonyContainerInterface::IGNORE_ON_INVALID_REFERENCE))); + ->addMethodCall('setBaz', [new Reference('not_invalid', SymfonyContainerInterface::IGNORE_ON_INVALID_REFERENCE)]); $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference'))); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference'])); $container = new \Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference(); $this->assertInstanceOf('BazClass', $container->get('bar')->getBaz()); @@ -758,16 +731,16 @@ public function testPrivateWithIgnoreOnInvalidReference() public function testArrayParameters() { $container = new ContainerBuilder(); - $container->setParameter('array_1', array(123)); - $container->setParameter('array_2', array(__DIR__)); + $container->setParameter('array_1', [123]); + $container->setParameter('array_2', [__DIR__]); $container->register('bar', 'BarClass') ->setPublic(true) - ->addMethodCall('setBaz', array('%array_1%', '%array_2%', '%%array_1%%', array(123))); + ->addMethodCall('setBaz', ['%array_1%', '%array_2%', '%%array_1%%', [123]]); $container->compile(); $dumper = new PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_array_params.php', str_replace('\\\\Dumper', '/Dumper', $dumper->dump(array('file' => self::$fixturesPath.'/php/services_array_params.php')))); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_array_params.php', str_replace('\\\\Dumper', '/Dumper', $dumper->dump(['file' => self::$fixturesPath.'/php/services_array_params.php']))); } public function testExpressionReferencingPrivateService() @@ -779,7 +752,7 @@ public function testExpressionReferencingPrivateService() ->setPublic(false); $container->register('public_foo', 'stdClass') ->setPublic(true) - ->addArgument(new Expression('service("private_foo")')); + ->addArgument(new Expression('service("private_foo").bar')); $container->compile(); $dumper = new PhpDumper($container); @@ -793,7 +766,7 @@ public function testUninitializedReference() $container->compile(); $dumper = new PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_uninitialized_ref.php', $dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Uninitialized_Reference'))); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_uninitialized_ref.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Uninitialized_Reference'])); require self::$fixturesPath.'/php/services_uninitialized_ref.php'; @@ -807,7 +780,7 @@ public function testUninitializedReference() $this->assertNull($bar->closures[0]()); $this->assertNull($bar->closures[1]()); $this->assertNull($bar->closures[2]()); - $this->assertSame(array(), iterator_to_array($bar->iter)); + $this->assertSame([], iterator_to_array($bar->iter)); $container = new \Symfony_DI_PhpDumper_Test_Uninitialized_Reference(); @@ -822,7 +795,7 @@ public function testUninitializedReference() $this->assertEquals(new \stdClass(), $bar->closures[0]()); $this->assertNull($bar->closures[1]()); $this->assertEquals(new \stdClass(), $bar->closures[2]()); - $this->assertEquals(array('foo1' => new \stdClass(), 'foo3' => new \stdClass()), iterator_to_array($bar->iter)); + $this->assertEquals(['foo1' => new \stdClass(), 'foo3' => new \stdClass()], iterator_to_array($bar->iter)); } /** @@ -835,7 +808,7 @@ public function testAlmostCircular($visibility) $dumper = new PhpDumper($container); $container = 'Symfony_DI_PhpDumper_Test_Almost_Circular_'.ucfirst($visibility); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_almost_circular_'.$visibility.'.php', $dumper->dump(array('class' => $container))); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_almost_circular_'.$visibility.'.php', $dumper->dump(['class' => $container])); require self::$fixturesPath.'/php/services_almost_circular_'.$visibility.'.php'; @@ -847,16 +820,71 @@ public function testAlmostCircular($visibility) $foo2 = $container->get('foo2'); $this->assertSame($foo2, $foo2->bar->foobar->foo); - $this->assertSame(array(), (array) $container->get('foobar4')); + $this->assertSame([], (array) $container->get('foobar4')); $foo5 = $container->get('foo5'); $this->assertSame($foo5, $foo5->bar->foo); + + $manager = $container->get('manager'); + $this->assertEquals(new \stdClass(), $manager); + + $manager = $container->get('manager2'); + $this->assertEquals(new \stdClass(), $manager); + + $foo6 = $container->get('foo6'); + $this->assertEquals((object) ['bar6' => (object) []], $foo6); + + $this->assertInstanceOf(\stdClass::class, $container->get('root')); } public function provideAlmostCircular() { - yield array('public'); - yield array('private'); + yield ['public']; + yield ['private']; + } + + public function testDeepServiceGraph() + { + $container = new ContainerBuilder(); + + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); + $loader->load('services_deep_graph.yml'); + + $container->compile(); + + $dumper = new PhpDumper($container); + $dumper->dump(); + + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_deep_graph.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Deep_Graph'])); + + require self::$fixturesPath.'/php/services_deep_graph.php'; + + $container = new \Symfony_DI_PhpDumper_Test_Deep_Graph(); + + $this->assertInstanceOf(FooForDeepGraph::class, $container->get('foo')); + $this->assertEquals((object) ['p2' => (object) ['p3' => (object) []]], $container->get('foo')->bClone); + } + + public function testInlineSelfRef() + { + $container = new ContainerBuilder(); + + $bar = (new Definition('App\Bar')) + ->setProperty('foo', new Reference('App\Foo')); + + $baz = (new Definition('App\Baz')) + ->setProperty('bar', $bar) + ->addArgument($bar); + + $container->register('App\Foo') + ->setPublic(true) + ->addArgument($baz); + + $passConfig = $container->getCompiler()->getPassConfig(); + $container->compile(); + + $dumper = new PhpDumper($container); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_inline_self_ref.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Inline_Self_Ref'])); } public function testHotPathOptimizations() @@ -866,7 +894,7 @@ public function testHotPathOptimizations() $container->compile(); $dumper = new PhpDumper($container); - $dump = $dumper->dump(array('hot_path_tag' => 'container.hot_path', 'inline_class_loader_parameter' => 'inline_requires', 'file' => self::$fixturesPath.'/php/services_inline_requires.php')); + $dump = $dumper->dump(['hot_path_tag' => 'container.hot_path', 'inline_class_loader_parameter' => 'inline_requires', 'file' => self::$fixturesPath.'/php/services_inline_requires.php']); if ('\\' === \DIRECTORY_SEPARATOR) { $dump = str_replace("'\\\\includes\\\\HotPath\\\\", "'/includes/HotPath/", $dump); } @@ -881,7 +909,7 @@ public function testDumpHandlesLiteralClassWithRootNamespace() $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Literal_Class_With_Root_Namespace'))); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Literal_Class_With_Root_Namespace'])); $container = new \Symfony_DI_PhpDumper_Test_Literal_Class_With_Root_Namespace(); @@ -890,23 +918,23 @@ public function testDumpHandlesLiteralClassWithRootNamespace() public function testDumpHandlesObjectClassNames() { - $container = new ContainerBuilder(new ParameterBag(array( + $container = new ContainerBuilder(new ParameterBag([ 'class' => 'stdClass', - ))); + ])); $container->setDefinition('foo', new Definition(new Parameter('class'))); - $container->setDefinition('bar', new Definition('stdClass', array( + $container->setDefinition('bar', new Definition('stdClass', [ new Reference('foo'), - )))->setPublic(true); + ]))->setPublic(true); $container->setParameter('inline_requires', true); $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array( + eval('?>'.$dumper->dump([ 'class' => 'Symfony_DI_PhpDumper_Test_Object_Class_Name', 'inline_class_loader_parameter' => 'inline_requires', - ))); + ])); $container = new \Symfony_DI_PhpDumper_Test_Object_Class_Name(); @@ -923,17 +951,29 @@ public function testUninitializedSyntheticReference() $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array( + eval('?>'.$dumper->dump([ 'class' => 'Symfony_DI_PhpDumper_Test_UninitializedSyntheticReference', 'inline_class_loader_parameter' => 'inline_requires', - ))); + ])); $container = new \Symfony_DI_PhpDumper_Test_UninitializedSyntheticReference(); - $this->assertEquals((object) array('foo' => null), $container->get('bar')); + $this->assertEquals((object) ['foo' => null], $container->get('bar')); + + $container->set('foo', (object) [123]); + $this->assertEquals((object) ['foo' => (object) [123]], $container->get('bar')); + } + + public function testAdawsonContainer() + { + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); + $loader->load('services_adawson.yml'); + $container->compile(); - $container->set('foo', (object) array(123)); - $this->assertEquals((object) array('foo' => (object) array(123)), $container->get('bar')); + $dumper = new PhpDumper($container); + $dump = $dumper->dump(); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_adawson.php', $dumper->dump()); } /** @@ -967,7 +1007,7 @@ public function testLegacyPrivateServices() $container->compile(); $dumper = new PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_legacy_privates.php', $dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Legacy_Privates', 'file' => self::$fixturesPath.'/php/services_legacy_privates.php'))); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_legacy_privates.php', $dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Legacy_Privates', 'file' => self::$fixturesPath.'/php/services_legacy_privates.php'])); require self::$fixturesPath.'/php/services_legacy_privates.php'; @@ -1004,7 +1044,7 @@ public function testPrivateServiceTriggersDeprecation() $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation'))); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation'])); $container = new \Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation(); @@ -1019,11 +1059,11 @@ public function testPrivateServiceTriggersDeprecation() */ public function testParameterWithMixedCase() { - $container = new ContainerBuilder(new ParameterBag(array('Foo' => 'bar', 'BAR' => 'foo'))); + $container = new ContainerBuilder(new ParameterBag(['Foo' => 'bar', 'BAR' => 'foo'])); $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Parameter_With_Mixed_Case'))); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Parameter_With_Mixed_Case'])); $container = new \Symfony_DI_PhpDumper_Test_Parameter_With_Mixed_Case(); @@ -1039,11 +1079,11 @@ public function testParameterWithMixedCase() */ public function testParameterWithLowerCase() { - $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); + $container = new ContainerBuilder(new ParameterBag(['foo' => 'bar'])); $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Parameter_With_Lower_Case'))); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Parameter_With_Lower_Case'])); $container = new \Symfony_DI_PhpDumper_Test_Parameter_With_Lower_Case(); @@ -1063,11 +1103,11 @@ public function testReferenceWithLowerCaseId() $container->compile(); $dumper = new PhpDumper($container); - eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Reference_With_Lower_Case_Id'))); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Reference_With_Lower_Case_Id'])); $container = new \Symfony_DI_PhpDumper_Test_Reference_With_Lower_Case_Id(); - $this->assertEquals((object) array('foo' => (object) array()), $container->get('Bar')); + $this->assertEquals((object) ['foo' => (object) []], $container->get('Bar')); } } @@ -1080,6 +1120,17 @@ public function getEnv($prefix, $name, \Closure $getEnv) public static function getProvidedTypes() { - return array('rot13' => 'string'); + return ['rot13' => 'string']; + } +} + +class FooForDeepGraph +{ + public $bClone; + + public function __construct(\stdClass $a, \stdClass $b) + { + // clone to verify that $b has been fully initialized before + $this->bClone = clone $b; } } diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php index f33b3b8d7073226b5b721eb62c732a17d578f703..ac274c6f26267833dadd07ab73ec4b32ddeb0f84 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php @@ -123,8 +123,8 @@ public function provideDecoratedServicesData() { $fixturesPath = realpath(__DIR__.'/../Fixtures/'); - return array( - array("<?xml version=\"1.0\" encoding=\"utf-8\"?> + return [ + ["<?xml version=\"1.0\" encoding=\"utf-8\"?> <container xmlns=\"http://symfony.com/schema/dic/services\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd\"> <services> <service id=\"service_container\" class=\"Symfony\Component\DependencyInjection\ContainerInterface\" public=\"true\" synthetic=\"true\"/> @@ -133,8 +133,8 @@ public function provideDecoratedServicesData() <service id=\"Symfony\Component\DependencyInjection\ContainerInterface\" alias=\"service_container\" public=\"false\"/> </services> </container> -", include $fixturesPath.'/containers/container15.php'), - array("<?xml version=\"1.0\" encoding=\"utf-8\"?> +", include $fixturesPath.'/containers/container15.php'], + ["<?xml version=\"1.0\" encoding=\"utf-8\"?> <container xmlns=\"http://symfony.com/schema/dic/services\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd\"> <services> <service id=\"service_container\" class=\"Symfony\Component\DependencyInjection\ContainerInterface\" public=\"true\" synthetic=\"true\"/> @@ -143,8 +143,8 @@ public function provideDecoratedServicesData() <service id=\"Symfony\Component\DependencyInjection\ContainerInterface\" alias=\"service_container\" public=\"false\"/> </services> </container> -", include $fixturesPath.'/containers/container16.php'), - ); +", include $fixturesPath.'/containers/container16.php'], + ]; } /** @@ -163,13 +163,13 @@ public function testCompiledContainerCanBeDumped($containerFile) public function provideCompiledContainerData() { - return array( - array('container8'), - array('container9'), - array('container11'), - array('container12'), - array('container14'), - ); + return [ + ['container8'], + ['container9'], + ['container11'], + ['container12'], + ['container14'], + ]; } public function testDumpInlinedServices() @@ -194,7 +194,7 @@ public function testDumpLoad() $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); $loader->load('services_dump_load.xml'); - $this->assertEquals(array(new Reference('bar', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)), $container->getDefinition('foo')->getArguments()); + $this->assertEquals([new Reference('bar', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)], $container->getDefinition('foo')->getArguments()); $dumper = new XmlDumper($container); $this->assertStringEqualsFile(self::$fixturesPath.'/xml/services_dump_load.xml', $dumper->dump()); diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php index ff2239fb64d66b4c335e2da4e93d6c7e25ba0f80..49ee8e6f3002e7bdab4a2a1d1e51078f63b6cbed 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php @@ -75,7 +75,7 @@ public function testDumpLoad() $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); $loader->load('services_dump_load.yml'); - $this->assertEquals(array(new Reference('bar', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)), $container->getDefinition('foo')->getArguments()); + $this->assertEquals([new Reference('bar', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)], $container->getDefinition('foo')->getArguments()); $dumper = new YamlDumper($container); $this->assertStringEqualsFile(self::$fixturesPath.'/yaml/services_dump_load.yml', $dumper->dump()); diff --git a/vendor/symfony/dependency-injection/Tests/EnvVarProcessorTest.php b/vendor/symfony/dependency-injection/Tests/EnvVarProcessorTest.php index b1ee044e9e5c088bf65b94c9566a7396c2c70f25..972350467a0218d869fcd25336b7944d136ccee6 100644 --- a/vendor/symfony/dependency-injection/Tests/EnvVarProcessorTest.php +++ b/vendor/symfony/dependency-injection/Tests/EnvVarProcessorTest.php @@ -31,16 +31,16 @@ public function testGetEnvString($value, $processed) public function validStrings() { - return array( - array('hello', 'hello'), - array('true', 'true'), - array('false', 'false'), - array('null', 'null'), - array('1', '1'), - array('0', '0'), - array('1.1', '1.1'), - array('1e1', '1e1'), - ); + return [ + ['hello', 'hello'], + ['true', 'true'], + ['false', 'false'], + ['null', 'null'], + ['1', '1'], + ['0', '0'], + ['1.1', '1.1'], + ['1e1', '1e1'], + ]; } /** @@ -61,15 +61,15 @@ public function testGetEnvBool($value, $processed) public function validBools() { - return array( - array('true', true), - array('false', false), - array('null', false), - array('1', true), - array('0', false), - array('1.1', true), - array('1e1', true), - ); + return [ + ['true', true], + ['false', false], + ['null', false], + ['1', true], + ['0', false], + ['1.1', true], + ['1e1', true], + ]; } /** @@ -90,11 +90,11 @@ public function testGetEnvInt($value, $processed) public function validInts() { - return array( - array('1', 1), - array('1.1', 1), - array('1e1', 10), - ); + return [ + ['1', 1], + ['1.1', 1], + ['1e1', 10], + ]; } /** @@ -115,11 +115,11 @@ public function testGetEnvIntInvalid($value) public function invalidInts() { - return array( - array('foo'), - array('true'), - array('null'), - ); + return [ + ['foo'], + ['true'], + ['null'], + ]; } /** @@ -140,11 +140,11 @@ public function testGetEnvFloat($value, $processed) public function validFloats() { - return array( - array('1', 1.0), - array('1.1', 1.1), - array('1e1', 10.0), - ); + return [ + ['1', 1.0], + ['1.1', 1.1], + ['1e1', 10.0], + ]; } /** @@ -165,11 +165,11 @@ public function testGetEnvFloatInvalid($value) public function invalidFloats() { - return array( - array('foo'), - array('true'), - array('null'), - ); + return [ + ['foo'], + ['true'], + ['null'], + ]; } /** @@ -190,10 +190,10 @@ public function testGetEnvConst($value, $processed) public function validConsts() { - return array( - array('Symfony\Component\DependencyInjection\Tests\EnvVarProcessorTest::TEST_CONST', self::TEST_CONST), - array('E_ERROR', E_ERROR), - ); + return [ + ['Symfony\Component\DependencyInjection\Tests\EnvVarProcessorTest::TEST_CONST', self::TEST_CONST], + ['E_ERROR', E_ERROR], + ]; } /** @@ -214,10 +214,10 @@ public function testGetEnvConstInvalid($value) public function invalidConsts() { - return array( - array('Symfony\Component\DependencyInjection\Tests\EnvVarProcessorTest::UNDEFINED_CONST'), - array('UNDEFINED_CONST'), - ); + return [ + ['Symfony\Component\DependencyInjection\Tests\EnvVarProcessorTest::UNDEFINED_CONST'], + ['UNDEFINED_CONST'], + ]; } public function testGetEnvBase64() @@ -240,10 +240,10 @@ public function testGetEnvJson() $result = $processor->getEnv('json', 'foo', function ($name) { $this->assertSame('foo', $name); - return json_encode(array(1)); + return json_encode([1]); }); - $this->assertSame(array(1), $result); + $this->assertSame([1], $result); } /** @@ -279,12 +279,12 @@ public function testGetEnvJsonOther($value) public function otherJsonValues() { - return array( - array(1), - array(1.1), - array(true), - array(false), - ); + return [ + [1], + [1.1], + [true], + [false], + ]; } /** diff --git a/vendor/symfony/dependency-injection/Tests/Extension/ExtensionTest.php b/vendor/symfony/dependency-injection/Tests/Extension/ExtensionTest.php index 9f66bfd7c6802aadbffcd4dc8d8bd0f2a6eeedf3..3c912f2a13678acd04638f6ac64a70f76e752644 100644 --- a/vendor/symfony/dependency-injection/Tests/Extension/ExtensionTest.php +++ b/vendor/symfony/dependency-injection/Tests/Extension/ExtensionTest.php @@ -23,15 +23,15 @@ class ExtensionTest extends TestCase public function testIsConfigEnabledReturnsTheResolvedValue($enabled) { $extension = new EnableableExtension(); - $this->assertSame($enabled, $extension->isConfigEnabled(new ContainerBuilder(), array('enabled' => $enabled))); + $this->assertSame($enabled, $extension->isConfigEnabled(new ContainerBuilder(), ['enabled' => $enabled])); } public function getResolvedEnabledFixtures() { - return array( - array(true), - array(false), - ); + return [ + [true], + [false], + ]; } /** @@ -42,7 +42,7 @@ public function testIsConfigEnabledOnNonEnableableConfig() { $extension = new EnableableExtension(); - $extension->isConfigEnabled(new ContainerBuilder(), array()); + $extension->isConfigEnabled(new ContainerBuilder(), []); } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/Bar.php b/vendor/symfony/dependency-injection/Tests/Fixtures/Bar.php index d243866d36ef9de23efce593b131758dfac1d282..83f2da12a70ab9b15666269b2f226eed9f64871f 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/Bar.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/Bar.php @@ -13,7 +13,7 @@ class Bar implements BarInterface { - public function __construct($quz = null, \NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = array()) + public function __construct($quz = null, \NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = []) { } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/FactoryDummyWithoutReturnTypes.php b/vendor/symfony/dependency-injection/Tests/Fixtures/FactoryDummyWithoutReturnTypes.php new file mode 100644 index 0000000000000000000000000000000000000000..f480a668b5c2cd19d584bc617235778d44b60826 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/FactoryDummyWithoutReturnTypes.php @@ -0,0 +1,19 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Fixtures; + +class FactoryDummyWithoutReturnTypes +{ + public function createTestDefinition1() + { + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/FooForCircularWithAddCalls.php b/vendor/symfony/dependency-injection/Tests/Fixtures/FooForCircularWithAddCalls.php new file mode 100644 index 0000000000000000000000000000000000000000..a8331dc3ebc171acd6154439012d5c3a575e99ad --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/FooForCircularWithAddCalls.php @@ -0,0 +1,19 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Fixtures; + +class FooForCircularWithAddCalls +{ + public function call(\stdClass $argument) + { + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/TestDefinition1.php b/vendor/symfony/dependency-injection/Tests/Fixtures/TestDefinition1.php new file mode 100644 index 0000000000000000000000000000000000000000..8ec76a9de63c4d7a648e4d0dbc8c6371595c5e04 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/TestDefinition1.php @@ -0,0 +1,18 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Fixtures; + +use Symfony\Component\DependencyInjection\Definition; + +class TestDefinition1 extends Definition +{ +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/TestServiceSubscriber.php b/vendor/symfony/dependency-injection/Tests/Fixtures/TestServiceSubscriber.php index 875abe9e02e121215e330536720be1df57c9ec4d..a3b042b8f261d0cea39f9a361332d823acc5ea88 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/TestServiceSubscriber.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/TestServiceSubscriber.php @@ -12,11 +12,11 @@ public function __construct($container) public static function getSubscribedServices() { - return array( + return [ __CLASS__, '?'.CustomDefinition::class, 'bar' => CustomDefinition::class, 'baz' => '?'.CustomDefinition::class, - ); + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/basic.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/basic.php index b98e894c372535e0e895017b12b2e0577bd9202f..a9e250b9213a1ce0292141562dc1f5b51c237933 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/basic.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/basic.php @@ -7,5 +7,5 @@ return function (ContainerConfigurator $c) { $s = $c->services(); $s->set(BarService::class) - ->args(array(inline('FooClass'))); + ->args([inline('FooClass')]); }; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/child.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/child.php index 6fd84485e7a3a8f62d1910e6f5e2854df4d85f66..8a5f2431d0abf39d3d67bc4be23035c1d6f7fa54 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/child.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/child.php @@ -13,7 +13,7 @@ ->set('foo') ->parent(BarService::class) ->decorate('bar', 'b', 1) - ->args(array(ref('b'))) + ->args([ref('b')]) ->class('Class2') ->file('file.php') ->parent('bar') diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/defaults.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/defaults.php index de3b99d745a56a299e5ebb3e7e9e0ed46e3e4643..2889d3fbb6400d31ab362cd136840c338f460770 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/defaults.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/defaults.php @@ -12,10 +12,10 @@ ->private() ->autoconfigure() ->autowire() - ->tag('t', array('a' => 'b')) + ->tag('t', ['a' => 'b']) ->bind(Foo::class, ref('bar')) ->private(); - $s->set(Foo::class)->args(array(ref('bar')))->public(); + $s->set(Foo::class)->args([ref('bar')])->public(); $s->set('bar', Foo::class)->call('setFoo')->autoconfigure(false); }; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/instanceof.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/instanceof.php index 062e8c00ab25014b189992924d7811bfca4d6b93..0d6aac7a0051e02c56ea117daa6e32358e20323d 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/instanceof.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/instanceof.php @@ -9,8 +9,8 @@ $s = $c->services(); $s->instanceof(Prototype\Foo::class) ->property('p', 0) - ->call('setFoo', array(ref('foo'))) - ->tag('tag', array('k' => 'v')) + ->call('setFoo', [ref('foo')]) + ->tag('tag', ['k' => 'v']) ->share(false) ->lazy() ->configurator('c') diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.php index 622c51af57a2636fb4e8cd98bfb3b9c87a0db1f0..e2884aa20216a73e0cdc9a570cb55bb9e78b9325 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.php @@ -12,8 +12,8 @@ ->exclude('../Prototype/{OtherDir,BadClasses}') ->factory('f') ->deprecate('%service_id%') - ->args(array(0)) - ->args(array(1)) + ->args([0]) + ->args([1]) ->autoconfigure(false) ->tag('foo') ->parent('foo'); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/services9.php b/vendor/symfony/dependency-injection/Tests/Fixtures/config/services9.php index b013e5126d3b68133cc933c2afc5640950c89b1c..d9373a2a6f9e61da25c08af60b5eef7e77e2b01f 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/services9.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/services9.php @@ -16,65 +16,65 @@ $s = $c->services(); $s->set('foo') - ->args(array('foo', ref('foo.baz'), array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'), true, ref('service_container'))) + ->args(['foo', ref('foo.baz'), ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%'], true, ref('service_container')]) ->class(FooClass::class) - ->tag('foo', array('foo' => 'foo')) - ->tag('foo', array('bar' => 'bar', 'baz' => 'baz')) - ->factory(array(FooClass::class, 'getInstance')) + ->tag('foo', ['foo' => 'foo']) + ->tag('foo', ['bar' => 'bar', 'baz' => 'baz']) + ->factory([FooClass::class, 'getInstance']) ->property('foo', 'bar') ->property('moo', ref('foo.baz')) - ->property('qux', array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%')) - ->call('setBar', array(ref('bar'))) + ->property('qux', ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%']) + ->call('setBar', [ref('bar')]) ->call('initialize') ->configurator('sc_configure'); $s->set('foo.baz', '%baz_class%') - ->factory(array('%baz_class%', 'getInstance')) - ->configurator(array('%baz_class%', 'configureStatic1')); + ->factory(['%baz_class%', 'getInstance']) + ->configurator(['%baz_class%', 'configureStatic1']); $s->set('bar', FooClass::class) - ->args(array('foo', ref('foo.baz'), new Parameter('foo_bar'))) - ->configurator(array(ref('foo.baz'), 'configure')); + ->args(['foo', ref('foo.baz'), new Parameter('foo_bar')]) + ->configurator([ref('foo.baz'), 'configure']); $s->set('foo_bar', '%foo_class%') - ->args(array(ref('deprecated_service'))) + ->args([ref('deprecated_service')]) ->share(false); $s->set('method_call1', 'Bar\FooClass') ->file(realpath(__DIR__.'/../includes/foo.php')) - ->call('setBar', array(ref('foo'))) - ->call('setBar', array(ref('foo2')->nullOnInvalid())) - ->call('setBar', array(ref('foo3')->ignoreOnInvalid())) - ->call('setBar', array(ref('foobaz')->ignoreOnInvalid())) - ->call('setBar', array(expr('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")'))); + ->call('setBar', [ref('foo')]) + ->call('setBar', [ref('foo2')->nullOnInvalid()]) + ->call('setBar', [ref('foo3')->ignoreOnInvalid()]) + ->call('setBar', [ref('foobaz')->ignoreOnInvalid()]) + ->call('setBar', [expr('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]); $s->set('foo_with_inline', 'Foo') - ->call('setBar', array(ref('inlined'))); + ->call('setBar', [ref('inlined')]); $s->set('inlined', 'Bar') ->property('pub', 'pub') - ->call('setBaz', array(ref('baz'))) + ->call('setBaz', [ref('baz')]) ->private(); $s->set('baz', 'Baz') - ->call('setFoo', array(ref('foo_with_inline'))); + ->call('setFoo', [ref('foo_with_inline')]); $s->set('request', 'Request') ->synthetic(); $s->set('configurator_service', 'ConfClass') ->private() - ->call('setFoo', array(ref('baz'))); + ->call('setFoo', [ref('baz')]); $s->set('configured_service', 'stdClass') - ->configurator(array(ref('configurator_service'), 'configureStdClass')); + ->configurator([ref('configurator_service'), 'configureStdClass']); $s->set('configurator_service_simple', 'ConfClass') - ->args(array('bar')) + ->args(['bar']) ->private(); $s->set('configured_service_simple', 'stdClass') - ->configurator(array(ref('configurator_service_simple'), 'configureStdClass')); + ->configurator([ref('configurator_service_simple'), 'configureStdClass']); $s->set('decorated', 'stdClass'); @@ -92,28 +92,28 @@ ->private(); $s->set('factory_service', 'Bar') - ->factory(array(ref('foo.baz'), 'getInstance')); + ->factory([ref('foo.baz'), 'getInstance']); $s->set('new_factory_service', 'FooBarBaz') ->property('foo', 'bar') - ->factory(array(ref('new_factory'), 'getInstance')); + ->factory([ref('new_factory'), 'getInstance']); $s->set('service_from_static_method', 'Bar\FooClass') - ->factory(array('Bar\FooClass', 'getInstance')); + ->factory(['Bar\FooClass', 'getInstance']); $s->set('factory_simple', 'SimpleFactoryClass') ->deprecate() - ->args(array('foo')) + ->args(['foo']) ->private(); $s->set('factory_service_simple', 'Bar') - ->factory(array(ref('factory_simple'), 'getInstance')); + ->factory([ref('factory_simple'), 'getInstance']); $s->set('lazy_context', 'LazyContext') - ->args(array(iterator(array('k1' => ref('foo.baz'), 'k2' => ref('service_container'))), iterator(array()))); + ->args([iterator(['k1' => ref('foo.baz'), 'k2' => ref('service_container')]), iterator([])]); $s->set('lazy_context_ignore_invalid_ref', 'LazyContext') - ->args(array(iterator(array(ref('foo.baz'), ref('invalid')->ignoreOnInvalid())), iterator(array()))); + ->args([iterator([ref('foo.baz'), ref('invalid')->ignoreOnInvalid()]), iterator([])]); $s->set('tagged_iterator_foo', 'Bar') ->private() @@ -121,7 +121,7 @@ $s->set('tagged_iterator', 'Bar') ->public() - ->args(array(tagged('foo'))); + ->args([tagged('foo')]); $s->alias('alias_for_foo', 'foo')->private()->public(); $s->alias('alias_for_alias', ref('alias_for_foo')); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container11.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container11.php index 150cd7921ee1badff68a8ba758a854a456c5b3c1..91e5c26330f4546bbcb2f7521c0f89fbefb0f4b0 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container11.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container11.php @@ -6,7 +6,7 @@ $container = new ContainerBuilder(); $container-> register('foo', 'FooClass')-> - addArgument(new Definition('BarClass', array(new Definition('BazClass')))) + addArgument(new Definition('BarClass', [new Definition('BazClass')])) ->setPublic(true) ; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container12.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container12.php index bc527eb79e78dda422a65278ee18b990e0bb8975..ef0770302491c97a0f24924307a763a054e1be82 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container12.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container12.php @@ -6,7 +6,7 @@ $container-> register('foo', 'FooClass\\Foo')-> addArgument('foo<>&bar')-> - addTag('foo"bar\\bar', array('foo' => 'foo"barřž€')) + addTag('foo"bar\\bar', ['foo' => 'foo"barřž€']) ->setPublic(true) ; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php index 823a77f534f5247138b735395b89d7c0ee6b81b2..c3af5c96063baf66697cdcdce140f088f93e0a2f 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php @@ -7,9 +7,12 @@ $container = new ContainerBuilder(); +$container->setParameter('env(FOO)', 'Bar\FaooClass'); +$container->setParameter('foo', '%env(FOO)%'); + $container - ->register('service_from_anonymous_factory', 'Bar\FooClass') - ->setFactory(array(new Definition('Bar\FooClass'), 'getInstance')) + ->register('service_from_anonymous_factory', '%foo%') + ->setFactory([new Definition('%foo%'), 'getInstance']) ->setPublic(true) ; @@ -17,7 +20,7 @@ $anonymousServiceWithFactory->setFactory('Bar\FooClass::getInstance'); $container ->register('service_with_method_call_and_factory', 'Bar\FooClass') - ->addMethodCall('setBar', array($anonymousServiceWithFactory)) + ->addMethodCall('setBar', [$anonymousServiceWithFactory]) ->setPublic(true) ; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container21.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container21.php index 298c9266a9e2b42f456aa246d24e68ac9c5305f5..d82cf38538c33dd6bb1178e1d131ab35fdd0f612 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container21.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container21.php @@ -6,15 +6,15 @@ $container = new ContainerBuilder(); $bar = new Definition('Bar'); -$bar->setConfigurator(array(new Definition('Baz'), 'configureBar')); +$bar->setConfigurator([new Definition('Baz'), 'configureBar']); $fooFactory = new Definition('FooFactory'); -$fooFactory->setFactory(array(new Definition('Foobar'), 'createFooFactory')); +$fooFactory->setFactory([new Definition('Foobar'), 'createFooFactory']); $container ->register('foo', 'Foo') - ->setFactory(array($fooFactory, 'createFoo')) - ->setConfigurator(array($bar, 'configureFoo')) + ->setFactory([$fooFactory, 'createFoo']) + ->setConfigurator([$bar, 'configureFoo']) ->setPublic(true) ; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container8.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container8.php index 1a4e5ab5c8d8da2e8d99ac7a6e84a85ae5c55bbc..5b3c01c23cd52dde4001a3fdcab6de6ab445af2b 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container8.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container8.php @@ -3,12 +3,12 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -$container = new ContainerBuilder(new ParameterBag(array( +$container = new ContainerBuilder(new ParameterBag([ 'foo' => '%baz%', 'baz' => 'bar', 'bar' => 'foo is %%foo bar', 'escape' => '@escapeme', - 'values' => array(true, false, null, 0, 1000.3, 'true', 'false', 'null'), -))); + 'values' => [true, false, null, 0, 1000.3, 'true', 'false', 'null'], +])); return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container9.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container9.php index 21d35611c33aef230d42fe512893db2e88b278b4..691a7fa695f9159811e1045e6ec90ef1bcad3601 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container9.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container9.php @@ -14,26 +14,26 @@ $container = new ContainerBuilder(); $container ->register('foo', '\Bar\FooClass') - ->addTag('foo', array('foo' => 'foo')) - ->addTag('foo', array('bar' => 'bar', 'baz' => 'baz')) - ->setFactory(array('Bar\\FooClass', 'getInstance')) - ->setArguments(array('foo', new Reference('foo.baz'), array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'), true, new Reference('service_container'))) - ->setProperties(array('foo' => 'bar', 'moo' => new Reference('foo.baz'), 'qux' => array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'))) - ->addMethodCall('setBar', array(new Reference('bar'))) + ->addTag('foo', ['foo' => 'foo']) + ->addTag('foo', ['bar' => 'bar', 'baz' => 'baz']) + ->setFactory(['Bar\\FooClass', 'getInstance']) + ->setArguments(['foo', new Reference('foo.baz'), ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%'], true, new Reference('service_container')]) + ->setProperties(['foo' => 'bar', 'moo' => new Reference('foo.baz'), 'qux' => ['%foo%' => 'foo is %foo%', 'foobar' => '%foo%']]) + ->addMethodCall('setBar', [new Reference('bar')]) ->addMethodCall('initialize') ->setConfigurator('sc_configure') ->setPublic(true) ; $container ->register('foo.baz', '%baz_class%') - ->setFactory(array('%baz_class%', 'getInstance')) - ->setConfigurator(array('%baz_class%', 'configureStatic1')) + ->setFactory(['%baz_class%', 'getInstance']) + ->setConfigurator(['%baz_class%', 'configureStatic1']) ->setPublic(true) ; $container ->register('bar', 'Bar\FooClass') - ->setArguments(array('foo', new Reference('foo.baz'), new Parameter('foo_bar'))) - ->setConfigurator(array(new Reference('foo.baz'), 'configure')) + ->setArguments(['foo', new Reference('foo.baz'), new Parameter('foo_bar')]) + ->setConfigurator([new Reference('foo.baz'), 'configure']) ->setPublic(true) ; $container @@ -43,35 +43,35 @@ ->setPublic(true) ; $container->getParameterBag()->clear(); -$container->getParameterBag()->add(array( +$container->getParameterBag()->add([ 'baz_class' => 'BazClass', 'foo_class' => 'Bar\FooClass', 'foo' => 'bar', -)); +]); $container ->register('method_call1', 'Bar\FooClass') ->setFile(realpath(__DIR__.'/../includes/foo.php')) - ->addMethodCall('setBar', array(new Reference('foo'))) - ->addMethodCall('setBar', array(new Reference('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE))) - ->addMethodCall('setBar', array(new Reference('foo3', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))) - ->addMethodCall('setBar', array(new Reference('foobaz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))) - ->addMethodCall('setBar', array(new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")'))) + ->addMethodCall('setBar', [new Reference('foo')]) + ->addMethodCall('setBar', [new Reference('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE)]) + ->addMethodCall('setBar', [new Reference('foo3', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]) + ->addMethodCall('setBar', [new Reference('foobaz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]) + ->addMethodCall('setBar', [new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]) ->setPublic(true) ; $container ->register('foo_with_inline', 'Foo') - ->addMethodCall('setBar', array(new Reference('inlined'))) + ->addMethodCall('setBar', [new Reference('inlined')]) ->setPublic(true) ; $container ->register('inlined', 'Bar') ->setProperty('pub', 'pub') - ->addMethodCall('setBaz', array(new Reference('baz'))) + ->addMethodCall('setBaz', [new Reference('baz')]) ->setPublic(false) ; $container ->register('baz', 'Baz') - ->addMethodCall('setFoo', array(new Reference('foo_with_inline'))) + ->addMethodCall('setFoo', [new Reference('foo_with_inline')]) ->setPublic(true) ; $container @@ -82,11 +82,11 @@ $container ->register('configurator_service', 'ConfClass') ->setPublic(false) - ->addMethodCall('setFoo', array(new Reference('baz'))) + ->addMethodCall('setFoo', [new Reference('baz')]) ; $container ->register('configured_service', 'stdClass') - ->setConfigurator(array(new Reference('configurator_service'), 'configureStdClass')) + ->setConfigurator([new Reference('configurator_service'), 'configureStdClass']) ->setPublic(true) ; $container @@ -96,7 +96,7 @@ ; $container ->register('configured_service_simple', 'stdClass') - ->setConfigurator(array(new Reference('configurator_service_simple'), 'configureStdClass')) + ->setConfigurator([new Reference('configurator_service_simple'), 'configureStdClass']) ->setPublic(true) ; $container @@ -125,18 +125,18 @@ ; $container ->register('factory_service', 'Bar') - ->setFactory(array(new Reference('foo.baz'), 'getInstance')) + ->setFactory([new Reference('foo.baz'), 'getInstance']) ->setPublic(true) ; $container ->register('new_factory_service', 'FooBarBaz') ->setProperty('foo', 'bar') - ->setFactory(array(new Reference('new_factory'), 'getInstance')) + ->setFactory([new Reference('new_factory'), 'getInstance']) ->setPublic(true) ; $container ->register('service_from_static_method', 'Bar\FooClass') - ->setFactory(array('Bar\FooClass', 'getInstance')) + ->setFactory(['Bar\FooClass', 'getInstance']) ->setPublic(true) ; $container @@ -147,17 +147,17 @@ ; $container ->register('factory_service_simple', 'Bar') - ->setFactory(array(new Reference('factory_simple'), 'getInstance')) + ->setFactory([new Reference('factory_simple'), 'getInstance']) ->setPublic(true) ; $container ->register('lazy_context', 'LazyContext') - ->setArguments(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))), new IteratorArgument(array()))) + ->setArguments([new IteratorArgument(['k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')]), new IteratorArgument([])]) ->setPublic(true) ; $container ->register('lazy_context_ignore_invalid_ref', 'LazyContext') - ->setArguments(array(new IteratorArgument(array(new Reference('foo.baz'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))), new IteratorArgument(array()))) + ->setArguments([new IteratorArgument([new Reference('foo.baz'), new Reference('invalid', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]), new IteratorArgument([])]) ->setPublic(true) ; $container diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php index dff937ccdbb7f962d42ab7a051816f08cac2c35d..df136cfa5ddbaa1fe9f42cbd15ff03bf98d8edaa 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php @@ -4,6 +4,7 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls; $public = 'public' === $visibility; $container = new ContainerBuilder(); @@ -14,7 +15,7 @@ ->addArgument(new Reference('bar')); $container->register('bar', BarCircular::class)->setPublic($public) - ->addMethodCall('addFoobar', array(new Reference('foobar'))); + ->addMethodCall('addFoobar', [new Reference('foobar')]); $container->register('foobar', FoobarCircular::class)->setPublic($public) ->addArgument(new Reference('foo')); @@ -25,7 +26,7 @@ ->addArgument(new Reference('bar2')); $container->register('bar2', BarCircular::class)->setPublic(!$public) - ->addMethodCall('addFoobar', array(new Reference('foobar2'))); + ->addMethodCall('addFoobar', [new Reference('foobar2')]); $container->register('foobar2', FoobarCircular::class)->setPublic($public) ->addArgument(new Reference('foo2')); @@ -33,7 +34,7 @@ // simple inline setter with internal reference $container->register('bar3', BarCircular::class)->setPublic(true) - ->addMethodCall('addFoobar', array(new Reference('foobar3'), new Reference('foobar3'))); + ->addMethodCall('addFoobar', [new Reference('foobar3'), new Reference('foobar3')]); $container->register('foobar3', FoobarCircular::class)->setPublic($public); @@ -55,4 +56,93 @@ ->addArgument(new Reference('foo5')) ->setProperty('foo', new Reference('foo5')); +// doctrine-like event system + some extra + +$container->register('manager', 'stdClass')->setPublic(true) + ->addArgument(new Reference('connection')); + +$container->register('logger', 'stdClass')->setPublic(true) + ->addArgument(new Reference('connection')) + ->setProperty('handler', (new Definition('stdClass'))->addArgument(new Reference('manager'))) +; +$container->register('connection', 'stdClass')->setPublic(true) + ->addArgument(new Reference('dispatcher')) + ->addArgument(new Reference('config')); + +$container->register('config', 'stdClass')->setPublic(false) + ->setProperty('logger', new Reference('logger')); + +$container->register('dispatcher', 'stdClass')->setPublic($public) + ->setLazy($public) + ->setProperty('subscriber', new Reference('subscriber')); + +$container->register('subscriber', 'stdClass')->setPublic(true) + ->addArgument(new Reference('manager')); + +// doctrine-like event system + some extra (bis) + +$container->register('manager2', 'stdClass')->setPublic(true) + ->addArgument(new Reference('connection2')); + +$container->register('logger2', 'stdClass')->setPublic(false) + ->addArgument(new Reference('connection2')) + ->setProperty('handler2', (new Definition('stdClass'))->addArgument(new Reference('manager2'))) +; +$container->register('connection2', 'stdClass')->setPublic(true) + ->addArgument(new Reference('dispatcher2')) + ->addArgument(new Reference('config2')); + +$container->register('config2', 'stdClass')->setPublic(false) + ->setProperty('logger2', new Reference('logger2')); + +$container->register('dispatcher2', 'stdClass')->setPublic($public) + ->setLazy($public) + ->setProperty('subscriber2', new Reference('subscriber2')); + +$container->register('subscriber2', 'stdClass')->setPublic(false) + ->addArgument(new Reference('manager2')); + +// private service involved in a loop + +$container->register('foo6', 'stdClass') + ->setPublic(true) + ->setProperty('bar6', new Reference('bar6')); + +$container->register('bar6', 'stdClass') + ->setPublic(false) + ->addArgument(new Reference('foo6')); + +$container->register('baz6', 'stdClass') + ->setPublic(true) + ->setProperty('bar6', new Reference('bar6')); + +// provided by Christian Schiffler + +$container + ->register('root', 'stdClass') + ->setArguments([new Reference('level2'), new Reference('multiuse1')]) + ->setPublic(true); + +$container + ->register('level2', FooForCircularWithAddCalls::class) + ->addMethodCall('call', [new Reference('level3')]); + +$container->register('multiuse1', 'stdClass'); + +$container + ->register('level3', 'stdClass') + ->addArgument(new Reference('level4')); + +$container + ->register('level4', 'stdClass') + ->setArguments([new Reference('multiuse1'), new Reference('level5')]); + +$container + ->register('level5', 'stdClass') + ->addArgument(new Reference('level6')); + +$container + ->register('level6', FooForCircularWithAddCalls::class) + ->addMethodCall('call', [new Reference('level5')]); + return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_env_in_id.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_env_in_id.php index 4699f41011a419809189902252488c7b00d466c2..1e851cf016c2b09c0a307a12bd8b3dc4f5186595 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_env_in_id.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_env_in_id.php @@ -11,7 +11,7 @@ $container->register('foo', 'stdClass')->setPublic(true) ->addArgument(new Reference('bar_%env(BAR)%')) - ->addArgument(array('baz_%env(BAR)%' => new Reference('baz_%env(BAR)%'))); + ->addArgument(['baz_%env(BAR)%' => new Reference('baz_%env(BAR)%')]); $container->register('bar', 'stdClass')->setPublic(true) ->addArgument(new Reference('bar_%env(BAR)%')); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_uninitialized_ref.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_uninitialized_ref.php index 7aeefb4d5227f0dee5a71aca7bc02a250e5829cd..36c05c3fa33ea20ddf9b0564a251b6d2ecfa7300 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_uninitialized_ref.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_uninitialized_ref.php @@ -33,16 +33,16 @@ ->setProperty('foo1', new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)) ->setProperty('foo2', new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)) ->setProperty('foo3', new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)) - ->setProperty('closures', array( + ->setProperty('closures', [ new ServiceClosureArgument(new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)), new ServiceClosureArgument(new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)), new ServiceClosureArgument(new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)), - )) - ->setProperty('iter', new IteratorArgument(array( + ]) + ->setProperty('iter', new IteratorArgument([ 'foo1' => new Reference('foo1', $container::IGNORE_ON_UNINITIALIZED_REFERENCE), 'foo2' => new Reference('foo2', $container::IGNORE_ON_UNINITIALIZED_REFERENCE), 'foo3' => new Reference('foo3', $container::IGNORE_ON_UNINITIALIZED_REFERENCE), - ))) + ])) ->setPublic(true) ; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/graphviz/services_inline.dot b/vendor/symfony/dependency-injection/Tests/Fixtures/graphviz/services_inline.dot new file mode 100644 index 0000000000000000000000000000000000000000..b430b186d70e8a4e547e16ca03b2f37f05266758 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/graphviz/services_inline.dot @@ -0,0 +1,10 @@ +digraph sc { + ratio="compress" + node [fontsize="11" fontname="Arial" shape="record"]; + edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"]; + + node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_foo [label="foo\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_bar [label="bar\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_foo -> node_bar [label="" style="filled"]; +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectExtension.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectExtension.php index ba07d7c44cbd67fc9dabe355d922ea83672b1796..2198b19c4d627f52d7244a9cd013f02c5e59ede2 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectExtension.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectExtension.php @@ -14,7 +14,7 @@ public function load(array $configs, ContainerBuilder $configuration) if ($configs) { $config = call_user_func_array('array_merge', $configs); } else { - $config = array(); + $config = []; } $configuration->setDefinition('project.service.bar', new Definition('FooClass')); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/foo.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/foo.php index bcb4e20a94afdcb339d266e61316a503909eb4c5..20bc928b9728c798ac38ca869496a7e580a6dcb7 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/foo.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/foo.php @@ -11,14 +11,14 @@ class FooClass public $initialized = false; public $configured = false; public $called = false; - public $arguments = array(); + public $arguments = []; - public function __construct($arguments = array()) + public function __construct($arguments = []) { $this->arguments = $arguments; } - public static function getInstance($arguments = array()) + public static function getInstance($arguments = []) { $obj = new self($arguments); $obj->called = true; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/ini/types.ini b/vendor/symfony/dependency-injection/Tests/Fixtures/ini/types.ini index 19cc5b3b31e425e01dfe027caa91e27c6ebe4091..75840907d277ab432f6111bbe244cc150f525537 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/ini/types.ini +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/ini/types.ini @@ -11,9 +11,10 @@ constant = PHP_VERSION 12 = 12 12_string = '12' + 12_quoted_number = "12" 12_comment = 12 ; comment 12_string_comment = '12' ; comment - 12_string_comment_again = "12" ; comment + 12_quoted_number_comment = "12" ; comment -12 = -12 0 = 0 1 = 1 diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php index 0a443f3a7965c669df52261629878939c7aa12c0..7495110dd877e0d77fc37681760115cd41d58821 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_constructor_without_arguments.php @@ -19,24 +19,24 @@ class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithoutArgumentsContainer { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { parent::__construct(); $this->parameterBag = null; - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php index dd9ed9cbb3141309df3652a6c23f843cb90ccdbd..eb573f9baecfdd450c283377c79b1243156d5659 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_mandatory_constructor_arguments.php @@ -19,21 +19,21 @@ class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithMandatoryArgumentsContainer { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php index 6bf3c90613702b02f18a27dd3bee0117160b5aec..d322f80a0f19bc328974a2a3d57d79fd03403cc3 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_with_optional_constructor_arguments.php @@ -19,24 +19,24 @@ class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithOptionalArgumentsContainer { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { parent::__construct(); $this->parameterBag = null; - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_without_constructor.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_without_constructor.php index 4cf1ae40b44df0e7ba2fd2c22e4577d0e3cb3de0..68bc1ef8beb1d013d1e334ca0f7d29673b265e12 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_without_constructor.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/custom_container_class_without_constructor.php @@ -19,21 +19,21 @@ class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\NoConstructorContainer { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1-1.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1-1.php index bdd0d101ab8d6b9e50a8adc8e2cce0d56b683e9a..ed085a5ef91a4620d04bfed2f1d9a28988fe9c9f 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1-1.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1-1.php @@ -19,21 +19,21 @@ class Container extends \Symfony\Component\DependencyInjection\Dump\AbstractContainer { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1.php index 85830af78c1dbb09b561b180530b41a7c9367d73..9733ba9c6c82e99003ec158760ad5aeb2888432d 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services1.php @@ -17,21 +17,21 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php index a7b43ceefbde118babc61d97817343c658618d1c..1b7443352df9ef8e0edcbdff7eba0a690d51db34 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php @@ -17,26 +17,26 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'test' => 'getTestService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -63,7 +63,7 @@ public function isFrozen() */ protected function getTestService() { - return $this->services['test'] = new \stdClass(array('only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end', 'new line' => 'string with '."\n".'new line')); + return $this->services['test'] = new \stdClass(['only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end', 'new line' => 'string with '."\n".'new line']); } public function getParameter($name) @@ -109,13 +109,13 @@ public function getParameterBag() return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -126,7 +126,7 @@ private function getDynamicParameter($name) throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -149,9 +149,9 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return array( + return [ 'empty_value' => '', 'some_string' => '-', - ); + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php index 9947d36ac54842da3b5186ce53fc5ecce053de58..ba564b82f4a5c05261729e686a04a0fdaf063990 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php @@ -17,7 +17,7 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { @@ -27,20 +27,20 @@ public function __construct() } $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'test' => 'getTestService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -67,7 +67,7 @@ public function isFrozen() */ protected function getTestService() { - return $this->services['test'] = new \stdClass(('wiz'.$this->targetDirs[1]), array(('wiz'.$this->targetDirs[1]) => ($this->targetDirs[2].'/'))); + return $this->services['test'] = new \stdClass(('wiz'.$this->targetDirs[1]), [('wiz'.$this->targetDirs[1]) => ($this->targetDirs[2].'/')]); } public function getParameter($name) @@ -113,16 +113,16 @@ public function getParameterBag() return $this->parameterBag; } - private $loadedDynamicParameters = array( + private $loadedDynamicParameters = [ 'foo' => false, 'buz' => false, - ); - private $dynamicParameters = array(); + ]; + private $dynamicParameters = []; /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -140,7 +140,7 @@ private function getDynamicParameter($name) return $this->dynamicParameters[$name] = $value; } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -163,9 +163,9 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return array( + return [ 'bar' => __DIR__, 'baz' => (__DIR__.'/PhpDumperTest.php'), - ); + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services13.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services13.php index 04705a29e4692124d1fb972dea0c089c2254e38c..40ce06decaeffa0af5a7f5f5cf5bc6e5b3fe801c 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services13.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services13.php @@ -17,25 +17,25 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'foo' => true, - ); + ]; } public function compile() diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php index 667dd852a0fe0976eebad19ab2e41bf9f29083f7..664f4dd907436fa740fcf61c971edc82f17d471f 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php @@ -17,25 +17,27 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->parameters = $this->getDefaultParameters(); + + $this->services = []; + $this->methodMap = [ 'service_from_anonymous_factory' => 'getServiceFromAnonymousFactoryService', 'service_with_method_call_and_factory' => 'getServiceWithMethodCallAndFactoryService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -58,11 +60,11 @@ public function isFrozen() /** * Gets the public 'service_from_anonymous_factory' shared service. * - * @return \Bar\FooClass + * @return object A %env(FOO)% instance */ protected function getServiceFromAnonymousFactoryService() { - return $this->services['service_from_anonymous_factory'] = (new \Bar\FooClass())->getInstance(); + return $this->services['service_from_anonymous_factory'] = (new ${($_ = $this->getEnv('FOO')) && false ?: "_"}())->getInstance(); } /** @@ -78,4 +80,102 @@ protected function getServiceWithMethodCallAndFactoryService() return $instance; } + + public function getParameter($name) + { + $name = (string) $name; + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + $name = $this->normalizeParameterName($name); + + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); + } + } + if (isset($this->loadedDynamicParameters[$name])) { + return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); + } + + return $this->parameters[$name]; + } + + public function hasParameter($name) + { + $name = (string) $name; + $name = $this->normalizeParameterName($name); + + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); + } + + public function setParameter($name, $value) + { + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); + } + + public function getParameterBag() + { + if (null === $this->parameterBag) { + $parameters = $this->parameters; + foreach ($this->loadedDynamicParameters as $name => $loaded) { + $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); + } + $this->parameterBag = new FrozenParameterBag($parameters); + } + + return $this->parameterBag; + } + + private $loadedDynamicParameters = [ + 'foo' => false, + ]; + private $dynamicParameters = []; + + /** + * Computes a dynamic parameter. + * + * @param string $name The name of the dynamic parameter to load + * + * @return mixed The value of the dynamic parameter + * + * @throws InvalidArgumentException When the dynamic parameter does not exist + */ + private function getDynamicParameter($name) + { + switch ($name) { + case 'foo': $value = $this->getEnv('FOO'); break; + default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); + } + $this->loadedDynamicParameters[$name] = true; + + return $this->dynamicParameters[$name] = $value; + } + + private $normalizedParameterNames = [ + 'env(foo)' => 'env(FOO)', + ]; + + private function normalizeParameterName($name) + { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { + $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; + if ((string) $name !== $normalizedName) { + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + } + } else { + $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; + } + + return $normalizedName; + } + + /** + * Gets the default parameters. + * + * @return array An array of the default parameters + */ + protected function getDefaultParameters() + { + return [ + 'env(FOO)' => 'Bar\\FaooClass', + ]; + } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services24.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services24.php index 1be6319eef0797d4aeceae5ae91d01aa5731f7b2..b277ddd1c2d2219bbafe7db8e565622641618cc7 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services24.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services24.php @@ -17,24 +17,24 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'foo' => 'getFooService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php index 16b99007aeca38999dc53c898e6de5064d5c2735..595d12ba608174f761edf154e197a594439e8737 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php @@ -17,7 +17,7 @@ class Symfony_DI_PhpDumper_Test_EnvParameters extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { @@ -27,21 +27,21 @@ public function __construct() } $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'test' => 'getTestService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -126,19 +126,19 @@ public function getParameterBag() return $this->parameterBag; } - private $loadedDynamicParameters = array( + private $loadedDynamicParameters = [ 'bar' => false, 'baz' => false, 'json' => false, 'db_dsn' => false, 'env(json_file)' => false, - ); - private $dynamicParameters = array(); + ]; + private $dynamicParameters = []; /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -159,10 +159,10 @@ private function getDynamicParameter($name) return $this->dynamicParameters[$name] = $value; } - private $normalizedParameterNames = array( + private $normalizedParameterNames = [ 'env(foo)' => 'env(FOO)', 'env(db)' => 'env(DB)', - ); + ]; private function normalizeParameterName($name) { @@ -185,10 +185,10 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return array( + return [ 'project_dir' => '/foo/bar', 'env(FOO)' => 'foo', 'env(DB)' => 'sqlite://%project_dir%/var/data.db', - ); + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services33.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services33.php index 3e308c1d4d36786889ac9d163fb3e8ef7cdf42b7..98e34bc9b1f5e86a016b4a684581a77ee27349a9 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services33.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services33.php @@ -17,29 +17,29 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'bar\\foo' => 'Bar\\Foo', 'foo\\foo' => 'Foo\\Foo', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'Bar\\Foo' => 'getFooService', 'Foo\\Foo' => 'getFoo2Service', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php index 56e2a98cc5e0ff9bcb58a243df722914d082c866..cc78c196acb805fbfc0c79c888540df2fbfff790 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php @@ -17,23 +17,23 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -96,13 +96,13 @@ public function getParameterBag() return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -113,7 +113,7 @@ private function getDynamicParameter($name) throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -136,12 +136,12 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return array( + return [ 'foo' => 'bar', 'baz' => 'bar', 'bar' => 'foo is %foo bar', 'escape' => '@escapeme', - 'values' => array( + 'values' => [ 0 => true, 1 => false, 2 => NULL, @@ -150,7 +150,7 @@ protected function getDefaultParameters() 5 => 'true', 6 => 'false', 7 => 'null', - ), - ); + ], + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9.php index ad316b23c6ee9b40a0a3f1b56d4e61a86765d698..0e09ec624dbe068401c6ef74e5acd73e6cbf90a2 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9.php @@ -17,19 +17,19 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { parent::__construct(new ParameterBag($this->getDefaultParameters())); - $this->normalizedIds = array( + $this->normalizedIds = [ 'psr\\container\\containerinterface' => 'Psr\\Container\\ContainerInterface', 'symfony\\component\\dependencyinjection\\containerinterface' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface', - ); - $this->syntheticIds = array( + ]; + $this->syntheticIds = [ 'request' => true, - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'bar' => 'getBarService', 'baz' => 'getBazService', 'configurator_service' => 'getConfiguratorServiceService', @@ -56,21 +56,21 @@ public function __construct() 'service_from_static_method' => 'getServiceFromStaticMethodService', 'tagged_iterator' => 'getTaggedIteratorService', 'tagged_iterator_foo' => 'getTaggedIteratorFooService', - ); - $this->privates = array( + ]; + $this->privates = [ 'configurator_service' => true, 'configurator_service_simple' => true, 'factory_simple' => true, 'inlined' => true, 'new_factory' => true, 'tagged_iterator_foo' => true, - ); - $this->aliases = array( + ]; + $this->aliases = [ 'Psr\\Container\\ContainerInterface' => 'service_container', 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => 'service_container', 'alias_for_alias' => 'foo', 'alias_for_foo' => 'foo', - ); + ]; } /** @@ -126,7 +126,7 @@ protected function getConfiguredServiceSimpleService() { $this->services['configured_service_simple'] = $instance = new \stdClass(); - ${($_ = isset($this->services['configurator_service_simple']) ? $this->services['configurator_service_simple'] : $this->services['configurator_service_simple'] = new \ConfClass('bar')) && false ?: '_'}->configureStdClass($instance); + ${($_ = isset($this->services['configurator_service_simple']) ? $this->services['configurator_service_simple'] : ($this->services['configurator_service_simple'] = new \ConfClass('bar'))) && false ?: '_'}->configureStdClass($instance); return $instance; } @@ -204,11 +204,11 @@ protected function getFooService() { $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}; - $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')), true, $this); + $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, [$this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')], true, $this); $instance->foo = 'bar'; $instance->moo = $a; - $instance->qux = array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')); + $instance->qux = [$this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')]; $instance->setBar(${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}); $instance->initialize(); sc_configure($instance); @@ -223,9 +223,9 @@ protected function getFooService() */ protected function getFoo_BazService() { - $this->services['foo.baz'] = $instance = \call_user_func(array($this->getParameter('baz_class'), 'getInstance')); + $this->services['foo.baz'] = $instance = \call_user_func([$this->getParameter('baz_class'), 'getInstance']); - \call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance); + \call_user_func([$this->getParameter('baz_class'), 'configureStatic1'], $instance); return $instance; } @@ -434,10 +434,10 @@ protected function getTaggedIteratorFooService() */ protected function getDefaultParameters() { - return array( + return [ 'baz_class' => 'BazClass', 'foo_class' => 'Bar\\FooClass', 'foo' => 'bar', - ); + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_as_files.txt b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_as_files.txt index fa89e04949bde284aa5147f83e64d3d34b992133..2dc415ced49717ea50f6474749255bfa1a5e8b91 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_as_files.txt +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_as_files.txt @@ -2,7 +2,7 @@ Array ( [Container%s/removed-ids.php] => <?php -return array( +return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'configurator_service' => true, @@ -13,7 +13,7 @@ return array( 'inlined' => true, 'new_factory' => true, 'tagged_iterator_foo' => true, -); +]; [Container%s/getBazService.php] => <?php @@ -124,11 +124,11 @@ use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->load('getFoo_BazService.php')) && false ?: '_'}; -$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this); +$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, ['bar' => 'foo is bar', 'foobar' => 'bar'], true, $this); $instance->foo = 'bar'; $instance->moo = $a; -$instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar'); +$instance->qux = ['bar' => 'foo is bar', 'foobar' => 'bar']; $instance->setBar(${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}); $instance->initialize(); sc_configure($instance); @@ -158,7 +158,6 @@ use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; $this->services['foo_with_inline'] = $instance = new \Foo(); $a = new \Bar(); - $a->pub = 'pub'; $a->setBaz(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->load('getBazService.php')) && false ?: '_'}); @@ -244,7 +243,7 @@ use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; return $this->services['tagged_iterator'] = new \Bar(new RewindableGenerator(function () { yield 0 => ${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->load('getFooService.php')) && false ?: '_'}; - yield 1 => ${($_ = isset($this->services['tagged_iterator_foo']) ? $this->services['tagged_iterator_foo'] : $this->services['tagged_iterator_foo'] = new \Bar()) && false ?: '_'}; + yield 1 => ${($_ = isset($this->services['tagged_iterator_foo']) ? $this->services['tagged_iterator_foo'] : ($this->services['tagged_iterator_foo'] = new \Bar())) && false ?: '_'}; }, 2)); [Container%s/getTaggedIteratorFooService.php] => <?php @@ -279,9 +278,9 @@ class ProjectServiceContainer extends Container private $buildParameters; private $containerDir; private $parameters; - private $targetDirs = array(); + private $targetDirs = []; - public function __construct(array $buildParameters = array(), $containerDir = __DIR__) + public function __construct(array $buildParameters = [], $containerDir = __DIR__) { $dir = $this->targetDirs[0] = \dirname($containerDir); for ($i = 1; $i <= 5; ++$i) { @@ -291,15 +290,15 @@ class ProjectServiceContainer extends Container $this->containerDir = $containerDir; $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->syntheticIds = array( + $this->services = []; + $this->syntheticIds = [ 'request' => true, - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'bar' => 'getBarService', 'foo_bar' => 'getFooBarService', - ); - $this->fileMap = array( + ]; + $this->fileMap = [ 'baz' => 'getBazService.php', 'configured_service' => 'getConfiguredServiceService.php', 'configured_service_simple' => 'getConfiguredServiceSimpleService.php', @@ -319,16 +318,16 @@ class ProjectServiceContainer extends Container 'service_from_static_method' => 'getServiceFromStaticMethodService.php', 'tagged_iterator' => 'getTaggedIteratorService.php', 'tagged_iterator_foo' => 'getTaggedIteratorFooService.php', - ); - $this->privates = array( + ]; + $this->privates = [ 'factory_simple' => true, 'tagged_iterator_foo' => true, - ); - $this->aliases = array( + ]; + $this->aliases = [ 'alias_for_alias' => 'foo', 'alias_for_foo' => 'foo', 'decorated' => 'decorator_service_with_name', - ); + ]; } public function getRemovedIds() @@ -436,13 +435,13 @@ class ProjectServiceContainer extends Container return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -453,7 +452,7 @@ class ProjectServiceContainer extends Container throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -476,11 +475,11 @@ class ProjectServiceContainer extends Container */ protected function getDefaultParameters() { - return array( + return [ 'baz_class' => 'BazClass', 'foo_class' => 'Bar\\FooClass', 'foo' => 'bar', - ); + ]; } } @@ -500,10 +499,10 @@ if (!\class_exists(ProjectServiceContainer::class, false)) { \class_alias(\Container%s\ProjectServiceContainer::class, ProjectServiceContainer::class, false); } -return new \Container%s\ProjectServiceContainer(array( +return new \Container%s\ProjectServiceContainer([ 'container.build_hash' => '%s', 'container.build_id' => '%s', 'container.build_time' => %d, -), __DIR__.\DIRECTORY_SEPARATOR.'Container%s'); +], __DIR__.\DIRECTORY_SEPARATOR.'Container%s'); ) diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php index 1af126fa3c961b4ae4cb523fab741f28d2e7c66f..02e0680da0ef35ad266e03e0f62300d909bb9ba0 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php @@ -17,17 +17,17 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->syntheticIds = array( + $this->services = []; + $this->syntheticIds = [ 'request' => true, - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'bar' => 'getBarService', 'baz' => 'getBazService', 'configured_service' => 'getConfiguredServiceService', @@ -49,21 +49,21 @@ public function __construct() 'service_from_static_method' => 'getServiceFromStaticMethodService', 'tagged_iterator' => 'getTaggedIteratorService', 'tagged_iterator_foo' => 'getTaggedIteratorFooService', - ); - $this->privates = array( + ]; + $this->privates = [ 'factory_simple' => true, 'tagged_iterator_foo' => true, - ); - $this->aliases = array( + ]; + $this->aliases = [ 'alias_for_alias' => 'foo', 'alias_for_foo' => 'foo', 'decorated' => 'decorator_service_with_name', - ); + ]; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'configurator_service' => true, @@ -74,7 +74,7 @@ public function getRemovedIds() 'inlined' => true, 'new_factory' => true, 'tagged_iterator_foo' => true, - ); + ]; } public function compile() @@ -218,11 +218,11 @@ protected function getFooService() { $a = ${($_ = isset($this->services['foo.baz']) ? $this->services['foo.baz'] : $this->getFoo_BazService()) && false ?: '_'}; - $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this); + $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, ['bar' => 'foo is bar', 'foobar' => 'bar'], true, $this); $instance->foo = 'bar'; $instance->moo = $a; - $instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar'); + $instance->qux = ['bar' => 'foo is bar', 'foobar' => 'bar']; $instance->setBar(${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}); $instance->initialize(); sc_configure($instance); @@ -264,7 +264,6 @@ protected function getFooWithInlineService() $this->services['foo_with_inline'] = $instance = new \Foo(); $a = new \Bar(); - $a->pub = 'pub'; $a->setBaz(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && false ?: '_'}); @@ -356,7 +355,7 @@ protected function getTaggedIteratorService() { return $this->services['tagged_iterator'] = new \Bar(new RewindableGenerator(function () { yield 0 => ${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}; - yield 1 => ${($_ = isset($this->services['tagged_iterator_foo']) ? $this->services['tagged_iterator_foo'] : $this->services['tagged_iterator_foo'] = new \Bar()) && false ?: '_'}; + yield 1 => ${($_ = isset($this->services['tagged_iterator_foo']) ? $this->services['tagged_iterator_foo'] : ($this->services['tagged_iterator_foo'] = new \Bar())) && false ?: '_'}; }, 2)); } @@ -427,13 +426,13 @@ public function getParameterBag() return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -444,7 +443,7 @@ private function getDynamicParameter($name) throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -467,10 +466,10 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return array( + return [ 'baz_class' => 'BazClass', 'foo_class' => 'Bar\\FooClass', 'foo' => 'bar', - ); + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_adawson.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_adawson.php new file mode 100644 index 0000000000000000000000000000000000000000..f222fc6e606f385590b6d706c131c4ada41e5f73 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_adawson.php @@ -0,0 +1,190 @@ +<?php + +use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\LogicException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; + +/** + * This class has been auto-generated + * by the Symfony Dependency Injection Component. + * + * @final since Symfony 3.3 + */ +class ProjectServiceContainer extends Container +{ + private $parameters; + private $targetDirs = []; + + public function __construct() + { + $this->services = []; + $this->normalizedIds = [ + 'app\\bus' => 'App\\Bus', + 'app\\db' => 'App\\Db', + 'app\\handler1' => 'App\\Handler1', + 'app\\handler2' => 'App\\Handler2', + 'app\\processor' => 'App\\Processor', + 'app\\registry' => 'App\\Registry', + 'app\\schema' => 'App\\Schema', + ]; + $this->methodMap = [ + 'App\\Bus' => 'getBusService', + 'App\\Db' => 'getDbService', + 'App\\Handler1' => 'getHandler1Service', + 'App\\Handler2' => 'getHandler2Service', + 'App\\Processor' => 'getProcessorService', + 'App\\Registry' => 'getRegistryService', + 'App\\Schema' => 'getSchemaService', + ]; + $this->privates = [ + 'App\\Handler1' => true, + 'App\\Handler2' => true, + 'App\\Processor' => true, + 'App\\Registry' => true, + 'App\\Schema' => true, + ]; + + $this->aliases = []; + } + + public function getRemovedIds() + { + return [ + 'App\\Handler1' => true, + 'App\\Handler2' => true, + 'App\\Processor' => true, + 'App\\Registry' => true, + 'App\\Schema' => true, + 'Psr\\Container\\ContainerInterface' => true, + 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, + ]; + } + + public function compile() + { + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + public function isCompiled() + { + return true; + } + + public function isFrozen() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + + return true; + } + + /** + * Gets the public 'App\Bus' shared service. + * + * @return \App\Bus + */ + protected function getBusService() + { + $this->services['App\Bus'] = $instance = new \App\Bus(${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}); + + $instance->handler1 = ${($_ = isset($this->services['App\Handler1']) ? $this->services['App\Handler1'] : $this->getHandler1Service()) && false ?: '_'}; + $instance->handler2 = ${($_ = isset($this->services['App\Handler2']) ? $this->services['App\Handler2'] : $this->getHandler2Service()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'App\Db' shared service. + * + * @return \App\Db + */ + protected function getDbService() + { + $this->services['App\Db'] = $instance = new \App\Db(); + + $instance->schema = ${($_ = isset($this->services['App\Schema']) ? $this->services['App\Schema'] : $this->getSchemaService()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the private 'App\Handler1' shared service. + * + * @return \App\Handler1 + */ + protected function getHandler1Service() + { + $a = ${($_ = isset($this->services['App\Processor']) ? $this->services['App\Processor'] : $this->getProcessorService()) && false ?: '_'}; + + if (isset($this->services['App\Handler1'])) { + return $this->services['App\Handler1']; + } + + return $this->services['App\Handler1'] = new \App\Handler1(${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}, ${($_ = isset($this->services['App\Schema']) ? $this->services['App\Schema'] : $this->getSchemaService()) && false ?: '_'}, $a); + } + + /** + * Gets the private 'App\Handler2' shared service. + * + * @return \App\Handler2 + */ + protected function getHandler2Service() + { + $a = ${($_ = isset($this->services['App\Processor']) ? $this->services['App\Processor'] : $this->getProcessorService()) && false ?: '_'}; + + if (isset($this->services['App\Handler2'])) { + return $this->services['App\Handler2']; + } + + return $this->services['App\Handler2'] = new \App\Handler2(${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}, ${($_ = isset($this->services['App\Schema']) ? $this->services['App\Schema'] : $this->getSchemaService()) && false ?: '_'}, $a); + } + + /** + * Gets the private 'App\Processor' shared service. + * + * @return \App\Processor + */ + protected function getProcessorService() + { + $a = ${($_ = isset($this->services['App\Registry']) ? $this->services['App\Registry'] : $this->getRegistryService()) && false ?: '_'}; + + if (isset($this->services['App\Processor'])) { + return $this->services['App\Processor']; + } + + return $this->services['App\Processor'] = new \App\Processor($a, ${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}); + } + + /** + * Gets the private 'App\Registry' shared service. + * + * @return \App\Registry + */ + protected function getRegistryService() + { + $this->services['App\Registry'] = $instance = new \App\Registry(); + + $instance->processor = [0 => ${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}, 1 => ${($_ = isset($this->services['App\Bus']) ? $this->services['App\Bus'] : $this->getBusService()) && false ?: '_'}]; + + return $instance; + } + + /** + * Gets the private 'App\Schema' shared service. + * + * @return \App\Schema + */ + protected function getSchemaService() + { + $a = ${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}; + + if (isset($this->services['App\Schema'])) { + return $this->services['App\Schema']; + } + + return $this->services['App\Schema'] = new \App\Schema($a); + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php index 45fb2432c33c9127a9cfe43d808a222610db2941..5345aa3b308a84f2993c996ac2cc101919b1fb6e 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php @@ -17,35 +17,73 @@ class Symfony_DI_PhpDumper_Test_Almost_Circular_Private extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar2' => 'getBar2Service', 'bar3' => 'getBar3Service', + 'bar6' => 'getBar6Service', + 'baz6' => 'getBaz6Service', + 'connection' => 'getConnectionService', + 'connection2' => 'getConnection2Service', 'foo' => 'getFooService', 'foo2' => 'getFoo2Service', 'foo5' => 'getFoo5Service', + 'foo6' => 'getFoo6Service', 'foobar4' => 'getFoobar4Service', - ); - - $this->aliases = array(); + 'level2' => 'getLevel2Service', + 'level3' => 'getLevel3Service', + 'level4' => 'getLevel4Service', + 'level5' => 'getLevel5Service', + 'level6' => 'getLevel6Service', + 'logger' => 'getLoggerService', + 'manager' => 'getManagerService', + 'manager2' => 'getManager2Service', + 'multiuse1' => 'getMultiuse1Service', + 'root' => 'getRootService', + 'subscriber' => 'getSubscriberService', + ]; + $this->privates = [ + 'bar6' => true, + 'level2' => true, + 'level3' => true, + 'level4' => true, + 'level5' => true, + 'level6' => true, + 'multiuse1' => true, + ]; + + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar' => true, 'bar5' => true, + 'bar6' => true, + 'config' => true, + 'config2' => true, + 'dispatcher' => true, + 'dispatcher2' => true, 'foo4' => true, 'foobar' => true, 'foobar2' => true, 'foobar3' => true, - ); + 'level2' => true, + 'level3' => true, + 'level4' => true, + 'level5' => true, + 'level6' => true, + 'logger2' => true, + 'multiuse1' => true, + 'subscriber2' => true, + ]; } public function compile() @@ -95,6 +133,66 @@ protected function getBar3Service() return $instance; } + /** + * Gets the public 'baz6' shared service. + * + * @return \stdClass + */ + protected function getBaz6Service() + { + $this->services['baz6'] = $instance = new \stdClass(); + + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'connection' shared service. + * + * @return \stdClass + */ + protected function getConnectionService() + { + $a = new \stdClass(); + + $b = new \stdClass(); + + $this->services['connection'] = $instance = new \stdClass($a, $b); + + $b->logger = ${($_ = isset($this->services['logger']) ? $this->services['logger'] : $this->getLoggerService()) && false ?: '_'}; + + $a->subscriber = ${($_ = isset($this->services['subscriber']) ? $this->services['subscriber'] : $this->getSubscriberService()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'connection2' shared service. + * + * @return \stdClass + */ + protected function getConnection2Service() + { + $a = new \stdClass(); + + $b = new \stdClass(); + + $this->services['connection2'] = $instance = new \stdClass($a, $b); + + $c = new \stdClass($instance); + + $d = ${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && false ?: '_'}; + + $c->handler2 = new \stdClass($d); + + $b->logger2 = $c; + + $a->subscriber2 = new \stdClass($d); + + return $instance; + } + /** * Gets the public 'foo' shared service. * @@ -136,8 +234,7 @@ protected function getFoo5Service() { $this->services['foo5'] = $instance = new \stdClass(); - $a = new \stdClass(${($_ = isset($this->services['foo5']) ? $this->services['foo5'] : $this->getFoo5Service()) && false ?: '_'}); - + $a = new \stdClass($instance); $a->foo = $instance; $instance->bar = $a; @@ -145,6 +242,20 @@ protected function getFoo5Service() return $instance; } + /** + * Gets the public 'foo6' shared service. + * + * @return \stdClass + */ + protected function getFoo6Service() + { + $this->services['foo6'] = $instance = new \stdClass(); + + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; + + return $instance; + } + /** * Gets the public 'foobar4' shared service. * @@ -160,4 +271,172 @@ protected function getFoobar4Service() return $instance; } + + /** + * Gets the public 'logger' shared service. + * + * @return \stdClass + */ + protected function getLoggerService() + { + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; + + if (isset($this->services['logger'])) { + return $this->services['logger']; + } + + $this->services['logger'] = $instance = new \stdClass($a); + + $instance->handler = new \stdClass(${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the public 'manager' shared service. + * + * @return \stdClass + */ + protected function getManagerService() + { + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; + + if (isset($this->services['manager'])) { + return $this->services['manager']; + } + + return $this->services['manager'] = new \stdClass($a); + } + + /** + * Gets the public 'manager2' shared service. + * + * @return \stdClass + */ + protected function getManager2Service() + { + $a = ${($_ = isset($this->services['connection2']) ? $this->services['connection2'] : $this->getConnection2Service()) && false ?: '_'}; + + if (isset($this->services['manager2'])) { + return $this->services['manager2']; + } + + return $this->services['manager2'] = new \stdClass($a); + } + + /** + * Gets the public 'root' shared service. + * + * @return \stdClass + */ + protected function getRootService() + { + return $this->services['root'] = new \stdClass(${($_ = isset($this->services['level2']) ? $this->services['level2'] : $this->getLevel2Service()) && false ?: '_'}, ${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new \stdClass())) && false ?: '_'}); + } + + /** + * Gets the public 'subscriber' shared service. + * + * @return \stdClass + */ + protected function getSubscriberService() + { + $a = ${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}; + + if (isset($this->services['subscriber'])) { + return $this->services['subscriber']; + } + + return $this->services['subscriber'] = new \stdClass($a); + } + + /** + * Gets the private 'bar6' shared service. + * + * @return \stdClass + */ + protected function getBar6Service() + { + $a = ${($_ = isset($this->services['foo6']) ? $this->services['foo6'] : $this->getFoo6Service()) && false ?: '_'}; + + if (isset($this->services['bar6'])) { + return $this->services['bar6']; + } + + return $this->services['bar6'] = new \stdClass($a); + } + + /** + * Gets the private 'level2' shared service. + * + * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls + */ + protected function getLevel2Service() + { + $this->services['level2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); + + $instance->call(${($_ = isset($this->services['level3']) ? $this->services['level3'] : $this->getLevel3Service()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the private 'level3' shared service. + * + * @return \stdClass + */ + protected function getLevel3Service() + { + return $this->services['level3'] = new \stdClass(${($_ = isset($this->services['level4']) ? $this->services['level4'] : $this->getLevel4Service()) && false ?: '_'}); + } + + /** + * Gets the private 'level4' shared service. + * + * @return \stdClass + */ + protected function getLevel4Service() + { + return $this->services['level4'] = new \stdClass(${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new \stdClass())) && false ?: '_'}, ${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); + } + + /** + * Gets the private 'level5' shared service. + * + * @return \stdClass + */ + protected function getLevel5Service() + { + $a = ${($_ = isset($this->services['level6']) ? $this->services['level6'] : $this->getLevel6Service()) && false ?: '_'}; + + if (isset($this->services['level5'])) { + return $this->services['level5']; + } + + return $this->services['level5'] = new \stdClass($a); + } + + /** + * Gets the private 'level6' shared service. + * + * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls + */ + protected function getLevel6Service() + { + $this->services['level6'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); + + $instance->call(${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the private 'multiuse1' shared service. + * + * @return \stdClass + */ + protected function getMultiuse1Service() + { + return $this->services['multiuse1'] = new \stdClass(); + } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php index be18eb183abd00c608b65e7d4553eb0fb7e1c8d7..b569b335fc857e3f08666545d3232c7e9518e3e6 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php @@ -17,35 +17,73 @@ class Symfony_DI_PhpDumper_Test_Almost_Circular_Public extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'bar3' => 'getBar3Service', 'bar5' => 'getBar5Service', + 'bar6' => 'getBar6Service', + 'baz6' => 'getBaz6Service', + 'connection' => 'getConnectionService', + 'connection2' => 'getConnection2Service', + 'dispatcher' => 'getDispatcherService', + 'dispatcher2' => 'getDispatcher2Service', 'foo' => 'getFooService', 'foo2' => 'getFoo2Service', 'foo4' => 'getFoo4Service', 'foo5' => 'getFoo5Service', + 'foo6' => 'getFoo6Service', 'foobar' => 'getFoobarService', 'foobar2' => 'getFoobar2Service', 'foobar3' => 'getFoobar3Service', 'foobar4' => 'getFoobar4Service', - ); - - $this->aliases = array(); + 'level2' => 'getLevel2Service', + 'level3' => 'getLevel3Service', + 'level4' => 'getLevel4Service', + 'level5' => 'getLevel5Service', + 'level6' => 'getLevel6Service', + 'logger' => 'getLoggerService', + 'manager' => 'getManagerService', + 'manager2' => 'getManager2Service', + 'multiuse1' => 'getMultiuse1Service', + 'root' => 'getRootService', + 'subscriber' => 'getSubscriberService', + ]; + $this->privates = [ + 'bar6' => true, + 'level2' => true, + 'level3' => true, + 'level4' => true, + 'level5' => true, + 'level6' => true, + 'multiuse1' => true, + ]; + + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar2' => true, - ); + 'bar6' => true, + 'config' => true, + 'config2' => true, + 'level2' => true, + 'level3' => true, + 'level4' => true, + 'level5' => true, + 'level6' => true, + 'logger2' => true, + 'multiuse1' => true, + 'subscriber2' => true, + ]; } public function compile() @@ -88,7 +126,7 @@ protected function getBar3Service() { $this->services['bar3'] = $instance = new \BarCircular(); - $a = ${($_ = isset($this->services['foobar3']) ? $this->services['foobar3'] : $this->services['foobar3'] = new \FoobarCircular()) && false ?: '_'}; + $a = ${($_ = isset($this->services['foobar3']) ? $this->services['foobar3'] : ($this->services['foobar3'] = new \FoobarCircular())) && false ?: '_'}; $instance->addFoobar($a, $a); @@ -115,6 +153,93 @@ protected function getBar5Service() return $instance; } + /** + * Gets the public 'baz6' shared service. + * + * @return \stdClass + */ + protected function getBaz6Service() + { + $this->services['baz6'] = $instance = new \stdClass(); + + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'connection' shared service. + * + * @return \stdClass + */ + protected function getConnectionService() + { + $a = ${($_ = isset($this->services['dispatcher']) ? $this->services['dispatcher'] : $this->getDispatcherService()) && false ?: '_'}; + + if (isset($this->services['connection'])) { + return $this->services['connection']; + } + $b = new \stdClass(); + + $this->services['connection'] = $instance = new \stdClass($a, $b); + + $b->logger = ${($_ = isset($this->services['logger']) ? $this->services['logger'] : $this->getLoggerService()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'connection2' shared service. + * + * @return \stdClass + */ + protected function getConnection2Service() + { + $a = ${($_ = isset($this->services['dispatcher2']) ? $this->services['dispatcher2'] : $this->getDispatcher2Service()) && false ?: '_'}; + + if (isset($this->services['connection2'])) { + return $this->services['connection2']; + } + $b = new \stdClass(); + + $this->services['connection2'] = $instance = new \stdClass($a, $b); + + $c = new \stdClass($instance); + $c->handler2 = new \stdClass(${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && false ?: '_'}); + + $b->logger2 = $c; + + return $instance; + } + + /** + * Gets the public 'dispatcher' shared service. + * + * @return \stdClass + */ + protected function getDispatcherService($lazyLoad = true) + { + $this->services['dispatcher'] = $instance = new \stdClass(); + + $instance->subscriber = ${($_ = isset($this->services['subscriber']) ? $this->services['subscriber'] : $this->getSubscriberService()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'dispatcher2' shared service. + * + * @return \stdClass + */ + protected function getDispatcher2Service($lazyLoad = true) + { + $this->services['dispatcher2'] = $instance = new \stdClass(); + + $instance->subscriber2 = new \stdClass(${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && false ?: '_'}); + + return $instance; + } + /** * Gets the public 'foo' shared service. * @@ -175,6 +300,20 @@ protected function getFoo5Service() return $instance; } + /** + * Gets the public 'foo6' shared service. + * + * @return \stdClass + */ + protected function getFoo6Service() + { + $this->services['foo6'] = $instance = new \stdClass(); + + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; + + return $instance; + } + /** * Gets the public 'foobar' shared service. * @@ -232,4 +371,172 @@ protected function getFoobar4Service() return $instance; } + + /** + * Gets the public 'logger' shared service. + * + * @return \stdClass + */ + protected function getLoggerService() + { + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; + + if (isset($this->services['logger'])) { + return $this->services['logger']; + } + + $this->services['logger'] = $instance = new \stdClass($a); + + $instance->handler = new \stdClass(${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the public 'manager' shared service. + * + * @return \stdClass + */ + protected function getManagerService() + { + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; + + if (isset($this->services['manager'])) { + return $this->services['manager']; + } + + return $this->services['manager'] = new \stdClass($a); + } + + /** + * Gets the public 'manager2' shared service. + * + * @return \stdClass + */ + protected function getManager2Service() + { + $a = ${($_ = isset($this->services['connection2']) ? $this->services['connection2'] : $this->getConnection2Service()) && false ?: '_'}; + + if (isset($this->services['manager2'])) { + return $this->services['manager2']; + } + + return $this->services['manager2'] = new \stdClass($a); + } + + /** + * Gets the public 'root' shared service. + * + * @return \stdClass + */ + protected function getRootService() + { + return $this->services['root'] = new \stdClass(${($_ = isset($this->services['level2']) ? $this->services['level2'] : $this->getLevel2Service()) && false ?: '_'}, ${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new \stdClass())) && false ?: '_'}); + } + + /** + * Gets the public 'subscriber' shared service. + * + * @return \stdClass + */ + protected function getSubscriberService() + { + $a = ${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}; + + if (isset($this->services['subscriber'])) { + return $this->services['subscriber']; + } + + return $this->services['subscriber'] = new \stdClass($a); + } + + /** + * Gets the private 'bar6' shared service. + * + * @return \stdClass + */ + protected function getBar6Service() + { + $a = ${($_ = isset($this->services['foo6']) ? $this->services['foo6'] : $this->getFoo6Service()) && false ?: '_'}; + + if (isset($this->services['bar6'])) { + return $this->services['bar6']; + } + + return $this->services['bar6'] = new \stdClass($a); + } + + /** + * Gets the private 'level2' shared service. + * + * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls + */ + protected function getLevel2Service() + { + $this->services['level2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); + + $instance->call(${($_ = isset($this->services['level3']) ? $this->services['level3'] : $this->getLevel3Service()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the private 'level3' shared service. + * + * @return \stdClass + */ + protected function getLevel3Service() + { + return $this->services['level3'] = new \stdClass(${($_ = isset($this->services['level4']) ? $this->services['level4'] : $this->getLevel4Service()) && false ?: '_'}); + } + + /** + * Gets the private 'level4' shared service. + * + * @return \stdClass + */ + protected function getLevel4Service() + { + return $this->services['level4'] = new \stdClass(${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : ($this->services['multiuse1'] = new \stdClass())) && false ?: '_'}, ${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); + } + + /** + * Gets the private 'level5' shared service. + * + * @return \stdClass + */ + protected function getLevel5Service() + { + $a = ${($_ = isset($this->services['level6']) ? $this->services['level6'] : $this->getLevel6Service()) && false ?: '_'}; + + if (isset($this->services['level5'])) { + return $this->services['level5']; + } + + return $this->services['level5'] = new \stdClass($a); + } + + /** + * Gets the private 'level6' shared service. + * + * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls + */ + protected function getLevel6Service() + { + $this->services['level6'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); + + $instance->call(${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the private 'multiuse1' shared service. + * + * @return \stdClass + */ + protected function getMultiuse1Service() + { + return $this->services['multiuse1'] = new \stdClass(); + } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php index 4776d98c310816158ec9bb9b4d374825f6d2745c..be59456b0f1d260dd268ce25416a893e4a407147 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php @@ -17,7 +17,7 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { @@ -27,20 +27,20 @@ public function __construct() } $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -117,15 +117,15 @@ public function getParameterBag() return $this->parameterBag; } - private $loadedDynamicParameters = array( + private $loadedDynamicParameters = [ 'array_2' => false, - ); - private $dynamicParameters = array(); + ]; + private $dynamicParameters = []; /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -134,9 +134,9 @@ public function getParameterBag() private function getDynamicParameter($name) { switch ($name) { - case 'array_2': $value = array( + case 'array_2': $value = [ 0 => ($this->targetDirs[2].'/Dumper'), - ); break; + ]; break; default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } $this->loadedDynamicParameters[$name] = true; @@ -144,7 +144,7 @@ private function getDynamicParameter($name) return $this->dynamicParameters[$name] = $value; } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -167,10 +167,10 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return array( - 'array_1' => array( + return [ + 'array_1' => [ 0 => 123, - ), - ); + ], + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php index f1b92397ddbc3482f528183b776331d3df60a00d..8582c3e2df847f2df87e934b33a10623c95cf1e9 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php @@ -17,23 +17,23 @@ class Symfony_DI_PhpDumper_Test_Base64Parameters extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); + $this->services = []; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -96,15 +96,15 @@ public function getParameterBag() return $this->parameterBag; } - private $loadedDynamicParameters = array( + private $loadedDynamicParameters = [ 'hello' => false, - ); - private $dynamicParameters = array(); + ]; + private $dynamicParameters = []; /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -121,7 +121,7 @@ private function getDynamicParameter($name) return $this->dynamicParameters[$name] = $value; } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -144,8 +144,8 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return array( + return [ 'env(foo)' => 'd29ybGQ=', - ); + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_dedup_lazy_proxy.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_dedup_lazy_proxy.php index 73a7f259f86b5d04786d5b0f3faac288c6b56f71..ec3c8028bb8ccd9610f93c5a7ecd0c4bd28f7aed 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_dedup_lazy_proxy.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_dedup_lazy_proxy.php @@ -17,25 +17,25 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'foo' => 'getFooService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_deep_graph.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_deep_graph.php new file mode 100644 index 0000000000000000000000000000000000000000..4158fc6288f7b7c6c4d15322a49f5be0eee54312 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_deep_graph.php @@ -0,0 +1,93 @@ +<?php + +use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\LogicException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; + +/** + * This class has been auto-generated + * by the Symfony Dependency Injection Component. + * + * @final since Symfony 3.3 + */ +class Symfony_DI_PhpDumper_Test_Deep_Graph extends Container +{ + private $parameters; + private $targetDirs = []; + + public function __construct() + { + $this->services = []; + $this->methodMap = [ + 'bar' => 'getBarService', + 'foo' => 'getFooService', + ]; + + $this->aliases = []; + } + + public function getRemovedIds() + { + return [ + 'Psr\\Container\\ContainerInterface' => true, + 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, + ]; + } + + public function compile() + { + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + public function isCompiled() + { + return true; + } + + public function isFrozen() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + + return true; + } + + /** + * Gets the public 'bar' shared service. + * + * @return \stdClass + */ + protected function getBarService() + { + $this->services['bar'] = $instance = new \stdClass(); + + $instance->p5 = new \stdClass(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the public 'foo' shared service. + * + * @return \Symfony\Component\DependencyInjection\Tests\Dumper\FooForDeepGraph + */ + protected function getFooService() + { + $a = ${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}; + + if (isset($this->services['foo'])) { + return $this->services['foo']; + } + $b = new \stdClass(); + + $c = new \stdClass(); + $c->p3 = new \stdClass(); + + $b->p2 = $c; + + return $this->services['foo'] = new \Symfony\Component\DependencyInjection\Tests\Dumper\FooForDeepGraph($a, $b); + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php index 6bc714a204c97faddd8356052ce2e3a834cb9d4d..ad76566b1af9dbdf743ce6c22a3bc258eab379d2 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php @@ -17,36 +17,36 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'bar_%env(bar)%' => 'bar_%env(BAR)%', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'bar' => 'getBarService', 'bar_%env(BAR)%' => 'getBarenvBARService', 'foo' => 'getFooService', - ); - $this->privates = array( + ]; + $this->privates = [ 'bar_%env(BAR)%' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar_%env(BAR)%' => true, 'baz_%env(BAR)%' => true, - ); + ]; } public function compile() @@ -73,7 +73,7 @@ public function isFrozen() */ protected function getBarService() { - return $this->services['bar'] = new \stdClass(${($_ = isset($this->services['bar_%env(BAR)%']) ? $this->services['bar_%env(BAR)%'] : $this->services['bar_%env(BAR)%'] = new \stdClass()) && false ?: '_'}); + return $this->services['bar'] = new \stdClass(${($_ = isset($this->services['bar_%env(BAR)%']) ? $this->services['bar_%env(BAR)%'] : ($this->services['bar_%env(BAR)%'] = new \stdClass())) && false ?: '_'}); } /** @@ -83,7 +83,7 @@ protected function getBarService() */ protected function getFooService() { - return $this->services['foo'] = new \stdClass(${($_ = isset($this->services['bar_%env(BAR)%']) ? $this->services['bar_%env(BAR)%'] : $this->services['bar_%env(BAR)%'] = new \stdClass()) && false ?: '_'}, array('baz_'.$this->getEnv('string:BAR') => new \stdClass())); + return $this->services['foo'] = new \stdClass(${($_ = isset($this->services['bar_%env(BAR)%']) ? $this->services['bar_%env(BAR)%'] : ($this->services['bar_%env(BAR)%'] = new \stdClass())) && false ?: '_'}, ['baz_'.$this->getEnv('string:BAR') => new \stdClass()]); } /** @@ -139,13 +139,13 @@ public function getParameterBag() return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -156,9 +156,9 @@ private function getDynamicParameter($name) throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array( + private $normalizedParameterNames = [ 'env(bar)' => 'env(BAR)', - ); + ]; private function normalizeParameterName($name) { @@ -181,8 +181,8 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return array( + return [ 'env(BAR)' => 'bar', - ); + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php index 2db58bddaab4fd1da087f3019d43879220c12d2b..a23a693674134a9233866b3cd22efc122c986fd2 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php @@ -17,7 +17,7 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { @@ -27,24 +27,24 @@ public function __construct() } $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c1' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1', 'symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c2' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2', 'symfony\\component\\dependencyinjection\\tests\\fixtures\\includes\\hotpath\\c3' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3', 'symfony\\component\\dependencyinjection\\tests\\fixtures\\parentnotexists' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\ParentNotExists', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\ParentNotExists' => 'getParentNotExistsService', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1' => 'getC1Service', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2' => 'getC2Service', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => 'getC3Service', - ); - $this->privates = array( + ]; + $this->privates = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; $this->privates['service_container'] = function () { include_once $this->targetDirs[1].'/includes/HotPath/I1.php'; @@ -56,11 +56,11 @@ public function __construct() public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C3' => true, - ); + ]; } public function compile() @@ -110,7 +110,7 @@ protected function getC2Service() include_once $this->targetDirs[1].'/includes/HotPath/C2.php'; include_once $this->targetDirs[1].'/includes/HotPath/C3.php'; - return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3'] : $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3()) && false ?: '_'}); + return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3())) && false ?: '_'}); } /** @@ -168,13 +168,13 @@ public function getParameterBag() return $this->parameterBag; } - private $loadedDynamicParameters = array(); - private $dynamicParameters = array(); + private $loadedDynamicParameters = []; + private $dynamicParameters = []; /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -185,7 +185,7 @@ private function getDynamicParameter($name) throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -208,8 +208,8 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return array( + return [ 'inline_requires' => true, - ); + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_self_ref.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_self_ref.php new file mode 100644 index 0000000000000000000000000000000000000000..a2573eae6d3a95c8c70d1a384637a68b67bfe85c --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_self_ref.php @@ -0,0 +1,78 @@ +<?php + +use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\LogicException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; + +/** + * This class has been auto-generated + * by the Symfony Dependency Injection Component. + * + * @final since Symfony 3.3 + */ +class Symfony_DI_PhpDumper_Test_Inline_Self_Ref extends Container +{ + private $parameters; + private $targetDirs = []; + + public function __construct() + { + $this->services = []; + $this->normalizedIds = [ + 'app\\foo' => 'App\\Foo', + ]; + $this->methodMap = [ + 'App\\Foo' => 'getFooService', + ]; + + $this->aliases = []; + } + + public function getRemovedIds() + { + return [ + 'Psr\\Container\\ContainerInterface' => true, + 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, + ]; + } + + public function compile() + { + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + public function isCompiled() + { + return true; + } + + public function isFrozen() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + + return true; + } + + /** + * Gets the public 'App\Foo' shared service. + * + * @return \App\Foo + */ + protected function getFooService() + { + $a = new \App\Bar(); + + $b = new \App\Baz($a); + $b->bar = $a; + + $this->services['App\Foo'] = $instance = new \App\Foo($b); + + $a->foo = $instance; + + return $instance; + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_legacy_privates.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_legacy_privates.php index 7aa1bff87069a95fa3a2e28d824224268fa237f2..30dd2c9ba978b3a0259cc6a27e7f0bfe74e7dc72 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_legacy_privates.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_legacy_privates.php @@ -17,7 +17,7 @@ class Symfony_DI_PhpDumper_Test_Legacy_Privates extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { @@ -25,8 +25,8 @@ public function __construct() for ($i = 1; $i <= 5; ++$i) { $this->targetDirs[$i] = $dir = \dirname($dir); } - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'private' => 'getPrivateService', 'private_alias' => 'getPrivateAliasService', @@ -37,8 +37,8 @@ public function __construct() 'private_not_removed' => 'getPrivateNotRemovedService', 'private_parent' => 'getPrivateParentService', 'public_child' => 'getPublicChildService', - ); - $this->privates = array( + ]; + $this->privates = [ 'decorated_private' => true, 'decorated_private_alias' => true, 'private' => true, @@ -47,17 +47,17 @@ public function __construct() 'private_not_inlined' => true, 'private_not_removed' => true, 'private_parent' => true, - ); - $this->aliases = array( + ]; + $this->aliases = [ 'alias_to_private' => 'private', 'decorated_private' => 'private_decorator', 'decorated_private_alias' => 'private_alias_decorator', - ); + ]; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'decorated_private' => true, @@ -71,7 +71,7 @@ public function getRemovedIds() 'private_not_inlined' => true, 'private_not_removed' => true, 'private_parent' => true, - ); + ]; } public function compile() @@ -98,7 +98,7 @@ public function isFrozen() */ protected function getBarService() { - return $this->services['bar'] = new \stdClass(${($_ = isset($this->services['private_not_inlined']) ? $this->services['private_not_inlined'] : $this->services['private_not_inlined'] = new \stdClass()) && false ?: '_'}); + return $this->services['bar'] = new \stdClass(${($_ = isset($this->services['private_not_inlined']) ? $this->services['private_not_inlined'] : ($this->services['private_not_inlined'] = new \stdClass())) && false ?: '_'}); } /** diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_locator.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_locator.php index 496f6aa77d3062370f37bd2ff8ed39fa1b8fb004..4969b2db09378313e14560d755e2417a2d534ba9 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_locator.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_locator.php @@ -17,12 +17,12 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar_service' => 'getBarServiceService', 'baz_service' => 'getBazServiceService', 'foo_service' => 'getFooServiceService', @@ -32,24 +32,24 @@ public function __construct() 'translator_1' => 'getTranslator1Service', 'translator_2' => 'getTranslator2Service', 'translator_3' => 'getTranslator3Service', - ); - $this->privates = array( + ]; + $this->privates = [ 'baz_service' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'baz_service' => true, 'translator.loader_1_locator' => true, 'translator.loader_2_locator' => true, 'translator.loader_3_locator' => true, - ); + ]; } public function compile() @@ -76,7 +76,7 @@ public function isFrozen() */ protected function getBarServiceService() { - return $this->services['bar_service'] = new \stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : $this->services['baz_service'] = new \stdClass()) && false ?: '_'}); + return $this->services['bar_service'] = new \stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new \stdClass())) && false ?: '_'}); } /** @@ -86,13 +86,13 @@ protected function getBarServiceService() */ protected function getFooServiceService() { - return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\ServiceLocator(array('bar' => function () { + return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\ServiceLocator(['bar' => function () { return ${($_ = isset($this->services['bar_service']) ? $this->services['bar_service'] : $this->getBarServiceService()) && false ?: '_'}; }, 'baz' => function () { - $f = function (\stdClass $v) { return $v; }; return $f(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : $this->services['baz_service'] = new \stdClass()) && false ?: '_'}); + $f = function (\stdClass $v) { return $v; }; return $f(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new \stdClass())) && false ?: '_'}); }, 'nil' => function () { return NULL; - })); + }]); } /** @@ -132,9 +132,9 @@ protected function getTranslator_Loader3Service() */ protected function getTranslator1Service() { - return $this->services['translator_1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(array('translator.loader_1' => function () { - return ${($_ = isset($this->services['translator.loader_1']) ? $this->services['translator.loader_1'] : $this->services['translator.loader_1'] = new \stdClass()) && false ?: '_'}; - }))); + return $this->services['translator_1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_1' => function () { + return ${($_ = isset($this->services['translator.loader_1']) ? $this->services['translator.loader_1'] : ($this->services['translator.loader_1'] = new \stdClass())) && false ?: '_'}; + }])); } /** @@ -144,11 +144,11 @@ protected function getTranslator1Service() */ protected function getTranslator2Service() { - $this->services['translator_2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(array('translator.loader_2' => function () { - return ${($_ = isset($this->services['translator.loader_2']) ? $this->services['translator.loader_2'] : $this->services['translator.loader_2'] = new \stdClass()) && false ?: '_'}; - }))); + $this->services['translator_2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_2' => function () { + return ${($_ = isset($this->services['translator.loader_2']) ? $this->services['translator.loader_2'] : ($this->services['translator.loader_2'] = new \stdClass())) && false ?: '_'}; + }])); - $instance->addResource('db', ${($_ = isset($this->services['translator.loader_2']) ? $this->services['translator.loader_2'] : $this->services['translator.loader_2'] = new \stdClass()) && false ?: '_'}, 'nl'); + $instance->addResource('db', ${($_ = isset($this->services['translator.loader_2']) ? $this->services['translator.loader_2'] : ($this->services['translator.loader_2'] = new \stdClass())) && false ?: '_'}, 'nl'); return $instance; } @@ -160,11 +160,11 @@ protected function getTranslator2Service() */ protected function getTranslator3Service() { - $this->services['translator_3'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(array('translator.loader_3' => function () { - return ${($_ = isset($this->services['translator.loader_3']) ? $this->services['translator.loader_3'] : $this->services['translator.loader_3'] = new \stdClass()) && false ?: '_'}; - }))); + $this->services['translator_3'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_3' => function () { + return ${($_ = isset($this->services['translator.loader_3']) ? $this->services['translator.loader_3'] : ($this->services['translator.loader_3'] = new \stdClass())) && false ?: '_'}; + }])); - $a = ${($_ = isset($this->services['translator.loader_3']) ? $this->services['translator.loader_3'] : $this->services['translator.loader_3'] = new \stdClass()) && false ?: '_'}; + $a = ${($_ = isset($this->services['translator.loader_3']) ? $this->services['translator.loader_3'] : ($this->services['translator.loader_3'] = new \stdClass())) && false ?: '_'}; $instance->addResource('db', $a, 'nl'); $instance->addResource('db', $a, 'en'); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_non_shared_lazy.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_non_shared_lazy.php index 6c3b1405069f1bcab7be91f5ca58fdfc16ba2c0c..b56063a1842a4c95165f414604fceabbc7b509a2 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_non_shared_lazy.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_non_shared_lazy.php @@ -17,31 +17,31 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'foo' => 'getFooService', - ); - $this->privates = array( + ]; + $this->privates = [ 'bar' => true, 'foo' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar' => true, 'foo' => true, - ); + ]; } public function compile() diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_frozen.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_frozen.php index 1275e9f2642a36a989e69e8312bf5a03b386ab78..da1d716c58a3c72eb8d60db181215307b1a85004 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_frozen.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_frozen.php @@ -17,30 +17,30 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar_service' => 'getBarServiceService', 'baz_service' => 'getBazServiceService', 'foo_service' => 'getFooServiceService', - ); - $this->privates = array( + ]; + $this->privates = [ 'baz_service' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'baz_service' => true, - ); + ]; } public function compile() @@ -67,7 +67,7 @@ public function isFrozen() */ protected function getBarServiceService() { - return $this->services['bar_service'] = new \stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : $this->services['baz_service'] = new \stdClass()) && false ?: '_'}); + return $this->services['bar_service'] = new \stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new \stdClass())) && false ?: '_'}); } /** @@ -77,7 +77,7 @@ protected function getBarServiceService() */ protected function getFooServiceService() { - return $this->services['foo_service'] = new \stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : $this->services['baz_service'] = new \stdClass()) && false ?: '_'}); + return $this->services['foo_service'] = new \stdClass(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : ($this->services['baz_service'] = new \stdClass())) && false ?: '_'}); } /** diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_in_expression.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_in_expression.php index fe84f49753c52b94f3fc5f08cd1aca5cb62ca6a9..c7fb579b0721592e31872a3583ac437d9d35d977 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_in_expression.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_private_in_expression.php @@ -17,30 +17,30 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'private_foo' => 'getPrivateFooService', 'public_foo' => 'getPublicFooService', - ); - $this->privates = array( + ]; + $this->privates = [ 'private_foo' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'private_bar' => true, 'private_foo' => true, - ); + ]; } public function compile() @@ -67,7 +67,7 @@ public function isFrozen() */ protected function getPublicFooService() { - return $this->services['public_foo'] = new \stdClass(${($_ = isset($this->services['private_foo']) ? $this->services['private_foo'] : $this->services['private_foo'] = new \stdClass()) && false ?: '_'}); + return $this->services['public_foo'] = new \stdClass(${($_ = isset($this->services['private_foo']) ? $this->services['private_foo'] : ($this->services['private_foo'] = new \stdClass())) && false ?: '_'}->bar); } /** diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php index aab87ec7af9f05b65c82167898430f290582c0fb..7c903b11d0720d54ab9d2aebf76f64ee02f0caa1 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php @@ -17,30 +17,30 @@ class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { $this->parameters = $this->getDefaultParameters(); - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'symfony\\component\\dependencyinjection\\tests\\dumper\\rot13envvarprocessor' => 'Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Dumper\\Rot13EnvVarProcessor' => 'getRot13EnvVarProcessorService', 'container.env_var_processors_locator' => 'getContainer_EnvVarProcessorsLocatorService', - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, - ); + ]; } public function compile() @@ -77,9 +77,9 @@ protected function getRot13EnvVarProcessorService() */ protected function getContainer_EnvVarProcessorsLocatorService() { - return $this->services['container.env_var_processors_locator'] = new \Symfony\Component\DependencyInjection\ServiceLocator(array('rot13' => function () { - return ${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] : $this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] = new \Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor()) && false ?: '_'}; - })); + return $this->services['container.env_var_processors_locator'] = new \Symfony\Component\DependencyInjection\ServiceLocator(['rot13' => function () { + return ${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] = new \Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor())) && false ?: '_'}; + }]); } public function getParameter($name) @@ -125,15 +125,15 @@ public function getParameterBag() return $this->parameterBag; } - private $loadedDynamicParameters = array( + private $loadedDynamicParameters = [ 'hello' => false, - ); - private $dynamicParameters = array(); + ]; + private $dynamicParameters = []; /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -150,7 +150,7 @@ private function getDynamicParameter($name) return $this->dynamicParameters[$name] = $value; } - private $normalizedParameterNames = array(); + private $normalizedParameterNames = []; private function normalizeParameterName($name) { @@ -173,8 +173,8 @@ private function normalizeParameterName($name) */ protected function getDefaultParameters() { - return array( + return [ 'env(foo)' => 'jbeyq', - ); + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_subscriber.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_subscriber.php index 9475c923068f285441b264b11919b5708100db22..9424a7611433bf817392d4aed44863c43a94756c 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_subscriber.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_subscriber.php @@ -17,36 +17,36 @@ class ProjectServiceContainer extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->normalizedIds = array( + $this->services = []; + $this->normalizedIds = [ 'symfony\\component\\dependencyinjection\\tests\\fixtures\\customdefinition' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'symfony\\component\\dependencyinjection\\tests\\fixtures\\testservicesubscriber' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', - ); - $this->methodMap = array( + ]; + $this->methodMap = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 'getCustomDefinitionService', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'getTestServiceSubscriberService', 'foo_service' => 'getFooServiceService', - ); - $this->privates = array( + ]; + $this->privates = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true, 'service_locator.jmktfsv' => true, 'service_locator.jmktfsv.foo_service' => true, - ); + ]; } public function compile() @@ -83,15 +83,15 @@ protected function getTestServiceSubscriberService() */ protected function getFooServiceService() { - return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber((new \Symfony\Component\DependencyInjection\ServiceLocator(array('Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => function () { - $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] : $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition()) && false ?: '_'}); + return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber((new \Symfony\Component\DependencyInjection\ServiceLocator(['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => function () { + $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition())) && false ?: '_'}); }, 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => function () { - $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] : $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber()) && false ?: '_'}); + $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber())) && false ?: '_'}); }, 'bar' => function () { - $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] : $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber()) && false ?: '_'}); + $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber())) && false ?: '_'}); }, 'baz' => function () { - $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] : $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition()) && false ?: '_'}); - })))->withContext('foo_service', $this)); + $f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition())) && false ?: '_'}); + }]))->withContext('foo_service', $this)); } /** diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_tsantos.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_tsantos.php new file mode 100644 index 0000000000000000000000000000000000000000..b14cdebb966c525661f00b4c20763d625cfd3434 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_tsantos.php @@ -0,0 +1,87 @@ +<?php + +use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\LogicException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; + +/** + * This class has been auto-generated + * by the Symfony Dependency Injection Component. + * + * @final since Symfony 3.3 + */ +class ProjectServiceContainer extends Container +{ + private $parameters; + private $targetDirs = []; + + public function __construct() + { + $this->services = []; + $this->normalizedIds = [ + 'tsantos\\serializer\\serializerinterface' => 'TSantos\\Serializer\\SerializerInterface', + ]; + $this->methodMap = [ + 'tsantos_serializer' => 'getTsantosSerializerService', + ]; + $this->aliases = [ + 'TSantos\\Serializer\\SerializerInterface' => 'tsantos_serializer', + ]; + } + + public function getRemovedIds() + { + return [ + 'Psr\\Container\\ContainerInterface' => true, + 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, + ]; + } + + public function compile() + { + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + public function isCompiled() + { + return true; + } + + public function isFrozen() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + + return true; + } + + /** + * Gets the public 'tsantos_serializer' shared service. + * + * @return \TSantos\Serializer\EventEmitterSerializer + */ + protected function getTsantosSerializerService() + { + $a = new \TSantos\Serializer\NormalizerRegistry(); + + $b = new \TSantos\Serializer\Normalizer\CollectionNormalizer(); + + $c = new \TSantos\Serializer\EventDispatcher\EventDispatcher(); + $c->addSubscriber(new \TSantos\SerializerBundle\EventListener\StopwatchListener(new \Symfony\Component\Stopwatch\Stopwatch(true))); + + $this->services['tsantos_serializer'] = $instance = new \TSantos\Serializer\EventEmitterSerializer(new \TSantos\Serializer\Encoder\JsonEncoder(), $a, $c); + + $b->setSerializer($instance); + $d = new \TSantos\Serializer\Normalizer\JsonNormalizer(); + $d->setSerializer($instance); + + $a->add(new \TSantos\Serializer\Normalizer\ObjectNormalizer(new \TSantos\SerializerBundle\Serializer\CircularReferenceHandler())); + $a->add($b); + $a->add($d); + + return $instance; + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_uninitialized_ref.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_uninitialized_ref.php index 4d0c00b2891387d7f212268a4d5663a52f3207aa..7a24f72c590c7d4379b779e0be8b9ff906ad5d69 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_uninitialized_ref.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_uninitialized_ref.php @@ -17,32 +17,32 @@ class Symfony_DI_PhpDumper_Test_Uninitialized_Reference extends Container { private $parameters; - private $targetDirs = array(); + private $targetDirs = []; public function __construct() { - $this->services = array(); - $this->methodMap = array( + $this->services = []; + $this->methodMap = [ 'bar' => 'getBarService', 'baz' => 'getBazService', 'foo1' => 'getFoo1Service', 'foo3' => 'getFoo3Service', - ); - $this->privates = array( + ]; + $this->privates = [ 'foo3' => true, - ); + ]; - $this->aliases = array(); + $this->aliases = []; } public function getRemovedIds() { - return array( + return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'foo2' => true, 'foo3' => true, - ); + ]; } public function compile() @@ -74,13 +74,13 @@ protected function getBarService() $instance->foo1 = ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && false ?: '_'}; $instance->foo2 = null; $instance->foo3 = ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : null) && false ?: '_'}; - $instance->closures = array(0 => function () { + $instance->closures = [0 => function () { return ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && false ?: '_'}; }, 1 => function () { return null; }, 2 => function () { return ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : null) && false ?: '_'}; - }); + }]; $instance->iter = new RewindableGenerator(function () { if (isset($this->services['foo1'])) { yield 'foo1' => ${($_ = isset($this->services['foo1']) ? $this->services['foo1'] : null) && false ?: '_'}; @@ -107,7 +107,7 @@ protected function getBazService() { $this->services['baz'] = $instance = new \stdClass(); - $instance->foo3 = ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : $this->services['foo3'] = new \stdClass()) && false ?: '_'}; + $instance->foo3 = ${($_ = isset($this->services['foo3']) ? $this->services['foo3'] : ($this->services['foo3'] = new \stdClass())) && false ?: '_'}; return $instance; } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/xml/services6.xml b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/services6.xml index cffd5df6059ac4ff734ecc57f20061c78cf83478..c85b7a7c01efb8dc08209ea91e7d527f4b4275cd 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/xml/services6.xml +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/services6.xml @@ -61,5 +61,9 @@ </service> <service id="alias_for_foo" alias="foo" /> <service id="another_alias_for_foo" alias="foo" public="false" /> + <service id="0" class="FooClass" /> + <service id="1" class="FooClass"> + <argument type="service" id="0" /> + </service> </services> </container> diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/xml/services_tsantos.xml b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/services_tsantos.xml new file mode 100644 index 0000000000000000000000000000000000000000..bb310b279d7057738e5547d5664097f7823145fa --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/services_tsantos.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + <services> + <service id="service_container" class="Symfony\Component\DependencyInjection\ContainerInterface" public="true" synthetic="true"/> + <service id="tsantos_serializer" class="TSantos\Serializer\EventEmitterSerializer" public="true"> + <argument type="service"> + <service class="TSantos\Serializer\Encoder\JsonEncoder" public="false"> + <tag name="tsantos_serializer.encoder" format="json"/> + </service> + </argument> + <argument type="service"> + <service class="TSantos\Serializer\NormalizerRegistry" public="false"> + <call method="add"> + <argument type="service"> + <service class="TSantos\Serializer\Normalizer\ObjectNormalizer" public="false"> + <tag name="tsantos_serializer.normalizer" priority="-800"/> + <argument type="service"> + <service class="TSantos\SerializerBundle\Serializer\CircularReferenceHandler" public="false"/> + </argument> + </service> + </argument> + </call> + <call method="add"> + <argument type="service"> + <service class="TSantos\Serializer\Normalizer\CollectionNormalizer" public="false"> + <tag name="tsantos_serializer.normalizer" priority="-900"/> + <call method="setSerializer"> + <argument type="service" id="tsantos_serializer"/> + </call> + </service> + </argument> + </call> + <call method="add"> + <argument type="service"> + <service class="TSantos\Serializer\Normalizer\JsonNormalizer" public="false"> + <tag name="tsantos_serializer.normalizer" priority="-1000"/> + <call method="setSerializer"> + <argument type="service" id="tsantos_serializer"/> + </call> + </service> + </argument> + </call> + </service> + </argument> + <argument type="service"> + <service class="TSantos\Serializer\EventDispatcher\EventDispatcher" public="false"> + <call method="addSubscriber"> + <argument type="service"> + <service class="TSantos\SerializerBundle\EventListener\StopwatchListener" public="false"> + <tag name="tsantos_serializer.event_subscriber"/> + <argument type="service"> + <service class="Symfony\Component\Stopwatch\Stopwatch" public="false"> + <tag name="kernel.reset" method="reset"/> + <argument>true</argument> + </service> + </argument> + </service> + </argument> + </call> + </service> + </argument> + </service> + <service id="TSantos\Serializer\SerializerInterface" alias="tsantos_serializer" public="true"/> + </services> +</container> diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_adawson.yml b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_adawson.yml new file mode 100644 index 0000000000000000000000000000000000000000..2a26f38a8307b63fa34e36cb0f1978ec1a230ec4 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_adawson.yml @@ -0,0 +1,28 @@ +services: + App\Db: + public: true + properties: + schema: '@App\Schema' + + App\Bus: + public: true + arguments: ['@App\Db'] + properties: + handler1: '@App\Handler1' + handler2: '@App\Handler2' + + App\Handler1: + ['@App\Db', '@App\Schema', '@App\Processor'] + + App\Handler2: + ['@App\Db', '@App\Schema', '@App\Processor'] + + App\Processor: + ['@App\Registry', '@App\Db'] + + App\Registry: + properties: + processor: ['@App\Db', '@App\Bus'] + + App\Schema: + arguments: ['@App\Db'] diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_deep_graph.yml b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_deep_graph.yml new file mode 100644 index 0000000000000000000000000000000000000000..f16329aef7b239b10ead6d9130ef71943d87912a --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_deep_graph.yml @@ -0,0 +1,24 @@ + +services: + foo: + class: Symfony\Component\DependencyInjection\Tests\Dumper\FooForDeepGraph + public: true + arguments: + - '@bar' + - !service + class: stdClass + properties: + p2: !service + class: stdClass + properties: + p3: !service + class: stdClass + + bar: + class: stdClass + public: true + properties: + p5: !service + class: stdClass + arguments: ['@foo'] + diff --git a/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php index 559abbe25b81dc3b46c946308756b5ffcd4e486c..c7c303b683d996045226e5dd3d93fc38577ca2ed 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php @@ -37,25 +37,25 @@ protected function setUp() $locator = new FileLocator(self::$fixturesPath); $this->container = new ContainerBuilder(); $this->loader = new DirectoryLoader($this->container, $locator); - $resolver = new LoaderResolver(array( + $resolver = new LoaderResolver([ new PhpFileLoader($this->container, $locator), new IniFileLoader($this->container, $locator), new YamlFileLoader($this->container, $locator), $this->loader, - )); + ]); $this->loader->setResolver($resolver); } public function testDirectoryCanBeLoadedRecursively() { $this->loader->load('directory/'); - $this->assertEquals(array('ini' => 'ini', 'yaml' => 'yaml', 'php' => 'php'), $this->container->getParameterBag()->all(), '->load() takes a single directory'); + $this->assertEquals(['ini' => 'ini', 'yaml' => 'yaml', 'php' => 'php'], $this->container->getParameterBag()->all(), '->load() takes a single directory'); } public function testImports() { $this->loader->resolve('directory/import/import.yml')->load('directory/import/import.yml'); - $this->assertEquals(array('ini' => 'ini', 'yaml' => 'yaml'), $this->container->getParameterBag()->all(), '->load() takes a single file that imports a directory'); + $this->assertEquals(['ini' => 'ini', 'yaml' => 'yaml'], $this->container->getParameterBag()->all(), '->load() takes a single file that imports a directory'); } /** diff --git a/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php index 73015084ab49ccc93231fba58a2653fc8b06ec95..065acdf1babcb53d261108f84678bd4e79c70048 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php @@ -47,21 +47,21 @@ public function testImportWithGlobPattern() $container = new ContainerBuilder(); $loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath)); - $resolver = new LoaderResolver(array( + $resolver = new LoaderResolver([ new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/ini')), new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')), new PhpFileLoader($container, new FileLocator(self::$fixturesPath.'/php')), new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')), - )); + ]); $loader->setResolver($resolver); $loader->import('{F}ixtures/{xml,yaml}/services2.{yml,xml}'); $actual = $container->getParameterBag()->all(); - $expected = array( + $expected = [ 'a string', 'foo' => 'bar', - 'values' => array( + 'values' => [ 0, 'integer' => 4, 100 => null, @@ -73,14 +73,14 @@ public function testImportWithGlobPattern() 'float' => 1.3, 1000.3, 'a string', - array('foo', 'bar'), - ), - 'mixedcase' => array('MixedCaseKey' => 'value'), + ['foo', 'bar'], + ], + 'mixedcase' => ['MixedCaseKey' => 'value'], 'constant' => PHP_EOL, 'bar' => '%foo%', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar'), - ); + ]; $this->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files'); } @@ -94,15 +94,15 @@ public function testRegisterClasses() $loader->registerClasses(new Definition(), 'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\\', 'Prototype/%sub_dir%/*'); $this->assertEquals( - array('service_container', Bar::class), + ['service_container', Bar::class], array_keys($container->getDefinitions()) ); $this->assertEquals( - array( + [ PsrContainerInterface::class, ContainerInterface::class, BarInterface::class, - ), + ], array_keys($container->getAliases()) ); } @@ -127,11 +127,11 @@ public function testRegisterClassesWithExclude() $this->assertFalse($container->has(DeeperBaz::class)); $this->assertEquals( - array( + [ PsrContainerInterface::class, ContainerInterface::class, BarInterface::class, - ), + ], array_keys($container->getAliases()) ); } @@ -150,11 +150,11 @@ public function testNestedRegisterClasses() $this->assertTrue($container->has(Foo::class)); $this->assertEquals( - array( + [ PsrContainerInterface::class, ContainerInterface::class, FooInterface::class, - ), + ], array_keys($container->getAliases()) ); @@ -179,7 +179,7 @@ public function testMissingParentClass() $this->assertTrue($container->has(MissingParent::class)); $this->assertSame( - array('While discovering services from namespace "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\", an error was thrown when processing the class "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\MissingParent": "Class Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\MissingClass not found".'), + ['While discovering services from namespace "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\", an error was thrown when processing the class "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\MissingParent": "Class Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\MissingClass not found".'], $container->getDefinition(MissingParent::class)->getErrors() ); } @@ -222,8 +222,8 @@ public function testRegisterClassesWithIncompatibleExclude($resourcePattern, $ex public function getIncompatibleExcludeTests() { - yield array('Prototype/*', 'yaml/*', false); - yield array('Prototype/OtherDir/*', 'Prototype/*', false); + yield ['Prototype/*', 'yaml/*', false]; + yield ['Prototype/OtherDir/*', 'Prototype/*', false]; } } diff --git a/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php index 65b5db93c5f130e11f9299ce9d2924f0bd186c18..1d7d3a93ebd0928735f7e2be23ce95ade3130499 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php @@ -30,7 +30,7 @@ protected function setUp() public function testIniFileCanBeLoaded() { $this->loader->load('parameters.ini'); - $this->assertEquals(array('foo' => 'bar', 'bar' => '%foo%'), $this->container->getParameterBag()->all(), '->load() takes a single file name as its first argument'); + $this->assertEquals(['foo' => 'bar', 'bar' => '%foo%'], $this->container->getParameterBag()->all(), '->load() takes a single file name as its first argument'); } /** @@ -58,41 +58,41 @@ public function testTypeConversionsWithNativePhp($key, $value, $supported) $this->markTestSkipped(sprintf('Converting the value "%s" to "%s" is not supported by the IniFileLoader.', $key, $value)); } - $this->loader->load('types.ini'); $expected = parse_ini_file(__DIR__.'/../Fixtures/ini/types.ini', true, INI_SCANNER_TYPED); $this->assertSame($value, $expected['parameters'][$key], '->load() converts values to PHP types'); } public function getTypeConversions() { - return array( - array('true_comment', true, true), - array('true', true, true), - array('false', false, true), - array('on', true, true), - array('off', false, true), - array('yes', true, true), - array('no', false, true), - array('none', false, true), - array('null', null, true), - array('constant', PHP_VERSION, true), - array('12', 12, true), - array('12_string', '12', true), - array('12_comment', 12, true), - array('12_string_comment', '12', true), - array('12_string_comment_again', '12', true), - array('-12', -12, true), - array('1', 1, true), - array('0', 0, true), - array('0b0110', bindec('0b0110'), false), // not supported by INI_SCANNER_TYPED - array('11112222333344445555', '1111,2222,3333,4444,5555', true), - array('0777', 0777, false), // not supported by INI_SCANNER_TYPED - array('255', 0xFF, false), // not supported by INI_SCANNER_TYPED - array('100.0', 1e2, false), // not supported by INI_SCANNER_TYPED - array('-120.0', -1.2E2, false), // not supported by INI_SCANNER_TYPED - array('-10100.1', -10100.1, false), // not supported by INI_SCANNER_TYPED - array('-10,100.1', '-10,100.1', true), - ); + return [ + ['true_comment', true, true], + ['true', true, true], + ['false', false, true], + ['on', true, true], + ['off', false, true], + ['yes', true, true], + ['no', false, true], + ['none', false, true], + ['null', null, true], + ['constant', PHP_VERSION, true], + ['12', 12, true], + ['12_string', '12', true], + ['12_quoted_number', 12, false], // INI_SCANNER_RAW removes the double quotes + ['12_comment', 12, true], + ['12_string_comment', '12', true], + ['12_quoted_number_comment', 12, false], // INI_SCANNER_RAW removes the double quotes + ['-12', -12, true], + ['1', 1, true], + ['0', 0, true], + ['0b0110', bindec('0b0110'), false], // not supported by INI_SCANNER_TYPED + ['11112222333344445555', '1111,2222,3333,4444,5555', true], + ['0777', 0777, false], // not supported by INI_SCANNER_TYPED + ['255', 0xFF, false], // not supported by INI_SCANNER_TYPED + ['100.0', 1e2, false], // not supported by INI_SCANNER_TYPED + ['-120.0', -1.2E2, false], // not supported by INI_SCANNER_TYPED + ['-10100.1', -10100.1, false], // not supported by INI_SCANNER_TYPED + ['-10,100.1', '-10,100.1', true], + ]; } /** diff --git a/vendor/symfony/dependency-injection/Tests/Loader/LoaderResolverTest.php b/vendor/symfony/dependency-injection/Tests/Loader/LoaderResolverTest.php index cb2d6ddcc248f92cf1f470a06939e65fa9007c66..9167e18cedcab2ce05a5abb72a70e12de24e2329 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/LoaderResolverTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/LoaderResolverTest.php @@ -33,23 +33,23 @@ protected function setUp() self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); $container = new ContainerBuilder(); - $this->resolver = new LoaderResolver(array( + $this->resolver = new LoaderResolver([ new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')), new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')), new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/ini')), new PhpFileLoader($container, new FileLocator(self::$fixturesPath.'/php')), new ClosureLoader($container), - )); + ]); } public function provideResourcesToLoad() { - return array( - array('ini_with_wrong_ext.xml', 'ini', IniFileLoader::class), - array('xml_with_wrong_ext.php', 'xml', XmlFileLoader::class), - array('php_with_wrong_ext.yml', 'php', PhpFileLoader::class), - array('yaml_with_wrong_ext.ini', 'yaml', YamlFileLoader::class), - ); + return [ + ['ini_with_wrong_ext.xml', 'ini', IniFileLoader::class], + ['xml_with_wrong_ext.php', 'xml', XmlFileLoader::class], + ['php_with_wrong_ext.yml', 'php', PhpFileLoader::class], + ['yaml_with_wrong_ext.ini', 'yaml', YamlFileLoader::class], + ]; } /** diff --git a/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php index e0a21e88051d92c20f6e642fe811b2bc23042229..4f7c16890b121a58caffd874f6aeed80eb9f7bda 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php @@ -66,14 +66,14 @@ public function testConfig($file) public function provideConfig() { - yield array('basic'); - yield array('defaults'); - yield array('instanceof'); - yield array('prototype'); - yield array('child'); + yield ['basic']; + yield ['defaults']; + yield ['instanceof']; + yield ['prototype']; + yield ['child']; if (\PHP_VERSION_ID >= 70000) { - yield array('php7'); + yield ['php7']; } } diff --git a/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php index 969bb09f0ce039a14191ee54c47968fac4312130..d89887acca9ea1f67fbc1ee502a89b77caf6fcbb 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php @@ -18,6 +18,7 @@ use Symfony\Component\Config\Resource\GlobResource; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\Loader\IniFileLoader; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; @@ -66,7 +67,7 @@ public function testParseFile() $this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); - $this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); @@ -80,7 +81,7 @@ public function testParseFile() $this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD'); - $this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD'); @@ -111,10 +112,10 @@ public function testLoadParameters() $loader->load('services2.xml'); $actual = $container->getParameterBag()->all(); - $expected = array( + $expected = [ 'a string', 'foo' => 'bar', - 'values' => array( + 'values' => [ 0, 'integer' => 4, 100 => null, @@ -126,11 +127,11 @@ public function testLoadParameters() 'float' => 1.3, 1000.3, 'a string', - array('foo', 'bar'), - ), - 'mixedcase' => array('MixedCaseKey' => 'value'), + ['foo', 'bar'], + ], + 'mixedcase' => ['MixedCaseKey' => 'value'], 'constant' => PHP_EOL, - ); + ]; $this->assertEquals($expected, $actual, '->load() converts XML values to PHP ones'); } @@ -138,19 +139,19 @@ public function testLoadParameters() public function testLoadImports() { $container = new ContainerBuilder(); - $resolver = new LoaderResolver(array( + $resolver = new LoaderResolver([ new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/ini')), new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yml')), $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')), - )); + ]); $loader->setResolver($resolver); $loader->load('services4.xml'); $actual = $container->getParameterBag()->all(); - $expected = array( + $expected = [ 'a string', 'foo' => 'bar', - 'values' => array( + 'values' => [ 0, 'integer' => 4, 100 => null, @@ -162,15 +163,15 @@ public function testLoadImports() 'float' => 1.3, 1000.3, 'a string', - array('foo', 'bar'), - ), - 'mixedcase' => array('MixedCaseKey' => 'value'), + ['foo', 'bar'], + ], + 'mixedcase' => ['MixedCaseKey' => 'value'], 'constant' => PHP_EOL, 'bar' => '%foo%', 'imported_from_ini' => true, 'imported_from_yaml' => true, 'with_wrong_ext' => 'from yaml', - ); + ]; $this->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files'); $this->assertTrue($actual['imported_from_ini']); @@ -265,16 +266,16 @@ public function testLoadServices() $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts <service> element to Definition instances'); $this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute'); $this->assertEquals('%path%/foo.php', $services['file']->getFile(), '->load() parses the file tag'); - $this->assertEquals(array('foo', new Reference('foo'), array(true, false)), $services['arguments']->getArguments(), '->load() parses the argument tags'); + $this->assertEquals(['foo', new Reference('foo'), [true, false]], $services['arguments']->getArguments(), '->load() parses the argument tags'); $this->assertEquals('sc_configure', $services['configurator1']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals(array(new Reference('baz'), 'configure'), $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals(array('BazClass', 'configureStatic'), $services['configurator3']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals(array(array('setBar', array()), array('setBar', array(new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')))), $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); - $this->assertEquals(array(array('setBar', array('foo', new Reference('foo'), array(true, false)))), $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals([new Reference('baz'), 'configure'], $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals(['BazClass', 'configureStatic'], $services['configurator3']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals([['setBar', []], ['setBar', [new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]]], $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals([['setBar', ['foo', new Reference('foo'), [true, false]]]], $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); $this->assertEquals('factory', $services['new_factory1']->getFactory(), '->load() parses the factory tag'); - $this->assertEquals(array(new Reference('baz'), 'getClass'), $services['new_factory2']->getFactory(), '->load() parses the factory tag'); - $this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag'); - $this->assertSame(array(null, 'getInstance'), $services['new_factory4']->getFactory(), '->load() accepts factory tag without class'); + $this->assertEquals([new Reference('baz'), 'getClass'], $services['new_factory2']->getFactory(), '->load() parses the factory tag'); + $this->assertEquals(['BazClass', 'getInstance'], $services['new_factory3']->getFactory(), '->load() parses the factory tag'); + $this->assertSame([null, 'getInstance'], $services['new_factory4']->getFactory(), '->load() accepts factory tag without class'); $aliases = $container->getAliases(); $this->assertArrayHasKey('alias_for_foo', $aliases, '->load() parses <service> elements'); @@ -284,9 +285,9 @@ public function testLoadServices() $this->assertEquals('foo', (string) $aliases['another_alias_for_foo']); $this->assertFalse($aliases['another_alias_for_foo']->isPublic()); - $this->assertEquals(array('decorated', null, 0), $services['decorator_service']->getDecoratedService()); - $this->assertEquals(array('decorated', 'decorated.pif-pouf', 0), $services['decorator_service_with_name']->getDecoratedService()); - $this->assertEquals(array('decorated', 'decorated.pif-pouf', 5), $services['decorator_service_with_name_and_priority']->getDecoratedService()); + $this->assertEquals(['decorated', null, 0], $services['decorator_service']->getDecoratedService()); + $this->assertEquals(['decorated', 'decorated.pif-pouf', 0], $services['decorator_service_with_name']->getDecoratedService()); + $this->assertEquals(['decorated', 'decorated.pif-pouf', 5], $services['decorator_service_with_name_and_priority']->getDecoratedService()); } public function testParsesIteratorArgument() @@ -297,7 +298,7 @@ public function testParsesIteratorArgument() $lazyDefinition = $container->getDefinition('lazy_context'); - $this->assertEquals(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))), new IteratorArgument(array())), $lazyDefinition->getArguments(), '->load() parses lazy arguments'); + $this->assertEquals([new IteratorArgument(['k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')]), new IteratorArgument([])], $lazyDefinition->getArguments(), '->load() parses lazy arguments'); } public function testParsesTags() @@ -367,27 +368,27 @@ public function testConvertDomElementToArray() $doc = new \DOMDocument('1.0'); $doc->loadXML('<foo foo="bar" />'); - $this->assertEquals(array('foo' => 'bar'), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + $this->assertEquals(['foo' => 'bar'], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); $doc = new \DOMDocument('1.0'); $doc->loadXML('<foo><foo>bar</foo></foo>'); - $this->assertEquals(array('foo' => 'bar'), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + $this->assertEquals(['foo' => 'bar'], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); $doc = new \DOMDocument('1.0'); $doc->loadXML('<foo><foo>bar<foo>bar</foo></foo></foo>'); - $this->assertEquals(array('foo' => array('value' => 'bar', 'foo' => 'bar')), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + $this->assertEquals(['foo' => ['value' => 'bar', 'foo' => 'bar']], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); $doc = new \DOMDocument('1.0'); $doc->loadXML('<foo><foo></foo></foo>'); - $this->assertEquals(array('foo' => null), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + $this->assertEquals(['foo' => null], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); $doc = new \DOMDocument('1.0'); $doc->loadXML('<foo><foo><!-- foo --></foo></foo>'); - $this->assertEquals(array('foo' => null), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + $this->assertEquals(['foo' => null], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); $doc = new \DOMDocument('1.0'); $doc->loadXML('<foo><foo foo="bar"/><foo foo="bar"/></foo>'); - $this->assertEquals(array('foo' => array(array('foo' => 'bar'), array('foo' => 'bar'))), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + $this->assertEquals(['foo' => [['foo' => 'bar'], ['foo' => 'bar']]], XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); } public function testExtensions() @@ -436,7 +437,7 @@ public function testExtensions() $this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); - $this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); @@ -476,7 +477,7 @@ public function testExtensionInPhar() $this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); - $this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); @@ -527,7 +528,7 @@ public function testDocTypeIsNotAllowed() $this->fail('->load() throws an InvalidArgumentException if the configuration contains a document type'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type'); - $this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type'); $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type'); @@ -544,7 +545,7 @@ public function testXmlNamespaces() $this->assertArrayHasKey('foo', $services, '->load() parses <srv:service> elements'); $this->assertCount(1, $services['foo']->getTag('foo.tag'), '->load parses <srv:tag> elements'); - $this->assertEquals(array(array('setBar', array('foo'))), $services['foo']->getMethodCalls(), '->load() parses the <srv:call> tag'); + $this->assertEquals([['setBar', ['foo']]], $services['foo']->getMethodCalls(), '->load() parses the <srv:call> tag'); } public function testLoadIndexedArguments() @@ -553,7 +554,7 @@ public function testLoadIndexedArguments() $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); $loader->load('services14.xml'); - $this->assertEquals(array('index_0' => 'app'), $container->findDefinition('logger')->getArguments()); + $this->assertEquals(['index_0' => 'app'], $container->findDefinition('logger')->getArguments()); } public function testLoadInlinedServices() @@ -599,7 +600,7 @@ public function testType() $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); $loader->load('services22.xml'); - $this->assertEquals(array('Bar', 'Baz'), $container->getDefinition('foo')->getAutowiringTypes()); + $this->assertEquals(['Bar', 'Baz'], $container->getDefinition('foo')->getAutowiringTypes()); } public function testAutowire() @@ -629,14 +630,14 @@ public function testPrototype() $ids = array_keys($container->getDefinitions()); sort($ids); - $this->assertSame(array(Prototype\Foo::class, Prototype\Sub\Bar::class, 'service_container'), $ids); + $this->assertSame([Prototype\Foo::class, Prototype\Sub\Bar::class, 'service_container'], $ids); $resources = $container->getResources(); $fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR; - $this->assertTrue(false !== array_search(new FileResource($fixturesDir.'xml'.\DIRECTORY_SEPARATOR.'services_prototype.xml'), $resources)); - $this->assertTrue(false !== array_search(new GlobResource($fixturesDir.'Prototype', '/*', true), $resources)); $resources = array_map('strval', $resources); + $this->assertContains((string) (new FileResource($fixturesDir.'xml'.\DIRECTORY_SEPARATOR.'services_prototype.xml')), $resources); + $this->assertContains((string) (new GlobResource($fixturesDir.'Prototype', '/*', true)), $resources); $this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources); $this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar', $resources); } @@ -663,7 +664,7 @@ public function testArgumentWithKeyOutsideCollection() $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); $loader->load('with_key_outside_collection.xml'); - $this->assertSame(array('type' => 'foo', 'bar'), $container->getDefinition('foo')->getArguments()); + $this->assertSame(['type' => 'foo', 'bar'], $container->getDefinition('foo')->getArguments()); } public function testDefaults() @@ -673,7 +674,7 @@ public function testDefaults() $loader->load('services28.xml'); $this->assertFalse($container->getDefinition('with_defaults')->isPublic()); - $this->assertSame(array('foo' => array(array())), $container->getDefinition('with_defaults')->getTags()); + $this->assertSame(['foo' => [[]]], $container->getDefinition('with_defaults')->getTags()); $this->assertTrue($container->getDefinition('with_defaults')->isAutowired()); $this->assertArrayNotHasKey('public', $container->getDefinition('with_defaults')->getChanges()); $this->assertArrayNotHasKey('autowire', $container->getDefinition('with_defaults')->getChanges()); @@ -682,12 +683,12 @@ public function testDefaults() $this->assertTrue($container->getDefinition('no_defaults')->isPublic()); - $this->assertSame(array('foo' => array(array())), $container->getDefinition('no_defaults')->getTags()); + $this->assertSame(['foo' => [[]]], $container->getDefinition('no_defaults')->getTags()); $this->assertFalse($container->getDefinition('no_defaults')->isAutowired()); $this->assertTrue($container->getDefinition('child_def')->isPublic()); - $this->assertSame(array('foo' => array(array())), $container->getDefinition('child_def')->getTags()); + $this->assertSame(['foo' => [[]]], $container->getDefinition('child_def')->getTags()); $this->assertFalse($container->getDefinition('child_def')->isAutowired()); $definitions = $container->getDefinitions(); @@ -698,7 +699,7 @@ public function testDefaults() $this->assertSame('bar', key($definitions)); $this->assertTrue($anonymous->isPublic()); $this->assertTrue($anonymous->isAutowired()); - $this->assertSame(array('foo' => array(array())), $anonymous->getTags()); + $this->assertSame(['foo' => [[]]], $anonymous->getTags()); } public function testNamedArguments() @@ -707,12 +708,12 @@ public function testNamedArguments() $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); $loader->load('services_named_args.xml'); - $this->assertEquals(array('$apiKey' => 'ABCD', CaseSensitiveClass::class => null), $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); + $this->assertEquals(['$apiKey' => 'ABCD', CaseSensitiveClass::class => null], $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); $container->compile(); - $this->assertEquals(array(null, 'ABCD'), $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); - $this->assertEquals(array(array('setApiKey', array('123'))), $container->getDefinition(NamedArgumentsDummy::class)->getMethodCalls()); + $this->assertEquals([null, 'ABCD'], $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); + $this->assertEquals([['setApiKey', ['123']]], $container->getDefinition(NamedArgumentsDummy::class)->getMethodCalls()); } public function testInstanceof() @@ -725,7 +726,7 @@ public function testInstanceof() $definition = $container->getDefinition(Bar::class); $this->assertTrue($definition->isAutowired()); $this->assertTrue($definition->isLazy()); - $this->assertSame(array('foo' => array(array()), 'bar' => array(array())), $definition->getTags()); + $this->assertSame(['foo' => [[]], 'bar' => [[]]], $definition->getTags()); } /** @@ -782,29 +783,41 @@ public function testBindings() $container->compile(); $definition = $container->getDefinition('bar'); - $this->assertEquals(array( + $this->assertEquals([ 'NonExistent' => null, BarInterface::class => new Reference(Bar::class), - '$foo' => array(null), + '$foo' => [null], '$quz' => 'quz', '$factory' => 'factory', - ), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); - $this->assertEquals(array( + ], array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); + $this->assertEquals([ 'quz', null, new Reference(Bar::class), - array(null), - ), $definition->getArguments()); + [null], + ], $definition->getArguments()); $definition = $container->getDefinition(Bar::class); - $this->assertEquals(array( + $this->assertEquals([ null, 'factory', - ), $definition->getArguments()); - $this->assertEquals(array( + ], $definition->getArguments()); + $this->assertEquals([ 'NonExistent' => null, '$quz' => 'quz', '$factory' => 'factory', - ), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); + ], array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); + } + + public function testTsantosContainer() + { + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('services_tsantos.xml'); + $container->compile(); + + $dumper = new PhpDumper($container); + $dump = $dumper->dump(); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_tsantos.php', $dumper->dump()); } } diff --git a/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php index b0938018520c5a086f281e4efd0f7c06b9fa3621..7bcf0ec0575845c09fdd709f9c730c134efae67f 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php @@ -83,17 +83,17 @@ public function testLoadInvalidFile($file) public function provideInvalidFiles() { - return array( - array('bad_parameters'), - array('bad_imports'), - array('bad_import'), - array('bad_services'), - array('bad_service'), - array('bad_calls'), - array('bad_format'), - array('nonvalid1'), - array('nonvalid2'), - ); + return [ + ['bad_parameters'], + ['bad_imports'], + ['bad_import'], + ['bad_services'], + ['bad_service'], + ['bad_calls'], + ['bad_format'], + ['nonvalid1'], + ['nonvalid2'], + ]; } public function testLoadParameters() @@ -101,33 +101,33 @@ public function testLoadParameters() $container = new ContainerBuilder(); $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); $loader->load('services2.yml'); - $this->assertEquals(array('foo' => 'bar', 'mixedcase' => array('MixedCaseKey' => 'value'), 'values' => array(true, false, 0, 1000.3, PHP_INT_MAX), 'bar' => 'foo', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar')), $container->getParameterBag()->all(), '->load() converts YAML keys to lowercase'); + $this->assertEquals(['foo' => 'bar', 'mixedcase' => ['MixedCaseKey' => 'value'], 'values' => [true, false, 0, 1000.3, PHP_INT_MAX], 'bar' => 'foo', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar')], $container->getParameterBag()->all(), '->load() converts YAML keys to lowercase'); } public function testLoadImports() { $container = new ContainerBuilder(); - $resolver = new LoaderResolver(array( + $resolver = new LoaderResolver([ new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/ini')), new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')), new PhpFileLoader($container, new FileLocator(self::$fixturesPath.'/php')), $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')), - )); + ]); $loader->setResolver($resolver); $loader->load('services4.yml'); $actual = $container->getParameterBag()->all(); - $expected = array( + $expected = [ 'foo' => 'bar', - 'values' => array(true, false, PHP_INT_MAX), + 'values' => [true, false, PHP_INT_MAX], 'bar' => '%foo%', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar'), - 'mixedcase' => array('MixedCaseKey' => 'value'), + 'mixedcase' => ['MixedCaseKey' => 'value'], 'imported_from_ini' => true, 'imported_from_xml' => true, 'with_wrong_ext' => 'from yaml', - ); + ]; $this->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files'); $this->assertTrue($actual['imported_from_ini']); @@ -146,17 +146,17 @@ public function testLoadServices() $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts service element to Definition instances'); $this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute'); $this->assertEquals('%path%/foo.php', $services['file']->getFile(), '->load() parses the file tag'); - $this->assertEquals(array('foo', new Reference('foo'), array(true, false)), $services['arguments']->getArguments(), '->load() parses the argument tags'); + $this->assertEquals(['foo', new Reference('foo'), [true, false]], $services['arguments']->getArguments(), '->load() parses the argument tags'); $this->assertEquals('sc_configure', $services['configurator1']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals(array(new Reference('baz'), 'configure'), $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals(array('BazClass', 'configureStatic'), $services['configurator3']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals(array(array('setBar', array()), array('setBar', array()), array('setBar', array(new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')))), $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); - $this->assertEquals(array(array('setBar', array('foo', new Reference('foo'), array(true, false)))), $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals([new Reference('baz'), 'configure'], $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals(['BazClass', 'configureStatic'], $services['configurator3']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals([['setBar', []], ['setBar', []], ['setBar', [new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]]], $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals([['setBar', ['foo', new Reference('foo'), [true, false]]]], $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); $this->assertEquals('factory', $services['new_factory1']->getFactory(), '->load() parses the factory tag'); - $this->assertEquals(array(new Reference('baz'), 'getClass'), $services['new_factory2']->getFactory(), '->load() parses the factory tag'); - $this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag'); - $this->assertSame(array(null, 'getInstance'), $services['new_factory4']->getFactory(), '->load() accepts factory tag without class'); - $this->assertEquals(array('foo', new Reference('baz')), $services['Acme\WithShortCutArgs']->getArguments(), '->load() parses short service definition'); + $this->assertEquals([new Reference('baz'), 'getClass'], $services['new_factory2']->getFactory(), '->load() parses the factory tag'); + $this->assertEquals(['BazClass', 'getInstance'], $services['new_factory3']->getFactory(), '->load() parses the factory tag'); + $this->assertSame([null, 'getInstance'], $services['new_factory4']->getFactory(), '->load() accepts factory tag without class'); + $this->assertEquals(['foo', new Reference('baz')], $services['Acme\WithShortCutArgs']->getArguments(), '->load() parses short service definition'); $aliases = $container->getAliases(); $this->assertArrayHasKey('alias_for_foo', $aliases, '->load() parses aliases'); @@ -169,9 +169,9 @@ public function testLoadServices() $this->assertEquals('foo', (string) $aliases['another_third_alias_for_foo']); $this->assertTrue($aliases['another_third_alias_for_foo']->isPublic()); - $this->assertEquals(array('decorated', null, 0), $services['decorator_service']->getDecoratedService()); - $this->assertEquals(array('decorated', 'decorated.pif-pouf', 0), $services['decorator_service_with_name']->getDecoratedService()); - $this->assertEquals(array('decorated', 'decorated.pif-pouf', 5), $services['decorator_service_with_name_and_priority']->getDecoratedService()); + $this->assertEquals(['decorated', null, 0], $services['decorator_service']->getDecoratedService()); + $this->assertEquals(['decorated', 'decorated.pif-pouf', 0], $services['decorator_service_with_name']->getDecoratedService()); + $this->assertEquals(['decorated', 'decorated.pif-pouf', 5], $services['decorator_service_with_name_and_priority']->getDecoratedService()); } public function testLoadFactoryShortSyntax() @@ -181,8 +181,8 @@ public function testLoadFactoryShortSyntax() $loader->load('services14.yml'); $services = $container->getDefinitions(); - $this->assertEquals(array(new Reference('baz'), 'getClass'), $services['factory']->getFactory(), '->load() parses the factory tag with service:method'); - $this->assertEquals(array('FooBacFactory', 'createFooBar'), $services['factory_with_static_call']->getFactory(), '->load() parses the factory tag with Class::method'); + $this->assertEquals([new Reference('baz'), 'getClass'], $services['factory']->getFactory(), '->load() parses the factory tag with service:method'); + $this->assertEquals(['FooBacFactory', 'createFooBar'], $services['factory_with_static_call']->getFactory(), '->load() parses the factory tag with Class::method'); } public function testLoadConfiguratorShortSyntax() @@ -192,8 +192,8 @@ public function testLoadConfiguratorShortSyntax() $loader->load('services_configurator_short_syntax.yml'); $services = $container->getDefinitions(); - $this->assertEquals(array(new Reference('foo_bar_configurator'), 'configure'), $services['foo_bar']->getConfigurator(), '->load() parses the configurator tag with service:method'); - $this->assertEquals(array('FooBarConfigurator', 'configureFooBar'), $services['foo_bar_with_static_call']->getConfigurator(), '->load() parses the configurator tag with Class::method'); + $this->assertEquals([new Reference('foo_bar_configurator'), 'configure'], $services['foo_bar']->getConfigurator(), '->load() parses the configurator tag with service:method'); + $this->assertEquals(['FooBarConfigurator', 'configureFooBar'], $services['foo_bar_with_static_call']->getConfigurator(), '->load() parses the configurator tag with Class::method'); } public function testExtensions() @@ -229,7 +229,7 @@ public function testExtensionWithNullConfig() $loader->load('null_config.yml'); $container->compile(); - $this->assertSame(array(null), $container->getParameter('project.configs')); + $this->assertSame([null], $container->getParameter('project.configs')); } public function testSupports() @@ -295,9 +295,9 @@ public function testLoadYamlOnlyWithKeys() $loader->load('services21.yml'); $definition = $container->getDefinition('manager'); - $this->assertEquals(array(array('setLogger', array(new Reference('logger'))), array('setClass', array('User'))), $definition->getMethodCalls()); - $this->assertEquals(array(true), $definition->getArguments()); - $this->assertEquals(array('manager' => array(array('alias' => 'user'))), $definition->getTags()); + $this->assertEquals([['setLogger', [new Reference('logger')]], ['setClass', ['User']]], $definition->getMethodCalls()); + $this->assertEquals([true], $definition->getArguments()); + $this->assertEquals(['manager' => [['alias' => 'user']]], $definition->getTags()); } /** @@ -347,8 +347,8 @@ public function testTypes() $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); $loader->load('services22.yml'); - $this->assertEquals(array('Foo', 'Bar'), $container->getDefinition('foo_service')->getAutowiringTypes()); - $this->assertEquals(array('Foo'), $container->getDefinition('baz_service')->getAutowiringTypes()); + $this->assertEquals(['Foo', 'Bar'], $container->getDefinition('foo_service')->getAutowiringTypes()); + $this->assertEquals(['Foo'], $container->getDefinition('baz_service')->getAutowiringTypes()); } public function testParsesIteratorArgument() @@ -359,7 +359,7 @@ public function testParsesIteratorArgument() $lazyDefinition = $container->getDefinition('lazy_context'); - $this->assertEquals(array(new IteratorArgument(array('k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container'))), new IteratorArgument(array())), $lazyDefinition->getArguments(), '->load() parses lazy arguments'); + $this->assertEquals([new IteratorArgument(['k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')]), new IteratorArgument([])], $lazyDefinition->getArguments(), '->load() parses lazy arguments'); } public function testAutowire() @@ -389,14 +389,14 @@ public function testPrototype() $ids = array_keys($container->getDefinitions()); sort($ids); - $this->assertSame(array(Prototype\Foo::class, Prototype\Sub\Bar::class, 'service_container'), $ids); + $this->assertSame([Prototype\Foo::class, Prototype\Sub\Bar::class, 'service_container'], $ids); $resources = $container->getResources(); $fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR; - $this->assertTrue(false !== array_search(new FileResource($fixturesDir.'yaml'.\DIRECTORY_SEPARATOR.'services_prototype.yml'), $resources)); - $this->assertTrue(false !== array_search(new GlobResource($fixturesDir.'Prototype', '', true), $resources)); $resources = array_map('strval', $resources); + $this->assertContains((string) (new FileResource($fixturesDir.'yaml'.\DIRECTORY_SEPARATOR.'services_prototype.yml')), $resources); + $this->assertContains((string) (new GlobResource($fixturesDir.'Prototype', '', true)), $resources); $this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources); $this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar', $resources); } @@ -410,13 +410,13 @@ public function testPrototypeWithNamespace() $ids = array_keys($container->getDefinitions()); sort($ids); - $this->assertSame(array( + $this->assertSame([ Prototype\OtherDir\Component1\Dir1\Service1::class, Prototype\OtherDir\Component1\Dir2\Service2::class, Prototype\OtherDir\Component2\Dir1\Service4::class, Prototype\OtherDir\Component2\Dir2\Service5::class, 'service_container', - ), $ids); + ], $ids); $this->assertTrue($container->getDefinition(Prototype\OtherDir\Component1\Dir1\Service1::class)->hasTag('foo')); $this->assertTrue($container->getDefinition(Prototype\OtherDir\Component2\Dir1\Service4::class)->hasTag('foo')); @@ -447,7 +447,7 @@ public function testDefaults() $loader->load('services28.yml'); $this->assertFalse($container->getDefinition('with_defaults')->isPublic()); - $this->assertSame(array('foo' => array(array())), $container->getDefinition('with_defaults')->getTags()); + $this->assertSame(['foo' => [[]]], $container->getDefinition('with_defaults')->getTags()); $this->assertTrue($container->getDefinition('with_defaults')->isAutowired()); $this->assertArrayNotHasKey('public', $container->getDefinition('with_defaults')->getChanges()); $this->assertArrayNotHasKey('autowire', $container->getDefinition('with_defaults')->getChanges()); @@ -456,7 +456,7 @@ public function testDefaults() $this->assertFalse($container->getAlias('with_defaults_aliased_short')->isPublic()); $this->assertFalse($container->getDefinition('Acme\WithShortCutArgs')->isPublic()); - $this->assertSame(array('foo' => array(array())), $container->getDefinition('Acme\WithShortCutArgs')->getTags()); + $this->assertSame(['foo' => [[]]], $container->getDefinition('Acme\WithShortCutArgs')->getTags()); $this->assertTrue($container->getDefinition('Acme\WithShortCutArgs')->isAutowired()); $container->compile(); @@ -465,14 +465,14 @@ public function testDefaults() $this->assertTrue($container->getDefinition('no_defaults')->isPublic()); // foo tag is inherited from defaults - $this->assertSame(array('foo' => array(array())), $container->getDefinition('with_null')->getTags()); - $this->assertSame(array('foo' => array(array())), $container->getDefinition('no_defaults')->getTags()); + $this->assertSame(['foo' => [[]]], $container->getDefinition('with_null')->getTags()); + $this->assertSame(['foo' => [[]]], $container->getDefinition('no_defaults')->getTags()); $this->assertTrue($container->getDefinition('with_null')->isAutowired()); $this->assertFalse($container->getDefinition('no_defaults')->isAutowired()); $this->assertTrue($container->getDefinition('child_def')->isPublic()); - $this->assertSame(array('foo' => array(array())), $container->getDefinition('child_def')->getTags()); + $this->assertSame(['foo' => [[]]], $container->getDefinition('child_def')->getTags()); $this->assertFalse($container->getDefinition('child_def')->isAutowired()); } @@ -482,14 +482,14 @@ public function testNamedArguments() $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); $loader->load('services_named_args.yml'); - $this->assertEquals(array(null, '$apiKey' => 'ABCD'), $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); - $this->assertEquals(array('$apiKey' => 'ABCD', CaseSensitiveClass::class => null), $container->getDefinition('another_one')->getArguments()); + $this->assertEquals([null, '$apiKey' => 'ABCD'], $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); + $this->assertEquals(['$apiKey' => 'ABCD', CaseSensitiveClass::class => null], $container->getDefinition('another_one')->getArguments()); $container->compile(); - $this->assertEquals(array(null, 'ABCD'), $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); - $this->assertEquals(array(null, 'ABCD'), $container->getDefinition('another_one')->getArguments()); - $this->assertEquals(array(array('setApiKey', array('123'))), $container->getDefinition('another_one')->getMethodCalls()); + $this->assertEquals([null, 'ABCD'], $container->getDefinition(NamedArgumentsDummy::class)->getArguments()); + $this->assertEquals([null, 'ABCD'], $container->getDefinition('another_one')->getArguments()); + $this->assertEquals([['setApiKey', ['123']]], $container->getDefinition('another_one')->getMethodCalls()); } public function testInstanceof() @@ -502,7 +502,7 @@ public function testInstanceof() $definition = $container->getDefinition(Bar::class); $this->assertTrue($definition->isAutowired()); $this->assertTrue($definition->isLazy()); - $this->assertSame(array('foo' => array(array()), 'bar' => array(array())), $definition->getTags()); + $this->assertSame(['foo' => [[]], 'bar' => [[]]], $definition->getTags()); } /** @@ -586,7 +586,7 @@ public function testAnonymousServices() $this->assertCount(1, $args); $this->assertInstanceOf(Reference::class, $args[0]); $this->assertTrue($container->has((string) $args[0])); - $this->assertRegExp('/^\d+_Bar[._A-Za-z0-9]{7}$/', (string) $args[0]); + $this->assertRegExp('/^\d+_Bar~[._A-Za-z0-9]{7}$/', (string) $args[0]); $anonymous = $container->getDefinition((string) $args[0]); $this->assertEquals('Bar', $anonymous->getClass()); @@ -598,7 +598,7 @@ public function testAnonymousServices() $this->assertInternalType('array', $factory); $this->assertInstanceOf(Reference::class, $factory[0]); $this->assertTrue($container->has((string) $factory[0])); - $this->assertRegExp('/^\d+_Quz[._A-Za-z0-9]{7}$/', (string) $factory[0]); + $this->assertRegExp('/^\d+_Quz~[._A-Za-z0-9]{7}$/', (string) $factory[0]); $this->assertEquals('constructFoo', $factory[1]); $anonymous = $container->getDefinition((string) $factory[0]); @@ -707,29 +707,29 @@ public function testBindings() $container->compile(); $definition = $container->getDefinition('bar'); - $this->assertEquals(array( + $this->assertEquals([ 'NonExistent' => null, BarInterface::class => new Reference(Bar::class), - '$foo' => array(null), + '$foo' => [null], '$quz' => 'quz', '$factory' => 'factory', - ), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); - $this->assertEquals(array( + ], array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); + $this->assertEquals([ 'quz', null, new Reference(Bar::class), - array(null), - ), $definition->getArguments()); + [null], + ], $definition->getArguments()); $definition = $container->getDefinition(Bar::class); - $this->assertEquals(array( + $this->assertEquals([ null, 'factory', - ), $definition->getArguments()); - $this->assertEquals(array( + ], $definition->getArguments()); + $this->assertEquals([ 'NonExistent' => null, '$quz' => 'quz', '$factory' => 'factory', - ), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); + ], array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); } } diff --git a/vendor/symfony/dependency-injection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/vendor/symfony/dependency-injection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php index 9abfb45d6ef9d0fbb725aecc48acad0dd6515615..e7c88d2bb58ec91162d4d39f75938e9cd1a2b6b4 100644 --- a/vendor/symfony/dependency-injection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php +++ b/vendor/symfony/dependency-injection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php @@ -137,7 +137,7 @@ public function testResolveThrowsOnBadDefaultValue() { $bag = new EnvPlaceholderParameterBag(); $bag->get('env(ARRAY_VAR)'); - $bag->set('env(ARRAY_VAR)', array()); + $bag->set('env(ARRAY_VAR)', []); $bag->resolve(); } @@ -158,7 +158,7 @@ public function testGetEnvAllowsNull() public function testGetThrowsOnBadDefaultValue() { $bag = new EnvPlaceholderParameterBag(); - $bag->set('env(ARRAY_VAR)', array()); + $bag->set('env(ARRAY_VAR)', []); $bag->get('env(ARRAY_VAR)'); $bag->resolve(); } diff --git a/vendor/symfony/dependency-injection/Tests/ParameterBag/FrozenParameterBagTest.php b/vendor/symfony/dependency-injection/Tests/ParameterBag/FrozenParameterBagTest.php index ef9a66f6cff72cf489e0abb912c636823b789566..b168e0c20a97604331b5508a9db7782df85579f8 100644 --- a/vendor/symfony/dependency-injection/Tests/ParameterBag/FrozenParameterBagTest.php +++ b/vendor/symfony/dependency-injection/Tests/ParameterBag/FrozenParameterBagTest.php @@ -18,10 +18,10 @@ class FrozenParameterBagTest extends TestCase { public function testConstructor() { - $parameters = array( + $parameters = [ 'foo' => 'foo', 'bar' => 'bar', - ); + ]; $bag = new FrozenParameterBag($parameters); $this->assertEquals($parameters, $bag->all(), '__construct() takes an array of parameters as its first argument'); } @@ -31,7 +31,7 @@ public function testConstructor() */ public function testClear() { - $bag = new FrozenParameterBag(array()); + $bag = new FrozenParameterBag([]); $bag->clear(); } @@ -40,7 +40,7 @@ public function testClear() */ public function testSet() { - $bag = new FrozenParameterBag(array()); + $bag = new FrozenParameterBag([]); $bag->set('foo', 'bar'); } @@ -49,8 +49,8 @@ public function testSet() */ public function testAdd() { - $bag = new FrozenParameterBag(array()); - $bag->add(array()); + $bag = new FrozenParameterBag([]); + $bag->add([]); } /** @@ -58,7 +58,7 @@ public function testAdd() */ public function testRemove() { - $bag = new FrozenParameterBag(array('foo' => 'bar')); + $bag = new FrozenParameterBag(['foo' => 'bar']); $bag->remove('foo'); } } diff --git a/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php b/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php index a04cc15c129f6fecf39bdc7150a2557401e6cd16..e67e393df77982529dbda0b0c268e6398bda0db1 100644 --- a/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php +++ b/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php @@ -21,36 +21,36 @@ class ParameterBagTest extends TestCase { public function testConstructor() { - $bag = new ParameterBag($parameters = array( + $bag = new ParameterBag($parameters = [ 'foo' => 'foo', 'bar' => 'bar', - )); + ]); $this->assertEquals($parameters, $bag->all(), '__construct() takes an array of parameters as its first argument'); } public function testClear() { - $bag = new ParameterBag($parameters = array( + $bag = new ParameterBag($parameters = [ 'foo' => 'foo', 'bar' => 'bar', - )); + ]); $bag->clear(); - $this->assertEquals(array(), $bag->all(), '->clear() removes all parameters'); + $this->assertEquals([], $bag->all(), '->clear() removes all parameters'); } public function testRemove() { - $bag = new ParameterBag(array( + $bag = new ParameterBag([ 'foo' => 'foo', 'bar' => 'bar', - )); + ]); $bag->remove('foo'); - $this->assertEquals(array('bar' => 'bar'), $bag->all(), '->remove() removes a parameter'); + $this->assertEquals(['bar' => 'bar'], $bag->all(), '->remove() removes a parameter'); } public function testGetSet() { - $bag = new ParameterBag(array('foo' => 'bar')); + $bag = new ParameterBag(['foo' => 'bar']); $bag->set('bar', 'foo'); $this->assertEquals('foo', $bag->get('bar'), '->set() sets the value of a new parameter'); @@ -71,12 +71,12 @@ public function testGetSet() */ public function testGetThrowParameterNotFoundException($parameterKey, $exceptionMessage) { - $bag = new ParameterBag(array( + $bag = new ParameterBag([ 'foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz', - 'fiz' => array('bar' => array('boo' => 12)), - )); + 'fiz' => ['bar' => ['boo' => 12]], + ]); if (method_exists($this, 'expectException')) { $this->expectException(ParameterNotFoundException::class); @@ -90,18 +90,18 @@ public function testGetThrowParameterNotFoundException($parameterKey, $exception public function provideGetThrowParameterNotFoundExceptionData() { - return array( - array('foo1', 'You have requested a non-existent parameter "foo1". Did you mean this: "foo"?'), - array('bag', 'You have requested a non-existent parameter "bag". Did you mean one of these: "bar", "baz"?'), - array('', 'You have requested a non-existent parameter "".'), + return [ + ['foo1', 'You have requested a non-existent parameter "foo1". Did you mean this: "foo"?'], + ['bag', 'You have requested a non-existent parameter "bag". Did you mean one of these: "bar", "baz"?'], + ['', 'You have requested a non-existent parameter "".'], - array('fiz.bar.boo', 'You have requested a non-existent parameter "fiz.bar.boo". You cannot access nested array items, do you want to inject "fiz" instead?'), - ); + ['fiz.bar.boo', 'You have requested a non-existent parameter "fiz.bar.boo". You cannot access nested array items, do you want to inject "fiz" instead?'], + ]; } public function testHas() { - $bag = new ParameterBag(array('foo' => 'bar')); + $bag = new ParameterBag(['foo' => 'bar']); $this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined'); $this->assertFalse($bag->has('bar'), '->has() returns false if a parameter is not defined'); } @@ -115,13 +115,13 @@ public function testHas() */ public function testMixedCase() { - $bag = new ParameterBag(array( + $bag = new ParameterBag([ 'foo' => 'foo', 'bar' => 'bar', - )); + ]); $bag->remove('BAR'); - $this->assertEquals(array('foo' => 'foo'), $bag->all(), '->remove() converts key to lowercase before removing'); + $this->assertEquals(['foo' => 'foo'], $bag->all(), '->remove() converts key to lowercase before removing'); $bag->set('Foo', 'baz1'); $this->assertEquals('baz1', $bag->get('foo'), '->set() converts the key to lowercase'); @@ -132,29 +132,29 @@ public function testMixedCase() public function testResolveValue() { - $bag = new ParameterBag(array()); + $bag = new ParameterBag([]); $this->assertEquals('foo', $bag->resolveValue('foo'), '->resolveValue() returns its argument unmodified if no placeholders are found'); - $bag = new ParameterBag(array('foo' => 'bar')); + $bag = new ParameterBag(['foo' => 'bar']); $this->assertEquals('I\'m a bar', $bag->resolveValue('I\'m a %foo%'), '->resolveValue() replaces placeholders by their values'); - $this->assertEquals(array('bar' => 'bar'), $bag->resolveValue(array('%foo%' => '%foo%')), '->resolveValue() replaces placeholders in keys and values of arrays'); - $this->assertEquals(array('bar' => array('bar' => array('bar' => 'bar'))), $bag->resolveValue(array('%foo%' => array('%foo%' => array('%foo%' => '%foo%')))), '->resolveValue() replaces placeholders in nested arrays'); + $this->assertEquals(['bar' => 'bar'], $bag->resolveValue(['%foo%' => '%foo%']), '->resolveValue() replaces placeholders in keys and values of arrays'); + $this->assertEquals(['bar' => ['bar' => ['bar' => 'bar']]], $bag->resolveValue(['%foo%' => ['%foo%' => ['%foo%' => '%foo%']]]), '->resolveValue() replaces placeholders in nested arrays'); $this->assertEquals('I\'m a %%foo%%', $bag->resolveValue('I\'m a %%foo%%'), '->resolveValue() supports % escaping by doubling it'); $this->assertEquals('I\'m a bar %%foo bar', $bag->resolveValue('I\'m a %foo% %%foo %foo%'), '->resolveValue() supports % escaping by doubling it'); - $this->assertEquals(array('foo' => array('bar' => array('ding' => 'I\'m a bar %%foo %%bar'))), $bag->resolveValue(array('foo' => array('bar' => array('ding' => 'I\'m a bar %%foo %%bar')))), '->resolveValue() supports % escaping by doubling it'); + $this->assertEquals(['foo' => ['bar' => ['ding' => 'I\'m a bar %%foo %%bar']]], $bag->resolveValue(['foo' => ['bar' => ['ding' => 'I\'m a bar %%foo %%bar']]]), '->resolveValue() supports % escaping by doubling it'); - $bag = new ParameterBag(array('foo' => true)); + $bag = new ParameterBag(['foo' => true]); $this->assertTrue($bag->resolveValue('%foo%'), '->resolveValue() replaces arguments that are just a placeholder by their value without casting them to strings'); - $bag = new ParameterBag(array('foo' => null)); + $bag = new ParameterBag(['foo' => null]); $this->assertNull($bag->resolveValue('%foo%'), '->resolveValue() replaces arguments that are just a placeholder by their value without casting them to strings'); - $bag = new ParameterBag(array('foo' => 'bar', 'baz' => '%%%foo% %foo%%% %%foo%% %%%foo%%%')); + $bag = new ParameterBag(['foo' => 'bar', 'baz' => '%%%foo% %foo%%% %%foo%% %%%foo%%%']); $this->assertEquals('%%bar bar%% %%foo%% %%bar%%', $bag->resolveValue('%baz%'), '->resolveValue() replaces params placed besides escaped %'); - $bag = new ParameterBag(array('baz' => '%%s?%%s')); + $bag = new ParameterBag(['baz' => '%%s?%%s']); $this->assertEquals('%%s?%%s', $bag->resolveValue('%baz%'), '->resolveValue() is not replacing greedily'); - $bag = new ParameterBag(array()); + $bag = new ParameterBag([]); try { $bag->resolveValue('%foobar%'); $this->fail('->resolveValue() throws an InvalidArgumentException if a placeholder references a non-existent parameter'); @@ -169,7 +169,7 @@ public function testResolveValue() $this->assertEquals('You have requested a non-existent parameter "foobar".', $e->getMessage(), '->resolveValue() throws a ParameterNotFoundException if a placeholder references a non-existent parameter'); } - $bag = new ParameterBag(array('foo' => 'a %bar%', 'bar' => array())); + $bag = new ParameterBag(['foo' => 'a %bar%', 'bar' => []]); try { $bag->resolveValue('%foo%'); $this->fail('->resolveValue() throws a RuntimeException when a parameter embeds another non-string parameter'); @@ -177,7 +177,7 @@ public function testResolveValue() $this->assertEquals('A string value must be composed of strings and/or numbers, but found parameter "bar" of type array inside string value "a %bar%".', $e->getMessage(), '->resolveValue() throws a RuntimeException when a parameter embeds another non-string parameter'); } - $bag = new ParameterBag(array('foo' => '%bar%', 'bar' => '%foobar%', 'foobar' => '%foo%')); + $bag = new ParameterBag(['foo' => '%bar%', 'bar' => '%foobar%', 'foobar' => '%foo%']); try { $bag->resolveValue('%foo%'); $this->fail('->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); @@ -185,7 +185,7 @@ public function testResolveValue() $this->assertEquals('Circular reference detected for parameter "foo" ("foo" > "bar" > "foobar" > "foo").', $e->getMessage(), '->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); } - $bag = new ParameterBag(array('foo' => 'a %bar%', 'bar' => 'a %foobar%', 'foobar' => 'a %foo%')); + $bag = new ParameterBag(['foo' => 'a %bar%', 'bar' => 'a %foobar%', 'foobar' => 'a %foo%']); try { $bag->resolveValue('%foo%'); $this->fail('->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); @@ -193,13 +193,13 @@ public function testResolveValue() $this->assertEquals('Circular reference detected for parameter "foo" ("foo" > "bar" > "foobar" > "foo").', $e->getMessage(), '->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); } - $bag = new ParameterBag(array('host' => 'foo.bar', 'port' => 1337)); + $bag = new ParameterBag(['host' => 'foo.bar', 'port' => 1337]); $this->assertEquals('foo.bar:1337', $bag->resolveValue('%host%:%port%')); } public function testResolveIndicatesWhyAParameterIsNeeded() { - $bag = new ParameterBag(array('foo' => '%bar%')); + $bag = new ParameterBag(['foo' => '%bar%']); try { $bag->resolve(); @@ -207,7 +207,7 @@ public function testResolveIndicatesWhyAParameterIsNeeded() $this->assertEquals('The parameter "foo" has a dependency on a non-existent parameter "bar".', $e->getMessage()); } - $bag = new ParameterBag(array('foo' => '%bar%')); + $bag = new ParameterBag(['foo' => '%bar%']); try { $bag->resolve(); @@ -218,28 +218,28 @@ public function testResolveIndicatesWhyAParameterIsNeeded() public function testResolveUnescapesValue() { - $bag = new ParameterBag(array( - 'foo' => array('bar' => array('ding' => 'I\'m a bar %%foo %%bar')), + $bag = new ParameterBag([ + 'foo' => ['bar' => ['ding' => 'I\'m a bar %%foo %%bar']], 'bar' => 'I\'m a %%foo%%', - )); + ]); $bag->resolve(); $this->assertEquals('I\'m a %foo%', $bag->get('bar'), '->resolveValue() supports % escaping by doubling it'); - $this->assertEquals(array('bar' => array('ding' => 'I\'m a bar %foo %bar')), $bag->get('foo'), '->resolveValue() supports % escaping by doubling it'); + $this->assertEquals(['bar' => ['ding' => 'I\'m a bar %foo %bar']], $bag->get('foo'), '->resolveValue() supports % escaping by doubling it'); } public function testEscapeValue() { $bag = new ParameterBag(); - $bag->add(array( - 'foo' => $bag->escapeValue(array('bar' => array('ding' => 'I\'m a bar %foo %bar', 'zero' => null))), + $bag->add([ + 'foo' => $bag->escapeValue(['bar' => ['ding' => 'I\'m a bar %foo %bar', 'zero' => null]]), 'bar' => $bag->escapeValue('I\'m a %foo%'), - )); + ]); $this->assertEquals('I\'m a %%foo%%', $bag->get('bar'), '->escapeValue() escapes % by doubling it'); - $this->assertEquals(array('bar' => array('ding' => 'I\'m a bar %%foo %%bar', 'zero' => null)), $bag->get('foo'), '->escapeValue() escapes % by doubling it'); + $this->assertEquals(['bar' => ['ding' => 'I\'m a bar %%foo %%bar', 'zero' => null]], $bag->get('foo'), '->escapeValue() escapes % by doubling it'); } /** @@ -247,7 +247,7 @@ public function testEscapeValue() */ public function testResolveStringWithSpacesReturnsString($expected, $test, $description) { - $bag = new ParameterBag(array('foo' => 'bar')); + $bag = new ParameterBag(['foo' => 'bar']); try { $this->assertEquals($expected, $bag->resolveString($test), $description); @@ -258,11 +258,11 @@ public function testResolveStringWithSpacesReturnsString($expected, $test, $desc public function stringsWithSpacesProvider() { - return array( - array('bar', '%foo%', 'Parameters must be wrapped by %.'), - array('% foo %', '% foo %', 'Parameters should not have spaces.'), - array('{% set my_template = "foo" %}', '{% set my_template = "foo" %}', 'Twig-like strings are not parameters.'), - array('50% is less than 100%', '50% is less than 100%', 'Text between % signs is allowed, if there are spaces.'), - ); + return [ + ['bar', '%foo%', 'Parameters must be wrapped by %.'], + ['% foo %', '% foo %', 'Parameters should not have spaces.'], + ['{% set my_template = "foo" %}', '{% set my_template = "foo" %}', 'Twig-like strings are not parameters.'], + ['50% is less than 100%', '50% is less than 100%', 'Text between % signs is allowed, if there are spaces.'], + ]; } } diff --git a/vendor/symfony/dependency-injection/Tests/ServiceLocatorTest.php b/vendor/symfony/dependency-injection/Tests/ServiceLocatorTest.php index 56fac643eb40b05a8ff2ee6f1aeb2b83921340e2..aa9ebab6816fcaeab2873adc1e359e059644c766 100644 --- a/vendor/symfony/dependency-injection/Tests/ServiceLocatorTest.php +++ b/vendor/symfony/dependency-injection/Tests/ServiceLocatorTest.php @@ -20,11 +20,11 @@ class ServiceLocatorTest extends TestCase { public function testHas() { - $locator = new ServiceLocator(array( + $locator = new ServiceLocator([ 'foo' => function () { return 'bar'; }, 'bar' => function () { return 'baz'; }, function () { return 'dummy'; }, - )); + ]); $this->assertTrue($locator->has('foo')); $this->assertTrue($locator->has('bar')); @@ -33,10 +33,10 @@ function () { return 'dummy'; }, public function testGet() { - $locator = new ServiceLocator(array( + $locator = new ServiceLocator([ 'foo' => function () { return 'bar'; }, 'bar' => function () { return 'baz'; }, - )); + ]); $this->assertSame('bar', $locator->get('foo')); $this->assertSame('baz', $locator->get('bar')); @@ -45,13 +45,13 @@ public function testGet() public function testGetDoesNotMemoize() { $i = 0; - $locator = new ServiceLocator(array( + $locator = new ServiceLocator([ 'foo' => function () use (&$i) { ++$i; return 'bar'; }, - )); + ]); $this->assertSame('bar', $locator->get('foo')); $this->assertSame('bar', $locator->get('foo')); @@ -64,10 +64,10 @@ public function testGetDoesNotMemoize() */ public function testGetThrowsOnUndefinedService() { - $locator = new ServiceLocator(array( + $locator = new ServiceLocator([ 'foo' => function () { return 'bar'; }, 'bar' => function () { return 'baz'; }, - )); + ]); $locator->get('dummy'); } @@ -78,9 +78,9 @@ public function testGetThrowsOnUndefinedService() */ public function testThrowsOnUndefinedInternalService() { - $locator = new ServiceLocator(array( + $locator = new ServiceLocator([ 'foo' => function () use (&$locator) { return $locator->get('bar'); }, - )); + ]); $locator->get('foo'); } @@ -91,11 +91,11 @@ public function testThrowsOnUndefinedInternalService() */ public function testThrowsOnCircularReference() { - $locator = new ServiceLocator(array( + $locator = new ServiceLocator([ 'foo' => function () use (&$locator) { return $locator->get('bar'); }, 'bar' => function () use (&$locator) { return $locator->get('baz'); }, 'baz' => function () use (&$locator) { return $locator->get('bar'); }, - )); + ]); $locator->get('foo'); } @@ -109,18 +109,32 @@ public function testThrowsInServiceSubscriber() $container = new Container(); $container->set('foo', new \stdClass()); $subscriber = new SomeServiceSubscriber(); - $subscriber->container = new ServiceLocator(array('bar' => function () {})); + $subscriber->container = new ServiceLocator(['bar' => function () {}]); $subscriber->container = $subscriber->container->withContext('caller', $container); $subscriber->getFoo(); } + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException + * @expectedExceptionMessage Service "foo" not found: even though it exists in the app's container, the container inside "foo" is a smaller service locator that is empty... Try using dependency injection instead. + */ + public function testGetThrowsServiceNotFoundException() + { + $container = new Container(); + $container->set('foo', new \stdClass()); + + $locator = new ServiceLocator([]); + $locator = $locator->withContext('foo', $container); + $locator->get('foo'); + } + public function testInvoke() { - $locator = new ServiceLocator(array( + $locator = new ServiceLocator([ 'foo' => function () { return 'bar'; }, 'bar' => function () { return 'baz'; }, - )); + ]); $this->assertSame('bar', $locator('foo')); $this->assertSame('baz', $locator('bar')); @@ -139,6 +153,6 @@ public function getFoo() public static function getSubscribedServices() { - return array('bar' => 'stdClass'); + return ['bar' => 'stdClass']; } } diff --git a/vendor/symfony/dependency-injection/phpunit.xml.dist b/vendor/symfony/dependency-injection/phpunit.xml.dist index 781f767d544821f256ee397137545cdd18a93c5d..21dee2a801afd464a4c8df82afc540e2781eccb1 100644 --- a/vendor/symfony/dependency-injection/phpunit.xml.dist +++ b/vendor/symfony/dependency-injection/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php b/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php index cd44a31c1dadd6376fec308939e08e584bf5c5b9..aeafd9ec29b44b8af2ee3d9509337a0f52a0baf7 100644 --- a/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php +++ b/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php @@ -30,12 +30,12 @@ class ContainerAwareEventDispatcher extends EventDispatcher /** * The service IDs of the event listeners and subscribers. */ - private $listenerIds = array(); + private $listenerIds = []; /** * The services registered as listeners. */ - private $listeners = array(); + private $listeners = []; public function __construct(ContainerInterface $container) { @@ -67,10 +67,10 @@ public function addListenerService($eventName, $callback, $priority = 0) @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); if (!\is_array($callback) || 2 !== \count($callback)) { - throw new \InvalidArgumentException('Expected an array("service", "method") argument'); + throw new \InvalidArgumentException('Expected an ["service", "method"] argument'); } - $this->listenerIds[$eventName][] = array($callback[0], $callback[1], $priority); + $this->listenerIds[$eventName][] = [$callback[0], $callback[1], $priority]; } public function removeListener($eventName, $listener) @@ -80,7 +80,7 @@ public function removeListener($eventName, $listener) if (isset($this->listenerIds[$eventName])) { foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method)) { $key = $serviceId.'.'.$method; - if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) { + if (isset($this->listeners[$eventName][$key]) && $listener === [$this->listeners[$eventName][$key], $method]) { unset($this->listeners[$eventName][$key]); if (empty($this->listeners[$eventName])) { unset($this->listeners[$eventName]); @@ -150,12 +150,12 @@ public function addSubscriberService($serviceId, $class) foreach ($class::getSubscribedEvents() as $eventName => $params) { if (\is_string($params)) { - $this->listenerIds[$eventName][] = array($serviceId, $params, 0); + $this->listenerIds[$eventName][] = [$serviceId, $params, 0]; } elseif (\is_string($params[0])) { - $this->listenerIds[$eventName][] = array($serviceId, $params[0], isset($params[1]) ? $params[1] : 0); + $this->listenerIds[$eventName][] = [$serviceId, $params[0], isset($params[1]) ? $params[1] : 0]; } else { foreach ($params as $listener) { - $this->listenerIds[$eventName][] = array($serviceId, $listener[0], isset($listener[1]) ? $listener[1] : 0); + $this->listenerIds[$eventName][] = [$serviceId, $listener[0], isset($listener[1]) ? $listener[1] : 0]; } } } @@ -184,10 +184,10 @@ protected function lazyLoad($eventName) $key = $serviceId.'.'.$method; if (!isset($this->listeners[$eventName][$key])) { - $this->addListener($eventName, array($listener, $method), $priority); + $this->addListener($eventName, [$listener, $method], $priority); } elseif ($this->listeners[$eventName][$key] !== $listener) { - parent::removeListener($eventName, array($this->listeners[$eventName][$key], $method)); - $this->addListener($eventName, array($listener, $method), $priority); + parent::removeListener($eventName, [$this->listeners[$eventName][$key], $method]); + $this->addListener($eventName, [$listener, $method], $priority); } $this->listeners[$eventName][$key] = $listener; diff --git a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php index e5d59402cf3a2408a11bb0eb82b3dc09962895f4..2339a68874a6d482f9e4f93053aa2b97546dec6e 100644 --- a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php +++ b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php @@ -29,7 +29,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface protected $logger; protected $stopwatch; - private $called; + private $callStack; private $dispatcher; private $wrappedListeners; @@ -38,8 +38,7 @@ public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $sto $this->dispatcher = $dispatcher; $this->stopwatch = $stopwatch; $this->logger = $logger; - $this->called = array(); - $this->wrappedListeners = array(); + $this->wrappedListeners = []; } /** @@ -123,6 +122,10 @@ public function hasListeners($eventName = null) */ public function dispatch($eventName, Event $event = null) { + if (null === $this->callStack) { + $this->callStack = new \SplObjectStorage(); + } + if (null === $event) { $event = new Event(); } @@ -132,19 +135,24 @@ public function dispatch($eventName, Event $event = null) } $this->preProcess($eventName); - $this->preDispatch($eventName, $event); - - $e = $this->stopwatch->start($eventName, 'section'); - - $this->dispatcher->dispatch($eventName, $event); - - if ($e->isStarted()) { - $e->stop(); + try { + $this->preDispatch($eventName, $event); + try { + $e = $this->stopwatch->start($eventName, 'section'); + try { + $this->dispatcher->dispatch($eventName, $event); + } finally { + if ($e->isStarted()) { + $e->stop(); + } + } + } finally { + $this->postDispatch($eventName, $event); + } + } finally { + $this->postProcess($eventName); } - $this->postDispatch($eventName, $event); - $this->postProcess($eventName); - return $event; } @@ -153,11 +161,15 @@ public function dispatch($eventName, Event $event = null) */ public function getCalledListeners() { - $called = array(); - foreach ($this->called as $eventName => $listeners) { - foreach ($listeners as $listener) { - $called[$eventName.'.'.$listener->getPretty()] = $listener->getInfo($eventName); - } + if (null === $this->callStack) { + return []; + } + + $called = []; + foreach ($this->callStack as $listener) { + list($eventName) = $this->callStack->getInfo(); + + $called[] = $listener->getInfo($eventName); } return $called; @@ -172,20 +184,20 @@ public function getNotCalledListeners() $allListeners = $this->getListeners(); } catch (\Exception $e) { if (null !== $this->logger) { - $this->logger->info('An exception was thrown while getting the uncalled listeners.', array('exception' => $e)); + $this->logger->info('An exception was thrown while getting the uncalled listeners.', ['exception' => $e]); } // unable to retrieve the uncalled listeners - return array(); + return []; } - $notCalled = array(); + $notCalled = []; foreach ($allListeners as $eventName => $listeners) { foreach ($listeners as $listener) { $called = false; - if (isset($this->called[$eventName])) { - foreach ($this->called[$eventName] as $l) { - if ($l->getWrappedListener() === $listener) { + if (null !== $this->callStack) { + foreach ($this->callStack as $calledListener) { + if ($calledListener->getWrappedListener() === $listener) { $called = true; break; @@ -197,19 +209,19 @@ public function getNotCalledListeners() if (!$listener instanceof WrappedListener) { $listener = new WrappedListener($listener, null, $this->stopwatch, $this); } - $notCalled[$eventName.'.'.$listener->getPretty()] = $listener->getInfo($eventName); + $notCalled[] = $listener->getInfo($eventName); } } } - uasort($notCalled, array($this, 'sortListenersByPriority')); + uasort($notCalled, [$this, 'sortNotCalledListeners']); return $notCalled; } public function reset() { - $this->called = array(); + $this->callStack = null; } /** @@ -222,7 +234,7 @@ public function reset() */ public function __call($method, $arguments) { - return \call_user_func_array(array($this->dispatcher, $method), $arguments); + return \call_user_func_array([$this->dispatcher, $method], $arguments); } /** @@ -249,10 +261,11 @@ private function preProcess($eventName) { foreach ($this->dispatcher->getListeners($eventName) as $listener) { $priority = $this->getListenerPriority($eventName, $listener); - $wrappedListener = new WrappedListener($listener, null, $this->stopwatch, $this); + $wrappedListener = new WrappedListener($listener instanceof WrappedListener ? $listener->getWrappedListener() : $listener, null, $this->stopwatch, $this); $this->wrappedListeners[$eventName][] = $wrappedListener; $this->dispatcher->removeListener($eventName, $listener); $this->dispatcher->addListener($eventName, $wrappedListener, $priority); + $this->callStack->attach($wrappedListener, [$eventName]); } } @@ -270,7 +283,7 @@ private function postProcess($eventName) $this->dispatcher->addListener($eventName, $listener->getWrappedListener(), $priority); if (null !== $this->logger) { - $context = array('event' => $eventName, 'listener' => $listener->getPretty()); + $context = ['event' => $eventName, 'listener' => $listener->getPretty()]; } if ($listener->wasCalled()) { @@ -281,8 +294,8 @@ private function postProcess($eventName) if (!isset($this->called[$eventName])) { $this->called[$eventName] = new \SplObjectStorage(); } - - $this->called[$eventName]->attach($listener); + } else { + $this->callStack->detach($listener); } if (null !== $this->logger && $skipped) { @@ -299,8 +312,12 @@ private function postProcess($eventName) } } - private function sortListenersByPriority($a, $b) + private function sortNotCalledListeners(array $a, array $b) { + if (0 !== $cmp = strcmp($a['event'], $b['event'])) { + return $cmp; + } + if (\is_int($a['priority']) && !\is_int($b['priority'])) { return 1; } diff --git a/vendor/symfony/event-dispatcher/Debug/WrappedListener.php b/vendor/symfony/event-dispatcher/Debug/WrappedListener.php index 2d8126a65d6be04109208f312c089f1934d7cb53..de2b850953c3d2cd12d8fa9d489a163bd630a9fe 100644 --- a/vendor/symfony/event-dispatcher/Debug/WrappedListener.php +++ b/vendor/symfony/event-dispatcher/Debug/WrappedListener.php @@ -29,12 +29,12 @@ class WrappedListener private $dispatcher; private $pretty; private $stub; + private $priority; private static $hasClassStub; public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null) { $this->listener = $listener; - $this->name = $name; $this->stopwatch = $stopwatch; $this->dispatcher = $dispatcher; $this->called = false; @@ -44,7 +44,15 @@ public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatc $this->name = \is_object($listener[0]) ? \get_class($listener[0]) : $listener[0]; $this->pretty = $this->name.'::'.$listener[1]; } elseif ($listener instanceof \Closure) { - $this->pretty = $this->name = 'closure'; + $r = new \ReflectionFunction($listener); + if (false !== strpos($r->name, '{closure}')) { + $this->pretty = $this->name = 'closure'; + } elseif ($class = $r->getClosureScopeClass()) { + $this->name = $class->name; + $this->pretty = $this->name.'::'.$r->name; + } else { + $this->pretty = $this->name = $r->name; + } } elseif (\is_string($listener)) { $this->pretty = $this->name = $listener; } else { @@ -87,21 +95,24 @@ public function getInfo($eventName) $this->stub = self::$hasClassStub ? new ClassStub($this->pretty.'()', $this->listener) : $this->pretty.'()'; } - return array( + return [ 'event' => $eventName, - 'priority' => null !== $this->dispatcher ? $this->dispatcher->getListenerPriority($eventName, $this->listener) : null, + 'priority' => null !== $this->priority ? $this->priority : (null !== $this->dispatcher ? $this->dispatcher->getListenerPriority($eventName, $this->listener) : null), 'pretty' => $this->pretty, 'stub' => $this->stub, - ); + ]; } public function __invoke(Event $event, $eventName, EventDispatcherInterface $dispatcher) { + $dispatcher = $this->dispatcher ?: $dispatcher; + $this->called = true; + $this->priority = $dispatcher->getListenerPriority($eventName, $this->listener); $e = $this->stopwatch->start($this->name, 'event_listener'); - \call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher); + \call_user_func($this->listener, $event, $eventName, $dispatcher); if ($e->isStarted()) { $e->stop(); diff --git a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php index a6fcde33ad972552a51f2cbcae7c97220f3febb2..bdad9fe9d9bd311f0537f1dad4084d2f53696f48 100644 --- a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php +++ b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php @@ -28,7 +28,7 @@ class RegisterListenersPass implements CompilerPassInterface protected $listenerTag; protected $subscriberTag; - private $hotPathEvents = array(); + private $hotPathEvents = []; private $hotPathTagName; /** @@ -68,14 +68,14 @@ public function process(ContainerBuilder $container) } if (!isset($event['method'])) { - $event['method'] = 'on'.preg_replace_callback(array( + $event['method'] = 'on'.preg_replace_callback([ '/(?<=\b)[a-z]/i', '/[^a-z0-9]/i', - ), function ($matches) { return strtoupper($matches[0]); }, $event['event']); + ], function ($matches) { return strtoupper($matches[0]); }, $event['event']); $event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']); } - $definition->addMethodCall('addListener', array($event['event'], array(new ServiceClosureArgument(new Reference($id)), $event['method']), $priority)); + $definition->addMethodCall('addListener', [$event['event'], [new ServiceClosureArgument(new Reference($id)), $event['method']], $priority]); if (isset($this->hotPathEvents[$event['event']])) { $container->getDefinition($id)->addTag($this->hotPathTagName); @@ -102,14 +102,14 @@ public function process(ContainerBuilder $container) ExtractingEventDispatcher::$subscriber = $class; $extractingDispatcher->addSubscriber($extractingDispatcher); foreach ($extractingDispatcher->listeners as $args) { - $args[1] = array(new ServiceClosureArgument(new Reference($id)), $args[1]); + $args[1] = [new ServiceClosureArgument(new Reference($id)), $args[1]]; $definition->addMethodCall('addListener', $args); if (isset($this->hotPathEvents[$args[0]])) { $container->getDefinition($id)->addTag('container.hot_path'); } } - $extractingDispatcher->listeners = array(); + $extractingDispatcher->listeners = []; } } } @@ -119,18 +119,18 @@ public function process(ContainerBuilder $container) */ class ExtractingEventDispatcher extends EventDispatcher implements EventSubscriberInterface { - public $listeners = array(); + public $listeners = []; public static $subscriber; public function addListener($eventName, $listener, $priority = 0) { - $this->listeners[] = array($eventName, $listener[1], $priority); + $this->listeners[] = [$eventName, $listener[1], $priority]; } public static function getSubscribedEvents() { - $callback = array(self::$subscriber, 'getSubscribedEvents'); + $callback = [self::$subscriber, 'getSubscribedEvents']; return $callback(); } diff --git a/vendor/symfony/event-dispatcher/EventDispatcher.php b/vendor/symfony/event-dispatcher/EventDispatcher.php index 4e75c63e4fafb4573bf2ed9eef1ec2d50f0b123d..968e345b3dcab21e14429727a8b80e988c93ddfc 100644 --- a/vendor/symfony/event-dispatcher/EventDispatcher.php +++ b/vendor/symfony/event-dispatcher/EventDispatcher.php @@ -28,8 +28,8 @@ */ class EventDispatcher implements EventDispatcherInterface { - private $listeners = array(); - private $sorted = array(); + private $listeners = []; + private $sorted = []; /** * {@inheritdoc} @@ -54,7 +54,7 @@ public function getListeners($eventName = null) { if (null !== $eventName) { if (empty($this->listeners[$eventName])) { - return array(); + return []; } if (!isset($this->sorted[$eventName])) { @@ -166,12 +166,12 @@ public function addSubscriber(EventSubscriberInterface $subscriber) { foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { if (\is_string($params)) { - $this->addListener($eventName, array($subscriber, $params)); + $this->addListener($eventName, [$subscriber, $params]); } elseif (\is_string($params[0])) { - $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0); + $this->addListener($eventName, [$subscriber, $params[0]], isset($params[1]) ? $params[1] : 0); } else { foreach ($params as $listener) { - $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0); + $this->addListener($eventName, [$subscriber, $listener[0]], isset($listener[1]) ? $listener[1] : 0); } } } @@ -185,10 +185,10 @@ public function removeSubscriber(EventSubscriberInterface $subscriber) foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { if (\is_array($params) && \is_array($params[0])) { foreach ($params as $listener) { - $this->removeListener($eventName, array($subscriber, $listener[0])); + $this->removeListener($eventName, [$subscriber, $listener[0]]); } } else { - $this->removeListener($eventName, array($subscriber, \is_string($params) ? $params : $params[0])); + $this->removeListener($eventName, [$subscriber, \is_string($params) ? $params : $params[0]]); } } } @@ -221,7 +221,7 @@ protected function doDispatch($listeners, $eventName, Event $event) private function sortListeners($eventName) { krsort($this->listeners[$eventName]); - $this->sorted[$eventName] = array(); + $this->sorted[$eventName] = []; foreach ($this->listeners[$eventName] as $priority => $listeners) { foreach ($listeners as $k => $listener) { diff --git a/vendor/symfony/event-dispatcher/EventDispatcherInterface.php b/vendor/symfony/event-dispatcher/EventDispatcherInterface.php index d3d0cb8a452d26b42970284f130c29ef76f9e27c..bde753a12fca0583ff7fdb71f3905bb8c20a1bfd 100644 --- a/vendor/symfony/event-dispatcher/EventDispatcherInterface.php +++ b/vendor/symfony/event-dispatcher/EventDispatcherInterface.php @@ -23,11 +23,11 @@ interface EventDispatcherInterface /** * Dispatches an event to all registered listeners. * - * @param string $eventName The name of the event to dispatch. The name of - * the event is the name of the method that is - * invoked on listeners. - * @param Event $event The event to pass to the event handlers/listeners - * If not supplied, an empty Event instance is created + * @param string $eventName The name of the event to dispatch. The name of + * the event is the name of the method that is + * invoked on listeners. + * @param Event|null $event The event to pass to the event handlers/listeners + * If not supplied, an empty Event instance is created * * @return Event */ @@ -46,7 +46,7 @@ public function addListener($eventName, $listener, $priority = 0); /** * Adds an event subscriber. * - * The subscriber is asked for all the events he is + * The subscriber is asked for all the events it is * interested in and added as a listener for these events. */ public function addSubscriber(EventSubscriberInterface $subscriber); @@ -64,7 +64,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber); /** * Gets the listeners of a specific event or all listeners sorted by descending priority. * - * @param string $eventName The name of the event + * @param string|null $eventName The name of the event * * @return array The event listeners for the specified event, or all event listeners by event name */ @@ -85,7 +85,7 @@ public function getListenerPriority($eventName, $listener); /** * Checks whether an event has any registered listeners. * - * @param string $eventName The name of the event + * @param string|null $eventName The name of the event * * @return bool true if the specified event has any listeners, false otherwise */ diff --git a/vendor/symfony/event-dispatcher/EventSubscriberInterface.php b/vendor/symfony/event-dispatcher/EventSubscriberInterface.php index 8af778919bab71042d545f5f225fde02fa81845d..824f21599c2560611fb1ff88398d475c908e9be8 100644 --- a/vendor/symfony/event-dispatcher/EventSubscriberInterface.php +++ b/vendor/symfony/event-dispatcher/EventSubscriberInterface.php @@ -12,7 +12,7 @@ namespace Symfony\Component\EventDispatcher; /** - * An EventSubscriber knows himself what events he is interested in. + * An EventSubscriber knows itself what events it is interested in. * If an EventSubscriber is added to an EventDispatcherInterface, the manager invokes * {@link getSubscribedEvents} and registers the subscriber as a listener for all * returned events. @@ -36,9 +36,9 @@ interface EventSubscriberInterface * * For instance: * - * * array('eventName' => 'methodName') - * * array('eventName' => array('methodName', $priority)) - * * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) + * * ['eventName' => 'methodName'] + * * ['eventName' => ['methodName', $priority]] + * * ['eventName' => [['methodName1', $priority], ['methodName2']]] * * @return array The event names to listen to */ diff --git a/vendor/symfony/event-dispatcher/GenericEvent.php b/vendor/symfony/event-dispatcher/GenericEvent.php index 95c99408de20f3ee779c1f44a009f56903adbace..f005e3a3db0762e55c1274b59b56d3cb0035e8c1 100644 --- a/vendor/symfony/event-dispatcher/GenericEvent.php +++ b/vendor/symfony/event-dispatcher/GenericEvent.php @@ -29,7 +29,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate * @param mixed $subject The subject of the event, usually an object or a callable * @param array $arguments Arguments to store in the event */ - public function __construct($subject = null, array $arguments = array()) + public function __construct($subject = null, array $arguments = []) { $this->subject = $subject; $this->arguments = $arguments; @@ -38,7 +38,7 @@ public function __construct($subject = null, array $arguments = array()) /** * Getter for subject property. * - * @return mixed $subject The observer subject + * @return mixed The observer subject */ public function getSubject() { @@ -95,7 +95,7 @@ public function getArguments() * * @return $this */ - public function setArguments(array $args = array()) + public function setArguments(array $args = []) { $this->arguments = $args; @@ -111,7 +111,7 @@ public function setArguments(array $args = array()) */ public function hasArgument($key) { - return array_key_exists($key, $this->arguments); + return \array_key_exists($key, $this->arguments); } /** diff --git a/vendor/symfony/event-dispatcher/LICENSE b/vendor/symfony/event-dispatcher/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/event-dispatcher/LICENSE +++ b/vendor/symfony/event-dispatcher/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php index 9997a7b0ec607cdb9f0a81aa497aa73d085fa80e..b157659dc08462e407950778e959e5dca790eb38 100644 --- a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php +++ b/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php @@ -47,15 +47,15 @@ abstract protected function createEventDispatcher(); public function testInitialState() { - $this->assertEquals(array(), $this->dispatcher->getListeners()); + $this->assertEquals([], $this->dispatcher->getListeners()); $this->assertFalse($this->dispatcher->hasListeners(self::preFoo)); $this->assertFalse($this->dispatcher->hasListeners(self::postFoo)); } public function testAddListener() { - $this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo')); - $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo')); + $this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']); + $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo']); $this->assertTrue($this->dispatcher->hasListeners()); $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); $this->assertTrue($this->dispatcher->hasListeners(self::postFoo)); @@ -73,15 +73,15 @@ public function testGetListenersSortsByPriority() $listener2->name = '2'; $listener3->name = '3'; - $this->dispatcher->addListener('pre.foo', array($listener1, 'preFoo'), -10); - $this->dispatcher->addListener('pre.foo', array($listener2, 'preFoo'), 10); - $this->dispatcher->addListener('pre.foo', array($listener3, 'preFoo')); + $this->dispatcher->addListener('pre.foo', [$listener1, 'preFoo'], -10); + $this->dispatcher->addListener('pre.foo', [$listener2, 'preFoo'], 10); + $this->dispatcher->addListener('pre.foo', [$listener3, 'preFoo']); - $expected = array( - array($listener2, 'preFoo'), - array($listener3, 'preFoo'), - array($listener1, 'preFoo'), - ); + $expected = [ + [$listener2, 'preFoo'], + [$listener3, 'preFoo'], + [$listener1, 'preFoo'], + ]; $this->assertSame($expected, $this->dispatcher->getListeners('pre.foo')); } @@ -102,10 +102,10 @@ public function testGetAllListenersSortsByPriority() $this->dispatcher->addListener('post.foo', $listener5); $this->dispatcher->addListener('post.foo', $listener6, 10); - $expected = array( - 'pre.foo' => array($listener3, $listener2, $listener1), - 'post.foo' => array($listener6, $listener5, $listener4), - ); + $expected = [ + 'pre.foo' => [$listener3, $listener2, $listener1], + 'post.foo' => [$listener6, $listener5, $listener4], + ]; $this->assertSame($expected, $this->dispatcher->getListeners()); } @@ -126,8 +126,8 @@ public function testGetListenerPriority() public function testDispatch() { - $this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo')); - $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo')); + $this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']); + $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo']); $this->dispatcher->dispatch(self::preFoo); $this->assertTrue($this->listener->preFooInvoked); $this->assertFalse($this->listener->postFooInvoked); @@ -157,8 +157,8 @@ public function testStopEventPropagation() // postFoo() stops the propagation, so only one listener should // be executed // Manually set priority to enforce $this->listener to be called first - $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'), 10); - $this->dispatcher->addListener('post.foo', array($otherListener, 'postFoo')); + $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo'], 10); + $this->dispatcher->addListener('post.foo', [$otherListener, 'postFoo']); $this->dispatcher->dispatch(self::postFoo); $this->assertTrue($this->listener->postFooInvoked); $this->assertFalse($otherListener->postFooInvoked); @@ -166,7 +166,7 @@ public function testStopEventPropagation() public function testDispatchByPriority() { - $invoked = array(); + $invoked = []; $listener1 = function () use (&$invoked) { $invoked[] = '1'; }; @@ -180,7 +180,7 @@ public function testDispatchByPriority() $this->dispatcher->addListener('pre.foo', $listener2); $this->dispatcher->addListener('pre.foo', $listener3, 10); $this->dispatcher->dispatch(self::preFoo); - $this->assertEquals(array('3', '2', '1'), $invoked); + $this->assertEquals(['3', '2', '1'], $invoked); } public function testRemoveListener() @@ -258,7 +258,7 @@ public function testRemoveSubscriberWithMultipleListeners() public function testEventReceivesTheDispatcherInstanceAsArgument() { $listener = new TestWithDispatcher(); - $this->dispatcher->addListener('test', array($listener, 'foo')); + $this->dispatcher->addListener('test', [$listener, 'foo']); $this->assertNull($listener->name); $this->assertNull($listener->dispatcher); $this->dispatcher->dispatch('test'); @@ -295,7 +295,7 @@ public function testGetListenersWhenAddedCallbackListenerIsRemoved() $listener = function () {}; $this->dispatcher->addListener('foo', $listener); $this->dispatcher->removeListener('foo', $listener); - $this->assertSame(array(), $this->dispatcher->getListeners()); + $this->assertSame([], $this->dispatcher->getListeners()); } public function testHasListenersWithoutEventsReturnsFalseAfterHasListenersWithEventHasBeenCalled() @@ -307,7 +307,7 @@ public function testHasListenersWithoutEventsReturnsFalseAfterHasListenersWithEv public function testHasListenersIsLazy() { $called = 0; - $listener = array(function () use (&$called) { ++$called; }, 'onFoo'); + $listener = [function () use (&$called) { ++$called; }, 'onFoo']; $this->dispatcher->addListener('foo', $listener); $this->assertTrue($this->dispatcher->hasListeners()); $this->assertTrue($this->dispatcher->hasListeners('foo')); @@ -322,7 +322,7 @@ public function testDispatchLazyListener() return new TestWithDispatcher(); }; - $this->dispatcher->addListener('foo', array($factory, 'foo')); + $this->dispatcher->addListener('foo', [$factory, 'foo']); $this->assertSame(0, $called); $this->dispatcher->dispatch('foo', new Event()); $this->dispatcher->dispatch('foo', new Event()); @@ -334,14 +334,14 @@ public function testRemoveFindsLazyListeners() $test = new TestWithDispatcher(); $factory = function () use ($test) { return $test; }; - $this->dispatcher->addListener('foo', array($factory, 'foo')); + $this->dispatcher->addListener('foo', [$factory, 'foo']); $this->assertTrue($this->dispatcher->hasListeners('foo')); - $this->dispatcher->removeListener('foo', array($test, 'foo')); + $this->dispatcher->removeListener('foo', [$test, 'foo']); $this->assertFalse($this->dispatcher->hasListeners('foo')); - $this->dispatcher->addListener('foo', array($test, 'foo')); + $this->dispatcher->addListener('foo', [$test, 'foo']); $this->assertTrue($this->dispatcher->hasListeners('foo')); - $this->dispatcher->removeListener('foo', array($factory, 'foo')); + $this->dispatcher->removeListener('foo', [$factory, 'foo']); $this->assertFalse($this->dispatcher->hasListeners('foo')); } @@ -350,12 +350,12 @@ public function testPriorityFindsLazyListeners() $test = new TestWithDispatcher(); $factory = function () use ($test) { return $test; }; - $this->dispatcher->addListener('foo', array($factory, 'foo'), 3); - $this->assertSame(3, $this->dispatcher->getListenerPriority('foo', array($test, 'foo'))); - $this->dispatcher->removeListener('foo', array($factory, 'foo')); + $this->dispatcher->addListener('foo', [$factory, 'foo'], 3); + $this->assertSame(3, $this->dispatcher->getListenerPriority('foo', [$test, 'foo'])); + $this->dispatcher->removeListener('foo', [$factory, 'foo']); - $this->dispatcher->addListener('foo', array($test, 'foo'), 5); - $this->assertSame(5, $this->dispatcher->getListenerPriority('foo', array($factory, 'foo'))); + $this->dispatcher->addListener('foo', [$test, 'foo'], 5); + $this->assertSame(5, $this->dispatcher->getListenerPriority('foo', [$factory, 'foo'])); } public function testGetLazyListeners() @@ -363,12 +363,12 @@ public function testGetLazyListeners() $test = new TestWithDispatcher(); $factory = function () use ($test) { return $test; }; - $this->dispatcher->addListener('foo', array($factory, 'foo'), 3); - $this->assertSame(array(array($test, 'foo')), $this->dispatcher->getListeners('foo')); + $this->dispatcher->addListener('foo', [$factory, 'foo'], 3); + $this->assertSame([[$test, 'foo']], $this->dispatcher->getListeners('foo')); - $this->dispatcher->removeListener('foo', array($test, 'foo')); - $this->dispatcher->addListener('bar', array($factory, 'foo'), 3); - $this->assertSame(array('bar' => array(array($test, 'foo'))), $this->dispatcher->getListeners()); + $this->dispatcher->removeListener('foo', [$test, 'foo']); + $this->dispatcher->addListener('bar', [$factory, 'foo'], 3); + $this->assertSame(['bar' => [[$test, 'foo']]], $this->dispatcher->getListeners()); } } @@ -415,7 +415,7 @@ class TestEventSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { - return array('pre.foo' => 'preFoo', 'post.foo' => 'postFoo'); + return ['pre.foo' => 'preFoo', 'post.foo' => 'postFoo']; } } @@ -423,10 +423,10 @@ class TestEventSubscriberWithPriorities implements EventSubscriberInterface { public static function getSubscribedEvents() { - return array( - 'pre.foo' => array('preFoo', 10), - 'post.foo' => array('postFoo'), - ); + return [ + 'pre.foo' => ['preFoo', 10], + 'post.foo' => ['postFoo'], + ]; } } @@ -434,9 +434,9 @@ class TestEventSubscriberWithMultipleListeners implements EventSubscriberInterfa { public static function getSubscribedEvents() { - return array('pre.foo' => array( - array('preFoo1'), - array('preFoo2', 10), - )); + return ['pre.foo' => [ + ['preFoo1'], + ['preFoo2', 10], + ]]; } } diff --git a/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php index 9d5eecc547bd47c53515dd387d736a07add7079b..685cdfc3aa84766e600174077ca9e393adf051cb 100644 --- a/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php +++ b/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php @@ -44,7 +44,7 @@ public function testAddAListenerService() $container->set('service.listener', $service); $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent')); + $dispatcher->addListenerService('onEvent', ['service.listener', 'onEvent']); $dispatcher->dispatch('onEvent', $event); } @@ -100,8 +100,8 @@ public function testPreventDuplicateListenerService() $container->set('service.listener', $service); $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'), 5); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'), 10); + $dispatcher->addListenerService('onEvent', ['service.listener', 'onEvent'], 5); + $dispatcher->addListenerService('onEvent', ['service.listener', 'onEvent'], 10); $dispatcher->dispatch('onEvent', $event); } @@ -116,7 +116,7 @@ public function testHasListenersOnLazyLoad() $container->set('service.listener', $service); $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent')); + $dispatcher->addListenerService('onEvent', ['service.listener', 'onEvent']); $service ->expects($this->once()) @@ -139,7 +139,7 @@ public function testGetListenersOnLazyLoad() $container->set('service.listener', $service); $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent')); + $dispatcher->addListenerService('onEvent', ['service.listener', 'onEvent']); $listeners = $dispatcher->getListeners(); @@ -156,10 +156,10 @@ public function testRemoveAfterDispatch() $container->set('service.listener', $service); $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent')); + $dispatcher->addListenerService('onEvent', ['service.listener', 'onEvent']); $dispatcher->dispatch('onEvent', new Event()); - $dispatcher->removeListener('onEvent', array($container->get('service.listener'), 'onEvent')); + $dispatcher->removeListener('onEvent', [$container->get('service.listener'), 'onEvent']); $this->assertFalse($dispatcher->hasListeners('onEvent')); } @@ -171,9 +171,9 @@ public function testRemoveBeforeDispatch() $container->set('service.listener', $service); $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent')); + $dispatcher->addListenerService('onEvent', ['service.listener', 'onEvent']); - $dispatcher->removeListener('onEvent', array($container->get('service.listener'), 'onEvent')); + $dispatcher->removeListener('onEvent', [$container->get('service.listener'), 'onEvent']); $this->assertFalse($dispatcher->hasListeners('onEvent')); } } @@ -189,11 +189,11 @@ class SubscriberService implements EventSubscriberInterface { public static function getSubscribedEvents() { - return array( + return [ 'onEvent' => 'onEvent', - 'onEventWithPriority' => array('onEventWithPriority', 10), - 'onEventNested' => array(array('onEventNested')), - ); + 'onEventWithPriority' => ['onEventWithPriority', 10], + 'onEventNested' => [['onEventNested']], + ]; } public function onEvent(Event $e) diff --git a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php index d7c5ce18ccca0b941ad4bb1ed00ef832e3a359c4..aabd95c0f285af740ccc41966a4573f8d7584251 100644 --- a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php +++ b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php @@ -98,7 +98,7 @@ public function testAddRemoveSubscriber() $tdispatcher->addSubscriber($subscriber); $listeners = $dispatcher->getListeners('foo'); $this->assertCount(1, $listeners); - $this->assertSame(array($subscriber, 'call'), $listeners[0]); + $this->assertSame([$subscriber, 'call'], $listeners[0]); $tdispatcher->removeSubscriber($subscriber); $this->assertCount(0, $dispatcher->getListeners('foo')); @@ -110,18 +110,18 @@ public function testGetCalledListeners() $tdispatcher->addListener('foo', function () {}, 5); $listeners = $tdispatcher->getNotCalledListeners(); - $this->assertArrayHasKey('stub', $listeners['foo.closure']); - unset($listeners['foo.closure']['stub']); - $this->assertEquals(array(), $tdispatcher->getCalledListeners()); - $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); + $this->assertArrayHasKey('stub', $listeners[0]); + unset($listeners[0]['stub']); + $this->assertEquals([], $tdispatcher->getCalledListeners()); + $this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners); $tdispatcher->dispatch('foo'); $listeners = $tdispatcher->getCalledListeners(); - $this->assertArrayHasKey('stub', $listeners['foo.closure']); - unset($listeners['foo.closure']['stub']); - $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); - $this->assertEquals(array(), $tdispatcher->getNotCalledListeners()); + $this->assertArrayHasKey('stub', $listeners[0]); + unset($listeners[0]['stub']); + $this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners); + $this->assertEquals([], $tdispatcher->getNotCalledListeners()); } public function testClearCalledListeners() @@ -133,10 +133,22 @@ public function testClearCalledListeners() $tdispatcher->reset(); $listeners = $tdispatcher->getNotCalledListeners(); - $this->assertArrayHasKey('stub', $listeners['foo.closure']); - unset($listeners['foo.closure']['stub']); - $this->assertEquals(array(), $tdispatcher->getCalledListeners()); - $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); + $this->assertArrayHasKey('stub', $listeners[0]); + unset($listeners[0]['stub']); + $this->assertEquals([], $tdispatcher->getCalledListeners()); + $this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners); + } + + public function testDispatchAfterReset() + { + $tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); + $tdispatcher->addListener('foo', function () {}, 5); + + $tdispatcher->reset(); + $tdispatcher->dispatch('foo'); + + $listeners = $tdispatcher->getCalledListeners(); + $this->assertArrayHasKey('stub', $listeners[0]); } public function testGetCalledListenersNested() @@ -162,8 +174,8 @@ public function testLogger() $tdispatcher->addListener('foo', $listener1 = function () {}); $tdispatcher->addListener('foo', $listener2 = function () {}); - $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure')); - $logger->expects($this->at(1))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure')); + $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']); + $logger->expects($this->at(1))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']); $tdispatcher->dispatch('foo'); } @@ -177,16 +189,16 @@ public function testLoggerWithStoppedEvent() $tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); }); $tdispatcher->addListener('foo', $listener2 = function () {}); - $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure')); - $logger->expects($this->at(1))->method('debug')->with('Listener "{listener}" stopped propagation of the event "{event}".', array('event' => 'foo', 'listener' => 'closure')); - $logger->expects($this->at(2))->method('debug')->with('Listener "{listener}" was not called for event "{event}".', array('event' => 'foo', 'listener' => 'closure')); + $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']); + $logger->expects($this->at(1))->method('debug')->with('Listener "{listener}" stopped propagation of the event "{event}".', ['event' => 'foo', 'listener' => 'closure']); + $logger->expects($this->at(2))->method('debug')->with('Listener "{listener}" was not called for event "{event}".', ['event' => 'foo', 'listener' => 'closure']); $tdispatcher->dispatch('foo'); } public function testDispatchCallListeners() { - $called = array(); + $called = []; $dispatcher = new EventDispatcher(); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); @@ -195,7 +207,7 @@ public function testDispatchCallListeners() $tdispatcher->dispatch('foo'); - $this->assertSame(array('foo2', 'foo1'), $called); + $this->assertSame(['foo2', 'foo1'], $called); } public function testDispatchNested() @@ -252,6 +264,6 @@ class EventSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { - return array('foo' => 'call'); + return ['foo' => 'call']; } } diff --git a/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php b/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..258938ed9b00901cc02508502085b57708076d82 --- /dev/null +++ b/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php @@ -0,0 +1,64 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\EventDispatcher\Tests\Debug; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\EventDispatcher\Debug\WrappedListener; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Stopwatch\Stopwatch; + +class WrappedListenerTest extends TestCase +{ + /** + * @dataProvider provideListenersToDescribe + */ + public function testListenerDescription(callable $listener, $expected) + { + $wrappedListener = new WrappedListener($listener, null, $this->getMockBuilder(Stopwatch::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock()); + + $this->assertStringMatchesFormat($expected, $wrappedListener->getPretty()); + } + + public function provideListenersToDescribe() + { + $listeners = [ + [new FooListener(), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::__invoke'], + [[new FooListener(), 'listen'], 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'], + [['Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic'], 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'], + ['var_dump', 'var_dump'], + [function () {}, 'closure'], + ]; + + if (\PHP_VERSION_ID >= 70100) { + $listeners[] = [\Closure::fromCallable([new FooListener(), 'listen']), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen']; + $listeners[] = [\Closure::fromCallable(['Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic']), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic']; + $listeners[] = [\Closure::fromCallable(function () {}), 'closure']; + } + + return $listeners; + } +} + +class FooListener +{ + public function listen() + { + } + + public function __invoke() + { + } + + public static function listenStatic() + { + } +} diff --git a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php index c1b49f75b8a47a682b5a30c20b4fcde2b954551f..801471b47b6e39d7ed95369b3d91074e1191a184 100644 --- a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php +++ b/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php @@ -38,9 +38,9 @@ public function testEventSubscriberWithoutInterface() public function testValidEventSubscriber() { - $services = array( - 'my_event_subscriber' => array(0 => array()), - ); + $services = [ + 'my_event_subscriber' => [0 => []], + ]; $builder = new ContainerBuilder(); $eventDispatcherDefinition = $builder->register('event_dispatcher'); @@ -50,16 +50,16 @@ public function testValidEventSubscriber() $registerListenersPass = new RegisterListenersPass(); $registerListenersPass->process($builder); - $expectedCalls = array( - array( + $expectedCalls = [ + [ 'addListener', - array( + [ 'event', - array(new ServiceClosureArgument(new Reference('my_event_subscriber')), 'onEvent'), + [new ServiceClosureArgument(new Reference('my_event_subscriber')), 'onEvent'], 0, - ), - ), - ); + ], + ], + ]; $this->assertEquals($expectedCalls, $eventDispatcherDefinition->getMethodCalls()); } @@ -70,7 +70,7 @@ public function testValidEventSubscriber() public function testAbstractEventListener() { $container = new ContainerBuilder(); - $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_listener', array()); + $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_listener', []); $container->register('event_dispatcher', 'stdClass'); $registerListenersPass = new RegisterListenersPass(); @@ -84,7 +84,7 @@ public function testAbstractEventListener() public function testAbstractEventSubscriber() { $container = new ContainerBuilder(); - $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_subscriber', array()); + $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_subscriber', []); $container->register('event_dispatcher', 'stdClass'); $registerListenersPass = new RegisterListenersPass(); @@ -96,23 +96,23 @@ public function testEventSubscriberResolvableClassName() $container = new ContainerBuilder(); $container->setParameter('subscriber.class', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService'); - $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array()); + $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', []); $container->register('event_dispatcher', 'stdClass'); $registerListenersPass = new RegisterListenersPass(); $registerListenersPass->process($container); $definition = $container->getDefinition('event_dispatcher'); - $expectedCalls = array( - array( + $expectedCalls = [ + [ 'addListener', - array( + [ 'event', - array(new ServiceClosureArgument(new Reference('foo')), 'onEvent'), + [new ServiceClosureArgument(new Reference('foo')), 'onEvent'], 0, - ), - ), - ); + ], + ], + ]; $this->assertEquals($expectedCalls, $definition->getMethodCalls()); } @@ -120,10 +120,10 @@ public function testHotPathEvents() { $container = new ContainerBuilder(); - $container->register('foo', SubscriberService::class)->addTag('kernel.event_subscriber', array()); + $container->register('foo', SubscriberService::class)->addTag('kernel.event_subscriber', []); $container->register('event_dispatcher', 'stdClass'); - (new RegisterListenersPass())->setHotPathEvents(array('event'))->process($container); + (new RegisterListenersPass())->setHotPathEvents(['event'])->process($container); $this->assertTrue($container->getDefinition('foo')->hasTag('container.hot_path')); } @@ -135,7 +135,7 @@ public function testHotPathEvents() public function testEventSubscriberUnresolvableClassName() { $container = new ContainerBuilder(); - $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array()); + $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', []); $container->register('event_dispatcher', 'stdClass'); $registerListenersPass = new RegisterListenersPass(); @@ -147,8 +147,8 @@ class SubscriberService implements \Symfony\Component\EventDispatcher\EventSubsc { public static function getSubscribedEvents() { - return array( + return [ 'event' => 'onEvent', - ); + ]; } } diff --git a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php b/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php index 9cf68c987f0da4821bb9dde0748ace073d13e2d7..461f86161e0670ae54d60aad2de81947dda4cc23 100644 --- a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php +++ b/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php @@ -31,10 +31,8 @@ class GenericEventTest extends TestCase */ protected function setUp() { - parent::setUp(); - $this->subject = new \stdClass(); - $this->event = new GenericEvent($this->subject, array('name' => 'Event')); + $this->event = new GenericEvent($this->subject, ['name' => 'Event']); } /** @@ -44,13 +42,11 @@ protected function tearDown() { $this->subject = null; $this->event = null; - - parent::tearDown(); } public function testConstruct() { - $this->assertEquals($this->event, new GenericEvent($this->subject, array('name' => 'Event'))); + $this->assertEquals($this->event, new GenericEvent($this->subject, ['name' => 'Event'])); } /** @@ -59,20 +55,20 @@ public function testConstruct() public function testGetArguments() { // test getting all - $this->assertSame(array('name' => 'Event'), $this->event->getArguments()); + $this->assertSame(['name' => 'Event'], $this->event->getArguments()); } public function testSetArguments() { - $result = $this->event->setArguments(array('foo' => 'bar')); - $this->assertAttributeSame(array('foo' => 'bar'), 'arguments', $this->event); + $result = $this->event->setArguments(['foo' => 'bar']); + $this->assertAttributeSame(['foo' => 'bar'], 'arguments', $this->event); $this->assertSame($this->event, $result); } public function testSetArgument() { $result = $this->event->setArgument('foo2', 'bar2'); - $this->assertAttributeSame(array('name' => 'Event', 'foo2' => 'bar2'), 'arguments', $this->event); + $this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event); $this->assertEquals($this->event, $result); } @@ -103,13 +99,13 @@ public function testOffsetGet() public function testOffsetSet() { $this->event['foo2'] = 'bar2'; - $this->assertAttributeSame(array('name' => 'Event', 'foo2' => 'bar2'), 'arguments', $this->event); + $this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event); } public function testOffsetUnset() { unset($this->event['name']); - $this->assertAttributeSame(array(), 'arguments', $this->event); + $this->assertAttributeSame([], 'arguments', $this->event); } public function testOffsetIsset() @@ -131,10 +127,10 @@ public function testGetSubject() public function testHasIterator() { - $data = array(); + $data = []; foreach ($this->event as $key => $value) { $data[$key] = $value; } - $this->assertEquals(array('name' => 'Event'), $data); + $this->assertEquals(['name' => 'Event'], $data); } } diff --git a/vendor/symfony/event-dispatcher/phpunit.xml.dist b/vendor/symfony/event-dispatcher/phpunit.xml.dist index b3ad1bdf5a8e3344357ea623024e7fdfe18b3d8f..f2eb1692cdbbab8633d66aa8b109e017821ed3d8 100644 --- a/vendor/symfony/event-dispatcher/phpunit.xml.dist +++ b/vendor/symfony/event-dispatcher/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/http-foundation/AcceptHeader.php b/vendor/symfony/http-foundation/AcceptHeader.php index d1740266b7a806d56372c3af4395d551f65d0a0f..968b71f5d2aff833125a7ebcb9ed568b1293d5e4 100644 --- a/vendor/symfony/http-foundation/AcceptHeader.php +++ b/vendor/symfony/http-foundation/AcceptHeader.php @@ -24,7 +24,7 @@ class AcceptHeader /** * @var AcceptHeaderItem[] */ - private $items = array(); + private $items = []; /** * @var bool diff --git a/vendor/symfony/http-foundation/AcceptHeaderItem.php b/vendor/symfony/http-foundation/AcceptHeaderItem.php index fe7b08bcad9960cafde1d3884b7bc2a1466d5f76..f6e896874319ad0204ede74fc86e482c74c696a3 100644 --- a/vendor/symfony/http-foundation/AcceptHeaderItem.php +++ b/vendor/symfony/http-foundation/AcceptHeaderItem.php @@ -21,13 +21,13 @@ class AcceptHeaderItem private $value; private $quality = 1.0; private $index = 0; - private $attributes = array(); + private $attributes = []; /** * @param string $value * @param array $attributes */ - public function __construct($value, array $attributes = array()) + public function __construct($value, array $attributes = []) { $this->value = $value; foreach ($attributes as $name => $value) { @@ -46,7 +46,7 @@ public static function fromString($itemValue) { $bits = preg_split('/\s*(?:;*("[^"]+");*|;*(\'[^\']+\');*|;+)\s*/', $itemValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $value = array_shift($bits); - $attributes = array(); + $attributes = []; $lastNullAttribute = null; foreach ($bits as $bit) { @@ -65,7 +65,7 @@ public static function fromString($itemValue) } /** - * Returns header value's string representation. + * Returns header value's string representation. * * @return string */ diff --git a/vendor/symfony/http-foundation/BinaryFileResponse.php b/vendor/symfony/http-foundation/BinaryFileResponse.php index 01740f176646cd606e7f2bbc54eb41c64872931b..cf648dfe9d54f0c0d0d10ea0030dc8d838fc3885 100644 --- a/vendor/symfony/http-foundation/BinaryFileResponse.php +++ b/vendor/symfony/http-foundation/BinaryFileResponse.php @@ -31,8 +31,8 @@ class BinaryFileResponse extends Response * @var File */ protected $file; - protected $offset; - protected $maxlen; + protected $offset = 0; + protected $maxlen = -1; protected $deleteFileAfterSend = false; /** @@ -40,11 +40,11 @@ class BinaryFileResponse extends Response * @param int $status The response status code * @param array $headers An array of response headers * @param bool $public Files are public by default - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename + * @param string|null $contentDisposition The type of Content-Disposition to set automatically with the filename * @param bool $autoEtag Whether the ETag header should be automatically set * @param bool $autoLastModified Whether the Last-Modified header should be automatically set */ - public function __construct($file, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) + public function __construct($file, $status = 200, $headers = [], $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) { parent::__construct(null, $status, $headers); @@ -60,13 +60,13 @@ public function __construct($file, $status = 200, $headers = array(), $public = * @param int $status The response status code * @param array $headers An array of response headers * @param bool $public Files are public by default - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename + * @param string|null $contentDisposition The type of Content-Disposition to set automatically with the filename * @param bool $autoEtag Whether the ETag header should be automatically set * @param bool $autoLastModified Whether the Last-Modified header should be automatically set * * @return static */ - public static function create($file = null, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) + public static function create($file = null, $status = 200, $headers = [], $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) { return new static($file, $status, $headers, $public, $contentDisposition, $autoEtag, $autoLastModified); } @@ -239,7 +239,7 @@ public function prepare(Request $request) if (!$request->headers->has('If-Range') || $this->hasValidIfRangeHeader($request->headers->get('If-Range'))) { $range = $request->headers->get('Range'); - list($start, $end) = explode('-', substr($range, 6), 2) + array(0); + list($start, $end) = explode('-', substr($range, 6), 2) + [0]; $end = ('' === $end) ? $fileSize - 1 : (int) $end; @@ -305,7 +305,7 @@ public function sendContent() fclose($out); fclose($file); - if ($this->deleteFileAfterSend) { + if ($this->deleteFileAfterSend && file_exists($this->file->getPathname())) { unlink($this->file->getPathname()); } diff --git a/vendor/symfony/http-foundation/Cookie.php b/vendor/symfony/http-foundation/Cookie.php index c38aa409da08b89fa1ac08f2fb95fd54f4b57b5f..e61619aa6dd9297d81581e8a4d9119761875e691 100644 --- a/vendor/symfony/http-foundation/Cookie.php +++ b/vendor/symfony/http-foundation/Cookie.php @@ -41,7 +41,7 @@ class Cookie */ public static function fromString($cookie, $decode = false) { - $data = array( + $data = [ 'expires' => 0, 'path' => '/', 'domain' => null, @@ -49,7 +49,7 @@ public static function fromString($cookie, $decode = false) 'httponly' => false, 'raw' => !$decode, 'samesite' => null, - ); + ]; foreach (explode(';', $cookie) as $part) { if (false === strpos($part, '=')) { $key = trim($part); @@ -128,7 +128,7 @@ public function __construct($name, $value = null, $expire = 0, $path = '/', $dom $sameSite = strtolower($sameSite); } - if (!\in_array($sameSite, array(self::SAMESITE_LAX, self::SAMESITE_STRICT, null), true)) { + if (!\in_array($sameSite, [self::SAMESITE_LAX, self::SAMESITE_STRICT, null], true)) { throw new \InvalidArgumentException('The "sameSite" parameter value is not valid.'); } diff --git a/vendor/symfony/http-foundation/ExpressionRequestMatcher.php b/vendor/symfony/http-foundation/ExpressionRequestMatcher.php index e9c8441ce314b2f5a9eb88350b888fe83030636a..26bed7d3713ebe1102d7398c1e8fcfd435e78eba 100644 --- a/vendor/symfony/http-foundation/ExpressionRequestMatcher.php +++ b/vendor/symfony/http-foundation/ExpressionRequestMatcher.php @@ -35,13 +35,13 @@ public function matches(Request $request) throw new \LogicException('Unable to match the request as the expression language is not available.'); } - return $this->language->evaluate($this->expression, array( + return $this->language->evaluate($this->expression, [ 'request' => $request, 'method' => $request->getMethod(), 'path' => rawurldecode($request->getPathInfo()), 'host' => $request->getHost(), 'ip' => $request->getClientIp(), 'attributes' => $request->attributes->all(), - )) && parent::matches($request); + ]) && parent::matches($request); } } diff --git a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php index 263fb321c574515925cb98a8e102f58f026cb628..80f4d47f767c0bfee88014874b5b111dbae8debe 100644 --- a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php @@ -37,7 +37,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface * * @var array */ - protected $guessers = array(); + protected $guessers = []; /** * Returns the singleton instance. diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php index 77bf51b1e5a032b633db261269fc5344e59eabc4..d5acb34094c1181b5cdbb54716f7d6065def5db9 100644 --- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php @@ -20,11 +20,11 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface * A map of mime types and their default extensions. * * This list has been placed under the public domain by the Apache HTTPD project. - * This list has been updated from upstream on 2013-04-23. + * This list has been updated from upstream on 2019-01-14. * - * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types + * @see https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types */ - protected $defaultExtensions = array( + protected $defaultExtensions = [ 'application/andrew-inset' => 'ez', 'application/applixware' => 'aw', 'application/atom+xml' => 'atom', @@ -618,7 +618,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'audio/adpcm' => 'adp', 'audio/basic' => 'au', 'audio/midi' => 'mid', - 'audio/mp4' => 'mp4a', + 'audio/mp4' => 'm4a', 'audio/mpeg' => 'mpga', 'audio/ogg' => 'oga', 'audio/s3m' => 's3m', @@ -653,6 +653,11 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'chemical/x-cml' => 'cml', 'chemical/x-csml' => 'csml', 'chemical/x-xyz' => 'xyz', + 'font/collection' => 'ttc', + 'font/otf' => 'otf', + 'font/ttf' => 'ttf', + 'font/woff' => 'woff', + 'font/woff2' => 'woff2', 'image/bmp' => 'bmp', 'image/x-ms-bmp' => 'bmp', 'image/cgm' => 'cgm', @@ -669,8 +674,8 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'image/tiff' => 'tiff', 'image/vnd.adobe.photoshop' => 'psd', 'image/vnd.dece.graphic' => 'uvi', - 'image/vnd.dvb.subtitle' => 'sub', 'image/vnd.djvu' => 'djvu', + 'image/vnd.dvb.subtitle' => 'sub', 'image/vnd.dwg' => 'dwg', 'image/vnd.dxf' => 'dxf', 'image/vnd.fastbidsheet' => 'fbs', @@ -732,8 +737,8 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'text/vcard' => 'vcard', 'text/vnd.curl' => 'curl', 'text/vnd.curl.dcurl' => 'dcurl', - 'text/vnd.curl.scurl' => 'scurl', 'text/vnd.curl.mcurl' => 'mcurl', + 'text/vnd.curl.scurl' => 'scurl', 'text/vnd.dvb.subtitle' => 'sub', 'text/vnd.fly' => 'fly', 'text/vnd.fmi.flexstor' => 'flx', @@ -747,10 +752,10 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'text/x-asm' => 's', 'text/x-c' => 'c', 'text/x-fortran' => 'f', - 'text/x-pascal' => 'p', 'text/x-java-source' => 'java', - 'text/x-opml' => 'opml', 'text/x-nfo' => 'nfo', + 'text/x-opml' => 'opml', + 'text/x-pascal' => 'p', 'text/x-setext' => 'etx', 'text/x-sfv' => 'sfv', 'text/x-uuencode' => 'uu', @@ -796,7 +801,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'video/x-sgi-movie' => 'movie', 'video/x-smv' => 'smv', 'x-conference/x-cooltalk' => 'ice', - ); + ]; /** * {@inheritdoc} diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php index dae47a7c023d74ad28bceb9a18afdd4daa9e5e9f..95d1ee26762a59f5d6a3013e7e1aaa437bb8ead4 100644 --- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php @@ -51,7 +51,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface * * @var array */ - protected $guessers = array(); + protected $guessers = []; /** * Returns the singleton instance. diff --git a/vendor/symfony/http-foundation/File/UploadedFile.php b/vendor/symfony/http-foundation/File/UploadedFile.php index de6ce75cc94b32075aa290554488f7e623dfe608..a44c664b4c6efdffffb9584b44c3214f93b21216 100644 --- a/vendor/symfony/http-foundation/File/UploadedFile.php +++ b/vendor/symfony/http-foundation/File/UploadedFile.php @@ -249,7 +249,7 @@ public static function getMaxFilesize() */ public function getErrorMessage() { - static $errors = array( + static $errors = [ UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).', UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.', UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.', @@ -257,7 +257,7 @@ public function getErrorMessage() UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.', UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.', UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.', - ); + ]; $errorCode = $this->error; $maxFilesize = UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0; diff --git a/vendor/symfony/http-foundation/FileBag.php b/vendor/symfony/http-foundation/FileBag.php index c135ad6412484cb189149b0baf41a058fa858594..ca849b3d7baf5e923270f9f9c2923805a92b6544 100644 --- a/vendor/symfony/http-foundation/FileBag.php +++ b/vendor/symfony/http-foundation/FileBag.php @@ -21,12 +21,12 @@ */ class FileBag extends ParameterBag { - private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); + private static $fileKeys = ['error', 'name', 'size', 'tmp_name', 'type']; /** * @param array $parameters An array of HTTP files */ - public function __construct(array $parameters = array()) + public function __construct(array $parameters = []) { $this->replace($parameters); } @@ -34,9 +34,9 @@ public function __construct(array $parameters = array()) /** * {@inheritdoc} */ - public function replace(array $files = array()) + public function replace(array $files = []) { - $this->parameters = array(); + $this->parameters = []; $this->add($files); } @@ -55,7 +55,7 @@ public function set($key, $value) /** * {@inheritdoc} */ - public function add(array $files = array()) + public function add(array $files = []) { foreach ($files as $key => $file) { $this->set($key, $file); @@ -87,7 +87,7 @@ protected function convertFileInformation($file) $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']); } } else { - $file = array_map(array($this, 'convertFileInformation'), $file); + $file = array_map([$this, 'convertFileInformation'], $file); if (array_keys($keys) === $keys) { $file = array_filter($file); } @@ -130,13 +130,13 @@ protected function fixPhpFilesArray($data) } foreach ($data['name'] as $key => $name) { - $files[$key] = $this->fixPhpFilesArray(array( + $files[$key] = $this->fixPhpFilesArray([ 'error' => $data['error'][$key], 'name' => $name, 'type' => $data['type'][$key], 'tmp_name' => $data['tmp_name'][$key], 'size' => $data['size'][$key], - )); + ]); } return $files; diff --git a/vendor/symfony/http-foundation/HeaderBag.php b/vendor/symfony/http-foundation/HeaderBag.php index 9da223a66145e75f86fba036ed3421ed171dc0ef..9798173e649bfe61534fc79f88d9ebd00ba8919a 100644 --- a/vendor/symfony/http-foundation/HeaderBag.php +++ b/vendor/symfony/http-foundation/HeaderBag.php @@ -18,13 +18,13 @@ */ class HeaderBag implements \IteratorAggregate, \Countable { - protected $headers = array(); - protected $cacheControl = array(); + protected $headers = []; + protected $cacheControl = []; /** * @param array $headers An array of HTTP headers */ - public function __construct(array $headers = array()) + public function __construct(array $headers = []) { foreach ($headers as $key => $values) { $this->set($key, $values); @@ -80,9 +80,9 @@ public function keys() * * @param array $headers An array of HTTP headers */ - public function replace(array $headers = array()) + public function replace(array $headers = []) { - $this->headers = array(); + $this->headers = []; $this->add($headers); } @@ -101,9 +101,9 @@ public function add(array $headers) /** * Returns a header value by name. * - * @param string $key The header name - * @param string|string[]|null $default The default value - * @param bool $first Whether to return the first value or all header values + * @param string $key The header name + * @param string|null $default The default value + * @param bool $first Whether to return the first value or all header values * * @return string|string[]|null The first header value or default value if $first is true, an array of values otherwise */ @@ -112,12 +112,12 @@ public function get($key, $default = null, $first = true) $key = str_replace('_', '-', strtolower($key)); $headers = $this->all(); - if (!array_key_exists($key, $headers)) { + if (!\array_key_exists($key, $headers)) { if (null === $default) { - return $first ? null : array(); + return $first ? null : []; } - return $first ? $default : array($default); + return $first ? $default : [$default]; } if ($first) { @@ -148,7 +148,7 @@ public function set($key, $values, $replace = true) } } else { if (true === $replace || !isset($this->headers[$key])) { - $this->headers[$key] = array($values); + $this->headers[$key] = [$values]; } else { $this->headers[$key][] = $values; } @@ -168,7 +168,7 @@ public function set($key, $values, $replace = true) */ public function has($key) { - return array_key_exists(str_replace('_', '-', strtolower($key)), $this->all()); + return \array_key_exists(str_replace('_', '-', strtolower($key)), $this->all()); } /** @@ -196,7 +196,7 @@ public function remove($key) unset($this->headers[$key]); if ('cache-control' === $key) { - $this->cacheControl = array(); + $this->cacheControl = []; } } @@ -206,7 +206,7 @@ public function remove($key) * @param string $key The parameter key * @param \DateTime $default The default value * - * @return null|\DateTime The parsed DateTime or the default value if the header does not exist + * @return \DateTime|null The parsed DateTime or the default value if the header does not exist * * @throws \RuntimeException When the HTTP header is not parseable */ @@ -245,7 +245,7 @@ public function addCacheControlDirective($key, $value = true) */ public function hasCacheControlDirective($key) { - return array_key_exists($key, $this->cacheControl); + return \array_key_exists($key, $this->cacheControl); } /** @@ -257,7 +257,7 @@ public function hasCacheControlDirective($key) */ public function getCacheControlDirective($key) { - return array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null; + return \array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null; } /** @@ -294,7 +294,7 @@ public function count() protected function getCacheControlHeader() { - $parts = array(); + $parts = []; ksort($this->cacheControl); foreach ($this->cacheControl as $key => $value) { if (true === $value) { @@ -320,7 +320,7 @@ protected function getCacheControlHeader() */ protected function parseCacheControl($header) { - $cacheControl = array(); + $cacheControl = []; preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER); foreach ($matches as $match) { $cacheControl[strtolower($match[1])] = isset($match[3]) ? $match[3] : (isset($match[2]) ? $match[2] : true); diff --git a/vendor/symfony/http-foundation/IpUtils.php b/vendor/symfony/http-foundation/IpUtils.php index a1bfa90885dcfb9204f220aab5a57b1fcfff21b1..67d13e57aafce553b40259116ddca89db429a996 100644 --- a/vendor/symfony/http-foundation/IpUtils.php +++ b/vendor/symfony/http-foundation/IpUtils.php @@ -18,7 +18,7 @@ */ class IpUtils { - private static $checkedIps = array(); + private static $checkedIps = []; /** * This class should not be instantiated. @@ -38,7 +38,7 @@ private function __construct() public static function checkIp($requestIp, $ips) { if (!\is_array($ips)) { - $ips = array($ips); + $ips = [$ips]; } $method = substr_count($requestIp, ':') > 1 ? 'checkIp6' : 'checkIp4'; diff --git a/vendor/symfony/http-foundation/JsonResponse.php b/vendor/symfony/http-foundation/JsonResponse.php index d741ce099d730fb3d665e118653bd1c6d31bba20..6fb32ee41bdace89b0b833c8cfcacd11824804ec 100644 --- a/vendor/symfony/http-foundation/JsonResponse.php +++ b/vendor/symfony/http-foundation/JsonResponse.php @@ -39,7 +39,7 @@ class JsonResponse extends Response * @param array $headers An array of response headers * @param bool $json If the data is already a JSON string */ - public function __construct($data = null, $status = 200, $headers = array(), $json = false) + public function __construct($data = null, $status = 200, $headers = [], $json = false) { parent::__construct('', $status, $headers); @@ -64,7 +64,7 @@ public function __construct($data = null, $status = 200, $headers = array(), $js * * @return static */ - public static function create($data = null, $status = 200, $headers = array()) + public static function create($data = null, $status = 200, $headers = []) { return new static($data, $status, $headers); } @@ -72,7 +72,7 @@ public static function create($data = null, $status = 200, $headers = array()) /** * Make easier the creation of JsonResponse from raw json. */ - public static function fromJsonString($data = null, $status = 200, $headers = array()) + public static function fromJsonString($data = null, $status = 200, $headers = []) { return new static($data, $status, $headers, true); } @@ -94,11 +94,11 @@ public function setCallback($callback = null) // JsonpCallbackValidator is released under the MIT License. See https://github.com/willdurand/JsonpCallbackValidator/blob/v1.1.0/LICENSE for details. // (c) William Durand <william.durand1@gmail.com> $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?:\[(?:"(?:\\\.|[^"\\\])*"|\'(?:\\\.|[^\'\\\])*\'|\d+)\])*?$/u'; - $reserved = array( + $reserved = [ 'break', 'do', 'instanceof', 'typeof', 'case', 'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue', 'for', 'switch', 'while', 'debugger', 'function', 'this', 'with', 'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum', 'extends', 'super', 'const', 'export', 'import', 'implements', 'let', 'private', 'public', 'yield', 'interface', 'package', 'protected', 'static', 'null', 'true', 'false', - ); + ]; $parts = explode('.', $callback); foreach ($parts as $part) { if (!preg_match($pattern, $part) || \in_array($part, $reserved, true)) { @@ -137,7 +137,7 @@ public function setJson($json) * * @throws \InvalidArgumentException */ - public function setData($data = array()) + public function setData($data = []) { if (\defined('HHVM_VERSION')) { // HHVM does not trigger any warnings and let exceptions diff --git a/vendor/symfony/http-foundation/LICENSE b/vendor/symfony/http-foundation/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/http-foundation/LICENSE +++ b/vendor/symfony/http-foundation/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/http-foundation/ParameterBag.php b/vendor/symfony/http-foundation/ParameterBag.php index e3be0a9b8b22aae583e6a6351cca2b313649eef4..f05e4a2154ecbc418bc50004ec6a9b4c4b2a87c4 100644 --- a/vendor/symfony/http-foundation/ParameterBag.php +++ b/vendor/symfony/http-foundation/ParameterBag.php @@ -26,7 +26,7 @@ class ParameterBag implements \IteratorAggregate, \Countable /** * @param array $parameters An array of parameters */ - public function __construct(array $parameters = array()) + public function __construct(array $parameters = []) { $this->parameters = $parameters; } @@ -56,7 +56,7 @@ public function keys() * * @param array $parameters An array of parameters */ - public function replace(array $parameters = array()) + public function replace(array $parameters = []) { $this->parameters = $parameters; } @@ -66,7 +66,7 @@ public function replace(array $parameters = array()) * * @param array $parameters An array of parameters */ - public function add(array $parameters = array()) + public function add(array $parameters = []) { $this->parameters = array_replace($this->parameters, $parameters); } @@ -81,7 +81,7 @@ public function add(array $parameters = array()) */ public function get($key, $default = null) { - return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default; + return \array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default; } /** @@ -104,7 +104,7 @@ public function set($key, $value) */ public function has($key) { - return array_key_exists($key, $this->parameters); + return \array_key_exists($key, $this->parameters); } /** @@ -154,7 +154,7 @@ public function getAlnum($key, $default = '') public function getDigits($key, $default = '') { // we need to remove - and + because they're allowed in the filter - return str_replace(array('-', '+'), '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT)); + return str_replace(['-', '+'], '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT)); } /** @@ -174,7 +174,7 @@ public function getInt($key, $default = 0) * Returns the parameter value converted to boolean. * * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist + * @param bool $default The default value if the parameter key does not exist * * @return bool The filtered value */ @@ -195,13 +195,13 @@ public function getBoolean($key, $default = false) * * @return mixed */ - public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = array()) + public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = []) { $value = $this->get($key, $default); // Always turn $options into an array - this allows filter_var option shortcuts. if (!\is_array($options) && $options) { - $options = array('flags' => $options); + $options = ['flags' => $options]; } // Add a convenience check for arrays. diff --git a/vendor/symfony/http-foundation/RedirectResponse.php b/vendor/symfony/http-foundation/RedirectResponse.php index 01681dcdf787a1314c716bd6051b1cfc0f69c954..5e1dfe58507fb9ad8018063550fb711bc042f5a7 100644 --- a/vendor/symfony/http-foundation/RedirectResponse.php +++ b/vendor/symfony/http-foundation/RedirectResponse.php @@ -32,7 +32,7 @@ class RedirectResponse extends Response * * @see http://tools.ietf.org/html/rfc2616#section-10.3 */ - public function __construct($url, $status = 302, $headers = array()) + public function __construct($url, $status = 302, $headers = []) { parent::__construct('', $status, $headers); @@ -42,7 +42,7 @@ public function __construct($url, $status = 302, $headers = array()) throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status)); } - if (301 == $status && !array_key_exists('cache-control', $headers)) { + if (301 == $status && !\array_key_exists('cache-control', $headers)) { $this->headers->remove('cache-control'); } } @@ -56,7 +56,7 @@ public function __construct($url, $status = 302, $headers = array()) * * @return static */ - public static function create($url = '', $status = 302, $headers = array()) + public static function create($url = '', $status = 302, $headers = []) { return new static($url, $status, $headers); } diff --git a/vendor/symfony/http-foundation/Request.php b/vendor/symfony/http-foundation/Request.php index 4208f9a62951bb53ed9436366e151584d804e6b3..f6ff0f509954da47d676e4356ab53433b3406ec3 100644 --- a/vendor/symfony/http-foundation/Request.php +++ b/vendor/symfony/http-foundation/Request.php @@ -61,17 +61,17 @@ class Request /** * @var string[] */ - protected static $trustedProxies = array(); + protected static $trustedProxies = []; /** * @var string[] */ - protected static $trustedHostPatterns = array(); + protected static $trustedHostPatterns = []; /** * @var string[] */ - protected static $trustedHosts = array(); + protected static $trustedHosts = []; /** * Names for headers that can be trusted when @@ -84,13 +84,13 @@ class Request * * @deprecated since version 3.3, to be removed in 4.0 */ - protected static $trustedHeaders = array( + protected static $trustedHeaders = [ self::HEADER_FORWARDED => 'FORWARDED', self::HEADER_CLIENT_IP => 'X_FORWARDED_FOR', self::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST', self::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO', self::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT', - ); + ]; protected static $httpMethodParameterOverride = false; @@ -226,20 +226,20 @@ class Request private static $trustedHeaderSet = -1; /** @deprecated since version 3.3, to be removed in 4.0 */ - private static $trustedHeaderNames = array( + private static $trustedHeaderNames = [ self::HEADER_FORWARDED => 'FORWARDED', self::HEADER_CLIENT_IP => 'X_FORWARDED_FOR', self::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST', self::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO', self::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT', - ); + ]; - private static $forwardedParams = array( + private static $forwardedParams = [ self::HEADER_X_FORWARDED_FOR => 'for', self::HEADER_X_FORWARDED_HOST => 'host', self::HEADER_X_FORWARDED_PROTO => 'proto', self::HEADER_X_FORWARDED_PORT => 'host', - ); + ]; /** * @param array $query The GET parameters @@ -250,7 +250,7 @@ class Request * @param array $server The SERVER parameters * @param string|resource|null $content The raw body data */ - public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) + public function __construct(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null) { $this->initialize($query, $request, $attributes, $cookies, $files, $server, $content); } @@ -268,7 +268,7 @@ public function __construct(array $query = array(), array $request = array(), ar * @param array $server The SERVER parameters * @param string|resource|null $content The raw body data */ - public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) + public function initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null) { $this->request = new ParameterBag($request); $this->query = new ParameterBag($query); @@ -303,18 +303,18 @@ public static function createFromGlobals() // HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH fields. $server = $_SERVER; if ('cli-server' === \PHP_SAPI) { - if (array_key_exists('HTTP_CONTENT_LENGTH', $_SERVER)) { + if (\array_key_exists('HTTP_CONTENT_LENGTH', $_SERVER)) { $server['CONTENT_LENGTH'] = $_SERVER['HTTP_CONTENT_LENGTH']; } - if (array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) { + if (\array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) { $server['CONTENT_TYPE'] = $_SERVER['HTTP_CONTENT_TYPE']; } } - $request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $server); + $request = self::createRequestFromFactory($_GET, $_POST, [], $_COOKIE, $_FILES, $server); if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') - && \in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH')) + && \in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), ['PUT', 'DELETE', 'PATCH']) ) { parse_str($request->getContent(), $data); $request->request = new ParameterBag($data); @@ -339,9 +339,9 @@ public static function createFromGlobals() * * @return static */ - public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) + public static function create($uri, $method = 'GET', $parameters = [], $cookies = [], $files = [], $server = [], $content = null) { - $server = array_replace(array( + $server = array_replace([ 'SERVER_NAME' => 'localhost', 'SERVER_PORT' => 80, 'HTTP_HOST' => 'localhost', @@ -354,7 +354,7 @@ public static function create($uri, $method = 'GET', $parameters = array(), $coo 'SCRIPT_FILENAME' => '', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_TIME' => time(), - ), $server); + ], $server); $server['PATH_INFO'] = ''; $server['REQUEST_METHOD'] = strtoupper($method); @@ -377,7 +377,7 @@ public static function create($uri, $method = 'GET', $parameters = array(), $coo if (isset($components['port'])) { $server['SERVER_PORT'] = $components['port']; - $server['HTTP_HOST'] = $server['HTTP_HOST'].':'.$components['port']; + $server['HTTP_HOST'] .= ':'.$components['port']; } if (isset($components['user'])) { @@ -402,10 +402,10 @@ public static function create($uri, $method = 'GET', $parameters = array(), $coo // no break case 'PATCH': $request = $parameters; - $query = array(); + $query = []; break; default: - $request = array(); + $request = []; $query = $parameters; break; } @@ -428,7 +428,7 @@ public static function create($uri, $method = 'GET', $parameters = array(), $coo $server['REQUEST_URI'] = $components['path'].('' !== $queryString ? '?'.$queryString : ''); $server['QUERY_STRING'] = $queryString; - return self::createRequestFromFactory($query, $request, array(), $cookies, $files, $server, $content); + return self::createRequestFromFactory($query, $request, [], $cookies, $files, $server, $content); } /** @@ -532,7 +532,7 @@ public function __toString() } $cookieHeader = ''; - $cookies = array(); + $cookies = []; foreach ($this->cookies as $k => $v) { $cookies[] = $k.'='.$v; @@ -566,19 +566,19 @@ public function overrideGlobals() foreach ($this->headers->all() as $key => $value) { $key = strtoupper(str_replace('-', '_', $key)); - if (\in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) { + if (\in_array($key, ['CONTENT_TYPE', 'CONTENT_LENGTH'])) { $_SERVER[$key] = implode(', ', $value); } else { $_SERVER['HTTP_'.$key] = implode(', ', $value); } } - $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE); + $request = ['g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE]; $requestOrder = ini_get('request_order') ?: ini_get('variables_order'); $requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp'; - $_REQUEST = array(); + $_REQUEST = []; foreach (str_split($requestOrder) as $order) { $_REQUEST = array_merge($_REQUEST, $request[$order]); } @@ -644,7 +644,7 @@ public static function setTrustedHosts(array $hostPatterns) return sprintf('{%s}i', $hostPattern); }, $hostPatterns); // we need to reset trusted hosts on trusted host patterns change - self::$trustedHosts = array(); + self::$trustedHosts = []; } /** @@ -691,7 +691,7 @@ public static function setTrustedHeaderName($key, $value) $key = self::HEADER_CLIENT_PROTO; } elseif ('client_port' === $key) { $key = self::HEADER_CLIENT_PORT; - } elseif (!array_key_exists($key, self::$trustedHeaders)) { + } elseif (!\array_key_exists($key, self::$trustedHeaders)) { throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key)); } @@ -722,7 +722,7 @@ public static function getTrustedHeaderName($key) @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead.', __METHOD__), E_USER_DEPRECATED); } - if (!array_key_exists($key, self::$trustedHeaders)) { + if (!\array_key_exists($key, self::$trustedHeaders)) { throw new \InvalidArgumentException(sprintf('Unable to get the trusted header name for key "%s".', $key)); } @@ -745,8 +745,8 @@ public static function normalizeQueryString($qs) return ''; } - $parts = array(); - $order = array(); + $parts = []; + $order = []; foreach (explode('&', $qs) as $param) { if ('' === $param || '=' === $param[0]) { @@ -893,10 +893,10 @@ public function getClientIps() $ip = $this->server->get('REMOTE_ADDR'); if (!$this->isFromTrustedProxy()) { - return array($ip); + return [$ip]; } - return $this->getTrustedValues(self::HEADER_CLIENT_IP, $ip) ?: array($ip); + return $this->getTrustedValues(self::HEADER_CLIENT_IP, $ip) ?: [$ip]; } /** @@ -1186,7 +1186,7 @@ public function getRelativeUriForPath($path) } $sourceDirs = explode('/', isset($basePath[0]) && '/' === $basePath[0] ? substr($basePath, 1) : $basePath); - $targetDirs = explode('/', isset($path[0]) && '/' === $path[0] ? substr($path, 1) : $path); + $targetDirs = explode('/', substr($path, 1)); array_pop($sourceDirs); $targetFile = array_pop($targetDirs); @@ -1242,7 +1242,7 @@ public function getQueryString() public function isSecure() { if ($this->isFromTrustedProxy() && $proto = $this->getTrustedValues(self::HEADER_CLIENT_PROTO)) { - return \in_array(strtolower($proto[0]), array('https', 'on', 'ssl', '1'), true); + return \in_array(strtolower($proto[0]), ['https', 'on', 'ssl', '1'], true); } $https = $this->server->get('HTTPS'); @@ -1405,7 +1405,7 @@ public static function getMimeTypes($format) static::initializeFormats(); } - return isset(static::$formats[$format]) ? static::$formats[$format] : array(); + return isset(static::$formats[$format]) ? static::$formats[$format] : []; } /** @@ -1419,7 +1419,7 @@ public function getFormat($mimeType) { $canonicalMimeType = null; if (false !== $pos = strpos($mimeType, ';')) { - $canonicalMimeType = substr($mimeType, 0, $pos); + $canonicalMimeType = trim(substr($mimeType, 0, $pos)); } if (null === static::$formats) { @@ -1448,7 +1448,7 @@ public function setFormat($format, $mimeTypes) static::initializeFormats(); } - static::$formats[$format] = \is_array($mimeTypes) ? $mimeTypes : array($mimeTypes); + static::$formats[$format] = \is_array($mimeTypes) ? $mimeTypes : [$mimeTypes]; } /** @@ -1460,7 +1460,7 @@ public function setFormat($format, $mimeTypes) * * _format request attribute * * $default * - * @param string $default The default format + * @param string|null $default The default format * * @return string The request format */ @@ -1565,10 +1565,10 @@ public function isMethodSafe(/* $andCacheable = true */) // then setting $andCacheable to false should be deprecated in 4.1 @trigger_error('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since Symfony 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.', E_USER_DEPRECATED); - return \in_array($this->getMethod(), array('GET', 'HEAD')); + return \in_array($this->getMethod(), ['GET', 'HEAD']); } - return \in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE')); + return \in_array($this->getMethod(), ['GET', 'HEAD', 'OPTIONS', 'TRACE']); } /** @@ -1578,7 +1578,7 @@ public function isMethodSafe(/* $andCacheable = true */) */ public function isMethodIdempotent() { - return \in_array($this->getMethod(), array('HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE')); + return \in_array($this->getMethod(), ['HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE']); } /** @@ -1586,11 +1586,11 @@ public function isMethodIdempotent() * * @see https://tools.ietf.org/html/rfc7231#section-4.2.3 * - * @return bool + * @return bool True for GET and HEAD, false otherwise */ public function isMethodCacheable() { - return \in_array($this->getMethod(), array('GET', 'HEAD')); + return \in_array($this->getMethod(), ['GET', 'HEAD']); } /** @@ -1704,7 +1704,7 @@ public function getPreferredLanguage(array $locales = null) return $locales[0]; } - $extendedPreferredLanguages = array(); + $extendedPreferredLanguages = []; foreach ($preferredLanguages as $language) { $extendedPreferredLanguages[] = $language; if (false !== $position = strpos($language, '_')) { @@ -1732,7 +1732,7 @@ public function getLanguages() } $languages = AcceptHeader::fromString($this->headers->get('Accept-Language'))->all(); - $this->languages = array(); + $this->languages = []; foreach ($languages as $lang => $acceptHeaderItem) { if (false !== strpos($lang, '-')) { $codes = explode('-', $lang); @@ -1836,10 +1836,24 @@ protected function prepareRequestUri() $this->server->remove('IIS_WasUrlRewritten'); } elseif ($this->server->has('REQUEST_URI')) { $requestUri = $this->server->get('REQUEST_URI'); - // HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path, only use URL path - $schemeAndHttpHost = $this->getSchemeAndHttpHost(); - if (0 === strpos($requestUri, $schemeAndHttpHost)) { - $requestUri = substr($requestUri, \strlen($schemeAndHttpHost)); + + if ('' !== $requestUri && '/' === $requestUri[0]) { + // To only use path and query remove the fragment. + if (false !== $pos = strpos($requestUri, '#')) { + $requestUri = substr($requestUri, 0, $pos); + } + } else { + // HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path, + // only use URL path. + $uriComponents = parse_url($requestUri); + + if (isset($uriComponents['path'])) { + $requestUri = $uriComponents['path']; + } + + if (isset($uriComponents['query'])) { + $requestUri .= '?'.$uriComponents['query']; + } } } elseif ($this->server->has('ORIG_PATH_INFO')) { // IIS 5.0, PHP as CGI @@ -1988,19 +2002,19 @@ protected function preparePathInfo() */ protected static function initializeFormats() { - static::$formats = array( - 'html' => array('text/html', 'application/xhtml+xml'), - 'txt' => array('text/plain'), - 'js' => array('application/javascript', 'application/x-javascript', 'text/javascript'), - 'css' => array('text/css'), - 'json' => array('application/json', 'application/x-json'), - 'jsonld' => array('application/ld+json'), - 'xml' => array('text/xml', 'application/xml', 'application/x-xml'), - 'rdf' => array('application/rdf+xml'), - 'atom' => array('application/atom+xml'), - 'rss' => array('application/rss+xml'), - 'form' => array('application/x-www-form-urlencoded'), - ); + static::$formats = [ + 'html' => ['text/html', 'application/xhtml+xml'], + 'txt' => ['text/plain'], + 'js' => ['application/javascript', 'application/x-javascript', 'text/javascript'], + 'css' => ['text/css'], + 'json' => ['application/json', 'application/x-json'], + 'jsonld' => ['application/ld+json'], + 'xml' => ['text/xml', 'application/xml', 'application/x-xml'], + 'rdf' => ['application/rdf+xml'], + 'atom' => ['application/atom+xml'], + 'rss' => ['application/rss+xml'], + 'form' => ['application/x-www-form-urlencoded'], + ]; } /** @@ -2045,7 +2059,7 @@ private function getUrlencodedPrefix($string, $prefix) return false; } - private static function createRequestFromFactory(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) + private static function createRequestFromFactory(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null) { if (self::$requestFactory) { $request = \call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content); @@ -2075,8 +2089,8 @@ public function isFromTrustedProxy() private function getTrustedValues($type, $ip = null) { - $clientValues = array(); - $forwardedValues = array(); + $clientValues = []; + $forwardedValues = []; if (self::$trustedHeaders[$type] && $this->headers->has(self::$trustedHeaders[$type])) { foreach (explode(',', $this->headers->get(self::$trustedHeaders[$type])) as $v) { @@ -2086,10 +2100,13 @@ private function getTrustedValues($type, $ip = null) if (self::$trustedHeaders[self::HEADER_FORWARDED] && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) { $forwardedValues = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]); - $forwardedValues = preg_match_all(sprintf('{(?:%s)=(?:"?\[?)([a-zA-Z0-9\.:_\-/]*+)}', self::$forwardedParams[$type]), $forwardedValues, $matches) ? $matches[1] : array(); + $forwardedValues = preg_match_all(sprintf('{(?:%s)="?([a-zA-Z0-9\.:_\-/\[\]]*+)}', self::$forwardedParams[$type]), $forwardedValues, $matches) ? $matches[1] : []; if (self::HEADER_CLIENT_PORT === $type) { foreach ($forwardedValues as $k => $v) { - $forwardedValues[$k] = substr_replace($v, '0.0.0.0', 0, strrpos($v, ':')); + if (']' === substr($v, -1) || false === $v = strrchr($v, ':')) { + $v = $this->isSecure() ? ':443' : ':80'; + } + $forwardedValues[$k] = '0.0.0.0'.$v; } } } @@ -2108,7 +2125,7 @@ private function getTrustedValues($type, $ip = null) } if (!$this->isForwardedValid) { - return null !== $ip ? array('0.0.0.0', $ip) : array(); + return null !== $ip ? ['0.0.0.0', $ip] : []; } $this->isForwardedValid = false; @@ -2118,15 +2135,23 @@ private function getTrustedValues($type, $ip = null) private function normalizeAndFilterClientIps(array $clientIps, $ip) { if (!$clientIps) { - return array(); + return []; } $clientIps[] = $ip; // Complete the IP chain with the IP the request actually came from $firstTrustedIp = null; foreach ($clientIps as $key => $clientIp) { - // Remove port (unfortunately, it does happen) - if (preg_match('{((?:\d+\.){3}\d+)\:\d+}', $clientIp, $match)) { - $clientIps[$key] = $clientIp = $match[1]; + if (strpos($clientIp, '.')) { + // Strip :port from IPv4 addresses. This is allowed in Forwarded + // and may occur in X-Forwarded-For. + $i = strpos($clientIp, ':'); + if ($i) { + $clientIps[$key] = $clientIp = substr($clientIp, 0, $i); + } + } elseif (0 === strpos($clientIp, '[')) { + // Strip brackets and :port from IPv6 addresses. + $i = strpos($clientIp, ']', 1); + $clientIps[$key] = $clientIp = substr($clientIp, 1, $i - 1); } if (!filter_var($clientIp, FILTER_VALIDATE_IP)) { @@ -2146,6 +2171,6 @@ private function normalizeAndFilterClientIps(array $clientIps, $ip) } // Now the IP chain contains only untrusted proxies and the client IP - return $clientIps ? array_reverse($clientIps) : array($firstTrustedIp); + return $clientIps ? array_reverse($clientIps) : [$firstTrustedIp]; } } diff --git a/vendor/symfony/http-foundation/RequestMatcher.php b/vendor/symfony/http-foundation/RequestMatcher.php index 6b4cef147d99fd68a13fb15f5aecd82157565bdf..cadf70c5b4106b54daab2ff74ed00563d39dd293 100644 --- a/vendor/symfony/http-foundation/RequestMatcher.php +++ b/vendor/symfony/http-foundation/RequestMatcher.php @@ -31,22 +31,22 @@ class RequestMatcher implements RequestMatcherInterface /** * @var string[] */ - private $methods = array(); + private $methods = []; /** * @var string[] */ - private $ips = array(); + private $ips = []; /** * @var array */ - private $attributes = array(); + private $attributes = []; /** * @var string[] */ - private $schemes = array(); + private $schemes = []; /** * @param string|null $path @@ -56,7 +56,7 @@ class RequestMatcher implements RequestMatcherInterface * @param array $attributes * @param string|string[]|null $schemes */ - public function __construct($path = null, $host = null, $methods = null, $ips = null, array $attributes = array(), $schemes = null) + public function __construct($path = null, $host = null, $methods = null, $ips = null, array $attributes = [], $schemes = null) { $this->matchPath($path); $this->matchHost($host); @@ -76,7 +76,7 @@ public function __construct($path = null, $host = null, $methods = null, $ips = */ public function matchScheme($scheme) { - $this->schemes = null !== $scheme ? array_map('strtolower', (array) $scheme) : array(); + $this->schemes = null !== $scheme ? array_map('strtolower', (array) $scheme) : []; } /** @@ -116,7 +116,7 @@ public function matchIp($ip) */ public function matchIps($ips) { - $this->ips = null !== $ips ? (array) $ips : array(); + $this->ips = null !== $ips ? (array) $ips : []; } /** @@ -126,7 +126,7 @@ public function matchIps($ips) */ public function matchMethod($method) { - $this->methods = null !== $method ? array_map('strtoupper', (array) $method) : array(); + $this->methods = null !== $method ? array_map('strtoupper', (array) $method) : []; } /** diff --git a/vendor/symfony/http-foundation/RequestStack.php b/vendor/symfony/http-foundation/RequestStack.php index 40123f66f910bb71ed423e079d1aae5585315e2e..885d78a50e6e5016daa3186c5ea3191536128b87 100644 --- a/vendor/symfony/http-foundation/RequestStack.php +++ b/vendor/symfony/http-foundation/RequestStack.php @@ -21,7 +21,7 @@ class RequestStack /** * @var Request[] */ - private $requests = array(); + private $requests = []; /** * Pushes a Request on the stack. diff --git a/vendor/symfony/http-foundation/Response.php b/vendor/symfony/http-foundation/Response.php index 4e9fb8723c96b8d5f8ffeebf2b62dc7580343c44..4d63219b2db212dc35600ffad362692b555b50d0 100644 --- a/vendor/symfony/http-foundation/Response.php +++ b/vendor/symfony/http-foundation/Response.php @@ -128,7 +128,7 @@ class Response * * @var array */ - public static $statusTexts = array( + public static $statusTexts = [ 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', // RFC2518 @@ -191,7 +191,7 @@ class Response 508 => 'Loop Detected', // RFC5842 510 => 'Not Extended', // RFC2774 511 => 'Network Authentication Required', // RFC6585 - ); + ]; /** * @param mixed $content The response content, see setContent() @@ -200,7 +200,7 @@ class Response * * @throws \InvalidArgumentException When the HTTP status code is not valid */ - public function __construct($content = '', $status = 200, $headers = array()) + public function __construct($content = '', $status = 200, $headers = []) { $this->headers = new ResponseHeaderBag($headers); $this->setContent($content); @@ -222,7 +222,7 @@ public function __construct($content = '', $status = 200, $headers = array()) * * @return static */ - public static function create($content = '', $status = 200, $headers = array()) + public static function create($content = '', $status = 200, $headers = []) { return new static($content, $status, $headers); } @@ -334,8 +334,9 @@ public function sendHeaders() // headers foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) { + $replace = 0 === strcasecmp($name, 'Content-Type'); foreach ($values as $value) { - header($name.': '.$value, false, $this->statusCode); + header($name.': '.$value, $replace, $this->statusCode); } } @@ -374,7 +375,7 @@ public function send() if (\function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); - } elseif (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) { + } elseif (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) { static::closeOutputBuffers(0, true); } @@ -394,7 +395,7 @@ public function send() */ public function setContent($content) { - if (null !== $content && !\is_string($content) && !is_numeric($content) && !\is_callable(array($content, '__toString'))) { + if (null !== $content && !\is_string($content) && !is_numeric($content) && !\is_callable([$content, '__toString'])) { throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', \gettype($content))); } @@ -541,7 +542,7 @@ public function getCharset() */ public function isCacheable() { - if (!\in_array($this->statusCode, array(200, 203, 300, 301, 302, 404, 410))) { + if (!\in_array($this->statusCode, [200, 203, 300, 301, 302, 404, 410])) { return false; } @@ -718,6 +719,7 @@ public function expire() { if ($this->isFresh()) { $this->headers->set('Age', $this->getMaxAge()); + $this->headers->remove('Expires'); } return $this; @@ -972,8 +974,8 @@ public function setEtag($etag = null, $weak = false) */ public function setCache(array $options) { - if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'))) { - throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff)))); + if ($diff = array_diff(array_keys($options), ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'])) { + throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', $diff))); } if (isset($options['etag'])) { @@ -1033,7 +1035,7 @@ public function setNotModified() $this->setContent(null); // remove headers that MUST NOT be included with 304 Not Modified responses - foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) { + foreach (['Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified'] as $header) { $this->headers->remove($header); } @@ -1062,10 +1064,10 @@ public function hasVary() public function getVary() { if (!$vary = $this->headers->get('Vary', null, false)) { - return array(); + return []; } - $ret = array(); + $ret = []; foreach ($vary as $item) { $ret = array_merge($ret, preg_split('/[\s,]+/', $item)); } @@ -1247,7 +1249,7 @@ public function isNotFound() */ public function isRedirect($location = null) { - return \in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location')); + return \in_array($this->statusCode, [201, 301, 302, 303, 307, 308]) && (null === $location ?: $location == $this->headers->get('Location')); } /** @@ -1259,7 +1261,7 @@ public function isRedirect($location = null) */ public function isEmpty() { - return \in_array($this->statusCode, array(204, 304)); + return \in_array($this->statusCode, [204, 304]); } /** diff --git a/vendor/symfony/http-foundation/ResponseHeaderBag.php b/vendor/symfony/http-foundation/ResponseHeaderBag.php index 00cff7af087443215b6ac24628c95f3c4f5fe799..1dc8dc2c5f65137cf9c05d192e67c159ed5f70c1 100644 --- a/vendor/symfony/http-foundation/ResponseHeaderBag.php +++ b/vendor/symfony/http-foundation/ResponseHeaderBag.php @@ -24,11 +24,11 @@ class ResponseHeaderBag extends HeaderBag const DISPOSITION_ATTACHMENT = 'attachment'; const DISPOSITION_INLINE = 'inline'; - protected $computedCacheControl = array(); - protected $cookies = array(); - protected $headerNames = array(); + protected $computedCacheControl = []; + protected $cookies = []; + protected $headerNames = []; - public function __construct(array $headers = array()) + public function __construct(array $headers = []) { parent::__construct($headers); @@ -49,7 +49,7 @@ public function __construct(array $headers = array()) */ public function allPreserveCase() { - $headers = array(); + $headers = []; foreach ($this->all() as $name => $value) { $headers[isset($this->headerNames[$name]) ? $this->headerNames[$name] : $name] = $value; } @@ -70,9 +70,9 @@ public function allPreserveCaseWithoutCookies() /** * {@inheritdoc} */ - public function replace(array $headers = array()) + public function replace(array $headers = []) { - $this->headerNames = array(); + $this->headerNames = []; parent::replace($headers); @@ -107,7 +107,7 @@ public function set($key, $values, $replace = true) if ('set-cookie' === $uniqueKey) { if ($replace) { - $this->cookies = array(); + $this->cookies = []; } foreach ((array) $values as $cookie) { $this->setCookie(Cookie::fromString($cookie)); @@ -122,9 +122,9 @@ public function set($key, $values, $replace = true) parent::set($key, $values, $replace); // ensure the cache-control header has sensible defaults - if (\in_array($uniqueKey, array('cache-control', 'etag', 'last-modified', 'expires'), true)) { + if (\in_array($uniqueKey, ['cache-control', 'etag', 'last-modified', 'expires'], true)) { $computed = $this->computeCacheControlValue(); - $this->headers['cache-control'] = array($computed); + $this->headers['cache-control'] = [$computed]; $this->headerNames['cache-control'] = 'Cache-Control'; $this->computedCacheControl = $this->parseCacheControl($computed); } @@ -139,7 +139,7 @@ public function remove($key) unset($this->headerNames[$uniqueKey]); if ('set-cookie' === $uniqueKey) { - $this->cookies = array(); + $this->cookies = []; return; } @@ -147,7 +147,7 @@ public function remove($key) parent::remove($key); if ('cache-control' === $uniqueKey) { - $this->computedCacheControl = array(); + $this->computedCacheControl = []; } if ('date' === $uniqueKey) { @@ -160,7 +160,7 @@ public function remove($key) */ public function hasCacheControlDirective($key) { - return array_key_exists($key, $this->computedCacheControl); + return \array_key_exists($key, $this->computedCacheControl); } /** @@ -168,7 +168,7 @@ public function hasCacheControlDirective($key) */ public function getCacheControlDirective($key) { - return array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null; + return \array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null; } public function setCookie(Cookie $cookie) @@ -216,15 +216,15 @@ public function removeCookie($name, $path = '/', $domain = null) */ public function getCookies($format = self::COOKIES_FLAT) { - if (!\in_array($format, array(self::COOKIES_FLAT, self::COOKIES_ARRAY))) { - throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', array(self::COOKIES_FLAT, self::COOKIES_ARRAY)))); + if (!\in_array($format, [self::COOKIES_FLAT, self::COOKIES_ARRAY])) { + throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', [self::COOKIES_FLAT, self::COOKIES_ARRAY]))); } if (self::COOKIES_ARRAY === $format) { return $this->cookies; } - $flattenedCookies = array(); + $flattenedCookies = []; foreach ($this->cookies as $path) { foreach ($path as $cookies) { foreach ($cookies as $cookie) { @@ -267,7 +267,7 @@ public function clearCookie($name, $path = '/', $domain = null, $secure = false, */ public function makeDisposition($disposition, $filename, $filenameFallback = '') { - if (!\in_array($disposition, array(self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE))) { + if (!\in_array($disposition, [self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE])) { throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE)); } diff --git a/vendor/symfony/http-foundation/ServerBag.php b/vendor/symfony/http-foundation/ServerBag.php index d8ab561aafb17565e40bde10795f6fba10a56668..90da49fae5dbe69874096563bc97e706d7054f4c 100644 --- a/vendor/symfony/http-foundation/ServerBag.php +++ b/vendor/symfony/http-foundation/ServerBag.php @@ -27,8 +27,8 @@ class ServerBag extends ParameterBag */ public function getHeaders() { - $headers = array(); - $contentHeaders = array('CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true); + $headers = []; + $contentHeaders = ['CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true]; foreach ($this->parameters as $key => $value) { if (0 === strpos($key, 'HTTP_')) { $headers[substr($key, 5)] = $value; diff --git a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php index fc5fb14101b29099c44c499437b790699a7b9dbd..07118e891b5de0013f2aebe9106f41cac72c4530 100644 --- a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php +++ b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php @@ -19,7 +19,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta private $name = 'attributes'; private $storageKey; - protected $attributes = array(); + protected $attributes = []; /** * @param string $storageKey The key used to store attributes in the session @@ -63,7 +63,7 @@ public function getStorageKey() */ public function has($name) { - return array_key_exists($name, $this->attributes); + return \array_key_exists($name, $this->attributes); } /** @@ -71,7 +71,7 @@ public function has($name) */ public function get($name, $default = null) { - return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default; + return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default; } /** @@ -95,7 +95,7 @@ public function all() */ public function replace(array $attributes) { - $this->attributes = array(); + $this->attributes = []; foreach ($attributes as $key => $value) { $this->set($key, $value); } @@ -107,7 +107,7 @@ public function replace(array $attributes) public function remove($name) { $retval = null; - if (array_key_exists($name, $this->attributes)) { + if (\array_key_exists($name, $this->attributes)) { $retval = $this->attributes[$name]; unset($this->attributes[$name]); } @@ -121,7 +121,7 @@ public function remove($name) public function clear() { $return = $this->attributes; - $this->attributes = array(); + $this->attributes = []; return $return; } diff --git a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php index 2f1e01a971a944e360369560b8224c93a5c6cdd8..bbf2e39c81059f229dfb8abeab7d71792dd0d2a8 100644 --- a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php +++ b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php @@ -44,7 +44,7 @@ public function has($name) return false; } - return array_key_exists($name, $attributes); + return \array_key_exists($name, $attributes); } /** @@ -60,7 +60,7 @@ public function get($name, $default = null) return $default; } - return array_key_exists($name, $attributes) ? $attributes[$name] : $default; + return \array_key_exists($name, $attributes) ? $attributes[$name] : $default; } /** @@ -81,7 +81,7 @@ public function remove($name) $retval = null; $attributes = &$this->resolveAttributePath($name); $name = $this->resolveKey($name); - if (null !== $attributes && array_key_exists($name, $attributes)) { + if (null !== $attributes && \array_key_exists($name, $attributes)) { $retval = $attributes[$name]; unset($attributes[$name]); } @@ -115,7 +115,7 @@ protected function &resolveAttributePath($name, $writeContext = false) return $array; } - $array[$parts[0]] = array(); + $array[$parts[0]] = []; return $array; } @@ -123,14 +123,14 @@ protected function &resolveAttributePath($name, $writeContext = false) unset($parts[\count($parts) - 1]); foreach ($parts as $part) { - if (null !== $array && !array_key_exists($part, $array)) { + if (null !== $array && !\array_key_exists($part, $array)) { if (!$writeContext) { $null = null; return $null; } - $array[$part] = array(); + $array[$part] = []; } $array = &$array[$part]; diff --git a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php index 77521c24789c681def801d829b4315354b585b97..451c4a5a1d089da9f527741eae67d554d4e564a1 100644 --- a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php +++ b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php @@ -19,7 +19,7 @@ class AutoExpireFlashBag implements FlashBagInterface { private $name = 'flashes'; - private $flashes = array('display' => array(), 'new' => array()); + private $flashes = ['display' => [], 'new' => []]; private $storageKey; /** @@ -53,8 +53,8 @@ public function initialize(array &$flashes) // The logic: messages from the last request will be stored in new, so we move them to previous // This request we will show what is in 'display'. What is placed into 'new' this time round will // be moved to display next time round. - $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array(); - $this->flashes['new'] = array(); + $this->flashes['display'] = \array_key_exists('new', $this->flashes) ? $this->flashes['new'] : []; + $this->flashes['new'] = []; } /** @@ -68,7 +68,7 @@ public function add($type, $message) /** * {@inheritdoc} */ - public function peek($type, array $default = array()) + public function peek($type, array $default = []) { return $this->has($type) ? $this->flashes['display'][$type] : $default; } @@ -78,13 +78,13 @@ public function peek($type, array $default = array()) */ public function peekAll() { - return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array(); + return \array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : []; } /** * {@inheritdoc} */ - public function get($type, array $default = array()) + public function get($type, array $default = []) { $return = $default; @@ -106,7 +106,7 @@ public function get($type, array $default = array()) public function all() { $return = $this->flashes['display']; - $this->flashes['display'] = array(); + $this->flashes['display'] = []; return $return; } @@ -132,7 +132,7 @@ public function set($type, $messages) */ public function has($type) { - return array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type]; + return \array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type]; } /** diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php index 12fb740c5220c4c7b9908ff445a5283d0d5b6aae..f5d984af081b2bf74372c4275dbed8ffcd70341a 100644 --- a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php +++ b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php @@ -19,7 +19,7 @@ class FlashBag implements FlashBagInterface { private $name = 'flashes'; - private $flashes = array(); + private $flashes = []; private $storageKey; /** @@ -62,7 +62,7 @@ public function add($type, $message) /** * {@inheritdoc} */ - public function peek($type, array $default = array()) + public function peek($type, array $default = []) { return $this->has($type) ? $this->flashes[$type] : $default; } @@ -78,7 +78,7 @@ public function peekAll() /** * {@inheritdoc} */ - public function get($type, array $default = array()) + public function get($type, array $default = []) { if (!$this->has($type)) { return $default; @@ -97,7 +97,7 @@ public function get($type, array $default = array()) public function all() { $return = $this->peekAll(); - $this->flashes = array(); + $this->flashes = []; return $return; } @@ -123,7 +123,7 @@ public function setAll(array $messages) */ public function has($type) { - return array_key_exists($type, $this->flashes) && $this->flashes[$type]; + return \array_key_exists($type, $this->flashes) && $this->flashes[$type]; } /** diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php index f53c9dae6c0aa41d03012fcc7c4bb258223f8d72..2bd1d62bdbf12bb9e33b6161f4edf0c6a8f193c3 100644 --- a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php +++ b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php @@ -44,7 +44,7 @@ public function set($type, $message); * * @return array */ - public function peek($type, array $default = array()); + public function peek($type, array $default = []); /** * Gets all flash messages. @@ -61,7 +61,7 @@ public function peekAll(); * * @return array */ - public function get($type, array $default = array()); + public function get($type, array $default = []); /** * Gets and clears flashes from the stack. diff --git a/vendor/symfony/http-foundation/Session/Session.php b/vendor/symfony/http-foundation/Session/Session.php index 8a33a9c3a725e8dd80eb0b0548d3225badc53865..867ceba97f8dba8259d605d9860a3a29c98788d5 100644 --- a/vendor/symfony/http-foundation/Session/Session.php +++ b/vendor/symfony/http-foundation/Session/Session.php @@ -28,7 +28,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable private $flashName; private $attributeName; - private $data = array(); + private $data = []; private $usageIndex = 0; /** @@ -209,7 +209,9 @@ public function getId() */ public function setId($id) { - $this->storage->setId($id); + if ($this->storage->getId() !== $id) { + $this->storage->setId($id); + } } /** diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php index 5b5c1d8170dfdeaba84ea70547da1273cb70ce89..eb09c0b54e01f74e5f83033929578e2b687f31fc 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php @@ -113,7 +113,7 @@ public function write($sessionId, $data) } if (null === $this->igbinaryEmptyData) { // see https://github.com/igbinary/igbinary/issues/146 - $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize(array()) : ''; + $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize([]) : ''; } if ('' === $data || $this->igbinaryEmptyData === $data) { return $this->destroy($sessionId); @@ -131,14 +131,14 @@ public function destroy($sessionId) if (\PHP_VERSION_ID < 70000) { $this->prefetchData = null; } - if (!headers_sent() && ini_get('session.use_cookies')) { + if (!headers_sent() && filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN)) { if (!$this->sessionName) { throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', \get_class($this))); } $sessionCookie = sprintf(' %s=', urlencode($this->sessionName)); $sessionCookieWithId = sprintf('%s%s;', $sessionCookie, urlencode($sessionId)); $sessionCookieFound = false; - $otherCookies = array(); + $otherCookies = []; foreach (headers_list() as $h) { if (0 !== stripos($h, 'Set-Cookie:')) { continue; @@ -159,7 +159,7 @@ public function destroy($sessionId) header($h, false); } } else { - setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly')); + setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), filter_var(ini_get('session.cookie_secure'), FILTER_VALIDATE_BOOLEAN), filter_var(ini_get('session.cookie_httponly'), FILTER_VALIDATE_BOOLEAN)); } } diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php index 90726beb04efe668a3017281e28323f457c246ea..3abc33caa55c0c1801cdde0004217e6787f1affd 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -44,12 +44,10 @@ class MemcacheSessionHandler implements \SessionHandlerInterface * * @throws \InvalidArgumentException When unsupported options are passed */ - public function __construct(\Memcache $memcache, array $options = array()) + public function __construct(\Memcache $memcache, array $options = []) { - if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { - throw new \InvalidArgumentException(sprintf( - 'The following options are not supported "%s"', implode(', ', $diff) - )); + if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) { + throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff))); } $this->memcache = $memcache; diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php index dd37eae14e10d7dc067155583f2dc643f0a332fb..1db590b36078396edc319fed9ea0b1bb34ae8907 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -45,14 +45,12 @@ class MemcachedSessionHandler extends AbstractSessionHandler * * @throws \InvalidArgumentException When unsupported options are passed */ - public function __construct(\Memcached $memcached, array $options = array()) + public function __construct(\Memcached $memcached, array $options = []) { $this->memcached = $memcached; - if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { - throw new \InvalidArgumentException(sprintf( - 'The following options are not supported "%s"', implode(', ', $diff) - )); + if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) { + throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff))); } $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400; @@ -64,7 +62,7 @@ public function __construct(\Memcached $memcached, array $options = array()) */ public function close() { - return true; + return $this->memcached->quit(); } /** diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php index 7d3fa218a269d62fef8b23cad74b672b63fe2e35..3b5ccaa8359526669dfb61023c5db6102bab397a 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -83,12 +83,12 @@ public function __construct($mongo, array $options) $this->mongo = $mongo; - $this->options = array_merge(array( + $this->options = array_merge([ 'id_field' => '_id', 'data_field' => 'data', 'time_field' => 'time', 'expiry_field' => 'expires_at', - ), $options); + ], $options); } /** @@ -106,9 +106,9 @@ protected function doDestroy($sessionId) { $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' : 'remove'; - $this->getCollection()->$methodName(array( + $this->getCollection()->$methodName([ $this->options['id_field'] => $sessionId, - )); + ]); return true; } @@ -120,9 +120,9 @@ public function gc($maxlifetime) { $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteMany' : 'remove'; - $this->getCollection()->$methodName(array( - $this->options['expiry_field'] => array('$lt' => $this->createDateTime()), - )); + $this->getCollection()->$methodName([ + $this->options['expiry_field'] => ['$lt' => $this->createDateTime()], + ]); return true; } @@ -134,12 +134,12 @@ protected function doWrite($sessionId, $data) { $expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime')); - $fields = array( + $fields = [ $this->options['time_field'] => $this->createDateTime(), $this->options['expiry_field'] => $expiry, - ); + ]; - $options = array('upsert' => true); + $options = ['upsert' => true]; if ($this->mongo instanceof \MongoDB\Client) { $fields[$this->options['data_field']] = new \MongoDB\BSON\Binary($data, \MongoDB\BSON\Binary::TYPE_OLD_BINARY); @@ -151,8 +151,8 @@ protected function doWrite($sessionId, $data) $methodName = $this->mongo instanceof \MongoDB\Client ? 'updateOne' : 'update'; $this->getCollection()->$methodName( - array($this->options['id_field'] => $sessionId), - array('$set' => $fields), + [$this->options['id_field'] => $sessionId], + ['$set' => $fields], $options ); @@ -168,18 +168,18 @@ public function updateTimestamp($sessionId, $data) if ($this->mongo instanceof \MongoDB\Client) { $methodName = 'updateOne'; - $options = array(); + $options = []; } else { $methodName = 'update'; - $options = array('multiple' => false); + $options = ['multiple' => false]; } $this->getCollection()->$methodName( - array($this->options['id_field'] => $sessionId), - array('$set' => array( + [$this->options['id_field'] => $sessionId], + ['$set' => [ $this->options['time_field'] => $this->createDateTime(), $this->options['expiry_field'] => $expiry, - )), + ]], $options ); @@ -191,10 +191,10 @@ public function updateTimestamp($sessionId, $data) */ protected function doRead($sessionId) { - $dbData = $this->getCollection()->findOne(array( + $dbData = $this->getCollection()->findOne([ $this->options['id_field'] => $sessionId, - $this->options['expiry_field'] => array('$gte' => $this->createDateTime()), - )); + $this->options['expiry_field'] => ['$gte' => $this->createDateTime()], + ]); if (null === $dbData) { return ''; diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php index dd7979d4f77ee6bcb9645fd4e4d6d30280e77f1c..bc088e7740bc89ab92ef41589153c515dca90aa4 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php @@ -71,7 +71,7 @@ class PdoSessionHandler extends AbstractSessionHandler private $pdo; /** - * @var string|null|false DSN string or null for session.save_path or false when lazy connection disabled + * @var string|false|null DSN string or null for session.save_path or false when lazy connection disabled */ private $dsn = false; @@ -118,7 +118,7 @@ class PdoSessionHandler extends AbstractSessionHandler /** * @var array Connection options when lazy-connect */ - private $connectionOptions = array(); + private $connectionOptions = []; /** * @var int The strategy for locking, see constants @@ -130,7 +130,7 @@ class PdoSessionHandler extends AbstractSessionHandler * * @var \PDOStatement[] An array of statements to release advisory locks */ - private $unlockStatements = array(); + private $unlockStatements = []; /** * @var bool True when the current session exists but expired according to session.gc_maxlifetime @@ -161,7 +161,7 @@ class PdoSessionHandler extends AbstractSessionHandler * * db_time_col: The column where to store the timestamp [default: sess_time] * * db_username: The username when lazy-connect [default: ''] * * db_password: The password when lazy-connect [default: ''] - * * db_connection_options: An array of driver-specific connection options [default: array()] + * * db_connection_options: An array of driver-specific connection options [default: []] * * lock_mode: The strategy for locking, see constants [default: LOCK_TRANSACTIONAL] * * @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or URL string or null @@ -169,7 +169,7 @@ class PdoSessionHandler extends AbstractSessionHandler * * @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION */ - public function __construct($pdoOrDsn = null, array $options = array()) + public function __construct($pdoOrDsn = null, array $options = []) { if ($pdoOrDsn instanceof \PDO) { if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) { @@ -468,13 +468,13 @@ private function buildDsnFromUrl($dsnOrUrl) throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler'); } - $driverAliasMap = array( + $driverAliasMap = [ 'mssql' => 'sqlsrv', 'mysql2' => 'mysql', // Amazon RDS, for some weird reason 'postgres' => 'pgsql', 'postgresql' => 'pgsql', 'sqlite3' => 'sqlite', - ); + ]; $driver = isset($driverAliasMap[$params['scheme']]) ? $driverAliasMap[$params['scheme']] : $params['scheme']; @@ -637,7 +637,7 @@ protected function doRead($sessionId) throw new \RuntimeException('Failed to read session: INSERT reported a duplicate id but next SELECT did not return any data.'); } - if (!ini_get('session.use_strict_mode') && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { + if (!filter_var(ini_get('session.use_strict_mode'), FILTER_VALIDATE_BOOLEAN) && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { // In strict mode, session fixation is not possible: new sessions always start with a unique // random id, so that concurrency is not possible and this code path can be skipped. // Exclusive-reading of non-existent rows does not block, so we need to do an insert to block diff --git a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php b/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php index 6f59af486981ebb1b2cb9c2687cc3ef2d40250d4..a62f108b34bb69d3beef9bb089279ed4f54c620f 100644 --- a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php +++ b/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php @@ -39,7 +39,7 @@ class MetadataBag implements SessionBagInterface /** * @var array */ - protected $meta = array(self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0); + protected $meta = [self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0]; /** * Unix timestamp. diff --git a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php index 027f4efffce51b9958b3cda5133d162bfcad888e..c1e7523c5e44fee119735c3a26fa8f4f746be608 100644 --- a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php @@ -50,7 +50,7 @@ class MockArraySessionStorage implements SessionStorageInterface /** * @var array */ - protected $data = array(); + protected $data = []; /** * @var MetadataBag @@ -60,7 +60,7 @@ class MockArraySessionStorage implements SessionStorageInterface /** * @var array|SessionBagInterface[] */ - protected $bags = array(); + protected $bags = []; /** * @param string $name Session name @@ -170,7 +170,7 @@ public function clear() } // clear out the session - $this->data = array(); + $this->data = []; // reconnect the bags to the session $this->loadSession(); @@ -242,11 +242,11 @@ protected function generateId() protected function loadSession() { - $bags = array_merge($this->bags, array($this->metadataBag)); + $bags = array_merge($this->bags, [$this->metadataBag]); foreach ($bags as $bag) { $key = $bag->getStorageKey(); - $this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : array(); + $this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : []; $bag->initialize($this->data[$key]); } diff --git a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php index 14f427007ba82d97351a0e77ac4f89cacb710c8c..9bbd1baf2cd6980c95756e6b946281f02aa4e7db 100644 --- a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php @@ -98,7 +98,7 @@ public function save() unset($data[$key]); } } - if (array($key = $this->metadataBag->getStorageKey()) === array_keys($data)) { + if ([$key = $this->metadataBag->getStorageKey()] === array_keys($data)) { unset($data[$key]); } @@ -145,7 +145,7 @@ private function getFilePath() private function read() { $filePath = $this->getFilePath(); - $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array(); + $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : []; $this->loadSession(); } diff --git a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php index a9a54b49dd425783db5c39a16e55f366fc753f6f..c4dbe7586822681a3598ddc46e9dcb254e5d67cf 100644 --- a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php @@ -26,7 +26,7 @@ class NativeSessionStorage implements SessionStorageInterface /** * @var SessionBagInterface[] */ - protected $bags = array(); + protected $bags = []; /** * @var bool @@ -98,14 +98,14 @@ class NativeSessionStorage implements SessionStorageInterface * @param \SessionHandlerInterface|null $handler * @param MetadataBag $metaBag MetadataBag */ - public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) + public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null) { - $options += array( + $options += [ 'cache_limiter' => '', 'cache_expire' => 0, 'use_cookies' => 1, 'lazy_write' => 1, - ); + ]; session_register_shutdown(); @@ -137,7 +137,7 @@ public function start() throw new \RuntimeException('Failed to start the session: already started by PHP.'); } - if (ini_get('session.use_cookies') && headers_sent($file, $line)) { + if (filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN) && headers_sent($file, $line)) { throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line)); } @@ -226,33 +226,26 @@ public function save() unset($_SESSION[$key]); } } - if (array($key = $this->metadataBag->getStorageKey()) === array_keys($_SESSION)) { + if ([$key = $this->metadataBag->getStorageKey()] === array_keys($_SESSION)) { unset($_SESSION[$key]); } - // Register custom error handler to catch a possible failure warning during session write - set_error_handler(function ($errno, $errstr, $errfile, $errline) { - throw new \ErrorException($errstr, $errno, E_WARNING, $errfile, $errline); - }, E_WARNING); + // Register error handler to add information about the current save handler + $previousHandler = set_error_handler(function ($type, $msg, $file, $line) use (&$previousHandler) { + if (E_WARNING === $type && 0 === strpos($msg, 'session_write_close():')) { + $handler = $this->saveHandler instanceof SessionHandlerProxy ? $this->saveHandler->getHandler() : $this->saveHandler; + $msg = sprintf('session_write_close(): Failed to write session data with "%s" handler', \get_class($handler)); + } + + return $previousHandler ? $previousHandler($type, $msg, $file, $line) : false; + }); try { - $e = null; session_write_close(); - } catch (\ErrorException $e) { } finally { restore_error_handler(); $_SESSION = $session; } - if (null !== $e) { - // The default PHP error message is not very helpful, as it does not give any information on the current save handler. - // Therefore, we catch this error and trigger a warning with a better error message - $handler = $this->getSaveHandler(); - if ($handler instanceof SessionHandlerProxy) { - $handler = $handler->getHandler(); - } - - trigger_error(sprintf('session_write_close(): Failed to write session data with %s handler', \get_class($handler)), E_USER_WARNING); - } $this->closed = true; $this->started = false; @@ -269,7 +262,7 @@ public function clear() } // clear out the session - $_SESSION = array(); + $_SESSION = []; // reconnect the bags to the session $this->loadSession(); @@ -338,7 +331,7 @@ public function isStarted() * For convenience we omit 'session.' from the beginning of the keys. * Explicitly ignores other ini keys. * - * @param array $options Session ini directives array(key => value) + * @param array $options Session ini directives [key => value] * * @see http://php.net/session.configuration */ @@ -348,7 +341,7 @@ public function setOptions(array $options) return; } - $validOptions = array_flip(array( + $validOptions = array_flip([ 'cache_expire', 'cache_limiter', 'cookie_domain', 'cookie_httponly', 'cookie_lifetime', 'cookie_path', 'cookie_secure', 'entropy_file', 'entropy_length', 'gc_divisor', @@ -359,7 +352,7 @@ public function setOptions(array $options) 'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name', 'upload_progress.freq', 'upload_progress.min_freq', 'url_rewriter.tags', 'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags', - )); + ]); foreach ($options as $key => $value) { if (isset($validOptions[$key])) { @@ -429,11 +422,11 @@ protected function loadSession(array &$session = null) $session = &$_SESSION; } - $bags = array_merge($this->bags, array($this->metadataBag)); + $bags = array_merge($this->bags, [$this->metadataBag]); foreach ($bags as $bag) { $key = $bag->getStorageKey(); - $session[$key] = isset($session[$key]) ? $session[$key] : array(); + $session[$key] = isset($session[$key]) ? $session[$key] : []; $bag->initialize($session[$key]); } diff --git a/vendor/symfony/http-foundation/StreamedResponse.php b/vendor/symfony/http-foundation/StreamedResponse.php index b87d0e35df731166ea8ce4a617f4aeed378b9577..8bc5fc91a5c18475cee9c3cb190316bbe901737e 100644 --- a/vendor/symfony/http-foundation/StreamedResponse.php +++ b/vendor/symfony/http-foundation/StreamedResponse.php @@ -17,7 +17,7 @@ * A StreamedResponse uses a callback for its content. * * The callback should use the standard PHP functions like echo - * to stream the response back to the client. The flush() method + * to stream the response back to the client. The flush() function * can also be used if needed. * * @see flush() @@ -35,7 +35,7 @@ class StreamedResponse extends Response * @param int $status The response status code * @param array $headers An array of response headers */ - public function __construct(callable $callback = null, $status = 200, $headers = array()) + public function __construct(callable $callback = null, $status = 200, $headers = []) { parent::__construct(null, $status, $headers); @@ -55,7 +55,7 @@ public function __construct(callable $callback = null, $status = 200, $headers = * * @return static */ - public static function create($callback = null, $status = 200, $headers = array()) + public static function create($callback = null, $status = 200, $headers = []) { return new static($callback, $status, $headers); } @@ -129,6 +129,8 @@ public function setContent($content) throw new \LogicException('The content cannot be set on a StreamedResponse instance.'); } + $this->streamed = true; + return $this; } @@ -141,16 +143,4 @@ public function getContent() { return false; } - - /** - * {@inheritdoc} - * - * @return $this - */ - public function setNotModified() - { - $this->setCallback(function () {}); - - return parent::setNotModified(); - } } diff --git a/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php b/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php index cb43bb35168a795b90967623d6d8164bdfe491ff..a40a7621d0336c1398e67ec031ba19dcddf6b8f1 100644 --- a/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php +++ b/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php @@ -28,24 +28,24 @@ public function testFromString($string, $value, array $attributes) public function provideFromStringData() { - return array( - array( + return [ + [ 'text/html', - 'text/html', array(), - ), - array( + 'text/html', [], + ], + [ '"this;should,not=matter"', - 'this;should,not=matter', array(), - ), - array( + 'this;should,not=matter', [], + ], + [ "text/plain; charset=utf-8;param=\"this;should,not=matter\";\tfootnotes=true", - 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'), - ), - array( + 'text/plain', ['charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'], + ], + [ '"this;should,not=matter";charset=utf-8', - 'this;should,not=matter', array('charset' => 'utf-8'), - ), - ); + 'this;should,not=matter', ['charset' => 'utf-8'], + ], + ]; } /** @@ -59,21 +59,21 @@ public function testToString($value, array $attributes, $string) public function provideToStringData() { - return array( - array( - 'text/html', array(), + return [ + [ + 'text/html', [], 'text/html', - ), - array( - 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'), + ], + [ + 'text/plain', ['charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'], 'text/plain;charset=utf-8;param="this;should,not=matter";footnotes=true', - ), - ); + ], + ]; } public function testValue() { - $item = new AcceptHeaderItem('value', array()); + $item = new AcceptHeaderItem('value', []); $this->assertEquals('value', $item->getValue()); $item->setValue('new value'); @@ -85,7 +85,7 @@ public function testValue() public function testQuality() { - $item = new AcceptHeaderItem('value', array()); + $item = new AcceptHeaderItem('value', []); $this->assertEquals(1.0, $item->getQuality()); $item->setQuality(0.5); @@ -98,14 +98,14 @@ public function testQuality() public function testAttribute() { - $item = new AcceptHeaderItem('value', array()); - $this->assertEquals(array(), $item->getAttributes()); + $item = new AcceptHeaderItem('value', []); + $this->assertEquals([], $item->getAttributes()); $this->assertFalse($item->hasAttribute('test')); $this->assertNull($item->getAttribute('test')); $this->assertEquals('default', $item->getAttribute('test', 'default')); $item->setAttribute('test', 'value'); - $this->assertEquals(array('test' => 'value'), $item->getAttributes()); + $this->assertEquals(['test' => 'value'], $item->getAttributes()); $this->assertTrue($item->hasAttribute('test')); $this->assertEquals('value', $item->getAttribute('test')); $this->assertEquals('value', $item->getAttribute('test', 'default')); diff --git a/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php b/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php index 9929eac28ef01feabe869324fbcbf1d492597060..31998696d7284d5ebcffbc459bdd8e085ebd9880 100644 --- a/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php +++ b/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php @@ -39,13 +39,13 @@ public function testFromString($string, array $items) public function provideFromStringData() { - return array( - array('', array()), - array('gzip', array(new AcceptHeaderItem('gzip'))), - array('gzip,deflate,sdch', array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))), - array("gzip, deflate\t,sdch", array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))), - array('"this;should,not=matter"', array(new AcceptHeaderItem('this;should,not=matter'))), - ); + return [ + ['', []], + ['gzip', [new AcceptHeaderItem('gzip')]], + ['gzip,deflate,sdch', [new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')]], + ["gzip, deflate\t,sdch", [new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')]], + ['"this;should,not=matter"', [new AcceptHeaderItem('this;should,not=matter')]], + ]; } /** @@ -59,12 +59,12 @@ public function testToString(array $items, $string) public function provideToStringData() { - return array( - array(array(), ''), - array(array(new AcceptHeaderItem('gzip')), 'gzip'), - array(array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')), 'gzip,deflate,sdch'), - array(array(new AcceptHeaderItem('this;should,not=matter')), 'this;should,not=matter'), - ); + return [ + [[], ''], + [[new AcceptHeaderItem('gzip')], 'gzip'], + [[new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')], 'gzip,deflate,sdch'], + [[new AcceptHeaderItem('this;should,not=matter')], 'this;should,not=matter'], + ]; } /** @@ -78,9 +78,9 @@ public function testFilter($string, $filter, array $values) public function provideFilterData() { - return array( - array('fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4', '/fr.*/', array('fr-FR', 'fr')), - ); + return [ + ['fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4', '/fr.*/', ['fr-FR', 'fr']], + ]; } /** @@ -94,10 +94,10 @@ public function testSorting($string, array $values) public function provideSortingData() { - return array( - 'quality has priority' => array('*;q=0.3,ISO-8859-1,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')), - 'order matters when q is equal' => array('*;q=0.3,ISO-8859-1;q=0.7,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')), - 'order matters when q is equal2' => array('*;q=0.3,utf-8;q=0.7,ISO-8859-1;q=0.7', array('utf-8', 'ISO-8859-1', '*')), - ); + return [ + 'quality has priority' => ['*;q=0.3,ISO-8859-1,utf-8;q=0.7', ['ISO-8859-1', 'utf-8', '*']], + 'order matters when q is equal' => ['*;q=0.3,ISO-8859-1;q=0.7,utf-8;q=0.7', ['ISO-8859-1', 'utf-8', '*']], + 'order matters when q is equal2' => ['*;q=0.3,utf-8;q=0.7,ISO-8859-1;q=0.7', ['utf-8', 'ISO-8859-1', '*']], + ]; } } diff --git a/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php b/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php index 157ab90ec59a2b0d2faf9108b0f5f04ec0580c3a..6fa3b88917055cb1a93fb334dac74fadc54c408a 100644 --- a/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php +++ b/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php @@ -31,63 +31,63 @@ public function testUriMethods($server, $expectedRequestUri, $expectedBaseUrl, $ public function provideServerVars() { - return array( - array( - array( + return [ + [ + [ 'REQUEST_URI' => '/foo/app_dev.php/bar', 'SCRIPT_NAME' => '/foo/app_dev.php', 'PATH_INFO' => '/bar', - ), + ], '/foo/app_dev.php/bar', '/foo/app_dev.php', '/bar', - ), - array( - array( + ], + [ + [ 'REQUEST_URI' => '/foo/bar', 'SCRIPT_NAME' => '/foo/app_dev.php', - ), + ], '/foo/bar', '/foo', '/bar', - ), - array( - array( + ], + [ + [ 'REQUEST_URI' => '/app_dev.php/foo/bar', 'SCRIPT_NAME' => '/app_dev.php', 'PATH_INFO' => '/foo/bar', - ), + ], '/app_dev.php/foo/bar', '/app_dev.php', '/foo/bar', - ), - array( - array( + ], + [ + [ 'REQUEST_URI' => '/foo/bar', 'SCRIPT_NAME' => '/app_dev.php', - ), + ], '/foo/bar', '', '/foo/bar', - ), - array( - array( + ], + [ + [ 'REQUEST_URI' => '/app_dev.php', 'SCRIPT_NAME' => '/app_dev.php', - ), + ], '/app_dev.php', '/app_dev.php', '/', - ), - array( - array( + ], + [ + [ 'REQUEST_URI' => '/', 'SCRIPT_NAME' => '/app_dev.php', - ), + ], '/', '', '/', - ), - ); + ], + ]; } } diff --git a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php index 1b9e58991cc6d5ba033d7c753ee9391c942fadc5..c89f20d05a498271b0fc3e0533a378f099070c1d 100644 --- a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php @@ -22,14 +22,14 @@ class BinaryFileResponseTest extends ResponseTestCase public function testConstruction() { $file = __DIR__.'/../README.md'; - $response = new BinaryFileResponse($file, 404, array('X-Header' => 'Foo'), true, null, true, true); + $response = new BinaryFileResponse($file, 404, ['X-Header' => 'Foo'], true, null, true, true); $this->assertEquals(404, $response->getStatusCode()); $this->assertEquals('Foo', $response->headers->get('X-Header')); $this->assertTrue($response->headers->has('ETag')); $this->assertTrue($response->headers->has('Last-Modified')); $this->assertFalse($response->headers->has('Content-Disposition')); - $response = BinaryFileResponse::create($file, 404, array(), true, ResponseHeaderBag::DISPOSITION_INLINE); + $response = BinaryFileResponse::create($file, 404, [], true, ResponseHeaderBag::DISPOSITION_INLINE); $this->assertEquals(404, $response->getStatusCode()); $this->assertFalse($response->headers->has('ETag')); $this->assertEquals('inline; filename="README.md"', $response->headers->get('Content-Disposition')); @@ -39,7 +39,7 @@ public function testConstructWithNonAsciiFilename() { touch(sys_get_temp_dir().'/fööö.html'); - $response = new BinaryFileResponse(sys_get_temp_dir().'/fööö.html', 200, array(), true, 'attachment'); + $response = new BinaryFileResponse(sys_get_temp_dir().'/fööö.html', 200, [], true, 'attachment'); @unlink(sys_get_temp_dir().'/fööö.html'); @@ -85,7 +85,7 @@ public function testSetContentDispositionGeneratesSafeFallbackFilenameForWrongly */ public function testRequests($requestRange, $offset, $length, $responseRange) { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag(); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag(); // do a request to get the ETag $request = Request::create('/'); @@ -117,7 +117,7 @@ public function testRequests($requestRange, $offset, $length, $responseRange) */ public function testRequestsWithoutEtag($requestRange, $offset, $length, $responseRange) { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream')); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']); // do a request to get the LastModified $request = Request::create('/'); @@ -145,19 +145,19 @@ public function testRequestsWithoutEtag($requestRange, $offset, $length, $respon public function provideRanges() { - return array( - array('bytes=1-4', 1, 4, 'bytes 1-4/35'), - array('bytes=-5', 30, 5, 'bytes 30-34/35'), - array('bytes=30-', 30, 5, 'bytes 30-34/35'), - array('bytes=30-30', 30, 1, 'bytes 30-30/35'), - array('bytes=30-34', 30, 5, 'bytes 30-34/35'), - ); + return [ + ['bytes=1-4', 1, 4, 'bytes 1-4/35'], + ['bytes=-5', 30, 5, 'bytes 30-34/35'], + ['bytes=30-', 30, 5, 'bytes 30-34/35'], + ['bytes=30-30', 30, 1, 'bytes 30-30/35'], + ['bytes=30-34', 30, 5, 'bytes 30-34/35'], + ]; } public function testRangeRequestsWithoutLastModifiedDate() { // prevent auto last modified - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'), true, null, false, false); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'], true, null, false, false); // prepare a request for a range of the testing file $request = Request::create('/'); @@ -178,7 +178,7 @@ public function testRangeRequestsWithoutLastModifiedDate() */ public function testFullFileRequests($requestRange) { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag(); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag(); // prepare a request for a range of the testing file $request = Request::create('/'); @@ -198,14 +198,27 @@ public function testFullFileRequests($requestRange) public function provideFullFileRanges() { - return array( - array('bytes=0-'), - array('bytes=0-34'), - array('bytes=-35'), + return [ + ['bytes=0-'], + ['bytes=0-34'], + ['bytes=-35'], // Syntactical invalid range-request should also return the full resource - array('bytes=20-10'), - array('bytes=50-40'), - ); + ['bytes=20-10'], + ['bytes=50-40'], + ]; + } + + public function testUnpreparedResponseSendsFullFile() + { + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200); + + $data = file_get_contents(__DIR__.'/File/Fixtures/test.gif'); + + $this->expectOutputString($data); + $response = clone $response; + $response->sendContent(); + + $this->assertEquals(200, $response->getStatusCode()); } /** @@ -213,7 +226,7 @@ public function provideFullFileRanges() */ public function testInvalidRequests($requestRange) { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag(); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag(); // prepare a request for a range of the testing file $request = Request::create('/'); @@ -229,10 +242,10 @@ public function testInvalidRequests($requestRange) public function provideInvalidRanges() { - return array( - array('bytes=-40'), - array('bytes=30-40'), - ); + return [ + ['bytes=-40'], + ['bytes=30-40'], + ]; } /** @@ -244,7 +257,7 @@ public function testXSendfile($file) $request->headers->set('X-Sendfile-Type', 'X-Sendfile'); BinaryFileResponse::trustXSendfileTypeHeader(); - $response = BinaryFileResponse::create($file, 200, array('Content-Type' => 'application/octet-stream')); + $response = BinaryFileResponse::create($file, 200, ['Content-Type' => 'application/octet-stream']); $response->prepare($request); $this->expectOutputString(''); @@ -255,10 +268,10 @@ public function testXSendfile($file) public function provideXSendfileFiles() { - return array( - array(__DIR__.'/../README.md'), - array('file://'.__DIR__.'/../README.md'), - ); + return [ + [__DIR__.'/../README.md'], + ['file://'.__DIR__.'/../README.md'], + ]; } /** @@ -273,7 +286,7 @@ public function testXAccelMapping($realpath, $mapping, $virtual) $file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test'); BinaryFileResponse::trustXSendfileTypeHeader(); - $response = new BinaryFileResponse($file, 200, array('Content-Type' => 'application/octet-stream')); + $response = new BinaryFileResponse($file, 200, ['Content-Type' => 'application/octet-stream']); $reflection = new \ReflectionObject($response); $property = $reflection->getProperty('file'); $property->setAccessible(true); @@ -292,7 +305,7 @@ public function testDeleteFileAfterSend() $realPath = realpath($path); $this->assertFileExists($realPath); - $response = new BinaryFileResponse($realPath, 200, array('Content-Type' => 'application/octet-stream')); + $response = new BinaryFileResponse($realPath, 200, ['Content-Type' => 'application/octet-stream']); $response->deleteFileAfterSend(true); $response->prepare($request); @@ -304,7 +317,7 @@ public function testDeleteFileAfterSend() public function testAcceptRangeOnUnsafeMethods() { $request = Request::create('/', 'POST'); - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream')); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']); $response->prepare($request); $this->assertEquals('none', $response->headers->get('Accept-Ranges')); @@ -313,7 +326,7 @@ public function testAcceptRangeOnUnsafeMethods() public function testAcceptRangeNotOverriden() { $request = Request::create('/', 'POST'); - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream')); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']); $response->headers->set('Accept-Ranges', 'foo'); $response->prepare($request); @@ -322,16 +335,16 @@ public function testAcceptRangeNotOverriden() public function getSampleXAccelMappings() { - return array( - array('/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'), - array('/home/foo/bar.txt', '/var/www/=/files/,/home/foo/=/baz/', '/baz/bar.txt'), - ); + return [ + ['/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'], + ['/home/foo/bar.txt', '/var/www/=/files/,/home/foo/=/baz/', '/baz/bar.txt'], + ]; } public function testStream() { $request = Request::create('/'); - $response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, array('Content-Type' => 'text/plain')); + $response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, ['Content-Type' => 'text/plain']); $response->prepare($request); $this->assertNull($response->headers->get('Content-Length')); @@ -339,7 +352,7 @@ public function testStream() protected function provideResponse() { - return new BinaryFileResponse(__DIR__.'/../README.md', 200, array('Content-Type' => 'application/octet-stream')); + return new BinaryFileResponse(__DIR__.'/../README.md', 200, ['Content-Type' => 'application/octet-stream']); } public static function tearDownAfterClass() diff --git a/vendor/symfony/http-foundation/Tests/CookieTest.php b/vendor/symfony/http-foundation/Tests/CookieTest.php index 14c45c9a6c89f917ae0ea25c53368b5e4e037485..aaf2edb385807a2cfeb7b5885cf52155e5f4f14d 100644 --- a/vendor/symfony/http-foundation/Tests/CookieTest.php +++ b/vendor/symfony/http-foundation/Tests/CookieTest.php @@ -26,17 +26,17 @@ class CookieTest extends TestCase { public function invalidNames() { - return array( - array(''), - array(',MyName'), - array(';MyName'), - array(' MyName'), - array("\tMyName"), - array("\rMyName"), - array("\nMyName"), - array("\013MyName"), - array("\014MyName"), - ); + return [ + [''], + [',MyName'], + [';MyName'], + [' MyName'], + ["\tMyName"], + ["\rMyName"], + ["\nMyName"], + ["\013MyName"], + ["\014MyName"], + ]; } /** diff --git a/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php b/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php index 1152e46c0be7e5e9adef75a28f1ba4856e0672c8..2afdade67d9ce03103c4b87cb21637a13605360f 100644 --- a/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php +++ b/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php @@ -55,15 +55,15 @@ public function testMatchesWhenParentMatchesIsFalse($expression) public function provideExpressions() { - return array( - array('request.getMethod() == method', true), - array('request.getPathInfo() == path', true), - array('request.getHost() == host', true), - array('request.getClientIp() == ip', true), - array('request.attributes.all() == attributes', true), - array('request.getMethod() == method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', true), - array('request.getMethod() != method', false), - array('request.getMethod() != method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', false), - ); + return [ + ['request.getMethod() == method', true], + ['request.getPathInfo() == path', true], + ['request.getHost() == host', true], + ['request.getClientIp() == ip', true], + ['request.attributes.all() == attributes', true], + ['request.getMethod() == method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', true], + ['request.getMethod() != method', false], + ['request.getMethod() != method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', false], + ]; } } diff --git a/vendor/symfony/http-foundation/Tests/File/FileTest.php b/vendor/symfony/http-foundation/Tests/File/FileTest.php index dbd9c44bd802cd53b92ec59189f36464b4ede843..fb82dae768b4fcea3b63f8f5dcff89fe93c63c50 100644 --- a/vendor/symfony/http-foundation/Tests/File/FileTest.php +++ b/vendor/symfony/http-foundation/Tests/File/FileTest.php @@ -110,14 +110,14 @@ public function testMoveWithNewName() public function getFilenameFixtures() { - return array( - array('original.gif', 'original.gif'), - array('..\\..\\original.gif', 'original.gif'), - array('../../original.gif', 'original.gif'), - array('файлfile.gif', 'файлfile.gif'), - array('..\\..\\файлfile.gif', 'файлfile.gif'), - array('../../файлfile.gif', 'файлfile.gif'), - ); + return [ + ['original.gif', 'original.gif'], + ['..\\..\\original.gif', 'original.gif'], + ['../../original.gif', 'original.gif'], + ['файлfile.gif', 'файлfile.gif'], + ['..\\..\\файлfile.gif', 'файлfile.gif'], + ['../../файлfile.gif', 'файлfile.gif'], + ]; } /** diff --git a/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php b/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php index 1a88d483505b42a2f8ae60f3dc620ff5813d28c4..9c02b478edc031cf00f54c5078e51f89ff021d8c 100644 --- a/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php +++ b/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php @@ -249,13 +249,13 @@ public function testIsInvalidOnUploadError($error) public function uploadedFileErrorProvider() { - return array( - array(UPLOAD_ERR_INI_SIZE), - array(UPLOAD_ERR_FORM_SIZE), - array(UPLOAD_ERR_PARTIAL), - array(UPLOAD_ERR_NO_TMP_DIR), - array(UPLOAD_ERR_EXTENSION), - ); + return [ + [UPLOAD_ERR_INI_SIZE], + [UPLOAD_ERR_FORM_SIZE], + [UPLOAD_ERR_PARTIAL], + [UPLOAD_ERR_NO_TMP_DIR], + [UPLOAD_ERR_EXTENSION], + ]; } public function testIsInvalidIfNotHttpUpload() diff --git a/vendor/symfony/http-foundation/Tests/FileBagTest.php b/vendor/symfony/http-foundation/Tests/FileBagTest.php index b1bbba0d3f57cc0db98d69bb2f319a414f3df923..0b6d660423f8a0128f55574fd6695a2d1c0064b1 100644 --- a/vendor/symfony/http-foundation/Tests/FileBagTest.php +++ b/vendor/symfony/http-foundation/Tests/FileBagTest.php @@ -28,7 +28,7 @@ class FileBagTest extends TestCase */ public function testFileMustBeAnArrayOrUploadedFile() { - new FileBag(array('file' => 'foo')); + new FileBag(['file' => 'foo']); } public function testShouldConvertsUploadedFiles() @@ -36,54 +36,54 @@ public function testShouldConvertsUploadedFiles() $tmpFile = $this->createTempFile(); $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0); - $bag = new FileBag(array('file' => array( + $bag = new FileBag(['file' => [ 'name' => basename($tmpFile), 'type' => 'text/plain', 'tmp_name' => $tmpFile, 'error' => 0, 'size' => 100, - ))); + ]]); $this->assertEquals($file, $bag->get('file')); } public function testShouldSetEmptyUploadedFilesToNull() { - $bag = new FileBag(array('file' => array( + $bag = new FileBag(['file' => [ 'name' => '', 'type' => '', 'tmp_name' => '', 'error' => UPLOAD_ERR_NO_FILE, 'size' => 0, - ))); + ]]); $this->assertNull($bag->get('file')); } public function testShouldRemoveEmptyUploadedFilesForMultiUpload() { - $bag = new FileBag(array('files' => array( - 'name' => array(''), - 'type' => array(''), - 'tmp_name' => array(''), - 'error' => array(UPLOAD_ERR_NO_FILE), - 'size' => array(0), - ))); - - $this->assertSame(array(), $bag->get('files')); + $bag = new FileBag(['files' => [ + 'name' => [''], + 'type' => [''], + 'tmp_name' => [''], + 'error' => [UPLOAD_ERR_NO_FILE], + 'size' => [0], + ]]); + + $this->assertSame([], $bag->get('files')); } public function testShouldNotRemoveEmptyUploadedFilesForAssociativeArray() { - $bag = new FileBag(array('files' => array( - 'name' => array('file1' => ''), - 'type' => array('file1' => ''), - 'tmp_name' => array('file1' => ''), - 'error' => array('file1' => UPLOAD_ERR_NO_FILE), - 'size' => array('file1' => 0), - ))); - - $this->assertSame(array('file1' => null), $bag->get('files')); + $bag = new FileBag(['files' => [ + 'name' => ['file1' => ''], + 'type' => ['file1' => ''], + 'tmp_name' => ['file1' => ''], + 'error' => ['file1' => UPLOAD_ERR_NO_FILE], + 'size' => ['file1' => 0], + ]]); + + $this->assertSame(['file1' => null], $bag->get('files')); } public function testShouldConvertUploadedFilesWithPhpBug() @@ -91,25 +91,25 @@ public function testShouldConvertUploadedFilesWithPhpBug() $tmpFile = $this->createTempFile(); $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0); - $bag = new FileBag(array( - 'child' => array( - 'name' => array( + $bag = new FileBag([ + 'child' => [ + 'name' => [ 'file' => basename($tmpFile), - ), - 'type' => array( + ], + 'type' => [ 'file' => 'text/plain', - ), - 'tmp_name' => array( + ], + 'tmp_name' => [ 'file' => $tmpFile, - ), - 'error' => array( + ], + 'error' => [ 'file' => 0, - ), - 'size' => array( + ], + 'size' => [ 'file' => 100, - ), - ), - )); + ], + ], + ]); $files = $bag->all(); $this->assertEquals($file, $files['child']['file']); @@ -120,25 +120,25 @@ public function testShouldConvertNestedUploadedFilesWithPhpBug() $tmpFile = $this->createTempFile(); $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0); - $bag = new FileBag(array( - 'child' => array( - 'name' => array( - 'sub' => array('file' => basename($tmpFile)), - ), - 'type' => array( - 'sub' => array('file' => 'text/plain'), - ), - 'tmp_name' => array( - 'sub' => array('file' => $tmpFile), - ), - 'error' => array( - 'sub' => array('file' => 0), - ), - 'size' => array( - 'sub' => array('file' => 100), - ), - ), - )); + $bag = new FileBag([ + 'child' => [ + 'name' => [ + 'sub' => ['file' => basename($tmpFile)], + ], + 'type' => [ + 'sub' => ['file' => 'text/plain'], + ], + 'tmp_name' => [ + 'sub' => ['file' => $tmpFile], + ], + 'error' => [ + 'sub' => ['file' => 0], + ], + 'size' => [ + 'sub' => ['file' => 100], + ], + ], + ]); $files = $bag->all(); $this->assertEquals($file, $files['child']['sub']['file']); @@ -148,7 +148,7 @@ public function testShouldNotConvertNestedUploadedFiles() { $tmpFile = $this->createTempFile(); $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0); - $bag = new FileBag(array('image' => array('file' => $file))); + $bag = new FileBag(['image' => ['file' => $file]]); $files = $bag->all(); $this->assertEquals($file, $files['image']['file']); diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc index f9c40a9a3c5e1d52066aad5c5cd77a10cfcac952..0bdf9e4b75fddcb25356e09c32a5ca1e8ea19ed6 100644 --- a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc +++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc @@ -22,7 +22,7 @@ ini_set('html_errors', 0); ini_set('display_errors', 1); -if (ini_get('xdebug.default_enable')) { +if (filter_var(ini_get('xdebug.default_enable'), FILTER_VALIDATE_BOOLEAN)) { xdebug_disable(); } diff --git a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php b/vendor/symfony/http-foundation/Tests/HeaderBagTest.php index c5a437f999379d4f71eefe862be7dcbde19982a6..6c4915f2e43b9a36fbd1d8ca6723272d11f38ccb 100644 --- a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php +++ b/vendor/symfony/http-foundation/Tests/HeaderBagTest.php @@ -18,7 +18,7 @@ class HeaderBagTest extends TestCase { public function testConstructor() { - $bag = new HeaderBag(array('foo' => 'bar')); + $bag = new HeaderBag(['foo' => 'bar']); $this->assertTrue($bag->has('foo')); } @@ -30,20 +30,20 @@ public function testToStringNull() public function testToStringNotNull() { - $bag = new HeaderBag(array('foo' => 'bar')); + $bag = new HeaderBag(['foo' => 'bar']); $this->assertEquals("Foo: bar\r\n", $bag->__toString()); } public function testKeys() { - $bag = new HeaderBag(array('foo' => 'bar')); + $bag = new HeaderBag(['foo' => 'bar']); $keys = $bag->keys(); $this->assertEquals('foo', $keys[0]); } public function testGetDate() { - $bag = new HeaderBag(array('foo' => 'Tue, 4 Sep 2012 20:00:00 +0200')); + $bag = new HeaderBag(['foo' => 'Tue, 4 Sep 2012 20:00:00 +0200']); $headerDate = $bag->getDate('foo'); $this->assertInstanceOf('DateTime', $headerDate); } @@ -53,7 +53,7 @@ public function testGetDate() */ public function testGetDateException() { - $bag = new HeaderBag(array('foo' => 'Tue')); + $bag = new HeaderBag(['foo' => 'Tue']); $headerDate = $bag->getDate('foo'); } @@ -67,50 +67,50 @@ public function testGetCacheControlHeader() public function testAll() { - $bag = new HeaderBag(array('foo' => 'bar')); - $this->assertEquals(array('foo' => array('bar')), $bag->all(), '->all() gets all the input'); + $bag = new HeaderBag(['foo' => 'bar']); + $this->assertEquals(['foo' => ['bar']], $bag->all(), '->all() gets all the input'); - $bag = new HeaderBag(array('FOO' => 'BAR')); - $this->assertEquals(array('foo' => array('BAR')), $bag->all(), '->all() gets all the input key are lower case'); + $bag = new HeaderBag(['FOO' => 'BAR']); + $this->assertEquals(['foo' => ['BAR']], $bag->all(), '->all() gets all the input key are lower case'); } public function testReplace() { - $bag = new HeaderBag(array('foo' => 'bar')); + $bag = new HeaderBag(['foo' => 'bar']); - $bag->replace(array('NOPE' => 'BAR')); - $this->assertEquals(array('nope' => array('BAR')), $bag->all(), '->replace() replaces the input with the argument'); + $bag->replace(['NOPE' => 'BAR']); + $this->assertEquals(['nope' => ['BAR']], $bag->all(), '->replace() replaces the input with the argument'); $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input'); } public function testGet() { - $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz')); + $bag = new HeaderBag(['foo' => 'bar', 'fuzz' => 'bizz']); $this->assertEquals('bar', $bag->get('foo'), '->get return current value'); $this->assertEquals('bar', $bag->get('FoO'), '->get key in case insensitive'); - $this->assertEquals(array('bar'), $bag->get('foo', 'nope', false), '->get return the value as array'); + $this->assertEquals(['bar'], $bag->get('foo', 'nope', false), '->get return the value as array'); // defaults $this->assertNull($bag->get('none'), '->get unknown values returns null'); $this->assertEquals('default', $bag->get('none', 'default'), '->get unknown values returns default'); - $this->assertEquals(array('default'), $bag->get('none', 'default', false), '->get unknown values returns default as array'); + $this->assertEquals(['default'], $bag->get('none', 'default', false), '->get unknown values returns default as array'); $bag->set('foo', 'bor', false); $this->assertEquals('bar', $bag->get('foo'), '->get return first value'); - $this->assertEquals(array('bar', 'bor'), $bag->get('foo', 'nope', false), '->get return all values as array'); + $this->assertEquals(['bar', 'bor'], $bag->get('foo', 'nope', false), '->get return all values as array'); } public function testSetAssociativeArray() { $bag = new HeaderBag(); - $bag->set('foo', array('bad-assoc-index' => 'value')); + $bag->set('foo', ['bad-assoc-index' => 'value']); $this->assertSame('value', $bag->get('foo')); - $this->assertEquals(array('value'), $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored'); + $this->assertEquals(['value'], $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored'); } public function testContains() { - $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz')); + $bag = new HeaderBag(['foo' => 'bar', 'fuzz' => 'bizz']); $this->assertTrue($bag->contains('foo', 'bar'), '->contains first value'); $this->assertTrue($bag->contains('fuzz', 'bizz'), '->contains second value'); $this->assertFalse($bag->contains('nope', 'nope'), '->contains unknown value'); @@ -143,7 +143,7 @@ public function testCacheControlDirectiveAccessors() public function testCacheControlDirectiveParsing() { - $bag = new HeaderBag(array('cache-control' => 'public, max-age=10')); + $bag = new HeaderBag(['cache-control' => 'public, max-age=10']); $this->assertTrue($bag->hasCacheControlDirective('public')); $this->assertTrue($bag->getCacheControlDirective('public')); @@ -156,15 +156,15 @@ public function testCacheControlDirectiveParsing() public function testCacheControlDirectiveParsingQuotedZero() { - $bag = new HeaderBag(array('cache-control' => 'max-age="0"')); + $bag = new HeaderBag(['cache-control' => 'max-age="0"']); $this->assertTrue($bag->hasCacheControlDirective('max-age')); $this->assertEquals(0, $bag->getCacheControlDirective('max-age')); } public function testCacheControlDirectiveOverrideWithReplace() { - $bag = new HeaderBag(array('cache-control' => 'private, max-age=100')); - $bag->replace(array('cache-control' => 'public, max-age=10')); + $bag = new HeaderBag(['cache-control' => 'private, max-age=100']); + $bag->replace(['cache-control' => 'public, max-age=10']); $this->assertTrue($bag->hasCacheControlDirective('public')); $this->assertTrue($bag->getCacheControlDirective('public')); @@ -174,7 +174,7 @@ public function testCacheControlDirectiveOverrideWithReplace() public function testCacheControlClone() { - $headers = array('foo' => 'bar'); + $headers = ['foo' => 'bar']; $bag1 = new HeaderBag($headers); $bag2 = new HeaderBag($bag1->all()); @@ -183,13 +183,13 @@ public function testCacheControlClone() public function testGetIterator() { - $headers = array('foo' => 'bar', 'hello' => 'world', 'third' => 'charm'); + $headers = ['foo' => 'bar', 'hello' => 'world', 'third' => 'charm']; $headerBag = new HeaderBag($headers); $i = 0; foreach ($headerBag as $key => $val) { ++$i; - $this->assertEquals(array($headers[$key]), $val); + $this->assertEquals([$headers[$key]], $val); } $this->assertEquals(\count($headers), $i); @@ -197,7 +197,7 @@ public function testGetIterator() public function testCount() { - $headers = array('foo' => 'bar', 'HELLO' => 'WORLD'); + $headers = ['foo' => 'bar', 'HELLO' => 'WORLD']; $headerBag = new HeaderBag($headers); $this->assertCount(\count($headers), $headerBag); diff --git a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php b/vendor/symfony/http-foundation/Tests/IpUtilsTest.php index 232a2040ff635f17c14c8fa03de7a1c2f127ca49..c7f76b5de29267c50661e69d12d24874b2bf181b 100644 --- a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php +++ b/vendor/symfony/http-foundation/Tests/IpUtilsTest.php @@ -26,20 +26,20 @@ public function testIpv4($matches, $remoteAddr, $cidr) public function getIpv4Data() { - return array( - array(true, '192.168.1.1', '192.168.1.1'), - array(true, '192.168.1.1', '192.168.1.1/1'), - array(true, '192.168.1.1', '192.168.1.0/24'), - array(false, '192.168.1.1', '1.2.3.4/1'), - array(false, '192.168.1.1', '192.168.1.1/33'), // invalid subnet - array(true, '192.168.1.1', array('1.2.3.4/1', '192.168.1.0/24')), - array(true, '192.168.1.1', array('192.168.1.0/24', '1.2.3.4/1')), - array(false, '192.168.1.1', array('1.2.3.4/1', '4.3.2.1/1')), - array(true, '1.2.3.4', '0.0.0.0/0'), - array(true, '1.2.3.4', '192.168.1.0/0'), - array(false, '1.2.3.4', '256.256.256/0'), // invalid CIDR notation - array(false, 'an_invalid_ip', '192.168.1.0/24'), - ); + return [ + [true, '192.168.1.1', '192.168.1.1'], + [true, '192.168.1.1', '192.168.1.1/1'], + [true, '192.168.1.1', '192.168.1.0/24'], + [false, '192.168.1.1', '1.2.3.4/1'], + [false, '192.168.1.1', '192.168.1.1/33'], // invalid subnet + [true, '192.168.1.1', ['1.2.3.4/1', '192.168.1.0/24']], + [true, '192.168.1.1', ['192.168.1.0/24', '1.2.3.4/1']], + [false, '192.168.1.1', ['1.2.3.4/1', '4.3.2.1/1']], + [true, '1.2.3.4', '0.0.0.0/0'], + [true, '1.2.3.4', '192.168.1.0/0'], + [false, '1.2.3.4', '256.256.256/0'], // invalid CIDR notation + [false, 'an_invalid_ip', '192.168.1.0/24'], + ]; } /** @@ -56,20 +56,20 @@ public function testIpv6($matches, $remoteAddr, $cidr) public function getIpv6Data() { - return array( - array(true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'), - array(false, '2a00:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'), - array(false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'), - array(true, '0:0:0:0:0:0:0:1', '::1'), - array(false, '0:0:603:0:396e:4789:8e99:0001', '::1'), - array(true, '0:0:603:0:396e:4789:8e99:0001', '::/0'), - array(true, '0:0:603:0:396e:4789:8e99:0001', '2a01:198:603:0::/0'), - array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '2a01:198:603:0::/65')), - array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('2a01:198:603:0::/65', '::1')), - array(false, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '1a01:198:603:0::/65')), - array(false, '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2', '::1'), - array(false, '2a01:198:603:0:396e:4789:8e99:890f', 'unknown'), - ); + return [ + [true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'], + [false, '2a00:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'], + [false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'], + [true, '0:0:0:0:0:0:0:1', '::1'], + [false, '0:0:603:0:396e:4789:8e99:0001', '::1'], + [true, '0:0:603:0:396e:4789:8e99:0001', '::/0'], + [true, '0:0:603:0:396e:4789:8e99:0001', '2a01:198:603:0::/0'], + [true, '2a01:198:603:0:396e:4789:8e99:890f', ['::1', '2a01:198:603:0::/65']], + [true, '2a01:198:603:0:396e:4789:8e99:890f', ['2a01:198:603:0::/65', '::1']], + [false, '2a01:198:603:0:396e:4789:8e99:890f', ['::1', '1a01:198:603:0::/65']], + [false, '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2', '::1'], + [false, '2a01:198:603:0:396e:4789:8e99:890f', 'unknown'], + ]; } /** @@ -95,10 +95,10 @@ public function testInvalidIpAddressesDoNotMatch($requestIp, $proxyIp) public function invalidIpAddressData() { - return array( - 'invalid proxy wildcard' => array('192.168.20.13', '*'), - 'invalid proxy missing netmask' => array('192.168.20.13', '0.0.0.0'), - 'invalid request IP with invalid proxy wildcard' => array('0.0.0.0', '*'), - ); + return [ + 'invalid proxy wildcard' => ['192.168.20.13', '*'], + 'invalid proxy missing netmask' => ['192.168.20.13', '0.0.0.0'], + 'invalid request IP with invalid proxy wildcard' => ['0.0.0.0', '*'], + ]; } } diff --git a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php b/vendor/symfony/http-foundation/Tests/JsonResponseTest.php index 6687fde5be519a2baa10f4bf6942995a6e1ed34d..5425896dfa3b72ab248b1491884bcf4e11f73103 100644 --- a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/JsonResponseTest.php @@ -33,13 +33,13 @@ public function testConstructorEmptyCreatesJsonObject() public function testConstructorWithArrayCreatesJsonArray() { - $response = new JsonResponse(array(0, 1, 2, 3)); + $response = new JsonResponse([0, 1, 2, 3]); $this->assertSame('[0,1,2,3]', $response->getContent()); } public function testConstructorWithAssocArrayCreatesJsonObject() { - $response = new JsonResponse(array('foo' => 'bar')); + $response = new JsonResponse(['foo' => 'bar']); $this->assertSame('{"foo":"bar"}', $response->getContent()); } @@ -60,7 +60,7 @@ public function testConstructorWithSimpleTypes() public function testConstructorWithCustomStatus() { - $response = new JsonResponse(array(), 202); + $response = new JsonResponse([], 202); $this->assertSame(202, $response->getStatusCode()); } @@ -72,35 +72,35 @@ public function testConstructorAddsContentTypeHeader() public function testConstructorWithCustomHeaders() { - $response = new JsonResponse(array(), 200, array('ETag' => 'foo')); + $response = new JsonResponse([], 200, ['ETag' => 'foo']); $this->assertSame('application/json', $response->headers->get('Content-Type')); $this->assertSame('foo', $response->headers->get('ETag')); } public function testConstructorWithCustomContentType() { - $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json'); + $headers = ['Content-Type' => 'application/vnd.acme.blog-v1+json']; - $response = new JsonResponse(array(), 200, $headers); + $response = new JsonResponse([], 200, $headers); $this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type')); } public function testSetJson() { - $response = new JsonResponse('1', 200, array(), true); + $response = new JsonResponse('1', 200, [], true); $this->assertEquals('1', $response->getContent()); - $response = new JsonResponse('[1]', 200, array(), true); + $response = new JsonResponse('[1]', 200, [], true); $this->assertEquals('[1]', $response->getContent()); - $response = new JsonResponse(null, 200, array()); + $response = new JsonResponse(null, 200, []); $response->setJson('true'); $this->assertEquals('true', $response->getContent()); } public function testCreate() { - $response = JsonResponse::create(array('foo' => 'bar'), 204); + $response = JsonResponse::create(['foo' => 'bar'], 204); $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); $this->assertEquals('{"foo":"bar"}', $response->getContent()); @@ -116,14 +116,14 @@ public function testStaticCreateEmptyJsonObject() public function testStaticCreateJsonArray() { - $response = JsonResponse::create(array(0, 1, 2, 3)); + $response = JsonResponse::create([0, 1, 2, 3]); $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); $this->assertSame('[0,1,2,3]', $response->getContent()); } public function testStaticCreateJsonObject() { - $response = JsonResponse::create(array('foo' => 'bar')); + $response = JsonResponse::create(['foo' => 'bar']); $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); $this->assertSame('{"foo":"bar"}', $response->getContent()); } @@ -149,7 +149,7 @@ public function testStaticCreateWithSimpleTypes() public function testStaticCreateWithCustomStatus() { - $response = JsonResponse::create(array(), 202); + $response = JsonResponse::create([], 202); $this->assertSame(202, $response->getStatusCode()); } @@ -161,22 +161,22 @@ public function testStaticCreateAddsContentTypeHeader() public function testStaticCreateWithCustomHeaders() { - $response = JsonResponse::create(array(), 200, array('ETag' => 'foo')); + $response = JsonResponse::create([], 200, ['ETag' => 'foo']); $this->assertSame('application/json', $response->headers->get('Content-Type')); $this->assertSame('foo', $response->headers->get('ETag')); } public function testStaticCreateWithCustomContentType() { - $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json'); + $headers = ['Content-Type' => 'application/vnd.acme.blog-v1+json']; - $response = JsonResponse::create(array(), 200, $headers); + $response = JsonResponse::create([], 200, $headers); $this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type')); } public function testSetCallback() { - $response = JsonResponse::create(array('foo' => 'bar'))->setCallback('callback'); + $response = JsonResponse::create(['foo' => 'bar'])->setCallback('callback'); $this->assertEquals('/**/callback({"foo":"bar"});', $response->getContent()); $this->assertEquals('text/javascript', $response->headers->get('Content-Type')); @@ -199,7 +199,7 @@ public function testGetEncodingOptions() public function testSetEncodingOptions() { $response = new JsonResponse(); - $response->setData(array(array(1, 2, 3))); + $response->setData([[1, 2, 3]]); $this->assertEquals('[[1,2,3]]', $response->getContent()); @@ -248,7 +248,7 @@ public function testSetContentJsonSerializeError() public function testSetComplexCallback() { - $response = JsonResponse::create(array('foo' => 'bar')); + $response = JsonResponse::create(['foo' => 'bar']); $response->setCallback('ಠ_ಠ["foo"].bar[0]'); $this->assertEquals('/**/ಠ_ಠ["foo"].bar[0]({"foo":"bar"});', $response->getContent()); diff --git a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php b/vendor/symfony/http-foundation/Tests/ParameterBagTest.php index dccfd4f3086871227e0ab14343d8a17094a65b66..d2a5c991cc7f68213da34208c9f8000d435d9c54 100644 --- a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php +++ b/vendor/symfony/http-foundation/Tests/ParameterBagTest.php @@ -23,44 +23,44 @@ public function testConstructor() public function testAll() { - $bag = new ParameterBag(array('foo' => 'bar')); - $this->assertEquals(array('foo' => 'bar'), $bag->all(), '->all() gets all the input'); + $bag = new ParameterBag(['foo' => 'bar']); + $this->assertEquals(['foo' => 'bar'], $bag->all(), '->all() gets all the input'); } public function testKeys() { - $bag = new ParameterBag(array('foo' => 'bar')); - $this->assertEquals(array('foo'), $bag->keys()); + $bag = new ParameterBag(['foo' => 'bar']); + $this->assertEquals(['foo'], $bag->keys()); } public function testAdd() { - $bag = new ParameterBag(array('foo' => 'bar')); - $bag->add(array('bar' => 'bas')); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all()); + $bag = new ParameterBag(['foo' => 'bar']); + $bag->add(['bar' => 'bas']); + $this->assertEquals(['foo' => 'bar', 'bar' => 'bas'], $bag->all()); } public function testRemove() { - $bag = new ParameterBag(array('foo' => 'bar')); - $bag->add(array('bar' => 'bas')); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all()); + $bag = new ParameterBag(['foo' => 'bar']); + $bag->add(['bar' => 'bas']); + $this->assertEquals(['foo' => 'bar', 'bar' => 'bas'], $bag->all()); $bag->remove('bar'); - $this->assertEquals(array('foo' => 'bar'), $bag->all()); + $this->assertEquals(['foo' => 'bar'], $bag->all()); } public function testReplace() { - $bag = new ParameterBag(array('foo' => 'bar')); + $bag = new ParameterBag(['foo' => 'bar']); - $bag->replace(array('FOO' => 'BAR')); - $this->assertEquals(array('FOO' => 'BAR'), $bag->all(), '->replace() replaces the input with the argument'); + $bag->replace(['FOO' => 'BAR']); + $this->assertEquals(['FOO' => 'BAR'], $bag->all(), '->replace() replaces the input with the argument'); $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input'); } public function testGet() { - $bag = new ParameterBag(array('foo' => 'bar', 'null' => null)); + $bag = new ParameterBag(['foo' => 'bar', 'null' => null]); $this->assertEquals('bar', $bag->get('foo'), '->get() gets the value of a parameter'); $this->assertEquals('default', $bag->get('unknown', 'default'), '->get() returns second argument as default if a parameter is not defined'); @@ -69,14 +69,14 @@ public function testGet() public function testGetDoesNotUseDeepByDefault() { - $bag = new ParameterBag(array('foo' => array('bar' => 'moo'))); + $bag = new ParameterBag(['foo' => ['bar' => 'moo']]); $this->assertNull($bag->get('foo[bar]')); } public function testSet() { - $bag = new ParameterBag(array()); + $bag = new ParameterBag([]); $bag->set('foo', 'bar'); $this->assertEquals('bar', $bag->get('foo'), '->set() sets the value of parameter'); @@ -87,7 +87,7 @@ public function testSet() public function testHas() { - $bag = new ParameterBag(array('foo' => 'bar')); + $bag = new ParameterBag(['foo' => 'bar']); $this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined'); $this->assertFalse($bag->has('unknown'), '->has() return false if a parameter is not defined'); @@ -95,7 +95,7 @@ public function testHas() public function testGetAlpha() { - $bag = new ParameterBag(array('word' => 'foo_BAR_012')); + $bag = new ParameterBag(['word' => 'foo_BAR_012']); $this->assertEquals('fooBAR', $bag->getAlpha('word'), '->getAlpha() gets only alphabetic characters'); $this->assertEquals('', $bag->getAlpha('unknown'), '->getAlpha() returns empty string if a parameter is not defined'); @@ -103,7 +103,7 @@ public function testGetAlpha() public function testGetAlnum() { - $bag = new ParameterBag(array('word' => 'foo_BAR_012')); + $bag = new ParameterBag(['word' => 'foo_BAR_012']); $this->assertEquals('fooBAR012', $bag->getAlnum('word'), '->getAlnum() gets only alphanumeric characters'); $this->assertEquals('', $bag->getAlnum('unknown'), '->getAlnum() returns empty string if a parameter is not defined'); @@ -111,7 +111,7 @@ public function testGetAlnum() public function testGetDigits() { - $bag = new ParameterBag(array('word' => 'foo_BAR_012')); + $bag = new ParameterBag(['word' => 'foo_BAR_012']); $this->assertEquals('012', $bag->getDigits('word'), '->getDigits() gets only digits as string'); $this->assertEquals('', $bag->getDigits('unknown'), '->getDigits() returns empty string if a parameter is not defined'); @@ -119,7 +119,7 @@ public function testGetDigits() public function testGetInt() { - $bag = new ParameterBag(array('digits' => '0123')); + $bag = new ParameterBag(['digits' => '0123']); $this->assertEquals(123, $bag->getInt('digits'), '->getInt() gets a value of parameter as integer'); $this->assertEquals(0, $bag->getInt('unknown'), '->getInt() returns zero if a parameter is not defined'); @@ -127,14 +127,14 @@ public function testGetInt() public function testFilter() { - $bag = new ParameterBag(array( + $bag = new ParameterBag([ 'digits' => '0123ab', 'email' => 'example@example.com', 'url' => 'http://example.com/foo', 'dec' => '256', 'hex' => '0x100', - 'array' => array('bang'), - )); + 'array' => ['bang'], + ]); $this->assertEmpty($bag->filter('nokey'), '->filter() should return empty by default if no key is found'); @@ -142,27 +142,27 @@ public function testFilter() $this->assertEquals('example@example.com', $bag->filter('email', '', FILTER_VALIDATE_EMAIL), '->filter() gets a value of parameter as email'); - $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, array('flags' => FILTER_FLAG_PATH_REQUIRED)), '->filter() gets a value of parameter as URL with a path'); + $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, ['flags' => FILTER_FLAG_PATH_REQUIRED]), '->filter() gets a value of parameter as URL with a path'); // This test is repeated for code-coverage $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as URL with a path'); - $this->assertFalse($bag->filter('dec', '', FILTER_VALIDATE_INT, array( + $this->assertFalse($bag->filter('dec', '', FILTER_VALIDATE_INT, [ 'flags' => FILTER_FLAG_ALLOW_HEX, - 'options' => array('min_range' => 1, 'max_range' => 0xff), - )), '->filter() gets a value of parameter as integer between boundaries'); + 'options' => ['min_range' => 1, 'max_range' => 0xff], + ]), '->filter() gets a value of parameter as integer between boundaries'); - $this->assertFalse($bag->filter('hex', '', FILTER_VALIDATE_INT, array( + $this->assertFalse($bag->filter('hex', '', FILTER_VALIDATE_INT, [ 'flags' => FILTER_FLAG_ALLOW_HEX, - 'options' => array('min_range' => 1, 'max_range' => 0xff), - )), '->filter() gets a value of parameter as integer between boundaries'); + 'options' => ['min_range' => 1, 'max_range' => 0xff], + ]), '->filter() gets a value of parameter as integer between boundaries'); - $this->assertEquals(array('bang'), $bag->filter('array', ''), '->filter() gets a value of parameter as an array'); + $this->assertEquals(['bang'], $bag->filter('array', ''), '->filter() gets a value of parameter as an array'); } public function testGetIterator() { - $parameters = array('foo' => 'bar', 'hello' => 'world'); + $parameters = ['foo' => 'bar', 'hello' => 'world']; $bag = new ParameterBag($parameters); $i = 0; @@ -176,7 +176,7 @@ public function testGetIterator() public function testCount() { - $parameters = array('foo' => 'bar', 'hello' => 'world'); + $parameters = ['foo' => 'bar', 'hello' => 'world']; $bag = new ParameterBag($parameters); $this->assertCount(\count($parameters), $bag); @@ -184,7 +184,7 @@ public function testCount() public function testGetBoolean() { - $parameters = array('string_true' => 'true', 'string_false' => 'false'); + $parameters = ['string_true' => 'true', 'string_false' => 'false']; $bag = new ParameterBag($parameters); $this->assertTrue($bag->getBoolean('string_true'), '->getBoolean() gets the string true as boolean true'); diff --git a/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php b/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php index d389e83dbe14a76a1c4c9955a20c11796f26c6da..64c3e73ee21af5a570aba9bb68db0886b5791e9e 100644 --- a/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php @@ -22,7 +22,7 @@ public function testGenerateMetaRedirect() $this->assertEquals(1, preg_match( '#<meta http-equiv="refresh" content="\d+;url=foo\.bar" />#', - preg_replace(array('/\s+/', '/\'/'), array(' ', '"'), $response->getContent()) + preg_replace(['/\s+/', '/\'/'], [' ', '"'], $response->getContent()) )); } @@ -87,7 +87,7 @@ public function testCacheHeaders() $response = new RedirectResponse('foo.bar', 301); $this->assertFalse($response->headers->hasCacheControlDirective('no-cache')); - $response = new RedirectResponse('foo.bar', 301, array('cache-control' => 'max-age=86400')); + $response = new RedirectResponse('foo.bar', 301, ['cache-control' => 'max-age=86400']); $this->assertFalse($response->headers->hasCacheControlDirective('no-cache')); $this->assertTrue($response->headers->hasCacheControlDirective('max-age')); diff --git a/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php b/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php index 10d764a776bba06718bede5ef90b212cfed6954f..7fb6925bbc7b29dc80e117738198b0d419a67ccd 100644 --- a/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php +++ b/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php @@ -34,20 +34,20 @@ public function testMethod($requestMethod, $matcherMethod, $isMatch) public function getMethodData() { - return array( - array('get', 'get', true), - array('get', array('get', 'post'), true), - array('get', 'post', false), - array('get', 'GET', true), - array('get', array('GET', 'POST'), true), - array('get', 'POST', false), - ); + return [ + ['get', 'get', true], + ['get', ['get', 'post'], true], + ['get', 'post', false], + ['get', 'GET', true], + ['get', ['GET', 'POST'], true], + ['get', 'POST', false], + ]; } public function testScheme() { $httpRequest = $request = $request = Request::create(''); - $httpsRequest = $request = $request = Request::create('', 'get', array(), array(), array(), array('HTTPS' => 'on')); + $httpsRequest = $request = $request = Request::create('', 'get', [], [], [], ['HTTPS' => 'on']); $matcher = new RequestMatcher(); $matcher->matchScheme('https'); @@ -69,7 +69,7 @@ public function testScheme() public function testHost($pattern, $isMatch) { $matcher = new RequestMatcher(); - $request = Request::create('', 'get', array(), array(), array(), array('HTTP_HOST' => 'foo.example.com')); + $request = Request::create('', 'get', [], [], [], ['HTTP_HOST' => 'foo.example.com']); $matcher->matchHost($pattern); $this->assertSame($isMatch, $matcher->matches($request)); @@ -80,16 +80,16 @@ public function testHost($pattern, $isMatch) public function getHostData() { - return array( - array('.*\.example\.com', true), - array('\.example\.com$', true), - array('^.*\.example\.com$', true), - array('.*\.sensio\.com', false), - array('.*\.example\.COM', true), - array('\.example\.COM$', true), - array('^.*\.example\.COM$', true), - array('.*\.sensio\.COM', false), - ); + return [ + ['.*\.example\.com', true], + ['\.example\.com$', true], + ['^.*\.example\.com$', true], + ['.*\.sensio\.com', false], + ['.*\.example\.COM', true], + ['\.example\.COM$', true], + ['^.*\.example\.COM$', true], + ['.*\.sensio\.COM', false], + ]; } public function testPath() diff --git a/vendor/symfony/http-foundation/Tests/RequestTest.php b/vendor/symfony/http-foundation/Tests/RequestTest.php index 426ae43e410369a14d59ab12c39cf1990086d31c..d266e1f68a4cc03a2ec16445fe2f8f91c8d19648 100644 --- a/vendor/symfony/http-foundation/Tests/RequestTest.php +++ b/vendor/symfony/http-foundation/Tests/RequestTest.php @@ -21,24 +21,24 @@ class RequestTest extends TestCase { protected function tearDown() { - Request::setTrustedProxies(array(), -1); - Request::setTrustedHosts(array()); + Request::setTrustedProxies([], -1); + Request::setTrustedHosts([]); } public function testInitialize() { $request = new Request(); - $request->initialize(array('foo' => 'bar')); + $request->initialize(['foo' => 'bar']); $this->assertEquals('bar', $request->query->get('foo'), '->initialize() takes an array of query parameters as its first argument'); - $request->initialize(array(), array('foo' => 'bar')); + $request->initialize([], ['foo' => 'bar']); $this->assertEquals('bar', $request->request->get('foo'), '->initialize() takes an array of request parameters as its second argument'); - $request->initialize(array(), array(), array('foo' => 'bar')); + $request->initialize([], [], ['foo' => 'bar']); $this->assertEquals('bar', $request->attributes->get('foo'), '->initialize() takes an array of attributes as its third argument'); - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_FOO' => 'bar')); + $request->initialize([], [], [], [], [], ['HTTP_FOO' => 'bar']); $this->assertEquals('bar', $request->headers->get('FOO'), '->initialize() takes an array of HTTP headers as its sixth argument'); } @@ -101,7 +101,7 @@ public function testCreate() $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); - $request = Request::create('http://test.com/foo', 'GET', array('bar' => 'baz')); + $request = Request::create('http://test.com/foo', 'GET', ['bar' => 'baz']); $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('bar=baz', $request->getQueryString()); @@ -109,7 +109,7 @@ public function testCreate() $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); - $request = Request::create('http://test.com/foo?bar=foo', 'GET', array('bar' => 'baz')); + $request = Request::create('http://test.com/foo?bar=foo', 'GET', ['bar' => 'baz']); $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('bar=baz', $request->getQueryString()); @@ -166,7 +166,7 @@ public function testCreate() $this->assertTrue($request->isSecure()); $json = '{"jsonrpc":"2.0","method":"echo","id":7,"params":["Hello World"]}'; - $request = Request::create('http://example.com/jsonrpc', 'POST', array(), array(), array(), array(), $json); + $request = Request::create('http://example.com/jsonrpc', 'POST', [], [], [], [], $json); $this->assertEquals($json, $request->getContent()); $this->assertFalse($request->isSecure()); @@ -216,28 +216,126 @@ public function testCreate() $request = Request::create('http://test.com/?foo'); $this->assertEquals('/?foo', $request->getRequestUri()); - $this->assertEquals(array('foo' => ''), $request->query->all()); + $this->assertEquals(['foo' => ''], $request->query->all()); // assume rewrite rule: (.*) --> app/app.php; app/ is a symlink to a symfony web/ directory - $request = Request::create('http://test.com/apparthotel-1234', 'GET', array(), array(), array(), - array( + $request = Request::create('http://test.com/apparthotel-1234', 'GET', [], [], [], + [ 'DOCUMENT_ROOT' => '/var/www/www.test.com', 'SCRIPT_FILENAME' => '/var/www/www.test.com/app/app.php', 'SCRIPT_NAME' => '/app/app.php', 'PHP_SELF' => '/app/app.php/apparthotel-1234', - )); + ]); $this->assertEquals('http://test.com/apparthotel-1234', $request->getUri()); $this->assertEquals('/apparthotel-1234', $request->getPathInfo()); $this->assertEquals('', $request->getQueryString()); $this->assertEquals(80, $request->getPort()); $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); + + // Fragment should not be included in the URI + $request = Request::create('http://test.com/foo#bar'); + $this->assertEquals('http://test.com/foo', $request->getUri()); + } + + public function testCreateWithRequestUri() + { + $request = Request::create('http://test.com:80/foo'); + $request->server->set('REQUEST_URI', 'http://test.com:80/foo'); + $this->assertEquals('http://test.com/foo', $request->getUri()); + $this->assertEquals('/foo', $request->getPathInfo()); + $this->assertEquals('test.com', $request->getHost()); + $this->assertEquals('test.com', $request->getHttpHost()); + $this->assertEquals(80, $request->getPort()); + $this->assertFalse($request->isSecure()); + + $request = Request::create('http://test.com:8080/foo'); + $request->server->set('REQUEST_URI', 'http://test.com:8080/foo'); + $this->assertEquals('http://test.com:8080/foo', $request->getUri()); + $this->assertEquals('/foo', $request->getPathInfo()); + $this->assertEquals('test.com', $request->getHost()); + $this->assertEquals('test.com:8080', $request->getHttpHost()); + $this->assertEquals(8080, $request->getPort()); + $this->assertFalse($request->isSecure()); + + $request = Request::create('http://test.com/foo?bar=foo', 'GET', ['bar' => 'baz']); + $request->server->set('REQUEST_URI', 'http://test.com/foo?bar=foo'); + $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); + $this->assertEquals('/foo', $request->getPathInfo()); + $this->assertEquals('bar=baz', $request->getQueryString()); + $this->assertEquals('test.com', $request->getHost()); + $this->assertEquals('test.com', $request->getHttpHost()); + $this->assertEquals(80, $request->getPort()); + $this->assertFalse($request->isSecure()); + + $request = Request::create('https://test.com:443/foo'); + $request->server->set('REQUEST_URI', 'https://test.com:443/foo'); + $this->assertEquals('https://test.com/foo', $request->getUri()); + $this->assertEquals('/foo', $request->getPathInfo()); + $this->assertEquals('test.com', $request->getHost()); + $this->assertEquals('test.com', $request->getHttpHost()); + $this->assertEquals(443, $request->getPort()); + $this->assertTrue($request->isSecure()); + + // Fragment should not be included in the URI + $request = Request::create('http://test.com/foo#bar'); + $request->server->set('REQUEST_URI', 'http://test.com/foo#bar'); + $this->assertEquals('http://test.com/foo', $request->getUri()); + } + + /** + * @dataProvider getRequestUriData + */ + public function testGetRequestUri($serverRequestUri, $expected, $message) + { + $request = new Request(); + $request->server->add([ + 'REQUEST_URI' => $serverRequestUri, + + // For having http://test.com + 'SERVER_NAME' => 'test.com', + 'SERVER_PORT' => 80, + ]); + + $this->assertSame($expected, $request->getRequestUri(), $message); + $this->assertSame($expected, $request->server->get('REQUEST_URI'), 'Normalize the request URI.'); + } + + public function getRequestUriData() + { + $message = 'Do not modify the path.'; + yield ['/foo', '/foo', $message]; + yield ['//bar/foo', '//bar/foo', $message]; + yield ['///bar/foo', '///bar/foo', $message]; + + $message = 'Handle when the scheme, host are on REQUEST_URI.'; + yield ['http://test.com/foo?bar=baz', '/foo?bar=baz', $message]; + + $message = 'Handle when the scheme, host and port are on REQUEST_URI.'; + yield ['http://test.com:80/foo', '/foo', $message]; + yield ['https://test.com:8080/foo', '/foo', $message]; + yield ['https://test.com:443/foo', '/foo', $message]; + + $message = 'Fragment should not be included in the URI'; + yield ['http://test.com/foo#bar', '/foo', $message]; + yield ['/foo#bar', '/foo', $message]; + } + + public function testGetRequestUriWithoutRequiredHeader() + { + $expected = ''; + + $request = new Request(); + + $message = 'Fallback to empty URI when headers are missing.'; + $this->assertSame($expected, $request->getRequestUri(), $message); + $this->assertSame($expected, $request->server->get('REQUEST_URI'), 'Normalize the request URI.'); } public function testCreateCheckPrecedence() { // server is used by default - $request = Request::create('/', 'DELETE', array(), array(), array(), array( + $request = Request::create('/', 'DELETE', [], [], [], [ 'HTTP_HOST' => 'example.com', 'HTTPS' => 'on', 'SERVER_PORT' => 443, @@ -245,7 +343,7 @@ public function testCreateCheckPrecedence() 'PHP_AUTH_PW' => 'pa$$', 'QUERY_STRING' => 'foo=bar', 'CONTENT_TYPE' => 'application/json', - )); + ]); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(443, $request->getPort()); $this->assertTrue($request->isSecure()); @@ -255,11 +353,11 @@ public function testCreateCheckPrecedence() $this->assertEquals('application/json', $request->headers->get('CONTENT_TYPE')); // URI has precedence over server - $request = Request::create('http://thomas:pokemon@example.net:8080/?foo=bar', 'GET', array(), array(), array(), array( + $request = Request::create('http://thomas:pokemon@example.net:8080/?foo=bar', 'GET', [], [], [], [ 'HTTP_HOST' => 'example.com', 'HTTPS' => 'on', 'SERVER_PORT' => 443, - )); + ]); $this->assertEquals('example.net', $request->getHost()); $this->assertEquals(8080, $request->getPort()); $this->assertFalse($request->isSecure()); @@ -270,7 +368,7 @@ public function testCreateCheckPrecedence() public function testDuplicate() { - $request = new Request(array('foo' => 'bar'), array('foo' => 'bar'), array('foo' => 'bar'), array(), array(), array('HTTP_FOO' => 'bar')); + $request = new Request(['foo' => 'bar'], ['foo' => 'bar'], ['foo' => 'bar'], [], [], ['HTTP_FOO' => 'bar']); $dup = $request->duplicate(); $this->assertEquals($request->query->all(), $dup->query->all(), '->duplicate() duplicates a request an copy the current query parameters'); @@ -278,17 +376,17 @@ public function testDuplicate() $this->assertEquals($request->attributes->all(), $dup->attributes->all(), '->duplicate() duplicates a request an copy the current attributes'); $this->assertEquals($request->headers->all(), $dup->headers->all(), '->duplicate() duplicates a request an copy the current HTTP headers'); - $dup = $request->duplicate(array('foo' => 'foobar'), array('foo' => 'foobar'), array('foo' => 'foobar'), array(), array(), array('HTTP_FOO' => 'foobar')); + $dup = $request->duplicate(['foo' => 'foobar'], ['foo' => 'foobar'], ['foo' => 'foobar'], [], [], ['HTTP_FOO' => 'foobar']); - $this->assertEquals(array('foo' => 'foobar'), $dup->query->all(), '->duplicate() overrides the query parameters if provided'); - $this->assertEquals(array('foo' => 'foobar'), $dup->request->all(), '->duplicate() overrides the request parameters if provided'); - $this->assertEquals(array('foo' => 'foobar'), $dup->attributes->all(), '->duplicate() overrides the attributes if provided'); - $this->assertEquals(array('foo' => array('foobar')), $dup->headers->all(), '->duplicate() overrides the HTTP header if provided'); + $this->assertEquals(['foo' => 'foobar'], $dup->query->all(), '->duplicate() overrides the query parameters if provided'); + $this->assertEquals(['foo' => 'foobar'], $dup->request->all(), '->duplicate() overrides the request parameters if provided'); + $this->assertEquals(['foo' => 'foobar'], $dup->attributes->all(), '->duplicate() overrides the attributes if provided'); + $this->assertEquals(['foo' => ['foobar']], $dup->headers->all(), '->duplicate() overrides the HTTP header if provided'); } public function testDuplicateWithFormat() { - $request = new Request(array(), array(), array('_format' => 'json')); + $request = new Request([], [], ['_format' => 'json']); $dup = $request->duplicate(); $this->assertEquals('json', $dup->getRequestFormat()); @@ -323,7 +421,7 @@ public function testGetFormatFromMimeType($format, $mimeTypes) public function getFormatToMimeTypeMapProviderWithAdditionalNullFormat() { return array_merge( - array(array(null, array(null, 'unexistent-mime-type'))), + [[null, [null, 'unexistent-mime-type']]], $this->getFormatToMimeTypeMapProvider() ); } @@ -332,6 +430,9 @@ public function testGetFormatFromMimeTypeWithParameters() { $request = new Request(); $this->assertEquals('json', $request->getFormat('application/json; charset=utf-8')); + $this->assertEquals('json', $request->getFormat('application/json;charset=utf-8')); + $this->assertEquals('json', $request->getFormat('application/json ; charset=utf-8')); + $this->assertEquals('json', $request->getFormat('application/json ;charset=utf-8')); } /** @@ -355,7 +456,7 @@ public function testGetMimeTypesFromInexistentFormat() { $request = new Request(); $this->assertNull($request->getMimeType('foo')); - $this->assertEquals(array(), Request::getMimeTypes('foo')); + $this->assertEquals([], Request::getMimeTypes('foo')); } public function testGetFormatWithCustomMimeType() @@ -367,21 +468,21 @@ public function testGetFormatWithCustomMimeType() public function getFormatToMimeTypeMapProvider() { - return array( - array('txt', array('text/plain')), - array('js', array('application/javascript', 'application/x-javascript', 'text/javascript')), - array('css', array('text/css')), - array('json', array('application/json', 'application/x-json')), - array('jsonld', array('application/ld+json')), - array('xml', array('text/xml', 'application/xml', 'application/x-xml')), - array('rdf', array('application/rdf+xml')), - array('atom', array('application/atom+xml')), - ); + return [ + ['txt', ['text/plain']], + ['js', ['application/javascript', 'application/x-javascript', 'text/javascript']], + ['css', ['text/css']], + ['json', ['application/json', 'application/x-json']], + ['jsonld', ['application/ld+json']], + ['xml', ['text/xml', 'application/xml', 'application/x-xml']], + ['rdf', ['application/rdf+xml']], + ['atom', ['application/atom+xml']], + ]; } public function testGetUri() { - $server = array(); + $server = []; // Standard Request on non default PORT // http://host:8080/index.php/path/info?query=string @@ -400,7 +501,7 @@ public function testGetUri() $request = new Request(); - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/index.php/path/info?query=string', $request->getUri(), '->getUri() with non default port'); @@ -409,7 +510,7 @@ public function testGetUri() $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port'); @@ -418,7 +519,7 @@ public function testGetUri() $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port without HOST_HEADER'); @@ -426,7 +527,7 @@ public function testGetUri() // RewriteCond %{REQUEST_FILENAME} !-f // RewriteRule ^(.*)$ index.php [QSA,L] // http://host:8080/path/info?query=string - $server = array(); + $server = []; $server['HTTP_HOST'] = 'host:8080'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '8080'; @@ -440,7 +541,7 @@ public function testGetUri() $server['PHP_SELF'] = '/index.php'; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/path/info?query=string', $request->getUri(), '->getUri() with rewrite'); // Use std port number @@ -449,7 +550,7 @@ public function testGetUri() $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host/path/info?query=string', $request->getUri(), '->getUri() with rewrite and default port'); @@ -458,13 +559,13 @@ public function testGetUri() $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/path/info?query=string', $request->getUri(), '->getUri() with rewrite, default port without HOST_HEADER'); // With encoded characters - $server = array( + $server = [ 'HTTP_HOST' => 'host:8080', 'SERVER_NAME' => 'servername', 'SERVER_PORT' => '8080', @@ -474,9 +575,9 @@ public function testGetUri() 'PATH_TRANSLATED' => 'redirect:/index.php/foo bar/in+fo', 'PHP_SELF' => '/ba se/index_dev.php/path/info', 'SCRIPT_FILENAME' => '/some/where/ba se/index_dev.php', - ); + ]; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals( 'http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', @@ -486,11 +587,11 @@ public function testGetUri() // with user info $server['PHP_AUTH_USER'] = 'fabien'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); $server['PHP_AUTH_PW'] = 'symfony'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); } @@ -508,7 +609,7 @@ public function testGetUriForPath() $request = Request::create('https://test.com:90/foo?bar=baz'); $this->assertEquals('https://test.com:90/some/path', $request->getUriForPath('/some/path')); - $server = array(); + $server = []; // Standard Request on non default PORT // http://host:8080/index.php/path/info?query=string @@ -527,7 +628,7 @@ public function testGetUriForPath() $request = new Request(); - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with non default port'); @@ -536,7 +637,7 @@ public function testGetUriForPath() $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port'); @@ -545,7 +646,7 @@ public function testGetUriForPath() $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port without HOST_HEADER'); @@ -553,7 +654,7 @@ public function testGetUriForPath() // RewriteCond %{REQUEST_FILENAME} !-f // RewriteRule ^(.*)$ index.php [QSA,L] // http://host:8080/path/info?query=string - $server = array(); + $server = []; $server['HTTP_HOST'] = 'host:8080'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '8080'; @@ -567,7 +668,7 @@ public function testGetUriForPath() $server['PHP_SELF'] = '/index.php'; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/some/path', $request->getUriForPath('/some/path'), '->getUri() with rewrite'); // Use std port number @@ -576,7 +677,7 @@ public function testGetUriForPath() $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite and default port'); @@ -585,7 +686,7 @@ public function testGetUriForPath() $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite, default port without HOST_HEADER'); $this->assertEquals('servername', $request->getHttpHost()); @@ -593,11 +694,11 @@ public function testGetUriForPath() // with user info $server['PHP_AUTH_USER'] = 'fabien'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path')); $server['PHP_AUTH_PW'] = 'symfony'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path')); } @@ -611,30 +712,30 @@ public function testGetRelativeUriForPath($expected, $pathinfo, $path) public function getRelativeUriForPathData() { - return array( - array('me.png', '/foo', '/me.png'), - array('../me.png', '/foo/bar', '/me.png'), - array('me.png', '/foo/bar', '/foo/me.png'), - array('../baz/me.png', '/foo/bar/b', '/foo/baz/me.png'), - array('../../fooz/baz/me.png', '/foo/bar/b', '/fooz/baz/me.png'), - array('baz/me.png', '/foo/bar/b', 'baz/me.png'), - ); + return [ + ['me.png', '/foo', '/me.png'], + ['../me.png', '/foo/bar', '/me.png'], + ['me.png', '/foo/bar', '/foo/me.png'], + ['../baz/me.png', '/foo/bar/b', '/foo/baz/me.png'], + ['../../fooz/baz/me.png', '/foo/bar/b', '/fooz/baz/me.png'], + ['baz/me.png', '/foo/bar/b', 'baz/me.png'], + ]; } public function testGetUserInfo() { $request = new Request(); - $server = array('PHP_AUTH_USER' => 'fabien'); - $request->initialize(array(), array(), array(), array(), array(), $server); + $server = ['PHP_AUTH_USER' => 'fabien']; + $request->initialize([], [], [], [], [], $server); $this->assertEquals('fabien', $request->getUserInfo()); $server['PHP_AUTH_USER'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('0', $request->getUserInfo()); $server['PHP_AUTH_PW'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('0:0', $request->getUserInfo()); } @@ -642,22 +743,22 @@ public function testGetSchemeAndHttpHost() { $request = new Request(); - $server = array(); + $server = []; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '90'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); $server['PHP_AUTH_USER'] = 'fabien'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); $server['PHP_AUTH_USER'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); $server['PHP_AUTH_PW'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); } @@ -674,29 +775,29 @@ public function testGetQueryString($query, $expectedQuery, $msg) public function getQueryStringNormalizationData() { - return array( - array('foo', 'foo', 'works with valueless parameters'), - array('foo=', 'foo=', 'includes a dangling equal sign'), - array('bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'), - array('foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'), + return [ + ['foo', 'foo', 'works with valueless parameters'], + ['foo=', 'foo=', 'includes a dangling equal sign'], + ['bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'], + ['foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'], // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. - array('him=John%20Doe&her=Jane+Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes spaces in both encodings "%20" and "+"'), + ['baz=Foo%20Baz&bar=Foo+Bar', 'bar=Foo%20Bar&baz=Foo%20Baz', 'normalizes spaces in both encodings "%20" and "+"'], - array('foo[]=1&foo[]=2', 'foo%5B%5D=1&foo%5B%5D=2', 'allows array notation'), - array('foo=1&foo=2', 'foo=1&foo=2', 'allows repeated parameters'), - array('pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'), - array('0', '0', 'allows "0"'), - array('Jane Doe&John%20Doe', 'Jane%20Doe&John%20Doe', 'normalizes encoding in keys'), - array('her=Jane Doe&him=John%20Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes encoding in values'), - array('foo=bar&&&test&&', 'foo=bar&test', 'removes unneeded delimiters'), - array('formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'), + ['foo[]=1&foo[]=2', 'foo%5B%5D=1&foo%5B%5D=2', 'allows array notation'], + ['foo=1&foo=2', 'foo=1&foo=2', 'allows repeated parameters'], + ['pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'], + ['0', '0', 'allows "0"'], + ['Foo Bar&Foo%20Baz', 'Foo%20Bar&Foo%20Baz', 'normalizes encoding in keys'], + ['bar=Foo Bar&baz=Foo%20Baz', 'bar=Foo%20Bar&baz=Foo%20Baz', 'normalizes encoding in values'], + ['foo=bar&&&test&&', 'foo=bar&test', 'removes unneeded delimiters'], + ['formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'], // Ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. // PHP also does not include them when building _GET. - array('foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'), - ); + ['foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'], + ]; } public function testGetQueryStringReturnsNull() @@ -713,74 +814,74 @@ public function testGetHost() { $request = new Request(); - $request->initialize(array('foo' => 'bar')); + $request->initialize(['foo' => 'bar']); $this->assertEquals('', $request->getHost(), '->getHost() return empty string if not initialized'); - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com')); + $request->initialize([], [], [], [], [], ['HTTP_HOST' => 'www.example.com']); $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header'); // Host header with port number - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com:8080')); + $request->initialize([], [], [], [], [], ['HTTP_HOST' => 'www.example.com:8080']); $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header with port number'); // Server values - $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com')); + $request->initialize([], [], [], [], [], ['SERVER_NAME' => 'www.example.com']); $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from server name'); - $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com', 'HTTP_HOST' => 'www.host.com')); + $request->initialize([], [], [], [], [], ['SERVER_NAME' => 'www.example.com', 'HTTP_HOST' => 'www.host.com']); $this->assertEquals('www.host.com', $request->getHost(), '->getHost() value from Host header has priority over SERVER_NAME '); } public function testGetPort() { - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_X_FORWARDED_PORT' => '443', - )); + ]); $port = $request->getPort(); $this->assertEquals(80, $port, 'Without trusted proxies FORWARDED_PROTO and FORWARDED_PORT are ignored.'); - Request::setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_ALL); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_ALL); + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_X_FORWARDED_PORT' => '8443', - )); + ]); $this->assertEquals(80, $request->getPort(), 'With PROTO and PORT on untrusted connection server value takes precedence.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(8443, $request->getPort(), 'With PROTO and PORT set PORT takes precedence.'); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'https', - )); + ]); $this->assertEquals(80, $request->getPort(), 'With only PROTO set getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(443, $request->getPort(), 'With only PROTO set getPort() defaults to 443.'); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'http', - )); + ]); $this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() returns port of the original request.'); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'On', - )); + ]); $this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is On, getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is On, getPort() defaults to 443.'); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => '1', - )); + ]); $this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is 1, getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is 1, getPort() defaults to 443.'); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'something-else', - )); + ]); $port = $request->getPort(); $this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.'); } @@ -791,7 +892,7 @@ public function testGetPort() public function testGetHostWithFakeHttpHostValue() { $request = new Request(); - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.host.com?query=string')); + $request->initialize([], [], [], [], [], ['HTTP_HOST' => 'www.host.com?query=string']); $request->getHost(); } @@ -851,7 +952,7 @@ public function testGetSetMethod() $request = new Request(); $request->setMethod('POST'); - $request->query->set('_method', array('delete', 'patch')); + $request->query->set('_method', ['delete', 'patch']); $this->assertSame('POST', $request->getMethod(), '->getMethod() returns the request method if invalid type is defined in query'); } @@ -888,69 +989,69 @@ public function testGetClientIpsForwarded($expected, $remoteAddr, $httpForwarded public function getClientIpsForwardedProvider() { // $expected $remoteAddr $httpForwarded $trustedProxies - return array( - array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', null), - array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', array('127.0.0.1')), - array(array('88.88.88.88'), '127.0.0.1', 'for="88.88.88.88:80"', array('127.0.0.1')), - array(array('192.0.2.60'), '::1', 'for=192.0.2.60;proto=http;by=203.0.113.43', array('::1')), - array(array('2620:0:1cfe:face:b00c::3', '192.0.2.43'), '::1', 'for=192.0.2.43, for=2620:0:1cfe:face:b00c::3', array('::1')), - array(array('2001:db8:cafe::17'), '::1', 'for="[2001:db8:cafe::17]:4711', array('::1')), - ); + return [ + [['127.0.0.1'], '127.0.0.1', 'for="_gazonk"', null], + [['127.0.0.1'], '127.0.0.1', 'for="_gazonk"', ['127.0.0.1']], + [['88.88.88.88'], '127.0.0.1', 'for="88.88.88.88:80"', ['127.0.0.1']], + [['192.0.2.60'], '::1', 'for=192.0.2.60;proto=http;by=203.0.113.43', ['::1']], + [['2620:0:1cfe:face:b00c::3', '192.0.2.43'], '::1', 'for=192.0.2.43, for=2620:0:1cfe:face:b00c::3', ['::1']], + [['2001:db8:cafe::17'], '::1', 'for="[2001:db8:cafe::17]:4711', ['::1']], + ]; } public function getClientIpsProvider() { - // $expected $remoteAddr $httpForwardedFor $trustedProxies - return array( + // $expected $remoteAddr $httpForwardedFor $trustedProxies + return [ // simple IPv4 - array(array('88.88.88.88'), '88.88.88.88', null, null), + [['88.88.88.88'], '88.88.88.88', null, null], // trust the IPv4 remote addr - array(array('88.88.88.88'), '88.88.88.88', null, array('88.88.88.88')), + [['88.88.88.88'], '88.88.88.88', null, ['88.88.88.88']], // simple IPv6 - array(array('::1'), '::1', null, null), + [['::1'], '::1', null, null], // trust the IPv6 remote addr - array(array('::1'), '::1', null, array('::1')), + [['::1'], '::1', null, ['::1']], // forwarded for with remote IPv4 addr not trusted - array(array('127.0.0.1'), '127.0.0.1', '88.88.88.88', null), - // forwarded for with remote IPv4 addr trusted - array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1')), + [['127.0.0.1'], '127.0.0.1', '88.88.88.88', null], + // forwarded for with remote IPv4 addr trusted + comma + [['88.88.88.88'], '127.0.0.1', '88.88.88.88,', ['127.0.0.1']], // forwarded for with remote IPv4 and all FF addrs trusted - array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1', '88.88.88.88')), + [['88.88.88.88'], '127.0.0.1', '88.88.88.88', ['127.0.0.1', '88.88.88.88']], // forwarded for with remote IPv4 range trusted - array(array('88.88.88.88'), '123.45.67.89', '88.88.88.88', array('123.45.67.0/24')), + [['88.88.88.88'], '123.45.67.89', '88.88.88.88', ['123.45.67.0/24']], // forwarded for with remote IPv6 addr not trusted - array(array('1620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', null), + [['1620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', null], // forwarded for with remote IPv6 addr trusted - array(array('2620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')), + [['2620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3']], // forwarded for with remote IPv6 range trusted - array(array('88.88.88.88'), '2a01:198:603:0:396e:4789:8e99:890f', '88.88.88.88', array('2a01:198:603:0::/65')), + [['88.88.88.88'], '2a01:198:603:0:396e:4789:8e99:890f', '88.88.88.88', ['2a01:198:603:0::/65']], // multiple forwarded for with remote IPv4 addr trusted - array(array('88.88.88.88', '87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89')), + [['88.88.88.88', '87.65.43.21', '127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89']], // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted - array(array('87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '88.88.88.88')), + [['87.65.43.21', '127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89', '88.88.88.88']], // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle - array(array('88.88.88.88', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21')), + [['88.88.88.88', '127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89', '87.65.43.21']], // multiple forwarded for with remote IPv4 addr and all reverse proxies trusted - array(array('127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21', '88.88.88.88', '127.0.0.1')), + [['127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89', '87.65.43.21', '88.88.88.88', '127.0.0.1']], // multiple forwarded for with remote IPv6 addr trusted - array(array('2620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')), + [['2620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3']], // multiple forwarded for with remote IPv6 addr and some reverse proxies trusted - array(array('3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3')), + [['3620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3']], // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle - array(array('2620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3,3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3')), + [['2620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3,3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3']], // client IP with port - array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88:12345, 127.0.0.1', array('127.0.0.1')), + [['88.88.88.88'], '127.0.0.1', '88.88.88.88:12345, 127.0.0.1', ['127.0.0.1']], // invalid forwarded IP is ignored - array(array('88.88.88.88'), '127.0.0.1', 'unknown,88.88.88.88', array('127.0.0.1')), - array(array('88.88.88.88'), '127.0.0.1', '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2,88.88.88.88', array('127.0.0.1')), - ); + [['88.88.88.88'], '127.0.0.1', 'unknown,88.88.88.88', ['127.0.0.1']], + [['88.88.88.88'], '127.0.0.1', '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2,88.88.88.88', ['127.0.0.1']], + ]; } /** @@ -961,15 +1062,15 @@ public function testGetClientIpsWithConflictingHeaders($httpForwarded, $httpXFor { $request = new Request(); - $server = array( + $server = [ 'REMOTE_ADDR' => '88.88.88.88', 'HTTP_FORWARDED' => $httpForwarded, 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor, - ); + ]; - Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_ALL | Request::HEADER_FORWARDED); + Request::setTrustedProxies(['88.88.88.88'], Request::HEADER_X_FORWARDED_ALL | Request::HEADER_FORWARDED); - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $request->getClientIps(); } @@ -981,15 +1082,15 @@ public function testGetClientIpsOnlyXHttpForwardedForTrusted($httpForwarded, $ht { $request = new Request(); - $server = array( + $server = [ 'REMOTE_ADDR' => '88.88.88.88', 'HTTP_FORWARDED' => $httpForwarded, 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor, - ); + ]; - Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_FOR); + Request::setTrustedProxies(['88.88.88.88'], Request::HEADER_X_FORWARDED_FOR); - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertSame(array_reverse(explode(',', $httpXForwardedFor)), $request->getClientIps()); } @@ -997,13 +1098,13 @@ public function testGetClientIpsOnlyXHttpForwardedForTrusted($httpForwarded, $ht public function getClientIpsWithConflictingHeadersProvider() { // $httpForwarded $httpXForwardedFor - return array( - array('for=87.65.43.21', '192.0.2.60'), - array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60'), - array('for=192.0.2.60', '192.0.2.60,87.65.43.21'), - array('for="::face", for=192.0.2.60', '192.0.2.60,192.0.2.43'), - array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60,87.65.43.21'), - ); + return [ + ['for=87.65.43.21', '192.0.2.60'], + ['for=87.65.43.21, for=192.0.2.60', '192.0.2.60'], + ['for=192.0.2.60', '192.0.2.60,87.65.43.21'], + ['for="::face", for=192.0.2.60', '192.0.2.60,192.0.2.43'], + ['for=87.65.43.21, for=192.0.2.60', '192.0.2.60,87.65.43.21'], + ]; } /** @@ -1013,15 +1114,15 @@ public function testGetClientIpsWithAgreeingHeaders($httpForwarded, $httpXForwar { $request = new Request(); - $server = array( + $server = [ 'REMOTE_ADDR' => '88.88.88.88', 'HTTP_FORWARDED' => $httpForwarded, 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor, - ); + ]; - Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['88.88.88.88'], -1); - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $clientIps = $request->getClientIps(); @@ -1031,14 +1132,14 @@ public function testGetClientIpsWithAgreeingHeaders($httpForwarded, $httpXForwar public function getClientIpsWithAgreeingHeadersProvider() { // $httpForwarded $httpXForwardedFor - return array( - array('for="192.0.2.60"', '192.0.2.60', array('192.0.2.60')), - array('for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21', array('87.65.43.21', '192.0.2.60')), - array('for="[::face]", for=192.0.2.60', '::face,192.0.2.60', array('192.0.2.60', '::face')), - array('for="192.0.2.60:80"', '192.0.2.60', array('192.0.2.60')), - array('for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60', array('192.0.2.60')), - array('for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17', array('2001:db8:cafe::17')), - ); + return [ + ['for="192.0.2.60"', '192.0.2.60', ['192.0.2.60']], + ['for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21', ['87.65.43.21', '192.0.2.60']], + ['for="[::face]", for=192.0.2.60', '::face,192.0.2.60', ['192.0.2.60', '::face']], + ['for="192.0.2.60:80"', '192.0.2.60', ['192.0.2.60']], + ['for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60', ['192.0.2.60']], + ['for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17', ['2001:db8:cafe::17']], + ]; } public function testGetContentWorksTwiceInDefaultMode() @@ -1059,7 +1160,7 @@ public function testGetContentReturnsResource() public function testGetContentReturnsResourceWhenContentSetInConstructor() { - $req = new Request(array(), array(), array(), array(), array(), array(), 'MyContent'); + $req = new Request([], [], [], [], [], [], 'MyContent'); $resource = $req->getContent(true); $this->assertInternalType('resource', $resource); @@ -1072,7 +1173,7 @@ public function testContentAsResource() fwrite($resource, 'My other content'); rewind($resource); - $req = new Request(array(), array(), array(), array(), array(), array(), $resource); + $req = new Request([], [], [], [], [], [], $resource); $this->assertEquals('My other content', stream_get_contents($req->getContent(true))); $this->assertEquals('My other content', $req->getContent()); } @@ -1094,10 +1195,10 @@ public function testGetContentCantBeCalledTwiceWithResources($first, $second) public function getContentCantBeCalledTwiceWithResourcesProvider() { - return array( - 'Resource then fetch' => array(true, false), - 'Resource then resource' => array(true, true), - ); + return [ + 'Resource then fetch' => [true, false], + 'Resource then resource' => [true, true], + ]; } /** @@ -1123,24 +1224,24 @@ public function testGetContentCanBeCalledTwiceWithResources($first, $second) public function getContentCanBeCalledTwiceWithResourcesProvider() { - return array( - 'Fetch then fetch' => array(false, false), - 'Fetch then resource' => array(false, true), - 'Resource then fetch' => array(true, false), - 'Resource then resource' => array(true, true), - ); + return [ + 'Fetch then fetch' => [false, false], + 'Fetch then resource' => [false, true], + 'Resource then fetch' => [true, false], + 'Resource then resource' => [true, true], + ]; } public function provideOverloadedMethods() { - return array( - array('PUT'), - array('DELETE'), - array('PATCH'), - array('put'), - array('delete'), - array('patch'), - ); + return [ + ['PUT'], + ['DELETE'], + ['PATCH'], + ['put'], + ['delete'], + ['patch'], + ]; } /** @@ -1153,14 +1254,14 @@ public function testCreateFromGlobals($method) $_GET['foo1'] = 'bar1'; $_POST['foo2'] = 'bar2'; $_COOKIE['foo3'] = 'bar3'; - $_FILES['foo4'] = array('bar4'); + $_FILES['foo4'] = ['bar4']; $_SERVER['foo5'] = 'bar5'; $request = Request::createFromGlobals(); $this->assertEquals('bar1', $request->query->get('foo1'), '::fromGlobals() uses values from $_GET'); $this->assertEquals('bar2', $request->request->get('foo2'), '::fromGlobals() uses values from $_POST'); $this->assertEquals('bar3', $request->cookies->get('foo3'), '::fromGlobals() uses values from $_COOKIE'); - $this->assertEquals(array('bar4'), $request->files->get('foo4'), '::fromGlobals() uses values from $_FILES'); + $this->assertEquals(['bar4'], $request->files->get('foo4'), '::fromGlobals() uses values from $_FILES'); $this->assertEquals('bar5', $request->server->get('foo5'), '::fromGlobals() uses values from $_SERVER'); unset($_GET['foo1'], $_POST['foo2'], $_COOKIE['foo3'], $_FILES['foo4'], $_SERVER['foo5']); @@ -1190,25 +1291,25 @@ public function testCreateFromGlobals($method) public function testOverrideGlobals() { $request = new Request(); - $request->initialize(array('foo' => 'bar')); + $request->initialize(['foo' => 'bar']); // as the Request::overrideGlobals really work, it erase $_SERVER, so we must backup it $server = $_SERVER; $request->overrideGlobals(); - $this->assertEquals(array('foo' => 'bar'), $_GET); + $this->assertEquals(['foo' => 'bar'], $_GET); - $request->initialize(array(), array('foo' => 'bar')); + $request->initialize([], ['foo' => 'bar']); $request->overrideGlobals(); - $this->assertEquals(array('foo' => 'bar'), $_POST); + $this->assertEquals(['foo' => 'bar'], $_POST); $this->assertArrayNotHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER); $request->headers->set('X_FORWARDED_PROTO', 'https'); - Request::setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_ALL); $this->assertFalse($request->isSecure()); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertTrue($request->isSecure()); @@ -1225,12 +1326,12 @@ public function testOverrideGlobals() $this->assertArrayHasKey('CONTENT_TYPE', $_SERVER); $this->assertArrayHasKey('CONTENT_LENGTH', $_SERVER); - $request->initialize(array('foo' => 'bar', 'baz' => 'foo')); + $request->initialize(['foo' => 'bar', 'baz' => 'foo']); $request->query->remove('baz'); $request->overrideGlobals(); - $this->assertEquals(array('foo' => 'bar'), $_GET); + $this->assertEquals(['foo' => 'bar'], $_GET); $this->assertEquals('foo=bar', $_SERVER['QUERY_STRING']); $this->assertEquals('foo=bar', $request->server->get('QUERY_STRING')); @@ -1243,23 +1344,23 @@ public function testGetScriptName() $request = new Request(); $this->assertEquals('', $request->getScriptName()); - $server = array(); + $server = []; $server['SCRIPT_NAME'] = '/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/index.php', $request->getScriptName()); - $server = array(); + $server = []; $server['ORIG_SCRIPT_NAME'] = '/frontend.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/frontend.php', $request->getScriptName()); - $server = array(); + $server = []; $server['SCRIPT_NAME'] = '/index.php'; $server['ORIG_SCRIPT_NAME'] = '/frontend.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/index.php', $request->getScriptName()); } @@ -1269,29 +1370,29 @@ public function testGetBasePath() $request = new Request(); $this->assertEquals('', $request->getBasePath()); - $server = array(); + $server = []; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('', $request->getBasePath()); - $server = array(); + $server = []; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $server['SCRIPT_NAME'] = '/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('', $request->getBasePath()); - $server = array(); + $server = []; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $server['PHP_SELF'] = '/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('', $request->getBasePath()); - $server = array(); + $server = []; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $server['ORIG_SCRIPT_NAME'] = '/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('', $request->getBasePath()); } @@ -1301,21 +1402,21 @@ public function testGetPathInfo() $request = new Request(); $this->assertEquals('/', $request->getPathInfo()); - $server = array(); + $server = []; $server['REQUEST_URI'] = '/path/info'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/path/info', $request->getPathInfo()); - $server = array(); + $server = []; $server['REQUEST_URI'] = '/path%20test/info'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/path%20test/info', $request->getPathInfo()); - $server = array(); + $server = []; $server['REQUEST_URI'] = '?a=b'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/', $request->getPathInfo()); } @@ -1343,27 +1444,27 @@ public function testGetPreferredLanguage() { $request = new Request(); $this->assertNull($request->getPreferredLanguage()); - $this->assertNull($request->getPreferredLanguage(array())); - $this->assertEquals('fr', $request->getPreferredLanguage(array('fr'))); - $this->assertEquals('fr', $request->getPreferredLanguage(array('fr', 'en'))); - $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'fr'))); - $this->assertEquals('fr-ch', $request->getPreferredLanguage(array('fr-ch', 'fr-fr'))); + $this->assertNull($request->getPreferredLanguage([])); + $this->assertEquals('fr', $request->getPreferredLanguage(['fr'])); + $this->assertEquals('fr', $request->getPreferredLanguage(['fr', 'en'])); + $this->assertEquals('en', $request->getPreferredLanguage(['en', 'fr'])); + $this->assertEquals('fr-ch', $request->getPreferredLanguage(['fr-ch', 'fr-fr'])); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); - $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'en-us'))); + $this->assertEquals('en', $request->getPreferredLanguage(['en', 'en-us'])); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); - $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); + $this->assertEquals('en', $request->getPreferredLanguage(['fr', 'en'])); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8'); - $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); + $this->assertEquals('en', $request->getPreferredLanguage(['fr', 'en'])); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, fr-fr; q=0.6, fr; q=0.5'); - $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); + $this->assertEquals('en', $request->getPreferredLanguage(['fr', 'en'])); } public function testIsXmlHttpRequest() @@ -1401,72 +1502,72 @@ public function testIntlLocale() public function testGetCharsets() { $request = new Request(); - $this->assertEquals(array(), $request->getCharsets()); + $this->assertEquals([], $request->getCharsets()); $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6'); - $this->assertEquals(array(), $request->getCharsets()); // testing caching + $this->assertEquals([], $request->getCharsets()); // testing caching $request = new Request(); $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6'); - $this->assertEquals(array('ISO-8859-1', 'US-ASCII', 'UTF-8', 'ISO-10646-UCS-2'), $request->getCharsets()); + $this->assertEquals(['ISO-8859-1', 'US-ASCII', 'UTF-8', 'ISO-10646-UCS-2'], $request->getCharsets()); $request = new Request(); $request->headers->set('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'); - $this->assertEquals(array('ISO-8859-1', 'utf-8', '*'), $request->getCharsets()); + $this->assertEquals(['ISO-8859-1', 'utf-8', '*'], $request->getCharsets()); } public function testGetEncodings() { $request = new Request(); - $this->assertEquals(array(), $request->getEncodings()); + $this->assertEquals([], $request->getEncodings()); $request->headers->set('Accept-Encoding', 'gzip,deflate,sdch'); - $this->assertEquals(array(), $request->getEncodings()); // testing caching + $this->assertEquals([], $request->getEncodings()); // testing caching $request = new Request(); $request->headers->set('Accept-Encoding', 'gzip,deflate,sdch'); - $this->assertEquals(array('gzip', 'deflate', 'sdch'), $request->getEncodings()); + $this->assertEquals(['gzip', 'deflate', 'sdch'], $request->getEncodings()); $request = new Request(); $request->headers->set('Accept-Encoding', 'gzip;q=0.4,deflate;q=0.9,compress;q=0.7'); - $this->assertEquals(array('deflate', 'compress', 'gzip'), $request->getEncodings()); + $this->assertEquals(['deflate', 'compress', 'gzip'], $request->getEncodings()); } public function testGetAcceptableContentTypes() { $request = new Request(); - $this->assertEquals(array(), $request->getAcceptableContentTypes()); + $this->assertEquals([], $request->getAcceptableContentTypes()); $request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*'); - $this->assertEquals(array(), $request->getAcceptableContentTypes()); // testing caching + $this->assertEquals([], $request->getAcceptableContentTypes()); // testing caching $request = new Request(); $request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*'); - $this->assertEquals(array('application/vnd.wap.wmlscriptc', 'text/vnd.wap.wml', 'application/vnd.wap.xhtml+xml', 'application/xhtml+xml', 'text/html', 'multipart/mixed', '*/*'), $request->getAcceptableContentTypes()); + $this->assertEquals(['application/vnd.wap.wmlscriptc', 'text/vnd.wap.wml', 'application/vnd.wap.xhtml+xml', 'application/xhtml+xml', 'text/html', 'multipart/mixed', '*/*'], $request->getAcceptableContentTypes()); } public function testGetLanguages() { $request = new Request(); - $this->assertEquals(array(), $request->getLanguages()); + $this->assertEquals([], $request->getLanguages()); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); - $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages()); - $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages()); + $this->assertEquals(['zh', 'en_US', 'en'], $request->getLanguages()); + $this->assertEquals(['zh', 'en_US', 'en'], $request->getLanguages()); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.6, en; q=0.8'); - $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test out of order qvalues + $this->assertEquals(['zh', 'en', 'en_US'], $request->getLanguages()); // Test out of order qvalues $request = new Request(); $request->headers->set('Accept-language', 'zh, en, en-us'); - $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test equal weighting without qvalues + $this->assertEquals(['zh', 'en', 'en_US'], $request->getLanguages()); // Test equal weighting without qvalues $request = new Request(); $request->headers->set('Accept-language', 'zh; q=0.6, en, en-us; q=0.6'); - $this->assertEquals(array('en', 'zh', 'en_US'), $request->getLanguages()); // Test equal weighting with qvalues + $this->assertEquals(['en', 'zh', 'en_US'], $request->getLanguages()); // Test equal weighting with qvalues $request = new Request(); $request->headers->set('Accept-language', 'zh, i-cherokee; q=0.6'); - $this->assertEquals(array('zh', 'cherokee'), $request->getLanguages()); + $this->assertEquals(['zh', 'cherokee'], $request->getLanguages()); } public function testGetRequestFormat() @@ -1486,7 +1587,7 @@ public function testGetRequestFormat() $this->assertNull($request->setRequestFormat('foo')); $this->assertEquals('foo', $request->getRequestFormat(null)); - $request = new Request(array('_format' => 'foo')); + $request = new Request(['_format' => 'foo']); $this->assertEquals('html', $request->getRequestFormat()); } @@ -1563,7 +1664,7 @@ public function testIsMethod() */ public function testGetBaseUrl($uri, $server, $expectedBaseUrl, $expectedPathInfo) { - $request = Request::create($uri, 'GET', array(), array(), array(), $server); + $request = Request::create($uri, 'GET', [], [], [], $server); $this->assertSame($expectedBaseUrl, $request->getBaseUrl(), 'baseUrl'); $this->assertSame($expectedPathInfo, $request->getPathInfo(), 'pathInfo'); @@ -1571,78 +1672,78 @@ public function testGetBaseUrl($uri, $server, $expectedBaseUrl, $expectedPathInf public function getBaseUrlData() { - return array( - array( + return [ + [ '/fruit/strawberry/1234index.php/blah', - array( + [ 'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/fruit/index.php', 'SCRIPT_NAME' => '/fruit/index.php', 'PHP_SELF' => '/fruit/index.php', - ), + ], '/fruit', '/strawberry/1234index.php/blah', - ), - array( + ], + [ '/fruit/strawberry/1234index.php/blah', - array( + [ 'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/index.php', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php', - ), + ], '', '/fruit/strawberry/1234index.php/blah', - ), - array( + ], + [ '/foo%20bar/', - array( + [ 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', - ), + ], '/foo%20bar', '/', - ), - array( + ], + [ '/foo%20bar/home', - array( + [ 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', - ), + ], '/foo%20bar', '/home', - ), - array( + ], + [ '/foo%20bar/app.php/home', - array( + [ 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', - ), + ], '/foo%20bar/app.php', '/home', - ), - array( + ], + [ '/foo%20bar/app.php/home%3Dbaz', - array( + [ 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', - ), + ], '/foo%20bar/app.php', '/home%3Dbaz', - ), - array( + ], + [ '/foo/bar+baz', - array( + [ 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app.php', 'SCRIPT_NAME' => '/foo/app.php', 'PHP_SELF' => '/foo/app.php', - ), + ], '/foo', '/bar+baz', - ), - ); + ], + ]; } /** @@ -1660,16 +1761,16 @@ public function testUrlencodedStringPrefix($string, $prefix, $expect) public function urlencodedStringPrefixData() { - return array( - array('foo', 'foo', 'foo'), - array('fo%6f', 'foo', 'fo%6f'), - array('foo/bar', 'foo', 'foo'), - array('fo%6f/bar', 'foo', 'fo%6f'), - array('f%6f%6f/bar', 'foo', 'f%6f%6f'), - array('%66%6F%6F/bar', 'foo', '%66%6F%6F'), - array('fo+o/bar', 'fo+o', 'fo+o'), - array('fo%2Bo/bar', 'fo+o', 'fo%2Bo'), - ); + return [ + ['foo', 'foo', 'foo'], + ['fo%6f', 'foo', 'fo%6f'], + ['foo/bar', 'foo', 'foo'], + ['fo%6f/bar', 'foo', 'fo%6f'], + ['f%6f%6f/bar', 'foo', 'f%6f%6f'], + ['%66%6F%6F/bar', 'foo', '%66%6F%6F'], + ['fo+o/bar', 'fo+o', 'fo+o'], + ['fo%2Bo/bar', 'fo+o', 'fo%2Bo'], + ]; } private function disableHttpMethodParameterOverride() @@ -1684,7 +1785,7 @@ private function getRequestInstanceForClientIpTests($remoteAddr, $httpForwardedF { $request = new Request(); - $server = array('REMOTE_ADDR' => $remoteAddr); + $server = ['REMOTE_ADDR' => $remoteAddr]; if (null !== $httpForwardedFor) { $server['HTTP_X_FORWARDED_FOR'] = $httpForwardedFor; } @@ -1693,7 +1794,7 @@ private function getRequestInstanceForClientIpTests($remoteAddr, $httpForwardedF Request::setTrustedProxies($trustedProxies, Request::HEADER_X_FORWARDED_ALL); } - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); return $request; } @@ -1702,7 +1803,7 @@ private function getRequestInstanceForClientIpsForwardedTests($remoteAddr, $http { $request = new Request(); - $server = array('REMOTE_ADDR' => $remoteAddr); + $server = ['REMOTE_ADDR' => $remoteAddr]; if (null !== $httpForwarded) { $server['HTTP_FORWARDED'] = $httpForwarded; @@ -1712,7 +1813,7 @@ private function getRequestInstanceForClientIpsForwardedTests($remoteAddr, $http Request::setTrustedProxies($trustedProxies, Request::HEADER_FORWARDED); } - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); return $request; } @@ -1733,35 +1834,35 @@ public function testTrustedProxiesXForwardedFor() $this->assertFalse($request->isSecure()); // disabling proxy trusting - Request::setTrustedProxies(array(), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies([], Request::HEADER_X_FORWARDED_ALL); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // request is forwarded by a non-trusted proxy - Request::setTrustedProxies(array('2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['2.2.2.2'], Request::HEADER_X_FORWARDED_ALL); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_X_FORWARDED_ALL); $this->assertEquals('1.1.1.1', $request->getClientIp()); $this->assertEquals('foo.example.com', $request->getHost()); $this->assertEquals(443, $request->getPort()); $this->assertTrue($request->isSecure()); // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.4', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['3.3.3.4', '2.2.2.2'], Request::HEADER_X_FORWARDED_ALL); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // check various X_FORWARDED_PROTO header values - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_X_FORWARDED_ALL); $request->headers->set('X_FORWARDED_PROTO', 'ssl'); $this->assertTrue($request->isSecure()); @@ -1786,7 +1887,7 @@ public function testLegacyTrustedProxies() $request->headers->set('X_MY_PROTO', 'http'); $request->headers->set('X_MY_PORT', 81); - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_X_FORWARDED_ALL); // custom header names Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'X_MY_FOR'); @@ -1829,35 +1930,35 @@ public function testTrustedProxiesForwarded() $this->assertFalse($request->isSecure()); // disabling proxy trusting - Request::setTrustedProxies(array(), Request::HEADER_FORWARDED); + Request::setTrustedProxies([], Request::HEADER_FORWARDED); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // request is forwarded by a non-trusted proxy - Request::setTrustedProxies(array('2.2.2.2'), Request::HEADER_FORWARDED); + Request::setTrustedProxies(['2.2.2.2'], Request::HEADER_FORWARDED); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_FORWARDED); + Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_FORWARDED); $this->assertEquals('1.1.1.1', $request->getClientIp()); $this->assertEquals('foo.example.com', $request->getHost()); $this->assertEquals(8080, $request->getPort()); $this->assertTrue($request->isSecure()); // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.4', '2.2.2.2'), Request::HEADER_FORWARDED); + Request::setTrustedProxies(['3.3.3.4', '2.2.2.2'], Request::HEADER_FORWARDED); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // check various X_FORWARDED_PROTO header values - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_FORWARDED); + Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_FORWARDED); $request->headers->set('FORWARDED', 'proto=ssl'); $this->assertTrue($request->isSecure()); @@ -1897,37 +1998,37 @@ public function testIISRequestUri($headers, $server, $expectedRequestUri) $this->assertEquals($expectedRequestUri, $request->getRequestUri(), '->getRequestUri() is correct'); $subRequestUri = '/bar/foo'; - $subRequest = Request::create($subRequestUri, 'get', array(), array(), array(), $request->server->all()); + $subRequest = Request::create($subRequestUri, 'get', [], [], [], $request->server->all()); $this->assertEquals($subRequestUri, $subRequest->getRequestUri(), '->getRequestUri() is correct in sub request'); } public function iisRequestUriProvider() { - return array( - array( - array(), - array( + return [ + [ + [], + [ 'IIS_WasUrlRewritten' => '1', 'UNENCODED_URL' => '/foo/bar', - ), + ], '/foo/bar', - ), - array( - array(), - array( + ], + [ + [], + [ 'ORIG_PATH_INFO' => '/foo/bar', - ), + ], '/foo/bar', - ), - array( - array(), - array( + ], + [ + [], + [ 'ORIG_PATH_INFO' => '/foo/bar', 'QUERY_STRING' => 'foo=bar', - ), + ], '/foo/bar?foo=bar', - ), - ); + ], + ]; } public function testTrustedHosts() @@ -1940,7 +2041,7 @@ public function testTrustedHosts() $this->assertEquals('evil.com', $request->getHost()); // add a trusted domain and all its subdomains - Request::setTrustedHosts(array('^([a-z]{9}\.)?trusted\.com$')); + Request::setTrustedHosts(['^([a-z]{9}\.)?trusted\.com$']); // untrusted host $request->headers->set('host', 'evil.com'); @@ -1972,7 +2073,7 @@ public function testTrustedHosts() public function testSetTrustedHostsDoesNotBreakOnSpecialCharacters() { - Request::setTrustedHosts(array('localhost(\.local){0,1}#,example.com', 'localhost')); + Request::setTrustedHosts(['localhost(\.local){0,1}#,example.com', 'localhost']); $request = Request::create('/'); $request->headers->set('host', 'localhost'); @@ -1981,7 +2082,7 @@ public function testSetTrustedHostsDoesNotBreakOnSpecialCharacters() public function testFactory() { - Request::setFactory(function (array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) { + Request::setFactory(function (array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null) { return new NewRequest(); }); @@ -2030,23 +2131,23 @@ public function testHostValidity($host, $isValid, $expectedHost = null, $expecte public function getHostValidities() { - return array( - array('.a', false), - array('a..', false), - array('a.', true), - array("\xE9", false), - array('[::1]', true), - array('[::1]:80', true, '[::1]', 80), - array(str_repeat('.', 101), false), - ); + return [ + ['.a', false], + ['a..', false], + ['a.', true], + ["\xE9", false], + ['[::1]', true], + ['[::1]:80', true, '[::1]', 80], + [str_repeat('.', 101), false], + ]; } public function getLongHostNames() { - return array( - array('a'.str_repeat('.a', 40000)), - array(str_repeat(':', 101)), - ); + return [ + ['a'.str_repeat('.a', 40000)], + [str_repeat(':', 101)], + ]; } /** @@ -2061,18 +2162,18 @@ public function testMethodIdempotent($method, $idempotent) public function methodIdempotentProvider() { - return array( - array('HEAD', true), - array('GET', true), - array('POST', false), - array('PUT', true), - array('PATCH', false), - array('DELETE', true), - array('PURGE', true), - array('OPTIONS', true), - array('TRACE', true), - array('CONNECT', false), - ); + return [ + ['HEAD', true], + ['GET', true], + ['POST', false], + ['PUT', true], + ['PATCH', false], + ['DELETE', true], + ['PURGE', true], + ['OPTIONS', true], + ['TRACE', true], + ['CONNECT', false], + ]; } /** @@ -2087,18 +2188,18 @@ public function testMethodSafe($method, $safe) public function methodSafeProvider() { - return array( - array('HEAD', true), - array('GET', true), - array('POST', false), - array('PUT', false), - array('PATCH', false), - array('DELETE', false), - array('PURGE', false), - array('OPTIONS', true), - array('TRACE', true), - array('CONNECT', false), - ); + return [ + ['HEAD', true], + ['GET', true], + ['POST', false], + ['PUT', false], + ['PATCH', false], + ['DELETE', false], + ['PURGE', false], + ['OPTIONS', true], + ['TRACE', true], + ['CONNECT', false], + ]; } /** @@ -2124,18 +2225,18 @@ public function testMethodCacheable($method, $cacheable) public function methodCacheableProvider() { - return array( - array('HEAD', true), - array('GET', true), - array('POST', false), - array('PUT', false), - array('PATCH', false), - array('DELETE', false), - array('PURGE', false), - array('OPTIONS', false), - array('TRACE', false), - array('CONNECT', false), - ); + return [ + ['HEAD', true], + ['GET', true], + ['POST', false], + ['PUT', false], + ['PATCH', false], + ['DELETE', false], + ['PURGE', false], + ['OPTIONS', false], + ['TRACE', false], + ['CONNECT', false], + ]; } /** @@ -2143,7 +2244,7 @@ public function methodCacheableProvider() */ public function testGetTrustedHeaderName() { - Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['8.8.8.8'], Request::HEADER_X_FORWARDED_ALL); $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_FORWARDED)); $this->assertSame('X_FORWARDED_FOR', Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)); @@ -2151,7 +2252,7 @@ public function testGetTrustedHeaderName() $this->assertSame('X_FORWARDED_PORT', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT)); $this->assertSame('X_FORWARDED_PROTO', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO)); - Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_FORWARDED); + Request::setTrustedProxies(['8.8.8.8'], Request::HEADER_FORWARDED); $this->assertSame('FORWARDED', Request::getTrustedHeaderName(Request::HEADER_FORWARDED)); $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)); @@ -2165,7 +2266,7 @@ public function testGetTrustedHeaderName() Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'D'); Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'E'); - Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_FORWARDED); + Request::setTrustedProxies(['8.8.8.8'], Request::HEADER_FORWARDED); $this->assertSame('A', Request::getTrustedHeaderName(Request::HEADER_FORWARDED)); $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)); @@ -2173,7 +2274,7 @@ public function testGetTrustedHeaderName() $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT)); $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO)); - Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['8.8.8.8'], Request::HEADER_X_FORWARDED_ALL); $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_FORWARDED)); $this->assertSame('B', Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)); @@ -2181,7 +2282,7 @@ public function testGetTrustedHeaderName() $this->assertSame('D', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT)); $this->assertSame('E', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO)); - Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_FORWARDED); + Request::setTrustedProxies(['8.8.8.8'], Request::HEADER_FORWARDED); $this->assertSame('A', Request::getTrustedHeaderName(Request::HEADER_FORWARDED)); @@ -2199,7 +2300,7 @@ public function testGetTrustedHeaderName() public function testProtocolVersion($serverProtocol, $trustedProxy, $via, $expected) { if ($trustedProxy) { - Request::setTrustedProxies(array('1.1.1.1'), -1); + Request::setTrustedProxies(['1.1.1.1'], -1); } $request = new Request(); @@ -2212,41 +2313,41 @@ public function testProtocolVersion($serverProtocol, $trustedProxy, $via, $expec public function protocolVersionProvider() { - return array( - 'untrusted without via' => array('HTTP/2.0', false, '', 'HTTP/2.0'), - 'untrusted with via' => array('HTTP/2.0', false, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/2.0'), - 'trusted without via' => array('HTTP/2.0', true, '', 'HTTP/2.0'), - 'trusted with via' => array('HTTP/2.0', true, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'), - 'trusted with via and protocol name' => array('HTTP/2.0', true, 'HTTP/1.0 fred, HTTP/1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'), - 'trusted with broken via' => array('HTTP/2.0', true, 'HTTP/1^0 foo', 'HTTP/2.0'), - 'trusted with partially-broken via' => array('HTTP/2.0', true, '1.0 fred, foo', 'HTTP/1.0'), - ); + return [ + 'untrusted without via' => ['HTTP/2.0', false, '', 'HTTP/2.0'], + 'untrusted with via' => ['HTTP/2.0', false, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/2.0'], + 'trusted without via' => ['HTTP/2.0', true, '', 'HTTP/2.0'], + 'trusted with via' => ['HTTP/2.0', true, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'], + 'trusted with via and protocol name' => ['HTTP/2.0', true, 'HTTP/1.0 fred, HTTP/1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'], + 'trusted with broken via' => ['HTTP/2.0', true, 'HTTP/1^0 foo', 'HTTP/2.0'], + 'trusted with partially-broken via' => ['HTTP/2.0', true, '1.0 fred, foo', 'HTTP/1.0'], + ]; } public function nonstandardRequestsData() { - return array( - array('', '', '/', 'http://host:8080/', ''), - array('/', '', '/', 'http://host:8080/', ''), + return [ + ['', '', '/', 'http://host:8080/', ''], + ['/', '', '/', 'http://host:8080/', ''], - array('hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'), - array('/hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'), + ['hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'], + ['/hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'], - array('', 'a=b', '/', 'http://host:8080/?a=b'), - array('?a=b', 'a=b', '/', 'http://host:8080/?a=b'), - array('/?a=b', 'a=b', '/', 'http://host:8080/?a=b'), + ['', 'a=b', '/', 'http://host:8080/?a=b'], + ['?a=b', 'a=b', '/', 'http://host:8080/?a=b'], + ['/?a=b', 'a=b', '/', 'http://host:8080/?a=b'], - array('x', 'a=b', '/x', 'http://host:8080/x?a=b'), - array('x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'), - array('/x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'), + ['x', 'a=b', '/x', 'http://host:8080/x?a=b'], + ['x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'], + ['/x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'], - array('hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'), - array('/hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'), + ['hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'], + ['/hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'], - array('hello/app.php/x', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), - array('hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), - array('/hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), - ); + ['hello/app.php/x', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'], + ['hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'], + ['/hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'], + ]; } /** @@ -2258,16 +2359,16 @@ public function testNonstandardRequests($requestUri, $queryString, $expectedPath $expectedBaseUrl = $expectedBasePath; } - $server = array( + $server = [ 'HTTP_HOST' => 'host:8080', 'SERVER_PORT' => '8080', 'QUERY_STRING' => $queryString, 'PHP_SELF' => '/hello/app.php', 'SCRIPT_FILENAME' => '/some/path/app.php', 'REQUEST_URI' => $requestUri, - ); + ]; - $request = new Request(array(), array(), array(), array(), array(), $server); + $request = new Request([], [], [], [], [], $server); $this->assertEquals($expectedPathInfo, $request->getPathInfo()); $this->assertEquals($expectedUri, $request->getUri()); @@ -2277,13 +2378,62 @@ public function testNonstandardRequests($requestUri, $queryString, $expectedPath $this->assertEquals($expectedBaseUrl, $request->getBaseUrl()); $this->assertEquals($expectedBasePath, $request->getBasePath()); } + + public function testTrustedHost() + { + Request::setTrustedProxies(['1.1.1.1'], -1); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('Forwarded', 'host=localhost:8080'); + $request->headers->set('X-Forwarded-Host', 'localhost:8080'); + + $this->assertSame('localhost:8080', $request->getHttpHost()); + $this->assertSame(8080, $request->getPort()); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('Forwarded', 'host="[::1]:443"'); + $request->headers->set('X-Forwarded-Host', '[::1]:443'); + $request->headers->set('X-Forwarded-Port', 443); + + $this->assertSame('[::1]:443', $request->getHttpHost()); + $this->assertSame(443, $request->getPort()); + } + + public function testTrustedPort() + { + Request::setTrustedProxies(['1.1.1.1'], -1); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('Forwarded', 'host=localhost:8080'); + $request->headers->set('X-Forwarded-Port', 8080); + + $this->assertSame(8080, $request->getPort()); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('Forwarded', 'host=localhost'); + $request->headers->set('X-Forwarded-Port', 80); + + $this->assertSame(80, $request->getPort()); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('Forwarded', 'host="[::1]"'); + $request->headers->set('X-Forwarded-Proto', 'https'); + $request->headers->set('X-Forwarded-Port', 443); + + $this->assertSame(443, $request->getPort()); + } } class RequestContentProxy extends Request { public function getContent($asResource = false) { - return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent'), '', '&'); + return http_build_query(['_method' => 'PUT', 'content' => 'mycontent'], '', '&'); } } diff --git a/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php b/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php index 22f25e978e5a283c5e85601d7e4d4fa5bb7e4db4..3d3e696c75c3b23426702492f341d0ff1dd791b4 100644 --- a/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php +++ b/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php @@ -22,10 +22,10 @@ class ResponseFunctionalTest extends TestCase public static function setUpBeforeClass() { - $spec = array( - 1 => array('file', '/dev/null', 'w'), - 2 => array('file', '/dev/null', 'w'), - ); + $spec = [ + 1 => ['file', '/dev/null', 'w'], + 2 => ['file', '/dev/null', 'w'], + ]; if (!self::$server = @proc_open('exec php -S localhost:8054', $spec, $pipes, __DIR__.'/Fixtures/response-functional')) { self::markTestSkipped('PHP server unable to start.'); } @@ -52,7 +52,7 @@ public function testCookie($fixture) public function provideCookie() { foreach (glob(__DIR__.'/Fixtures/response-functional/*.php') as $file) { - yield array(pathinfo($file, PATHINFO_FILENAME)); + yield [pathinfo($file, PATHINFO_FILENAME)]; } } } diff --git a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php index 06e2d41d01bb02a81f60bf01b6e87bfef77ad976..93aacf24d799fb28c82de8a57eb44e5e106be830 100644 --- a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php +++ b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php @@ -22,7 +22,7 @@ class ResponseHeaderBagTest extends TestCase { public function testAllPreserveCase() { - $headers = array( + $headers = [ 'fOo' => 'BAR', 'ETag' => 'xyzzy', 'Content-MD5' => 'Q2hlY2sgSW50ZWdyaXR5IQ==', @@ -30,7 +30,7 @@ public function testAllPreserveCase() 'WWW-Authenticate' => 'Basic realm="WallyWorld"', 'X-UA-Compatible' => 'IE=edge,chrome=1', 'X-XSS-Protection' => '1; mode=block', - ); + ]; $bag = new ResponseHeaderBag($headers); $allPreservedCase = $bag->allPreserveCase(); @@ -42,45 +42,45 @@ public function testAllPreserveCase() public function testCacheControlHeader() { - $bag = new ResponseHeaderBag(array()); + $bag = new ResponseHeaderBag([]); $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('no-cache')); - $bag = new ResponseHeaderBag(array('Cache-Control' => 'public')); + $bag = new ResponseHeaderBag(['Cache-Control' => 'public']); $this->assertEquals('public', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('public')); - $bag = new ResponseHeaderBag(array('ETag' => 'abcde')); + $bag = new ResponseHeaderBag(['ETag' => 'abcde']); $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('private')); $this->assertTrue($bag->hasCacheControlDirective('must-revalidate')); $this->assertFalse($bag->hasCacheControlDirective('max-age')); - $bag = new ResponseHeaderBag(array('Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT')); + $bag = new ResponseHeaderBag(['Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT']); $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array( + $bag = new ResponseHeaderBag([ 'Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT', 'Cache-Control' => 'max-age=3600', - )); + ]); $this->assertEquals('max-age=3600, private', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('Last-Modified' => 'abcde')); + $bag = new ResponseHeaderBag(['Last-Modified' => 'abcde']); $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('Etag' => 'abcde', 'Last-Modified' => 'abcde')); + $bag = new ResponseHeaderBag(['Etag' => 'abcde', 'Last-Modified' => 'abcde']); $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('cache-control' => 'max-age=100')); + $bag = new ResponseHeaderBag(['cache-control' => 'max-age=100']); $this->assertEquals('max-age=100, private', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('cache-control' => 's-maxage=100')); + $bag = new ResponseHeaderBag(['cache-control' => 's-maxage=100']); $this->assertEquals('s-maxage=100', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('cache-control' => 'private, max-age=100')); + $bag = new ResponseHeaderBag(['cache-control' => 'private, max-age=100']); $this->assertEquals('max-age=100, private', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('cache-control' => 'public, max-age=100')); + $bag = new ResponseHeaderBag(['cache-control' => 'public, max-age=100']); $this->assertEquals('max-age=100, public', $bag->get('Cache-Control')); $bag = new ResponseHeaderBag(); @@ -88,7 +88,7 @@ public function testCacheControlHeader() $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); $bag = new ResponseHeaderBag(); - $bag->set('Cache-Control', array('public', 'must-revalidate')); + $bag->set('Cache-Control', ['public', 'must-revalidate']); $this->assertCount(1, $bag->get('Cache-Control', null, false)); $this->assertEquals('must-revalidate, public', $bag->get('Cache-Control')); @@ -101,7 +101,7 @@ public function testCacheControlHeader() public function testCacheControlClone() { - $headers = array('foo' => 'bar'); + $headers = ['foo' => 'bar']; $bag1 = new ResponseHeaderBag($headers); $bag2 = new ResponseHeaderBag($bag1->allPreserveCase()); $this->assertEquals($bag1->allPreserveCase(), $bag2->allPreserveCase()); @@ -109,7 +109,7 @@ public function testCacheControlClone() public function testToStringIncludesCookieHeaders() { - $bag = new ResponseHeaderBag(array()); + $bag = new ResponseHeaderBag([]); $bag->setCookie(new Cookie('foo', 'bar')); $this->assertSetCookieHeader('foo=bar; path=/; httponly', $bag); @@ -121,7 +121,7 @@ public function testToStringIncludesCookieHeaders() public function testClearCookieSecureNotHttpOnly() { - $bag = new ResponseHeaderBag(array()); + $bag = new ResponseHeaderBag([]); $bag->clearCookie('foo', '/', null, true, false); @@ -130,23 +130,23 @@ public function testClearCookieSecureNotHttpOnly() public function testReplace() { - $bag = new ResponseHeaderBag(array()); + $bag = new ResponseHeaderBag([]); $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('no-cache')); - $bag->replace(array('Cache-Control' => 'public')); + $bag->replace(['Cache-Control' => 'public']); $this->assertEquals('public', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('public')); } public function testReplaceWithRemove() { - $bag = new ResponseHeaderBag(array()); + $bag = new ResponseHeaderBag([]); $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('no-cache')); $bag->remove('Cache-Control'); - $bag->replace(array()); + $bag->replace([]); $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('no-cache')); } @@ -161,12 +161,12 @@ public function testCookiesWithSameNames() $this->assertCount(4, $bag->getCookies()); $this->assertEquals('foo=bar; path=/path/foo; domain=foo.bar; httponly', $bag->get('set-cookie')); - $this->assertEquals(array( + $this->assertEquals([ 'foo=bar; path=/path/foo; domain=foo.bar; httponly', 'foo=bar; path=/path/bar; domain=foo.bar; httponly', 'foo=bar; path=/path/bar; domain=bar.foo; httponly', 'foo=bar; path=/; httponly', - ), $bag->get('set-cookie', null, false)); + ], $bag->get('set-cookie', null, false)); $this->assertSetCookieHeader('foo=bar; path=/path/foo; domain=foo.bar; httponly', $bag); $this->assertSetCookieHeader('foo=bar; path=/path/bar; domain=foo.bar; httponly', $bag); @@ -228,16 +228,16 @@ public function testSetCookieHeader() { $bag = new ResponseHeaderBag(); $bag->set('set-cookie', 'foo=bar'); - $this->assertEquals(array(new Cookie('foo', 'bar', 0, '/', null, false, false, true)), $bag->getCookies()); + $this->assertEquals([new Cookie('foo', 'bar', 0, '/', null, false, false, true)], $bag->getCookies()); $bag->set('set-cookie', 'foo2=bar2', false); - $this->assertEquals(array( + $this->assertEquals([ new Cookie('foo', 'bar', 0, '/', null, false, false, true), new Cookie('foo2', 'bar2', 0, '/', null, false, false, true), - ), $bag->getCookies()); + ], $bag->getCookies()); $bag->remove('set-cookie'); - $this->assertEquals(array(), $bag->getCookies()); + $this->assertEquals([], $bag->getCookies()); } /** @@ -280,20 +280,20 @@ public function testToStringDoesntMessUpHeaders() (string) $headers; $allHeaders = $headers->allPreserveCase(); - $this->assertEquals(array('http://www.symfony.com'), $allHeaders['Location']); - $this->assertEquals(array('text/html'), $allHeaders['Content-type']); + $this->assertEquals(['http://www.symfony.com'], $allHeaders['Location']); + $this->assertEquals(['text/html'], $allHeaders['Content-type']); } public function provideMakeDisposition() { - return array( - array('attachment', 'foo.html', 'foo.html', 'attachment; filename="foo.html"'), - array('attachment', 'foo.html', '', 'attachment; filename="foo.html"'), - array('attachment', 'foo bar.html', '', 'attachment; filename="foo bar.html"'), - array('attachment', 'foo "bar".html', '', 'attachment; filename="foo \\"bar\\".html"'), - array('attachment', 'foo%20bar.html', 'foo bar.html', 'attachment; filename="foo bar.html"; filename*=utf-8\'\'foo%2520bar.html'), - array('attachment', 'föö.html', 'foo.html', 'attachment; filename="foo.html"; filename*=utf-8\'\'f%C3%B6%C3%B6.html'), - ); + return [ + ['attachment', 'foo.html', 'foo.html', 'attachment; filename="foo.html"'], + ['attachment', 'foo.html', '', 'attachment; filename="foo.html"'], + ['attachment', 'foo bar.html', '', 'attachment; filename="foo bar.html"'], + ['attachment', 'foo "bar".html', '', 'attachment; filename="foo \\"bar\\".html"'], + ['attachment', 'foo%20bar.html', 'foo bar.html', 'attachment; filename="foo bar.html"; filename*=utf-8\'\'foo%2520bar.html'], + ['attachment', 'föö.html', 'foo.html', 'attachment; filename="foo.html"; filename*=utf-8\'\'f%C3%B6%C3%B6.html'], + ]; } /** @@ -309,14 +309,14 @@ public function testMakeDispositionFail($disposition, $filename) public function provideMakeDispositionFail() { - return array( - array('attachment', 'foo%20bar.html'), - array('attachment', 'foo/bar.html'), - array('attachment', '/foo.html'), - array('attachment', 'foo\bar.html'), - array('attachment', '\foo.html'), - array('attachment', 'föö.html'), - ); + return [ + ['attachment', 'foo%20bar.html'], + ['attachment', 'foo/bar.html'], + ['attachment', '/foo.html'], + ['attachment', 'foo\bar.html'], + ['attachment', '\foo.html'], + ['attachment', 'föö.html'], + ]; } public function testDateHeaderAddedOnCreation() @@ -332,7 +332,7 @@ public function testDateHeaderAddedOnCreation() public function testDateHeaderCanBeSetOnCreation() { $someDate = 'Thu, 23 Mar 2017 09:15:12 GMT'; - $bag = new ResponseHeaderBag(array('Date' => $someDate)); + $bag = new ResponseHeaderBag(['Date' => $someDate]); $this->assertEquals($someDate, $bag->get('Date')); } @@ -340,7 +340,7 @@ public function testDateHeaderCanBeSetOnCreation() public function testDateHeaderWillBeRecreatedWhenRemoved() { $someDate = 'Thu, 23 Mar 2017 09:15:12 GMT'; - $bag = new ResponseHeaderBag(array('Date' => $someDate)); + $bag = new ResponseHeaderBag(['Date' => $someDate]); $bag->remove('Date'); // a (new) Date header is still present @@ -351,7 +351,7 @@ public function testDateHeaderWillBeRecreatedWhenRemoved() public function testDateHeaderWillBeRecreatedWhenHeadersAreReplaced() { $bag = new ResponseHeaderBag(); - $bag->replace(array()); + $bag->replace([]); $this->assertTrue($bag->has('Date')); } diff --git a/vendor/symfony/http-foundation/Tests/ResponseTest.php b/vendor/symfony/http-foundation/Tests/ResponseTest.php index 9444d54c37831fdac285886fbafd7e87f289787d..68634f6d4b104697d6ff29fc1778bb6d57e2515c 100644 --- a/vendor/symfony/http-foundation/Tests/ResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/ResponseTest.php @@ -21,7 +21,7 @@ class ResponseTest extends ResponseTestCase { public function testCreate() { - $response = Response::create('foo', 301, array('Foo' => 'bar')); + $response = Response::create('foo', 301, ['Foo' => 'bar']); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); $this->assertEquals(301, $response->getStatusCode()); @@ -253,10 +253,10 @@ public function testIsNotModifiedIfModifiedSinceAndEtagWithoutLastModified() public function testIsValidateable() { - $response = new Response('', 200, array('Last-Modified' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822))); + $response = new Response('', 200, ['Last-Modified' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)]); $this->assertTrue($response->isValidateable(), '->isValidateable() returns true if Last-Modified is present'); - $response = new Response('', 200, array('ETag' => '"12345"')); + $response = new Response('', 200, ['ETag' => '"12345"']); $this->assertTrue($response->isValidateable(), '->isValidateable() returns true if ETag is present'); $response = new Response(); @@ -266,7 +266,7 @@ public function testIsValidateable() public function testGetDate() { $oneHourAgo = $this->createDateTimeOneHourAgo(); - $response = new Response('', 200, array('Date' => $oneHourAgo->format(DATE_RFC2822))); + $response = new Response('', 200, ['Date' => $oneHourAgo->format(DATE_RFC2822)]); $date = $response->getDate(); $this->assertEquals($oneHourAgo->getTimestamp(), $date->getTimestamp(), '->getDate() returns the Date header if present'); @@ -274,7 +274,7 @@ public function testGetDate() $date = $response->getDate(); $this->assertEquals(time(), $date->getTimestamp(), '->getDate() returns the current Date if no Date header present'); - $response = new Response('', 200, array('Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822))); + $response = new Response('', 200, ['Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)]); $now = $this->createDateTimeNow(); $response->headers->set('Date', $now->format(DATE_RFC2822)); $date = $response->getDate(); @@ -362,6 +362,11 @@ public function testExpire() $response->headers->set('Expires', -1); $response->expire(); $this->assertNull($response->headers->get('Age'), '->expire() does not set the Age when the response is expired'); + + $response = new Response(); + $response->headers->set('Expires', date(DATE_RFC2822, time() + 600)); + $response->expire(); + $this->assertNull($response->headers->get('Expires'), '->expire() removes the Expires header when the response is fresh'); } public function testGetTtl() @@ -409,21 +414,21 @@ public function testGetSetProtocolVersion() public function testGetVary() { $response = new Response(); - $this->assertEquals(array(), $response->getVary(), '->getVary() returns an empty array if no Vary header is present'); + $this->assertEquals([], $response->getVary(), '->getVary() returns an empty array if no Vary header is present'); $response = new Response(); $response->headers->set('Vary', 'Accept-Language'); - $this->assertEquals(array('Accept-Language'), $response->getVary(), '->getVary() parses a single header name value'); + $this->assertEquals(['Accept-Language'], $response->getVary(), '->getVary() parses a single header name value'); $response = new Response(); $response->headers->set('Vary', 'Accept-Language User-Agent X-Foo'); - $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by spaces'); + $this->assertEquals(['Accept-Language', 'User-Agent', 'X-Foo'], $response->getVary(), '->getVary() parses multiple header name values separated by spaces'); $response = new Response(); $response->headers->set('Vary', 'Accept-Language,User-Agent, X-Foo'); - $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by commas'); + $this->assertEquals(['Accept-Language', 'User-Agent', 'X-Foo'], $response->getVary(), '->getVary() parses multiple header name values separated by commas'); - $vary = array('Accept-Language', 'User-Agent', 'X-foo'); + $vary = ['Accept-Language', 'User-Agent', 'X-foo']; $response = new Response(); $response->headers->set('Vary', $vary); @@ -438,18 +443,18 @@ public function testSetVary() { $response = new Response(); $response->setVary('Accept-Language'); - $this->assertEquals(array('Accept-Language'), $response->getVary()); + $this->assertEquals(['Accept-Language'], $response->getVary()); $response->setVary('Accept-Language, User-Agent'); - $this->assertEquals(array('Accept-Language', 'User-Agent'), $response->getVary(), '->setVary() replace the vary header by default'); + $this->assertEquals(['Accept-Language', 'User-Agent'], $response->getVary(), '->setVary() replace the vary header by default'); $response->setVary('X-Foo', false); - $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->setVary() doesn\'t wipe out earlier Vary headers if replace is set to false'); + $this->assertEquals(['Accept-Language', 'User-Agent', 'X-Foo'], $response->getVary(), '->setVary() doesn\'t wipe out earlier Vary headers if replace is set to false'); } public function testDefaultContentType() { - $headerMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\ResponseHeaderBag')->setMethods(array('set'))->getMock(); + $headerMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\ResponseHeaderBag')->setMethods(['set'])->getMock(); $headerMock->expects($this->at(0)) ->method('set') ->with('Content-Type', 'text/html'); @@ -571,55 +576,55 @@ public function testPrepareSetsPragmaOnHttp10Only() public function testSetCache() { $response = new Response(); - //array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public') + // ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public'] try { - $response->setCache(array('wrong option' => 'value')); + $response->setCache(['wrong option' => 'value']); $this->fail('->setCache() throws an InvalidArgumentException if an option is not supported'); } catch (\Exception $e) { $this->assertInstanceOf('InvalidArgumentException', $e, '->setCache() throws an InvalidArgumentException if an option is not supported'); $this->assertContains('"wrong option"', $e->getMessage()); } - $options = array('etag' => '"whatever"'); + $options = ['etag' => '"whatever"']; $response->setCache($options); $this->assertEquals($response->getEtag(), '"whatever"'); $now = $this->createDateTimeNow(); - $options = array('last_modified' => $now); + $options = ['last_modified' => $now]; $response->setCache($options); $this->assertEquals($response->getLastModified()->getTimestamp(), $now->getTimestamp()); - $options = array('max_age' => 100); + $options = ['max_age' => 100]; $response->setCache($options); $this->assertEquals($response->getMaxAge(), 100); - $options = array('s_maxage' => 200); + $options = ['s_maxage' => 200]; $response->setCache($options); $this->assertEquals($response->getMaxAge(), 200); $this->assertTrue($response->headers->hasCacheControlDirective('public')); $this->assertFalse($response->headers->hasCacheControlDirective('private')); - $response->setCache(array('public' => true)); + $response->setCache(['public' => true]); $this->assertTrue($response->headers->hasCacheControlDirective('public')); $this->assertFalse($response->headers->hasCacheControlDirective('private')); - $response->setCache(array('public' => false)); + $response->setCache(['public' => false]); $this->assertFalse($response->headers->hasCacheControlDirective('public')); $this->assertTrue($response->headers->hasCacheControlDirective('private')); - $response->setCache(array('private' => true)); + $response->setCache(['private' => true]); $this->assertFalse($response->headers->hasCacheControlDirective('public')); $this->assertTrue($response->headers->hasCacheControlDirective('private')); - $response->setCache(array('private' => false)); + $response->setCache(['private' => false]); $this->assertTrue($response->headers->hasCacheControlDirective('public')); $this->assertFalse($response->headers->hasCacheControlDirective('private')); - $response->setCache(array('immutable' => true)); + $response->setCache(['immutable' => true]); $this->assertTrue($response->headers->hasCacheControlDirective('immutable')); - $response->setCache(array('immutable' => false)); + $response->setCache(['immutable' => false]); $this->assertFalse($response->headers->hasCacheControlDirective('immutable')); } @@ -720,14 +725,14 @@ public function testSetStatusCode($code, $text, $expectedText) public function getStatusCodeFixtures() { - return array( - array('200', null, 'OK'), - array('200', false, ''), - array('200', 'foo', 'foo'), - array('199', null, 'unknown status'), - array('199', false, ''), - array('199', 'foo', 'foo'), - ); + return [ + ['200', null, 'OK'], + ['200', false, ''], + ['200', 'foo', 'foo'], + ['199', null, 'unknown status'], + ['199', false, ''], + ['199', 'foo', 'foo'], + ]; } public function testIsInformational() @@ -741,7 +746,7 @@ public function testIsInformational() public function testIsRedirectRedirection() { - foreach (array(301, 302, 303, 307) as $code) { + foreach ([301, 302, 303, 307] as $code) { $response = new Response('', $code); $this->assertTrue($response->isRedirection()); $this->assertTrue($response->isRedirect()); @@ -759,7 +764,7 @@ public function testIsRedirectRedirection() $this->assertFalse($response->isRedirection()); $this->assertFalse($response->isRedirect()); - $response = new Response('', 301, array('Location' => '/good-uri')); + $response = new Response('', 301, ['Location' => '/good-uri']); $this->assertFalse($response->isRedirect('/bad-uri')); $this->assertTrue($response->isRedirect('/good-uri')); } @@ -775,7 +780,7 @@ public function testIsNotFound() public function testIsEmpty() { - foreach (array(204, 304) as $code) { + foreach ([204, 304] as $code) { $response = new Response('', $code); $this->assertTrue($response->isEmpty()); } @@ -824,7 +829,7 @@ public function testHasVary() public function testSetEtag() { - $response = new Response('', 200, array('ETag' => '"12345"')); + $response = new Response('', 200, ['ETag' => '"12345"']); $response->setEtag(); $this->assertNull($response->headers->get('Etag'), '->setEtag() removes Etags when call with null'); @@ -854,7 +859,7 @@ public function testSettersAreChainable() { $response = new Response(); - $setters = array( + $setters = [ 'setProtocolVersion' => '1.0', 'setCharset' => 'UTF-8', 'setPublic' => null, @@ -865,7 +870,7 @@ public function testSettersAreChainable() 'setSharedMaxAge' => 1, 'setTtl' => 1, 'setClientTtl' => 1, - ); + ]; foreach ($setters as $setter => $arg) { $this->assertEquals($response, $response->{$setter}($arg)); @@ -884,20 +889,20 @@ public function testNoDeprecationsAreTriggered() public function validContentProvider() { - return array( - 'obj' => array(new StringableObject()), - 'string' => array('Foo'), - 'int' => array(2), - ); + return [ + 'obj' => [new StringableObject()], + 'string' => ['Foo'], + 'int' => [2], + ]; } public function invalidContentProvider() { - return array( - 'obj' => array(new \stdClass()), - 'array' => array(array()), - 'bool' => array(true, '1'), - ); + return [ + 'obj' => [new \stdClass()], + 'array' => [[]], + 'bool' => [true, '1'], + ]; } protected function createDateTimeOneHourAgo() @@ -937,19 +942,19 @@ public function ianaCodesReasonPhrasesProvider() $ianaHttpStatusCodes = new \DOMDocument(); - libxml_set_streams_context(stream_context_create(array( - 'http' => array( + libxml_set_streams_context(stream_context_create([ + 'http' => [ 'method' => 'GET', 'timeout' => 30, - ), - ))); + ], + ])); $ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml'); if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) { self::fail('Invalid IANA\'s HTTP status code list.'); } - $ianaCodesReasonPhrases = array(); + $ianaCodesReasonPhrases = []; $xpath = new \DOMXPath($ianaHttpStatusCodes); $xpath->registerNamespace('ns', 'http://www.iana.org/assignments'); @@ -959,16 +964,16 @@ public function ianaCodesReasonPhrasesProvider() $value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue; $description = $xpath->query('.//ns:description', $record)->item(0)->nodeValue; - if (\in_array($description, array('Unassigned', '(Unused)'), true)) { + if (\in_array($description, ['Unassigned', '(Unused)'], true)) { continue; } if (preg_match('/^([0-9]+)\s*\-\s*([0-9]+)$/', $value, $matches)) { for ($value = $matches[1]; $value <= $matches[2]; ++$value) { - $ianaCodesReasonPhrases[] = array($value, $description); + $ianaCodesReasonPhrases[] = [$value, $description]; } } else { - $ianaCodesReasonPhrases[] = array($value, $description); + $ianaCodesReasonPhrases[] = [$value, $description]; } } diff --git a/vendor/symfony/http-foundation/Tests/ServerBagTest.php b/vendor/symfony/http-foundation/Tests/ServerBagTest.php index f8becec5a982df0ffc049c1f409e334b7e260cc2..0663b118e675e9996646e1417be0dd69254a1932 100644 --- a/vendor/symfony/http-foundation/Tests/ServerBagTest.php +++ b/vendor/symfony/http-foundation/Tests/ServerBagTest.php @@ -23,7 +23,7 @@ class ServerBagTest extends TestCase { public function testShouldExtractHeadersFromServerArray() { - $server = array( + $server = [ 'SOME_SERVER_VARIABLE' => 'value', 'SOME_SERVER_VARIABLE2' => 'value', 'ROOT' => 'value', @@ -32,45 +32,45 @@ public function testShouldExtractHeadersFromServerArray() 'HTTP_ETAG' => 'asdf', 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => 'bar', - ); + ]; $bag = new ServerBag($server); - $this->assertEquals(array( + $this->assertEquals([ 'CONTENT_TYPE' => 'text/html', 'CONTENT_LENGTH' => '0', 'ETAG' => 'asdf', 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'), 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => 'bar', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpPasswordIsOptional() { - $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo')); + $bag = new ServerBag(['PHP_AUTH_USER' => 'foo']); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => 'Basic '.base64_encode('foo:'), 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => '', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpBasicAuthWithPhpCgi() { - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'))); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:bar')]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'), 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => 'bar', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpBasicAuthWithPhpCgiBogus() { - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic_'.base64_encode('foo:bar'))); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => 'Basic_'.base64_encode('foo:bar')]); // Username and passwords should not be set as the header is bogus $headers = $bag->getHeaders(); @@ -80,41 +80,41 @@ public function testHttpBasicAuthWithPhpCgiBogus() public function testHttpBasicAuthWithPhpCgiRedirect() { - $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word'))); + $bag = new ServerBag(['REDIRECT_HTTP_AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word')]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word'), 'PHP_AUTH_USER' => 'username', 'PHP_AUTH_PW' => 'pass:word', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpBasicAuthWithPhpCgiEmptyPassword() { - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:'))); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:')]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => 'Basic '.base64_encode('foo:'), 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => '', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpDigestAuthWithPhpCgi() { $digest = 'Digest username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"'; - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $digest)); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => $digest]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => $digest, 'PHP_AUTH_DIGEST' => $digest, - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpDigestAuthWithPhpCgiBogus() { $digest = 'Digest_username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"'; - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $digest)); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => $digest]); // Username and passwords should not be set as the header is bogus $headers = $bag->getHeaders(); @@ -125,32 +125,32 @@ public function testHttpDigestAuthWithPhpCgiBogus() public function testHttpDigestAuthWithPhpCgiRedirect() { $digest = 'Digest username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"'; - $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => $digest)); + $bag = new ServerBag(['REDIRECT_HTTP_AUTHORIZATION' => $digest]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => $digest, 'PHP_AUTH_DIGEST' => $digest, - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testOAuthBearerAuth() { $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo'; - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $headerContent)); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => $headerContent]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => $headerContent, - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testOAuthBearerAuthWithRedirect() { $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo'; - $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => $headerContent)); + $bag = new ServerBag(['REDIRECT_HTTP_AUTHORIZATION' => $headerContent]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => $headerContent, - ), $bag->getHeaders()); + ], $bag->getHeaders()); } /** @@ -159,12 +159,12 @@ public function testOAuthBearerAuthWithRedirect() public function testItDoesNotOverwriteTheAuthorizationHeaderIfItIsAlreadySet() { $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo'; - $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo', 'HTTP_AUTHORIZATION' => $headerContent)); + $bag = new ServerBag(['PHP_AUTH_USER' => 'foo', 'HTTP_AUTHORIZATION' => $headerContent]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => $headerContent, 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => '', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php index 43644e23eab28d45224f4c21bfe10da3ced0c2d5..3f2f7b3c8f341f00e1fe9fc0dcedef7c3bc76f94 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php @@ -21,7 +21,7 @@ */ class AttributeBagTest extends TestCase { - private $array = array(); + private $array = []; /** * @var AttributeBag @@ -30,21 +30,21 @@ class AttributeBagTest extends TestCase protected function setUp() { - $this->array = array( + $this->array = [ 'hello' => 'world', 'always' => 'be happy', 'user.login' => 'drak', - 'csrf.token' => array( + 'csrf.token' => [ 'a' => '1234', 'b' => '4321', - ), - 'category' => array( - 'fishing' => array( + ], + 'category' => [ + 'fishing' => [ 'first' => 'cod', 'second' => 'sole', - ), - ), - ); + ], + ], + ]; $this->bag = new AttributeBag('_sf2'); $this->bag->initialize($this->array); } @@ -52,7 +52,7 @@ protected function setUp() protected function tearDown() { $this->bag = null; - $this->array = array(); + $this->array = []; } public function testInitialize() @@ -60,7 +60,7 @@ public function testInitialize() $bag = new AttributeBag(); $bag->initialize($this->array); $this->assertEquals($this->array, $bag->all()); - $array = array('should' => 'change'); + $array = ['should' => 'change']; $bag->initialize($array); $this->assertEquals($array, $bag->all()); } @@ -122,7 +122,7 @@ public function testAll() public function testReplace() { - $array = array(); + $array = []; $array['name'] = 'jack'; $array['foo.bar'] = 'beep'; $this->bag->replace($array); @@ -150,22 +150,22 @@ public function testRemove() public function testClear() { $this->bag->clear(); - $this->assertEquals(array(), $this->bag->all()); + $this->assertEquals([], $this->bag->all()); } public function attributesProvider() { - return array( - array('hello', 'world', true), - array('always', 'be happy', true), - array('user.login', 'drak', true), - array('csrf.token', array('a' => '1234', 'b' => '4321'), true), - array('category', array('fishing' => array('first' => 'cod', 'second' => 'sole')), true), - array('user2.login', null, false), - array('never', null, false), - array('bye', null, false), - array('bye/for/now', null, false), - ); + return [ + ['hello', 'world', true], + ['always', 'be happy', true], + ['user.login', 'drak', true], + ['csrf.token', ['a' => '1234', 'b' => '4321'], true], + ['category', ['fishing' => ['first' => 'cod', 'second' => 'sole']], true], + ['user2.login', null, false], + ['never', null, false], + ['bye', null, false], + ['bye/for/now', null, false], + ]; } public function testGetIterator() diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php index ec4cd5ad1a146e4907cc87722fcf217d18eee946..6b4bb17d696f2df0fe67dc5ee8a24129fec808ff 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php @@ -21,7 +21,7 @@ */ class NamespacedAttributeBagTest extends TestCase { - private $array = array(); + private $array = []; /** * @var NamespacedAttributeBag @@ -30,21 +30,21 @@ class NamespacedAttributeBagTest extends TestCase protected function setUp() { - $this->array = array( + $this->array = [ 'hello' => 'world', 'always' => 'be happy', 'user.login' => 'drak', - 'csrf.token' => array( + 'csrf.token' => [ 'a' => '1234', 'b' => '4321', - ), - 'category' => array( - 'fishing' => array( + ], + 'category' => [ + 'fishing' => [ 'first' => 'cod', 'second' => 'sole', - ), - ), - ); + ], + ], + ]; $this->bag = new NamespacedAttributeBag('_sf2', '/'); $this->bag->initialize($this->array); } @@ -52,7 +52,7 @@ protected function setUp() protected function tearDown() { $this->bag = null; - $this->array = array(); + $this->array = []; } public function testInitialize() @@ -60,7 +60,7 @@ public function testInitialize() $bag = new NamespacedAttributeBag(); $bag->initialize($this->array); $this->assertEquals($this->array, $this->bag->all()); - $array = array('should' => 'not stick'); + $array = ['should' => 'not stick']; $bag->initialize($array); // should have remained the same @@ -139,7 +139,7 @@ public function testAll() public function testReplace() { - $array = array(); + $array = []; $array['name'] = 'jack'; $array['foo.bar'] = 'beep'; $this->bag->replace($array); @@ -177,28 +177,28 @@ public function testRemoveNonexistingNamespacedAttribute() public function testClear() { $this->bag->clear(); - $this->assertEquals(array(), $this->bag->all()); + $this->assertEquals([], $this->bag->all()); } public function attributesProvider() { - return array( - array('hello', 'world', true), - array('always', 'be happy', true), - array('user.login', 'drak', true), - array('csrf.token', array('a' => '1234', 'b' => '4321'), true), - array('csrf.token/a', '1234', true), - array('csrf.token/b', '4321', true), - array('category', array('fishing' => array('first' => 'cod', 'second' => 'sole')), true), - array('category/fishing', array('first' => 'cod', 'second' => 'sole'), true), - array('category/fishing/missing/first', null, false), - array('category/fishing/first', 'cod', true), - array('category/fishing/second', 'sole', true), - array('category/fishing/missing/second', null, false), - array('user2.login', null, false), - array('never', null, false), - array('bye', null, false), - array('bye/for/now', null, false), - ); + return [ + ['hello', 'world', true], + ['always', 'be happy', true], + ['user.login', 'drak', true], + ['csrf.token', ['a' => '1234', 'b' => '4321'], true], + ['csrf.token/a', '1234', true], + ['csrf.token/b', '4321', true], + ['category', ['fishing' => ['first' => 'cod', 'second' => 'sole']], true], + ['category/fishing', ['first' => 'cod', 'second' => 'sole'], true], + ['category/fishing/missing/first', null, false], + ['category/fishing/first', 'cod', true], + ['category/fishing/second', 'sole', true], + ['category/fishing/missing/second', null, false], + ['user2.login', null, false], + ['never', null, false], + ['bye', null, false], + ['bye/for/now', null, false], + ]; } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php index fa8626ab923b7b365a3ee4df035a29bfc962c829..b4e2c3a5ad30aa7bcc50b7abfb506b1d0f864691 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php @@ -26,13 +26,13 @@ class AutoExpireFlashBagTest extends TestCase */ private $bag; - protected $array = array(); + protected $array = []; protected function setUp() { parent::setUp(); $this->bag = new FlashBag(); - $this->array = array('new' => array('notice' => array('A previous flash message'))); + $this->array = ['new' => ['notice' => ['A previous flash message']]]; $this->bag->initialize($this->array); } @@ -45,16 +45,16 @@ protected function tearDown() public function testInitialize() { $bag = new FlashBag(); - $array = array('new' => array('notice' => array('A previous flash message'))); + $array = ['new' => ['notice' => ['A previous flash message']]]; $bag->initialize($array); - $this->assertEquals(array('A previous flash message'), $bag->peek('notice')); - $array = array('new' => array( - 'notice' => array('Something else'), - 'error' => array('a'), - )); + $this->assertEquals(['A previous flash message'], $bag->peek('notice')); + $array = ['new' => [ + 'notice' => ['Something else'], + 'error' => ['a'], + ]]; $bag->initialize($array); - $this->assertEquals(array('Something else'), $bag->peek('notice')); - $this->assertEquals(array('a'), $bag->peek('error')); + $this->assertEquals(['Something else'], $bag->peek('notice')); + $this->assertEquals(['a'], $bag->peek('error')); } public function testGetStorageKey() @@ -73,16 +73,16 @@ public function testGetSetName() public function testPeek() { - $this->assertEquals(array(), $this->bag->peek('non_existing')); - $this->assertEquals(array('default'), $this->bag->peek('non_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); + $this->assertEquals([], $this->bag->peek('non_existing')); + $this->assertEquals(['default'], $this->bag->peek('non_existing', ['default'])); + $this->assertEquals(['A previous flash message'], $this->bag->peek('notice')); + $this->assertEquals(['A previous flash message'], $this->bag->peek('notice')); } public function testSet() { $this->bag->set('notice', 'Foo'); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); + $this->assertEquals(['A previous flash message'], $this->bag->peek('notice')); } public function testHas() @@ -93,43 +93,43 @@ public function testHas() public function testKeys() { - $this->assertEquals(array('notice'), $this->bag->keys()); + $this->assertEquals(['notice'], $this->bag->keys()); } public function testPeekAll() { - $array = array( - 'new' => array( + $array = [ + 'new' => [ 'notice' => 'Foo', 'error' => 'Bar', - ), - ); + ], + ]; $this->bag->initialize($array); - $this->assertEquals(array( + $this->assertEquals([ 'notice' => 'Foo', 'error' => 'Bar', - ), $this->bag->peekAll() + ], $this->bag->peekAll() ); - $this->assertEquals(array( + $this->assertEquals([ 'notice' => 'Foo', 'error' => 'Bar', - ), $this->bag->peekAll() + ], $this->bag->peekAll() ); } public function testGet() { - $this->assertEquals(array(), $this->bag->get('non_existing')); - $this->assertEquals(array('default'), $this->bag->get('non_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->get('notice')); - $this->assertEquals(array(), $this->bag->get('notice')); + $this->assertEquals([], $this->bag->get('non_existing')); + $this->assertEquals(['default'], $this->bag->get('non_existing', ['default'])); + $this->assertEquals(['A previous flash message'], $this->bag->get('notice')); + $this->assertEquals([], $this->bag->get('notice')); } public function testSetAll() { - $this->bag->setAll(array('a' => 'first', 'b' => 'second')); + $this->bag->setAll(['a' => 'first', 'b' => 'second']); $this->assertFalse($this->bag->has('a')); $this->assertFalse($this->bag->has('b')); } @@ -138,17 +138,17 @@ public function testAll() { $this->bag->set('notice', 'Foo'); $this->bag->set('error', 'Bar'); - $this->assertEquals(array( - 'notice' => array('A previous flash message'), - ), $this->bag->all() + $this->assertEquals([ + 'notice' => ['A previous flash message'], + ], $this->bag->all() ); - $this->assertEquals(array(), $this->bag->all()); + $this->assertEquals([], $this->bag->all()); } public function testClear() { - $this->assertEquals(array('notice' => array('A previous flash message')), $this->bag->clear()); + $this->assertEquals(['notice' => ['A previous flash message']], $this->bag->clear()); } public function testDoNotRemoveTheNewFlashesWhenDisplayingTheExistingOnes() @@ -156,6 +156,6 @@ public function testDoNotRemoveTheNewFlashesWhenDisplayingTheExistingOnes() $this->bag->add('success', 'Something'); $this->bag->all(); - $this->assertEquals(array('new' => array('success' => array('Something')), 'display' => array()), $this->array); + $this->assertEquals(['new' => ['success' => ['Something']], 'display' => []], $this->array); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php index 905a1f7517306113bba8fd327132269356e61346..6d8619e078a12005641e7610ebbbd4a4e50e77f1 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php @@ -26,13 +26,13 @@ class FlashBagTest extends TestCase */ private $bag; - protected $array = array(); + protected $array = []; protected function setUp() { parent::setUp(); $this->bag = new FlashBag(); - $this->array = array('notice' => array('A previous flash message')); + $this->array = ['notice' => ['A previous flash message']]; $this->bag->initialize($this->array); } @@ -47,7 +47,7 @@ public function testInitialize() $bag = new FlashBag(); $bag->initialize($this->array); $this->assertEquals($this->array, $bag->peekAll()); - $array = array('should' => array('change')); + $array = ['should' => ['change']]; $bag->initialize($array); $this->assertEquals($array, $bag->peekAll()); } @@ -68,49 +68,49 @@ public function testGetSetName() public function testPeek() { - $this->assertEquals(array(), $this->bag->peek('non_existing')); - $this->assertEquals(array('default'), $this->bag->peek('not_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); + $this->assertEquals([], $this->bag->peek('non_existing')); + $this->assertEquals(['default'], $this->bag->peek('not_existing', ['default'])); + $this->assertEquals(['A previous flash message'], $this->bag->peek('notice')); + $this->assertEquals(['A previous flash message'], $this->bag->peek('notice')); } public function testAdd() { - $tab = array('bar' => 'baz'); + $tab = ['bar' => 'baz']; $this->bag->add('string_message', 'lorem'); $this->bag->add('object_message', new \stdClass()); $this->bag->add('array_message', $tab); - $this->assertEquals(array('lorem'), $this->bag->get('string_message')); - $this->assertEquals(array(new \stdClass()), $this->bag->get('object_message')); - $this->assertEquals(array($tab), $this->bag->get('array_message')); + $this->assertEquals(['lorem'], $this->bag->get('string_message')); + $this->assertEquals([new \stdClass()], $this->bag->get('object_message')); + $this->assertEquals([$tab], $this->bag->get('array_message')); } public function testGet() { - $this->assertEquals(array(), $this->bag->get('non_existing')); - $this->assertEquals(array('default'), $this->bag->get('not_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->get('notice')); - $this->assertEquals(array(), $this->bag->get('notice')); + $this->assertEquals([], $this->bag->get('non_existing')); + $this->assertEquals(['default'], $this->bag->get('not_existing', ['default'])); + $this->assertEquals(['A previous flash message'], $this->bag->get('notice')); + $this->assertEquals([], $this->bag->get('notice')); } public function testAll() { $this->bag->set('notice', 'Foo'); $this->bag->set('error', 'Bar'); - $this->assertEquals(array( - 'notice' => array('Foo'), - 'error' => array('Bar'), ), $this->bag->all() + $this->assertEquals([ + 'notice' => ['Foo'], + 'error' => ['Bar'], ], $this->bag->all() ); - $this->assertEquals(array(), $this->bag->all()); + $this->assertEquals([], $this->bag->all()); } public function testSet() { $this->bag->set('notice', 'Foo'); $this->bag->set('notice', 'Bar'); - $this->assertEquals(array('Bar'), $this->bag->peek('notice')); + $this->assertEquals(['Bar'], $this->bag->peek('notice')); } public function testHas() @@ -121,7 +121,7 @@ public function testHas() public function testKeys() { - $this->assertEquals(array('notice'), $this->bag->keys()); + $this->assertEquals(['notice'], $this->bag->keys()); } public function testSetAll() @@ -130,28 +130,28 @@ public function testSetAll() $this->bag->add('another_flash', 'Bar'); $this->assertTrue($this->bag->has('one_flash')); $this->assertTrue($this->bag->has('another_flash')); - $this->bag->setAll(array('unique_flash' => 'FooBar')); + $this->bag->setAll(['unique_flash' => 'FooBar']); $this->assertFalse($this->bag->has('one_flash')); $this->assertFalse($this->bag->has('another_flash')); - $this->assertSame(array('unique_flash' => 'FooBar'), $this->bag->all()); - $this->assertSame(array(), $this->bag->all()); + $this->assertSame(['unique_flash' => 'FooBar'], $this->bag->all()); + $this->assertSame([], $this->bag->all()); } public function testPeekAll() { $this->bag->set('notice', 'Foo'); $this->bag->set('error', 'Bar'); - $this->assertEquals(array( - 'notice' => array('Foo'), - 'error' => array('Bar'), - ), $this->bag->peekAll() + $this->assertEquals([ + 'notice' => ['Foo'], + 'error' => ['Bar'], + ], $this->bag->peekAll() ); $this->assertTrue($this->bag->has('notice')); $this->assertTrue($this->bag->has('error')); - $this->assertEquals(array( - 'notice' => array('Foo'), - 'error' => array('Bar'), - ), $this->bag->peekAll() + $this->assertEquals([ + 'notice' => ['Foo'], + 'error' => ['Bar'], + ], $this->bag->peekAll() ); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php index 37d722660fbc058f8115ad2950c8d75d6fa85b8a..afa00fc7c30463065d618c897ce1d4239c96dbaf 100644 --- a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php @@ -70,6 +70,27 @@ public function testSetId() $this->assertEquals('0123456789abcdef', $this->session->getId()); } + public function testSetIdAfterStart() + { + $this->session->start(); + $id = $this->session->getId(); + + $e = null; + try { + $this->session->setId($id); + } catch (\Exception $e) { + } + + $this->assertNull($e); + + try { + $this->session->setId('different'); + } catch (\Exception $e) { + } + + $this->assertInstanceOf('\LogicException', $e); + } + public function testSetName() { $this->assertEquals('MOCKSESSID', $this->session->getName()); @@ -106,10 +127,10 @@ public function testHas($key, $value) public function testReplace() { - $this->session->replace(array('happiness' => 'be good', 'symfony' => 'awesome')); - $this->assertEquals(array('happiness' => 'be good', 'symfony' => 'awesome'), $this->session->all()); - $this->session->replace(array()); - $this->assertEquals(array(), $this->session->all()); + $this->session->replace(['happiness' => 'be good', 'symfony' => 'awesome']); + $this->assertEquals(['happiness' => 'be good', 'symfony' => 'awesome'], $this->session->all()); + $this->session->replace([]); + $this->assertEquals([], $this->session->all()); } /** @@ -129,16 +150,16 @@ public function testClear($key, $value) $this->session->set('hi', 'fabien'); $this->session->set($key, $value); $this->session->clear(); - $this->assertEquals(array(), $this->session->all()); + $this->assertEquals([], $this->session->all()); } public function setProvider() { - return array( - array('foo', 'bar', array('foo' => 'bar')), - array('foo.bar', 'too much beer', array('foo.bar' => 'too much beer')), - array('great', 'symfony is great', array('great' => 'symfony is great')), - ); + return [ + ['foo', 'bar', ['foo' => 'bar']], + ['foo.bar', 'too much beer', ['foo.bar' => 'too much beer']], + ['great', 'symfony is great', ['great' => 'symfony is great']], + ]; } /** @@ -149,14 +170,14 @@ public function testRemove($key, $value) $this->session->set('hi.world', 'have a nice day'); $this->session->set($key, $value); $this->session->remove($key); - $this->assertEquals(array('hi.world' => 'have a nice day'), $this->session->all()); + $this->assertEquals(['hi.world' => 'have a nice day'], $this->session->all()); } public function testInvalidate() { $this->session->set('invalidate', 123); $this->session->invalidate(); - $this->assertEquals(array(), $this->session->all()); + $this->assertEquals([], $this->session->all()); } public function testMigrate() @@ -195,7 +216,7 @@ public function testGetFlashBag() public function testGetIterator() { - $attributes = array('hello' => 'world', 'symfony' => 'rocks'); + $attributes = ['hello' => 'world', 'symfony' => 'rocks']; foreach ($attributes as $key => $val) { $this->session->set($key, $val); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php index 3ac081e3884c1f0cfa37ea8fa4e15766e818316f..98bc67bcabb401986935de6437a51ce8a40d392c 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php @@ -22,10 +22,10 @@ class AbstractSessionHandlerTest extends TestCase public static function setUpBeforeClass() { - $spec = array( - 1 => array('file', '/dev/null', 'w'), - 2 => array('file', '/dev/null', 'w'), - ); + $spec = [ + 1 => ['file', '/dev/null', 'w'], + 2 => ['file', '/dev/null', 'w'], + ]; if (!self::$server = @proc_open('exec php -S localhost:8053', $spec, $pipes, __DIR__.'/Fixtures')) { self::markTestSkipped('PHP server unable to start.'); } @@ -45,7 +45,7 @@ public static function tearDownAfterClass() */ public function testSession($fixture) { - $context = array('http' => array('header' => "Cookie: sid=123abc\r\n")); + $context = ['http' => ['header' => "Cookie: sid=123abc\r\n"]]; $context = stream_context_create($context); $result = file_get_contents(sprintf('http://localhost:8053/%s.php', $fixture), false, $context); @@ -55,7 +55,7 @@ public function testSession($fixture) public function provideSession() { foreach (glob(__DIR__.'/Fixtures/*.php') as $file) { - yield array(pathinfo($file, PATHINFO_FILENAME)); + yield [pathinfo($file, PATHINFO_FILENAME)]; } } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php index d3d31762ae517a213e49fee34ffc359bbb2bb753..68daa4e5cb5955284948a180cddbd2fda75ffd5d 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php @@ -41,7 +41,7 @@ protected function setUp() $this->memcache = $this->getMockBuilder('Memcache')->getMock(); $this->storage = new MemcacheSessionHandler( $this->memcache, - array('prefix' => self::PREFIX, 'expiretime' => self::TTL) + ['prefix' => self::PREFIX, 'expiretime' => self::TTL] ); } @@ -117,12 +117,12 @@ public function testSupportedOptions($options, $supported) public function getOptionFixtures() { - return array( - array(array('prefix' => 'session'), true), - array(array('expiretime' => 100), true), - array(array('prefix' => 'session', 'expiretime' => 200), true), - array(array('expiretime' => 100, 'foo' => 'bar'), false), - ); + return [ + [['prefix' => 'session'], true], + [['expiretime' => 100], true], + [['prefix' => 'session', 'expiretime' => 200], true], + [['expiretime' => 100, 'foo' => 'bar'], false], + ]; } public function testGetConnection() diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php index 2a114801056c3294de889c2a05cba07eca364e93..813337349f2257b12f0d603088948545af531751 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php @@ -45,7 +45,7 @@ protected function setUp() $this->memcached = $this->getMockBuilder('Memcached')->getMock(); $this->storage = new MemcachedSessionHandler( $this->memcached, - array('prefix' => self::PREFIX, 'expiretime' => self::TTL) + ['prefix' => self::PREFIX, 'expiretime' => self::TTL] ); } @@ -63,6 +63,12 @@ public function testOpenSession() public function testCloseSession() { + $this->memcached + ->expects($this->once()) + ->method('quit') + ->will($this->returnValue(true)) + ; + $this->assertTrue($this->storage->close()); } @@ -121,12 +127,12 @@ public function testSupportedOptions($options, $supported) public function getOptionFixtures() { - return array( - array(array('prefix' => 'session'), true), - array(array('expiretime' => 100), true), - array(array('prefix' => 'session', 'expiretime' => 200), true), - array(array('expiretime' => 100, 'foo' => 'bar'), false), - ); + return [ + [['prefix' => 'session'], true], + [['expiretime' => 100], true], + [['prefix' => 'session', 'expiretime' => 200], true], + [['expiretime' => 100, 'foo' => 'bar'], false], + ]; } public function testGetConnection() diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index 186fc0a2d056463388616333e4f4e6a8ea8dc96f..6f2742ca70e53d36eb245258b715d6a014895e9c 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -50,14 +50,14 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); - $this->options = array( + $this->options = [ 'id_field' => '_id', 'data_field' => 'data', 'time_field' => 'time', 'expiry_field' => 'expires_at', 'database' => 'sf2-test', 'collection' => 'session-test', - ); + ]; $this->storage = new MongoDbSessionHandler($this->mongo, $this->options); } @@ -75,7 +75,7 @@ public function testConstructorShouldThrowExceptionForInvalidMongo() */ public function testConstructorShouldThrowExceptionForMissingOptions() { - new MongoDbSessionHandler($this->mongo, array()); + new MongoDbSessionHandler($this->mongo, []); } public function testOpenMethodAlwaysReturnTrue() @@ -118,9 +118,9 @@ public function testRead() $this->assertGreaterThanOrEqual($criteria[$this->options['expiry_field']]['$gte']->sec, $testTimeout); } - $fields = array( + $fields = [ $this->options['id_field'] => 'foo', - ); + ]; if (phpversion('mongodb')) { $fields[$this->options['data_field']] = new \MongoDB\BSON\Binary('bar', \MongoDB\BSON\Binary::TYPE_OLD_BINARY); @@ -145,19 +145,19 @@ public function testWrite() ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); - $data = array(); + $data = []; $methodName = phpversion('mongodb') ? 'updateOne' : 'update'; $collection->expects($this->once()) ->method($methodName) ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { - $this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria); + $this->assertEquals([$this->options['id_field'] => 'foo'], $criteria); if (phpversion('mongodb')) { - $this->assertEquals(array('upsert' => true), $options); + $this->assertEquals(['upsert' => true], $options); } else { - $this->assertEquals(array('upsert' => true, 'multiple' => false), $options); + $this->assertEquals(['upsert' => true, 'multiple' => false], $options); } $data = $updateData['$set']; @@ -181,14 +181,14 @@ public function testWrite() public function testWriteWhenUsingExpiresField() { - $this->options = array( + $this->options = [ 'id_field' => '_id', 'data_field' => 'data', 'time_field' => 'time', 'database' => 'sf2-test', 'collection' => 'session-test', 'expiry_field' => 'expiresAt', - ); + ]; $this->storage = new MongoDbSessionHandler($this->mongo, $this->options); @@ -199,19 +199,19 @@ public function testWriteWhenUsingExpiresField() ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); - $data = array(); + $data = []; $methodName = phpversion('mongodb') ? 'updateOne' : 'update'; $collection->expects($this->once()) ->method($methodName) ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { - $this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria); + $this->assertEquals([$this->options['id_field'] => 'foo'], $criteria); if (phpversion('mongodb')) { - $this->assertEquals(array('upsert' => true), $options); + $this->assertEquals(['upsert' => true], $options); } else { - $this->assertEquals(array('upsert' => true, 'multiple' => false), $options); + $this->assertEquals(['upsert' => true, 'multiple' => false], $options); } $data = $updateData['$set']; @@ -239,7 +239,7 @@ public function testReplaceSessionData() ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); - $data = array(); + $data = []; $methodName = phpversion('mongodb') ? 'updateOne' : 'update'; @@ -272,7 +272,7 @@ public function testDestroy() $collection->expects($this->once()) ->method($methodName) - ->with(array($this->options['id_field'] => 'foo')); + ->with([$this->options['id_field'] => 'foo']); $this->assertTrue($this->storage->destroy('foo')); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php index a6264e51d2a72df84268d2a63ac5485f8f5f2bdb..dc827d8ab03c2d8e1743762fff410c8bf11febdc 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php @@ -27,7 +27,7 @@ class NativeFileSessionHandlerTest extends TestCase { public function testConstruct() { - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir())); + $storage = new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler(sys_get_temp_dir())); $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); $this->assertEquals('user', ini_get('session.save_handler')); @@ -52,11 +52,11 @@ public function savePathDataProvider() { $base = sys_get_temp_dir(); - return array( - array("$base/foo", "$base/foo", "$base/foo"), - array("5;$base/foo", "5;$base/foo", "$base/foo"), - array("5;0600;$base/foo", "5;0600;$base/foo", "$base/foo"), - ); + return [ + ["$base/foo", "$base/foo", "$base/foo"], + ["5;$base/foo", "5;$base/foo", "$base/foo"], + ["5;0600;$base/foo", "5;0600;$base/foo", "$base/foo"], + ]; } /** @@ -70,7 +70,7 @@ public function testConstructException() public function testConstructDefault() { $path = ini_get('session.save_path'); - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler()); + $storage = new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler()); $this->assertEquals($path, ini_get('session.save_path')); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php index 9a2212b8b4009bf35f03ec1476b589d198b205fa..0d246e1aa560b8d32d7c44896bbae4fa56f1d8ad 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php @@ -54,6 +54,6 @@ public function testNothingIsPersisted() public function getStorage() { - return new NativeSessionStorage(array(), new NullSessionHandler()); + return new NativeSessionStorage([], new NullSessionHandler()); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index 3060452e9e1f94353c359ac80517a69650323edc..901078478b4db1ad86928d78c6733cc0793d3553 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -64,7 +64,7 @@ public function testWrongPdoErrMode() */ public function testInexistentTable() { - $storage = new PdoSessionHandler($this->getMemorySqlitePdo(), array('db_table' => 'inexistent_table')); + $storage = new PdoSessionHandler($this->getMemorySqlitePdo(), ['db_table' => 'inexistent_table']); $storage->open('', 'sid'); $storage->read('id'); $storage->write('id', 'data'); @@ -147,7 +147,7 @@ public function testReadConvertsStreamToString() $stream = $this->createStream($content); $pdo->prepareResult->expects($this->once())->method('fetchAll') - ->will($this->returnValue(array(array($stream, 42, time())))); + ->will($this->returnValue([[$stream, 42, time()]])); $storage = new PdoSessionHandler($pdo); $result = $storage->read('foo'); @@ -160,7 +160,7 @@ public function testReadLockedConvertsStreamToString() if (\defined('HHVM_VERSION')) { $this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); } - if (ini_get('session.use_strict_mode')) { + if (filter_var(ini_get('session.use_strict_mode'), FILTER_VALIDATE_BOOLEAN)) { $this->markTestSkipped('Strict mode needs no locking for new sessions.'); } @@ -178,7 +178,7 @@ public function testReadLockedConvertsStreamToString() $selectStmt->expects($this->atLeast(2))->method('fetchAll') ->will($this->returnCallback(function () use (&$exception, $stream) { - return $exception ? array(array($stream, 42, time())) : array(); + return $exception ? [[$stream, 42, time()]] : []; })); $insertStmt->expects($this->once())->method('execute') @@ -344,19 +344,19 @@ public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPa public function provideUrlDsnPairs() { - yield array('mysql://localhost/test', 'mysql:host=localhost;dbname=test;'); - yield array('mysql://localhost:56/test', 'mysql:host=localhost;port=56;dbname=test;'); - yield array('mysql2://root:pwd@localhost/test', 'mysql:host=localhost;dbname=test;', 'root', 'pwd'); - yield array('postgres://localhost/test', 'pgsql:host=localhost;dbname=test;'); - yield array('postgresql://localhost:5634/test', 'pgsql:host=localhost;port=5634;dbname=test;'); - yield array('postgres://root:pwd@localhost/test', 'pgsql:host=localhost;dbname=test;', 'root', 'pwd'); - yield 'sqlite relative path' => array('sqlite://localhost/tmp/test', 'sqlite:tmp/test'); - yield 'sqlite absolute path' => array('sqlite://localhost//tmp/test', 'sqlite:/tmp/test'); - yield 'sqlite relative path without host' => array('sqlite:///tmp/test', 'sqlite:tmp/test'); - yield 'sqlite absolute path without host' => array('sqlite3:////tmp/test', 'sqlite:/tmp/test'); - yield array('sqlite://localhost/:memory:', 'sqlite::memory:'); - yield array('mssql://localhost/test', 'sqlsrv:server=localhost;Database=test'); - yield array('mssql://localhost:56/test', 'sqlsrv:server=localhost,56;Database=test'); + yield ['mysql://localhost/test', 'mysql:host=localhost;dbname=test;']; + yield ['mysql://localhost:56/test', 'mysql:host=localhost;port=56;dbname=test;']; + yield ['mysql2://root:pwd@localhost/test', 'mysql:host=localhost;dbname=test;', 'root', 'pwd']; + yield ['postgres://localhost/test', 'pgsql:host=localhost;dbname=test;']; + yield ['postgresql://localhost:5634/test', 'pgsql:host=localhost;port=5634;dbname=test;']; + yield ['postgres://root:pwd@localhost/test', 'pgsql:host=localhost;dbname=test;', 'root', 'pwd']; + yield 'sqlite relative path' => ['sqlite://localhost/tmp/test', 'sqlite:tmp/test']; + yield 'sqlite absolute path' => ['sqlite://localhost//tmp/test', 'sqlite:/tmp/test']; + yield 'sqlite relative path without host' => ['sqlite:///tmp/test', 'sqlite:tmp/test']; + yield 'sqlite absolute path without host' => ['sqlite3:////tmp/test', 'sqlite:/tmp/test']; + yield ['sqlite://localhost/:memory:', 'sqlite::memory:']; + yield ['mssql://localhost/test', 'sqlsrv:server=localhost;Database=test']; + yield ['mssql://localhost:56/test', 'sqlsrv:server=localhost,56;Database=test']; } private function createStream($content) @@ -394,7 +394,7 @@ public function getAttribute($attribute) return parent::getAttribute($attribute); } - public function prepare($statement, $driverOptions = array()) + public function prepare($statement, $driverOptions = []) { return \is_callable($this->prepareResult) ? \call_user_func($this->prepareResult, $statement, $driverOptions) diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php index b02c41ae898663f721cc439e2c1bdb2f4989539a..6a0d16876e8e0f6ee9104dcefae111bdf0e0d21e 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php @@ -84,7 +84,7 @@ public function testReadWithValidateIdMismatch() { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->exactly(2))->method('read') - ->withConsecutive(array('id1'), array('id2')) + ->withConsecutive(['id1'], ['id2']) ->will($this->onConsecutiveCalls('data1', 'data2')); $proxy = new StrictSessionHandler($handler); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php index 69cf6163c16f3030f8ea0f5d83745d6fa926c55d..2c4758b9137c0720b07a9ce11d34be866e00f3e9 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php @@ -26,26 +26,26 @@ class MetadataBagTest extends TestCase */ protected $bag; - protected $array = array(); + protected $array = []; protected function setUp() { parent::setUp(); $this->bag = new MetadataBag(); - $this->array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0); + $this->array = [MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0]; $this->bag->initialize($this->array); } protected function tearDown() { - $this->array = array(); + $this->array = []; $this->bag = null; parent::tearDown(); } public function testInitialize() { - $sessionMetadata = array(); + $sessionMetadata = []; $bag1 = new MetadataBag(); $bag1->initialize($sessionMetadata); @@ -82,7 +82,7 @@ public function testGetStorageKey() public function testGetLifetime() { $bag = new MetadataBag(); - $array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 1000); + $array = [MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 1000]; $bag->initialize($array); $this->assertEquals(1000, $bag->getLifetime()); } @@ -111,11 +111,11 @@ public function testSkipLastUsedUpdate() $timeStamp = time(); $created = $timeStamp - 15; - $sessionMetadata = array( + $sessionMetadata = [ MetadataBag::CREATED => $created, MetadataBag::UPDATED => $created, MetadataBag::LIFETIME => 1000, - ); + ]; $bag->initialize($sessionMetadata); $this->assertEquals($created, $sessionMetadata[MetadataBag::UPDATED]); @@ -127,11 +127,11 @@ public function testDoesNotSkipLastUsedUpdate() $timeStamp = time(); $created = $timeStamp - 45; - $sessionMetadata = array( + $sessionMetadata = [ MetadataBag::CREATED => $created, MetadataBag::UPDATED => $created, MetadataBag::LIFETIME => 1000, - ); + ]; $bag->initialize($sessionMetadata); $this->assertEquals($timeStamp, $sessionMetadata[MetadataBag::UPDATED]); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php index 0c182e0b0bf5790b7e4ab4ff2908099e03954875..2e3024ef1b1669a7361c815b22d5af01e409bbbc 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php @@ -45,10 +45,10 @@ protected function setUp() $this->attributes = new AttributeBag(); $this->flashes = new FlashBag(); - $this->data = array( - $this->attributes->getStorageKey() => array('foo' => 'bar'), - $this->flashes->getStorageKey() => array('notice' => 'hello'), - ); + $this->data = [ + $this->attributes->getStorageKey() => ['foo' => 'bar'], + $this->flashes->getStorageKey() => ['notice' => 'hello'], + ]; $this->storage = new MockArraySessionStorage(); $this->storage->registerBag($this->flashes); @@ -80,14 +80,14 @@ public function testRegenerate() $id = $this->storage->getId(); $this->storage->regenerate(); $this->assertNotEquals($id, $this->storage->getId()); - $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all()); - $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll()); + $this->assertEquals(['foo' => 'bar'], $this->storage->getBag('attributes')->all()); + $this->assertEquals(['notice' => 'hello'], $this->storage->getBag('flashes')->peekAll()); $id = $this->storage->getId(); $this->storage->regenerate(true); $this->assertNotEquals($id, $this->storage->getId()); - $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all()); - $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll()); + $this->assertEquals(['foo' => 'bar'], $this->storage->getBag('attributes')->all()); + $this->assertEquals(['notice' => 'hello'], $this->storage->getBag('flashes')->peekAll()); } public function testGetId() @@ -101,8 +101,8 @@ public function testClearClearsBags() { $this->storage->clear(); - $this->assertSame(array(), $this->storage->getBag('attributes')->all()); - $this->assertSame(array(), $this->storage->getBag('flashes')->peekAll()); + $this->assertSame([], $this->storage->getBag('attributes')->all()); + $this->assertSame([], $this->storage->getBag('flashes')->peekAll()); } public function testClearStartsSession() diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php index 16957981750e32c0775f4f4e94727150e4bba996..9e2692dc0ba189d93e130cfe844b5008cc70347e 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php @@ -91,7 +91,7 @@ public function testSave() $storage->start(); $this->assertEquals('108', $storage->getBag('attributes')->get('new')); $this->assertTrue($storage->getBag('flashes')->has('newkey')); - $this->assertEquals(array('test'), $storage->getBag('flashes')->peek('newkey')); + $this->assertEquals(['test'], $storage->getBag('flashes')->peek('newkey')); } public function testMultipleInstances() diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php index 52da2947cbcb739cc22892d20a74000d24ceb9ce..7cc2eb79c8dbdd4c32cf51b3721695d295193faa 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -56,7 +56,7 @@ protected function tearDown() /** * @return NativeSessionStorage */ - protected function getStorage(array $options = array()) + protected function getStorage(array $options = []) { $storage = new NativeSessionStorage($options); $storage->registerBag(new AttributeBag()); @@ -157,28 +157,30 @@ public function testExplicitSessionCacheLimiter() { $this->iniSet('session.cache_limiter', 'nocache'); - $storage = new NativeSessionStorage(array('cache_limiter' => 'public')); + $storage = new NativeSessionStorage(['cache_limiter' => 'public']); $this->assertEquals('public', ini_get('session.cache_limiter')); } public function testCookieOptions() { - $options = array( + $options = [ 'cookie_lifetime' => 123456, 'cookie_path' => '/my/cookie/path', 'cookie_domain' => 'symfony.example.com', 'cookie_secure' => true, 'cookie_httponly' => false, - ); + ]; $this->getStorage($options); $temp = session_get_cookie_params(); - $gco = array(); + $gco = []; foreach ($temp as $key => $value) { $gco['cookie_'.$key] = $value; } + unset($gco['cookie_samesite']); + $this->assertEquals($options, $gco); } @@ -188,10 +190,10 @@ public function testSessionOptions() $this->markTestSkipped('HHVM is not handled in this test case.'); } - $options = array( + $options = [ 'url_rewriter.tags' => 'a=href', 'cache_expire' => '200', - ); + ]; $this->getStorage($options); @@ -272,9 +274,9 @@ public function testCanCreateNativeSessionStorageWhenSessionAlreadyStarted() public function testSetSessionOptionsOnceSessionStartedIsIgnored() { session_start(); - $this->getStorage(array( + $this->getStorage([ 'name' => 'something-else', - )); + ]); // Assert no exception has been thrown by `getStorage()` $this->addToAssertionCount(1); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php index 7cb63c5aacefc0caa7b02d03599f5ebd766686ca..752be618bc1ee8a89d03a2b8256b18aa272cca28 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php @@ -87,10 +87,10 @@ public function testClear() $_SESSION['drak'] = 'loves symfony'; $storage->getBag('attributes')->set('symfony', 'greatness'); $key = $storage->getBag('attributes')->getStorageKey(); - $this->assertEquals($_SESSION[$key], array('symfony' => 'greatness')); + $this->assertEquals($_SESSION[$key], ['symfony' => 'greatness']); $this->assertEquals($_SESSION['drak'], 'loves symfony'); $storage->clear(); - $this->assertEquals($_SESSION[$key], array()); + $this->assertEquals($_SESSION[$key], []); $this->assertEquals($_SESSION['drak'], 'loves symfony'); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php index 0b48250e01010e6f1f507c8276649c4699dc8dba..0459a8ce97d50e6cc7e97c7d6f353559b658ed9f 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php @@ -127,7 +127,7 @@ public function testGc() */ public function testValidateId() { - $mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock(); + $mock = $this->getMockBuilder(['SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'])->getMock(); $mock->expects($this->once()) ->method('validateId'); @@ -142,7 +142,7 @@ public function testValidateId() */ public function testUpdateTimestamp() { - $mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock(); + $mock = $this->getMockBuilder(['SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'])->getMock(); $mock->expects($this->once()) ->method('updateTimestamp'); diff --git a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php index 699222e37916e78e4dc611901a4802bb541ff55e..62dfc9bc94a7b2fdbbdb04bbc4f726ed2e201a11 100644 --- a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php @@ -19,7 +19,7 @@ class StreamedResponseTest extends TestCase { public function testConstructor() { - $response = new StreamedResponse(function () { echo 'foo'; }, 404, array('Content-Type' => 'text/plain')); + $response = new StreamedResponse(function () { echo 'foo'; }, 404, ['Content-Type' => 'text/plain']); $this->assertEquals(404, $response->getStatusCode()); $this->assertEquals('text/plain', $response->headers->get('Content-Type')); @@ -51,7 +51,7 @@ public function testPrepareWith10Protocol() public function testPrepareWithHeadRequest() { - $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Content-Length' => '123')); + $response = new StreamedResponse(function () { echo 'foo'; }, 200, ['Content-Length' => '123']); $request = Request::create('/', 'HEAD'); $response->prepare($request); @@ -61,7 +61,7 @@ public function testPrepareWithHeadRequest() public function testPrepareWithCacheHeaders() { - $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Cache-Control' => 'max-age=600, public')); + $response = new StreamedResponse(function () { echo 'foo'; }, 200, ['Cache-Control' => 'max-age=600, public']); $request = Request::create('/', 'GET'); $response->prepare($request); diff --git a/vendor/symfony/http-foundation/phpunit.xml.dist b/vendor/symfony/http-foundation/phpunit.xml.dist index c1d61f8bf1da0b6d47f92152164b63f3bb7e6f37..f57bc9e62d5eb37cc83a86db4459969d4c06864e 100644 --- a/vendor/symfony/http-foundation/phpunit.xml.dist +++ b/vendor/symfony/http-foundation/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/http-kernel/Bundle/Bundle.php b/vendor/symfony/http-kernel/Bundle/Bundle.php index 8dca09036bde56ae7cab07c745364afb4bac86f4..62b86ca7fd1e1eb17a3cb987c7f618543538a118 100644 --- a/vendor/symfony/http-kernel/Bundle/Bundle.php +++ b/vendor/symfony/http-kernel/Bundle/Bundle.php @@ -34,23 +34,21 @@ abstract class Bundle implements BundleInterface private $namespace; /** - * Boots the Bundle. + * {@inheritdoc} */ public function boot() { } /** - * Shutdowns the Bundle. + * {@inheritdoc} */ public function shutdown() { } /** - * Builds the bundle. - * - * It is only ever called once when the cache is empty. + * {@inheritdoc} * * This method can be overridden to register compilation passes, * other extensions, ... @@ -81,10 +79,7 @@ public function getContainerExtension() $expectedAlias = Container::underscore($basename); if ($expectedAlias != $extension->getAlias()) { - throw new \LogicException(sprintf( - 'Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', - $expectedAlias, $extension->getAlias() - )); + throw new \LogicException(sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias())); } $this->extension = $extension; @@ -99,9 +94,7 @@ public function getContainerExtension() } /** - * Gets the Bundle namespace. - * - * @return string The Bundle namespace + * {@inheritdoc} */ public function getNamespace() { @@ -113,9 +106,7 @@ public function getNamespace() } /** - * Gets the Bundle directory path. - * - * @return string The Bundle absolute path + * {@inheritdoc} */ public function getPath() { @@ -128,18 +119,14 @@ public function getPath() } /** - * Returns the bundle parent name. - * - * @return string|null The Bundle parent name it overrides or null if no parent + * {@inheritdoc} */ public function getParent() { } /** - * Returns the bundle name (the class short name). - * - * @return string The Bundle name + * {@inheritdoc} */ final public function getName() { @@ -179,7 +166,7 @@ public function registerCommands(Application $application) } $class = $ns.'\\'.$file->getBasename('.php'); if ($this->container) { - $commandIds = $this->container->hasParameter('console.command.ids') ? $this->container->getParameter('console.command.ids') : array(); + $commandIds = $this->container->hasParameter('console.command.ids') ? $this->container->getParameter('console.command.ids') : []; $alias = 'console.command.'.strtolower(str_replace('\\', '_', $class)); if (isset($commandIds[$alias]) || $this->container->has($alias)) { continue; diff --git a/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php b/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php index 8ee4275b1686746ac9117fd970d989b7d62b06ef..f82ada5c4b24f477def31ee0038e352b6e5cc367 100644 --- a/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php +++ b/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php @@ -27,7 +27,7 @@ class ChainCacheClearer implements CacheClearerInterface * * @param array $clearers The initial clearers */ - public function __construct($clearers = array()) + public function __construct($clearers = []) { $this->clearers = $clearers; } diff --git a/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php b/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php index d413d2c9d641d18952a305be9e599ed50a221ce1..42add5a686f93a28e0f71bd8138b626c44c4db62 100644 --- a/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php +++ b/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php @@ -18,9 +18,9 @@ */ class Psr6CacheClearer implements CacheClearerInterface { - private $pools = array(); + private $pools = []; - public function __construct(array $pools = array()) + public function __construct(array $pools = []) { $this->pools = $pools; } diff --git a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php index ca3911ed5f9dc13bfb6d3c902d62bcfcbacb00e8..eca4e6aede716c54ba9adf8aebd8559c30a70dc7 100644 --- a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php +++ b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php @@ -20,11 +20,11 @@ */ class CacheWarmerAggregate implements CacheWarmerInterface { - protected $warmers = array(); + protected $warmers = []; protected $optionalsEnabled = false; private $triggerDeprecation = false; - public function __construct($warmers = array()) + public function __construct($warmers = []) { foreach ($warmers as $warmer) { $this->add($warmer); @@ -70,7 +70,7 @@ public function setWarmers(array $warmers) { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), E_USER_DEPRECATED); - $this->warmers = array(); + $this->warmers = []; foreach ($warmers as $warmer) { $this->add($warmer); } diff --git a/vendor/symfony/http-kernel/Client.php b/vendor/symfony/http-kernel/Client.php index 380dd152436ab6b4a54477cc2149afcb31ce912f..958c4c81f9538cdd450b1598196fea44313075bb 100644 --- a/vendor/symfony/http-kernel/Client.php +++ b/vendor/symfony/http-kernel/Client.php @@ -39,7 +39,7 @@ class Client extends BaseClient * @param History $history A History instance to store the browser history * @param CookieJar $cookieJar A CookieJar instance to store the cookies */ - public function __construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null) + public function __construct(HttpKernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null) { // These class properties must be set before calling the parent constructor, as it may depend on it. $this->kernel = $kernel; @@ -81,8 +81,9 @@ protected function doRequest($request) */ protected function getScript($request) { - $kernel = str_replace("'", "\\'", serialize($this->kernel)); - $request = str_replace("'", "\\'", serialize($request)); + $kernel = var_export(serialize($this->kernel), true); + $request = var_export(serialize($request), true); + $errorReporting = error_reporting(); $requires = ''; @@ -91,7 +92,7 @@ protected function getScript($request) $r = new \ReflectionClass($class); $file = \dirname(\dirname($r->getFileName())).'/autoload.php'; if (file_exists($file)) { - $requires .= "require_once '".str_replace("'", "\\'", $file)."';\n"; + $requires .= 'require_once '.var_export($file, true).";\n"; } } } @@ -107,8 +108,8 @@ protected function getScript($request) $requires -\$kernel = unserialize('$kernel'); -\$request = unserialize('$request'); +\$kernel = unserialize($kernel); +\$request = unserialize($request); EOF; return $code.$this->getHandleScript(); @@ -158,7 +159,7 @@ protected function filterRequest(DomRequest $request) */ protected function filterFiles(array $files) { - $filtered = array(); + $filtered = []; foreach ($files as $key => $value) { if (\is_array($value)) { $filtered[$key] = $this->filterFiles($value); diff --git a/vendor/symfony/http-kernel/Config/EnvParametersResource.php b/vendor/symfony/http-kernel/Config/EnvParametersResource.php index f8d2a72b2a9b918174396e913395543d2567cf64..26869ced2fc70dc6b889e249760b44a3f6c17df9 100644 --- a/vendor/symfony/http-kernel/Config/EnvParametersResource.php +++ b/vendor/symfony/http-kernel/Config/EnvParametersResource.php @@ -54,7 +54,7 @@ public function __toString() */ public function getResource() { - return array('prefix' => $this->prefix, 'variables' => $this->variables); + return ['prefix' => $this->prefix, 'variables' => $this->variables]; } /** @@ -65,15 +65,21 @@ public function isFresh($timestamp) return $this->findVariables() === $this->variables; } + /** + * @internal + */ public function serialize() { - return serialize(array('prefix' => $this->prefix, 'variables' => $this->variables)); + return serialize(['prefix' => $this->prefix, 'variables' => $this->variables]); } + /** + * @internal + */ public function unserialize($serialized) { if (\PHP_VERSION_ID >= 70000) { - $unserialized = unserialize($serialized, array('allowed_classes' => false)); + $unserialized = unserialize($serialized, ['allowed_classes' => false]); } else { $unserialized = unserialize($serialized); } @@ -84,7 +90,7 @@ public function unserialize($serialized) private function findVariables() { - $variables = array(); + $variables = []; foreach ($_SERVER as $key => $value) { if (0 === strpos($key, $this->prefix)) { diff --git a/vendor/symfony/http-kernel/Config/FileLocator.php b/vendor/symfony/http-kernel/Config/FileLocator.php index fb1f913bdff5d1ae348cd4611d3529215b7a1be9..fd5c8a32c1edf41e588c949485dd83b7a44fa3dd 100644 --- a/vendor/symfony/http-kernel/Config/FileLocator.php +++ b/vendor/symfony/http-kernel/Config/FileLocator.php @@ -26,10 +26,10 @@ class FileLocator extends BaseFileLocator /** * @param KernelInterface $kernel A KernelInterface instance - * @param null|string $path The path the global resource directory + * @param string|null $path The path the global resource directory * @param array $paths An array of paths where to look for resources */ - public function __construct(KernelInterface $kernel, $path = null, array $paths = array()) + public function __construct(KernelInterface $kernel, $path = null, array $paths = []) { $this->kernel = $kernel; if (null !== $path) { diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver.php index fc316920c7e0857925f7cd64ad503106b5963332..fc6f969a9eae57392ec3f26bbd779bb77f1c54f4 100644 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver.php +++ b/vendor/symfony/http-kernel/Controller/ArgumentResolver.php @@ -34,7 +34,7 @@ final class ArgumentResolver implements ArgumentResolverInterface */ private $argumentValueResolvers; - public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, $argumentValueResolvers = array()) + public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, $argumentValueResolvers = []) { $this->argumentMetadataFactory = $argumentMetadataFactory ?: new ArgumentMetadataFactory(); $this->argumentValueResolvers = $argumentValueResolvers ?: self::getDefaultArgumentValueResolvers(); @@ -45,7 +45,7 @@ public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFa */ public function getArguments(Request $request, $controller) { - $arguments = array(); + $arguments = []; foreach ($this->argumentMetadataFactory->createArgumentMetadata($controller) as $metadata) { foreach ($this->argumentValueResolvers as $resolver) { @@ -83,12 +83,12 @@ public function getArguments(Request $request, $controller) public static function getDefaultArgumentValueResolvers() { - return array( + return [ new RequestAttributeValueResolver(), new RequestValueResolver(), new SessionValueResolver(), new DefaultValueResolver(), new VariadicValueResolver(), - ); + ]; } } diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php index 7bc195f233114679b550469bd8bcf1bce32b3165..3294ec862ee30b5302a0cdce908b63032b9650c2 100644 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php +++ b/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php @@ -47,6 +47,10 @@ public function supports(Request $request, ArgumentMetadata $argument) $controller = ltrim($controller, '\\'); } + if (!$this->container->has($controller) && false !== $i = strrpos($controller, ':')) { + $controller = substr($controller, 0, $i).strtolower(substr($controller, $i)); + } + return $this->container->has($controller) && $this->container->get($controller)->has($argument->getName()); } @@ -63,6 +67,11 @@ public function resolve(Request $request, ArgumentMetadata $argument) $controller = ltrim($controller, '\\'); } + if (!$this->container->has($controller)) { + $i = strrpos($controller, ':'); + $controller = substr($controller, 0, $i).strtolower(substr($controller, $i)); + } + yield $this->container->get($controller)->get($argument->getName()); } } diff --git a/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php b/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php index bc53e94bef3b4098a81bff2e1aae0608e1bf6268..b08877da936b423d76eb42211e07548ffc1ec7e5 100644 --- a/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php +++ b/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php @@ -77,7 +77,7 @@ protected function createController($controller) $service = $this->container->get($controller); if (null !== $method) { - return array($service, $method); + return [$service, $method]; } if (!method_exists($service, '__invoke')) { diff --git a/vendor/symfony/http-kernel/Controller/ControllerReference.php b/vendor/symfony/http-kernel/Controller/ControllerReference.php index fae4e7fa449bc572be27c602fd3d01ef4eb10f6e..e1e9c813ea9685f9958f4d9acc80f62d7b119b15 100644 --- a/vendor/symfony/http-kernel/Controller/ControllerReference.php +++ b/vendor/symfony/http-kernel/Controller/ControllerReference.php @@ -27,15 +27,15 @@ class ControllerReference { public $controller; - public $attributes = array(); - public $query = array(); + public $attributes = []; + public $query = []; /** * @param string $controller The controller name * @param array $attributes An array of parameters to add to the Request attributes * @param array $query An array of parameters to add to the Request query string */ - public function __construct($controller, array $attributes = array(), array $query = array()) + public function __construct($controller, array $attributes = [], array $query = []) { $this->controller = $controller; $this->attributes = $attributes; diff --git a/vendor/symfony/http-kernel/Controller/ControllerResolver.php b/vendor/symfony/http-kernel/Controller/ControllerResolver.php index 6d898e783144bc5447ce29ae869a8a6c328eb822..e657f6143075f0df061c987b4c65e6a1079d708c 100644 --- a/vendor/symfony/http-kernel/Controller/ControllerResolver.php +++ b/vendor/symfony/http-kernel/Controller/ControllerResolver.php @@ -129,9 +129,9 @@ protected function doGetArguments(Request $request, $controller, array $paramete @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED); $attributes = $request->attributes->all(); - $arguments = array(); + $arguments = []; foreach ($parameters as $param) { - if (array_key_exists($param->name, $attributes)) { + if (\array_key_exists($param->name, $attributes)) { if ($this->supportsVariadic && $param->isVariadic() && \is_array($attributes[$param->name])) { $arguments = array_merge($arguments, array_values($attributes[$param->name])); } else { @@ -180,7 +180,7 @@ protected function createController($controller) throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); } - return array($this->instantiateController($class), $method); + return [$this->instantiateController($class), $method]; } /** @@ -216,7 +216,7 @@ private function getControllerError($callable) } if (2 !== \count($callable)) { - return 'Invalid format for controller, expected array(controller, method) or controller::method.'; + return 'Invalid format for controller, expected [controller, method] or controller::method.'; } list($controller, $method) = $callable; @@ -233,7 +233,7 @@ private function getControllerError($callable) $collection = get_class_methods($controller); - $alternatives = array(); + $alternatives = []; foreach ($collection as $item) { $lev = levenshtein($method, $item); diff --git a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php index 6559c9db1338aea8da4abb2f0f646b687b1dfeef..fa48d0cc115740f750b7098d5ff273a1122c2cf9 100644 --- a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php +++ b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php @@ -47,7 +47,7 @@ public function __construct() */ public function createArgumentMetadata($controller) { - $arguments = array(); + $arguments = []; if (\is_array($controller)) { $reflection = new \ReflectionMethod($controller[0], $controller[1]); @@ -105,7 +105,7 @@ private function getDefaultValue(\ReflectionParameter $parameter) * * @param \ReflectionParameter $parameter * - * @return null|string + * @return string|null */ private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbstract $function) { diff --git a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php b/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php index 07eac4023e35272a1180371b268f67f3d72ddd39..626c1cc6952716b37409891bfcf1395614bf7d4c 100644 --- a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php @@ -54,7 +54,7 @@ public function setKernel(KernelInterface $kernel = null) */ public function collect(Request $request, Response $response, \Exception $exception = null) { - $this->data = array( + $this->data = [ 'app_name' => $this->name, 'app_version' => $this->version, 'token' => $response->headers->get('X-Debug-Token'), @@ -68,11 +68,11 @@ public function collect(Request $request, Response $response, \Exception $except 'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', 'php_timezone' => date_default_timezone_get(), 'xdebug_enabled' => \extension_loaded('xdebug'), - 'apcu_enabled' => \extension_loaded('apcu') && ini_get('apc.enabled'), - 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && ini_get('opcache.enable'), - 'bundles' => array(), + 'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN), + 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN), + 'bundles' => [], 'sapi_name' => \PHP_SAPI, - ); + ]; if (isset($this->kernel)) { foreach ($this->kernel->getBundles() as $name => $bundle) { @@ -98,7 +98,7 @@ public function collect(Request $request, Response $response, \Exception $except */ public function reset() { - $this->data = array(); + $this->data = []; } public function lateCollect() diff --git a/vendor/symfony/http-kernel/DataCollector/DataCollector.php b/vendor/symfony/http-kernel/DataCollector/DataCollector.php index 6d1a822e47a9008c1394c96cac6383b06a77ed8f..4346e0ec0f8e192fe77237d08ffff3f7c2940bd7 100644 --- a/vendor/symfony/http-kernel/DataCollector/DataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/DataCollector.php @@ -28,7 +28,7 @@ */ abstract class DataCollector implements DataCollectorInterface, \Serializable { - protected $data = array(); + protected $data = []; /** * @var ValueExporter @@ -42,12 +42,15 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable public function serialize() { - return serialize($this->data); + $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); + $isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object']; + + return $isCalledFromOverridingMethod ? $this->data : serialize($this->data); } public function unserialize($data) { - $this->data = unserialize($data); + $this->data = \is_array($data) ? $data : unserialize($data); } /** @@ -111,7 +114,7 @@ protected function varToString($var) */ protected function getCasters() { - return array( + return [ '*' => function ($v, array $a, Stub $s, $isNested) { if (!$v instanceof Stub) { foreach ($a as $k => $v) { @@ -123,6 +126,6 @@ protected function getCasters() return $a; }, - ); + ]; } } diff --git a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php index 7e2430c4ba1060d5c324d4b5ff68894ebdd1794d..4266b22fec9b9ae1239492a9ddde29a17c811fae 100644 --- a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php @@ -49,12 +49,12 @@ public function __construct(Stopwatch $stopwatch = null, $fileLinkFormat = null, $this->dumperIsInjected = null !== $dumper; // All clones share these properties by reference: - $this->rootRefs = array( + $this->rootRefs = [ &$this->data, &$this->dataCount, &$this->isCollected, &$this->clonesCount, - ); + ]; } public function __clone() @@ -103,7 +103,7 @@ public function dump(Data $data) if ($src) { $src = explode("\n", $src); - $fileExcerpt = array(); + $fileExcerpt = []; for ($i = max($line - 3, 1), $max = min($line + 3, \count($src)); $i <= $max; ++$i) { $fileExcerpt[] = '<li'.($i === $line ? ' class="selected"' : '').'><code>'.$this->htmlEncode($src[$i - 1]).'</code></li>'; @@ -153,7 +153,7 @@ public function collect(Request $request, Response $response, \Exception $except ) { if ($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html')) { $this->dumper = new HtmlDumper('php://output', $this->charset); - $this->dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat)); + $this->dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]); } else { $this->dumper = new CliDumper('php://output', $this->charset); } @@ -169,7 +169,7 @@ public function reset() if ($this->stopwatch) { $this->stopwatch->reset(); } - $this->data = array(); + $this->data = []; $this->dataCount = 0; $this->isCollected = true; $this->clonesCount = 0; @@ -185,7 +185,7 @@ public function serialize() $this->data[] = $this->fileLinkFormat; $this->data[] = $this->charset; $ser = serialize($this->data); - $this->data = array(); + $this->data = []; $this->dataCount = 0; $this->isCollected = true; if (!$this->dumperIsInjected) { @@ -197,7 +197,7 @@ public function serialize() public function unserialize($data) { - parent::unserialize($data); + $this->data = unserialize($data); $charset = array_pop($this->data); $fileLinkFormat = array_pop($this->data); $this->dataCount = \count($this->data); @@ -215,11 +215,11 @@ public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1) if ('html' === $format) { $dumper = new HtmlDumper($data, $this->charset); - $dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat)); + $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]); } else { throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format)); } - $dumps = array(); + $dumps = []; foreach ($this->data as $dump) { $dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth)); @@ -250,9 +250,9 @@ public function __destruct() --$i; } - if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html')) { + if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && stripos($h[$i], 'html')) { $this->dumper = new HtmlDumper('php://output', $this->charset); - $this->dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat)); + $this->dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]); } else { $this->dumper = new CliDumper('php://output', $this->charset); } @@ -262,7 +262,7 @@ public function __destruct() $this->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']); } - $this->data = array(); + $this->data = []; $this->dataCount = 0; } } @@ -276,7 +276,7 @@ private function doDump($data, $name, $file, $line) $s = $this->style('meta', '%s'); $f = strip_tags($this->style('', $file)); $name = strip_tags($this->style('', $name)); - if ($fmt && $link = \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line)) { + if ($fmt && $link = \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line)) { $name = sprintf('<a href="%s" title="%s">'.$s.'</a>', strip_tags($this->style('', $link)), $f, $name); } else { $name = sprintf('<abbr title="%s">'.$s.'</abbr>', $f, $name); diff --git a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php index 81076fd7267761cba086b54f6133ae8cb4707a2f..78e9e29198e9512f3beffba3142b8f2bd7fc559e 100644 --- a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php @@ -38,15 +38,15 @@ public function __construct(EventDispatcherInterface $dispatcher = null) */ public function collect(Request $request, Response $response, \Exception $exception = null) { - $this->data = array( - 'called_listeners' => array(), - 'not_called_listeners' => array(), - ); + $this->data = [ + 'called_listeners' => [], + 'not_called_listeners' => [], + ]; } public function reset() { - $this->data = array(); + $this->data = []; if ($this->dispatcher instanceof TraceableEventDispatcherInterface) { if (!method_exists($this->dispatcher, 'reset')) { diff --git a/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php b/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php index 7a25f149215b8584b5cb3764d116f49b1692aecc..c76e7f45bdf109c8fecb14e9b0d36db56255f44b 100644 --- a/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php @@ -28,9 +28,9 @@ class ExceptionDataCollector extends DataCollector public function collect(Request $request, Response $response, \Exception $exception = null) { if (null !== $exception) { - $this->data = array( + $this->data = [ 'exception' => FlattenException::create($exception), - ); + ]; } } @@ -39,7 +39,7 @@ public function collect(Request $request, Response $response, \Exception $except */ public function reset() { - $this->data = array(); + $this->data = []; } /** diff --git a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php b/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php index 97b8a8620c3c9d87e5a7b42cfb6c8c5d4d42a699..1d95b8b566a5bde7e571d80b2a2a7caf5b5efecf 100644 --- a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php @@ -55,7 +55,7 @@ public function reset() if ($this->logger && method_exists($this->logger, 'clear')) { $this->logger->clear(); } - $this->data = array(); + $this->data = []; } /** @@ -79,12 +79,12 @@ public function lateCollect() */ public function getLogs() { - return isset($this->data['logs']) ? $this->data['logs'] : array(); + return isset($this->data['logs']) ? $this->data['logs'] : []; } public function getPriorities() { - return isset($this->data['priorities']) ? $this->data['priorities'] : array(); + return isset($this->data['priorities']) ? $this->data['priorities'] : []; } public function countErrors() @@ -109,7 +109,7 @@ public function countScreams() public function getCompilerLogs() { - return isset($this->data['compiler_logs']) ? $this->data['compiler_logs'] : array(); + return isset($this->data['compiler_logs']) ? $this->data['compiler_logs'] : []; } /** @@ -123,13 +123,13 @@ public function getName() private function getContainerDeprecationLogs() { if (null === $this->containerPathPrefix || !file_exists($file = $this->containerPathPrefix.'Deprecations.log')) { - return array(); + return []; } $bootTime = filemtime($file); - $logs = array(); + $logs = []; foreach (unserialize(file_get_contents($file)) as $log) { - $log['context'] = array('exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count'])); + $log['context'] = ['exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count'])]; $log['timestamp'] = $bootTime; $log['priority'] = 100; $log['priorityName'] = 'DEBUG'; @@ -145,17 +145,17 @@ private function getContainerDeprecationLogs() private function getContainerCompilerLogs() { if (null === $this->containerPathPrefix || !file_exists($file = $this->containerPathPrefix.'Compiler.log')) { - return array(); + return []; } - $logs = array(); + $logs = []; foreach (file($file, FILE_IGNORE_NEW_LINES) as $log) { $log = explode(': ', $log, 2); if (!isset($log[1]) || !preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $log[0])) { - $log = array('Unknown Compiler Pass', implode(': ', $log)); + $log = ['Unknown Compiler Pass', implode(': ', $log)]; } - $logs[$log[0]][] = array('message' => $log[1]); + $logs[$log[0]][] = ['message' => $log[1]]; } return $logs; @@ -163,8 +163,8 @@ private function getContainerCompilerLogs() private function sanitizeLogs($logs) { - $sanitizedLogs = array(); - $silencedLogs = array(); + $sanitizedLogs = []; + $silencedLogs = []; foreach ($logs as $log) { if (!$this->isSilencedOrDeprecationErrorLog($log)) { @@ -183,10 +183,10 @@ private function sanitizeLogs($logs) $silencedLogs[$h] = true; if (!isset($sanitizedLogs[$message])) { - $sanitizedLogs[$message] = $log + array( + $sanitizedLogs[$message] = $log + [ 'errorCount' => 0, 'scream' => true, - ); + ]; } $sanitizedLogs[$message]['errorCount'] += $exception->count; @@ -198,10 +198,10 @@ private function sanitizeLogs($logs) if (isset($sanitizedLogs[$errorId])) { ++$sanitizedLogs[$errorId]['errorCount']; } else { - $log += array( + $log += [ 'errorCount' => 1, 'scream' => false, - ); + ]; $sanitizedLogs[$errorId] = $log; } @@ -222,7 +222,7 @@ private function isSilencedOrDeprecationErrorLog(array $log) return true; } - if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), array(E_DEPRECATED, E_USER_DEPRECATED), true)) { + if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), [E_DEPRECATED, E_USER_DEPRECATED], true)) { return true; } @@ -231,23 +231,23 @@ private function isSilencedOrDeprecationErrorLog(array $log) private function computeErrorsCount(array $containerDeprecationLogs) { - $silencedLogs = array(); - $count = array( + $silencedLogs = []; + $count = [ 'error_count' => $this->logger->countErrors(), 'deprecation_count' => 0, 'warning_count' => 0, 'scream_count' => 0, - 'priorities' => array(), - ); + 'priorities' => [], + ]; foreach ($this->logger->getLogs() as $log) { if (isset($count['priorities'][$log['priority']])) { ++$count['priorities'][$log['priority']]['count']; } else { - $count['priorities'][$log['priority']] = array( + $count['priorities'][$log['priority']] = [ 'count' => 1, 'name' => $log['priorityName'], - ); + ]; } if ('WARNING' === $log['priorityName']) { ++$count['warning_count']; diff --git a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php b/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php index 310b2f91a55d08d7335e6aa6ca143e1523a78e49..7a6e1c06464469a81da283b733908b4ce3be7fff 100644 --- a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php @@ -39,10 +39,10 @@ public function collect(Request $request, Response $response, \Exception $except */ public function reset() { - $this->data = array( + $this->data = [ 'memory' => 0, 'memory_limit' => $this->convertToBytes(ini_get('memory_limit')), - ); + ]; } /** diff --git a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php index e415833cc33e890ded6595d7eeb2015808bab525..671865aa16b17913ee843d13ade29601e27d0d4b 100644 --- a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php @@ -38,7 +38,7 @@ public function __construct() public function collect(Request $request, Response $response, \Exception $exception = null) { // attributes are serialized and as they can be anything, they need to be converted to strings. - $attributes = array(); + $attributes = []; $route = ''; foreach ($request->attributes->all() as $key => $value) { if ('_route' === $key) { @@ -57,10 +57,10 @@ public function collect(Request $request, Response $response, \Exception $except $content = false; } - $sessionMetadata = array(); - $sessionAttributes = array(); + $sessionMetadata = []; + $sessionAttributes = []; $session = null; - $flashes = array(); + $flashes = []; if ($request->hasSession()) { $session = $request->getSession(); if ($session->isStarted()) { @@ -74,12 +74,12 @@ public function collect(Request $request, Response $response, \Exception $except $statusCode = $response->getStatusCode(); - $responseCookies = array(); + $responseCookies = []; foreach ($response->headers->getCookies() as $cookie) { $responseCookies[$cookie->getName()] = $cookie; } - $this->data = array( + $this->data = [ 'method' => $request->getMethod(), 'format' => $request->getRequestFormat(), 'content' => $content, @@ -101,7 +101,7 @@ public function collect(Request $request, Response $response, \Exception $except 'path_info' => $request->getPathInfo(), 'controller' => 'n/a', 'locale' => $request->getLocale(), - ); + ]; if (isset($this->data['request_headers']['php-auth-pw'])) { $this->data['request_headers']['php-auth-pw'] = '******'; @@ -138,14 +138,14 @@ public function collect(Request $request, Response $response, \Exception $except if ($response->isRedirect()) { $response->headers->setCookie(new Cookie( 'sf_redirect', - json_encode(array( + json_encode([ 'token' => $response->headers->get('x-debug-token'), 'route' => $request->attributes->get('_route', 'n/a'), 'method' => $request->getMethod(), 'controller' => $this->parseController($request->attributes->get('_controller')), 'status_code' => $statusCode, 'status_text' => Response::$statusTexts[(int) $statusCode], - )) + ]) )); } @@ -159,7 +159,7 @@ public function lateCollect() public function reset() { - $this->data = array(); + $this->data = []; $this->controllers = new \SplObjectStorage(); } @@ -284,7 +284,7 @@ public function getIdentifier() */ public function getRouteParams() { - return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params']->getValue() : array(); + return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params']->getValue() : []; } /** @@ -327,10 +327,10 @@ public function onKernelResponse(FilterResponseEvent $event) public static function getSubscribedEvents() { - return array( + return [ KernelEvents::CONTROLLER => 'onKernelController', KernelEvents::RESPONSE => 'onKernelResponse', - ); + ]; } /** @@ -358,21 +358,21 @@ protected function parseController($controller) try { $r = new \ReflectionMethod($controller[0], $controller[1]); - return array( + return [ 'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0], 'method' => $controller[1], 'file' => $r->getFileName(), 'line' => $r->getStartLine(), - ); + ]; } catch (\ReflectionException $e) { if (\is_callable($controller)) { // using __call or __callStatic - return array( + return [ 'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0], 'method' => $controller[1], 'file' => 'n/a', 'line' => 'n/a', - ); + ]; } } } @@ -380,23 +380,36 @@ protected function parseController($controller) if ($controller instanceof \Closure) { $r = new \ReflectionFunction($controller); - return array( + $controller = [ 'class' => $r->getName(), 'method' => null, 'file' => $r->getFileName(), 'line' => $r->getStartLine(), - ); + ]; + + if (false !== strpos($r->name, '{closure}')) { + return $controller; + } + $controller['method'] = $r->name; + + if ($class = $r->getClosureScopeClass()) { + $controller['class'] = $class->name; + } else { + return $r->name; + } + + return $controller; } if (\is_object($controller)) { $r = new \ReflectionClass($controller); - return array( + return [ 'class' => $r->getName(), 'method' => null, 'file' => $r->getFileName(), 'line' => $r->getStartLine(), - ); + ]; } return \is_string($controller) ? $controller : 'n/a'; diff --git a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php index 481747b3c83963a9d45e4b344065633f1571d1fd..432dc3618f8c0900be0b8fa370f2d96a03f1831b 100644 --- a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php @@ -54,11 +54,11 @@ public function reset() { $this->controllers = new \SplObjectStorage(); - $this->data = array( + $this->data = [ 'redirect' => false, 'url' => null, 'route' => null, - ); + ]; } protected function guessRoute(Request $request, $controller) diff --git a/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php b/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php index e489d77598620b77971f2618ae914333030d42dc..99149ab0be5694c573c128153a0f3c3bfceb628d 100644 --- a/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php @@ -43,11 +43,11 @@ public function collect(Request $request, Response $response, \Exception $except $startTime = $request->server->get('REQUEST_TIME_FLOAT'); } - $this->data = array( + $this->data = [ 'token' => $response->headers->get('X-Debug-Token'), 'start_time' => $startTime * 1000, - 'events' => array(), - ); + 'events' => [], + ]; } /** @@ -55,7 +55,7 @@ public function collect(Request $request, Response $response, \Exception $except */ public function reset() { - $this->data = array(); + $this->data = []; if (null !== $this->stopwatch) { $this->stopwatch->reset(); diff --git a/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php b/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php index e30b3a50298503b4a05ffb7c364727cb9e038e8a..36570b4d5fa43b955d68a50cc87dfb905a61edfb 100644 --- a/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php +++ b/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php @@ -50,7 +50,7 @@ public function exportValue($value, $depth = 1, $deep = false) $indent = str_repeat(' ', $depth); - $a = array(); + $a = []; foreach ($value as $k => $v) { if (\is_array($v)) { $deep = true; diff --git a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php index 4d4ae9b003ef6be214f529987db406471667b841..af65f7ec5725d8a124de0ace2213559ae3920021 100644 --- a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php +++ b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php @@ -36,7 +36,7 @@ public function __construct($fileLinkFormat = null, RequestStack $requestStack = $fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); if ($fileLinkFormat && !\is_array($fileLinkFormat)) { $i = strpos($f = $fileLinkFormat, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f); - $fileLinkFormat = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); + $fileLinkFormat = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); } $this->fileLinkFormat = $fileLinkFormat; @@ -55,21 +55,27 @@ public function format($file, $line) } } - return strtr($fmt[0], array('%f' => $file, '%l' => $line)); + return strtr($fmt[0], ['%f' => $file, '%l' => $line]); } return false; } + /** + * @internal + */ public function serialize() { return serialize($this->getFileLinkFormat()); } + /** + * @internal + */ public function unserialize($serialized) { if (\PHP_VERSION_ID >= 70000) { - $this->fileLinkFormat = unserialize($serialized, array('allowed_classes' => false)); + $this->fileLinkFormat = unserialize($serialized, ['allowed_classes' => false]); } else { $this->fileLinkFormat = unserialize($serialized); } @@ -99,10 +105,10 @@ private function getFileLinkFormat() return; } - return array( - $request->getSchemeAndHttpHost().$request->getBaseUrl().$this->urlFormat, + return [ + $request->getSchemeAndHttpHost().$request->getBasePath().$this->urlFormat, $this->baseDir.\DIRECTORY_SEPARATOR, '', - ); + ]; } } } diff --git a/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php b/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php index 645e8f30ff15872b9a5d521a77570fcf566b6dc4..8bb03bd0c78d084a6779d727cfd69e0cb61fc393 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php @@ -36,8 +36,8 @@ public function __construct(Kernel $kernel) */ public function process(ContainerBuilder $container) { - $classes = array(); - $annotatedClasses = array(); + $classes = []; + $annotatedClasses = []; foreach ($container->getExtensions() as $extension) { if ($extension instanceof Extension) { if (\PHP_VERSION_ID < 70000) { @@ -63,11 +63,11 @@ public function process(ContainerBuilder $container) * @param array $patterns The class patterns to expand * @param array $classes The existing classes to match against the patterns * - * @return array A list of classes derivated from the patterns + * @return array A list of classes derived from the patterns */ private function expandClasses(array $patterns, array $classes) { - $expanded = array(); + $expanded = []; // Explicit classes declared in the patterns are returned directly foreach ($patterns as $key => $pattern) { @@ -93,7 +93,7 @@ private function expandClasses(array $patterns, array $classes) private function getClassesInComposerClassMaps() { - $classes = array(); + $classes = []; foreach (spl_autoload_functions() as $function) { if (!\is_array($function)) { @@ -114,14 +114,14 @@ private function getClassesInComposerClassMaps() private function patternsToRegexps($patterns) { - $regexps = array(); + $regexps = []; foreach ($patterns as $pattern) { // Escape user input $regex = preg_quote(ltrim($pattern, '\\')); // Wildcards * and ** - $regex = strtr($regex, array('\\*\\*' => '.*?', '\\*' => '[^\\\\]*?')); + $regex = strtr($regex, ['\\*\\*' => '.*?', '\\*' => '[^\\\\]*?']); // If this class does not end by a slash, anchor the end if ('\\' !== substr($regex, -1)) { diff --git a/vendor/symfony/http-kernel/DependencyInjection/Extension.php b/vendor/symfony/http-kernel/DependencyInjection/Extension.php index a382c15d67b264014955afd343962d1b7a7ede08..ec69392e535de28d816fdd0f697470bb0e7760a9 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/Extension.php +++ b/vendor/symfony/http-kernel/DependencyInjection/Extension.php @@ -20,8 +20,8 @@ */ abstract class Extension extends BaseExtension { - private $classes = array(); - private $annotatedClasses = array(); + private $classes = []; + private $annotatedClasses = []; /** * Gets the classes to cache. diff --git a/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php b/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php index 06a39c8bc015299730774d5699ccfceeb16d3c99..a15fbaa17212582ea94e4f44461b5bcb4a648278 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php @@ -45,7 +45,7 @@ public function process(ContainerBuilder $container) } $definition = $container->getDefinition($this->handlerService); - $renderers = array(); + $renderers = []; foreach ($container->findTaggedServiceIds($this->rendererTag, true) as $id => $tags) { $def = $container->getDefinition($id); $class = $container->getParameterBag()->resolveValue($def->getClass()); diff --git a/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php b/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php index 00b05959cf38535bf3c6b2431284e5be5da0c4ee..1722ef58b167eb9927448fd13ad3cb613deedf79 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php +++ b/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php @@ -26,8 +26,8 @@ class LazyLoadingFragmentHandler extends FragmentHandler /** * @deprecated since version 3.3, to be removed in 4.0 */ - private $rendererIds = array(); - private $initialized = array(); + private $rendererIds = []; + private $initialized = []; /** * @param ContainerInterface $container A container @@ -38,7 +38,7 @@ public function __construct(ContainerInterface $container, RequestStack $request { $this->container = $container; - parent::__construct($requestStack, array(), $debug); + parent::__construct($requestStack, [], $debug); } /** @@ -59,7 +59,7 @@ public function addRendererService($name, $renderer) /** * {@inheritdoc} */ - public function render($uri, $renderer = 'inline', array $options = array()) + public function render($uri, $renderer = 'inline', array $options = []) { // BC 3.x, to be removed in 4.0 if (isset($this->rendererIds[$renderer])) { diff --git a/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php b/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php index 1dbf7f7beeedf22fbb3f5285c463903c9dc26992..83e1b758de75b520c46e26973793a39013fa3cc8 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php @@ -32,7 +32,7 @@ public function process(ContainerBuilder $container) { foreach ($this->extensions as $extension) { if (!\count($container->getExtensionConfig($extension))) { - $container->loadFromExtension($extension, array()); + $container->loadFromExtension($extension, []); } } diff --git a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php index cb05f6fbeb4e137ced091100c6142bbf361f1427..d021c6ee8a12663ca0af24b512ea95713a7a0987 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php @@ -47,7 +47,7 @@ public function process(ContainerBuilder $container) } $parameterBag = $container->getParameterBag(); - $controllers = array(); + $controllers = []; foreach ($container->findTaggedServiceIds($this->controllerTag, true) as $id => $tags) { $def = $container->getDefinition($id); @@ -70,14 +70,14 @@ public function process(ContainerBuilder $container) $isContainerAware = $r->implementsInterface(ContainerAwareInterface::class) || is_subclass_of($class, AbstractController::class); // get regular public methods - $methods = array(); - $arguments = array(); + $methods = []; + $arguments = []; foreach ($r->getMethods(\ReflectionMethod::IS_PUBLIC) as $r) { if ('setContainer' === $r->name && $isContainerAware) { continue; } if (!$r->isConstructor() && !$r->isDestructor() && !$r->isAbstract()) { - $methods[strtolower($r->name)] = array($r, $r->getParameters()); + $methods[strtolower($r->name)] = [$r, $r->getParameters()]; } } @@ -87,7 +87,7 @@ public function process(ContainerBuilder $container) $autowire = true; continue; } - foreach (array('action', 'argument', 'id') as $k) { + foreach (['action', 'argument', 'id'] as $k) { if (!isset($attributes[$k][0])) { throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "%s" %s for service "%s".', $k, $this->controllerTag, json_encode($attributes, JSON_UNESCAPED_UNICODE), $id)); } @@ -117,7 +117,7 @@ public function process(ContainerBuilder $container) /** @var \ReflectionMethod $r */ // create a per-method map of argument-names to service/type-references - $args = array(); + $args = []; foreach ($parameters as $p) { /** @var \ReflectionParameter $p */ $type = $target = ProxyHelper::getTypeHint($r, $p, true); @@ -141,7 +141,7 @@ public function process(ContainerBuilder $container) continue; } - $binding->setValues(array($bindingValue, $bindingId, true)); + $binding->setValues([$bindingValue, $bindingId, true]); $args[$p->name] = $bindingValue; continue; diff --git a/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php b/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php index 29433a6d5b19581f77a1ebd6ac8554300d02d53c..28136be625427fdc74a6c001123e60e6d16efecf 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php @@ -39,7 +39,7 @@ public function process(ContainerBuilder $container) return; } - $services = $methods = array(); + $services = $methods = []; foreach ($container->findTaggedServiceIds($this->tagName, true) as $id => $tags) { $services[$id] = new Reference($id, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE); diff --git a/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php index 41187d4125d979b108f023bd00d795a44120836f..aee5d6f88f50b7c07d3dd82f4cadc8fd09adf54d 100644 --- a/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php @@ -26,7 +26,7 @@ */ abstract class AbstractSessionListener implements EventSubscriberInterface { - private $sessionUsageStack = array(); + private $sessionUsageStack = []; public function onKernelRequest(GetResponseEvent $event) { @@ -74,12 +74,12 @@ public function onFinishRequest(FinishRequestEvent $event) public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 128), + return [ + KernelEvents::REQUEST => ['onKernelRequest', 128], // low priority to come after regular response listeners, same as SaveSessionListener - KernelEvents::RESPONSE => array('onKernelResponse', -1000), - KernelEvents::FINISH_REQUEST => array('onFinishRequest'), - ); + KernelEvents::RESPONSE => ['onKernelResponse', -1000], + KernelEvents::FINISH_REQUEST => ['onFinishRequest'], + ]; } /** diff --git a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php index cb5da50bd086041da1c1e30d2c699f72604128a4..714b315a3240fcac345375a3ed93f80c781c076f 100644 --- a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php @@ -85,10 +85,10 @@ public function onKernelResponse(FilterResponseEvent $event) public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 192), - KernelEvents::RESPONSE => array('onKernelResponse', -128), - ); + return [ + KernelEvents::REQUEST => ['onKernelRequest', 192], + KernelEvents::RESPONSE => ['onKernelResponse', -128], + ]; } /** diff --git a/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php b/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php index 5ec528417c987b78e5f0b78980cd778468ba3a0d..68d806af01ecd26cff64245ecd95a0a32ad8c2ab 100644 --- a/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php +++ b/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php @@ -45,6 +45,6 @@ public function onKernelRequest(GetResponseEvent $event) */ public static function getSubscribedEvents() { - return array(KernelEvents::REQUEST => array('onKernelRequest', 1)); + return [KernelEvents::REQUEST => ['onKernelRequest', 1]]; } } diff --git a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php b/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php index 04137c746861b90b7dd121c886ebf54a85103217..77f9e2f61839c930d80b200eb2ca4d85498990e8 100644 --- a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php +++ b/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php @@ -145,10 +145,10 @@ public function configure(Event $event = null) public static function getSubscribedEvents() { - $events = array(KernelEvents::REQUEST => array('configure', 2048)); + $events = [KernelEvents::REQUEST => ['configure', 2048]]; if ('cli' === \PHP_SAPI && \defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { - $events[ConsoleEvents::COMMAND] = array('configure', 2048); + $events[ConsoleEvents::COMMAND] = ['configure', 2048]; } return $events; diff --git a/vendor/symfony/http-kernel/EventListener/DumpListener.php b/vendor/symfony/http-kernel/EventListener/DumpListener.php index de19e13113e59f139dc6065094e9ad55ca5f53a5..2f47d1068cbe83e9da4bdfcaba826ad54a361ef0 100644 --- a/vendor/symfony/http-kernel/EventListener/DumpListener.php +++ b/vendor/symfony/http-kernel/EventListener/DumpListener.php @@ -46,10 +46,10 @@ public function configure() public static function getSubscribedEvents() { if (!class_exists(ConsoleEvents::class)) { - return array(); + return []; } // Register early to have a working dump() as early as possible - return array(ConsoleEvents::COMMAND => array('configure', 1024)); + return [ConsoleEvents::COMMAND => ['configure', 1024]]; } } diff --git a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php index 147e09013dd93fbfd7a1753797c43f921685e247..e7e36d188bdead002a3274f754522c2f6739973f 100644 --- a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php +++ b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php @@ -56,13 +56,12 @@ public function onKernelException(GetResponseForExceptionEvent $event) } catch (\Exception $e) { $this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', \get_class($e), $e->getMessage(), $e->getFile(), $e->getLine())); - $wrapper = $e; - - while ($prev = $wrapper->getPrevious()) { + $prev = $e; + do { if ($exception === $wrapper = $prev) { throw $e; } - } + } while ($prev = $wrapper->getPrevious()); $prev = new \ReflectionProperty($wrapper instanceof \Exception ? \Exception::class : \Error::class, 'previous'); $prev->setAccessible(true); @@ -84,9 +83,9 @@ public function onKernelException(GetResponseForExceptionEvent $event) public static function getSubscribedEvents() { - return array( - KernelEvents::EXCEPTION => array('onKernelException', -128), - ); + return [ + KernelEvents::EXCEPTION => ['onKernelException', -128], + ]; } /** @@ -99,9 +98,9 @@ protected function logException(\Exception $exception, $message) { if (null !== $this->logger) { if (!$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500) { - $this->logger->critical($message, array('exception' => $exception)); + $this->logger->critical($message, ['exception' => $exception]); } else { - $this->logger->error($message, array('exception' => $exception)); + $this->logger->error($message, ['exception' => $exception]); } } } @@ -112,15 +111,15 @@ protected function logException(\Exception $exception, $message) * @param \Exception $exception The thrown exception * @param Request $request The original request * - * @return Request $request The cloned request + * @return Request The cloned request */ protected function duplicateRequest(\Exception $exception, Request $request) { - $attributes = array( + $attributes = [ '_controller' => $this->controller, 'exception' => FlattenException::create($exception), 'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null, - ); + ]; $request = $request->duplicate(null, null, $attributes); $request->setMethod('GET'); diff --git a/vendor/symfony/http-kernel/EventListener/FragmentListener.php b/vendor/symfony/http-kernel/EventListener/FragmentListener.php index 574d7c05c94364fa41fe3ef8e52c0e18732abbf2..1333120e2dd106d40ef51f44b965311c5dbb2abf 100644 --- a/vendor/symfony/http-kernel/EventListener/FragmentListener.php +++ b/vendor/symfony/http-kernel/EventListener/FragmentListener.php @@ -70,7 +70,7 @@ public function onKernelRequest(GetResponseEvent $event) parse_str($request->query->get('_path', ''), $attributes); $request->attributes->add($attributes); - $request->attributes->set('_route_params', array_replace($request->attributes->get('_route_params', array()), $attributes)); + $request->attributes->set('_route_params', array_replace($request->attributes->get('_route_params', []), $attributes)); $request->query->remove('_path'); } @@ -92,8 +92,8 @@ protected function validateRequest(Request $request) public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array(array('onKernelRequest', 48)), - ); + return [ + KernelEvents::REQUEST => [['onKernelRequest', 48]], + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/LocaleListener.php b/vendor/symfony/http-kernel/EventListener/LocaleListener.php index ed0236efc85e8ad5fe455ff5c6b3935ec92c1688..c7e32dbb230899f140289fc2531eb7c986b7a451 100644 --- a/vendor/symfony/http-kernel/EventListener/LocaleListener.php +++ b/vendor/symfony/http-kernel/EventListener/LocaleListener.php @@ -74,10 +74,10 @@ private function setRouterContext(Request $request) public static function getSubscribedEvents() { - return array( + return [ // must be registered after the Router to have access to the _locale - KernelEvents::REQUEST => array(array('onKernelRequest', 16)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); + KernelEvents::REQUEST => [['onKernelRequest', 16]], + KernelEvents::FINISH_REQUEST => [['onKernelFinishRequest', 0]], + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/ProfilerListener.php b/vendor/symfony/http-kernel/EventListener/ProfilerListener.php index 2e54a92f08146846e6a3e5afba1ce04ec6e83bd6..5304b8097bec5f39ee2776a9d4679abd1b2a83e8 100644 --- a/vendor/symfony/http-kernel/EventListener/ProfilerListener.php +++ b/vendor/symfony/http-kernel/EventListener/ProfilerListener.php @@ -119,10 +119,10 @@ public function onKernelTerminate(PostResponseEvent $event) public static function getSubscribedEvents() { - return array( - KernelEvents::RESPONSE => array('onKernelResponse', -100), + return [ + KernelEvents::RESPONSE => ['onKernelResponse', -100], KernelEvents::EXCEPTION => 'onKernelException', - KernelEvents::TERMINATE => array('onKernelTerminate', -1024), - ); + KernelEvents::TERMINATE => ['onKernelTerminate', -1024], + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/ResponseListener.php b/vendor/symfony/http-kernel/EventListener/ResponseListener.php index f24784527bb8e21ea5b8f153d7b03585c0e16b76..43527b7ffc2df733c0124862bc43338992bb35f4 100644 --- a/vendor/symfony/http-kernel/EventListener/ResponseListener.php +++ b/vendor/symfony/http-kernel/EventListener/ResponseListener.php @@ -49,8 +49,8 @@ public function onKernelResponse(FilterResponseEvent $event) public static function getSubscribedEvents() { - return array( + return [ KernelEvents::RESPONSE => 'onKernelResponse', - ); + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/RouterListener.php b/vendor/symfony/http-kernel/EventListener/RouterListener.php index ab5c86cdd0e8247a400c47d9a24789421a7024c5..378327b57410917f22a37326f8261e2ffcea8f83 100644 --- a/vendor/symfony/http-kernel/EventListener/RouterListener.php +++ b/vendor/symfony/http-kernel/EventListener/RouterListener.php @@ -118,12 +118,12 @@ public function onKernelRequest(GetResponseEvent $event) } if (null !== $this->logger) { - $this->logger->info('Matched route "{route}".', array( + $this->logger->info('Matched route "{route}".', [ 'route' => isset($parameters['_route']) ? $parameters['_route'] : 'n/a', 'route_parameters' => $parameters, 'request_uri' => $request->getUri(), 'method' => $request->getMethod(), - )); + ]); } $request->attributes->add($parameters); @@ -157,11 +157,11 @@ public function onKernelException(GetResponseForExceptionEvent $event) public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array(array('onKernelRequest', 32)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - KernelEvents::EXCEPTION => array('onKernelException', -64), - ); + return [ + KernelEvents::REQUEST => [['onKernelRequest', 32]], + KernelEvents::FINISH_REQUEST => [['onKernelFinishRequest', 0]], + KernelEvents::EXCEPTION => ['onKernelException', -64], + ]; } private function createWelcomeResponse() diff --git a/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php b/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php index 36809b59af914aecf4865a91a673b8ec87b68f8d..5901200a70f723ea7582686786c23d7eb0c7f51d 100644 --- a/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php @@ -58,9 +58,9 @@ public function onKernelResponse(FilterResponseEvent $event) public static function getSubscribedEvents() { - return array( + return [ // low priority but higher than StreamedResponseListener - KernelEvents::RESPONSE => array(array('onKernelResponse', -1000)), - ); + KernelEvents::RESPONSE => [['onKernelResponse', -1000]], + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php b/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php index 2c616b9182b3bcb87148ed33af7f3e74d3558d96..895176a931ae38f7d5409bb9effe425c8f96e6a5 100644 --- a/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php +++ b/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php @@ -42,8 +42,8 @@ public function onKernelResponse(FilterResponseEvent $event) public static function getSubscribedEvents() { - return array( - KernelEvents::RESPONSE => array('onKernelResponse', -1024), - ); + return [ + KernelEvents::RESPONSE => ['onKernelResponse', -1024], + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/SurrogateListener.php b/vendor/symfony/http-kernel/EventListener/SurrogateListener.php index 634353385715f4a893d7ef98f72486e82511a4f0..0fddddde4233b8b4f506d098d50ac084c2a78409 100644 --- a/vendor/symfony/http-kernel/EventListener/SurrogateListener.php +++ b/vendor/symfony/http-kernel/EventListener/SurrogateListener.php @@ -58,8 +58,8 @@ public function onKernelResponse(FilterResponseEvent $event) public static function getSubscribedEvents() { - return array( + return [ KernelEvents::RESPONSE => 'onKernelResponse', - ); + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/TranslatorListener.php b/vendor/symfony/http-kernel/EventListener/TranslatorListener.php index 2a5fc712807d5e4563a74fc27386c67541dc65e8..0f506061a66a36a91ccfdd4cf61b755cd921d2a3 100644 --- a/vendor/symfony/http-kernel/EventListener/TranslatorListener.php +++ b/vendor/symfony/http-kernel/EventListener/TranslatorListener.php @@ -51,11 +51,11 @@ public function onKernelFinishRequest(FinishRequestEvent $event) public static function getSubscribedEvents() { - return array( + return [ // must be registered after the Locale listener - KernelEvents::REQUEST => array(array('onKernelRequest', 10)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); + KernelEvents::REQUEST => [['onKernelRequest', 10]], + KernelEvents::FINISH_REQUEST => [['onKernelFinishRequest', 0]], + ]; } private function setLocale(Request $request) diff --git a/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php b/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php index a33853f727badd875cd7b1593e2c64cf38a12ca0..2e921869b92f1e5fe43dc6595c37e2e67f0795a7 100644 --- a/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php +++ b/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php @@ -44,10 +44,10 @@ public function onKernelRequest(GetResponseEvent $event) */ public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array( - array('onKernelRequest', 256), - ), - ); + return [ + KernelEvents::REQUEST => [ + ['onKernelRequest', 256], + ], + ]; } } diff --git a/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php b/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php index 39418842666b2f8a9fca09df20fa876efbf15416..05fe7c4a40b38924f36d92f07ef32c110594ee12 100644 --- a/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php +++ b/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php @@ -24,6 +24,6 @@ class AccessDeniedHttpException extends HttpException */ public function __construct($message = null, \Exception $previous = null, $code = 0) { - parent::__construct(403, $message, $previous, array(), $code); + parent::__construct(403, $message, $previous, [], $code); } } diff --git a/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php b/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php index c28d83739c7a54e043fa050dad50ee9ddfd8794a..683ef1a99ecc645732fd4d51c94cb432d543c964 100644 --- a/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php +++ b/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php @@ -23,6 +23,6 @@ class BadRequestHttpException extends HttpException */ public function __construct($message = null, \Exception $previous = null, $code = 0) { - parent::__construct(400, $message, $previous, array(), $code); + parent::__construct(400, $message, $previous, [], $code); } } diff --git a/vendor/symfony/http-kernel/Exception/ConflictHttpException.php b/vendor/symfony/http-kernel/Exception/ConflictHttpException.php index 79f24f2e56dc0a52e63b8ed50c0c8644b5c21de6..aaf258a07da807840bf07017c2cef41bb9e51505 100644 --- a/vendor/symfony/http-kernel/Exception/ConflictHttpException.php +++ b/vendor/symfony/http-kernel/Exception/ConflictHttpException.php @@ -23,6 +23,6 @@ class ConflictHttpException extends HttpException */ public function __construct($message = null, \Exception $previous = null, $code = 0) { - parent::__construct(409, $message, $previous, array(), $code); + parent::__construct(409, $message, $previous, [], $code); } } diff --git a/vendor/symfony/http-kernel/Exception/GoneHttpException.php b/vendor/symfony/http-kernel/Exception/GoneHttpException.php index 84e6915df70f7acd8563a006cb262f9a7bf2a9a0..f855ba02c820e96e2a3190e2569790d3bff1f529 100644 --- a/vendor/symfony/http-kernel/Exception/GoneHttpException.php +++ b/vendor/symfony/http-kernel/Exception/GoneHttpException.php @@ -23,6 +23,6 @@ class GoneHttpException extends HttpException */ public function __construct($message = null, \Exception $previous = null, $code = 0) { - parent::__construct(410, $message, $previous, array(), $code); + parent::__construct(410, $message, $previous, [], $code); } } diff --git a/vendor/symfony/http-kernel/Exception/HttpException.php b/vendor/symfony/http-kernel/Exception/HttpException.php index e8e37605838cc6efb93b40d1e32a209fb6f798bc..809d29e6e32fc079cda42ceb5e4ca98e803599e1 100644 --- a/vendor/symfony/http-kernel/Exception/HttpException.php +++ b/vendor/symfony/http-kernel/Exception/HttpException.php @@ -21,7 +21,7 @@ class HttpException extends \RuntimeException implements HttpExceptionInterface private $statusCode; private $headers; - public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = array(), $code = 0) + public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = [], $code = 0) { $this->statusCode = $statusCode; $this->headers = $headers; diff --git a/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php b/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php index 645efe87d7c23f1c85f94311e794a0d9547c1420..8ad08f4208402b6605cf6fe5787ceb94883866aa 100644 --- a/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php +++ b/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php @@ -23,6 +23,6 @@ class LengthRequiredHttpException extends HttpException */ public function __construct($message = null, \Exception $previous = null, $code = 0) { - parent::__construct(411, $message, $previous, array(), $code); + parent::__construct(411, $message, $previous, [], $code); } } diff --git a/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php b/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php index e308a5fee2767ecaf077d1127598f1307eb3c062..f256ef8615b1f4d38d86bda011d583d67c0637b8 100644 --- a/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php +++ b/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php @@ -24,7 +24,7 @@ class MethodNotAllowedHttpException extends HttpException */ public function __construct(array $allow, $message = null, \Exception $previous = null, $code = 0) { - $headers = array('Allow' => strtoupper(implode(', ', $allow))); + $headers = ['Allow' => strtoupper(implode(', ', $allow))]; parent::__construct(405, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php b/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php index 097a13fd9bc05aaa8169db436c8534081ff0a434..a48bbe70ebc1806495f64c9e65fa72e688bfa262 100644 --- a/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php +++ b/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php @@ -23,6 +23,6 @@ class NotAcceptableHttpException extends HttpException */ public function __construct($message = null, \Exception $previous = null, $code = 0) { - parent::__construct(406, $message, $previous, array(), $code); + parent::__construct(406, $message, $previous, [], $code); } } diff --git a/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php b/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php index 878173cc7b9ace62fe3b035ecd2a35f6eca1058b..01a5bd080c6758902dce57be0fefa31e1db14443 100644 --- a/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php +++ b/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php @@ -23,6 +23,6 @@ class NotFoundHttpException extends HttpException */ public function __construct($message = null, \Exception $previous = null, $code = 0) { - parent::__construct(404, $message, $previous, array(), $code); + parent::__construct(404, $message, $previous, [], $code); } } diff --git a/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php b/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php index 9f13a624cc0fb487594fb38c2ef1d07fd8f175f2..3cf33f988a298c44b0086ffecd21a34489d1b716 100644 --- a/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php +++ b/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php @@ -23,6 +23,6 @@ class PreconditionFailedHttpException extends HttpException */ public function __construct($message = null, \Exception $previous = null, $code = 0) { - parent::__construct(412, $message, $previous, array(), $code); + parent::__construct(412, $message, $previous, [], $code); } } diff --git a/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php b/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php index 9d0a36d7d34d600b26b32eac42e11f28dbb9a114..a2512c5c1bb9213819cc8f0b24abba3253c68198 100644 --- a/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php +++ b/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php @@ -25,6 +25,6 @@ class PreconditionRequiredHttpException extends HttpException */ public function __construct($message = null, \Exception $previous = null, $code = 0) { - parent::__construct(428, $message, $previous, array(), $code); + parent::__construct(428, $message, $previous, [], $code); } } diff --git a/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php b/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php index b2767c3fd5bccc809f5efa55e59d0b7d65bb302b..52ce75132f538ae8a58b538a0d2b27442ffb3275 100644 --- a/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php +++ b/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php @@ -24,9 +24,9 @@ class ServiceUnavailableHttpException extends HttpException */ public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0) { - $headers = array(); + $headers = []; if ($retryAfter) { - $headers = array('Retry-After' => $retryAfter); + $headers = ['Retry-After' => $retryAfter]; } parent::__construct(503, $message, $previous, $headers, $code); diff --git a/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php b/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php index 7d8a803323b7c4d4c428f205749160d5d523e8a5..d313f7ead85e15c43e0139f20a4e1b27a982c399 100644 --- a/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php +++ b/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php @@ -26,9 +26,9 @@ class TooManyRequestsHttpException extends HttpException */ public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0) { - $headers = array(); + $headers = []; if ($retryAfter) { - $headers = array('Retry-After' => $retryAfter); + $headers = ['Retry-After' => $retryAfter]; } parent::__construct(429, $message, $previous, $headers, $code); diff --git a/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php b/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php index 05ac875c552e210bc8d9ea42692f9986a8193fd7..d945df2bc8104d5d2ccd26193b9557e53eb4c3df 100644 --- a/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php +++ b/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php @@ -24,7 +24,7 @@ class UnauthorizedHttpException extends HttpException */ public function __construct($challenge, $message = null, \Exception $previous = null, $code = 0) { - $headers = array('WWW-Authenticate' => $challenge); + $headers = ['WWW-Authenticate' => $challenge]; parent::__construct(401, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php b/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php index 01b8b8465a1a3aed60ba08ae3f1b2ffd2024c337..2263a31253ce2622db2a2ed0324503ddffac8df5 100644 --- a/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php +++ b/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php @@ -23,6 +23,6 @@ class UnprocessableEntityHttpException extends HttpException */ public function __construct($message = null, \Exception $previous = null, $code = 0) { - parent::__construct(422, $message, $previous, array(), $code); + parent::__construct(422, $message, $previous, [], $code); } } diff --git a/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php b/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php index 6913504e832dc41c75616884035b1e3b895d0280..75f844ab57769027923f019c97aaa04f77a59710 100644 --- a/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php +++ b/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php @@ -23,6 +23,6 @@ class UnsupportedMediaTypeHttpException extends HttpException */ public function __construct($message = null, \Exception $previous = null, $code = 0) { - parent::__construct(415, $message, $previous, array(), $code); + parent::__construct(415, $message, $previous, [], $code); } } diff --git a/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php index 3c8934ff893489902a21b20a71ee39786c210309..430486e549885a24148a858845feafbc4d2625e0 100644 --- a/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php @@ -59,7 +59,7 @@ public function __construct(SurrogateInterface $surrogate = null, FragmentRender * * @see Symfony\Component\HttpKernel\HttpCache\SurrogateInterface */ - public function render($uri, Request $request, array $options = array()) + public function render($uri, Request $request, array $options = []) { if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) { if ($uri instanceof ControllerReference && $this->containsNonScalars($uri->attributes)) { diff --git a/vendor/symfony/http-kernel/Fragment/FragmentHandler.php b/vendor/symfony/http-kernel/Fragment/FragmentHandler.php index f11db73dc90c21dd9c90202f54fd635b098a95cc..f40da0018bc17ca78f7f1b3d75b57fac867f45e0 100644 --- a/vendor/symfony/http-kernel/Fragment/FragmentHandler.php +++ b/vendor/symfony/http-kernel/Fragment/FragmentHandler.php @@ -29,7 +29,7 @@ class FragmentHandler { private $debug; - private $renderers = array(); + private $renderers = []; private $requestStack; /** @@ -37,7 +37,7 @@ class FragmentHandler * @param FragmentRendererInterface[] $renderers An array of FragmentRendererInterface instances * @param bool $debug Whether the debug mode is enabled or not */ - public function __construct(RequestStack $requestStack, array $renderers = array(), $debug = false) + public function __construct(RequestStack $requestStack, array $renderers = [], $debug = false) { $this->requestStack = $requestStack; foreach ($renderers as $renderer) { @@ -70,7 +70,7 @@ public function addRenderer(FragmentRendererInterface $renderer) * @throws \InvalidArgumentException when the renderer does not exist * @throws \LogicException when no master request is being handled */ - public function render($uri, $renderer = 'inline', array $options = array()) + public function render($uri, $renderer = 'inline', array $options = []) { if (!isset($options['ignore_errors'])) { $options['ignore_errors'] = !$this->debug; diff --git a/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php b/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php index bcf4e9944a9dd200d744b6d4144965e2d2cab48f..8e454a01a6ecbef50762c1af9bce46618ceb3d11 100644 --- a/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php +++ b/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php @@ -31,7 +31,7 @@ interface FragmentRendererInterface * * @return Response A Response instance */ - public function render($uri, Request $request, array $options = array()); + public function render($uri, Request $request, array $options = []); /** * Gets the name of the strategy. diff --git a/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php index f7150c1979b4b93408572bdb11cc534b5a2cd547..a0abc058819af5fda1dc03a1e7a55e18e9162342 100644 --- a/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php @@ -81,7 +81,7 @@ public function hasTemplating() * * id: An optional hx:include tag id attribute * * attributes: An optional array of hx:include tag attributes */ - public function render($uri, Request $request, array $options = array()) + public function render($uri, Request $request, array $options = []) { if ($uri instanceof ControllerReference) { if (null === $this->signer) { @@ -102,7 +102,7 @@ public function render($uri, Request $request, array $options = array()) $content = $template; } - $attributes = isset($options['attributes']) && \is_array($options['attributes']) ? $options['attributes'] : array(); + $attributes = isset($options['attributes']) && \is_array($options['attributes']) ? $options['attributes'] : []; if (isset($options['id']) && $options['id']) { $attributes['id'] = $options['id']; } diff --git a/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php index 712248578d0a7dababdc2b4e68d4d85263d5477a..ce88bd45dea26abf8835ff0344853b513c87e223 100644 --- a/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php @@ -43,7 +43,7 @@ public function __construct(HttpKernelInterface $kernel, EventDispatcherInterfac * * * alt: an alternative URI to render in case of an error */ - public function render($uri, Request $request, array $options = array()) + public function render($uri, Request $request, array $options = []) { $reference = null; if ($uri instanceof ControllerReference) { @@ -54,10 +54,10 @@ public function render($uri, Request $request, array $options = array()) // want that as we want to preserve objects (so we manually set Request attributes // below instead) $attributes = $reference->attributes; - $reference->attributes = array(); + $reference->attributes = []; // The request format and locale might have been overridden by the user - foreach (array('_format', '_locale') as $key) { + foreach (['_format', '_locale'] as $key) { if (isset($attributes[$key])) { $reference->attributes[$key] = $attributes[$key]; } @@ -80,7 +80,7 @@ public function render($uri, Request $request, array $options = array()) return SubRequestHandler::handle($this->kernel, $subRequest, HttpKernelInterface::SUB_REQUEST, false); } catch (\Exception $e) { // we dispatch the exception event to trigger the logging - // the response that comes back is simply ignored + // the response that comes back is ignored if (isset($options['ignore_errors']) && $options['ignore_errors'] && $this->dispatcher) { $event = new GetResponseForExceptionEvent($this->kernel, $request, HttpKernelInterface::SUB_REQUEST, $e); @@ -113,7 +113,7 @@ protected function createSubRequest($uri, Request $request) unset($server['HTTP_IF_MODIFIED_SINCE']); unset($server['HTTP_IF_NONE_MATCH']); - $subRequest = Request::create($uri, 'get', array(), $cookies, array(), $server); + $subRequest = Request::create($uri, 'get', [], $cookies, [], $server); if ($request->headers->has('Surrogate-Capability')) { $subRequest->headers->set('Surrogate-Capability', $request->headers->get('Surrogate-Capability')); } @@ -122,6 +122,13 @@ protected function createSubRequest($uri, Request $request) $subRequest->setSession($session); } + if ($request->get('_format')) { + $subRequest->attributes->set('_format', $request->get('_format')); + } + if ($request->getDefaultLocale() !== $request->getLocale()) { + $subRequest->setLocale($request->getLocale()); + } + return $subRequest; } diff --git a/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php b/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php index 3b2d5f262cfcc9e81917f19188a1a1afbed0c855..8918a3057056eac08b807ea5eacf31fda483f89f 100644 --- a/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php +++ b/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php @@ -24,16 +24,16 @@ abstract class AbstractSurrogate implements SurrogateInterface { protected $contentTypes; - protected $phpEscapeMap = array( - array('<?', '<%', '<s', '<S'), - array('<?php echo "<?"; ?>', '<?php echo "<%"; ?>', '<?php echo "<s"; ?>', '<?php echo "<S"; ?>'), - ); + protected $phpEscapeMap = [ + ['<?', '<%', '<s', '<S'], + ['<?php echo "<?"; ?>', '<?php echo "<%"; ?>', '<?php echo "<s"; ?>', '<?php echo "<S"; ?>'], + ]; /** * @param array $contentTypes An array of content-type that should be parsed for Surrogate information * (default: text/html, text/xml, application/xhtml+xml, and application/xml) */ - public function __construct(array $contentTypes = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/xml')) + public function __construct(array $contentTypes = ['text/html', 'text/xml', 'application/xhtml+xml', 'application/xml']) { $this->contentTypes = $contentTypes; } @@ -90,7 +90,7 @@ public function needsParsing(Response $response) */ public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors) { - $subRequest = Request::create($uri, Request::METHOD_GET, array(), $cache->getRequest()->cookies->all(), array(), $cache->getRequest()->server->all()); + $subRequest = Request::create($uri, Request::METHOD_GET, [], $cache->getRequest()->cookies->all(), [], $cache->getRequest()->server->all()); try { $response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true); diff --git a/vendor/symfony/http-kernel/HttpCache/Esi.php b/vendor/symfony/http-kernel/HttpCache/Esi.php index 69134c71a12c43e6e210823dc62a663dd808deb7..dc62990b408c9f92d73fd02b8211dad895b038c9 100644 --- a/vendor/symfony/http-kernel/HttpCache/Esi.php +++ b/vendor/symfony/http-kernel/HttpCache/Esi.php @@ -85,7 +85,7 @@ public function process(Request $request, Response $response) $i = 1; while (isset($chunks[$i])) { - $options = array(); + $options = []; preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER); foreach ($matches as $set) { $options[$set[1]] = $set[2]; diff --git a/vendor/symfony/http-kernel/HttpCache/HttpCache.php b/vendor/symfony/http-kernel/HttpCache/HttpCache.php index 44405209d4a5c6f91734a731014c9e1b23101f6e..daaa928fa38ffc42ccba2d0174f13f9a5dc4d4e2 100644 --- a/vendor/symfony/http-kernel/HttpCache/HttpCache.php +++ b/vendor/symfony/http-kernel/HttpCache/HttpCache.php @@ -32,8 +32,8 @@ class HttpCache implements HttpKernelInterface, TerminableInterface private $request; private $surrogate; private $surrogateCacheStrategy; - private $options = array(); - private $traces = array(); + private $options = []; + private $traces = []; /** * Constructor. @@ -70,30 +70,30 @@ class HttpCache implements HttpKernelInterface, TerminableInterface * This setting is overridden by the stale-if-error HTTP Cache-Control extension * (see RFC 5861). */ - public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = array()) + public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = []) { $this->store = $store; $this->kernel = $kernel; $this->surrogate = $surrogate; // needed in case there is a fatal error because the backend is too slow to respond - register_shutdown_function(array($this->store, 'cleanup')); + register_shutdown_function([$this->store, 'cleanup']); - $this->options = array_merge(array( + $this->options = array_merge([ 'debug' => false, 'default_ttl' => 0, - 'private_headers' => array('Authorization', 'Cookie'), + 'private_headers' => ['Authorization', 'Cookie'], 'allow_reload' => false, 'allow_revalidate' => false, 'stale_while_revalidate' => 2, 'stale_if_error' => 60, - ), $options); + ], $options); } /** * Gets the current store. * - * @return StoreInterface $store A StoreInterface instance + * @return StoreInterface A StoreInterface instance */ public function getStore() { @@ -117,7 +117,7 @@ public function getTraces() */ public function getLog() { - $log = array(); + $log = []; foreach ($this->traces as $request => $traces) { $log[] = sprintf('%s: %s', $request, implode(', ', $traces)); } @@ -164,7 +164,7 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ { // FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-in error page mechanism if (HttpKernelInterface::MASTER_REQUEST === $type) { - $this->traces = array(); + $this->traces = []; // Keep a clone of the original request for surrogates so they can access it. // We must clone here to get a separate instance because the application will modify the request during // the application flow (we know it always does because we do ourselves by setting REMOTE_ADDR to 127.0.0.1 @@ -175,7 +175,7 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ } } - $this->traces[$this->getTraceKey($request)] = array(); + $this->traces[$this->getTraceKey($request)] = []; if (!$request->isMethodSafe(false)) { $response = $this->invalidate($request, $catch); @@ -260,9 +260,9 @@ protected function invalidate(Request $request, $catch = false) $this->store->invalidate($request); // As per the RFC, invalidate Location and Content-Location URLs if present - foreach (array('Location', 'Content-Location') as $header) { + foreach (['Location', 'Content-Location'] as $header) { if ($uri = $response->headers->get($header)) { - $subRequest = Request::create($uri, 'get', array(), array(), array(), $request->server->all()); + $subRequest = Request::create($uri, 'get', [], [], [], $request->server->all()); $this->store->invalidate($subRequest); } @@ -357,7 +357,7 @@ protected function validate(Request $request, Response $entry, $catch = false) // Add our cached etag validator to the environment. // We keep the etags from the client to handle the case when the client // has a different private valid entry which is not cached here. - $cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array(); + $cachedEtags = $entry->getEtag() ? [$entry->getEtag()] : []; $requestEtags = $request->getETags(); if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) { $subRequest->headers->set('if_none_match', implode(', ', $etags)); @@ -377,7 +377,7 @@ protected function validate(Request $request, Response $entry, $catch = false) $entry = clone $entry; $entry->headers->remove('Date'); - foreach (array('Date', 'Expires', 'Cache-Control', 'ETag', 'Last-Modified') as $name) { + foreach (['Date', 'Expires', 'Cache-Control', 'ETag', 'Last-Modified'] as $name) { if ($response->headers->has($name)) { $entry->headers->set($name, $response->headers->get($name)); } @@ -448,7 +448,7 @@ protected function forward(Request $request, $catch = false, Response $entry = n $response = SubRequestHandler::handle($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, $catch); // we don't implement the stale-if-error on Requests, which is nonetheless part of the RFC - if (null !== $entry && \in_array($response->getStatusCode(), array(500, 502, 503, 504))) { + if (null !== $entry && \in_array($response->getStatusCode(), [500, 502, 503, 504])) { if (null === $age = $entry->headers->getCacheControlDirective('stale-if-error')) { $age = $this->options['stale_if_error']; } diff --git a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php b/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php index 672cc893feb6d3dbc3adc9d6b19b415c0420cc1d..862bac557dd773b0988b13a0f93c70edb0c70996 100644 --- a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php +++ b/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php @@ -5,10 +5,6 @@ * * (c) Fabien Potencier <fabien@symfony.com> * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ @@ -28,30 +24,69 @@ */ class ResponseCacheStrategy implements ResponseCacheStrategyInterface { - private $cacheable = true; + /** + * Cache-Control headers that are sent to the final response if they appear in ANY of the responses. + */ + private static $overrideDirectives = ['private', 'no-cache', 'no-store', 'no-transform', 'must-revalidate', 'proxy-revalidate']; + + /** + * Cache-Control headers that are sent to the final response if they appear in ALL of the responses. + */ + private static $inheritDirectives = ['public', 'immutable']; + private $embeddedResponses = 0; - private $ttls = array(); - private $maxAges = array(); private $isNotCacheableResponseEmbedded = false; + private $age = 0; + private $flagDirectives = [ + 'no-cache' => null, + 'no-store' => null, + 'no-transform' => null, + 'must-revalidate' => null, + 'proxy-revalidate' => null, + 'public' => null, + 'private' => null, + 'immutable' => null, + ]; + private $ageDirectives = [ + 'max-age' => null, + 's-maxage' => null, + 'expires' => null, + ]; /** * {@inheritdoc} */ public function add(Response $response) { - if (!$response->isFresh() || !$response->isCacheable()) { - $this->cacheable = false; - } else { - $maxAge = $response->getMaxAge(); - $this->ttls[] = $response->getTtl(); - $this->maxAges[] = $maxAge; - - if (null === $maxAge) { - $this->isNotCacheableResponseEmbedded = true; + ++$this->embeddedResponses; + + foreach (self::$overrideDirectives as $directive) { + if ($response->headers->hasCacheControlDirective($directive)) { + $this->flagDirectives[$directive] = true; } } - ++$this->embeddedResponses; + foreach (self::$inheritDirectives as $directive) { + if (false !== $this->flagDirectives[$directive]) { + $this->flagDirectives[$directive] = $response->headers->hasCacheControlDirective($directive); + } + } + + $age = $response->getAge(); + $this->age = max($this->age, $age); + + if ($this->willMakeFinalResponseUncacheable($response)) { + $this->isNotCacheableResponseEmbedded = true; + + return; + } + + $this->storeRelativeAgeDirective('max-age', $response->headers->getCacheControlDirective('max-age'), $age); + $this->storeRelativeAgeDirective('s-maxage', $response->headers->getCacheControlDirective('s-maxage') ?: $response->headers->getCacheControlDirective('max-age'), $age); + + $expires = $response->getExpires(); + $expires = null !== $expires ? $expires->format('U') - $response->getDate()->format('U') : null; + $this->storeRelativeAgeDirective('expires', $expires >= 0 ? $expires : null, 0); } /** @@ -64,33 +99,124 @@ public function update(Response $response) return; } - // Remove validation related headers in order to avoid browsers using - // their own cache, because some of the response content comes from - // at least one embedded response (which likely has a different caching strategy). - if ($response->isValidateable()) { - $response->setEtag(null); - $response->setLastModified(null); + // Remove validation related headers of the master response, + // because some of the response content comes from at least + // one embedded response (which likely has a different caching strategy). + $response->setEtag(null); + $response->setLastModified(null); + + $this->add($response); + + $response->headers->set('Age', $this->age); + + if ($this->isNotCacheableResponseEmbedded) { + $response->setExpires($response->getDate()); + + if ($this->flagDirectives['no-store']) { + $response->headers->set('Cache-Control', 'no-cache, no-store, must-revalidate'); + } else { + $response->headers->set('Cache-Control', 'no-cache, must-revalidate'); + } + + return; + } + + $flags = array_filter($this->flagDirectives); + + if (isset($flags['must-revalidate'])) { + $flags['no-cache'] = true; } - if (!$response->isFresh() || !$response->isCacheable()) { - $this->cacheable = false; + $response->headers->set('Cache-Control', implode(', ', array_keys($flags))); + + $maxAge = null; + $sMaxage = null; + + if (\is_numeric($this->ageDirectives['max-age'])) { + $maxAge = $this->ageDirectives['max-age'] + $this->age; + $response->headers->addCacheControlDirective('max-age', $maxAge); } - if (!$this->cacheable) { - $response->headers->set('Cache-Control', 'no-cache, must-revalidate'); + if (\is_numeric($this->ageDirectives['s-maxage'])) { + $sMaxage = $this->ageDirectives['s-maxage'] + $this->age; - return; + if ($maxAge !== $sMaxage) { + $response->headers->addCacheControlDirective('s-maxage', $sMaxage); + } + } + + if (\is_numeric($this->ageDirectives['expires'])) { + $date = clone $response->getDate(); + $date->modify('+'.($this->ageDirectives['expires'] + $this->age).' seconds'); + $response->setExpires($date); } + } - $this->ttls[] = $response->getTtl(); - $this->maxAges[] = $response->getMaxAge(); + /** + * RFC2616, Section 13.4. + * + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4 + * + * @return bool + */ + private function willMakeFinalResponseUncacheable(Response $response) + { + // RFC2616: A response received with a status code of 200, 203, 300, 301 or 410 + // MAY be stored by a cache […] unless a cache-control directive prohibits caching. + if ($response->headers->hasCacheControlDirective('no-cache') + || $response->headers->getCacheControlDirective('no-store') + ) { + return true; + } - if ($this->isNotCacheableResponseEmbedded) { - $response->headers->removeCacheControlDirective('s-maxage'); - } elseif (null !== $maxAge = min($this->maxAges)) { - $response->setSharedMaxAge($maxAge); - $response->headers->set('Age', $maxAge - min($this->ttls)); + // Last-Modified and Etag headers cannot be merged, they render the response uncacheable + // by default (except if the response also has max-age etc.). + if (\in_array($response->getStatusCode(), [200, 203, 300, 301, 410]) + && null === $response->getLastModified() + && null === $response->getEtag() + ) { + return false; + } + + // RFC2616: A response received with any other status code (e.g. status codes 302 and 307) + // MUST NOT be returned in a reply to a subsequent request unless there are + // cache-control directives or another header(s) that explicitly allow it. + $cacheControl = ['max-age', 's-maxage', 'must-revalidate', 'proxy-revalidate', 'public', 'private']; + foreach ($cacheControl as $key) { + if ($response->headers->hasCacheControlDirective($key)) { + return false; + } + } + + if ($response->headers->has('Expires')) { + return false; + } + + return true; + } + + /** + * Store lowest max-age/s-maxage/expires for the final response. + * + * The response might have been stored in cache a while ago. To keep things comparable, + * we have to subtract the age so that the value is normalized for an age of 0. + * + * If the value is lower than the currently stored value, we update the value, to keep a rolling + * minimal value of each instruction. If the value is NULL, the directive will not be set on the final response. + * + * @param string $directive + * @param int|null $value + * @param int $age + */ + private function storeRelativeAgeDirective($directive, $value, $age) + { + if (null === $value) { + $this->ageDirectives[$directive] = false; + } + + if (false !== $this->ageDirectives[$directive]) { + $value = $value - $age; + $this->ageDirectives[$directive] = null !== $this->ageDirectives[$directive] ? min($this->ageDirectives[$directive], $value) : $value; } - $response->setMaxAge(0); } } diff --git a/vendor/symfony/http-kernel/HttpCache/Ssi.php b/vendor/symfony/http-kernel/HttpCache/Ssi.php index 58df1760199535ab83823c420ad03bfdb0b09db4..eaaa230b50ee9de21241ad19749e314612f40da9 100644 --- a/vendor/symfony/http-kernel/HttpCache/Ssi.php +++ b/vendor/symfony/http-kernel/HttpCache/Ssi.php @@ -70,7 +70,7 @@ public function process(Request $request, Response $response) $i = 1; while (isset($chunks[$i])) { - $options = array(); + $options = []; preg_match_all('/(virtual)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER); foreach ($matches as $set) { $options[$set[1]] = $set[2]; diff --git a/vendor/symfony/http-kernel/HttpCache/Store.php b/vendor/symfony/http-kernel/HttpCache/Store.php index 990091d0650a5d056ea2c4b4bb5d7f55eef7fb77..ffd4f01aea59f8003c641fd6e2b1d6c56cad3b36 100644 --- a/vendor/symfony/http-kernel/HttpCache/Store.php +++ b/vendor/symfony/http-kernel/HttpCache/Store.php @@ -40,7 +40,7 @@ public function __construct($root) throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root)); } $this->keyCache = new \SplObjectStorage(); - $this->locks = array(); + $this->locks = []; } /** @@ -54,7 +54,7 @@ public function cleanup() fclose($lock); } - $this->locks = array(); + $this->locks = []; } /** @@ -192,11 +192,11 @@ public function write(Request $request, Response $response) } // read existing cache entries, remove non-varying, and add this one to the list - $entries = array(); + $entries = []; $vary = $response->headers->get('vary'); foreach ($this->getMetadata($key) as $entry) { if (!isset($entry[1]['vary'][0])) { - $entry[1]['vary'] = array(''); + $entry[1]['vary'] = ['']; } if ($entry[1]['vary'][0] != $vary || !$this->requestsMatch($vary, $entry[0], $storedEnv)) { @@ -207,7 +207,7 @@ public function write(Request $request, Response $response) $headers = $this->persistResponse($response); unset($headers['age']); - array_unshift($entries, array($storedEnv, $headers)); + array_unshift($entries, [$storedEnv, $headers]); if (false === $this->save($key, serialize($entries))) { throw new \RuntimeException('Unable to store the metadata.'); @@ -236,13 +236,13 @@ public function invalidate(Request $request) $modified = false; $key = $this->getCacheKey($request); - $entries = array(); + $entries = []; foreach ($this->getMetadata($key) as $entry) { $response = $this->restoreResponse($entry[1]); if ($response->isFresh()) { $response->expire(); $modified = true; - $entries[] = array($entry[0], $this->persistResponse($response)); + $entries[] = [$entry[0], $this->persistResponse($response)]; } else { $entries[] = $entry; } @@ -293,7 +293,7 @@ private function requestsMatch($vary, $env1, $env2) private function getMetadata($key) { if (!$entries = $this->load($key)) { - return array(); + return []; } return unserialize($entries); @@ -464,7 +464,7 @@ private function persistRequest(Request $request) private function persistResponse(Response $response) { $headers = $response->headers->all(); - $headers['X-Status'] = array($response->getStatusCode()); + $headers['X-Status'] = [$response->getStatusCode()]; return $headers; } @@ -483,7 +483,7 @@ private function restoreResponse($headers, $body = null) unset($headers['X-Status']); if (null !== $body) { - $headers['X-Body-File'] = array($body); + $headers['X-Body-File'] = [$body]; } return new Response($body, $status, $headers); diff --git a/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php b/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php index 789cb6ea6b3283a233738df9d9f37b7340d1e08b..a701b235464baa6ce48139291b2e68993a70a2f6 100644 --- a/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php +++ b/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php @@ -33,22 +33,22 @@ public static function handle(HttpKernelInterface $kernel, Request $request, $ty $trustedHeaderSet = Request::getTrustedHeaderSet(); if (\method_exists(Request::class, 'getTrustedHeaderName')) { Request::setTrustedProxies($trustedProxies, -1); - $trustedHeaders = array( + $trustedHeaders = [ Request::HEADER_FORWARDED => Request::getTrustedHeaderName(Request::HEADER_FORWARDED, false), Request::HEADER_X_FORWARDED_FOR => Request::getTrustedHeaderName(Request::HEADER_X_FORWARDED_FOR, false), Request::HEADER_X_FORWARDED_HOST => Request::getTrustedHeaderName(Request::HEADER_X_FORWARDED_HOST, false), Request::HEADER_X_FORWARDED_PROTO => Request::getTrustedHeaderName(Request::HEADER_X_FORWARDED_PROTO, false), Request::HEADER_X_FORWARDED_PORT => Request::getTrustedHeaderName(Request::HEADER_X_FORWARDED_PORT, false), - ); + ]; Request::setTrustedProxies($trustedProxies, $trustedHeaderSet); } else { - $trustedHeaders = array( + $trustedHeaders = [ Request::HEADER_FORWARDED => 'FORWARDED', Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR', Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST', Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO', Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT', - ); + ]; } // remove untrusted values @@ -57,13 +57,14 @@ public static function handle(HttpKernelInterface $kernel, Request $request, $ty foreach ($trustedHeaders as $key => $name) { if ($trustedHeaderSet & $key) { $request->headers->remove($name); + $request->server->remove('HTTP_'.strtoupper(str_replace('-', '_', $name))); } } } // compute trusted values, taking any trusted proxies into account - $trustedIps = array(); - $trustedValues = array(); + $trustedIps = []; + $trustedValues = []; foreach (array_reverse($request->getClientIps()) as $ip) { $trustedIps[] = $ip; $trustedValues[] = sprintf('for="%s"', $ip); @@ -76,13 +77,16 @@ public static function handle(HttpKernelInterface $kernel, Request $request, $ty // set trusted values, reusing as much as possible the global trusted settings if (Request::HEADER_FORWARDED & $trustedHeaderSet) { $trustedValues[0] .= sprintf(';host="%s";proto=%s', $request->getHttpHost(), $request->getScheme()); - $request->headers->set($trustedHeaders[Request::HEADER_FORWARDED], implode(', ', $trustedValues)); + $request->headers->set($name = $trustedHeaders[Request::HEADER_FORWARDED], $v = implode(', ', $trustedValues)); + $request->server->set('HTTP_'.strtoupper(str_replace('-', '_', $name)), $v); } if (Request::HEADER_X_FORWARDED_FOR & $trustedHeaderSet) { - $request->headers->set($trustedHeaders[Request::HEADER_X_FORWARDED_FOR], implode(', ', $trustedIps)); + $request->headers->set($name = $trustedHeaders[Request::HEADER_X_FORWARDED_FOR], $v = implode(', ', $trustedIps)); + $request->server->set('HTTP_'.strtoupper(str_replace('-', '_', $name)), $v); } elseif (!(Request::HEADER_FORWARDED & $trustedHeaderSet)) { Request::setTrustedProxies($trustedProxies, $trustedHeaderSet | Request::HEADER_X_FORWARDED_FOR); - $request->headers->set($trustedHeaders[Request::HEADER_X_FORWARDED_FOR], implode(', ', $trustedIps)); + $request->headers->set($name = $trustedHeaders[Request::HEADER_X_FORWARDED_FOR], $v = implode(', ', $trustedIps)); + $request->server->set('HTTP_'.strtoupper(str_replace('-', '_', $name)), $v); } // fix the client IP address by setting it to 127.0.0.1, @@ -91,7 +95,7 @@ public static function handle(HttpKernelInterface $kernel, Request $request, $ty // ensure 127.0.0.1 is set as trusted proxy if (!IpUtils::checkIp('127.0.0.1', $trustedProxies)) { - Request::setTrustedProxies(array_merge($trustedProxies, array('127.0.0.1')), Request::getTrustedHeaderSet()); + Request::setTrustedProxies(array_merge($trustedProxies, ['127.0.0.1']), Request::getTrustedHeaderSet()); } try { diff --git a/vendor/symfony/http-kernel/HttpKernel.php b/vendor/symfony/http-kernel/HttpKernel.php index 36c673093bcc8de3031667e35915948426fa997f..1e19923eb7e7a31aa624914dd0f347878be0ef9b 100644 --- a/vendor/symfony/http-kernel/HttpKernel.php +++ b/vendor/symfony/http-kernel/HttpKernel.php @@ -263,6 +263,9 @@ private function handleException(\Exception $e, $request, $type) } } + /** + * Returns a human-readable string for the specified variable. + */ private function varToString($var) { if (\is_object($var)) { @@ -270,7 +273,7 @@ private function varToString($var) } if (\is_array($var)) { - $a = array(); + $a = []; foreach ($var as $k => $v) { $a[] = sprintf('%s => %s', $k, $this->varToString($v)); } diff --git a/vendor/symfony/http-kernel/Kernel.php b/vendor/symfony/http-kernel/Kernel.php index 0684f22a03232d13a0b2c65d7ebf464d63f270f4..1a985a4c910b94c9d4061153e96d8dfd5ad76118 100644 --- a/vendor/symfony/http-kernel/Kernel.php +++ b/vendor/symfony/http-kernel/Kernel.php @@ -50,7 +50,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl /** * @var BundleInterface[] */ - protected $bundles = array(); + protected $bundles = []; protected $bundleMap; protected $container; @@ -67,11 +67,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.14'; - const VERSION_ID = 30414; + const VERSION = '3.4.23'; + const VERSION_ID = 30423; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 14; + const RELEASE_VERSION = 23; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2020'; @@ -98,7 +98,7 @@ public function __clone() } /** - * Boots the current kernel. + * {@inheritdoc} */ public function boot() { @@ -271,16 +271,12 @@ public function locateResource($name, $dir = null, $first = true) $overridePath = substr($path, 9); $resourceBundle = null; $bundles = $this->getBundle($bundleName, false, true); - $files = array(); + $files = []; foreach ($bundles as $bundle) { if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { if (null !== $resourceBundle) { - throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', - $file, - $resourceBundle, - $dir.'/'.$bundles[0]->getName().$overridePath - )); + throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', $file, $resourceBundle, $dir.'/'.$bundles[0]->getName().$overridePath)); } if ($first) { @@ -399,7 +395,7 @@ public function loadClassCache($name = 'classes', $extension = '.php') @trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED); } - $this->loadClassCache = array($name, $extension); + $this->loadClassCache = [$name, $extension]; } /** @@ -485,9 +481,9 @@ protected function doLoadClassCache($name, $extension) protected function initializeBundles() { // init bundles - $this->bundles = array(); - $topMostBundles = array(); - $directChildren = array(); + $this->bundles = []; + $topMostBundles = []; + $directChildren = []; foreach ($this->registerBundles() as $bundle) { $name = $bundle->getName(); @@ -519,10 +515,10 @@ protected function initializeBundles() } // inheritance - $this->bundleMap = array(); + $this->bundleMap = []; foreach ($topMostBundles as $name => $bundle) { - $bundleMap = array($bundle); - $hierarchy = array($name); + $bundleMap = [$bundle]; + $hierarchy = [$name]; while (isset($directChildren[$name])) { $name = $directChildren[$name]; @@ -602,7 +598,7 @@ protected function initializeContainer() } if ($this->debug) { - $collectedLogs = array(); + $collectedLogs = []; $previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL'); $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { @@ -624,14 +620,14 @@ protected function initializeContainer() } } - $collectedLogs[$message] = array( + $collectedLogs[$message] = [ 'type' => $type, 'message' => $message, 'file' => $file, 'line' => $line, 'trace' => $backtrace, 'count' => 1, - ); + ]; }); } @@ -668,7 +664,7 @@ protected function initializeContainer() // Because concurrent requests might still be using them, // old container files are not removed immediately, // but on a next dump of the container. - static $legacyContainers = array(); + static $legacyContainers = []; $oldContainerDir = \dirname($oldContainer->getFileName()); $legacyContainers[$oldContainerDir.'.legacy'] = true; foreach (glob(\dirname($oldContainerDir).\DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) { @@ -692,20 +688,20 @@ protected function initializeContainer() */ protected function getKernelParameters() { - $bundles = array(); - $bundlesMetadata = array(); + $bundles = []; + $bundlesMetadata = []; foreach ($this->bundles as $name => $bundle) { $bundles[$name] = \get_class($bundle); - $bundlesMetadata[$name] = array( + $bundlesMetadata[$name] = [ 'parent' => $bundle->getParent(), 'path' => $bundle->getPath(), 'namespace' => $bundle->getNamespace(), - ); + ]; } return array_merge( - array( + [ 'kernel.root_dir' => realpath($this->rootDir) ?: $this->rootDir, 'kernel.project_dir' => realpath($this->getProjectDir()) ?: $this->getProjectDir(), 'kernel.environment' => $this->environment, @@ -717,7 +713,7 @@ protected function getKernelParameters() 'kernel.bundles_metadata' => $bundlesMetadata, 'kernel.charset' => $this->getCharset(), 'kernel.container_class' => $this->getContainerClass(), - ), + ], $this->getEnvParameters(false) ); } @@ -737,7 +733,7 @@ protected function getEnvParameters() @trigger_error(sprintf('The "%s()" method is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax to get the value of any environment variable from configuration files instead.', __METHOD__), E_USER_DEPRECATED); } - $parameters = array(); + $parameters = []; foreach ($_SERVER as $key => $value) { if (0 === strpos($key, 'SYMFONY__')) { @trigger_error(sprintf('The support of special environment variables that start with SYMFONY__ (such as "%s") is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax instead to get the value of environment variables in configuration files.', $key), E_USER_DEPRECATED); @@ -757,7 +753,7 @@ protected function getEnvParameters() */ protected function buildContainer() { - foreach (array('cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) { + foreach (['cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()] as $name => $dir) { if (!is_dir($dir)) { if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) { throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir)); @@ -786,7 +782,7 @@ protected function buildContainer() */ protected function prepareContainer(ContainerBuilder $container) { - $extensions = array(); + $extensions = []; foreach ($this->bundles as $bundle) { if ($extension = $bundle->getContainerExtension()) { $container->registerExtension($extension); @@ -848,7 +844,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container $dumper->setProxyDumper(new ProxyDumper()); } - $content = $dumper->dump(array( + $content = $dumper->dump([ 'class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath(), @@ -856,7 +852,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container 'debug' => $this->debug, 'inline_class_loader_parameter' => \PHP_VERSION_ID >= 70000 && !$this->loadClassCache && !class_exists(ClassCollectionLoader::class, false) ? 'container.dumper.inline_class_loader' : null, 'build_time' => $container->hasParameter('kernel.container_build_time') ? $container->getParameter('kernel.container_build_time') : time(), - )); + ]); $rootCode = array_pop($content); $dir = \dirname($cache->getPath()).'/'; @@ -866,7 +862,10 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container $fs->dumpFile($dir.$file, $code); @chmod($dir.$file, 0666 & ~umask()); } - @unlink(\dirname($dir.$file).'.legacy'); + $legacyFile = \dirname($dir.$file).'.legacy'; + if (file_exists($legacyFile)) { + @unlink($legacyFile); + } $cache->write($rootCode, $container->getResources()); } @@ -879,7 +878,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container protected function getContainerLoader(ContainerInterface $container) { $locator = new FileLocator($this); - $resolver = new LoaderResolver(array( + $resolver = new LoaderResolver([ new XmlFileLoader($container, $locator), new YamlFileLoader($container, $locator), new IniFileLoader($container, $locator), @@ -887,7 +886,7 @@ protected function getContainerLoader(ContainerInterface $container) new GlobFileLoader($container, $locator), new DirectoryLoader($container, $locator), new ClosureLoader($container), - )); + ]); return new DelegatingLoader($resolver); } @@ -931,8 +930,8 @@ public static function stripComments($source) } // replace multiple new lines with a single newline - $rawChunk .= preg_replace(array('/\n{2,}/S'), "\n", $token[1]); - } elseif (\in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { + $rawChunk .= preg_replace(['/\n{2,}/S'], "\n", $token[1]); + } elseif (\in_array($token[0], [T_COMMENT, T_DOC_COMMENT])) { $ignoreSpace = true; } else { $rawChunk .= $token[1]; @@ -957,13 +956,13 @@ public static function stripComments($source) public function serialize() { - return serialize(array($this->environment, $this->debug)); + return serialize([$this->environment, $this->debug]); } public function unserialize($data) { if (\PHP_VERSION_ID >= 70000) { - list($environment, $debug) = unserialize($data, array('allowed_classes' => false)); + list($environment, $debug) = unserialize($data, ['allowed_classes' => false]); } else { list($environment, $debug) = unserialize($data); } diff --git a/vendor/symfony/http-kernel/KernelInterface.php b/vendor/symfony/http-kernel/KernelInterface.php index 481eef9505e8acb6ad2780a87d04fccebcaea216..d624d1219d0f71599634e4020296ad208982d9b9 100644 --- a/vendor/symfony/http-kernel/KernelInterface.php +++ b/vendor/symfony/http-kernel/KernelInterface.php @@ -131,7 +131,7 @@ public function getRootDir(); /** * Gets the current container. * - * @return ContainerInterface A ContainerInterface instance + * @return ContainerInterface|null A ContainerInterface instance or null when the Kernel is shutdown */ public function getContainer(); diff --git a/vendor/symfony/http-kernel/LICENSE b/vendor/symfony/http-kernel/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/http-kernel/LICENSE +++ b/vendor/symfony/http-kernel/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/http-kernel/Log/Logger.php b/vendor/symfony/http-kernel/Log/Logger.php index ca54d22f759bdd86afebe579a2001dff31159a3f..6cfc75949021e7da1f6e7e8a39867d2d812a6ea6 100644 --- a/vendor/symfony/http-kernel/Log/Logger.php +++ b/vendor/symfony/http-kernel/Log/Logger.php @@ -22,7 +22,7 @@ */ class Logger extends AbstractLogger { - private static $levels = array( + private static $levels = [ LogLevel::DEBUG => 0, LogLevel::INFO => 1, LogLevel::NOTICE => 2, @@ -31,7 +31,7 @@ class Logger extends AbstractLogger LogLevel::CRITICAL => 5, LogLevel::ALERT => 6, LogLevel::EMERGENCY => 7, - ); + ]; private $minLevelIndex; private $formatter; @@ -57,7 +57,7 @@ public function __construct($minLevel = null, $output = 'php://stderr', callable } $this->minLevelIndex = self::$levels[$minLevel]; - $this->formatter = $formatter ?: array($this, 'format'); + $this->formatter = $formatter ?: [$this, 'format']; if (false === $this->handle = \is_resource($output) ? $output : @fopen($output, 'a')) { throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output)); } @@ -66,7 +66,7 @@ public function __construct($minLevel = null, $output = 'php://stderr', callable /** * {@inheritdoc} */ - public function log($level, $message, array $context = array()) + public function log($level, $message, array $context = []) { if (!isset(self::$levels[$level])) { throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level)); @@ -90,7 +90,7 @@ public function log($level, $message, array $context = array()) private function format($level, $message, array $context) { if (false !== strpos($message, '{')) { - $replacements = array(); + $replacements = []; foreach ($context as $key => $val) { if (null === $val || is_scalar($val) || (\is_object($val) && method_exists($val, '__toString'))) { $replacements["{{$key}}"] = $val; diff --git a/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php b/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php index 8bb57cf30cecf588a4e1a52e0458dcacbe7c0f1d..810e2fe6f2f8ddf9638bdcb92d4158b29508c727 100644 --- a/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php +++ b/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php @@ -54,13 +54,13 @@ public function find($ip, $url, $limit, $method, $start = null, $end = null, $st $file = $this->getIndexFilename(); if (!file_exists($file)) { - return array(); + return []; } $file = fopen($file, 'r'); fseek($file, 0, SEEK_END); - $result = array(); + $result = []; while (\count($result) < $limit && $line = $this->readLineFromFile($file)) { $values = str_getcsv($line); list($csvToken, $csvIp, $csvMethod, $csvUrl, $csvTime, $csvParent, $csvStatusCode) = $values; @@ -78,7 +78,7 @@ public function find($ip, $url, $limit, $method, $start = null, $end = null, $st continue; } - $result[$csvToken] = array( + $result[$csvToken] = [ 'token' => $csvToken, 'ip' => $csvIp, 'method' => $csvMethod, @@ -86,7 +86,7 @@ public function find($ip, $url, $limit, $method, $start = null, $end = null, $st 'time' => $csvTime, 'parent' => $csvParent, 'status_code' => $csvStatusCode, - ); + ]; } fclose($file); @@ -151,7 +151,7 @@ public function write(Profile $profile) }, $profile->getChildren())); // Store profile - $data = array( + $data = [ 'token' => $profileToken, 'parent' => $parentToken, 'children' => $childrenToken, @@ -161,7 +161,7 @@ public function write(Profile $profile) 'url' => $profile->getUrl(), 'time' => $profile->getTime(), 'status_code' => $profile->getStatusCode(), - ); + ]; if (false === file_put_contents($file, serialize($data))) { return false; @@ -173,7 +173,7 @@ public function write(Profile $profile) return false; } - fputcsv($file, array( + fputcsv($file, [ $profile->getToken(), $profile->getIp(), $profile->getMethod(), @@ -181,7 +181,7 @@ public function write(Profile $profile) $profile->getTime(), $profile->getParentToken(), $profile->getStatusCode(), - )); + ]); fclose($file); } diff --git a/vendor/symfony/http-kernel/Profiler/Profile.php b/vendor/symfony/http-kernel/Profiler/Profile.php index c21c9d38a343d7715dffe0beb8f14ebd41a81a24..c4490bc7a692978b455381613068e10a9fc02eed 100644 --- a/vendor/symfony/http-kernel/Profiler/Profile.php +++ b/vendor/symfony/http-kernel/Profiler/Profile.php @@ -25,7 +25,7 @@ class Profile /** * @var DataCollectorInterface[] */ - private $collectors = array(); + private $collectors = []; private $ip; private $method; @@ -41,7 +41,7 @@ class Profile /** * @var Profile[] */ - private $children = array(); + private $children = []; /** * @param string $token The token @@ -74,7 +74,7 @@ public function getToken() /** * Sets the parent token. */ - public function setParent(Profile $parent) + public function setParent(self $parent) { $this->parent = $parent; } @@ -92,7 +92,7 @@ public function getParent() /** * Returns the parent token. * - * @return null|string The parent token + * @return string|null The parent token */ public function getParentToken() { @@ -204,7 +204,7 @@ public function getChildren() */ public function setChildren(array $children) { - $this->children = array(); + $this->children = []; foreach ($children as $child) { $this->addChild($child); } @@ -213,7 +213,7 @@ public function setChildren(array $children) /** * Adds the child token. */ - public function addChild(Profile $child) + public function addChild(self $child) { $this->children[] = $child; $child->setParent($this); @@ -254,7 +254,7 @@ public function getCollectors() */ public function setCollectors(array $collectors) { - $this->collectors = array(); + $this->collectors = []; foreach ($collectors as $collector) { $this->addCollector($collector); } @@ -282,6 +282,6 @@ public function hasCollector($name) public function __sleep() { - return array('token', 'parent', 'children', 'collectors', 'ip', 'method', 'url', 'time', 'statusCode'); + return ['token', 'parent', 'children', 'collectors', 'ip', 'method', 'url', 'time', 'statusCode']; } } diff --git a/vendor/symfony/http-kernel/Profiler/Profiler.php b/vendor/symfony/http-kernel/Profiler/Profiler.php index f252da476680c2de4f0bd3028a4184c4171a2aa0..edf6cb833017d6b7ca38cc69c0645a3dba9169f9 100644 --- a/vendor/symfony/http-kernel/Profiler/Profiler.php +++ b/vendor/symfony/http-kernel/Profiler/Profiler.php @@ -30,7 +30,7 @@ class Profiler /** * @var DataCollectorInterface[] */ - private $collectors = array(); + private $collectors = []; private $logger; private $initiallyEnabled = true; @@ -103,7 +103,7 @@ public function saveProfile(Profile $profile) } if (!($ret = $this->storage->write($profile)) && null !== $this->logger) { - $this->logger->warning('Unable to store the profiler information.', array('configured_storage' => \get_class($this->storage))); + $this->logger->warning('Unable to store the profiler information.', ['configured_storage' => \get_class($this->storage)]); } return $ret; @@ -198,9 +198,9 @@ public function all() * * @param DataCollectorInterface[] $collectors An array of collectors */ - public function set(array $collectors = array()) + public function set(array $collectors = []) { - $this->collectors = array(); + $this->collectors = []; foreach ($collectors as $collector) { $this->add($collector); } diff --git a/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php b/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php index ec2ecff948c81e8c851d223e772bf2228b4f0964..a7093dfc9df9010f84f355ad5027d54216b901cc 100644 --- a/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php @@ -35,7 +35,7 @@ public function testInjectClearersInConstructor() ->expects($this->once()) ->method('clear'); - $chainClearer = new ChainCacheClearer(array($clearer)); + $chainClearer = new ChainCacheClearer([$clearer]); $chainClearer->clear(self::$cacheDir); } diff --git a/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php b/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php index b3bed4e87f605a656f5a9145614f750eda4b339a..297ede6a3602856539d303cb37dd1b649ee744f8 100644 --- a/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php @@ -24,7 +24,7 @@ public function testClearPoolsInjectedInConstructor() ->expects($this->once()) ->method('clear'); - (new Psr6CacheClearer(array('pool' => $pool)))->clear(''); + (new Psr6CacheClearer(['pool' => $pool]))->clear(''); } public function testClearPool() @@ -34,7 +34,7 @@ public function testClearPool() ->expects($this->once()) ->method('clear'); - (new Psr6CacheClearer(array('pool' => $pool)))->clearPool('pool'); + (new Psr6CacheClearer(['pool' => $pool]))->clearPool('pool'); } /** @@ -62,7 +62,7 @@ public function testClearPoolsInjectedByAdder() ->expects($this->once()) ->method('clear'); - $clearer = new Psr6CacheClearer(array('pool1' => $pool1)); + $clearer = new Psr6CacheClearer(['pool1' => $pool1]); $clearer->addPool($pool2); $clearer->clear(''); } diff --git a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php index ba159124c93e90f972c2a5fff1a095dd03c3bf50..de15c6f30ce0b1b101e9098f5af771c51f4e754d 100644 --- a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php @@ -34,7 +34,7 @@ public function testInjectWarmersUsingConstructor() $warmer ->expects($this->once()) ->method('warmUp'); - $aggregate = new CacheWarmerAggregate(array($warmer)); + $aggregate = new CacheWarmerAggregate([$warmer]); $aggregate->warmUp(self::$cacheDir); } @@ -62,7 +62,7 @@ public function testInjectWarmersUsingSetWarmers() ->expects($this->once()) ->method('warmUp'); $aggregate = new CacheWarmerAggregate(); - $aggregate->setWarmers(array($warmer)); + $aggregate->setWarmers([$warmer]); $aggregate->warmUp(self::$cacheDir); } @@ -76,7 +76,7 @@ public function testWarmupDoesCallWarmupOnOptionalWarmersWhenEnableOptionalWarme ->expects($this->once()) ->method('warmUp'); - $aggregate = new CacheWarmerAggregate(array($warmer)); + $aggregate = new CacheWarmerAggregate([$warmer]); $aggregate->enableOptionalWarmers(); $aggregate->warmUp(self::$cacheDir); } @@ -92,7 +92,7 @@ public function testWarmupDoesNotCallWarmupOnOptionalWarmersWhenEnableOptionalWa ->expects($this->never()) ->method('warmUp'); - $aggregate = new CacheWarmerAggregate(array($warmer)); + $aggregate = new CacheWarmerAggregate([$warmer]); $aggregate->warmUp(self::$cacheDir); } diff --git a/vendor/symfony/http-kernel/Tests/ClientTest.php b/vendor/symfony/http-kernel/Tests/ClientTest.php index 5af273086820b74fee7b9ce36a1a0b639a5d8d6d..ac1c55ad54d351cc272c73fb5991f2d6dbfb0fb4 100644 --- a/vendor/symfony/http-kernel/Tests/ClientTest.php +++ b/vendor/symfony/http-kernel/Tests/ClientTest.php @@ -70,7 +70,7 @@ public function testFilterResponseConvertsCookies() $response->headers->setCookie($cookie2 = new Cookie('foo1', 'bar1', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true)); $domResponse = $m->invoke($client, $response); $this->assertSame((string) $cookie1, $domResponse->getHeader('Set-Cookie')); - $this->assertSame(array((string) $cookie1, (string) $cookie2), $domResponse->getHeader('Set-Cookie', false)); + $this->assertSame([(string) $cookie1, (string) $cookie2], $domResponse->getHeader('Set-Cookie', false)); } public function testFilterResponseSupportsStreamedResponses() @@ -99,14 +99,14 @@ public function testUploadedFile() $kernel = new TestHttpKernel(); $client = new Client($kernel); - $files = array( - array('tmp_name' => $source, 'name' => 'original', 'type' => 'mime/original', 'size' => 1, 'error' => UPLOAD_ERR_OK), + $files = [ + ['tmp_name' => $source, 'name' => 'original', 'type' => 'mime/original', 'size' => 1, 'error' => UPLOAD_ERR_OK], new UploadedFile($source, 'original', 'mime/original', 1, UPLOAD_ERR_OK, true), - ); + ]; $file = null; foreach ($files as $file) { - $client->request('POST', '/', array(), array('foo' => $file)); + $client->request('POST', '/', [], ['foo' => $file]); $files = $client->getRequest()->files->all(); @@ -131,9 +131,9 @@ public function testUploadedFileWhenNoFileSelected() $kernel = new TestHttpKernel(); $client = new Client($kernel); - $file = array('tmp_name' => '', 'name' => '', 'type' => '', 'size' => 0, 'error' => UPLOAD_ERR_NO_FILE); + $file = ['tmp_name' => '', 'name' => '', 'type' => '', 'size' => 0, 'error' => UPLOAD_ERR_NO_FILE]; - $client->request('POST', '/', array(), array('foo' => $file)); + $client->request('POST', '/', [], ['foo' => $file]); $files = $client->getRequest()->files->all(); @@ -150,8 +150,8 @@ public function testUploadedFileWhenSizeExceedsUploadMaxFileSize() $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile') - ->setConstructorArgs(array($source, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true)) - ->setMethods(array('getSize')) + ->setConstructorArgs([$source, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true]) + ->setMethods(['getSize']) ->getMock() ; @@ -160,7 +160,7 @@ public function testUploadedFileWhenSizeExceedsUploadMaxFileSize() ->will($this->returnValue(INF)) ; - $client->request('POST', '/', array(), array($file)); + $client->request('POST', '/', [], [$file]); $files = $client->getRequest()->files->all(); diff --git a/vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php b/vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php index 986e05d8b888abfadf10cf50a4fc95376886d467..a1bf52957219ba021868c9420fb04c365f7c6213 100644 --- a/vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php +++ b/vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php @@ -25,10 +25,10 @@ class EnvParametersResourceTest extends TestCase protected function setUp() { - $this->initialEnv = array( + $this->initialEnv = [ $this->prefix.'1' => 'foo', $this->prefix.'2' => 'bar', - ); + ]; foreach ($this->initialEnv as $key => $value) { $_SERVER[$key] = $value; @@ -49,7 +49,7 @@ protected function tearDown() public function testGetResource() { $this->assertSame( - array('prefix' => $this->prefix, 'variables' => $this->initialEnv), + ['prefix' => $this->prefix, 'variables' => $this->initialEnv], $this->resource->getResource(), '->getResource() returns the resource' ); @@ -58,7 +58,7 @@ public function testGetResource() public function testToString() { $this->assertSame( - serialize(array('prefix' => $this->prefix, 'variables' => $this->initialEnv)), + serialize(['prefix' => $this->prefix, 'variables' => $this->initialEnv]), (string) $this->resource ); } diff --git a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php index 7d34172ce3d8fe31f8f7f0ecde8520da02d55bf1..2c43e5b1ba00c9289d338b9a5b1a45472514de8f 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php @@ -21,68 +21,86 @@ class ServiceValueResolverTest extends TestCase { public function testDoNotSupportWhenControllerDoNotExists() { - $resolver = new ServiceValueResolver(new ServiceLocator(array())); + $resolver = new ServiceValueResolver(new ServiceLocator([])); $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); - $request = $this->requestWithAttributes(array('_controller' => 'my_controller')); + $request = $this->requestWithAttributes(['_controller' => 'my_controller']); $this->assertFalse($resolver->supports($request, $argument)); } public function testExistingController() { - $resolver = new ServiceValueResolver(new ServiceLocator(array( + $resolver = new ServiceValueResolver(new ServiceLocator([ 'App\\Controller\\Mine::method' => function () { - return new ServiceLocator(array( + return new ServiceLocator([ 'dummy' => function () { return new DummyService(); }, - )); + ]); }, - ))); + ])); - $request = $this->requestWithAttributes(array('_controller' => 'App\\Controller\\Mine::method')); + $request = $this->requestWithAttributes(['_controller' => 'App\\Controller\\Mine::method']); $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); $this->assertTrue($resolver->supports($request, $argument)); - $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument)); + $this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument)); } public function testExistingControllerWithATrailingBackSlash() { - $resolver = new ServiceValueResolver(new ServiceLocator(array( + $resolver = new ServiceValueResolver(new ServiceLocator([ 'App\\Controller\\Mine::method' => function () { - return new ServiceLocator(array( + return new ServiceLocator([ 'dummy' => function () { return new DummyService(); }, - )); + ]); }, - ))); + ])); - $request = $this->requestWithAttributes(array('_controller' => '\\App\\Controller\\Mine::method')); + $request = $this->requestWithAttributes(['_controller' => '\\App\\Controller\\Mine::method']); $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); $this->assertTrue($resolver->supports($request, $argument)); - $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument)); + $this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument)); + } + + public function testExistingControllerWithMethodNameStartUppercase() + { + $resolver = new ServiceValueResolver(new ServiceLocator([ + 'App\\Controller\\Mine::method' => function () { + return new ServiceLocator([ + 'dummy' => function () { + return new DummyService(); + }, + ]); + }, + ])); + $request = $this->requestWithAttributes(['_controller' => 'App\\Controller\\Mine::Method']); + $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); + + $this->assertTrue($resolver->supports($request, $argument)); + $this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument)); } public function testControllerNameIsAnArray() { - $resolver = new ServiceValueResolver(new ServiceLocator(array( + $resolver = new ServiceValueResolver(new ServiceLocator([ 'App\\Controller\\Mine::method' => function () { - return new ServiceLocator(array( + return new ServiceLocator([ 'dummy' => function () { return new DummyService(); }, - )); + ]); }, - ))); + ])); - $request = $this->requestWithAttributes(array('_controller' => array('App\\Controller\\Mine', 'method'))); + $request = $this->requestWithAttributes(['_controller' => ['App\\Controller\\Mine', 'method']]); $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); $this->assertTrue($resolver->supports($request, $argument)); - $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument)); + $this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument)); } private function requestWithAttributes(array $attributes) @@ -98,7 +116,7 @@ private function requestWithAttributes(array $attributes) private function assertYieldEquals(array $expected, \Generator $generator) { - $args = array(); + $args = []; foreach ($generator as $arg) { $args[] = $arg; } diff --git a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php index 729b90b2f63c52955287c16d810baa952327f852..8c900fb92c2282d7b4970da926dc47f7d4d98666 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php @@ -40,33 +40,33 @@ public static function setUpBeforeClass() public function testDefaultState() { $this->assertEquals(self::$resolver, new ArgumentResolver()); - $this->assertNotEquals(self::$resolver, new ArgumentResolver(null, array(new RequestAttributeValueResolver()))); + $this->assertNotEquals(self::$resolver, new ArgumentResolver(null, [new RequestAttributeValueResolver()])); } public function testGetArguments() { $request = Request::create('/'); $request->attributes->set('foo', 'foo'); - $controller = array(new self(), 'controllerWithFoo'); + $controller = [new self(), 'controllerWithFoo']; - $this->assertEquals(array('foo'), self::$resolver->getArguments($request, $controller), '->getArguments() returns an array of arguments for the controller method'); + $this->assertEquals(['foo'], self::$resolver->getArguments($request, $controller), '->getArguments() returns an array of arguments for the controller method'); } public function testGetArgumentsReturnsEmptyArrayWhenNoArguments() { $request = Request::create('/'); - $controller = array(new self(), 'controllerWithoutArguments'); + $controller = [new self(), 'controllerWithoutArguments']; - $this->assertEquals(array(), self::$resolver->getArguments($request, $controller), '->getArguments() returns an empty array if the method takes no arguments'); + $this->assertEquals([], self::$resolver->getArguments($request, $controller), '->getArguments() returns an empty array if the method takes no arguments'); } public function testGetArgumentsUsesDefaultValue() { $request = Request::create('/'); $request->attributes->set('foo', 'foo'); - $controller = array(new self(), 'controllerWithFooAndDefaultBar'); + $controller = [new self(), 'controllerWithFooAndDefaultBar']; - $this->assertEquals(array('foo', null), self::$resolver->getArguments($request, $controller), '->getArguments() uses default values if present'); + $this->assertEquals(['foo', null], self::$resolver->getArguments($request, $controller), '->getArguments() uses default values if present'); } public function testGetArgumentsOverrideDefaultValueByRequestAttribute() @@ -74,9 +74,9 @@ public function testGetArgumentsOverrideDefaultValueByRequestAttribute() $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $request->attributes->set('bar', 'bar'); - $controller = array(new self(), 'controllerWithFooAndDefaultBar'); + $controller = [new self(), 'controllerWithFooAndDefaultBar']; - $this->assertEquals(array('foo', 'bar'), self::$resolver->getArguments($request, $controller), '->getArguments() overrides default values if provided in the request attributes'); + $this->assertEquals(['foo', 'bar'], self::$resolver->getArguments($request, $controller), '->getArguments() overrides default values if provided in the request attributes'); } public function testGetArgumentsFromClosure() @@ -85,7 +85,7 @@ public function testGetArgumentsFromClosure() $request->attributes->set('foo', 'foo'); $controller = function ($foo) {}; - $this->assertEquals(array('foo'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo'], self::$resolver->getArguments($request, $controller)); } public function testGetArgumentsUsesDefaultValueFromClosure() @@ -94,7 +94,7 @@ public function testGetArgumentsUsesDefaultValueFromClosure() $request->attributes->set('foo', 'foo'); $controller = function ($foo, $bar = 'bar') {}; - $this->assertEquals(array('foo', 'bar'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', 'bar'], self::$resolver->getArguments($request, $controller)); } public function testGetArgumentsFromInvokableObject() @@ -103,12 +103,12 @@ public function testGetArgumentsFromInvokableObject() $request->attributes->set('foo', 'foo'); $controller = new self(); - $this->assertEquals(array('foo', null), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', null], self::$resolver->getArguments($request, $controller)); // Test default bar overridden by request attribute $request->attributes->set('bar', 'bar'); - $this->assertEquals(array('foo', 'bar'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', 'bar'], self::$resolver->getArguments($request, $controller)); } public function testGetArgumentsFromFunctionName() @@ -118,7 +118,7 @@ public function testGetArgumentsFromFunctionName() $request->attributes->set('foobar', 'foobar'); $controller = __NAMESPACE__.'\controller_function'; - $this->assertEquals(array('foo', 'foobar'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', 'foobar'], self::$resolver->getArguments($request, $controller)); } public function testGetArgumentsFailsOnUnresolvedValue() @@ -126,7 +126,7 @@ public function testGetArgumentsFailsOnUnresolvedValue() $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $request->attributes->set('foobar', 'foobar'); - $controller = array(new self(), 'controllerWithFooBarFoobar'); + $controller = [new self(), 'controllerWithFooBarFoobar']; try { self::$resolver->getArguments($request, $controller); @@ -139,17 +139,17 @@ public function testGetArgumentsFailsOnUnresolvedValue() public function testGetArgumentsInjectsRequest() { $request = Request::create('/'); - $controller = array(new self(), 'controllerWithRequest'); + $controller = [new self(), 'controllerWithRequest']; - $this->assertEquals(array($request), self::$resolver->getArguments($request, $controller), '->getArguments() injects the request'); + $this->assertEquals([$request], self::$resolver->getArguments($request, $controller), '->getArguments() injects the request'); } public function testGetArgumentsInjectsExtendingRequest() { $request = ExtendingRequest::create('/'); - $controller = array(new self(), 'controllerWithExtendingRequest'); + $controller = [new self(), 'controllerWithExtendingRequest']; - $this->assertEquals(array($request), self::$resolver->getArguments($request, $controller), '->getArguments() injects the request when extended'); + $this->assertEquals([$request], self::$resolver->getArguments($request, $controller), '->getArguments() injects the request when extended'); } /** @@ -159,10 +159,10 @@ public function testGetVariadicArguments() { $request = Request::create('/'); $request->attributes->set('foo', 'foo'); - $request->attributes->set('bar', array('foo', 'bar')); - $controller = array(new VariadicController(), 'action'); + $request->attributes->set('bar', ['foo', 'bar']); + $controller = [new VariadicController(), 'action']; - $this->assertEquals(array('foo', 'foo', 'bar'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', 'foo', 'bar'], self::$resolver->getArguments($request, $controller)); } /** @@ -174,7 +174,7 @@ public function testGetVariadicArgumentsWithoutArrayInRequest() $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $request->attributes->set('bar', 'foo'); - $controller = array(new VariadicController(), 'action'); + $controller = [new VariadicController(), 'action']; self::$resolver->getArguments($request, $controller); } @@ -187,7 +187,7 @@ public function testGetArgumentWithoutArray() { $factory = new ArgumentMetadataFactory(); $valueResolver = $this->getMockBuilder(ArgumentValueResolverInterface::class)->getMock(); - $resolver = new ArgumentResolver($factory, array($valueResolver)); + $resolver = new ArgumentResolver($factory, [$valueResolver]); $valueResolver->expects($this->any())->method('supports')->willReturn(true); $valueResolver->expects($this->any())->method('resolve')->willReturn('foo'); @@ -195,7 +195,7 @@ public function testGetArgumentWithoutArray() $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $request->attributes->set('bar', 'foo'); - $controller = array($this, 'controllerWithFooAndDefaultBar'); + $controller = [$this, 'controllerWithFooAndDefaultBar']; $resolver->getArguments($request, $controller); } @@ -205,7 +205,7 @@ public function testGetArgumentWithoutArray() public function testIfExceptionIsThrownWhenMissingAnArgument() { $request = Request::create('/'); - $controller = array($this, 'controllerWithFoo'); + $controller = [$this, 'controllerWithFoo']; self::$resolver->getArguments($request, $controller); } @@ -219,9 +219,9 @@ public function testGetNullableArguments() $request->attributes->set('foo', 'foo'); $request->attributes->set('bar', new \stdClass()); $request->attributes->set('mandatory', 'mandatory'); - $controller = array(new NullableController(), 'action'); + $controller = [new NullableController(), 'action']; - $this->assertEquals(array('foo', new \stdClass(), 'value', 'mandatory'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', new \stdClass(), 'value', 'mandatory'], self::$resolver->getArguments($request, $controller)); } /** @@ -231,9 +231,9 @@ public function testGetNullableArgumentsWithDefaults() { $request = Request::create('/'); $request->attributes->set('mandatory', 'mandatory'); - $controller = array(new NullableController(), 'action'); + $controller = [new NullableController(), 'action']; - $this->assertEquals(array(null, null, 'value', 'mandatory'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals([null, null, 'value', 'mandatory'], self::$resolver->getArguments($request, $controller)); } public function testGetSessionArguments() @@ -241,9 +241,9 @@ public function testGetSessionArguments() $session = new Session(new MockArraySessionStorage()); $request = Request::create('/'); $request->setSession($session); - $controller = array($this, 'controllerWithSession'); + $controller = [$this, 'controllerWithSession']; - $this->assertEquals(array($session), self::$resolver->getArguments($request, $controller)); + $this->assertEquals([$session], self::$resolver->getArguments($request, $controller)); } public function testGetSessionArgumentsWithExtendedSession() @@ -251,9 +251,9 @@ public function testGetSessionArgumentsWithExtendedSession() $session = new ExtendingSession(new MockArraySessionStorage()); $request = Request::create('/'); $request->setSession($session); - $controller = array($this, 'controllerWithExtendingSession'); + $controller = [$this, 'controllerWithExtendingSession']; - $this->assertEquals(array($session), self::$resolver->getArguments($request, $controller)); + $this->assertEquals([$session], self::$resolver->getArguments($request, $controller)); } public function testGetSessionArgumentsWithInterface() @@ -261,9 +261,9 @@ public function testGetSessionArgumentsWithInterface() $session = $this->getMockBuilder(SessionInterface::class)->getMock(); $request = Request::create('/'); $request->setSession($session); - $controller = array($this, 'controllerWithSessionInterface'); + $controller = [$this, 'controllerWithSessionInterface']; - $this->assertEquals(array($session), self::$resolver->getArguments($request, $controller)); + $this->assertEquals([$session], self::$resolver->getArguments($request, $controller)); } /** @@ -274,7 +274,7 @@ public function testGetSessionMissMatchWithInterface() $session = $this->getMockBuilder(SessionInterface::class)->getMock(); $request = Request::create('/'); $request->setSession($session); - $controller = array($this, 'controllerWithExtendingSession'); + $controller = [$this, 'controllerWithExtendingSession']; self::$resolver->getArguments($request, $controller); } @@ -287,7 +287,7 @@ public function testGetSessionMissMatchWithImplementation() $session = new Session(new MockArraySessionStorage()); $request = Request::create('/'); $request->setSession($session); - $controller = array($this, 'controllerWithExtendingSession'); + $controller = [$this, 'controllerWithExtendingSession']; self::$resolver->getArguments($request, $controller); } @@ -298,7 +298,7 @@ public function testGetSessionMissMatchWithImplementation() public function testGetSessionMissMatchOnNull() { $request = Request::create('/'); - $controller = array($this, 'controllerWithExtendingSession'); + $controller = [$this, 'controllerWithExtendingSession']; self::$resolver->getArguments($request, $controller); } diff --git a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php index 82407f5601a1831df39fd0cdbefa612ee41149e7..3f130db06500a92da6b81733a12815373e9e51ba 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php @@ -105,11 +105,11 @@ public function testNonInstantiableController() $resolver = $this->createControllerResolver(null, $container); $request = Request::create('/'); - $request->attributes->set('_controller', array(NonInstantiableController::class, 'action')); + $request->attributes->set('_controller', [NonInstantiableController::class, 'action']); $controller = $resolver->getController($request); - $this->assertSame(array(NonInstantiableController::class, 'action'), $controller); + $this->assertSame([NonInstantiableController::class, 'action'], $controller); } /** @@ -134,12 +134,12 @@ public function testNonConstructController() $container->expects($this->atLeastOnce()) ->method('getRemovedIds') ->with() - ->will($this->returnValue(array(ImpossibleConstructController::class => true))) + ->will($this->returnValue([ImpossibleConstructController::class => true])) ; $resolver = $this->createControllerResolver(null, $container); $request = Request::create('/'); - $request->attributes->set('_controller', array(ImpossibleConstructController::class, 'action')); + $request->attributes->set('_controller', [ImpossibleConstructController::class, 'action']); if (\PHP_VERSION_ID < 70100) { ErrorHandler::register(); @@ -172,11 +172,11 @@ public function testNonInstantiableControllerWithCorrespondingService() $resolver = $this->createControllerResolver(null, $container); $request = Request::create('/'); - $request->attributes->set('_controller', array(NonInstantiableController::class, 'action')); + $request->attributes->set('_controller', [NonInstantiableController::class, 'action']); $controller = $resolver->getController($request); - $this->assertSame(array($service, 'action'), $controller); + $this->assertSame([$service, 'action'], $controller); } /** @@ -195,7 +195,7 @@ public function testExceptionWhenUsingRemovedControllerService() $container->expects($this->atLeastOnce()) ->method('getRemovedIds') ->with() - ->will($this->returnValue(array('app.my_controller' => true))) + ->will($this->returnValue(['app.my_controller' => true])) ; $resolver = $this->createControllerResolver(null, $container); @@ -251,16 +251,16 @@ public function testGetControllerOnNonUndefinedFunction($controller, $exceptionN public function getUndefinedControllers() { - return array( - array('foo', \LogicException::class, '/Controller not found: service "foo" does not exist\./'), - array('oof::bar', \InvalidArgumentException::class, '/Class "oof" does not exist\./'), - array('stdClass', \LogicException::class, '/Controller not found: service "stdClass" does not exist\./'), - array( + return [ + ['foo', \LogicException::class, '/Controller not found: service "foo" does not exist\./'], + ['oof::bar', \InvalidArgumentException::class, '/Class "oof" does not exist\./'], + ['stdClass', \LogicException::class, '/Controller not found: service "stdClass" does not exist\./'], + [ 'Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest::bar', \InvalidArgumentException::class, '/.?[cC]ontroller(.*?) for URI "\/" is not callable\.( Expected method(.*) Available methods)?/', - ), - ); + ], + ]; } protected function createControllerResolver(LoggerInterface $logger = null, ContainerInterface $container = null) diff --git a/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php index 87f598d16df741a555256bada3b2a0cb1717526b..728382ad2b1ec34267cc514ed5fc577ab2707eb8 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php @@ -55,9 +55,9 @@ public function testGetControllerWithObjectAndMethod() $resolver = $this->createControllerResolver(); $request = Request::create('/'); - $request->attributes->set('_controller', array($this, 'controllerMethod1')); + $request->attributes->set('_controller', [$this, 'controllerMethod1']); $controller = $resolver->getController($request); - $this->assertSame(array($this, 'controllerMethod1'), $controller); + $this->assertSame([$this, 'controllerMethod1'], $controller); } public function testGetControllerWithClassAndMethod() @@ -65,9 +65,9 @@ public function testGetControllerWithClassAndMethod() $resolver = $this->createControllerResolver(); $request = Request::create('/'); - $request->attributes->set('_controller', array('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', 'controllerMethod4')); + $request->attributes->set('_controller', ['Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', 'controllerMethod4']); $controller = $resolver->getController($request); - $this->assertSame(array('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', 'controllerMethod4'), $controller); + $this->assertSame(['Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', 'controllerMethod4'], $controller); } public function testGetControllerWithObjectAndMethodAsString() @@ -132,16 +132,16 @@ public function testGetControllerOnNonUndefinedFunction($controller, $exceptionN public function getUndefinedControllers() { - return array( - array(1, 'InvalidArgumentException', 'Unable to find controller "1".'), - array('foo', 'InvalidArgumentException', 'Unable to find controller "foo".'), - array('oof::bar', 'InvalidArgumentException', 'Class "oof" does not exist.'), - array('stdClass', 'InvalidArgumentException', 'Unable to find controller "stdClass".'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::staticsAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Expected method "staticsAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest", did you mean "staticAction"?'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::privateAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Method "privateAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::protectedAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Method "protectedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::undefinedAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Expected method "undefinedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest". Available methods: "publicAction", "staticAction"'), - ); + return [ + [1, 'InvalidArgumentException', 'Unable to find controller "1".'], + ['foo', 'InvalidArgumentException', 'Unable to find controller "foo".'], + ['oof::bar', 'InvalidArgumentException', 'Class "oof" does not exist.'], + ['stdClass', 'InvalidArgumentException', 'Unable to find controller "stdClass".'], + ['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::staticsAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Expected method "staticsAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest", did you mean "staticAction"?'], + ['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::privateAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Method "privateAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'], + ['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::protectedAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Method "protectedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'], + ['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::undefinedAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Expected method "undefinedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest". Available methods: "publicAction", "staticAction"'], + ]; } /** @@ -152,49 +152,49 @@ public function testGetArguments() $resolver = $this->createControllerResolver(); $request = Request::create('/'); - $controller = array(new self(), 'testGetArguments'); - $this->assertEquals(array(), $resolver->getArguments($request, $controller), '->getArguments() returns an empty array if the method takes no arguments'); + $controller = [new self(), 'testGetArguments']; + $this->assertEquals([], $resolver->getArguments($request, $controller), '->getArguments() returns an empty array if the method takes no arguments'); $request = Request::create('/'); $request->attributes->set('foo', 'foo'); - $controller = array(new self(), 'controllerMethod1'); - $this->assertEquals(array('foo'), $resolver->getArguments($request, $controller), '->getArguments() returns an array of arguments for the controller method'); + $controller = [new self(), 'controllerMethod1']; + $this->assertEquals(['foo'], $resolver->getArguments($request, $controller), '->getArguments() returns an array of arguments for the controller method'); $request = Request::create('/'); $request->attributes->set('foo', 'foo'); - $controller = array(new self(), 'controllerMethod2'); - $this->assertEquals(array('foo', null), $resolver->getArguments($request, $controller), '->getArguments() uses default values if present'); + $controller = [new self(), 'controllerMethod2']; + $this->assertEquals(['foo', null], $resolver->getArguments($request, $controller), '->getArguments() uses default values if present'); $request->attributes->set('bar', 'bar'); - $this->assertEquals(array('foo', 'bar'), $resolver->getArguments($request, $controller), '->getArguments() overrides default values if provided in the request attributes'); + $this->assertEquals(['foo', 'bar'], $resolver->getArguments($request, $controller), '->getArguments() overrides default values if provided in the request attributes'); $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $controller = function ($foo) {}; - $this->assertEquals(array('foo'), $resolver->getArguments($request, $controller)); + $this->assertEquals(['foo'], $resolver->getArguments($request, $controller)); $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $controller = function ($foo, $bar = 'bar') {}; - $this->assertEquals(array('foo', 'bar'), $resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', 'bar'], $resolver->getArguments($request, $controller)); $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $controller = new self(); - $this->assertEquals(array('foo', null), $resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', null], $resolver->getArguments($request, $controller)); $request->attributes->set('bar', 'bar'); - $this->assertEquals(array('foo', 'bar'), $resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', 'bar'], $resolver->getArguments($request, $controller)); $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $request->attributes->set('foobar', 'foobar'); $controller = 'Symfony\Component\HttpKernel\Tests\Controller\some_controller_function'; - $this->assertEquals(array('foo', 'foobar'), $resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', 'foobar'], $resolver->getArguments($request, $controller)); $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $request->attributes->set('foobar', 'foobar'); - $controller = array(new self(), 'controllerMethod3'); + $controller = [new self(), 'controllerMethod3']; try { $resolver->getArguments($request, $controller); @@ -204,8 +204,8 @@ public function testGetArguments() } $request = Request::create('/'); - $controller = array(new self(), 'controllerMethod5'); - $this->assertEquals(array($request), $resolver->getArguments($request, $controller), '->getArguments() injects the request'); + $controller = [new self(), 'controllerMethod5']; + $this->assertEquals([$request], $resolver->getArguments($request, $controller), '->getArguments() injects the request'); } /** @@ -218,14 +218,14 @@ public function testGetVariadicArguments() $request = Request::create('/'); $request->attributes->set('foo', 'foo'); - $request->attributes->set('bar', array('foo', 'bar')); - $controller = array(new VariadicController(), 'action'); - $this->assertEquals(array('foo', 'foo', 'bar'), $resolver->getArguments($request, $controller)); + $request->attributes->set('bar', ['foo', 'bar']); + $controller = [new VariadicController(), 'action']; + $this->assertEquals(['foo', 'foo', 'bar'], $resolver->getArguments($request, $controller)); } public function testCreateControllerCanReturnAnyCallable() { - $mock = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolver')->setMethods(array('createController'))->getMock(); + $mock = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolver')->setMethods(['createController'])->getMock(); $mock->expects($this->once())->method('createController')->will($this->returnValue('Symfony\Component\HttpKernel\Tests\Controller\some_controller_function')); $request = Request::create('/'); @@ -242,7 +242,7 @@ public function testIfExceptionIsThrownWhenMissingAnArgument() $resolver = new ControllerResolver(); $request = Request::create('/'); - $controller = array($this, 'controllerMethod1'); + $controller = [$this, 'controllerMethod1']; $resolver->getArguments($request, $controller); } @@ -259,8 +259,8 @@ public function testGetNullableArguments() $request->attributes->set('foo', 'foo'); $request->attributes->set('bar', new \stdClass()); $request->attributes->set('mandatory', 'mandatory'); - $controller = array(new NullableController(), 'action'); - $this->assertEquals(array('foo', new \stdClass(), 'value', 'mandatory'), $resolver->getArguments($request, $controller)); + $controller = [new NullableController(), 'action']; + $this->assertEquals(['foo', new \stdClass(), 'value', 'mandatory'], $resolver->getArguments($request, $controller)); } /** @@ -273,8 +273,8 @@ public function testGetNullableArgumentsWithDefaults() $request = Request::create('/'); $request->attributes->set('mandatory', 'mandatory'); - $controller = array(new NullableController(), 'action'); - $this->assertEquals(array(null, null, 'value', 'mandatory'), $resolver->getArguments($request, $controller)); + $controller = [new NullableController(), 'action']; + $this->assertEquals([null, null, 'value', 'mandatory'], $resolver->getArguments($request, $controller)); } protected function createControllerResolver(LoggerInterface $logger = null) diff --git a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php b/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php index bf0db5ad565127331b9a96218c20db0af0947ebd..1c0c4648a0f2a7772a40ab4e798b07095ce389f9 100644 --- a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php +++ b/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php @@ -33,55 +33,55 @@ protected function setUp() public function testSignature1() { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature1')); + $arguments = $this->factory->createArgumentMetadata([$this, 'signature1']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', self::class, false, false, null), new ArgumentMetadata('bar', 'array', false, false, null), new ArgumentMetadata('baz', 'callable', false, false, null), - ), $arguments); + ], $arguments); } public function testSignature2() { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature2')); + $arguments = $this->factory->createArgumentMetadata([$this, 'signature2']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', self::class, false, true, null, true), new ArgumentMetadata('bar', __NAMESPACE__.'\FakeClassThatDoesNotExist', false, true, null, true), new ArgumentMetadata('baz', 'Fake\ImportedAndFake', false, true, null, true), - ), $arguments); + ], $arguments); } public function testSignature3() { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature3')); + $arguments = $this->factory->createArgumentMetadata([$this, 'signature3']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('bar', __NAMESPACE__.'\FakeClassThatDoesNotExist', false, false, null), new ArgumentMetadata('baz', 'Fake\ImportedAndFake', false, false, null), - ), $arguments); + ], $arguments); } public function testSignature4() { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature4')); + $arguments = $this->factory->createArgumentMetadata([$this, 'signature4']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', null, false, true, 'default'), new ArgumentMetadata('bar', null, false, true, 500), - new ArgumentMetadata('baz', null, false, true, array()), - ), $arguments); + new ArgumentMetadata('baz', null, false, true, []), + ], $arguments); } public function testSignature5() { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature5')); + $arguments = $this->factory->createArgumentMetadata([$this, 'signature5']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', 'array', false, true, null, true), new ArgumentMetadata('bar', null, false, false, null), - ), $arguments); + ], $arguments); } /** @@ -89,12 +89,12 @@ public function testSignature5() */ public function testVariadicSignature() { - $arguments = $this->factory->createArgumentMetadata(array(new VariadicController(), 'action')); + $arguments = $this->factory->createArgumentMetadata([new VariadicController(), 'action']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', null, false, false, null), new ArgumentMetadata('bar', null, true, false, null), - ), $arguments); + ], $arguments); } /** @@ -102,13 +102,13 @@ public function testVariadicSignature() */ public function testBasicTypesSignature() { - $arguments = $this->factory->createArgumentMetadata(array(new BasicTypesController(), 'action')); + $arguments = $this->factory->createArgumentMetadata([new BasicTypesController(), 'action']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', 'string', false, false, null), new ArgumentMetadata('bar', 'int', false, false, null), new ArgumentMetadata('baz', 'float', false, false, null), - ), $arguments); + ], $arguments); } /** @@ -116,14 +116,14 @@ public function testBasicTypesSignature() */ public function testNullableTypesSignature() { - $arguments = $this->factory->createArgumentMetadata(array(new NullableController(), 'action')); + $arguments = $this->factory->createArgumentMetadata([new NullableController(), 'action']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', 'string', false, false, null, true), new ArgumentMetadata('bar', \stdClass::class, false, false, null, true), new ArgumentMetadata('baz', 'string', false, true, 'value', true), new ArgumentMetadata('mandatory', null, false, false, null, true), - ), $arguments); + ], $arguments); } private function signature1(self $foo, array $bar, callable $baz) @@ -138,7 +138,7 @@ private function signature3(FakeClassThatDoesNotExist $bar, ImportedAndFake $baz { } - private function signature4($foo = 'default', $bar = 500, $baz = array()) + private function signature4($foo = 'default', $bar = 500, $baz = []) { } diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php index a99e34ad4288d55af106878512d96a02e1206884..a858eabe155f2288837cf9f124a0fc5ccce9775b 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -39,8 +39,8 @@ public function testCollect() $this->assertSame(Kernel::VERSION, $c->getSymfonyVersion()); $this->assertNull($c->getToken()); $this->assertSame(\extension_loaded('xdebug'), $c->hasXDebug()); - $this->assertSame(\extension_loaded('Zend OPcache') && ini_get('opcache.enable'), $c->hasZendOpcache()); - $this->assertSame(\extension_loaded('apcu') && ini_get('apc.enabled'), $c->hasApcu()); + $this->assertSame(\extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN), $c->hasZendOpcache()); + $this->assertSame(\extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN), $c->hasApcu()); } } @@ -57,7 +57,7 @@ public function registerBundles() public function getBundles() { - return array(); + return []; } public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php index 54fd39e0d8c8f65d57ead5c5069fd5725e79c33a..ae79a3c93c5043b8c86d4956b34fe70431068430 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php @@ -30,7 +30,7 @@ public function testCloneVarStringWithScheme() public function testCloneVarExistingFilePath() { - $c = new CloneVarDataCollector(array($filePath = tempnam(sys_get_temp_dir(), 'clone_var_data_collector_'))); + $c = new CloneVarDataCollector([$filePath = tempnam(sys_get_temp_dir(), 'clone_var_data_collector_')]); $c->collect(new Request(), new Response()); $this->assertSame($filePath, $c->getData()[0]); diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php index fd5ea11e720b5da847be0be0bcd0bc9a2afd3ea4..ebe50e378b8715b9193be97a02af7836da83c908 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -25,7 +25,7 @@ class DumpDataCollectorTest extends TestCase { public function testDump() { - $data = new Data(array(array(123))); + $data = new Data([[123]]); $collector = new DumpDataCollector(); @@ -40,15 +40,15 @@ public function testDump() $dump[0]['data'] = preg_replace('/^.*?<pre/', '<pre', $dump[0]['data']); $dump[0]['data'] = preg_replace('/sf-dump-\d+/', 'sf-dump', $dump[0]['data']); - $xDump = array( - array( + $xDump = [ + [ 'data' => "<pre class=sf-dump id=sf-dump data-indent-pad=\" \"><span class=sf-dump-num>123</span>\n</pre><script>Sfdump(\"sf-dump\")</script>\n", 'name' => 'DumpDataCollectorTest.php', 'file' => __FILE__, 'line' => $line, 'fileExcerpt' => false, - ), - ); + ], + ]; $this->assertEquals($xDump, $dump); $this->assertStringMatchesFormat('a:3:{i:0;a:5:{s:4:"data";%c:39:"Symfony\Component\VarDumper\Cloner\Data":%a', $collector->serialize()); @@ -58,7 +58,7 @@ public function testDump() public function testCollectDefault() { - $data = new Data(array(array(123))); + $data = new Data([[123]]); $collector = new DumpDataCollector(); @@ -76,7 +76,7 @@ public function testCollectDefault() public function testCollectHtml() { - $data = new Data(array(array(123))); + $data = new Data([[123]]); $collector = new DumpDataCollector(null, 'test://%f:%l'); @@ -104,7 +104,7 @@ public function testCollectHtml() public function testFlush() { - $data = new Data(array(array(456))); + $data = new Data([[456]]); $collector = new DumpDataCollector(); $collector->dump($data); $line = __LINE__ - 1; @@ -117,7 +117,7 @@ public function testFlush() public function testFlushNothingWhenDataDumperIsProvided() { - $data = new Data(array(array(456))); + $data = new Data([[456]]); $dumper = new CliDumper('php://output'); $collector = new DumpDataCollector(null, null, null, null, $dumper); @@ -125,11 +125,8 @@ public function testFlushNothingWhenDataDumperIsProvided() $collector->dump($data); $line = __LINE__ - 1; $output = preg_replace("/\033\[[^m]*m/", '', ob_get_clean()); - if (\PHP_VERSION_ID >= 50400) { - $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", $output); - } else { - $this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", $output); - } + + $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", $output); ob_start(); $collector->__destruct(); diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php index 3dec3bd7f87a00878a9167ca2508c72f5b98a1dd..90151ae44afdf59027d440768f70e9093a29f2d3 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php @@ -21,24 +21,24 @@ public function testCollectWithUnexpectedFormat() { $logger = $this ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') - ->setMethods(array('countErrors', 'getLogs', 'clear')) + ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); $logger->expects($this->once())->method('countErrors')->will($this->returnValue('foo')); - $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue(array())); + $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue([])); $c = new LoggerDataCollector($logger, __DIR__.'/'); $c->lateCollect(); $compilerLogs = $c->getCompilerLogs()->getValue('message'); - $this->assertSame(array( - array('message' => 'Removed service "Psr\Container\ContainerInterface"; reason: private alias.'), - array('message' => 'Removed service "Symfony\Component\DependencyInjection\ContainerInterface"; reason: private alias.'), - ), $compilerLogs['Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass']); + $this->assertSame([ + ['message' => 'Removed service "Psr\Container\ContainerInterface"; reason: private alias.'], + ['message' => 'Removed service "Symfony\Component\DependencyInjection\ContainerInterface"; reason: private alias.'], + ], $compilerLogs['Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass']); - $this->assertSame(array( - array('message' => 'Some custom logging message'), - array('message' => 'With ending :'), - ), $compilerLogs['Unknown Compiler Pass']); + $this->assertSame([ + ['message' => 'Some custom logging message'], + ['message' => 'With ending :'], + ], $compilerLogs['Unknown Compiler Pass']); } /** @@ -48,7 +48,7 @@ public function testCollect($nb, $logs, $expectedLogs, $expectedDeprecationCount { $logger = $this ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') - ->setMethods(array('countErrors', 'getLogs', 'clear')) + ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); $logger->expects($this->once())->method('countErrors')->will($this->returnValue($nb)); $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue($logs)); @@ -62,7 +62,7 @@ public function testCollect($nb, $logs, $expectedLogs, $expectedDeprecationCount $logs = array_map(function ($v) { if (isset($v['context']['exception'])) { $e = &$v['context']['exception']; - $e = isset($e["\0*\0message"]) ? array($e["\0*\0message"], $e["\0*\0severity"]) : array($e["\0Symfony\Component\Debug\Exception\SilencedErrorContext\0severity"]); + $e = isset($e["\0*\0message"]) ? [$e["\0*\0message"], $e["\0*\0severity"]] : [$e["\0Symfony\Component\Debug\Exception\SilencedErrorContext\0severity"]]; } return $v; @@ -80,7 +80,7 @@ public function testReset() { $logger = $this ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') - ->setMethods(array('countErrors', 'getLogs', 'clear')) + ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); $logger->expects($this->once())->method('clear'); @@ -90,55 +90,55 @@ public function testReset() public function getCollectTestData() { - yield 'simple log' => array( + yield 'simple log' => [ 1, - array(array('message' => 'foo', 'context' => array(), 'priority' => 100, 'priorityName' => 'DEBUG')), - array(array('message' => 'foo', 'context' => array(), 'priority' => 100, 'priorityName' => 'DEBUG')), + [['message' => 'foo', 'context' => [], 'priority' => 100, 'priorityName' => 'DEBUG']], + [['message' => 'foo', 'context' => [], 'priority' => 100, 'priorityName' => 'DEBUG']], 0, 0, - ); + ]; - yield 'log with a context' => array( + yield 'log with a context' => [ 1, - array(array('message' => 'foo', 'context' => array('foo' => 'bar'), 'priority' => 100, 'priorityName' => 'DEBUG')), - array(array('message' => 'foo', 'context' => array('foo' => 'bar'), 'priority' => 100, 'priorityName' => 'DEBUG')), + [['message' => 'foo', 'context' => ['foo' => 'bar'], 'priority' => 100, 'priorityName' => 'DEBUG']], + [['message' => 'foo', 'context' => ['foo' => 'bar'], 'priority' => 100, 'priorityName' => 'DEBUG']], 0, 0, - ); + ]; if (!class_exists(SilencedErrorContext::class)) { return; } - yield 'logs with some deprecations' => array( + yield 'logs with some deprecations' => [ 1, - array( - array('message' => 'foo3', 'context' => array('exception' => new \ErrorException('warning', 0, E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo', 'context' => array('exception' => new \ErrorException('deprecated', 0, E_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo2', 'context' => array('exception' => new \ErrorException('deprecated', 0, E_USER_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG'), - ), - array( - array('message' => 'foo3', 'context' => array('exception' => array('warning', E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo', 'context' => array('exception' => array('deprecated', E_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false), - array('message' => 'foo2', 'context' => array('exception' => array('deprecated', E_USER_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false), - ), + [ + ['message' => 'foo3', 'context' => ['exception' => new \ErrorException('warning', 0, E_USER_WARNING)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo', 'context' => ['exception' => new \ErrorException('deprecated', 0, E_DEPRECATED)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo2', 'context' => ['exception' => new \ErrorException('deprecated', 0, E_USER_DEPRECATED)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ], + [ + ['message' => 'foo3', 'context' => ['exception' => ['warning', E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo', 'context' => ['exception' => ['deprecated', E_DEPRECATED]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false], + ['message' => 'foo2', 'context' => ['exception' => ['deprecated', E_USER_DEPRECATED]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false], + ], 2, 0, - array(100 => array('count' => 3, 'name' => 'DEBUG')), - ); + [100 => ['count' => 3, 'name' => 'DEBUG']], + ]; - yield 'logs with some silent errors' => array( + yield 'logs with some silent errors' => [ 1, - array( - array('message' => 'foo3', 'context' => array('exception' => new \ErrorException('warning', 0, E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo3', 'context' => array('exception' => new SilencedErrorContext(E_USER_WARNING, __FILE__, __LINE__)), 'priority' => 100, 'priorityName' => 'DEBUG'), - ), - array( - array('message' => 'foo3', 'context' => array('exception' => array('warning', E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo3', 'context' => array('exception' => array(E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true), - ), + [ + ['message' => 'foo3', 'context' => ['exception' => new \ErrorException('warning', 0, E_USER_WARNING)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo3', 'context' => ['exception' => new SilencedErrorContext(E_USER_WARNING, __FILE__, __LINE__)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ], + [ + ['message' => 'foo3', 'context' => ['exception' => ['warning', E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo3', 'context' => ['exception' => [E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true], + ], 0, 1, - ); + ]; } } diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php index 1435d05e83c3aa668583eeb7b40682646e641b89..c434ed1e1162bb773a6a779dd61ccc5a8660560d 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php @@ -39,21 +39,21 @@ public function testBytesConversion($limit, $bytes) public function getBytesConversionTestData() { - return array( - array('2k', 2048), - array('2 k', 2048), - array('8m', 8 * 1024 * 1024), - array('+2 k', 2048), - array('+2???k', 2048), - array('0x10', 16), - array('0xf', 15), - array('010', 8), - array('+0x10 k', 16 * 1024), - array('1g', 1024 * 1024 * 1024), - array('1G', 1024 * 1024 * 1024), - array('-1', -1), - array('0', 0), - array('2mk', 2048), // the unit must be the last char, so in this case 'k', not 'm' - ); + return [ + ['2k', 2048], + ['2 k', 2048], + ['8m', 8 * 1024 * 1024], + ['+2 k', 2048], + ['+2???k', 2048], + ['0x10', 16], + ['0xf', 15], + ['010', 8], + ['+0x10 k', 16 * 1024], + ['1g', 1024 * 1024 * 1024], + ['1G', 1024 * 1024 * 1024], + ['-1', -1], + ['0', 0], + ['2mk', 2048], // the unit must be the last char, so in this case 'k', not 'm' + ]; } } diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php index cce08e27c4cc5d1c0232a79b9ce9ca00b473915d..5e97267da5423ed195a12fd0811c95c28e3ed327 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php @@ -48,8 +48,8 @@ public function testCollect() $this->assertInstanceOf(ParameterBag::class, $c->getResponseCookies()); $this->assertSame('html', $c->getFormat()); $this->assertEquals('foobar', $c->getRoute()); - $this->assertEquals(array('name' => 'foo'), $c->getRouteParams()); - $this->assertSame(array(), $c->getSessionAttributes()); + $this->assertEquals(['name' => 'foo'], $c->getRouteParams()); + $this->assertSame([], $c->getSessionAttributes()); $this->assertSame('en', $c->getLocale()); $this->assertContains(__FILE__, $attributes->get('resource')); $this->assertSame('stdClass', $attributes->get('object')->getType()); @@ -62,13 +62,13 @@ public function testCollect() public function testCollectWithoutRouteParams() { - $request = $this->createRequest(array()); + $request = $this->createRequest([]); $c = new RequestDataCollector(); $c->collect($request, $this->createResponse()); $c->lateCollect(); - $this->assertEquals(array(), $c->getRouteParams()); + $this->assertEquals([], $c->getRouteParams()); } /** @@ -94,95 +94,95 @@ public function provideControllerCallables() $r3 = new \ReflectionClass($this); // test name, callable, expected - return array( - array( + return [ + [ '"Regular" callable', - array($this, 'testControllerInspection'), - array( + [$this, 'testControllerInspection'], + [ 'class' => __NAMESPACE__.'\RequestDataCollectorTest', 'method' => 'testControllerInspection', 'file' => __FILE__, 'line' => $r1->getStartLine(), - ), - ), + ], + ], - array( + [ 'Closure', function () { return 'foo'; }, - array( + [ 'class' => __NAMESPACE__.'\{closure}', 'method' => null, 'file' => __FILE__, 'line' => __LINE__ - 5, - ), - ), + ], + ], - array( + [ 'Static callback as string', __NAMESPACE__.'\RequestDataCollectorTest::staticControllerMethod', - array( + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => 'staticControllerMethod', 'file' => __FILE__, 'line' => $r2->getStartLine(), - ), - ), + ], + ], - array( + [ 'Static callable with instance', - array($this, 'staticControllerMethod'), - array( + [$this, 'staticControllerMethod'], + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => 'staticControllerMethod', 'file' => __FILE__, 'line' => $r2->getStartLine(), - ), - ), + ], + ], - array( + [ 'Static callable with class name', - array('Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'staticControllerMethod'), - array( + ['Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'staticControllerMethod'], + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => 'staticControllerMethod', 'file' => __FILE__, 'line' => $r2->getStartLine(), - ), - ), + ], + ], - array( + [ 'Callable with instance depending on __call()', - array($this, 'magicMethod'), - array( + [$this, 'magicMethod'], + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => 'magicMethod', 'file' => 'n/a', 'line' => 'n/a', - ), - ), + ], + ], - array( + [ 'Callable with class name depending on __callStatic()', - array('Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'magicMethod'), - array( + ['Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'magicMethod'], + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => 'magicMethod', 'file' => 'n/a', 'line' => 'n/a', - ), - ), + ], + ], - array( + [ 'Invokable controller', $this, - array( + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => null, 'file' => __FILE__, 'line' => $r3->getStartLine(), - ), - ), - ); + ], + ], + ]; } public function testItIgnoresInvalidCallables() @@ -199,9 +199,9 @@ public function testItIgnoresInvalidCallables() public function testItAddsRedirectedAttributesWhenRequestContainsSpecificCookie() { $request = $this->createRequest(); - $request->cookies->add(array( + $request->cookies->add([ 'sf_redirect' => '{}', - )); + ]); $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock(); @@ -233,9 +233,9 @@ public function testItCollectsTheRedirectionAndClearTheCookie() $request = $this->createRequest(); $request->attributes->set('_redirected', true); - $request->cookies->add(array( + $request->cookies->add([ 'sf_redirect' => '{"method": "POST"}', - )); + ]); $c->collect($request, $response = $this->createResponse()); $c->lateCollect(); @@ -246,7 +246,7 @@ public function testItCollectsTheRedirectionAndClearTheCookie() $this->assertNull($cookie->getValue()); } - protected function createRequest($routeParams = array('name' => 'foo')) + protected function createRequest($routeParams = ['name' => 'foo']) { $request = Request::create('http://test.com/foo?bar=baz'); $request->attributes->set('foo', 'bar'); diff --git a/vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php b/vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php index e14780ac687f378a51804219abd7d049a9a32933..5c93bd90e356543397e0cf38aedebd7fbfd81f3d 100644 --- a/vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php +++ b/vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php @@ -37,7 +37,6 @@ public function testWhenFileLinkFormatAndNoRequest() public function testWhenFileLinkFormatAndRequest() { $file = __DIR__.\DIRECTORY_SEPARATOR.'file.php'; - $baseDir = __DIR__; $requestStack = new RequestStack(); $request = new Request(); $requestStack->push($request); @@ -56,12 +55,12 @@ public function testWhenNoFileLinkFormatAndRequest() $request->server->set('SERVER_NAME', 'www.example.org'); $request->server->set('SERVER_PORT', 80); - $request->server->set('SCRIPT_NAME', '/app.php'); - $request->server->set('SCRIPT_FILENAME', '/web/app.php'); - $request->server->set('REQUEST_URI', '/app.php/example'); + $request->server->set('SCRIPT_NAME', '/index.php'); + $request->server->set('SCRIPT_FILENAME', '/public/index.php'); + $request->server->set('REQUEST_URI', '/index.php/example'); $sut = new FileLinkFormatter(null, $requestStack, __DIR__, '/_profiler/open?file=%f&line=%l#line%l'); - $this->assertSame('http://www.example.org/app.php/_profiler/open?file=file.php&line=3#line3', $sut->format($file, 3)); + $this->assertSame('http://www.example.org/_profiler/open?file=file.php&line=3#line3', $sut->format($file, 3)); } } diff --git a/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php index 3de147c7f79fb9a62c81fc49255183cfa0620c25..8b8e91aeb474d8eccb83c072fe379d63440378ee 100644 --- a/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php +++ b/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php @@ -31,7 +31,7 @@ public function testStopwatchSections() $kernel->terminate($request, $response); $events = $stopwatch->getSectionEvents($response->headers->get('X-Debug-Token')); - $this->assertEquals(array( + $this->assertEquals([ '__section__', 'kernel.request', 'kernel.controller', @@ -39,13 +39,13 @@ public function testStopwatchSections() 'controller', 'kernel.response', 'kernel.terminate', - ), array_keys($events)); + ], array_keys($events)); } public function testStopwatchCheckControllerOnRequestEvent() { $stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch') - ->setMethods(array('isStarted')) + ->setMethods(['isStarted']) ->getMock(); $stopwatch->expects($this->once()) ->method('isStarted') @@ -61,7 +61,7 @@ public function testStopwatchCheckControllerOnRequestEvent() public function testStopwatchStopControllerOnRequestEvent() { $stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch') - ->setMethods(array('isStarted', 'stop', 'stopSection')) + ->setMethods(['isStarted', 'stop', 'stopSection']) ->getMock(); $stopwatch->expects($this->once()) ->method('isStarted') @@ -114,7 +114,7 @@ protected function getHttpKernel($dispatcher, $controller) $controllerResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface')->getMock(); $controllerResolver->expects($this->once())->method('getController')->will($this->returnValue($controller)); $argumentResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface')->getMock(); - $argumentResolver->expects($this->once())->method('getArguments')->will($this->returnValue(array())); + $argumentResolver->expects($this->once())->method('getArguments')->will($this->returnValue([])); return new HttpKernel($dispatcher, $controllerResolver, new RequestStack(), $argumentResolver); } diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php index a2fb6afca4da03f9749c9428fbc9ba22288210d3..914b1dd8d68e0e35b0f0a6a2c262c9a1b69fa142 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php @@ -24,76 +24,76 @@ public function testExpandClasses() $r->setAccessible(true); $expand = $r->getClosure($pass); - $this->assertSame('Foo', $expand(array('Foo'), array())[0]); - $this->assertSame('Foo', $expand(array('\\Foo'), array())[0]); - $this->assertSame('Foo', $expand(array('Foo'), array('\\Foo'))[0]); - $this->assertSame('Foo', $expand(array('Foo'), array('Foo'))[0]); - $this->assertSame('Foo', $expand(array('\\Foo'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo', $expand(array('Foo'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo', $expand(array('\\Foo'), array('\\Foo\\Bar\\Acme'))[0]); + $this->assertSame('Foo', $expand(['Foo'], [])[0]); + $this->assertSame('Foo', $expand(['\\Foo'], [])[0]); + $this->assertSame('Foo', $expand(['Foo'], ['\\Foo'])[0]); + $this->assertSame('Foo', $expand(['Foo'], ['Foo'])[0]); + $this->assertSame('Foo', $expand(['\\Foo'], ['\\Foo\\Bar'])[0]); + $this->assertSame('Foo', $expand(['Foo'], ['\\Foo\\Bar'])[0]); + $this->assertSame('Foo', $expand(['\\Foo'], ['\\Foo\\Bar\\Acme'])[0]); - $this->assertSame('Foo\\Bar', $expand(array('Foo\\'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo\\Bar\\Acme', $expand(array('Foo\\'), array('\\Foo\\Bar\\Acme'))[0]); - $this->assertEmpty($expand(array('Foo\\'), array('\\Foo'))); + $this->assertSame('Foo\\Bar', $expand(['Foo\\'], ['\\Foo\\Bar'])[0]); + $this->assertSame('Foo\\Bar\\Acme', $expand(['Foo\\'], ['\\Foo\\Bar\\Acme'])[0]); + $this->assertEmpty($expand(['Foo\\'], ['\\Foo'])); - $this->assertSame('Acme\\Foo\\Bar', $expand(array('**\\Foo\\'), array('\\Acme\\Foo\\Bar'))[0]); - $this->assertEmpty($expand(array('**\\Foo\\'), array('\\Foo\\Bar'))); - $this->assertEmpty($expand(array('**\\Foo\\'), array('\\Acme\\Foo'))); - $this->assertEmpty($expand(array('**\\Foo\\'), array('\\Foo'))); + $this->assertSame('Acme\\Foo\\Bar', $expand(['**\\Foo\\'], ['\\Acme\\Foo\\Bar'])[0]); + $this->assertEmpty($expand(['**\\Foo\\'], ['\\Foo\\Bar'])); + $this->assertEmpty($expand(['**\\Foo\\'], ['\\Acme\\Foo'])); + $this->assertEmpty($expand(['**\\Foo\\'], ['\\Foo'])); - $this->assertSame('Acme\\Foo', $expand(array('**\\Foo'), array('\\Acme\\Foo'))[0]); - $this->assertEmpty($expand(array('**\\Foo'), array('\\Acme\\Foo\\AcmeBundle'))); - $this->assertEmpty($expand(array('**\\Foo'), array('\\Acme\\FooBar\\AcmeBundle'))); + $this->assertSame('Acme\\Foo', $expand(['**\\Foo'], ['\\Acme\\Foo'])[0]); + $this->assertEmpty($expand(['**\\Foo'], ['\\Acme\\Foo\\AcmeBundle'])); + $this->assertEmpty($expand(['**\\Foo'], ['\\Acme\\FooBar\\AcmeBundle'])); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\*\\Bar'), array('\\Foo\\Acme\\Bar'))[0]); - $this->assertEmpty($expand(array('Foo\\*\\Bar'), array('\\Foo\\Acme\\Bundle\\Bar'))); + $this->assertSame('Foo\\Acme\\Bar', $expand(['Foo\\*\\Bar'], ['\\Foo\\Acme\\Bar'])[0]); + $this->assertEmpty($expand(['Foo\\*\\Bar'], ['\\Foo\\Acme\\Bundle\\Bar'])); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\**\\Bar'), array('\\Foo\\Acme\\Bar'))[0]); - $this->assertSame('Foo\\Acme\\Bundle\\Bar', $expand(array('Foo\\**\\Bar'), array('\\Foo\\Acme\\Bundle\\Bar'))[0]); + $this->assertSame('Foo\\Acme\\Bar', $expand(['Foo\\**\\Bar'], ['\\Foo\\Acme\\Bar'])[0]); + $this->assertSame('Foo\\Acme\\Bundle\\Bar', $expand(['Foo\\**\\Bar'], ['\\Foo\\Acme\\Bundle\\Bar'])[0]); - $this->assertSame('Acme\\Bar', $expand(array('*\\Bar'), array('\\Acme\\Bar'))[0]); - $this->assertEmpty($expand(array('*\\Bar'), array('\\Bar'))); - $this->assertEmpty($expand(array('*\\Bar'), array('\\Foo\\Acme\\Bar'))); + $this->assertSame('Acme\\Bar', $expand(['*\\Bar'], ['\\Acme\\Bar'])[0]); + $this->assertEmpty($expand(['*\\Bar'], ['\\Bar'])); + $this->assertEmpty($expand(['*\\Bar'], ['\\Foo\\Acme\\Bar'])); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('**\\Bar'), array('\\Foo\\Acme\\Bar'))[0]); - $this->assertSame('Foo\\Acme\\Bundle\\Bar', $expand(array('**\\Bar'), array('\\Foo\\Acme\\Bundle\\Bar'))[0]); - $this->assertEmpty($expand(array('**\\Bar'), array('\\Bar'))); + $this->assertSame('Foo\\Acme\\Bar', $expand(['**\\Bar'], ['\\Foo\\Acme\\Bar'])[0]); + $this->assertSame('Foo\\Acme\\Bundle\\Bar', $expand(['**\\Bar'], ['\\Foo\\Acme\\Bundle\\Bar'])[0]); + $this->assertEmpty($expand(['**\\Bar'], ['\\Bar'])); - $this->assertSame('Foo\\Bar', $expand(array('Foo\\*'), array('\\Foo\\Bar'))[0]); - $this->assertEmpty($expand(array('Foo\\*'), array('\\Foo\\Acme\\Bar'))); + $this->assertSame('Foo\\Bar', $expand(['Foo\\*'], ['\\Foo\\Bar'])[0]); + $this->assertEmpty($expand(['Foo\\*'], ['\\Foo\\Acme\\Bar'])); - $this->assertSame('Foo\\Bar', $expand(array('Foo\\**'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\**'), array('\\Foo\\Acme\\Bar'))[0]); + $this->assertSame('Foo\\Bar', $expand(['Foo\\**'], ['\\Foo\\Bar'])[0]); + $this->assertSame('Foo\\Acme\\Bar', $expand(['Foo\\**'], ['\\Foo\\Acme\\Bar'])[0]); - $this->assertSame(array('Foo\\Bar'), $expand(array('Foo\\*'), array('Foo\\Bar', 'Foo\\BarTest'))); - $this->assertSame(array('Foo\\Bar', 'Foo\\BarTest'), $expand(array('Foo\\*', 'Foo\\*Test'), array('Foo\\Bar', 'Foo\\BarTest'))); + $this->assertSame(['Foo\\Bar'], $expand(['Foo\\*'], ['Foo\\Bar', 'Foo\\BarTest'])); + $this->assertSame(['Foo\\Bar', 'Foo\\BarTest'], $expand(['Foo\\*', 'Foo\\*Test'], ['Foo\\Bar', 'Foo\\BarTest'])); $this->assertSame( 'Acme\\FooBundle\\Controller\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Acme\\FooBundle\\Controller\\DefaultController'))[0] + $expand(['**Bundle\\Controller\\'], ['\\Acme\\FooBundle\\Controller\\DefaultController'])[0] ); $this->assertSame( 'FooBundle\\Controller\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\FooBundle\\Controller\\DefaultController'))[0] + $expand(['**Bundle\\Controller\\'], ['\\FooBundle\\Controller\\DefaultController'])[0] ); $this->assertSame( 'Acme\\FooBundle\\Controller\\Bar\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Acme\\FooBundle\\Controller\\Bar\\DefaultController'))[0] + $expand(['**Bundle\\Controller\\'], ['\\Acme\\FooBundle\\Controller\\Bar\\DefaultController'])[0] ); $this->assertSame( 'Bundle\\Controller\\Bar\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Bundle\\Controller\\Bar\\DefaultController'))[0] + $expand(['**Bundle\\Controller\\'], ['\\Bundle\\Controller\\Bar\\DefaultController'])[0] ); $this->assertSame( 'Acme\\Bundle\\Controller\\Bar\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Acme\\Bundle\\Controller\\Bar\\DefaultController'))[0] + $expand(['**Bundle\\Controller\\'], ['\\Acme\\Bundle\\Controller\\Bar\\DefaultController'])[0] ); - $this->assertSame('Foo\\Bar', $expand(array('Foo\\Bar'), array())[0]); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\**'), array('\\Foo\\Acme\\Bar'))[0]); + $this->assertSame('Foo\\Bar', $expand(['Foo\\Bar'], [])[0]); + $this->assertSame('Foo\\Acme\\Bar', $expand(['Foo\\**'], ['\\Foo\\Acme\\Bar'])[0]); } } diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php index df8977de0b4ff07d9cca85103f99863017619520..871b7e0ee845e32e21d8c93025ab00a5c7a66c64 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php @@ -22,19 +22,19 @@ class ControllerArgumentValueResolverPassTest extends TestCase { public function testServicesAreOrderedAccordingToPriority() { - $services = array( - 'n3' => array(array()), - 'n1' => array(array('priority' => 200)), - 'n2' => array(array('priority' => 100)), - ); + $services = [ + 'n3' => [[]], + 'n1' => [['priority' => 200]], + 'n2' => [['priority' => 100]], + ]; - $expected = array( + $expected = [ new Reference('n1'), new Reference('n2'), new Reference('n3'), - ); + ]; - $definition = new Definition(ArgumentResolver::class, array(null, array())); + $definition = new Definition(ArgumentResolver::class, [null, []]); $container = new ContainerBuilder(); $container->setDefinition('argument_resolver', $definition); @@ -48,12 +48,12 @@ public function testServicesAreOrderedAccordingToPriority() public function testReturningEmptyArrayWhenNoService() { - $definition = new Definition(ArgumentResolver::class, array(null, array())); + $definition = new Definition(ArgumentResolver::class, [null, []]); $container = new ContainerBuilder(); $container->setDefinition('argument_resolver', $definition); (new ControllerArgumentValueResolverPass())->process($container); - $this->assertEquals(array(), $definition->getArgument(1)->getValues()); + $this->assertEquals([], $definition->getArgument(1)->getValues()); } public function testNoArgumentResolver() diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php index e8957bb3ccfac88a809ef81fdda532ce490f8d17..087c66659633c3d1540e1651459dbc342f635506 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php @@ -33,12 +33,12 @@ public function testContentRendererWithoutInterface() $builder = new ContainerBuilder(); $fragmentHandlerDefinition = $builder->register('fragment.handler'); $builder->register('my_content_renderer', 'Symfony\Component\DependencyInjection\Definition') - ->addTag('kernel.fragment_renderer', array('alias' => 'foo')); + ->addTag('kernel.fragment_renderer', ['alias' => 'foo']); $pass = new FragmentRendererPass(); $pass->process($builder); - $this->assertEquals(array(array('addRendererService', array('foo', 'my_content_renderer'))), $fragmentHandlerDefinition->getMethodCalls()); + $this->assertEquals([['addRendererService', ['foo', 'my_content_renderer']]], $fragmentHandlerDefinition->getMethodCalls()); } public function testValidContentRenderer() @@ -47,20 +47,20 @@ public function testValidContentRenderer() $fragmentHandlerDefinition = $builder->register('fragment.handler') ->addArgument(null); $builder->register('my_content_renderer', 'Symfony\Component\HttpKernel\Tests\DependencyInjection\RendererService') - ->addTag('kernel.fragment_renderer', array('alias' => 'foo')); + ->addTag('kernel.fragment_renderer', ['alias' => 'foo']); $pass = new FragmentRendererPass(); $pass->process($builder); $serviceLocatorDefinition = $builder->getDefinition((string) $fragmentHandlerDefinition->getArgument(0)); $this->assertSame(ServiceLocator::class, $serviceLocatorDefinition->getClass()); - $this->assertEquals(array('foo' => new ServiceClosureArgument(new Reference('my_content_renderer'))), $serviceLocatorDefinition->getArgument(0)); + $this->assertEquals(['foo' => new ServiceClosureArgument(new Reference('my_content_renderer'))], $serviceLocatorDefinition->getArgument(0)); } } class RendererService implements FragmentRendererInterface { - public function render($uri, Request $request = null, array $options = array()) + public function render($uri, Request $request = null, array $options = []) { } diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php index ae421d919bfd845b1f6158d3cf8f8b236a96f0b9..7af756e0b8c100c423ea1f2ed24eabf0d25bb7f2 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php @@ -23,9 +23,9 @@ public function testAutoloadMainExtension() $container = new ContainerBuilder(); $container->registerExtension(new LoadedExtension()); $container->registerExtension(new NotLoadedExtension()); - $container->loadFromExtension('loaded', array()); + $container->loadFromExtension('loaded', []); - $configPass = new MergeExtensionConfigurationPass(array('loaded', 'not_loaded')); + $configPass = new MergeExtensionConfigurationPass(['loaded', 'not_loaded']); $configPass->process($container); $this->assertTrue($container->hasDefinition('loaded.foo')); diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php index ca121c732711e51aaa2c412c8c10d72ef1c8e550..6d0da5fcf868c4403e3be0d14cd98f177cd10461 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php @@ -32,7 +32,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testInvalidClass() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', NotFound::class) ->addTag('controller.service_arguments') @@ -49,10 +49,10 @@ public function testInvalidClass() public function testNoAction() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('argument' => 'bar')) + ->addTag('controller.service_arguments', ['argument' => 'bar']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -66,10 +66,10 @@ public function testNoAction() public function testNoArgument() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction')) + ->addTag('controller.service_arguments', ['action' => 'fooAction']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -83,10 +83,10 @@ public function testNoArgument() public function testNoService() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar')) + ->addTag('controller.service_arguments', ['action' => 'fooAction', 'argument' => 'bar']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -100,10 +100,10 @@ public function testNoService() public function testInvalidMethod() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'barAction', 'argument' => 'bar', 'id' => 'bar_service')) + ->addTag('controller.service_arguments', ['action' => 'barAction', 'argument' => 'bar', 'id' => 'bar_service']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -117,10 +117,10 @@ public function testInvalidMethod() public function testInvalidArgument() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'baz', 'id' => 'bar')) + ->addTag('controller.service_arguments', ['action' => 'fooAction', 'argument' => 'baz', 'id' => 'bar']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -130,7 +130,7 @@ public function testInvalidArgument() public function testAllActions() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) ->addTag('controller.service_arguments') @@ -141,7 +141,7 @@ public function testAllActions() $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertEquals(array('foo:fooAction'), array_keys($locator)); + $this->assertEquals(['foo:fooAction'], array_keys($locator)); $this->assertInstanceof(ServiceClosureArgument::class, $locator['foo:fooAction']); $locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]); @@ -149,18 +149,18 @@ public function testAllActions() $this->assertSame(ServiceLocator::class, $locator->getClass()); $this->assertFalse($locator->isPublic()); - $expected = array('bar' => new ServiceClosureArgument(new TypedReference(ControllerDummy::class, ControllerDummy::class, RegisterTestController::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE))); + $expected = ['bar' => new ServiceClosureArgument(new TypedReference(ControllerDummy::class, ControllerDummy::class, RegisterTestController::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE))]; $this->assertEquals($expected, $locator->getArgument(0)); } public function testExplicitArgument() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar', 'id' => 'bar')) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar', 'id' => 'baz')) // should be ignored, the first wins + ->addTag('controller.service_arguments', ['action' => 'fooAction', 'argument' => 'bar', 'id' => 'bar']) + ->addTag('controller.service_arguments', ['action' => 'fooAction', 'argument' => 'bar', 'id' => 'baz']) // should be ignored, the first wins ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -169,17 +169,17 @@ public function testExplicitArgument() $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); $locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]); - $expected = array('bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, RegisterTestController::class))); + $expected = ['bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, RegisterTestController::class))]; $this->assertEquals($expected, $locator->getArgument(0)); } public function testOptionalArgument() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar', 'id' => '?bar')) + ->addTag('controller.service_arguments', ['action' => 'fooAction', 'argument' => 'bar', 'id' => '?bar']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -188,14 +188,14 @@ public function testOptionalArgument() $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); $locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]); - $expected = array('bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, RegisterTestController::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE))); + $expected = ['bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, RegisterTestController::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE))]; $this->assertEquals($expected, $locator->getArgument(0)); } public function testSkipSetContainer() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', ContainerAwareRegisterTestController::class) ->addTag('controller.service_arguments'); @@ -204,7 +204,7 @@ public function testSkipSetContainer() $pass->process($container); $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertSame(array('foo:fooAction'), array_keys($locator)); + $this->assertSame(['foo:fooAction'], array_keys($locator)); } /** @@ -214,7 +214,7 @@ public function testSkipSetContainer() public function testExceptionOnNonExistentTypeHint() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', NonExistentClassController::class) ->addTag('controller.service_arguments'); @@ -230,7 +230,7 @@ public function testExceptionOnNonExistentTypeHint() public function testExceptionOnNonExistentTypeHintDifferentNamespace() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', NonExistentClassDifferentNamespaceController::class) ->addTag('controller.service_arguments'); @@ -242,7 +242,7 @@ public function testExceptionOnNonExistentTypeHintDifferentNamespace() public function testNoExceptionOnNonExistentTypeHintOptionalArg() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', NonExistentClassOptionalController::class) ->addTag('controller.service_arguments'); @@ -251,13 +251,13 @@ public function testNoExceptionOnNonExistentTypeHintOptionalArg() $pass->process($container); $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertSame(array('foo:barAction', 'foo:fooAction'), array_keys($locator)); + $this->assertSame(['foo:barAction', 'foo:fooAction'], array_keys($locator)); } public function testArgumentWithNoTypeHintIsOk() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', ArgumentWithoutTypeController::class) ->addTag('controller.service_arguments'); @@ -272,7 +272,7 @@ public function testArgumentWithNoTypeHintIsOk() public function testControllersAreMadePublic() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', ArgumentWithoutTypeController::class) ->setPublic(false) @@ -290,10 +290,10 @@ public function testControllersAreMadePublic() public function testBindings($bindingName) { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->setBindings(array($bindingName => new Reference('foo'))) + ->setBindings([$bindingName => new Reference('foo')]) ->addTag('controller.service_arguments'); $pass = new RegisterControllerArgumentLocatorsPass(); @@ -303,22 +303,22 @@ public function testBindings($bindingName) $locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]); - $expected = array('bar' => new ServiceClosureArgument(new Reference('foo'))); + $expected = ['bar' => new ServiceClosureArgument(new Reference('foo'))]; $this->assertEquals($expected, $locator->getArgument(0)); } public function provideBindings() { - return array(array(ControllerDummy::class), array('$bar')); + return [[ControllerDummy::class], ['$bar']]; } public function testDoNotBindScalarValueToControllerArgument() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', ArgumentWithoutTypeController::class) - ->setBindings(array('$someArg' => '%foo%')) + ->setBindings(['$someArg' => '%foo%']) ->addTag('controller.service_arguments'); $pass = new RegisterControllerArgumentLocatorsPass(); @@ -331,12 +331,12 @@ public function testDoNotBindScalarValueToControllerArgument() public function testBindingsOnChildDefinitions() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('parent', ArgumentWithoutTypeController::class); $container->setDefinition('child', (new ChildDefinition('parent')) - ->setBindings(array('$someArg' => new Reference('parent'))) + ->setBindings(['$someArg' => new Reference('parent')]) ->addTag('controller.service_arguments') ); diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php index 9cac9681857f89a5a4dee42f5e437d6ce44da5e2..713ab5441abaa0030d287adaf38272f9afdb8663 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php @@ -23,13 +23,13 @@ class RemoveEmptyControllerArgumentLocatorsPassTest extends TestCase public function testProcess() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('stdClass', 'stdClass'); $container->register(parent::class, 'stdClass'); $container->register('c1', RemoveTestController1::class)->addTag('controller.service_arguments'); $container->register('c2', RemoveTestController2::class)->addTag('controller.service_arguments') - ->addMethodCall('setTestCase', array(new Reference('c1'))); + ->addMethodCall('setTestCase', [new Reference('c1')]); $pass = new RegisterControllerArgumentLocatorsPass(); $pass->process($container); @@ -43,19 +43,19 @@ public function testProcess() (new ResolveInvalidReferencesPass())->process($container); $this->assertCount(1, $container->getDefinition((string) $controllers['c2:setTestCase']->getValues()[0])->getArgument(0)); - $this->assertSame(array(), $container->getDefinition((string) $controllers['c2:fooAction']->getValues()[0])->getArgument(0)); + $this->assertSame([], $container->getDefinition((string) $controllers['c2:fooAction']->getValues()[0])->getArgument(0)); (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); $controllers = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertSame(array('c1:fooAction'), array_keys($controllers)); - $this->assertSame(array('bar'), array_keys($container->getDefinition((string) $controllers['c1:fooAction']->getValues()[0])->getArgument(0))); + $this->assertSame(['c1:fooAction'], array_keys($controllers)); + $this->assertSame(['bar'], array_keys($container->getDefinition((string) $controllers['c1:fooAction']->getValues()[0])->getArgument(0))); - $expectedLog = array( + $expectedLog = [ 'Symfony\Component\HttpKernel\DependencyInjection\RemoveEmptyControllerArgumentLocatorsPass: Removing service-argument resolver for controller "c2:fooAction": no corresponding services exist for the referenced types.', 'Symfony\Component\HttpKernel\DependencyInjection\RemoveEmptyControllerArgumentLocatorsPass: Removing method "setTestCase" of service "c2" from controller candidates: the method is called at instantiation, thus cannot be an action.', - ); + ]; $this->assertSame($expectedLog, $container->getCompiler()->getLog()); } @@ -63,7 +63,7 @@ public function testProcess() public function testSameIdClass() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register(RegisterTestController::class, RegisterTestController::class) ->addTag('controller.service_arguments') @@ -72,17 +72,17 @@ public function testSameIdClass() (new RegisterControllerArgumentLocatorsPass())->process($container); (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); - $expected = array( + $expected = [ RegisterTestController::class.':fooAction', RegisterTestController::class.'::fooAction', - ); + ]; $this->assertEquals($expected, array_keys($container->getDefinition((string) $resolver->getArgument(0))->getArgument(0))); } public function testInvoke() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('invokable', InvokableRegisterTestController::class) ->addTag('controller.service_arguments') @@ -92,7 +92,7 @@ public function testInvoke() (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); $this->assertEquals( - array('invokable:__invoke', 'invokable'), + ['invokable:__invoke', 'invokable'], array_keys($container->getDefinition((string) $resolver->getArgument(0))->getArgument(0)) ); } @@ -100,7 +100,7 @@ public function testInvoke() public function testInvokeSameIdClass() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register(InvokableRegisterTestController::class, InvokableRegisterTestController::class) ->addTag('controller.service_arguments') @@ -109,11 +109,11 @@ public function testInvokeSameIdClass() (new RegisterControllerArgumentLocatorsPass())->process($container); (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); - $expected = array( + $expected = [ InvokableRegisterTestController::class.':__invoke', InvokableRegisterTestController::class.'::__invoke', InvokableRegisterTestController::class, - ); + ]; $this->assertEquals($expected, array_keys($container->getDefinition((string) $resolver->getArgument(0))->getArgument(0))); } } diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php index f7ea16dbfb0360436ee3b7b8c9f9fa496d12bc31..9b23ad003d758100cc55f86750b278eeb6ca5963 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php @@ -19,14 +19,14 @@ public function testCompilerPass() $container = new ContainerBuilder(); $container->register('one', ResettableService::class) ->setPublic(true) - ->addTag('kernel.reset', array('method' => 'reset')); + ->addTag('kernel.reset', ['method' => 'reset']); $container->register('two', ClearableService::class) ->setPublic(true) - ->addTag('kernel.reset', array('method' => 'clear')); + ->addTag('kernel.reset', ['method' => 'clear']); $container->register('services_resetter', ServicesResetter::class) ->setPublic(true) - ->setArguments(array(null, array())); + ->setArguments([null, []]); $container->addCompilerPass(new ResettableServicePass()); $container->compile(); @@ -34,16 +34,16 @@ public function testCompilerPass() $definition = $container->getDefinition('services_resetter'); $this->assertEquals( - array( - new IteratorArgument(array( + [ + new IteratorArgument([ 'one' => new Reference('one', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE), 'two' => new Reference('two', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE), - )), - array( + ]), + [ 'one' => 'reset', 'two' => 'clear', - ), - ), + ], + ], $definition->getArguments() ); } @@ -58,7 +58,7 @@ public function testMissingMethod() $container->register(ResettableService::class) ->addTag('kernel.reset'); $container->register('services_resetter', ServicesResetter::class) - ->setArguments(array(null, array())); + ->setArguments([null, []]); $container->addCompilerPass(new ResettableServicePass()); $container->compile(); @@ -68,7 +68,7 @@ public function testCompilerPassWithoutResetters() { $container = new ContainerBuilder(); $container->register('services_resetter', ServicesResetter::class) - ->setArguments(array(null, array())); + ->setArguments([null, []]); $container->addCompilerPass(new ResettableServicePass()); $container->compile(); diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php index 47c62abd0d99894522f1391cc768f283232c608b..86f1abdb05292682f07448bc5025230cf0912d3f 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php @@ -26,13 +26,13 @@ protected function setUp() public function testResetServices() { - $resetter = new ServicesResetter(new \ArrayIterator(array( + $resetter = new ServicesResetter(new \ArrayIterator([ 'id1' => new ResettableService(), 'id2' => new ClearableService(), - )), array( + ]), [ 'id1' => 'reset', 'id2' => 'clear', - )); + ]); $resetter->reset(); diff --git a/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php b/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php index f1e440b2fc711eda676ea85533679bd758b42b89..abc51ac51e7778724646f40a6029212a83019542 100644 --- a/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php +++ b/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php @@ -11,7 +11,7 @@ class FilterControllerArgumentsEventTest extends TestCase { public function testFilterControllerArgumentsEvent() { - $filterController = new FilterControllerArgumentsEvent(new TestHttpKernel(), function () {}, array('test'), new Request(), 1); - $this->assertEquals($filterController->getArguments(), array('test')); + $filterController = new FilterControllerArgumentsEvent(new TestHttpKernel(), function () {}, ['test'], new Request(), 1); + $this->assertEquals($filterController->getArguments(), ['test']); } } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php index 3ffb9f3d632e43cc3fe355be4cc2bc41a33c1c08..b4ea2f955bb5357a2fa8dedaa6e31e378ec5845e 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php @@ -30,7 +30,7 @@ class AddRequestFormatsListenerTest extends TestCase protected function setUp() { - $this->listener = new AddRequestFormatsListener(array('csv' => array('text/csv', 'text/plain'))); + $this->listener = new AddRequestFormatsListener(['csv' => ['text/csv', 'text/plain']]); } protected function tearDown() @@ -46,7 +46,7 @@ public function testIsAnEventSubscriber() public function testRegisteredEvent() { $this->assertEquals( - array(KernelEvents::REQUEST => array('onKernelRequest', 1)), + [KernelEvents::REQUEST => ['onKernelRequest', 1]], AddRequestFormatsListener::getSubscribedEvents() ); } @@ -58,7 +58,7 @@ public function testSetAdditionalFormats() $request->expects($this->once()) ->method('setFormat') - ->with('csv', array('text/csv', 'text/plain')); + ->with('csv', ['text/csv', 'text/plain']); $this->listener->onKernelRequest($event); } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php index 9a9c17edab527da7d2e539685bc76b95c58b032b..d9e261d35af5eb556fd42fdf2c56585fdc6bc4e5 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php @@ -40,11 +40,11 @@ public function testConfigure() $listener = new DebugHandlersListener($userHandler, $logger); $xHandler = new ExceptionHandler(); $eHandler = new ErrorHandler(); - $eHandler->setExceptionHandler(array($xHandler, 'handle')); + $eHandler->setExceptionHandler([$xHandler, 'handle']); $exception = null; - set_error_handler(array($eHandler, 'handleError')); - set_exception_handler(array($eHandler, 'handleException')); + set_error_handler([$eHandler, 'handleError']); + set_exception_handler([$eHandler, 'handleException']); try { $listener->configure(); } catch (\Exception $exception) { @@ -58,10 +58,10 @@ public function testConfigure() $this->assertSame($userHandler, $xHandler->setHandler('var_dump')); - $loggers = $eHandler->setLoggers(array()); + $loggers = $eHandler->setLoggers([]); $this->assertArrayHasKey(E_DEPRECATED, $loggers); - $this->assertSame(array($logger, LogLevel::INFO), $loggers[E_DEPRECATED]); + $this->assertSame([$logger, LogLevel::INFO], $loggers[E_DEPRECATED]); } public function testConfigureForHttpKernelWithNoTerminateWithException() @@ -75,7 +75,7 @@ public function testConfigureForHttpKernelWithNoTerminateWithException() ); $exception = null; - $h = set_exception_handler(array($eHandler, 'handleException')); + $h = set_exception_handler([$eHandler, 'handleException']); try { $listener->configure($event); } catch (\Exception $exception) { @@ -101,16 +101,16 @@ public function testConsoleEvent() $dispatcher->addSubscriber($listener); - $xListeners = array( - KernelEvents::REQUEST => array(array($listener, 'configure')), - ConsoleEvents::COMMAND => array(array($listener, 'configure')), - ); + $xListeners = [ + KernelEvents::REQUEST => [[$listener, 'configure']], + ConsoleEvents::COMMAND => [[$listener, 'configure']], + ]; $this->assertSame($xListeners, $dispatcher->getListeners()); $exception = null; $eHandler = new ErrorHandler(); - set_error_handler(array($eHandler, 'handleError')); - set_exception_handler(array($eHandler, 'handleException')); + set_error_handler([$eHandler, 'handleError']); + set_exception_handler([$eHandler, 'handleException']); try { $dispatcher->dispatch(ConsoleEvents::COMMAND, $event); } catch (\Exception $exception) { @@ -139,7 +139,7 @@ public function testReplaceExistingExceptionHandler() $eHandler->setExceptionHandler('var_dump'); $exception = null; - set_exception_handler(array($eHandler, 'handleException')); + set_exception_handler([$eHandler, 'handleException']); try { $listener->configure(); } catch (\Exception $exception) { diff --git a/vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php index 509f443087ebe4de5cba010d0fea310a163c6212..b86a7552f85e4eab8ce1629136eb691b58afaf37 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php @@ -29,7 +29,7 @@ class DumpListenerTest extends TestCase public function testSubscribedEvents() { $this->assertSame( - array(ConsoleEvents::COMMAND => array('configure', 1024)), + [ConsoleEvents::COMMAND => ['configure', 1024]], DumpListener::getSubscribedEvents() ); } @@ -68,7 +68,7 @@ class MockCloner implements ClonerInterface { public function cloneVar($var) { - return new Data(array(array($var.'-'))); + return new Data([[$var.'-']]); } } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php index 0b73075e7b8965d345cab69bf7a770e909087e9c..c4e8cd505cbff2149769a8a6333b90a1c14836ed 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php @@ -94,7 +94,7 @@ public function testHandleWithLogger($event, $event2) public function provider() { if (!class_exists('Symfony\Component\HttpFoundation\Request')) { - return array(array(null, null)); + return [[null, null]]; } $request = new Request(); @@ -102,9 +102,9 @@ public function provider() $event = new GetResponseForExceptionEvent(new TestKernel(), $request, HttpKernelInterface::MASTER_REQUEST, $exception); $event2 = new GetResponseForExceptionEvent(new TestKernelThatThrowsException(), $request, HttpKernelInterface::MASTER_REQUEST, $exception); - return array( - array($event, $event2), - ); + return [ + [$event, $event2], + ]; } public function testSubRequestFormat() @@ -142,7 +142,7 @@ public function testCSPHeaderIsRemoved() $event = new GetResponseForExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new \Exception('foo')); $dispatcher->dispatch(KernelEvents::EXCEPTION, $event); - $response = new Response('', 200, array('content-security-policy' => "style-src 'self'")); + $response = new Response('', 200, ['content-security-policy' => "style-src 'self'"]); $this->assertTrue($response->headers->has('content-security-policy')); $event = new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php index edf0498265c80847e40c98910bca2070e70438a7..6408b1b21c7e0f0e41aba37c8da661377a55f086 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php @@ -68,7 +68,7 @@ public function testAccessDeniedWithNonSafeMethods() */ public function testAccessDeniedWithWrongSignature() { - $request = Request::create('http://example.com/_fragment', 'GET', array(), array(), array(), array('REMOTE_ADDR' => '10.0.0.1')); + $request = Request::create('http://example.com/_fragment', 'GET', [], [], [], ['REMOTE_ADDR' => '10.0.0.1']); $listener = new FragmentListener(new UriSigner('foo')); $event = $this->createGetResponseEvent($request); @@ -79,14 +79,14 @@ public function testAccessDeniedWithWrongSignature() public function testWithSignature() { $signer = new UriSigner('foo'); - $request = Request::create($signer->sign('http://example.com/_fragment?_path=foo%3Dbar%26_controller%3Dfoo'), 'GET', array(), array(), array(), array('REMOTE_ADDR' => '10.0.0.1')); + $request = Request::create($signer->sign('http://example.com/_fragment?_path=foo%3Dbar%26_controller%3Dfoo'), 'GET', [], [], [], ['REMOTE_ADDR' => '10.0.0.1']); $listener = new FragmentListener($signer); $event = $this->createGetResponseEvent($request); $listener->onKernelRequest($event); - $this->assertEquals(array('foo' => 'bar', '_controller' => 'foo'), $request->attributes->get('_route_params')); + $this->assertEquals(['foo' => 'bar', '_controller' => 'foo'], $request->attributes->get('_route_params')); $this->assertFalse($request->query->has('_path')); } @@ -105,7 +105,7 @@ public function testRemovesPathWithControllerDefined() public function testRemovesPathWithControllerNotDefined() { $signer = new UriSigner('foo'); - $request = Request::create($signer->sign('http://example.com/_fragment?_path=foo%3Dbar'), 'GET', array(), array(), array(), array('REMOTE_ADDR' => '10.0.0.1')); + $request = Request::create($signer->sign('http://example.com/_fragment?_path=foo%3Dbar'), 'GET', [], [], [], ['REMOTE_ADDR' => '10.0.0.1']); $listener = new FragmentListener($signer); $event = $this->createGetResponseEvent($request); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php index f442235ad048d55efcfe58e03f14ccde86376e16..1cf4b72c69d784f05e74baf2893d33903025cc79 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php @@ -54,7 +54,7 @@ public function testLocaleSetForRoutingContext() $context = $this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock(); $context->expects($this->once())->method('setParameter')->with('_locale', 'es'); - $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(array('getContext'))->disableOriginalConstructor()->getMock(); + $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock(); $router->expects($this->once())->method('getContext')->will($this->returnValue($context)); $request = Request::create('/'); @@ -70,7 +70,7 @@ public function testRouterResetWithParentRequestOnKernelFinishRequest() $context = $this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock(); $context->expects($this->once())->method('setParameter')->with('_locale', 'es'); - $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(array('getContext'))->disableOriginalConstructor()->getMock(); + $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock(); $router->expects($this->once())->method('getContext')->will($this->returnValue($context)); $parentRequest = Request::create('/'); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php index 526b3aa75dcf8add2d7536e86d68bafbb587528d..392aa2fc35816837a79569282efb764a87000b20 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php @@ -19,6 +19,7 @@ use Symfony\Component\HttpKernel\EventListener\ProfilerListener; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\HttpKernel\Profiler\Profile; class ProfilerListenerTest extends TestCase { @@ -27,9 +28,7 @@ class ProfilerListenerTest extends TestCase */ public function testKernelTerminate() { - $profile = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profile') - ->disableOriginalConstructor() - ->getMock(); + $profile = new Profile('token'); $profiler = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profiler') ->disableOriginalConstructor() diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php index 1d8960267dbe7da2474c92a0abdefdf7f0e12fa5..aeab68f3e9155d65b5215ce759ae4cff1927d627 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php @@ -30,7 +30,7 @@ protected function setUp() { $this->dispatcher = new EventDispatcher(); $listener = new ResponseListener('UTF-8'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); + $this->dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']); $this->kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); } @@ -54,7 +54,7 @@ public function testFilterDoesNothingForSubRequests() public function testFilterSetsNonDefaultCharsetIfNotOverridden() { $listener = new ResponseListener('ISO-8859-15'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse'), 1); + $this->dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse'], 1); $response = new Response('foo'); @@ -67,7 +67,7 @@ public function testFilterSetsNonDefaultCharsetIfNotOverridden() public function testFilterDoesNothingIfCharsetIsOverridden() { $listener = new ResponseListener('ISO-8859-15'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse'), 1); + $this->dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse'], 1); $response = new Response('foo'); $response->setCharset('ISO-8859-1'); @@ -81,7 +81,7 @@ public function testFilterDoesNothingIfCharsetIsOverridden() public function testFiltersSetsNonDefaultCharsetIfNotOverriddenOnNonTextContentType() { $listener = new ResponseListener('ISO-8859-15'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse'), 1); + $this->dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse'], 1); $response = new Response('foo'); $request = Request::create('/'); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php index ecbce409fb64410bc363250837e93723f98f4dbb..218af8d36e29337db8c313148099ca9f488c8c15 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php @@ -62,12 +62,12 @@ public function testPort($defaultHttpPort, $defaultHttpsPort, $uri, $expectedHtt public function getPortData() { - return array( - array(80, 443, 'http://localhost/', 80, 443), - array(80, 443, 'http://localhost:90/', 90, 443), - array(80, 443, 'https://localhost/', 80, 443), - array(80, 443, 'https://localhost:90/', 80, 90), - ); + return [ + [80, 443, 'http://localhost/', 80, 443], + [80, 443, 'http://localhost:90/', 90, 443], + [80, 443, 'https://localhost/', 80, 443], + [80, 443, 'https://localhost:90/', 80, 90], + ]; } /** @@ -102,7 +102,7 @@ public function testRequestMatcher() $requestMatcher->expects($this->once()) ->method('matchRequest') ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) - ->will($this->returnValue(array())); + ->will($this->returnValue([])); $listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext()); $listener->onKernelRequest($event); @@ -118,7 +118,7 @@ public function testSubRequestWithDifferentMethod() $requestMatcher->expects($this->any()) ->method('matchRequest') ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) - ->will($this->returnValue(array())); + ->will($this->returnValue([])); $context = new RequestContext(); @@ -159,10 +159,10 @@ public function testLoggingParameter($parameter, $log, $parameters) public function getLoggingParameterData() { - return array( - array(array('_route' => 'foo'), 'Matched route "{route}".', array('route' => 'foo', 'route_parameters' => array('_route' => 'foo'), 'request_uri' => 'http://localhost/', 'method' => 'GET')), - array(array(), 'Matched route "{route}".', array('route' => 'n/a', 'route_parameters' => array(), 'request_uri' => 'http://localhost/', 'method' => 'GET')), - ); + return [ + [['_route' => 'foo'], 'Matched route "{route}".', ['route' => 'foo', 'route_parameters' => ['_route' => 'foo'], 'request_uri' => 'http://localhost/', 'method' => 'GET']], + [[], 'Matched route "{route}".', ['route' => 'n/a', 'route_parameters' => [], 'request_uri' => 'http://localhost/', 'method' => 'GET']], + ]; } public function testWithBadRequest() diff --git a/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php index 1b95d19f9c2527a1daaa9bba6a90620690c871ee..f0bac60505bc66f4ce130155c16e379628966a02 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php @@ -90,7 +90,7 @@ public function testSurrogateMasterRequestIsPublic() $request = new Request(); $response = new Response(); - $response->setCache(array('public' => true, 'max_age' => '30')); + $response->setCache(['public' => true, 'max_age' => '30']); $listener->onKernelRequest(new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST)); $this->assertTrue($request->hasSession()); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php index b955c07d47422fe46cef97d8c1c5b155ad77a89f..66e119f1239dd131a1e46daf16e4ea6441a5adf5 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php @@ -30,7 +30,7 @@ public function testFilterDoesNothingForSubRequests() $response = new Response('foo <esi:include src="" />'); $listener = new SurrogateListener(new Esi()); - $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); + $dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']); $event = new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::SUB_REQUEST, $response); $dispatcher->dispatch(KernelEvents::RESPONSE, $event); @@ -44,7 +44,7 @@ public function testFilterWhenThereIsSomeEsiIncludes() $response = new Response('foo <esi:include src="" />'); $listener = new SurrogateListener(new Esi()); - $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); + $dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']); $event = new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::MASTER_REQUEST, $response); $dispatcher->dispatch(KernelEvents::RESPONSE, $event); @@ -58,7 +58,7 @@ public function testFilterWhenThereIsNoEsiIncludes() $response = new Response('foo'); $listener = new SurrogateListener(new Esi()); - $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); + $dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']); $event = new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::MASTER_REQUEST, $response); $dispatcher->dispatch(KernelEvents::RESPONSE, $event); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php index 0d0985ca5daf9cf371261382050265cca1c0313d..f261f2ed15a6698f66b1ca2834036462e6c0467e 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php @@ -87,7 +87,7 @@ public function testEmptySessionDoesNotSendCookie() $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST); - $this->assertSame(array(), $response->headers->getCookies()); + $this->assertSame([], $response->headers->getCookies()); } public function testEmptySessionWithNewSessionIdDoesSendCookie() @@ -97,7 +97,7 @@ public function testEmptySessionWithNewSessionIdDoesSendCookie() $this->fixSessionId('456'); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $request = Request::create('/', 'GET', array(), array('MOCKSESSID' => '123')); + $request = Request::create('/', 'GET', [], ['MOCKSESSID' => '123']); $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); $this->listener->onKernelRequest($event); @@ -116,11 +116,11 @@ public function testSessionWithNewSessionIdAndNewCookieDoesNotSendAnotherCookie( $this->fixSessionId('456'); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $request = Request::create('/', 'GET', array(), array('MOCKSESSID' => '123')); + $request = Request::create('/', 'GET', [], ['MOCKSESSID' => '123']); $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); $this->listener->onKernelRequest($event); - $response = new Response('', 200, array('Set-Cookie' => $existing)); + $response = new Response('', 200, ['Set-Cookie' => $existing]); $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST, $response); @@ -129,11 +129,11 @@ public function testSessionWithNewSessionIdAndNewCookieDoesNotSendAnotherCookie( public function anotherCookieProvider() { - return array( - 'same' => array('MOCKSESSID=789; path=/', array('MOCKSESSID=789; path=/')), - 'different domain' => array('MOCKSESSID=789; path=/; domain=example.com', array('MOCKSESSID=789; path=/; domain=example.com', 'MOCKSESSID=456; path=/')), - 'different path' => array('MOCKSESSID=789; path=/foo', array('MOCKSESSID=789; path=/foo', 'MOCKSESSID=456; path=/')), - ); + return [ + 'same' => ['MOCKSESSID=789; path=/', ['MOCKSESSID=789; path=/']], + 'different domain' => ['MOCKSESSID=789; path=/; domain=example.com', ['MOCKSESSID=789; path=/; domain=example.com', 'MOCKSESSID=456; path=/']], + 'different path' => ['MOCKSESSID=789; path=/foo', ['MOCKSESSID=789; path=/foo', 'MOCKSESSID=456; path=/']], + ]; } public function testUnstartedSessionIsNotSave() diff --git a/vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php index 23b833177ab61932cd28a128c164f76f08544e12..c1d56ec85d728705b7f95df7839cec3173d0d0e9 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php @@ -47,7 +47,7 @@ public function testDefaultLocaleIsUsedOnExceptionsInOnKernelRequest() $this->translator ->expects($this->at(0)) ->method('setLocale') - ->will($this->throwException(new \InvalidArgumentException())); + ->willThrowException(new \InvalidArgumentException()); $this->translator ->expects($this->at(1)) ->method('setLocale') @@ -84,7 +84,7 @@ public function testDefaultLocaleIsUsedOnExceptionsInOnKernelFinishRequest() $this->translator ->expects($this->at(0)) ->method('setLocale') - ->will($this->throwException(new \InvalidArgumentException())); + ->willThrowException(new \InvalidArgumentException()); $this->translator ->expects($this->at(1)) ->method('setLocale') diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php index bdab742ce182c89ab436547b227cd3d229f8fa61..fb7a4379bfa49ca410c67e506e81720cee5a6f38 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php @@ -23,7 +23,7 @@ class ValidateRequestListenerTest extends TestCase { protected function tearDown() { - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } /** @@ -35,12 +35,12 @@ public function testListenerThrowsWhenMasterRequestHasInconsistentClientIps() $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); $request = new Request(); - $request->setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED); + $request->setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $request->headers->set('FORWARDED', 'for=2.2.2.2'); $request->headers->set('X_FORWARDED_FOR', '3.3.3.3'); - $dispatcher->addListener(KernelEvents::REQUEST, array(new ValidateRequestListener(), 'onKernelRequest')); + $dispatcher->addListener(KernelEvents::REQUEST, [new ValidateRequestListener(), 'onKernelRequest']); $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); $dispatcher->dispatch(KernelEvents::REQUEST, $event); diff --git a/vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php index b64773551eb31c865c717a695bb9ca8c424f850b..f5fe97255bdb89fdc541daf5e04deadb75a6e061 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php @@ -9,22 +9,22 @@ class HttpExceptionTest extends TestCase { public function headerDataProvider() { - return array( - array(array('X-Test' => 'Test')), - array(array('X-Test' => 1)), - array( - array( - array('X-Test' => 'Test'), - array('X-Test-2' => 'Test-2'), - ), - ), - ); + return [ + [['X-Test' => 'Test']], + [['X-Test' => 1]], + [ + [ + ['X-Test' => 'Test'], + ['X-Test-2' => 'Test-2'], + ], + ], + ]; } public function testHeadersDefault() { $exception = $this->createException(); - $this->assertSame(array(), $exception->getHeaders()); + $this->assertSame([], $exception->getHeaders()); } /** diff --git a/vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php index b5def13ce38d7d06372b199a09abe2b2ce244d35..31dbf2f036e171b480006118ed37efac3277f446 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php @@ -8,8 +8,8 @@ class MethodNotAllowedHttpExceptionTest extends HttpExceptionTest { public function testHeadersDefault() { - $exception = new MethodNotAllowedHttpException(array('GET', 'PUT')); - $this->assertSame(array('Allow' => 'GET, PUT'), $exception->getHeaders()); + $exception = new MethodNotAllowedHttpException(['GET', 'PUT']); + $this->assertSame(['Allow' => 'GET, PUT'], $exception->getHeaders()); } /** @@ -17,7 +17,7 @@ public function testHeadersDefault() */ public function testHeadersSetter($headers) { - $exception = new MethodNotAllowedHttpException(array('GET')); + $exception = new MethodNotAllowedHttpException(['GET']); $exception->setHeaders($headers); $this->assertSame($headers, $exception->getHeaders()); } diff --git a/vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php index e41a23d4e7719a407ad4f9fb42bba282404d992f..cefde951ccfbb7da84a3e42bafc662827f5fbb7e 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php @@ -9,7 +9,7 @@ class ServiceUnavailableHttpExceptionTest extends HttpExceptionTest public function testHeadersDefaultRetryAfter() { $exception = new ServiceUnavailableHttpException(10); - $this->assertSame(array('Retry-After' => 10), $exception->getHeaders()); + $this->assertSame(['Retry-After' => 10], $exception->getHeaders()); } /** diff --git a/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php index 2079bb3380d20b086d6b597ef5501a4eed0ae424..73ee91a77d8fa5a0e5a8c33a78a55dffa18a80ca 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php @@ -9,7 +9,7 @@ class TooManyRequestsHttpExceptionTest extends HttpExceptionTest public function testHeadersDefaultRertyAfter() { $exception = new TooManyRequestsHttpException(10); - $this->assertSame(array('Retry-After' => 10), $exception->getHeaders()); + $this->assertSame(['Retry-After' => 10], $exception->getHeaders()); } /** diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php index 37a0028dc82573de82e916d2041d0bfc06a9f225..a8cc19aef8961c477e513cf12ca00b99fd7cacda 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php @@ -9,7 +9,7 @@ class UnauthorizedHttpExceptionTest extends HttpExceptionTest public function testHeadersDefault() { $exception = new UnauthorizedHttpException('Challenge'); - $this->assertSame(array('WWW-Authenticate' => 'Challenge'), $exception->getHeaders()); + $this->assertSame(['WWW-Authenticate' => 'Challenge'], $exception->getHeaders()); } /** diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php b/vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php index d3a76684dfa29796893caf1ccd86c7ba2c5a3d14..70c4026f067dda67abd7683d52a7f98c1ba83cd3 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php @@ -18,7 +18,7 @@ class Kernel123 extends Kernel { public function registerBundles() { - return array(); + return []; } public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php b/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php index 89dec36af4110194ecb9b9b77706a07e8d68cabc..4f5de182fd17f1f5713f0295a6ea7579170de697 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php @@ -31,7 +31,7 @@ public function collect(Request $request, Response $response, \Exception $except public function reset() { - $this->data = array(); + $this->data = []; } public function getData() diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php b/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php index 9acee4cac553e5c49f7aea01974dad0416d4973a..88c34b023136a9ed97e46ad92ecbd3dd4ff24972 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php @@ -23,7 +23,7 @@ public function getBundleMap() public function registerBundles() { - return array(); + return []; } public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php b/vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php index cee1b09fb22533ef1d45b63bd26c52434c64b5b5..1f5a456061f2fb510df53d87c745d4c1fb533620 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php @@ -19,7 +19,7 @@ class KernelWithoutBundles extends Kernel { public function registerBundles() { - return array(); + return []; } public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php b/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php index ca2e6a693da6ec117539acd7c1cef4decba0a3c5..dc9c9166f9f253c7b6fa22d62c75ee5f4ec04858 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php @@ -18,12 +18,12 @@ class TestEventDispatcher extends EventDispatcher implements TraceableEventDispa { public function getCalledListeners() { - return array('foo'); + return ['foo']; } public function getNotCalledListeners() { - return array('bar'); + return ['bar']; } public function reset() diff --git a/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php index 00d796d5205111246e626806f9b31b6503d9520e..52d8551965a0d01d7d77b8c9cbe8108a60874b79 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php @@ -34,7 +34,7 @@ public function testRenderFallbackWithObjectAttributesIsDeprecated() { $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo')); $request = Request::create('/'); - $reference = new ControllerReference('main_controller', array('foo' => new \stdClass()), array()); + $reference = new ControllerReference('main_controller', ['foo' => new \stdClass()], []); $strategy->render($reference, $request); } @@ -42,7 +42,7 @@ public function testRenderFallbackWithScalarIsNotDeprecated() { $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo')); $request = Request::create('/'); - $reference = new ControllerReference('main_controller', array('foo' => array(true)), array()); + $reference = new ControllerReference('main_controller', ['foo' => [true]], []); $strategy->render($reference, $request); } @@ -55,8 +55,8 @@ public function testRender() $request->headers->set('Surrogate-Capability', 'ESI/1.0'); $this->assertEquals('<esi:include src="/" />', $strategy->render('/', $request)->getContent()); - $this->assertEquals("<esi:comment text=\"This is a comment\" />\n<esi:include src=\"/\" />", $strategy->render('/', $request, array('comment' => 'This is a comment'))->getContent()); - $this->assertEquals('<esi:include src="/" alt="foo" />', $strategy->render('/', $request, array('alt' => 'foo'))->getContent()); + $this->assertEquals("<esi:comment text=\"This is a comment\" />\n<esi:include src=\"/\" />", $strategy->render('/', $request, ['comment' => 'This is a comment'])->getContent()); + $this->assertEquals('<esi:include src="/" alt="foo" />', $strategy->render('/', $request, ['alt' => 'foo'])->getContent()); } public function testRenderControllerReference() @@ -68,12 +68,12 @@ public function testRenderControllerReference() $request->setLocale('fr'); $request->headers->set('Surrogate-Capability', 'ESI/1.0'); - $reference = new ControllerReference('main_controller', array(), array()); - $altReference = new ControllerReference('alt_controller', array(), array()); + $reference = new ControllerReference('main_controller', [], []); + $altReference = new ControllerReference('alt_controller', [], []); $this->assertEquals( - '<esi:include src="/_fragment?_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3Dmain_controller&_hash=Jz1P8NErmhKTeI6onI1EdAXTB85359MY3RIk5mSJ60w%3D" alt="/_fragment?_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3Dalt_controller&_hash=iPJEdRoUpGrM1ztqByiorpfMPtiW%2FOWwdH1DBUXHhEc%3D" />', - $strategy->render($reference, $request, array('alt' => $altReference))->getContent() + '<esi:include src="/_fragment?_hash=Jz1P8NErmhKTeI6onI1EdAXTB85359MY3RIk5mSJ60w%3D&_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3Dmain_controller" alt="/_fragment?_hash=iPJEdRoUpGrM1ztqByiorpfMPtiW%2FOWwdH1DBUXHhEc%3D&_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3Dalt_controller" />', + $strategy->render($reference, $request, ['alt' => $altReference])->getContent() ); } @@ -102,7 +102,7 @@ public function testRenderAltControllerReferenceWithoutSignerThrowsException() $request->setLocale('fr'); $request->headers->set('Surrogate-Capability', 'ESI/1.0'); - $strategy->render('/', $request, array('alt' => new ControllerReference('alt_controller'))); + $strategy->render('/', $request, ['alt' => new ControllerReference('alt_controller')]); } private function getInlineStrategy($called = false) diff --git a/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php b/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php index a296aa0e183c5841da05f24b59bbf5702039d778..8829393ea4e5c85f9ebdc31a8df5e7e30020ba54 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php @@ -68,12 +68,12 @@ public function testDeliverWithUnsuccessfulResponse() public function testRender() { - $handler = $this->getHandler($this->returnValue(new Response('foo')), array('/', Request::create('/'), array('foo' => 'foo', 'ignore_errors' => true))); + $handler = $this->getHandler($this->returnValue(new Response('foo')), ['/', Request::create('/'), ['foo' => 'foo', 'ignore_errors' => true]]); - $this->assertEquals('foo', $handler->render('/', 'foo', array('foo' => 'foo'))); + $this->assertEquals('foo', $handler->render('/', 'foo', ['foo' => 'foo'])); } - protected function getHandler($returnValue, $arguments = array()) + protected function getHandler($returnValue, $arguments = []) { $renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock(); $renderer @@ -88,7 +88,7 @@ protected function getHandler($returnValue, $arguments = array()) ; if ($arguments) { - \call_user_func_array(array($e, 'with'), $arguments); + \call_user_func_array([$e, 'with'], $arguments); } $handler = new FragmentHandler($this->requestStack); diff --git a/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php index 10fbccf0fa207df2be90c3837ef59e66f968aa63..6125d95ff4ca8b61a6ec465ffa7baba833abb01f 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php @@ -25,14 +25,14 @@ class HIncludeFragmentRendererTest extends TestCase public function testRenderExceptionWhenControllerAndNoSigner() { $strategy = new HIncludeFragmentRenderer(); - $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/')); + $strategy->render(new ControllerReference('main_controller', [], []), Request::create('/')); } public function testRenderWithControllerAndSigner() { $strategy = new HIncludeFragmentRenderer(null, new UriSigner('foo')); - $this->assertEquals('<hx:include src="/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dmain_controller&_hash=BP%2BOzCD5MRUI%2BHJpgPDOmoju00FnzLhP3TGcSHbbBLs%3D"></hx:include>', $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/'))->getContent()); + $this->assertEquals('<hx:include src="/_fragment?_hash=BP%2BOzCD5MRUI%2BHJpgPDOmoju00FnzLhP3TGcSHbbBLs%3D&_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dmain_controller"></hx:include>', $strategy->render(new ControllerReference('main_controller', [], []), Request::create('/'))->getContent()); } public function testRenderWithUri() @@ -48,30 +48,30 @@ public function testRenderWithDefault() { // only default $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent()); + $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default'])->getContent()); // only global default $strategy = new HIncludeFragmentRenderer(null, null, 'global_default'); - $this->assertEquals('<hx:include src="/foo">global_default</hx:include>', $strategy->render('/foo', Request::create('/'), array())->getContent()); + $this->assertEquals('<hx:include src="/foo">global_default</hx:include>', $strategy->render('/foo', Request::create('/'), [])->getContent()); // global default and default $strategy = new HIncludeFragmentRenderer(null, null, 'global_default'); - $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent()); + $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default'])->getContent()); } public function testRenderWithAttributesOptions() { // with id $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('<hx:include src="/foo" id="bar">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default', 'id' => 'bar'))->getContent()); + $this->assertEquals('<hx:include src="/foo" id="bar">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default', 'id' => 'bar'])->getContent()); // with attributes $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('<hx:include src="/foo" p1="v1" p2="v2">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default', 'attributes' => array('p1' => 'v1', 'p2' => 'v2')))->getContent()); + $this->assertEquals('<hx:include src="/foo" p1="v1" p2="v2">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default', 'attributes' => ['p1' => 'v1', 'p2' => 'v2']])->getContent()); // with id & attributes $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('<hx:include src="/foo" p1="v1" p2="v2" id="bar">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default', 'id' => 'bar', 'attributes' => array('p1' => 'v1', 'p2' => 'v2')))->getContent()); + $this->assertEquals('<hx:include src="/foo" p1="v1" p2="v2" id="bar">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default', 'id' => 'bar', 'attributes' => ['p1' => 'v1', 'p2' => 'v2']])->getContent()); } public function testRenderWithDefaultText() @@ -80,11 +80,11 @@ public function testRenderWithDefaultText() $engine->expects($this->once()) ->method('exists') ->with('default') - ->will($this->throwException(new \InvalidArgumentException())); + ->willThrowException(new \InvalidArgumentException()); // only default $strategy = new HIncludeFragmentRenderer($engine); - $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent()); + $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default'])->getContent()); } public function testRenderWithEngineAndDefaultText() @@ -93,10 +93,10 @@ public function testRenderWithEngineAndDefaultText() $engine->expects($this->once()) ->method('exists') ->with('loading...') - ->will($this->throwException(new \RuntimeException())); + ->willThrowException(new \RuntimeException()); // only default $strategy = new HIncludeFragmentRenderer($engine); - $this->assertEquals('<hx:include src="/foo">loading...</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'loading...'))->getContent()); + $this->assertEquals('<hx:include src="/foo">loading...</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'loading...'])->getContent()); } } diff --git a/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php index c36ea5576001aefe1aa0ed7c91a54fafa31aa405..11adf74c2931c62ae6580ba2d3216b35ba70bf75 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php @@ -36,7 +36,7 @@ public function testRenderWithControllerReference() { $strategy = new InlineFragmentRenderer($this->getKernel($this->returnValue(new Response('foo')))); - $this->assertEquals('foo', $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/'))->getContent()); + $this->assertEquals('foo', $strategy->render(new ControllerReference('main_controller', [], []), Request::create('/'))->getContent()); } public function testRenderWithObjectsAsAttributes() @@ -44,13 +44,15 @@ public function testRenderWithObjectsAsAttributes() $object = new \stdClass(); $subRequest = Request::create('/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dmain_controller'); - $subRequest->attributes->replace(array('object' => $object, '_format' => 'html', '_controller' => 'main_controller', '_locale' => 'en')); - $subRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $subRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $subRequest->attributes->replace(['object' => $object, '_format' => 'html', '_controller' => 'main_controller', '_locale' => 'en']); + $subRequest->headers->set('x-forwarded-for', ['127.0.0.1']); + $subRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); + $subRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + $subRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($subRequest)); - $this->assertSame('foo', $strategy->render(new ControllerReference('main_controller', array('object' => $object), array()), Request::create('/'))->getContent()); + $this->assertSame('foo', $strategy->render(new ControllerReference('main_controller', ['object' => $object], []), Request::create('/'))->getContent()); } /** @@ -58,7 +60,7 @@ public function testRenderWithObjectsAsAttributes() */ public function testRenderWithObjectsAsAttributesPassedAsObjectsInTheControllerLegacy() { - $resolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver')->setMethods(array('getController'))->getMock(); + $resolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver')->setMethods(['getController'])->getMock(); $resolver ->expects($this->once()) ->method('getController') @@ -70,7 +72,7 @@ public function testRenderWithObjectsAsAttributesPassedAsObjectsInTheControllerL $kernel = new HttpKernel(new EventDispatcher(), $resolver, new RequestStack()); $renderer = new InlineFragmentRenderer($kernel); - $response = $renderer->render(new ControllerReference('main_controller', array('object' => new \stdClass(), 'object1' => new Bar()), array()), Request::create('/')); + $response = $renderer->render(new ControllerReference('main_controller', ['object' => new \stdClass(), 'object1' => new Bar()], []), Request::create('/')); $this->assertEquals('bar', $response->getContent()); } @@ -91,21 +93,22 @@ public function testRenderWithObjectsAsAttributesPassedAsObjectsInTheController( $kernel = new HttpKernel(new EventDispatcher(), $resolver, new RequestStack(), new ArgumentResolver()); $renderer = new InlineFragmentRenderer($kernel); - $response = $renderer->render(new ControllerReference('main_controller', array('object' => new \stdClass(), 'object1' => new Bar()), array()), Request::create('/')); + $response = $renderer->render(new ControllerReference('main_controller', ['object' => new \stdClass(), 'object1' => new Bar()], []), Request::create('/')); $this->assertEquals('bar', $response->getContent()); } public function testRenderWithTrustedHeaderDisabled() { - Request::setTrustedProxies(array(), 0); + Request::setTrustedProxies([], 0); $expectedSubRequest = Request::create('/'); - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); $this->assertSame('foo', $strategy->render('/', Request::create('/'))->getContent()); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } /** @@ -128,7 +131,7 @@ public function testRenderExceptionIgnoreErrors() $strategy = new InlineFragmentRenderer($this->getKernel($this->throwException(new \RuntimeException('foo'))), $dispatcher); - $this->assertEmpty($strategy->render('/', Request::create('/'), array('ignore_errors' => true))->getContent()); + $this->assertEmpty($strategy->render('/', Request::create('/'), ['ignore_errors' => true])->getContent()); } public function testRenderExceptionIgnoreErrorsWithAlt() @@ -138,7 +141,7 @@ public function testRenderExceptionIgnoreErrorsWithAlt() $this->returnValue(new Response('bar')) ))); - $this->assertEquals('bar', $strategy->render('/', Request::create('/'), array('ignore_errors' => true, 'alt' => '/foo'))->getContent()); + $this->assertEquals('bar', $strategy->render('/', Request::create('/'), ['ignore_errors' => true, 'alt' => '/foo'])->getContent()); } private function getKernel($returnValue) @@ -170,7 +173,7 @@ public function testExceptionInSubRequestsDoesNotMangleOutputBuffers() $argumentResolver ->expects($this->once()) ->method('getArguments') - ->will($this->returnValue(array())) + ->will($this->returnValue([])) ; $kernel = new HttpKernel(new EventDispatcher(), $controllerResolver, new RequestStack(), $argumentResolver); @@ -181,20 +184,42 @@ public function testExceptionInSubRequestsDoesNotMangleOutputBuffers() echo 'Foo'; // simulate a sub-request with output buffering and an exception - $renderer->render('/', Request::create('/'), array('ignore_errors' => true)); + $renderer->render('/', Request::create('/'), ['ignore_errors' => true]); $this->assertEquals('Foo', ob_get_clean()); } + public function testLocaleAndFormatAreIsKeptInSubrequest() + { + $expectedSubRequest = Request::create('/'); + $expectedSubRequest->attributes->set('_format', 'foo'); + $expectedSubRequest->setLocale('fr'); + if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + } + $expectedSubRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); + $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); + + $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); + + $request = Request::create('/'); + $request->attributes->set('_format', 'foo'); + $request->setLocale('fr'); + $strategy->render('/', $request); + } + public function testESIHeaderIsKeptInSubrequest() { $expectedSubRequest = Request::create('/'); $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); } - $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); + $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); @@ -205,33 +230,37 @@ public function testESIHeaderIsKeptInSubrequest() public function testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled() { - Request::setTrustedProxies(array(), Request::HEADER_FORWARDED); + Request::setTrustedProxies([], Request::HEADER_FORWARDED); $this->testESIHeaderIsKeptInSubrequest(); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } public function testHeadersPossiblyResultingIn304AreNotAssignedToSubrequest() { $expectedSubRequest = Request::create('/'); - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); + $expectedSubRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); - $request = Request::create('/', 'GET', array(), array(), array(), array('HTTP_IF_MODIFIED_SINCE' => 'Fri, 01 Jan 2016 00:00:00 GMT', 'HTTP_IF_NONE_MATCH' => '*')); + $request = Request::create('/', 'GET', [], [], [], ['HTTP_IF_MODIFIED_SINCE' => 'Fri, 01 Jan 2016 00:00:00 GMT', 'HTTP_IF_NONE_MATCH' => '*']); $strategy->render('/', $request); } public function testFirstTrustedProxyIsSetAsRemote() { - Request::setTrustedProxies(array('1.1.1.1'), -1); + Request::setTrustedProxies(['1.1.1.1'], -1); $expectedSubRequest = Request::create('/'); $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $expectedSubRequest->server->set('REMOTE_ADDR', '127.0.0.1'); - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); + $expectedSubRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); @@ -239,7 +268,7 @@ public function testFirstTrustedProxyIsSetAsRemote() $request->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $strategy->render('/', $request); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } public function testIpAddressOfRangedTrustedProxyIsSetAsRemote() @@ -247,10 +276,12 @@ public function testIpAddressOfRangedTrustedProxyIsSetAsRemote() $expectedSubRequest = Request::create('/'); $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $expectedSubRequest->server->set('REMOTE_ADDR', '127.0.0.1'); - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); + $expectedSubRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); - Request::setTrustedProxies(array('1.1.1.1/24'), -1); + Request::setTrustedProxies(['1.1.1.1/24'], -1); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); @@ -258,7 +289,7 @@ public function testIpAddressOfRangedTrustedProxyIsSetAsRemote() $request->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $strategy->render('/', $request); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } /** diff --git a/vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php index 3a040dedd6e54051b77545555583568f8e6cdd92..c03e8c4a92334c1bef1df3b1e879f1deebe2372f 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php @@ -35,14 +35,14 @@ public function testGenerateAbsoluteFragmentUri($uri, $controller) public function getGenerateFragmentUriData() { - return array( - array('/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array(), array())), - array('/_fragment?_path=_format%3Dxml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('_format' => 'xml'), array())), - array('/_fragment?_path=foo%3Dfoo%26_format%3Djson%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('foo' => 'foo', '_format' => 'json'), array())), - array('/_fragment?bar=bar&_path=foo%3Dfoo%26_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('foo' => 'foo'), array('bar' => 'bar'))), - array('/_fragment?foo=foo&_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array(), array('foo' => 'foo'))), - array('/_fragment?_path=foo%255B0%255D%3Dfoo%26foo%255B1%255D%3Dbar%26_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('foo' => array('foo', 'bar')), array())), - ); + return [ + ['/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', [], [])], + ['/_fragment?_path=_format%3Dxml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', ['_format' => 'xml'], [])], + ['/_fragment?_path=foo%3Dfoo%26_format%3Djson%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', ['foo' => 'foo', '_format' => 'json'], [])], + ['/_fragment?bar=bar&_path=foo%3Dfoo%26_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', ['foo' => 'foo'], ['bar' => 'bar'])], + ['/_fragment?foo=foo&_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', [], ['foo' => 'foo'])], + ['/_fragment?_path=foo%255B0%255D%3Dfoo%26foo%255B1%255D%3Dbar%26_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', ['foo' => ['foo', 'bar']], [])], + ]; } public function testGenerateFragmentUriWithARequest() @@ -50,7 +50,7 @@ public function testGenerateFragmentUriWithARequest() $request = Request::create('/'); $request->attributes->set('_format', 'json'); $request->setLocale('fr'); - $controller = new ControllerReference('controller', array(), array()); + $controller = new ControllerReference('controller', [], []); $this->assertEquals('/_fragment?_path=_format%3Djson%26_locale%3Dfr%26_controller%3Dcontroller', $this->callGenerateFragmentUriMethod($controller, $request)); } @@ -66,10 +66,10 @@ public function testGenerateFragmentUriWithNonScalar($controller) public function getGenerateFragmentUriDataWithNonScalar() { - return array( - array(new ControllerReference('controller', array('foo' => new Foo(), 'bar' => 'bar'), array())), - array(new ControllerReference('controller', array('foo' => array('foo' => 'foo'), 'bar' => array('bar' => new Foo())), array())), - ); + return [ + [new ControllerReference('controller', ['foo' => new Foo(), 'bar' => 'bar'], [])], + [new ControllerReference('controller', ['foo' => ['foo' => 'foo'], 'bar' => ['bar' => new Foo()]], [])], + ]; } private function callGenerateFragmentUriMethod(ControllerReference $reference, Request $request, $absolute = false) diff --git a/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php index f725803118f74027b99707745d0fb54969bb5b6d..b2181725edfd65b5f59d178f89db9cb8e1777634 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php @@ -35,7 +35,7 @@ public function testRender() $request->headers->set('Surrogate-Capability', 'SSI/1.0'); $this->assertEquals('<!--#include virtual="/" -->', $strategy->render('/', $request)->getContent()); - $this->assertEquals('<!--#include virtual="/" -->', $strategy->render('/', $request, array('comment' => 'This is a comment'))->getContent(), 'Strategy options should not impact the ssi include tag'); + $this->assertEquals('<!--#include virtual="/" -->', $strategy->render('/', $request, ['comment' => 'This is a comment'])->getContent(), 'Strategy options should not impact the ssi include tag'); } public function testRenderControllerReference() @@ -47,12 +47,12 @@ public function testRenderControllerReference() $request->setLocale('fr'); $request->headers->set('Surrogate-Capability', 'SSI/1.0'); - $reference = new ControllerReference('main_controller', array(), array()); - $altReference = new ControllerReference('alt_controller', array(), array()); + $reference = new ControllerReference('main_controller', [], []); + $altReference = new ControllerReference('alt_controller', [], []); $this->assertEquals( - '<!--#include virtual="/_fragment?_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3Dmain_controller&_hash=Jz1P8NErmhKTeI6onI1EdAXTB85359MY3RIk5mSJ60w%3D" -->', - $strategy->render($reference, $request, array('alt' => $altReference))->getContent() + '<!--#include virtual="/_fragment?_hash=Jz1P8NErmhKTeI6onI1EdAXTB85359MY3RIk5mSJ60w%3D&_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3Dmain_controller" -->', + $strategy->render($reference, $request, ['alt' => $altReference])->getContent() ); } @@ -81,7 +81,7 @@ public function testRenderAltControllerReferenceWithoutSignerThrowsException() $request->setLocale('fr'); $request->headers->set('Surrogate-Capability', 'SSI/1.0'); - $strategy->render('/', $request, array('alt' => new ControllerReference('alt_controller'))); + $strategy->render('/', $request, ['alt' => new ControllerReference('alt_controller')]); } private function getInlineStrategy($called = false) diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php index 863ad76147fcc4c1e37fc32531f9ed3b1ea41732..ccc3eecfaf8c2a23d0adb5b55877da3d880796ea 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php @@ -220,13 +220,13 @@ public function testHandleWhenResponseIsNot200AndAltIsPresent() $response1 = new Response('foo'); $response1->setStatusCode(404); $response2 = new Response('bar'); - $cache = $this->getCache(Request::create('/'), array($response1, $response2)); + $cache = $this->getCache(Request::create('/'), [$response1, $response2]); $this->assertEquals('bar', $esi->handle($cache, '/', '/alt', false)); } protected function getCache($request, $response) { - $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(array('getRequest', 'handle'))->disableOriginalConstructor()->getMock(); + $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) ->method('getRequest') ->will($this->returnValue($request)) @@ -234,7 +234,7 @@ protected function getCache($request, $response) if (\is_array($response)) { $cache->expects($this->any()) ->method('handle') - ->will(\call_user_func_array(array($this, 'onConsecutiveCalls'), $response)) + ->will(\call_user_func_array([$this, 'onConsecutiveCalls'], $response)) ; } else { $cache->expects($this->any()) diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php index a41d8665083c25cdbfc0d20833c9637efaac6915..7b3cac78c734bc1867a7335171b798fd36ffcfc1 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php @@ -39,7 +39,7 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface() // implements TerminableInterface $kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Kernel') ->disableOriginalConstructor() - ->setMethods(array('terminate', 'registerBundles', 'registerContainerConfiguration')) + ->setMethods(['terminate', 'registerBundles', 'registerContainerConfiguration']) ->getMock(); $kernelMock->expects($this->once()) @@ -61,7 +61,7 @@ public function testPassesOnNonGetHeadRequests() public function testInvalidatesOnPostPutDeleteRequests() { - foreach (array('post', 'put', 'delete') as $method) { + foreach (['post', 'put', 'delete'] as $method) { $this->setNextResponse(200); $this->request($method, '/'); @@ -74,8 +74,8 @@ public function testInvalidatesOnPostPutDeleteRequests() public function testDoesNotCacheWithAuthorizationRequestHeaderAndNonPublicResponse() { - $this->setNextResponse(200, array('ETag' => '"Foo"')); - $this->request('GET', '/', array('HTTP_AUTHORIZATION' => 'basic foobarbaz')); + $this->setNextResponse(200, ['ETag' => '"Foo"']); + $this->request('GET', '/', ['HTTP_AUTHORIZATION' => 'basic foobarbaz']); $this->assertHttpKernelIsCalled(); $this->assertResponseOk(); @@ -88,8 +88,8 @@ public function testDoesNotCacheWithAuthorizationRequestHeaderAndNonPublicRespon public function testDoesCacheWithAuthorizationRequestHeaderAndPublicResponse() { - $this->setNextResponse(200, array('Cache-Control' => 'public', 'ETag' => '"Foo"')); - $this->request('GET', '/', array('HTTP_AUTHORIZATION' => 'basic foobarbaz')); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'ETag' => '"Foo"']); + $this->request('GET', '/', ['HTTP_AUTHORIZATION' => 'basic foobarbaz']); $this->assertHttpKernelIsCalled(); $this->assertResponseOk(); @@ -101,8 +101,8 @@ public function testDoesCacheWithAuthorizationRequestHeaderAndPublicResponse() public function testDoesNotCacheWithCookieHeaderAndNonPublicResponse() { - $this->setNextResponse(200, array('ETag' => '"Foo"')); - $this->request('GET', '/', array(), array('foo' => 'bar')); + $this->setNextResponse(200, ['ETag' => '"Foo"']); + $this->request('GET', '/', [], ['foo' => 'bar']); $this->assertHttpKernelIsCalled(); $this->assertResponseOk(); @@ -115,7 +115,7 @@ public function testDoesNotCacheWithCookieHeaderAndNonPublicResponse() public function testDoesNotCacheRequestsWithACookieHeader() { $this->setNextResponse(200); - $this->request('GET', '/', array(), array('foo' => 'bar')); + $this->request('GET', '/', [], ['foo' => 'bar']); $this->assertHttpKernelIsCalled(); $this->assertResponseOk(); @@ -129,8 +129,8 @@ public function testRespondsWith304WhenIfModifiedSinceMatchesLastModified() { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822), 'Content-Type' => 'text/plain'), 'Hello World'); - $this->request('GET', '/', array('HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822), 'Content-Type' => 'text/plain'], 'Hello World'); + $this->request('GET', '/', ['HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(304, $this->response->getStatusCode()); @@ -142,8 +142,8 @@ public function testRespondsWith304WhenIfModifiedSinceMatchesLastModified() public function testRespondsWith304WhenIfNoneMatchMatchesETag() { - $this->setNextResponse(200, array('Cache-Control' => 'public', 'ETag' => '12345', 'Content-Type' => 'text/plain'), 'Hello World'); - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '12345')); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'ETag' => '12345', 'Content-Type' => 'text/plain'], 'Hello World'); + $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '12345']); $this->assertHttpKernelIsCalled(); $this->assertEquals(304, $this->response->getStatusCode()); @@ -158,7 +158,7 @@ public function testRespondsWith304OnlyIfIfNoneMatchAndIfModifiedSinceBothMatch( { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array(), '', function ($request, $response) use ($time) { + $this->setNextResponse(200, [], '', function ($request, $response) use ($time) { $response->setStatusCode(200); $response->headers->set('ETag', '12345'); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); @@ -168,17 +168,17 @@ public function testRespondsWith304OnlyIfIfNoneMatchAndIfModifiedSinceBothMatch( // only ETag matches $t = \DateTime::createFromFormat('U', time() - 3600); - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $t->format(DATE_RFC2822))); + $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $t->format(DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(200, $this->response->getStatusCode()); // only Last-Modified matches - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '1234', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); + $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '1234', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(200, $this->response->getStatusCode()); // Both matches - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); + $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(304, $this->response->getStatusCode()); } @@ -187,10 +187,10 @@ public function testIncrementsMaxAgeWhenNoDateIsSpecifiedEventWhenUsingETag() { $this->setNextResponse( 200, - array( + [ 'ETag' => '1234', 'Cache-Control' => 'public, s-maxage=60', - ) + ] ); $this->request('GET', '/'); @@ -210,7 +210,7 @@ public function testIncrementsMaxAgeWhenNoDateIsSpecifiedEventWhenUsingETag() public function testValidatesPrivateResponsesCachedOnTheClient() { - $this->setNextResponse(200, array(), '', function ($request, $response) { + $this->setNextResponse(200, [], '', function ($request, $response) { $etags = preg_split('/\s*,\s*/', $request->headers->get('IF_NONE_MATCH')); if ($request->cookies->has('authenticated')) { $response->headers->set('Cache-Control', 'private, no-store'); @@ -243,7 +243,7 @@ public function testValidatesPrivateResponsesCachedOnTheClient() $this->assertTraceContains('miss'); $this->assertTraceContains('store'); - $this->request('GET', '/', array(), array('authenticated' => '')); + $this->request('GET', '/', [], ['authenticated' => '']); $this->assertHttpKernelIsCalled(); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('"private tag"', $this->response->headers->get('ETag')); @@ -257,8 +257,8 @@ public function testStoresResponsesWhenNoCacheRequestDirectivePresent() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'no-cache']); $this->assertHttpKernelIsCalled(); $this->assertTraceContains('store'); @@ -269,7 +269,7 @@ public function testReloadsResponsesWhenCacheHitsButNoCacheRequestDirectivePrese { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, ['Cache-Control' => 'public, max-age=10000'], '', function ($request, $response) use (&$count) { ++$count; $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); }); @@ -285,7 +285,7 @@ public function testReloadsResponsesWhenCacheHitsButNoCacheRequestDirectivePrese $this->assertTraceContains('fresh'); $this->cacheConfig['allow_reload'] = true; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'no-cache']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Goodbye World', $this->response->getContent()); $this->assertTraceContains('reload'); @@ -296,7 +296,7 @@ public function testDoesNotReloadResponsesWhenAllowReloadIsSetFalseDefault() { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, ['Cache-Control' => 'public, max-age=10000'], '', function ($request, $response) use (&$count) { ++$count; $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); }); @@ -312,12 +312,12 @@ public function testDoesNotReloadResponsesWhenAllowReloadIsSetFalseDefault() $this->assertTraceContains('fresh'); $this->cacheConfig['allow_reload'] = false; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'no-cache']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Hello World', $this->response->getContent()); $this->assertTraceNotContains('reload'); - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'no-cache']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Hello World', $this->response->getContent()); $this->assertTraceNotContains('reload'); @@ -327,7 +327,7 @@ public function testRevalidatesFreshCacheEntryWhenMaxAgeRequestDirectiveIsExceed { $count = 0; - $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, [], '', function ($request, $response) use (&$count) { ++$count; $response->headers->set('Cache-Control', 'public, max-age=10000'); $response->setETag($count); @@ -345,7 +345,7 @@ public function testRevalidatesFreshCacheEntryWhenMaxAgeRequestDirectiveIsExceed $this->assertTraceContains('fresh'); $this->cacheConfig['allow_revalidate'] = true; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'max-age=0')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'max-age=0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Goodbye World', $this->response->getContent()); $this->assertTraceContains('stale'); @@ -357,7 +357,7 @@ public function testDoesNotRevalidateFreshCacheEntryWhenEnableRevalidateOptionIs { $count = 0; - $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, [], '', function ($request, $response) use (&$count) { ++$count; $response->headers->set('Cache-Control', 'public, max-age=10000'); $response->setETag($count); @@ -375,14 +375,14 @@ public function testDoesNotRevalidateFreshCacheEntryWhenEnableRevalidateOptionIs $this->assertTraceContains('fresh'); $this->cacheConfig['allow_revalidate'] = false; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'max-age=0')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'max-age=0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Hello World', $this->response->getContent()); $this->assertTraceNotContains('stale'); $this->assertTraceNotContains('invalid'); $this->assertTraceContains('fresh'); - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'max-age=0')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'max-age=0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Hello World', $this->response->getContent()); $this->assertTraceNotContains('stale'); @@ -393,7 +393,7 @@ public function testDoesNotRevalidateFreshCacheEntryWhenEnableRevalidateOptionIs public function testFetchesResponseFromBackendWhenCacheMisses() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -405,7 +405,7 @@ public function testDoesNotCacheSomeStatusCodeResponses() { foreach (array_merge(range(201, 202), range(204, 206), range(303, 305), range(400, 403), range(405, 409), range(411, 417), range(500, 505)) as $code) { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse($code, array('Expires' => $time->format(DATE_RFC2822))); + $this->setNextResponse($code, ['Expires' => $time->format(DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals($code, $this->response->getStatusCode()); @@ -417,7 +417,7 @@ public function testDoesNotCacheSomeStatusCodeResponses() public function testDoesNotCacheResponsesWithExplicitNoStoreDirective() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'no-store')); + $this->setNextResponse(200, ['Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'no-store']); $this->request('GET', '/'); $this->assertTraceNotContains('store'); @@ -436,7 +436,7 @@ public function testDoesNotCacheResponsesWithoutFreshnessInformationOrAValidator public function testCachesResponsesWithExplicitNoCacheDirective() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, no-cache')); + $this->setNextResponse(200, ['Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, no-cache']); $this->request('GET', '/'); $this->assertTraceContains('store'); @@ -446,7 +446,7 @@ public function testCachesResponsesWithExplicitNoCacheDirective() public function testCachesResponsesWithAnExpirationHeader() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -462,7 +462,7 @@ public function testCachesResponsesWithAnExpirationHeader() public function testCachesResponsesWithAMaxAgeDirective() { - $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=5')); + $this->setNextResponse(200, ['Cache-Control' => 'public, max-age=5']); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -478,7 +478,7 @@ public function testCachesResponsesWithAMaxAgeDirective() public function testCachesResponsesWithASMaxAgeDirective() { - $this->setNextResponse(200, array('Cache-Control' => 's-maxage=5')); + $this->setNextResponse(200, ['Cache-Control' => 's-maxage=5']); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -495,7 +495,7 @@ public function testCachesResponsesWithASMaxAgeDirective() public function testCachesResponsesWithALastModifiedValidatorButNoFreshnessInformation() { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -506,7 +506,7 @@ public function testCachesResponsesWithALastModifiedValidatorButNoFreshnessInfor public function testCachesResponsesWithAnETagValidatorButNoFreshnessInformation() { - $this->setNextResponse(200, array('Cache-Control' => 'public', 'ETag' => '"123456"')); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'ETag' => '"123456"']); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -519,7 +519,7 @@ public function testHitsCachedResponsesWithExpiresHeader() { $time1 = \DateTime::createFromFormat('U', time() - 5); $time2 = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Date' => $time1->format(DATE_RFC2822), 'Expires' => $time2->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Date' => $time1->format(DATE_RFC2822), 'Expires' => $time2->format(DATE_RFC2822)]); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); @@ -543,7 +543,7 @@ public function testHitsCachedResponsesWithExpiresHeader() public function testHitsCachedResponseWithMaxAgeDirective() { $time = \DateTime::createFromFormat('U', time() - 5); - $this->setNextResponse(200, array('Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, max-age=10')); + $this->setNextResponse(200, ['Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, max-age=10']); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); @@ -573,7 +573,7 @@ public function testDegradationWhenCacheLocked() $this->cacheConfig['stale_while_revalidate'] = 10; // The prescence of Last-Modified makes this cacheable (because Response::isValidateable() then). - $this->setNextResponse(200, array('Cache-Control' => 'public, s-maxage=5', 'Last-Modified' => 'some while ago'), 'Old response'); + $this->setNextResponse(200, ['Cache-Control' => 'public, s-maxage=5', 'Last-Modified' => 'some while ago'], 'Old response'); $this->request('GET', '/'); // warm the cache // Now, lock the cache @@ -607,7 +607,7 @@ public function testDegradationWhenCacheLocked() public function testHitsCachedResponseWithSMaxAgeDirective() { $time = \DateTime::createFromFormat('U', time() - 5); - $this->setNextResponse(200, array('Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 's-maxage=10, max-age=0')); + $this->setNextResponse(200, ['Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 's-maxage=10, max-age=0']); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); @@ -752,7 +752,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft public function testDoesNotAssignDefaultTtlWhenResponseHasMustRevalidateDirective() { - $this->setNextResponse(200, array('Cache-Control' => 'must-revalidate')); + $this->setNextResponse(200, ['Cache-Control' => 'must-revalidate']); $this->cacheConfig['default_ttl'] = 10; $this->request('GET', '/'); @@ -767,7 +767,7 @@ public function testDoesNotAssignDefaultTtlWhenResponseHasMustRevalidateDirectiv public function testFetchesFullResponseWhenCacheStaleAndNoValidatorsPresent() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); // build initial request $this->request('GET', '/'); @@ -807,7 +807,7 @@ public function testFetchesFullResponseWhenCacheStaleAndNoValidatorsPresent() public function testValidatesCachedResponsesWithLastModifiedAndNoFreshnessInformation() { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($time) { $response->headers->set('Cache-Control', 'public'); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); if ($time->format(DATE_RFC2822) == $request->headers->get('IF_MODIFIED_SINCE')) { @@ -845,7 +845,7 @@ public function testValidatesCachedResponsesUseSameHttpMethod() { $test = $this; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($test) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($test) { $test->assertSame('OPTIONS', $request->getMethod()); }); @@ -858,7 +858,7 @@ public function testValidatesCachedResponsesUseSameHttpMethod() public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation() { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) { $response->headers->set('Cache-Control', 'public'); $response->headers->set('ETag', '"12345"'); if ($response->getETag() == $request->headers->get('IF_NONE_MATCH')) { @@ -895,7 +895,7 @@ public function testServesResponseWhileFreshAndRevalidatesWithLastModifiedInform { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array(), 'Hello World', function (Request $request, Response $response) use ($time) { + $this->setNextResponse(200, [], 'Hello World', function (Request $request, Response $response) use ($time) { $response->setSharedMaxAge(10); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); }); @@ -913,7 +913,7 @@ public function testServesResponseWhileFreshAndRevalidatesWithLastModifiedInform sleep(15); // expire the cache - $this->setNextResponse(304, array(), '', function (Request $request, Response $response) use ($time) { + $this->setNextResponse(304, [], '', function (Request $request, Response $response) use ($time) { $this->assertEquals($time->format(DATE_RFC2822), $request->headers->get('IF_MODIFIED_SINCE')); }); @@ -929,7 +929,7 @@ public function testReplacesCachedResponsesWhenValidationResultsInNon304Response { $time = \DateTime::createFromFormat('U', time()); $count = 0; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time, &$count) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($time, &$count) { $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); $response->headers->set('Cache-Control', 'public'); switch (++$count) { @@ -966,20 +966,20 @@ public function testReplacesCachedResponsesWhenValidationResultsInNon304Response public function testPassesHeadRequestsThroughDirectlyOnPass() { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) { $response->setContent(''); $response->setStatusCode(200); $this->assertEquals('HEAD', $request->getMethod()); }); - $this->request('HEAD', '/', array('HTTP_EXPECT' => 'something ...')); + $this->request('HEAD', '/', ['HTTP_EXPECT' => 'something ...']); $this->assertHttpKernelIsCalled(); $this->assertEquals('', $this->response->getContent()); } public function testUsesCacheToRespondToHeadRequestsWhenFresh() { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) { $response->headers->set('Cache-Control', 'public, max-age=10'); $response->setContent('Hello World'); $response->setStatusCode(200); @@ -1000,7 +1000,7 @@ public function testUsesCacheToRespondToHeadRequestsWhenFresh() public function testSendsNoContentWhenFresh() { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($time) { $response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); }); @@ -1009,7 +1009,7 @@ public function testSendsNoContentWhenFresh() $this->assertHttpKernelIsCalled(); $this->assertEquals('Hello World', $this->response->getContent()); - $this->request('GET', '/', array('HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); + $this->request('GET', '/', ['HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); $this->assertHttpKernelIsNotCalled(); $this->assertEquals(304, $this->response->getStatusCode()); $this->assertEquals('', $this->response->getContent()); @@ -1017,7 +1017,7 @@ public function testSendsNoContentWhenFresh() public function testInvalidatesCachedResponsesOnPost() { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) { if ('GET' == $request->getMethod()) { $response->setStatusCode(200); $response->headers->set('Cache-Control', 'public, max-age=500'); @@ -1066,20 +1066,20 @@ public function testInvalidatesCachedResponsesOnPost() public function testServesFromCacheWhenHeadersMatch() { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, ['Cache-Control' => 'max-age=10000'], '', function ($request, $response) use (&$count) { $response->headers->set('Vary', 'Accept User-Agent Foo'); $response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('X-Response-Count', ++$count); $response->setContent($request->headers->get('USER_AGENT')); }); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Bob/1.0', $this->response->getContent()); $this->assertTraceContains('miss'); $this->assertTraceContains('store'); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Bob/1.0', $this->response->getContent()); $this->assertTraceContains('fresh'); @@ -1090,36 +1090,36 @@ public function testServesFromCacheWhenHeadersMatch() public function testStoresMultipleResponsesWhenHeadersDiffer() { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, ['Cache-Control' => 'max-age=10000'], '', function ($request, $response) use (&$count) { $response->headers->set('Vary', 'Accept User-Agent Foo'); $response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('X-Response-Count', ++$count); $response->setContent($request->headers->get('USER_AGENT')); }); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Bob/1.0', $this->response->getContent()); $this->assertEquals(1, $this->response->headers->get('X-Response-Count')); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/2.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/2.0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertTraceContains('miss'); $this->assertTraceContains('store'); $this->assertEquals('Bob/2.0', $this->response->getContent()); $this->assertEquals(2, $this->response->headers->get('X-Response-Count')); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0']); $this->assertTraceContains('fresh'); $this->assertEquals('Bob/1.0', $this->response->getContent()); $this->assertEquals(1, $this->response->headers->get('X-Response-Count')); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/2.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/2.0']); $this->assertTraceContains('fresh'); $this->assertEquals('Bob/2.0', $this->response->getContent()); $this->assertEquals(2, $this->response->headers->get('X-Response-Count')); - $this->request('GET', '/', array('HTTP_USER_AGENT' => 'Bob/2.0')); + $this->request('GET', '/', ['HTTP_USER_AGENT' => 'Bob/2.0']); $this->assertTraceContains('miss'); $this->assertEquals('Bob/2.0', $this->response->getContent()); $this->assertEquals(3, $this->response->headers->get('X-Response-Count')); @@ -1141,7 +1141,7 @@ public function testShouldCatchExceptionsWhenReloadingAndNoCacheRequest() $this->setNextResponse(); $this->cacheConfig['allow_reload'] = true; - $this->request('GET', '/', array(), array(), false, array('Pragma' => 'no-cache')); + $this->request('GET', '/', [], [], false, ['Pragma' => 'no-cache']); $this->assertExceptionsAreCaught(); } @@ -1158,30 +1158,30 @@ public function testShouldNotCatchExceptions() public function testEsiCacheSendsTheLowestTtl() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/foo" /> <esi:include src="/bar" />', - 'headers' => array( + 'headers' => [ 'Cache-Control' => 's-maxage=300', 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hello World!', - 'headers' => array('Cache-Control' => 's-maxage=200'), - ), - array( + 'headers' => ['Cache-Control' => 's-maxage=200'], + ], + [ 'status' => 200, 'body' => 'My name is Bobby.', - 'headers' => array('Cache-Control' => 's-maxage=100'), - ), - ); + 'headers' => ['Cache-Control' => 's-maxage=100'], + ], + ]; $this->setNextResponses($responses); - $this->request('GET', '/', array(), array(), true); + $this->request('GET', '/', [], [], true); $this->assertEquals('Hello World! My name is Bobby.', $this->response->getContent()); $this->assertEquals(100, $this->response->getTtl()); @@ -1189,25 +1189,25 @@ public function testEsiCacheSendsTheLowestTtl() public function testEsiCacheSendsTheLowestTtlForHeadRequests() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => 'I am a long-lived master response, but I embed a short-lived resource: <esi:include src="/foo" />', - 'headers' => array( + 'headers' => [ 'Cache-Control' => 's-maxage=300', 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'I am a short-lived resource', - 'headers' => array('Cache-Control' => 's-maxage=100'), - ), - ); + 'headers' => ['Cache-Control' => 's-maxage=100'], + ], + ]; $this->setNextResponses($responses); - $this->request('HEAD', '/', array(), array(), true); + $this->request('HEAD', '/', [], [], true); $this->assertEmpty($this->response->getContent()); $this->assertEquals(100, $this->response->getTtl()); @@ -1215,30 +1215,30 @@ public function testEsiCacheSendsTheLowestTtlForHeadRequests() public function testEsiCacheForceValidation() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/foo" /> <esi:include src="/bar" />', - 'headers' => array( + 'headers' => [ 'Cache-Control' => 's-maxage=300', 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hello World!', - 'headers' => array('ETag' => 'foobar'), - ), - array( + 'headers' => ['ETag' => 'foobar'], + ], + [ 'status' => 200, 'body' => 'My name is Bobby.', - 'headers' => array('Cache-Control' => 's-maxage=100'), - ), - ); + 'headers' => ['Cache-Control' => 's-maxage=100'], + ], + ]; $this->setNextResponses($responses); - $this->request('GET', '/', array(), array(), true); + $this->request('GET', '/', [], [], true); $this->assertEquals('Hello World! My name is Bobby.', $this->response->getContent()); $this->assertNull($this->response->getTtl()); $this->assertTrue($this->response->mustRevalidate()); @@ -1248,25 +1248,25 @@ public function testEsiCacheForceValidation() public function testEsiCacheForceValidationForHeadRequests() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => 'I am the master response and use expiration caching, but I embed another resource: <esi:include src="/foo" />', - 'headers' => array( + 'headers' => [ 'Cache-Control' => 's-maxage=300', 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'I am the embedded resource and use validation caching', - 'headers' => array('ETag' => 'foobar'), - ), - ); + 'headers' => ['ETag' => 'foobar'], + ], + ]; $this->setNextResponses($responses); - $this->request('HEAD', '/', array(), array(), true); + $this->request('HEAD', '/', [], [], true); // The response has been assembled from expiration and validation based resources // This can neither be cached nor revalidated, so it should be private/no cache @@ -1279,50 +1279,50 @@ public function testEsiCacheForceValidationForHeadRequests() public function testEsiRecalculateContentLengthHeader() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/foo" />', - 'headers' => array( + 'headers' => [ 'Content-Length' => 26, 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hello World!', - 'headers' => array(), - ), - ); + 'headers' => [], + ], + ]; $this->setNextResponses($responses); - $this->request('GET', '/', array(), array(), true); + $this->request('GET', '/', [], [], true); $this->assertEquals('Hello World!', $this->response->getContent()); $this->assertEquals(12, $this->response->headers->get('Content-Length')); } public function testEsiRecalculateContentLengthHeaderForHeadRequest() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/foo" />', - 'headers' => array( + 'headers' => [ 'Content-Length' => 26, 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hello World!', - 'headers' => array(), - ), - ); + 'headers' => [], + ], + ]; $this->setNextResponses($responses); - $this->request('HEAD', '/', array(), array(), true); + $this->request('HEAD', '/', [], [], true); // https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13 // "The Content-Length entity-header field indicates the size of the entity-body, @@ -1336,7 +1336,7 @@ public function testEsiRecalculateContentLengthHeaderForHeadRequest() public function testClientIpIsAlwaysLocalhostForForwardedRequests() { $this->setNextResponse(); - $this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1')); + $this->request('GET', '/', ['REMOTE_ADDR' => '10.0.0.1']); $this->kernel->assert(function ($backendRequest) { $this->assertSame('127.0.0.1', $backendRequest->server->get('REMOTE_ADDR')); @@ -1351,25 +1351,25 @@ public function testHttpCacheIsSetAsATrustedProxy(array $existing) Request::setTrustedProxies($existing, Request::HEADER_X_FORWARDED_ALL); $this->setNextResponse(); - $this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1')); + $this->request('GET', '/', ['REMOTE_ADDR' => '10.0.0.1']); $this->assertSame($existing, Request::getTrustedProxies()); - $existing = array_unique(array_merge($existing, array('127.0.0.1'))); + $existing = array_unique(array_merge($existing, ['127.0.0.1'])); $this->kernel->assert(function ($backendRequest) use ($existing) { $this->assertSame($existing, Request::getTrustedProxies()); $this->assertsame('10.0.0.1', $backendRequest->getClientIp()); }); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } public function getTrustedProxyData() { - return array( - array(array()), - array(array('10.0.0.2')), - array(array('10.0.0.2', '127.0.0.1')), - ); + return [ + [[]], + [['10.0.0.2']], + [['10.0.0.2', '127.0.0.1']], + ]; } /** @@ -1378,7 +1378,7 @@ public function getTrustedProxyData() public function testForwarderHeaderForForwardedRequests($forwarded, $expected) { $this->setNextResponse(); - $server = array('REMOTE_ADDR' => '10.0.0.1'); + $server = ['REMOTE_ADDR' => '10.0.0.1']; if (null !== $forwarded) { Request::setTrustedProxies($server, -1); $server['HTTP_FORWARDED'] = $forwarded; @@ -1389,42 +1389,42 @@ public function testForwarderHeaderForForwardedRequests($forwarded, $expected) $this->assertSame($expected, $backendRequest->headers->get('Forwarded')); }); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } public function getForwardedData() { - return array( - array(null, 'for="10.0.0.1";host="localhost";proto=http'), - array('for=10.0.0.2', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.1"'), - array('for=10.0.0.2, for=10.0.0.3', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.3", for="10.0.0.1"'), - ); + return [ + [null, 'for="10.0.0.1";host="localhost";proto=http'], + ['for=10.0.0.2', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.1"'], + ['for=10.0.0.2, for=10.0.0.3', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.3", for="10.0.0.1"'], + ]; } public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponses() { $time = \DateTime::createFromFormat('U', time()); - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/hey" />', - 'headers' => array( + 'headers' => [ 'Surrogate-Control' => 'content="ESI/1.0"', 'ETag' => 'hey', 'Last-Modified' => $time->format(DATE_RFC2822), - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hey!', - 'headers' => array(), - ), - ); + 'headers' => [], + ], + ]; $this->setNextResponses($responses); - $this->request('GET', '/', array(), array(), true); + $this->request('GET', '/', [], [], true); $this->assertNull($this->response->getETag()); $this->assertNull($this->response->getLastModified()); } @@ -1433,26 +1433,26 @@ public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponsesAndHeadReq { $time = \DateTime::createFromFormat('U', time()); - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/hey" />', - 'headers' => array( + 'headers' => [ 'Surrogate-Control' => 'content="ESI/1.0"', 'ETag' => 'hey', 'Last-Modified' => $time->format(DATE_RFC2822), - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hey!', - 'headers' => array(), - ), - ); + 'headers' => [], + ], + ]; $this->setNextResponses($responses); - $this->request('HEAD', '/', array(), array(), true); + $this->request('HEAD', '/', [], [], true); $this->assertEmpty($this->response->getContent()); $this->assertNull($this->response->getETag()); $this->assertNull($this->response->getLastModified()); @@ -1460,11 +1460,11 @@ public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponsesAndHeadReq public function testDoesNotCacheOptionsRequest() { - $this->setNextResponse(200, array('Cache-Control' => 'public, s-maxage=60'), 'get'); + $this->setNextResponse(200, ['Cache-Control' => 'public, s-maxage=60'], 'get'); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); - $this->setNextResponse(200, array('Cache-Control' => 'public, s-maxage=60'), 'options'); + $this->setNextResponse(200, ['Cache-Control' => 'public, s-maxage=60'], 'options'); $this->request('OPTIONS', '/'); $this->assertHttpKernelIsCalled(); diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php index b3aa2be2f0bc8b514c4e05b2ba20776fdb9c27b2..1eb461744726e7dac578e18d7a0c243880df6401 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php @@ -41,12 +41,12 @@ protected function setUp() $this->cache = null; $this->esi = null; - $this->caches = array(); - $this->cacheConfig = array(); + $this->caches = []; + $this->cacheConfig = []; $this->request = null; $this->response = null; - $this->responses = array(); + $this->responses = []; $this->catch = false; @@ -112,7 +112,7 @@ public function assertExceptionsAreNotCaught() $this->assertFalse($this->kernel->isCatchingExceptions()); } - public function request($method, $uri = '/', $server = array(), $cookies = array(), $esi = false, $headers = array()) + public function request($method, $uri = '/', $server = [], $cookies = [], $esi = false, $headers = []) { if (null === $this->kernel) { throw new \LogicException('You must call setNextResponse() before calling request().'); @@ -126,7 +126,7 @@ public function request($method, $uri = '/', $server = array(), $cookies = array $this->esi = $esi ? new Esi() : null; $this->cache = new HttpCache($this->kernel, $this->store, $this->esi, $this->cacheConfig); - $this->request = Request::create($uri, $method, array(), $cookies, array(), $server); + $this->request = Request::create($uri, $method, [], $cookies, [], $server); $this->request->headers->add($headers); $this->response = $this->cache->handle($this->request, HttpKernelInterface::MASTER_REQUEST, $this->catch); @@ -136,7 +136,7 @@ public function request($method, $uri = '/', $server = array(), $cookies = array public function getMetaStorageValues() { - $values = array(); + $values = []; foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(sys_get_temp_dir().'/http_cache/md', \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { $values[] = file_get_contents($file); } @@ -145,7 +145,7 @@ public function getMetaStorageValues() } // A basic response with 200 status code and a tiny body. - public function setNextResponse($statusCode = 200, array $headers = array(), $body = 'Hello World', \Closure $customizer = null) + public function setNextResponse($statusCode = 200, array $headers = [], $body = 'Hello World', \Closure $customizer = null) { $this->kernel = new TestHttpKernel($body, $statusCode, $headers, $customizer); } @@ -168,7 +168,7 @@ public static function clearDirectory($directory) $fp = opendir($directory); while (false !== $file = readdir($fp)) { - if (!\in_array($file, array('.', '..'))) { + if (!\in_array($file, ['.', '..'])) { if (is_link($directory.'/'.$file)) { unlink($directory.'/'.$file); } elseif (is_dir($directory.'/'.$file)) { diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php index 6d67a177398c2ccb7ba513aa56b1f6b8e7f82f60..22cadf712952896b4c7a819ad855e3b3effef612 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php @@ -237,4 +237,233 @@ public function testResponseIsExpirableButNotValidateableWhenMasterResponseCombi $this->assertSame('60', $masterResponse->headers->getCacheControlDirective('s-maxage')); $this->assertFalse($masterResponse->isValidateable()); } + + /** + * @dataProvider cacheControlMergingProvider + */ + public function testCacheControlMerging(array $expects, array $master, array $surrogates) + { + $cacheStrategy = new ResponseCacheStrategy(); + $buildResponse = function ($config) { + $response = new Response(); + + foreach ($config as $key => $value) { + switch ($key) { + case 'age': + $response->headers->set('Age', $value); + break; + + case 'expires': + $expires = clone $response->getDate(); + $expires->modify('+'.$value.' seconds'); + $response->setExpires($expires); + break; + + case 'max-age': + $response->setMaxAge($value); + break; + + case 's-maxage': + $response->setSharedMaxAge($value); + break; + + case 'private': + $response->setPrivate(); + break; + + case 'public': + $response->setPublic(); + break; + + default: + $response->headers->addCacheControlDirective($key, $value); + } + } + + return $response; + }; + + foreach ($surrogates as $config) { + $cacheStrategy->add($buildResponse($config)); + } + + $response = $buildResponse($master); + $cacheStrategy->update($response); + + foreach ($expects as $key => $value) { + if ('expires' === $key) { + $this->assertSame($value, $response->getExpires()->format('U') - $response->getDate()->format('U')); + } elseif ('age' === $key) { + $this->assertSame($value, $response->getAge()); + } elseif (true === $value) { + $this->assertTrue($response->headers->hasCacheControlDirective($key), sprintf('Cache-Control header must have "%s" flag', $key)); + } elseif (false === $value) { + $this->assertFalse( + $response->headers->hasCacheControlDirective($key), + sprintf('Cache-Control header must NOT have "%s" flag', $key) + ); + } else { + $this->assertSame($value, $response->headers->getCacheControlDirective($key), sprintf('Cache-Control flag "%s" should be "%s"', $key, $value)); + } + } + } + + public function cacheControlMergingProvider() + { + yield 'result is public if all responses are public' => [ + ['private' => false, 'public' => true], + ['public' => true], + [ + ['public' => true], + ], + ]; + + yield 'result is private by default' => [ + ['private' => true, 'public' => false], + ['public' => true], + [ + [], + ], + ]; + + yield 'combines public and private responses' => [ + ['must-revalidate' => false, 'private' => true, 'public' => false], + ['public' => true], + [ + ['private' => true], + ], + ]; + + yield 'inherits no-cache from surrogates' => [ + ['no-cache' => true, 'public' => false], + ['public' => true], + [ + ['no-cache' => true], + ], + ]; + + yield 'inherits no-store from surrogate' => [ + ['no-store' => true, 'public' => false], + ['public' => true], + [ + ['no-store' => true], + ], + ]; + + yield 'resolve to lowest possible max-age' => [ + ['public' => false, 'private' => true, 's-maxage' => false, 'max-age' => '60'], + ['public' => true, 'max-age' => 3600], + [ + ['private' => true, 'max-age' => 60], + ], + ]; + + yield 'resolves multiple max-age' => [ + ['public' => false, 'private' => true, 's-maxage' => false, 'max-age' => '60'], + ['private' => true, 'max-age' => 100], + [ + ['private' => true, 'max-age' => 3600], + ['public' => true, 'max-age' => 60, 's-maxage' => 60], + ['private' => true, 'max-age' => 60], + ], + ]; + + yield 'merge max-age and s-maxage' => [ + ['public' => true, 's-maxage' => '60', 'max-age' => null], + ['public' => true, 's-maxage' => 3600], + [ + ['public' => true, 'max-age' => 60], + ], + ]; + + yield 'result is private when combining private responses' => [ + ['no-cache' => false, 'must-revalidate' => false, 'private' => true], + ['s-maxage' => 60, 'private' => true], + [ + ['s-maxage' => 60, 'private' => true], + ], + ]; + + yield 'result can have s-maxage and max-age' => [ + ['public' => true, 'private' => false, 's-maxage' => '60', 'max-age' => '30'], + ['s-maxage' => 100, 'max-age' => 2000], + [ + ['s-maxage' => 1000, 'max-age' => 30], + ['s-maxage' => 500, 'max-age' => 500], + ['s-maxage' => 60, 'max-age' => 1000], + ], + ]; + + yield 'does not set headers without value' => [ + ['max-age' => null, 's-maxage' => null, 'public' => null], + ['private' => true], + [ + ['private' => true], + ], + ]; + + yield 'max-age 0 is sent to the client' => [ + ['private' => true, 'max-age' => '0'], + ['max-age' => 0, 'private' => true], + [ + ['max-age' => 60, 'private' => true], + ], + ]; + + yield 'max-age is relative to age' => [ + ['max-age' => '240', 'age' => 60], + ['max-age' => 180], + [ + ['max-age' => 600, 'age' => 60], + ], + ]; + + yield 'retains lowest age of all responses' => [ + ['max-age' => '160', 'age' => 60], + ['max-age' => 600, 'age' => 60], + [ + ['max-age' => 120, 'age' => 20], + ], + ]; + + yield 'max-age can be less than age, essentially expiring the response' => [ + ['age' => 120, 'max-age' => '90'], + ['max-age' => 90, 'age' => 120], + [ + ['max-age' => 120, 'age' => 60], + ], + ]; + + yield 'max-age is 0 regardless of age' => [ + ['max-age' => '0'], + ['max-age' => 60], + [ + ['max-age' => 0, 'age' => 60], + ], + ]; + + yield 'max-age is not negative' => [ + ['max-age' => '0'], + ['max-age' => 0], + [ + ['max-age' => 0, 'age' => 60], + ], + ]; + + yield 'calculates lowest Expires header' => [ + ['expires' => 60], + ['expires' => 60], + [ + ['expires' => 120], + ], + ]; + + yield 'calculates Expires header relative to age' => [ + ['expires' => 210, 'age' => 120], + ['expires' => 90], + [ + ['expires' => 600, 'age' => '120'], + ], + ]; + } } diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php index 26ef6cb2b8e62e9ad007ebce9c6ed5a0b12f5d92..2fc0bb9660dd11c1b63cfbccbb5ce07a586acb0d 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php @@ -187,13 +187,13 @@ public function testHandleWhenResponseIsNot200AndAltIsPresent() $response1 = new Response('foo'); $response1->setStatusCode(404); $response2 = new Response('bar'); - $cache = $this->getCache(Request::create('/'), array($response1, $response2)); + $cache = $this->getCache(Request::create('/'), [$response1, $response2]); $this->assertEquals('bar', $ssi->handle($cache, '/', '/alt', false)); } protected function getCache($request, $response) { - $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(array('getRequest', 'handle'))->disableOriginalConstructor()->getMock(); + $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) ->method('getRequest') ->will($this->returnValue($request)) @@ -201,7 +201,7 @@ protected function getCache($request, $response) if (\is_array($response)) { $cache->expects($this->any()) ->method('handle') - ->will(\call_user_func_array(array($this, 'onConsecutiveCalls'), $response)) + ->will(\call_user_func_array([$this, 'onConsecutiveCalls'], $response)) ; } else { $cache->expects($this->any()) diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php index cef019167a4efa88ab8339a4dcf6f02b947a1f35..fc47ff2c88c5687d3667ee8b50e7aa19e5e6ca67 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php @@ -29,7 +29,7 @@ class StoreTest extends TestCase protected function setUp() { $this->request = Request::create('/'); - $this->response = new Response('hello world', 200, array()); + $this->response = new Response('hello world', 200, []); HttpCacheTestCase::clearDirectory(sys_get_temp_dir().'/http_cache'); @@ -108,7 +108,7 @@ public function testFindsAStoredEntryWithLookup() public function testDoesNotFindAnEntryWithLookupWhenNoneExists() { - $request = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); + $request = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); $this->assertNull($this->store->lookup($request)); } @@ -137,7 +137,7 @@ public function testRestoresResponseHeadersProperlyWithLookup() $this->storeSimpleEntry(); $response = $this->store->lookup($this->request); - $this->assertEquals($response->headers->all(), array_merge(array('content-length' => 4, 'x-body-file' => array($this->getStorePath($response->headers->get('X-Content-Digest')))), $this->response->headers->all())); + $this->assertEquals($response->headers->all(), array_merge(['content-length' => 4, 'x-body-file' => [$this->getStorePath($response->headers->get('X-Content-Digest'))]], $this->response->headers->all())); } public function testRestoresResponseContentFromEntityStoreWithLookup() @@ -165,9 +165,9 @@ public function testSucceedsQuietlyWhenInvalidateCalledWithNoMatchingEntries() public function testDoesNotReturnEntriesThatVaryWithLookup() { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam')); - $res = new Response('test', 200, array('Vary' => 'Foo Bar')); + $req1 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); + $req2 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam']); + $res = new Response('test', 200, ['Vary' => 'Foo Bar']); $this->store->write($req1, $res); $this->assertNull($this->store->lookup($req2)); @@ -175,9 +175,9 @@ public function testDoesNotReturnEntriesThatVaryWithLookup() public function testDoesNotReturnEntriesThatSlightlyVaryWithLookup() { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bam')); - $res = new Response('test', 200, array('Vary' => array('Foo', 'Bar'))); + $req1 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); + $req2 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bam']); + $res = new Response('test', 200, ['Vary' => ['Foo', 'Bar']]); $this->store->write($req1, $res); $this->assertNull($this->store->lookup($req2)); @@ -185,16 +185,16 @@ public function testDoesNotReturnEntriesThatSlightlyVaryWithLookup() public function testStoresMultipleResponsesForEachVaryCombination() { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $res1 = new Response('test 1', 200, array('Vary' => 'Foo Bar')); + $req1 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); + $res1 = new Response('test 1', 200, ['Vary' => 'Foo Bar']); $key = $this->store->write($req1, $res1); - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam')); - $res2 = new Response('test 2', 200, array('Vary' => 'Foo Bar')); + $req2 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam']); + $res2 = new Response('test 2', 200, ['Vary' => 'Foo Bar']); $this->store->write($req2, $res2); - $req3 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Baz', 'HTTP_BAR' => 'Boom')); - $res3 = new Response('test 3', 200, array('Vary' => 'Foo Bar')); + $req3 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Baz', 'HTTP_BAR' => 'Boom']); + $res3 = new Response('test 3', 200, ['Vary' => 'Foo Bar']); $this->store->write($req3, $res3); $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 3')), $this->store->lookup($req3)->getContent()); @@ -206,18 +206,18 @@ public function testStoresMultipleResponsesForEachVaryCombination() public function testOverwritesNonVaryingResponseWithStore() { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $res1 = new Response('test 1', 200, array('Vary' => 'Foo Bar')); + $req1 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); + $res1 = new Response('test 1', 200, ['Vary' => 'Foo Bar']); $key = $this->store->write($req1, $res1); $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 1')), $this->store->lookup($req1)->getContent()); - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam')); - $res2 = new Response('test 2', 200, array('Vary' => 'Foo Bar')); + $req2 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam']); + $res2 = new Response('test 2', 200, ['Vary' => 'Foo Bar']); $this->store->write($req2, $res2); $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 2')), $this->store->lookup($req2)->getContent()); - $req3 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $res3 = new Response('test 3', 200, array('Vary' => 'Foo Bar')); + $req3 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); + $res3 = new Response('test 3', 200, ['Vary' => 'Foo Bar']); $key = $this->store->write($req3, $res3); $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 3')), $this->store->lookup($req3)->getContent()); @@ -226,7 +226,7 @@ public function testOverwritesNonVaryingResponseWithStore() public function testLocking() { - $req = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); + $req = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); $this->assertTrue($this->store->lock($req)); $path = $this->store->lock($req); @@ -263,14 +263,14 @@ public function testPurgeHttpAndHttps() $this->assertEmpty($this->getStoreMetadata($requestHttps)); } - protected function storeSimpleEntry($path = null, $headers = array()) + protected function storeSimpleEntry($path = null, $headers = []) { if (null === $path) { $path = '/test'; } - $this->request = Request::create($path, 'get', array(), array(), array(), $headers); - $this->response = new Response('test', 200, array('Cache-Control' => 'max-age=420')); + $this->request = Request::create($path, 'get', [], [], [], $headers); + $this->response = new Response('test', 200, ['Cache-Control' => 'max-age=420']); return $this->store->write($this->request, $this->response); } diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php index dfe0a734bf9f9f88bc7c1a36ebb025c456ddea70..67b637bfe3d05018c8aa924da11b5b1bdf116caf 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php @@ -33,7 +33,7 @@ protected function tearDown() public function testTrustedHeadersAreKept() { - Request::setTrustedProxies(array('10.0.0.1'), -1); + Request::setTrustedProxies(['10.0.0.1'], -1); $globalState = $this->getGlobalState(); $request = Request::create('/'); @@ -82,7 +82,7 @@ public function testUntrustedHeadersAreRemoved() public function testTrustedForwardedHeader() { - Request::setTrustedProxies(array('10.0.0.1'), -1); + Request::setTrustedProxies(['10.0.0.1'], -1); $globalState = $this->getGlobalState(); $request = Request::create('/'); @@ -104,7 +104,7 @@ public function testTrustedForwardedHeader() public function testTrustedXForwardedForHeader() { - Request::setTrustedProxies(array('10.0.0.1'), -1); + Request::setTrustedProxies(['10.0.0.1'], -1); $globalState = $this->getGlobalState(); $request = Request::create('/'); @@ -127,10 +127,10 @@ public function testTrustedXForwardedForHeader() private function getGlobalState() { - return array( + return [ Request::getTrustedProxies(), Request::getTrustedHeaderSet(), - ); + ]; } } diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php b/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php index 5dbf02c9922dae6c4ba2b811f4e295e8374c1eb8..304ff9d9e43e716cdcfe5865a16ef96b21b5c477 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php @@ -41,7 +41,7 @@ public function __construct($body, $status, $headers, \Closure $customizer = nul public function assert(\Closure $callback) { - $trustedConfig = array(Request::getTrustedProxies(), Request::getTrustedHeaderSet()); + $trustedConfig = [Request::getTrustedProxies(), Request::getTrustedHeaderSet()]; list($trustedProxies, $trustedHeaderSet, $backendRequest) = $this->backendRequest; Request::setTrustedProxies($trustedProxies, $trustedHeaderSet); @@ -57,7 +57,7 @@ public function assert(\Closure $callback) public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) { $this->catch = $catch; - $this->backendRequest = array(Request::getTrustedProxies(), Request::getTrustedHeaderSet(), $request); + $this->backendRequest = [Request::getTrustedProxies(), Request::getTrustedHeaderSet(), $request]; return parent::handle($request, $type, $catch); } @@ -69,12 +69,12 @@ public function isCatchingExceptions() public function getController(Request $request) { - return array($this, 'callController'); + return [$this, 'callController']; } public function getArguments(Request $request, $controller) { - return array($request); + return [$request]; } public function callController(Request $request) diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php b/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php index 712132bd13f3d9c6c5703b8e2704201b0203724f..010bee86895a76623d0c08c701402e73409bddd8 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php @@ -21,9 +21,9 @@ class TestMultipleHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface { - protected $bodies = array(); - protected $statuses = array(); - protected $headers = array(); + protected $bodies = []; + protected $statuses = []; + protected $headers = []; protected $called = false; protected $backendRequest; @@ -52,12 +52,12 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ public function getController(Request $request) { - return array($this, 'callController'); + return [$this, 'callController']; } public function getArguments(Request $request, $controller) { - return array($request); + return [$request]; } public function callController(Request $request) diff --git a/vendor/symfony/http-kernel/Tests/HttpKernelTest.php b/vendor/symfony/http-kernel/Tests/HttpKernelTest.php index 4b9ec69d1ef564e6b18c8f142808e1e341a40352..939ecc04463591d39bc0a0813ee3e99b58172256 100644 --- a/vendor/symfony/http-kernel/Tests/HttpKernelTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpKernelTest.php @@ -104,7 +104,7 @@ public function testHandleHttpException() $event->setResponse(new Response($event->getException()->getMessage())); }); - $kernel = $this->getHttpKernel($dispatcher, function () { throw new MethodNotAllowedHttpException(array('POST')); }); + $kernel = $this->getHttpKernel($dispatcher, function () { throw new MethodNotAllowedHttpException(['POST']); }); $response = $kernel->handle(new Request()); $this->assertEquals('405', $response->getStatusCode()); @@ -119,7 +119,7 @@ public function testLegacyHandleWhenAnExceptionIsHandledWithASpecificStatusCode( { $dispatcher = new EventDispatcher(); $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) use ($responseStatusCode, $expectedStatusCode) { - $event->setResponse(new Response('', $responseStatusCode, array('X-Status-Code' => $expectedStatusCode))); + $event->setResponse(new Response('', $responseStatusCode, ['X-Status-Code' => $expectedStatusCode])); }); $kernel = $this->getHttpKernel($dispatcher, function () { throw new \RuntimeException(); }); @@ -131,12 +131,12 @@ public function testLegacyHandleWhenAnExceptionIsHandledWithASpecificStatusCode( public function getStatusCodes() { - return array( - array(200, 404), - array(404, 200), - array(301, 200), - array(500, 200), - ); + return [ + [200, 404], + [404, 200], + [301, 200], + [500, 200], + ]; } /** @@ -158,11 +158,11 @@ public function testHandleWhenAnExceptionIsHandledWithASpecificStatusCode($expec public function getSpecificStatusCodes() { - return array( - array(200), - array(302), - array(403), - ); + return [ + [200], + [302], + [403], + ]; } public function testHandleWhenAListenerReturnsAResponse() @@ -200,7 +200,7 @@ public function testHandleWhenTheControllerIsAClosure() public function testHandleWhenTheControllerIsAnObjectWithInvoke() { $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, new Controller()); + $kernel = $this->getHttpKernel($dispatcher, new TestController()); $this->assertResponseEquals(new Response('foo'), $kernel->handle(new Request())); } @@ -216,7 +216,7 @@ public function testHandleWhenTheControllerIsAFunction() public function testHandleWhenTheControllerIsAnArray() { $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, array(new Controller(), 'controller')); + $kernel = $this->getHttpKernel($dispatcher, [new TestController(), 'controller']); $this->assertResponseEquals(new Response('foo'), $kernel->handle(new Request())); } @@ -224,7 +224,7 @@ public function testHandleWhenTheControllerIsAnArray() public function testHandleWhenTheControllerIsAStaticArray() { $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, array('Symfony\Component\HttpKernel\Tests\Controller', 'staticcontroller')); + $kernel = $this->getHttpKernel($dispatcher, ['Symfony\Component\HttpKernel\Tests\TestController', 'staticcontroller']); $this->assertResponseEquals(new Response('foo'), $kernel->handle(new Request())); } @@ -267,7 +267,7 @@ public function testHandleAllowChangingControllerArguments() { $dispatcher = new EventDispatcher(); $dispatcher->addListener(KernelEvents::CONTROLLER_ARGUMENTS, function (FilterControllerArgumentsEvent $event) { - $event->setArguments(array('foo')); + $event->setArguments(['foo']); }); $kernel = $this->getHttpKernel($dispatcher, function ($content) { return new Response($content); }); @@ -291,12 +291,12 @@ public function testHandleAllowChangingControllerAndArguments() }; $event->setController($newController); - $event->setArguments(array('bar')); + $event->setArguments(['bar']); }); - $kernel = $this->getHttpKernel($dispatcher, function ($content) { return new Response($content); }, null, array('foo')); + $kernel = $this->getHttpKernel($dispatcher, function ($content) { return new Response($content); }, null, ['foo']); - $this->assertResponseEquals(new Response('foo', 200, array('X-Id' => 'bar')), $kernel->handle(new Request())); + $this->assertResponseEquals(new Response('foo', 200, ['X-Id' => 'bar']), $kernel->handle(new Request())); } public function testTerminate() @@ -321,7 +321,7 @@ public function testVerifyRequestStackPushPopDuringHandle() { $request = new Request(); - $stack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->setMethods(array('push', 'pop'))->getMock(); + $stack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->setMethods(['push', 'pop'])->getMock(); $stack->expects($this->at(0))->method('push')->with($this->equalTo($request)); $stack->expects($this->at(1))->method('pop'); @@ -337,7 +337,7 @@ public function testVerifyRequestStackPushPopDuringHandle() public function testInconsistentClientIpsOnMasterRequests() { $request = new Request(); - $request->setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED); + $request->setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $request->headers->set('FORWARDED', 'for=2.2.2.2'); $request->headers->set('X_FORWARDED_FOR', '3.3.3.3'); @@ -350,10 +350,10 @@ public function testInconsistentClientIpsOnMasterRequests() $kernel = $this->getHttpKernel($dispatcher); $kernel->handle($request, $kernel::MASTER_REQUEST, false); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } - private function getHttpKernel(EventDispatcherInterface $eventDispatcher, $controller = null, RequestStack $requestStack = null, array $arguments = array()) + private function getHttpKernel(EventDispatcherInterface $eventDispatcher, $controller = null, RequestStack $requestStack = null, array $arguments = []) { if (null === $controller) { $controller = function () { return new Response('Hello'); }; @@ -381,7 +381,7 @@ private function assertResponseEquals(Response $expected, Response $actual) } } -class Controller +class TestController { public function __invoke() { diff --git a/vendor/symfony/http-kernel/Tests/KernelTest.php b/vendor/symfony/http-kernel/Tests/KernelTest.php index ab0b8cfb6ec6bd35c449e419322f52a2084fc8bf..208e11e182d65a3a02ed6b9430a29c5258f5217b 100644 --- a/vendor/symfony/http-kernel/Tests/KernelTest.php +++ b/vendor/symfony/http-kernel/Tests/KernelTest.php @@ -92,7 +92,7 @@ public function testInitializeContainerClearsOldContainers() public function testBootInitializesBundlesAndContainer() { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer')); + $kernel = $this->getKernel(['initializeBundles', 'initializeContainer']); $kernel->expects($this->once()) ->method('initializeBundles'); $kernel->expects($this->once()) @@ -107,10 +107,10 @@ public function testBootSetsTheContainerToTheBundles() $bundle->expects($this->once()) ->method('setContainer'); - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'getBundles')); + $kernel = $this->getKernel(['initializeBundles', 'initializeContainer', 'getBundles']); $kernel->expects($this->once()) ->method('getBundles') - ->will($this->returnValue(array($bundle))); + ->will($this->returnValue([$bundle])); $kernel->boot(); } @@ -118,7 +118,7 @@ public function testBootSetsTheContainerToTheBundles() public function testBootSetsTheBootedFlagToTrue() { // use test kernel to access isBooted() - $kernel = $this->getKernelForTest(array('initializeBundles', 'initializeContainer')); + $kernel = $this->getKernelForTest(['initializeBundles', 'initializeContainer']); $kernel->boot(); $this->assertTrue($kernel->isBooted()); @@ -129,7 +129,7 @@ public function testBootSetsTheBootedFlagToTrue() */ public function testClassCacheIsLoaded() { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache')); + $kernel = $this->getKernel(['initializeBundles', 'initializeContainer', 'doLoadClassCache']); $kernel->loadClassCache('name', '.extension'); $kernel->expects($this->once()) ->method('doLoadClassCache') @@ -140,7 +140,7 @@ public function testClassCacheIsLoaded() public function testClassCacheIsNotLoadedByDefault() { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache')); + $kernel = $this->getKernel(['initializeBundles', 'initializeContainer', 'doLoadClassCache']); $kernel->expects($this->never()) ->method('doLoadClassCache'); @@ -152,7 +152,7 @@ public function testClassCacheIsNotLoadedByDefault() */ public function testClassCacheIsNotLoadedWhenKernelIsNotBooted() { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache')); + $kernel = $this->getKernel(['initializeBundles', 'initializeContainer', 'doLoadClassCache']); $kernel->loadClassCache(); $kernel->expects($this->never()) ->method('doLoadClassCache'); @@ -163,7 +163,7 @@ public function testEnvParametersResourceIsAdded() $container = new ContainerBuilder(); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest') ->disableOriginalConstructor() - ->setMethods(array('getContainerBuilder', 'prepareContainer', 'getCacheDir', 'getLogDir')) + ->setMethods(['getContainerBuilder', 'prepareContainer', 'getCacheDir', 'getLogDir']) ->getMock(); $kernel->expects($this->any()) ->method('getContainerBuilder') @@ -196,7 +196,7 @@ public function testEnvParametersResourceIsAdded() public function testBootKernelSeveralTimesOnlyInitializesBundlesOnce() { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer')); + $kernel = $this->getKernel(['initializeBundles', 'initializeContainer']); $kernel->expects($this->once()) ->method('initializeBundles'); @@ -210,7 +210,7 @@ public function testShutdownCallsShutdownOnAllBundles() $bundle->expects($this->once()) ->method('shutdown'); - $kernel = $this->getKernel(array(), array($bundle)); + $kernel = $this->getKernel([], [$bundle]); $kernel->boot(); $kernel->shutdown(); @@ -223,10 +223,10 @@ public function testShutdownGivesNullContainerToAllBundles() ->method('setContainer') ->with(null); - $kernel = $this->getKernel(array('getBundles')); + $kernel = $this->getKernel(['getBundles']); $kernel->expects($this->any()) ->method('getBundles') - ->will($this->returnValue(array($bundle))); + ->will($this->returnValue([$bundle])); $kernel->boot(); $kernel->shutdown(); @@ -246,7 +246,7 @@ public function testHandleCallsHandleOnHttpKernel() ->method('handle') ->with($request, $type, $catch); - $kernel = $this->getKernel(array('getHttpKernel')); + $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->once()) ->method('getHttpKernel') ->will($this->returnValue($httpKernelMock)); @@ -264,7 +264,7 @@ public function testHandleBootsTheKernel() ->disableOriginalConstructor() ->getMock(); - $kernel = $this->getKernel(array('getHttpKernel', 'boot')); + $kernel = $this->getKernel(['getHttpKernel', 'boot']); $kernel->expects($this->once()) ->method('getHttpKernel') ->will($this->returnValue($httpKernelMock)); @@ -384,7 +384,7 @@ public function testSerialize() $debug = true; $kernel = new KernelForTest($env, $debug); - $expected = serialize(array($env, $debug)); + $expected = serialize([$env, $debug]); $this->assertEquals($expected, $kernel->serialize()); } @@ -417,11 +417,11 @@ public function testLocateResourceThrowsExceptionWhenBundleDoesNotExist() */ public function testLocateResourceThrowsExceptionWhenResourceDoesNotExist() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))) + ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')])) ; $kernel->locateResource('@Bundle1Bundle/config/routing.xml'); @@ -429,11 +429,11 @@ public function testLocateResourceThrowsExceptionWhenResourceDoesNotExist() public function testLocateResourceReturnsTheFirstThatMatches() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))) + ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')])) ; $this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt', $kernel->locateResource('@Bundle1Bundle/foo.txt')); @@ -447,11 +447,11 @@ public function testLocateResourceReturnsTheFirstThatMatchesWithParent() $parent = $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'); $child = $this->getBundle(__DIR__.'/Fixtures/Bundle2Bundle'); - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->exactly(2)) ->method('getBundle') - ->will($this->returnValue(array($child, $parent))) + ->will($this->returnValue([$child, $parent])) ; $this->assertEquals(__DIR__.'/Fixtures/Bundle2Bundle/foo.txt', $kernel->locateResource('@ParentAABundle/foo.txt')); @@ -466,16 +466,16 @@ public function testLocateResourceReturnsAllMatches() $parent = $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'); $child = $this->getBundle(__DIR__.'/Fixtures/Bundle2Bundle'); - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue(array($child, $parent))) + ->will($this->returnValue([$child, $parent])) ; - $this->assertEquals(array( + $this->assertEquals([ __DIR__.'/Fixtures/Bundle2Bundle/foo.txt', - __DIR__.'/Fixtures/Bundle1Bundle/foo.txt', ), + __DIR__.'/Fixtures/Bundle1Bundle/foo.txt', ], $kernel->locateResource('@Bundle1Bundle/foo.txt', null, false)); } @@ -484,29 +484,29 @@ public function testLocateResourceReturnsAllMatches() */ public function testLocateResourceReturnsAllMatchesBis() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue(array( + ->will($this->returnValue([ $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'), $this->getBundle(__DIR__.'/Foobar'), - ))) + ])) ; $this->assertEquals( - array(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt'), + [__DIR__.'/Fixtures/Bundle1Bundle/foo.txt'], $kernel->locateResource('@Bundle1Bundle/foo.txt', null, false) ); } public function testLocateResourceIgnoresDirOnNonResource() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))) + ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')])) ; $this->assertEquals( @@ -517,11 +517,11 @@ public function testLocateResourceIgnoresDirOnNonResource() public function testLocateResourceReturnsTheDirOneForResources() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')))) + ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')])) ; $this->assertEquals( @@ -535,16 +535,16 @@ public function testLocateResourceReturnsTheDirOneForResources() */ public function testLocateResourceReturnsTheDirOneForResourcesAndBundleOnes() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')))) + ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')])) ; - $this->assertEquals(array( + $this->assertEquals([ __DIR__.'/Fixtures/Resources/Bundle1Bundle/foo.txt', - __DIR__.'/Fixtures/Bundle1Bundle/Resources/foo.txt', ), + __DIR__.'/Fixtures/Bundle1Bundle/Resources/foo.txt', ], $kernel->locateResource('@Bundle1Bundle/Resources/foo.txt', __DIR__.'/Fixtures/Resources', false) ); } @@ -557,18 +557,18 @@ public function testLocateResourceOverrideBundleAndResourcesFolders() $parent = $this->getBundle(__DIR__.'/Fixtures/BaseBundle', null, 'BaseBundle', 'BaseBundle'); $child = $this->getBundle(__DIR__.'/Fixtures/ChildBundle', 'ParentBundle', 'ChildBundle', 'ChildBundle'); - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->exactly(4)) ->method('getBundle') - ->will($this->returnValue(array($child, $parent))) + ->will($this->returnValue([$child, $parent])) ; - $this->assertEquals(array( + $this->assertEquals([ __DIR__.'/Fixtures/Resources/ChildBundle/foo.txt', __DIR__.'/Fixtures/ChildBundle/Resources/foo.txt', __DIR__.'/Fixtures/BaseBundle/Resources/foo.txt', - ), + ], $kernel->locateResource('@BaseBundle/Resources/foo.txt', __DIR__.'/Fixtures/Resources', false) ); @@ -592,11 +592,11 @@ public function testLocateResourceOverrideBundleAndResourcesFolders() public function testLocateResourceOnDirectories() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->exactly(2)) ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')))) + ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')])) ; $this->assertEquals( @@ -608,11 +608,11 @@ public function testLocateResourceOnDirectories() $kernel->locateResource('@FooBundle/Resources', __DIR__.'/Fixtures/Resources') ); - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->exactly(2)) ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')))) + ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')])) ; $this->assertEquals( @@ -634,16 +634,16 @@ public function testInitializeBundles() $child = $this->getBundle(null, 'ParentABundle', 'ChildABundle'); // use test kernel so we can access getBundleMap() - $kernel = $this->getKernelForTest(array('registerBundles')); + $kernel = $this->getKernelForTest(['registerBundles']); $kernel ->expects($this->once()) ->method('registerBundles') - ->will($this->returnValue(array($parent, $child))) + ->will($this->returnValue([$parent, $child])) ; $kernel->boot(); $map = $kernel->getBundleMap(); - $this->assertEquals(array($child, $parent), $map['ParentABundle']); + $this->assertEquals([$child, $parent], $map['ParentABundle']); } /** @@ -656,18 +656,18 @@ public function testInitializeBundlesSupportInheritanceCascade() $child = $this->getBundle(null, 'ParentBBundle', 'ChildBBundle'); // use test kernel so we can access getBundleMap() - $kernel = $this->getKernelForTest(array('registerBundles')); + $kernel = $this->getKernelForTest(['registerBundles']); $kernel ->expects($this->once()) ->method('registerBundles') - ->will($this->returnValue(array($grandparent, $parent, $child))) + ->will($this->returnValue([$grandparent, $parent, $child])) ; $kernel->boot(); $map = $kernel->getBundleMap(); - $this->assertEquals(array($child, $parent, $grandparent), $map['GrandParentBBundle']); - $this->assertEquals(array($child, $parent), $map['ParentBBundle']); - $this->assertEquals(array($child), $map['ChildBBundle']); + $this->assertEquals([$child, $parent, $grandparent], $map['GrandParentBBundle']); + $this->assertEquals([$child, $parent], $map['ParentBBundle']); + $this->assertEquals([$child], $map['ChildBBundle']); } /** @@ -678,7 +678,7 @@ public function testInitializeBundlesSupportInheritanceCascade() public function testInitializeBundlesThrowsExceptionWhenAParentDoesNotExists() { $child = $this->getBundle(null, 'FooBar', 'ChildCBundle'); - $kernel = $this->getKernel(array(), array($child)); + $kernel = $this->getKernel([], [$child]); $kernel->boot(); } @@ -692,18 +692,18 @@ public function testInitializeBundlesSupportsArbitraryBundleRegistrationOrder() $child = $this->getBundle(null, 'ParentCBundle', 'ChildCBundle'); // use test kernel so we can access getBundleMap() - $kernel = $this->getKernelForTest(array('registerBundles')); + $kernel = $this->getKernelForTest(['registerBundles']); $kernel ->expects($this->once()) ->method('registerBundles') - ->will($this->returnValue(array($parent, $grandparent, $child))) + ->will($this->returnValue([$parent, $grandparent, $child])) ; $kernel->boot(); $map = $kernel->getBundleMap(); - $this->assertEquals(array($child, $parent, $grandparent), $map['GrandParentCBundle']); - $this->assertEquals(array($child, $parent), $map['ParentCBundle']); - $this->assertEquals(array($child), $map['ChildCBundle']); + $this->assertEquals([$child, $parent, $grandparent], $map['GrandParentCBundle']); + $this->assertEquals([$child, $parent], $map['ParentCBundle']); + $this->assertEquals([$child], $map['ChildCBundle']); } /** @@ -717,7 +717,7 @@ public function testInitializeBundlesThrowsExceptionWhenABundleIsDirectlyExtende $child1 = $this->getBundle(null, 'ParentCBundle', 'ChildC1Bundle'); $child2 = $this->getBundle(null, 'ParentCBundle', 'ChildC2Bundle'); - $kernel = $this->getKernel(array(), array($parent, $child1, $child2)); + $kernel = $this->getKernel([], [$parent, $child1, $child2]); $kernel->boot(); } @@ -731,7 +731,7 @@ public function testInitializeBundleThrowsExceptionWhenRegisteringTwoBundlesWith $fooBundle = $this->getBundle(null, null, 'FooBundle', 'DuplicateName'); $barBundle = $this->getBundle(null, null, 'BarBundle', 'DuplicateName'); - $kernel = $this->getKernel(array(), array($fooBundle, $barBundle)); + $kernel = $this->getKernel([], [$fooBundle, $barBundle]); $kernel->boot(); } @@ -744,13 +744,13 @@ public function testInitializeBundleThrowsExceptionWhenABundleExtendsItself() { $circularRef = $this->getBundle(null, 'CircularRefBundle', 'CircularRefBundle'); - $kernel = $this->getKernel(array(), array($circularRef)); + $kernel = $this->getKernel([], [$circularRef]); $kernel->boot(); } public function testTerminateReturnsSilentlyIfKernelIsNotBooted() { - $kernel = $this->getKernel(array('getHttpKernel')); + $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->never()) ->method('getHttpKernel'); @@ -762,7 +762,7 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface() // does not implement TerminableInterface $httpKernel = new TestKernel(); - $kernel = $this->getKernel(array('getHttpKernel')); + $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->once()) ->method('getHttpKernel') ->willReturn($httpKernel); @@ -775,14 +775,14 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface() // implements TerminableInterface $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel') ->disableOriginalConstructor() - ->setMethods(array('terminate')) + ->setMethods(['terminate']) ->getMock(); $httpKernelMock ->expects($this->once()) ->method('terminate'); - $kernel = $this->getKernel(array('getHttpKernel')); + $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->exactly(2)) ->method('getHttpKernel') ->will($this->returnValue($httpKernelMock)); @@ -882,7 +882,7 @@ public function testServicesResetter() $container->addCompilerPass(new ResettableServicePass()); $container->register('one', ResettableService::class) ->setPublic(true) - ->addTag('kernel.reset', array('method' => 'reset')); + ->addTag('kernel.reset', ['method' => 'reset']); $container->register('services_resetter', ServicesResetter::class)->setPublic(true); }, $httpKernelMock, 'resetting'); @@ -906,7 +906,7 @@ public function testServicesResetter() */ public function testKernelStartTimeIsResetWhileBootingAlreadyBootedKernel() { - $kernel = $this->getKernelForTest(array('initializeBundles'), true); + $kernel = $this->getKernelForTest(['initializeBundles'], true); $kernel->boot(); $preReBoot = $kernel->getStartTime(); @@ -925,7 +925,7 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu { $bundle = $this ->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface') - ->setMethods(array('getPath', 'getParent', 'getName')) + ->setMethods(['getPath', 'getParent', 'getName']) ->disableOriginalConstructor() ; @@ -964,14 +964,14 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu * * @return Kernel */ - protected function getKernel(array $methods = array(), array $bundles = array()) + protected function getKernel(array $methods = [], array $bundles = []) { $methods[] = 'registerBundles'; $kernel = $this ->getMockBuilder('Symfony\Component\HttpKernel\Kernel') ->setMethods($methods) - ->setConstructorArgs(array('test', false)) + ->setConstructorArgs(['test', false]) ->getMockForAbstractClass() ; $kernel->expects($this->any()) @@ -985,10 +985,10 @@ protected function getKernel(array $methods = array(), array $bundles = array()) return $kernel; } - protected function getKernelForTest(array $methods = array(), $debug = false) + protected function getKernelForTest(array $methods = [], $debug = false) { $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest') - ->setConstructorArgs(array('test', $debug)) + ->setConstructorArgs(['test', $debug]) ->setMethods($methods) ->getMock(); $p = new \ReflectionProperty($kernel, 'rootDir'); @@ -1030,7 +1030,7 @@ public function __construct(\Closure $buildContainer = null, HttpKernelInterface public function registerBundles() { - return array(); + return []; } public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php b/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php index a5d070c8a750d0250bf8cb653601508dca045c7f..7354000b16595c24fce10f56090297663cd42aa0 100644 --- a/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php +++ b/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php @@ -72,39 +72,39 @@ public function testImplements() */ public function testLogsAtAllLevels($level, $message) { - $this->logger->{$level}($message, array('user' => 'Bob')); - $this->logger->log($level, $message, array('user' => 'Bob')); + $this->logger->{$level}($message, ['user' => 'Bob']); + $this->logger->log($level, $message, ['user' => 'Bob']); - $expected = array( + $expected = [ "[$level] message of level $level with context: Bob", "[$level] message of level $level with context: Bob", - ); + ]; $this->assertLogsMatch($expected, $this->getLogs()); } public function provideLevelsAndMessages() { - return array( - LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), - LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), - LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), - LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), - LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), - LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), - LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), - LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), - ); + return [ + LogLevel::EMERGENCY => [LogLevel::EMERGENCY, 'message of level emergency with context: {user}'], + LogLevel::ALERT => [LogLevel::ALERT, 'message of level alert with context: {user}'], + LogLevel::CRITICAL => [LogLevel::CRITICAL, 'message of level critical with context: {user}'], + LogLevel::ERROR => [LogLevel::ERROR, 'message of level error with context: {user}'], + LogLevel::WARNING => [LogLevel::WARNING, 'message of level warning with context: {user}'], + LogLevel::NOTICE => [LogLevel::NOTICE, 'message of level notice with context: {user}'], + LogLevel::INFO => [LogLevel::INFO, 'message of level info with context: {user}'], + LogLevel::DEBUG => [LogLevel::DEBUG, 'message of level debug with context: {user}'], + ]; } public function testLogLevelDisabled() { $this->logger = new Logger(LogLevel::INFO, $this->tmpFile); - $this->logger->debug('test', array('user' => 'Bob')); - $this->logger->log(LogLevel::DEBUG, 'test', array('user' => 'Bob')); + $this->logger->debug('test', ['user' => 'Bob']); + $this->logger->log(LogLevel::DEBUG, 'test', ['user' => 'Bob']); // Will always be true, but asserts than an exception isn't thrown - $this->assertSame(array(), $this->getLogs()); + $this->assertSame([], $this->getLogs()); } /** @@ -134,18 +134,18 @@ public function testInvalidOutput() public function testContextReplacement() { $logger = $this->logger; - $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); + $logger->info('{Message {nothing} {user} {foo.bar} a}', ['user' => 'Bob', 'foo.bar' => 'Bar']); - $expected = array('[info] {Message {nothing} Bob Bar a}'); + $expected = ['[info] {Message {nothing} Bob Bar a}']; $this->assertLogsMatch($expected, $this->getLogs()); } public function testObjectCastToString() { if (method_exists($this, 'createPartialMock')) { - $dummy = $this->createPartialMock(DummyTest::class, array('__toString')); + $dummy = $this->createPartialMock(DummyTest::class, ['__toString']); } else { - $dummy = $this->getMock(DummyTest::class, array('__toString')); + $dummy = $this->getMock(DummyTest::class, ['__toString']); } $dummy->expects($this->atLeastOnce()) ->method('__toString') @@ -153,54 +153,54 @@ public function testObjectCastToString() $this->logger->warning($dummy); - $expected = array('[warning] DUMMY'); + $expected = ['[warning] DUMMY']; $this->assertLogsMatch($expected, $this->getLogs()); } public function testContextCanContainAnything() { - $context = array( + $context = [ 'bool' => true, 'null' => null, 'string' => 'Foo', 'int' => 0, 'float' => 0.5, - 'nested' => array('with object' => new DummyTest()), + 'nested' => ['with object' => new DummyTest()], 'object' => new \DateTime(), 'resource' => fopen('php://memory', 'r'), - ); + ]; $this->logger->warning('Crazy context data', $context); - $expected = array('[warning] Crazy context data'); + $expected = ['[warning] Crazy context data']; $this->assertLogsMatch($expected, $this->getLogs()); } public function testContextExceptionKeyCanBeExceptionOrOtherValues() { $logger = $this->logger; - $logger->warning('Random message', array('exception' => 'oops')); - $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); + $logger->warning('Random message', ['exception' => 'oops']); + $logger->critical('Uncaught Exception!', ['exception' => new \LogicException('Fail')]); - $expected = array( + $expected = [ '[warning] Random message', '[critical] Uncaught Exception!', - ); + ]; $this->assertLogsMatch($expected, $this->getLogs()); } public function testFormatter() { $this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile, function ($level, $message, $context) { - return json_encode(array('level' => $level, 'message' => $message, 'context' => $context)).\PHP_EOL; + return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).\PHP_EOL; }); - $this->logger->error('An error', array('foo' => 'bar')); - $this->logger->warning('A warning', array('baz' => 'bar')); - $this->assertSame(array( + $this->logger->error('An error', ['foo' => 'bar']); + $this->logger->warning('A warning', ['baz' => 'bar']); + $this->assertSame([ '{"level":"error","message":"An error","context":{"foo":"bar"}}', '{"level":"warning","message":"A warning","context":{"baz":"bar"}}', - ), $this->getLogs()); + ], $this->getLogs()); } } diff --git a/vendor/symfony/http-kernel/Tests/Logger.php b/vendor/symfony/http-kernel/Tests/Logger.php index 63c70bf67aa82ec508e0eff9ce3163e52e15e20d..8ae756132cc4d52f3b88fc6cd599794334271e05 100644 --- a/vendor/symfony/http-kernel/Tests/Logger.php +++ b/vendor/symfony/http-kernel/Tests/Logger.php @@ -29,59 +29,59 @@ public function getLogs($level = false) public function clear() { - $this->logs = array( - 'emergency' => array(), - 'alert' => array(), - 'critical' => array(), - 'error' => array(), - 'warning' => array(), - 'notice' => array(), - 'info' => array(), - 'debug' => array(), - ); + $this->logs = [ + 'emergency' => [], + 'alert' => [], + 'critical' => [], + 'error' => [], + 'warning' => [], + 'notice' => [], + 'info' => [], + 'debug' => [], + ]; } - public function log($level, $message, array $context = array()) + public function log($level, $message, array $context = []) { $this->logs[$level][] = $message; } - public function emergency($message, array $context = array()) + public function emergency($message, array $context = []) { $this->log('emergency', $message, $context); } - public function alert($message, array $context = array()) + public function alert($message, array $context = []) { $this->log('alert', $message, $context); } - public function critical($message, array $context = array()) + public function critical($message, array $context = []) { $this->log('critical', $message, $context); } - public function error($message, array $context = array()) + public function error($message, array $context = []) { $this->log('error', $message, $context); } - public function warning($message, array $context = array()) + public function warning($message, array $context = []) { $this->log('warning', $message, $context); } - public function notice($message, array $context = array()) + public function notice($message, array $context = []) { $this->log('notice', $message, $context); } - public function info($message, array $context = array()) + public function info($message, array $context = []) { $this->log('info', $message, $context); } - public function debug($message, array $context = array()) + public function debug($message, array $context = []) { $this->log('debug', $message, $context); } diff --git a/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php b/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php index a1db1d9c0ec61ebcd988ad16007b6215c57b2fba..1cc05e41ec85420d2b3bc9a5fae62431d82c5f66 100644 --- a/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php @@ -226,7 +226,7 @@ public function testRetrieveByEmptyUrlAndIp() public function testRetrieveByMethodAndLimit() { - foreach (array('POST', 'GET') as $method) { + foreach (['POST', 'GET'] as $method) { for ($i = 0; $i < 5; ++$i) { $profile = new Profile('token_'.$i.$method); $profile->setMethod($method); @@ -293,8 +293,8 @@ public function testStatusCode() $tokens = $this->storage->find('', '', 10, ''); $this->assertCount(2, $tokens); - $this->assertContains($tokens[0]['status_code'], array(200, 404)); - $this->assertContains($tokens[1]['status_code'], array(200, 404)); + $this->assertContains($tokens[0]['status_code'], [200, 404]); + $this->assertContains($tokens[1]['status_code'], [200, 404]); } public function testMultiRowIndexFile() diff --git a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php b/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php index cff133c1aaa7c22a996f8cbfea6468d13022109a..8f12e013a4533bf9cdd044c57fac44ba29b35b95 100644 --- a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php +++ b/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php @@ -44,7 +44,7 @@ public function testCollect() public function testReset() { $collector = $this->getMockBuilder(DataCollectorInterface::class) - ->setMethods(array('collect', 'getName', 'reset')) + ->setMethods(['collect', 'getName', 'reset']) ->getMock(); $collector->expects($this->any())->method('getName')->willReturn('mock'); $collector->expects($this->once())->method('reset'); diff --git a/vendor/symfony/http-kernel/Tests/TestHttpKernel.php b/vendor/symfony/http-kernel/Tests/TestHttpKernel.php index fb95aa033b142b31ac308d562cb45825cd83632f..27ba2d6f8949901133c70c5dda934ec8d94d2ff2 100644 --- a/vendor/symfony/http-kernel/Tests/TestHttpKernel.php +++ b/vendor/symfony/http-kernel/Tests/TestHttpKernel.php @@ -27,12 +27,12 @@ public function __construct() public function getController(Request $request) { - return array($this, 'callController'); + return [$this, 'callController']; } public function getArguments(Request $request, $controller) { - return array($request); + return [$request]; } public function callController(Request $request) diff --git a/vendor/symfony/http-kernel/Tests/UriSignerTest.php b/vendor/symfony/http-kernel/Tests/UriSignerTest.php index 84ec19f70db2181402ca4f397ec6a2c261621ab2..9b7fe08a999097317497d06c06001337975d5aa5 100644 --- a/vendor/symfony/http-kernel/Tests/UriSignerTest.php +++ b/vendor/symfony/http-kernel/Tests/UriSignerTest.php @@ -21,7 +21,8 @@ public function testSign() $signer = new UriSigner('foobar'); $this->assertContains('?_hash=', $signer->sign('http://example.com/foo')); - $this->assertContains('&_hash=', $signer->sign('http://example.com/foo?foo=bar')); + $this->assertContains('?_hash=', $signer->sign('http://example.com/foo?foo=bar')); + $this->assertContains('&foo=', $signer->sign('http://example.com/foo?foo=bar')); } public function testCheck() @@ -45,7 +46,7 @@ public function testCheckWithDifferentArgSeparator() $signer = new UriSigner('foobar'); $this->assertSame( - 'http://example.com/foo?baz=bay&foo=bar&_hash=rIOcC%2FF3DoEGo%2FvnESjSp7uU9zA9S%2F%2BOLhxgMexoPUM%3D', + 'http://example.com/foo?_hash=rIOcC%2FF3DoEGo%2FvnESjSp7uU9zA9S%2F%2BOLhxgMexoPUM%3D&baz=bay&foo=bar', $signer->sign('http://example.com/foo?foo=bar&baz=bay') ); $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&baz=bay'))); @@ -61,4 +62,15 @@ public function testCheckWithDifferentParameter() ); $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&baz=bay'))); } + + public function testSignerWorksWithFragments() + { + $signer = new UriSigner('foobar'); + + $this->assertSame( + 'http://example.com/foo?_hash=EhpAUyEobiM3QTrKxoLOtQq5IsWyWedoXDPqIjzNj5o%3D&bar=foo&foo=bar#foobar', + $signer->sign('http://example.com/foo?bar=foo&foo=bar#foobar') + ); + $this->assertTrue($signer->check($signer->sign('http://example.com/foo?bar=foo&foo=bar#foobar'))); + } } diff --git a/vendor/symfony/http-kernel/UriSigner.php b/vendor/symfony/http-kernel/UriSigner.php index 28459b4ecd394ddc3fb0b4269277af03daa5537e..481270da519e159ea598ad0e86f17f73eb3ae20f 100644 --- a/vendor/symfony/http-kernel/UriSigner.php +++ b/vendor/symfony/http-kernel/UriSigner.php @@ -47,12 +47,13 @@ public function sign($uri) if (isset($url['query'])) { parse_str($url['query'], $params); } else { - $params = array(); + $params = []; } $uri = $this->buildUrl($url, $params); + $params[$this->parameter] = $this->computeHash($uri); - return $uri.(false === strpos($uri, '?') ? '?' : '&').$this->parameter.'='.$this->computeHash($uri); + return $this->buildUrl($url, $params); } /** @@ -68,14 +69,14 @@ public function check($uri) if (isset($url['query'])) { parse_str($url['query'], $params); } else { - $params = array(); + $params = []; } if (empty($params[$this->parameter])) { return false; } - $hash = urlencode($params[$this->parameter]); + $hash = $params[$this->parameter]; unset($params[$this->parameter]); return $this->computeHash($this->buildUrl($url, $params)) === $hash; @@ -83,10 +84,10 @@ public function check($uri) private function computeHash($uri) { - return urlencode(base64_encode(hash_hmac('sha256', $uri, $this->secret, true))); + return base64_encode(hash_hmac('sha256', $uri, $this->secret, true)); } - private function buildUrl(array $url, array $params = array()) + private function buildUrl(array $url, array $params = []) { ksort($params, SORT_STRING); $url['query'] = http_build_query($params, '', '&'); diff --git a/vendor/symfony/http-kernel/composer.json b/vendor/symfony/http-kernel/composer.json index 9ad3877ba1a5810fc5df200a3557f601a914673d..f47f1162d1cdc3a7afa88d13cf28cdc2a1f63994 100644 --- a/vendor/symfony/http-kernel/composer.json +++ b/vendor/symfony/http-kernel/composer.json @@ -19,7 +19,7 @@ "php": "^5.5.9|>=7.0.8", "symfony/event-dispatcher": "~2.8|~3.0|~4.0", "symfony/http-foundation": "~3.4.12|~4.0.12|^4.1.1", - "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/debug": "^3.3.3|~4.0", "symfony/polyfill-ctype": "~1.8", "psr/log": "~1.0" }, diff --git a/vendor/symfony/http-kernel/phpunit.xml.dist b/vendor/symfony/http-kernel/phpunit.xml.dist index e0de769dd7afc031a6dbc59a463b0a45530b0f27..3fc07707f2faeacf24a3ab2315390d1eebe1db41 100644 --- a/vendor/symfony/http-kernel/phpunit.xml.dist +++ b/vendor/symfony/http-kernel/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/polyfill-ctype/composer.json b/vendor/symfony/polyfill-ctype/composer.json index 0504dda05bc747d6be6764199550a67ff47488c3..094f8d867a0e30ae8ad2875e1d4d1ee613eb219b 100644 --- a/vendor/symfony/polyfill-ctype/composer.json +++ b/vendor/symfony/polyfill-ctype/composer.json @@ -22,10 +22,13 @@ "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" }, "files": [ "bootstrap.php" ] }, + "suggest": { + "ext-ctype": "For best performance" + }, "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } } } diff --git a/vendor/symfony/polyfill-iconv/Iconv.php b/vendor/symfony/polyfill-iconv/Iconv.php index b9abecbe8ced3f76a51b2cd905df8a3851279fb0..77e7ca056bfafef8f42ef6ba1d56785d9ca3e955 100644 --- a/vendor/symfony/polyfill-iconv/Iconv.php +++ b/vendor/symfony/polyfill-iconv/Iconv.php @@ -174,8 +174,8 @@ public static function iconv($inCharset, $outCharset, $str) } } while ($loop); - if (isset(self::$alias[ $inCharset])) { - $inCharset = self::$alias[ $inCharset]; + if (isset(self::$alias[$inCharset])) { + $inCharset = self::$alias[$inCharset]; } if (isset(self::$alias[$outCharset])) { $outCharset = self::$alias[$outCharset]; @@ -292,7 +292,7 @@ public static function iconv_mime_decode($str, $mode = 0, $charset = null) if ((ICONV_MIME_DECODE_CONTINUE_ON_ERROR & $mode) && 'utf-8' !== $c && !isset(self::$alias[$c]) - && !self::loadMap('from.', $c, $d)) { + && !self::loadMap('from.', $c, $d)) { $d = false; } elseif ('B' === strtoupper($str[$i + 1])) { $d = base64_decode($str[$i + 2]); @@ -433,7 +433,7 @@ public static function iconv_strlen($s, $encoding = null) { static $hasXml = null; if (null === $hasXml) { - $hasXml = extension_loaded('xml'); + $hasXml = \extension_loaded('xml'); } if ($hasXml) { @@ -695,6 +695,10 @@ private static function mapFromUtf8(&$result, array $map, $str, $ignore, $transl } else { return false; } + } elseif ($ignore) { + continue; + } else { + return false; } $str = $uchr.substr($str, $i); diff --git a/vendor/symfony/polyfill-iconv/composer.json b/vendor/symfony/polyfill-iconv/composer.json index 6e089b9c21c29d2ec1adb79aa8ef649b14b8c433..816e6bd7ffe11f0c4273be2e3d472605782bb9af 100644 --- a/vendor/symfony/polyfill-iconv/composer.json +++ b/vendor/symfony/polyfill-iconv/composer.json @@ -28,7 +28,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } } } diff --git a/vendor/symfony/polyfill-mbstring/Mbstring.php b/vendor/symfony/polyfill-mbstring/Mbstring.php index 4bd326e5f6e89c2ca7df31ab3247fd0a63d8bc7c..a5e4a8fde4bdee4cd0036a1bf85490c6fdb9d789 100644 --- a/vendor/symfony/polyfill-mbstring/Mbstring.php +++ b/vendor/symfony/polyfill-mbstring/Mbstring.php @@ -44,7 +44,7 @@ * - mb_strrchr - Finds the last occurrence of a character in a string within another * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive - * - mb_strstr - Finds first occurrence of a string within anothers + * - mb_strstr - Finds first occurrence of a string within another * - mb_strwidth - Return width of string * - mb_substr_count - Count the number of substring occurrences * @@ -72,8 +72,8 @@ final class Mbstring private static $language = 'neutral'; private static $internalEncoding = 'UTF-8'; private static $caseFold = array( - array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"), - array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1",'ι'), + array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"), + array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'), ); public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) @@ -141,7 +141,8 @@ public static function mb_encode_mimeheader($s, $charset = null, $transferEncodi public static function mb_decode_numericentity($s, $convmap, $encoding = null) { if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { - trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING); + return null; } @@ -150,7 +151,8 @@ public static function mb_decode_numericentity($s, $convmap, $encoding = null) } if (null !== $encoding && !\is_scalar($encoding)) { - trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING); + return ''; // Instead of null (cf. mb_encode_numericentity). } @@ -185,6 +187,7 @@ public static function mb_decode_numericentity($s, $convmap, $encoding = null) return Mbstring::mb_chr($c - $convmap[$i + 2]); } } + return $m[0]; }, $s); @@ -198,7 +201,8 @@ public static function mb_decode_numericentity($s, $convmap, $encoding = null) public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) { if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { - trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING); + return null; } @@ -207,12 +211,14 @@ public static function mb_encode_numericentity($s, $convmap, $encoding = null, $ } if (null !== $encoding && !\is_scalar($encoding)) { - trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING); + return null; // Instead of '' (cf. mb_decode_numericentity). } if (null !== $is_hex && !\is_scalar($is_hex)) { - trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING); + return null; } @@ -281,8 +287,11 @@ public static function mb_convert_case($s, $mode, $encoding = null) } if (MB_CASE_TITLE == $mode) { - $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s); - $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s); + static $titleRegexp = null; + if (null === $titleRegexp) { + $titleRegexp = self::getData('titleCaseRegexp'); + } + $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s); } else { if (MB_CASE_UPPER == $mode) { static $upper = null; @@ -324,7 +333,7 @@ public static function mb_convert_case($s, $mode, $encoding = null) } else { $s = substr_replace($s, $uchr, $i - $ulen, $ulen); $len += $nlen - $ulen; - $i += $nlen - $ulen; + $i += $nlen - $ulen; } } } @@ -452,6 +461,7 @@ public static function mb_detect_order($encodingList = null) if (strncmp($enc, 'ISO-8859-', 9)) { return false; } + // no break case 'ASCII': case 'UTF8': case 'UTF-8': @@ -701,6 +711,10 @@ public static function mb_ord($s, $encoding = null) $s = mb_convert_encoding($s, 'UTF-8', $encoding); } + if (1 === \strlen($s)) { + return \ord($s); + } + $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; if (0xF0 <= $code) { return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80; @@ -752,14 +766,9 @@ private static function html_encoding_callback(array $m) return $entities; } - private static function title_case_lower(array $s) - { - return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8'); - } - - private static function title_case_upper(array $s) + private static function title_case(array $s) { - return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8'); + return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8'); } private static function getData($file) diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php index 3ca16416a82580b15bd446ba5cf75dc3d87fa922..e6fbfa64e6215a3e572d3d99f794cc6a85ea8af8 100644 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php @@ -1,6 +1,6 @@ <?php -static $data = array ( +return array( 'A' => 'a', 'B' => 'b', 'C' => 'c', @@ -1094,8 +1094,3 @@ '𑢾' => '𑣞', '𑢿' => '𑣟', ); - -$result =& $data; -unset($data); - -return $result; diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php new file mode 100644 index 0000000000000000000000000000000000000000..2a8f6e73b99301469991b2bb835324b39d96cd60 --- /dev/null +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php @@ -0,0 +1,5 @@ +<?php + +// from Case_Ignorable in https://unicode.org/Public/UNIDATA/DerivedCoreProperties.txt + +return '/(?<![\x{0027}\x{002E}\x{003A}\x{005E}\x{0060}\x{00A8}\x{00AD}\x{00AF}\x{00B4}\x{00B7}\x{00B8}\x{02B0}-\x{02C1}\x{02C2}-\x{02C5}\x{02C6}-\x{02D1}\x{02D2}-\x{02DF}\x{02E0}-\x{02E4}\x{02E5}-\x{02EB}\x{02EC}\x{02ED}\x{02EE}\x{02EF}-\x{02FF}\x{0300}-\x{036F}\x{0374}\x{0375}\x{037A}\x{0384}-\x{0385}\x{0387}\x{0483}-\x{0487}\x{0488}-\x{0489}\x{0559}\x{0591}-\x{05BD}\x{05BF}\x{05C1}-\x{05C2}\x{05C4}-\x{05C5}\x{05C7}\x{05F4}\x{0600}-\x{0605}\x{0610}-\x{061A}\x{061C}\x{0640}\x{064B}-\x{065F}\x{0670}\x{06D6}-\x{06DC}\x{06DD}\x{06DF}-\x{06E4}\x{06E5}-\x{06E6}\x{06E7}-\x{06E8}\x{06EA}-\x{06ED}\x{070F}\x{0711}\x{0730}-\x{074A}\x{07A6}-\x{07B0}\x{07EB}-\x{07F3}\x{07F4}-\x{07F5}\x{07FA}\x{07FD}\x{0816}-\x{0819}\x{081A}\x{081B}-\x{0823}\x{0824}\x{0825}-\x{0827}\x{0828}\x{0829}-\x{082D}\x{0859}-\x{085B}\x{08D3}-\x{08E1}\x{08E2}\x{08E3}-\x{0902}\x{093A}\x{093C}\x{0941}-\x{0948}\x{094D}\x{0951}-\x{0957}\x{0962}-\x{0963}\x{0971}\x{0981}\x{09BC}\x{09C1}-\x{09C4}\x{09CD}\x{09E2}-\x{09E3}\x{09FE}\x{0A01}-\x{0A02}\x{0A3C}\x{0A41}-\x{0A42}\x{0A47}-\x{0A48}\x{0A4B}-\x{0A4D}\x{0A51}\x{0A70}-\x{0A71}\x{0A75}\x{0A81}-\x{0A82}\x{0ABC}\x{0AC1}-\x{0AC5}\x{0AC7}-\x{0AC8}\x{0ACD}\x{0AE2}-\x{0AE3}\x{0AFA}-\x{0AFF}\x{0B01}\x{0B3C}\x{0B3F}\x{0B41}-\x{0B44}\x{0B4D}\x{0B56}\x{0B62}-\x{0B63}\x{0B82}\x{0BC0}\x{0BCD}\x{0C00}\x{0C04}\x{0C3E}-\x{0C40}\x{0C46}-\x{0C48}\x{0C4A}-\x{0C4D}\x{0C55}-\x{0C56}\x{0C62}-\x{0C63}\x{0C81}\x{0CBC}\x{0CBF}\x{0CC6}\x{0CCC}-\x{0CCD}\x{0CE2}-\x{0CE3}\x{0D00}-\x{0D01}\x{0D3B}-\x{0D3C}\x{0D41}-\x{0D44}\x{0D4D}\x{0D62}-\x{0D63}\x{0DCA}\x{0DD2}-\x{0DD4}\x{0DD6}\x{0E31}\x{0E34}-\x{0E3A}\x{0E46}\x{0E47}-\x{0E4E}\x{0EB1}\x{0EB4}-\x{0EB9}\x{0EBB}-\x{0EBC}\x{0EC6}\x{0EC8}-\x{0ECD}\x{0F18}-\x{0F19}\x{0F35}\x{0F37}\x{0F39}\x{0F71}-\x{0F7E}\x{0F80}-\x{0F84}\x{0F86}-\x{0F87}\x{0F8D}-\x{0F97}\x{0F99}-\x{0FBC}\x{0FC6}\x{102D}-\x{1030}\x{1032}-\x{1037}\x{1039}-\x{103A}\x{103D}-\x{103E}\x{1058}-\x{1059}\x{105E}-\x{1060}\x{1071}-\x{1074}\x{1082}\x{1085}-\x{1086}\x{108D}\x{109D}\x{10FC}\x{135D}-\x{135F}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}-\x{1753}\x{1772}-\x{1773}\x{17B4}-\x{17B5}\x{17B7}-\x{17BD}\x{17C6}\x{17C9}-\x{17D3}\x{17D7}\x{17DD}\x{180B}-\x{180D}\x{180E}\x{1843}\x{1885}-\x{1886}\x{18A9}\x{1920}-\x{1922}\x{1927}-\x{1928}\x{1932}\x{1939}-\x{193B}\x{1A17}-\x{1A18}\x{1A1B}\x{1A56}\x{1A58}-\x{1A5E}\x{1A60}\x{1A62}\x{1A65}-\x{1A6C}\x{1A73}-\x{1A7C}\x{1A7F}\x{1AA7}\x{1AB0}-\x{1ABD}\x{1ABE}\x{1B00}-\x{1B03}\x{1B34}\x{1B36}-\x{1B3A}\x{1B3C}\x{1B42}\x{1B6B}-\x{1B73}\x{1B80}-\x{1B81}\x{1BA2}-\x{1BA5}\x{1BA8}-\x{1BA9}\x{1BAB}-\x{1BAD}\x{1BE6}\x{1BE8}-\x{1BE9}\x{1BED}\x{1BEF}-\x{1BF1}\x{1C2C}-\x{1C33}\x{1C36}-\x{1C37}\x{1C78}-\x{1C7D}\x{1CD0}-\x{1CD2}\x{1CD4}-\x{1CE0}\x{1CE2}-\x{1CE8}\x{1CED}\x{1CF4}\x{1CF8}-\x{1CF9}\x{1D2C}-\x{1D6A}\x{1D78}\x{1D9B}-\x{1DBF}\x{1DC0}-\x{1DF9}\x{1DFB}-\x{1DFF}\x{1FBD}\x{1FBF}-\x{1FC1}\x{1FCD}-\x{1FCF}\x{1FDD}-\x{1FDF}\x{1FED}-\x{1FEF}\x{1FFD}-\x{1FFE}\x{200B}-\x{200F}\x{2018}\x{2019}\x{2024}\x{2027}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{206F}\x{2071}\x{207F}\x{2090}-\x{209C}\x{20D0}-\x{20DC}\x{20DD}-\x{20E0}\x{20E1}\x{20E2}-\x{20E4}\x{20E5}-\x{20F0}\x{2C7C}-\x{2C7D}\x{2CEF}-\x{2CF1}\x{2D6F}\x{2D7F}\x{2DE0}-\x{2DFF}\x{2E2F}\x{3005}\x{302A}-\x{302D}\x{3031}-\x{3035}\x{303B}\x{3099}-\x{309A}\x{309B}-\x{309C}\x{309D}-\x{309E}\x{30FC}-\x{30FE}\x{A015}\x{A4F8}-\x{A4FD}\x{A60C}\x{A66F}\x{A670}-\x{A672}\x{A674}-\x{A67D}\x{A67F}\x{A69C}-\x{A69D}\x{A69E}-\x{A69F}\x{A6F0}-\x{A6F1}\x{A700}-\x{A716}\x{A717}-\x{A71F}\x{A720}-\x{A721}\x{A770}\x{A788}\x{A789}-\x{A78A}\x{A7F8}-\x{A7F9}\x{A802}\x{A806}\x{A80B}\x{A825}-\x{A826}\x{A8C4}-\x{A8C5}\x{A8E0}-\x{A8F1}\x{A8FF}\x{A926}-\x{A92D}\x{A947}-\x{A951}\x{A980}-\x{A982}\x{A9B3}\x{A9B6}-\x{A9B9}\x{A9BC}\x{A9CF}\x{A9E5}\x{A9E6}\x{AA29}-\x{AA2E}\x{AA31}-\x{AA32}\x{AA35}-\x{AA36}\x{AA43}\x{AA4C}\x{AA70}\x{AA7C}\x{AAB0}\x{AAB2}-\x{AAB4}\x{AAB7}-\x{AAB8}\x{AABE}-\x{AABF}\x{AAC1}\x{AADD}\x{AAEC}-\x{AAED}\x{AAF3}-\x{AAF4}\x{AAF6}\x{AB5B}\x{AB5C}-\x{AB5F}\x{ABE5}\x{ABE8}\x{ABED}\x{FB1E}\x{FBB2}-\x{FBC1}\x{FE00}-\x{FE0F}\x{FE13}\x{FE20}-\x{FE2F}\x{FE52}\x{FE55}\x{FEFF}\x{FF07}\x{FF0E}\x{FF1A}\x{FF3E}\x{FF40}\x{FF70}\x{FF9E}-\x{FF9F}\x{FFE3}\x{FFF9}-\x{FFFB}\x{101FD}\x{102E0}\x{10376}-\x{1037A}\x{10A01}-\x{10A03}\x{10A05}-\x{10A06}\x{10A0C}-\x{10A0F}\x{10A38}-\x{10A3A}\x{10A3F}\x{10AE5}-\x{10AE6}\x{10D24}-\x{10D27}\x{10F46}-\x{10F50}\x{11001}\x{11038}-\x{11046}\x{1107F}-\x{11081}\x{110B3}-\x{110B6}\x{110B9}-\x{110BA}\x{110BD}\x{110CD}\x{11100}-\x{11102}\x{11127}-\x{1112B}\x{1112D}-\x{11134}\x{11173}\x{11180}-\x{11181}\x{111B6}-\x{111BE}\x{111C9}-\x{111CC}\x{1122F}-\x{11231}\x{11234}\x{11236}-\x{11237}\x{1123E}\x{112DF}\x{112E3}-\x{112EA}\x{11300}-\x{11301}\x{1133B}-\x{1133C}\x{11340}\x{11366}-\x{1136C}\x{11370}-\x{11374}\x{11438}-\x{1143F}\x{11442}-\x{11444}\x{11446}\x{1145E}\x{114B3}-\x{114B8}\x{114BA}\x{114BF}-\x{114C0}\x{114C2}-\x{114C3}\x{115B2}-\x{115B5}\x{115BC}-\x{115BD}\x{115BF}-\x{115C0}\x{115DC}-\x{115DD}\x{11633}-\x{1163A}\x{1163D}\x{1163F}-\x{11640}\x{116AB}\x{116AD}\x{116B0}-\x{116B5}\x{116B7}\x{1171D}-\x{1171F}\x{11722}-\x{11725}\x{11727}-\x{1172B}\x{1182F}-\x{11837}\x{11839}-\x{1183A}\x{11A01}-\x{11A0A}\x{11A33}-\x{11A38}\x{11A3B}-\x{11A3E}\x{11A47}\x{11A51}-\x{11A56}\x{11A59}-\x{11A5B}\x{11A8A}-\x{11A96}\x{11A98}-\x{11A99}\x{11C30}-\x{11C36}\x{11C38}-\x{11C3D}\x{11C3F}\x{11C92}-\x{11CA7}\x{11CAA}-\x{11CB0}\x{11CB2}-\x{11CB3}\x{11CB5}-\x{11CB6}\x{11D31}-\x{11D36}\x{11D3A}\x{11D3C}-\x{11D3D}\x{11D3F}-\x{11D45}\x{11D47}\x{11D90}-\x{11D91}\x{11D95}\x{11D97}\x{11EF3}-\x{11EF4}\x{16AF0}-\x{16AF4}\x{16B30}-\x{16B36}\x{16B40}-\x{16B43}\x{16F8F}-\x{16F92}\x{16F93}-\x{16F9F}\x{16FE0}-\x{16FE1}\x{1BC9D}-\x{1BC9E}\x{1BCA0}-\x{1BCA3}\x{1D167}-\x{1D169}\x{1D173}-\x{1D17A}\x{1D17B}-\x{1D182}\x{1D185}-\x{1D18B}\x{1D1AA}-\x{1D1AD}\x{1D242}-\x{1D244}\x{1DA00}-\x{1DA36}\x{1DA3B}-\x{1DA6C}\x{1DA75}\x{1DA84}\x{1DA9B}-\x{1DA9F}\x{1DAA1}-\x{1DAAF}\x{1E000}-\x{1E006}\x{1E008}-\x{1E018}\x{1E01B}-\x{1E021}\x{1E023}-\x{1E024}\x{1E026}-\x{1E02A}\x{1E8D0}-\x{1E8D6}\x{1E944}-\x{1E94A}\x{1F3FB}-\x{1F3FF}\x{E0001}\x{E0020}-\x{E007F}\x{E0100}-\x{E01EF}])(\pL)(\pL*+)/u'; diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php index ec9422121cae73c8baa8d0cfc695897a5c091961..b8103b2e808dd0a670c04868f20edcc969ea7e70 100644 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php @@ -1,6 +1,6 @@ <?php -static $data = array ( +return array( 'a' => 'A', 'b' => 'B', 'c' => 'C', @@ -1102,8 +1102,3 @@ '𑣞' => '𑢾', '𑣟' => '𑢿', ); - -$result =& $data; -unset($data); - -return $result; diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json index 49b720dd81e2c2286cd0faf81182dfca43e7776d..50ea12f1bbb09226c9ee9abc9c3c33d8655af2b2 100644 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ b/vendor/symfony/polyfill-mbstring/composer.json @@ -28,7 +28,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } } } diff --git a/vendor/symfony/polyfill-php70/Php70.php b/vendor/symfony/polyfill-php70/Php70.php index 39e66450769d418c07f47818f9779c70ba616d97..7f1ad08a46b6ccc3038a75c95900e2c5df2afdaa 100644 --- a/vendor/symfony/polyfill-php70/Php70.php +++ b/vendor/symfony/polyfill-php70/Php70.php @@ -53,7 +53,7 @@ public static function error_clear_last() { static $handler; if (!$handler) { - $handler = function() { return false; }; + $handler = function () { return false; }; } set_error_handler($handler); @trigger_error(''); @@ -66,7 +66,7 @@ private static function intArg($value, $caller, $pos) return $value; } if (!\is_numeric($value) || PHP_INT_MAX <= ($value += 0) || ~PHP_INT_MAX >= $value) { - throw new \TypeError(sprintf('%s() expects parameter %d to be integer, %s given', $caller, $pos, gettype($value))); + throw new \TypeError(sprintf('%s() expects parameter %d to be integer, %s given', $caller, $pos, \gettype($value))); } return (int) $value; diff --git a/vendor/symfony/polyfill-php70/composer.json b/vendor/symfony/polyfill-php70/composer.json index 871045d2a390ab497e429c32d8f5f61216741327..13dcf94a62e29bf15e8f938a1c9af0c26eb0db68 100644 --- a/vendor/symfony/polyfill-php70/composer.json +++ b/vendor/symfony/polyfill-php70/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=5.3.3", - "paragonie/random_compat": "~1.0|~2.0" + "paragonie/random_compat": "~1.0|~2.0|~9.99" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php70\\": "" }, @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } } } diff --git a/vendor/symfony/process/ExecutableFinder.php b/vendor/symfony/process/ExecutableFinder.php index ccfa4c09b09ae0849b21ab160ea0129ef4dba482..a621fc6918e5d6213003397df6a889326e80695f 100644 --- a/vendor/symfony/process/ExecutableFinder.php +++ b/vendor/symfony/process/ExecutableFinder.php @@ -19,7 +19,7 @@ */ class ExecutableFinder { - private $suffixes = array('.exe', '.bat', '.cmd', '.com'); + private $suffixes = ['.exe', '.bat', '.cmd', '.com']; /** * Replaces default suffixes of executable. @@ -42,17 +42,17 @@ public function addSuffix($suffix) /** * Finds an executable by name. * - * @param string $name The executable name (without the extension) - * @param string $default The default to return if no executable is found - * @param array $extraDirs Additional dirs to check into + * @param string $name The executable name (without the extension) + * @param string|null $default The default to return if no executable is found + * @param array $extraDirs Additional dirs to check into * - * @return string The executable path or default value + * @return string|null The executable path or default value */ - public function find($name, $default = null, array $extraDirs = array()) + public function find($name, $default = null, array $extraDirs = []) { if (ini_get('open_basedir')) { $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir')); - $dirs = array(); + $dirs = []; foreach ($searchPath as $path) { // Silencing against https://bugs.php.net/69240 if (@is_dir($path)) { @@ -70,7 +70,7 @@ public function find($name, $default = null, array $extraDirs = array()) ); } - $suffixes = array(''); + $suffixes = ['']; if ('\\' === \DIRECTORY_SEPARATOR) { $pathExt = getenv('PATHEXT'); $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes); diff --git a/vendor/symfony/process/InputStream.php b/vendor/symfony/process/InputStream.php index 9bd917a7ef7cef309cad7ee2395f15534dea633d..757d6294554e52370284eb269e1425496c00e6fe 100644 --- a/vendor/symfony/process/InputStream.php +++ b/vendor/symfony/process/InputStream.php @@ -20,9 +20,9 @@ */ class InputStream implements \IteratorAggregate { - /** @var null|callable */ + /** @var callable|null */ private $onEmpty = null; - private $input = array(); + private $input = []; private $open = true; /** @@ -36,8 +36,8 @@ public function onEmpty(callable $onEmpty = null) /** * Appends an input to the write buffer. * - * @param resource|string|int|float|bool|\Traversable|null The input to append as scalar, - * stream resource or \Traversable + * @param resource|string|int|float|bool|\Traversable|null $input The input to append as scalar, + * stream resource or \Traversable */ public function write($input) { diff --git a/vendor/symfony/process/LICENSE b/vendor/symfony/process/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/process/LICENSE +++ b/vendor/symfony/process/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/process/PhpExecutableFinder.php b/vendor/symfony/process/PhpExecutableFinder.php index 334de13fc06006501e98ecfe205041ec69c801a5..a97aa12cbff46bee850e0b2193a92b1b7990f040 100644 --- a/vendor/symfony/process/PhpExecutableFinder.php +++ b/vendor/symfony/process/PhpExecutableFinder.php @@ -44,7 +44,7 @@ public function find($includeArgs = true) } // PHP_BINARY return the current sapi executable - if (PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) { + if (PHP_BINARY && \in_array(\PHP_SAPI, ['cli', 'cli-server', 'phpdbg'], true)) { return PHP_BINARY.$args; } @@ -66,7 +66,7 @@ public function find($includeArgs = true) return $php; } - $dirs = array(PHP_BINDIR); + $dirs = [PHP_BINDIR]; if ('\\' === \DIRECTORY_SEPARATOR) { $dirs[] = 'C:\xampp\php\\'; } @@ -81,7 +81,7 @@ public function find($includeArgs = true) */ public function findArguments() { - $arguments = array(); + $arguments = []; if (\defined('HHVM_VERSION')) { $arguments[] = '--php'; diff --git a/vendor/symfony/process/PhpProcess.php b/vendor/symfony/process/PhpProcess.php index b4763953141bc85f188c60ec42ec88ab2b508ed7..f0c47b285a164611e3761b21394c6e79ef331e40 100644 --- a/vendor/symfony/process/PhpProcess.php +++ b/vendor/symfony/process/PhpProcess.php @@ -16,9 +16,9 @@ /** * PhpProcess runs a PHP script in an independent process. * - * $p = new PhpProcess('<?php echo "foo"; ?>'); - * $p->run(); - * print $p->getOutput()."\n"; + * $p = new PhpProcess('<?php echo "foo"; ?>'); + * $p->run(); + * print $p->getOutput()."\n"; * * @author Fabien Potencier <fabien@symfony.com> */ @@ -37,7 +37,7 @@ public function __construct($script, $cwd = null, array $env = null, $timeout = if (false === $php = $executableFinder->find(false)) { $php = null; } else { - $php = array_merge(array($php), $executableFinder->findArguments()); + $php = array_merge([$php], $executableFinder->findArguments()); } if ('phpdbg' === \PHP_SAPI) { $file = tempnam(sys_get_temp_dir(), 'dbg'); @@ -64,7 +64,7 @@ public function setPhpBinary($php) /** * {@inheritdoc} */ - public function start(callable $callback = null/*, array $env = array()*/) + public function start(callable $callback = null/*, array $env = []*/) { if (null === $this->getCommandLine()) { throw new RuntimeException('Unable to find the PHP executable.'); diff --git a/vendor/symfony/process/Pipes/AbstractPipes.php b/vendor/symfony/process/Pipes/AbstractPipes.php index e5e26866afd936641cc1dc8d1da8c204ee858f4d..23886b616387f62562550c8287a5a0ea3a50721f 100644 --- a/vendor/symfony/process/Pipes/AbstractPipes.php +++ b/vendor/symfony/process/Pipes/AbstractPipes.php @@ -20,7 +20,7 @@ */ abstract class AbstractPipes implements PipesInterface { - public $pipes = array(); + public $pipes = []; private $inputBuffer = ''; private $input; @@ -49,7 +49,7 @@ public function close() foreach ($this->pipes as $pipe) { fclose($pipe); } - $this->pipes = array(); + $this->pipes = []; } /** @@ -117,8 +117,8 @@ protected function write() } } - $r = $e = array(); - $w = array($this->pipes[0]); + $r = $e = []; + $w = [$this->pipes[0]]; // let's have a look if something changed in streams if (false === @stream_select($r, $w, $e, 0, 0)) { @@ -130,7 +130,7 @@ protected function write() $written = fwrite($stdin, $this->inputBuffer); $this->inputBuffer = substr($this->inputBuffer, $written); if (isset($this->inputBuffer[0])) { - return array($this->pipes[0]); + return [$this->pipes[0]]; } } @@ -145,7 +145,7 @@ protected function write() if (isset($data[0])) { $this->inputBuffer = $data; - return array($this->pipes[0]); + return [$this->pipes[0]]; } } if (feof($input)) { @@ -164,7 +164,7 @@ protected function write() fclose($this->pipes[0]); unset($this->pipes[0]); } elseif (!$w) { - return array($this->pipes[0]); + return [$this->pipes[0]]; } } diff --git a/vendor/symfony/process/Pipes/UnixPipes.php b/vendor/symfony/process/Pipes/UnixPipes.php index 254df51902cb7b36fc285bb35ab07b719e5cf9c5..1ebf2138a56facd592ce31774b5bbfd918b3b13f 100644 --- a/vendor/symfony/process/Pipes/UnixPipes.php +++ b/vendor/symfony/process/Pipes/UnixPipes.php @@ -48,34 +48,34 @@ public function getDescriptors() if (!$this->haveReadSupport) { $nullstream = fopen('/dev/null', 'c'); - return array( - array('pipe', 'r'), + return [ + ['pipe', 'r'], $nullstream, $nullstream, - ); + ]; } if ($this->ttyMode) { - return array( - array('file', '/dev/tty', 'r'), - array('file', '/dev/tty', 'w'), - array('file', '/dev/tty', 'w'), - ); + return [ + ['file', '/dev/tty', 'r'], + ['file', '/dev/tty', 'w'], + ['file', '/dev/tty', 'w'], + ]; } if ($this->ptyMode && Process::isPtySupported()) { - return array( - array('pty'), - array('pty'), - array('pty'), - ); + return [ + ['pty'], + ['pty'], + ['pty'], + ]; } - return array( - array('pipe', 'r'), - array('pipe', 'w'), // stdout - array('pipe', 'w'), // stderr - ); + return [ + ['pipe', 'r'], + ['pipe', 'w'], // stdout + ['pipe', 'w'], // stderr + ]; } /** @@ -83,7 +83,7 @@ public function getDescriptors() */ public function getFiles() { - return array(); + return []; } /** @@ -94,18 +94,18 @@ public function readAndWrite($blocking, $close = false) $this->unblock(); $w = $this->write(); - $read = $e = array(); + $read = $e = []; $r = $this->pipes; unset($r[0]); // let's have a look if something changed in streams - set_error_handler(array($this, 'handleError')); + set_error_handler([$this, 'handleError']); if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { restore_error_handler(); // if a system call has been interrupted, forget about it, let's try again // otherwise, an error occurred, let's reset pipes if (!$this->hasSystemCallBeenInterrupted()) { - $this->pipes = array(); + $this->pipes = []; } return $read; diff --git a/vendor/symfony/process/Pipes/WindowsPipes.php b/vendor/symfony/process/Pipes/WindowsPipes.php index cfffd351d1f0ca17f4beedfdf99f98034c1a651f..1619e632f134a073233aa3043166b4562d387b70 100644 --- a/vendor/symfony/process/Pipes/WindowsPipes.php +++ b/vendor/symfony/process/Pipes/WindowsPipes.php @@ -26,12 +26,13 @@ */ class WindowsPipes extends AbstractPipes { - private $files = array(); - private $fileHandles = array(); - private $readBytes = array( + private $files = []; + private $fileHandles = []; + private $lockHandles = []; + private $readBytes = [ Process::STDOUT => 0, Process::STDERR => 0, - ); + ]; private $haveReadSupport; public function __construct($input, $haveReadSupport) @@ -43,35 +44,37 @@ public function __construct($input, $haveReadSupport) // Workaround for this problem is to use temporary files instead of pipes on Windows platform. // // @see https://bugs.php.net/bug.php?id=51800 - $pipes = array( + $pipes = [ Process::STDOUT => Process::OUT, Process::STDERR => Process::ERR, - ); - $tmpCheck = false; + ]; $tmpDir = sys_get_temp_dir(); $lastError = 'unknown reason'; set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; }); for ($i = 0;; ++$i) { foreach ($pipes as $pipe => $name) { $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name); - if (file_exists($file) && !unlink($file)) { - continue 2; - } - $h = fopen($file, 'xb'); - if (!$h) { - $error = $lastError; - if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) { - continue; - } + + if (!$h = fopen($file.'.lock', 'w')) { restore_error_handler(); - throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error)); + throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError)); } - if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) { + if (!flock($h, LOCK_EX | LOCK_NB)) { continue 2; } - if (isset($this->files[$pipe])) { - unlink($this->files[$pipe]); + if (isset($this->lockHandles[$pipe])) { + flock($this->lockHandles[$pipe], LOCK_UN); + fclose($this->lockHandles[$pipe]); } + $this->lockHandles[$pipe] = $h; + + if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) { + flock($this->lockHandles[$pipe], LOCK_UN); + fclose($this->lockHandles[$pipe]); + unset($this->lockHandles[$pipe]); + continue 2; + } + $this->fileHandles[$pipe] = $h; $this->files[$pipe] = $file; } break; @@ -85,7 +88,6 @@ public function __construct($input, $haveReadSupport) public function __destruct() { $this->close(); - $this->removeFiles(); } /** @@ -96,21 +98,21 @@ public function getDescriptors() if (!$this->haveReadSupport) { $nullstream = fopen('NUL', 'c'); - return array( - array('pipe', 'r'), + return [ + ['pipe', 'r'], $nullstream, $nullstream, - ); + ]; } // We're not using pipe on Windows platform as it hangs (https://bugs.php.net/bug.php?id=51800) // We're not using file handles as it can produce corrupted output https://bugs.php.net/bug.php?id=65650 // So we redirect output within the commandline and pass the nul device to the process - return array( - array('pipe', 'r'), - array('file', 'NUL', 'w'), - array('file', 'NUL', 'w'), - ); + return [ + ['pipe', 'r'], + ['file', 'NUL', 'w'], + ['file', 'NUL', 'w'], + ]; } /** @@ -128,7 +130,7 @@ public function readAndWrite($blocking, $close = false) { $this->unblock(); $w = $this->write(); - $read = $r = $e = array(); + $read = $r = $e = []; if ($blocking) { if ($w) { @@ -145,8 +147,11 @@ public function readAndWrite($blocking, $close = false) $read[$type] = $data; } if ($close) { + ftruncate($fileHandle, 0); fclose($fileHandle); - unset($this->fileHandles[$type]); + flock($this->lockHandles[$type], LOCK_UN); + fclose($this->lockHandles[$type]); + unset($this->fileHandles[$type], $this->lockHandles[$type]); } } @@ -175,22 +180,12 @@ public function areOpen() public function close() { parent::close(); - foreach ($this->fileHandles as $handle) { + foreach ($this->fileHandles as $type => $handle) { + ftruncate($handle, 0); fclose($handle); + flock($this->lockHandles[$type], LOCK_UN); + fclose($this->lockHandles[$type]); } - $this->fileHandles = array(); - } - - /** - * Removes temporary files. - */ - private function removeFiles() - { - foreach ($this->files as $filename) { - if (file_exists($filename)) { - @unlink($filename); - } - } - $this->files = array(); + $this->fileHandles = $this->lockHandles = []; } } diff --git a/vendor/symfony/process/Process.php b/vendor/symfony/process/Process.php index a64f5f00141e8467f56eb2274142b137427cf4cd..75395b66c587ebc4f5c4821e4cb697f78fd4493e 100644 --- a/vendor/symfony/process/Process.php +++ b/vendor/symfony/process/Process.php @@ -58,9 +58,9 @@ class Process implements \IteratorAggregate private $lastOutputTime; private $timeout; private $idleTimeout; - private $options = array('suppress_errors' => true); + private $options = ['suppress_errors' => true]; private $exitcode; - private $fallbackStatus = array(); + private $fallbackStatus = []; private $processInformation; private $outputDisabled = false; private $stdout; @@ -88,7 +88,7 @@ class Process implements \IteratorAggregate * * User-defined errors must use exit codes in the 64-113 range. */ - public static $exitCodes = array( + public static $exitCodes = [ 0 => 'OK', 1 => 'General error', 2 => 'Misuse of shell builtins', @@ -129,7 +129,7 @@ class Process implements \IteratorAggregate 157 => 'Pollable event', // 158 - not defined 159 => 'Bad syscall', - ); + ]; /** * @param string|array $commandline The command line to run @@ -204,7 +204,7 @@ public function __clone() * * @final since version 3.3 */ - public function run($callback = null/*, array $env = array()*/) + public function run($callback = null/*, array $env = []*/) { $env = 1 < \func_num_args() ? func_get_arg(1) : null; $this->start($callback, $env); @@ -228,7 +228,7 @@ public function run($callback = null/*, array $env = array()*/) * * @final since version 3.3 */ - public function mustRun(callable $callback = null/*, array $env = array()*/) + public function mustRun(callable $callback = null/*, array $env = []*/) { if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.'); @@ -262,7 +262,7 @@ public function mustRun(callable $callback = null/*, array $env = array()*/) * @throws RuntimeException When process is already running * @throws LogicException In case a callback is provided and output has been disabled */ - public function start(callable $callback = null/*, array $env = array()*/) + public function start(callable $callback = null/*, array $env = [*/) { if ($this->isRunning()) { throw new RuntimeException('Process is already running'); @@ -287,7 +287,7 @@ public function start(callable $callback = null/*, array $env = array()*/) $inheritEnv = $this->inheritEnv; if (\is_array($commandline = $this->commandline)) { - $commandline = implode(' ', array_map(array($this, 'escapeArgument'), $commandline)); + $commandline = implode(' ', array_map([$this, 'escapeArgument'], $commandline)); if ('\\' !== \DIRECTORY_SEPARATOR) { // exec is mandatory to deal with sending a signal to the process @@ -316,7 +316,7 @@ public function start(callable $callback = null/*, array $env = array()*/) $commandline = $this->prepareWindowsCommandLine($commandline, $env); } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { // last exit code is output on the fourth pipe and caught to work around --enable-sigchild - $descriptors[3] = array('pipe', 'w'); + $descriptors[3] = ['pipe', 'w']; // See https://unix.stackexchange.com/questions/71205/background-process-pipe-input $commandline = '{ ('.$commandline.') <&3 3<&- 3>/dev/null & } 3<&0;'; @@ -329,7 +329,7 @@ public function start(callable $callback = null/*, array $env = array()*/) if (\defined('HHVM_VERSION')) { $envPairs = $env; } else { - $envPairs = array(); + $envPairs = []; foreach ($env as $k => $v) { if (false !== $v) { $envPairs[] = $k.'='.$v; @@ -378,7 +378,7 @@ public function start(callable $callback = null/*, array $env = array()*/) * * @final since version 3.3 */ - public function restart(callable $callback = null/*, array $env = array()*/) + public function restart(callable $callback = null/*, array $env = []*/) { if ($this->isRunning()) { throw new RuntimeException('Process is already running'); @@ -692,7 +692,7 @@ public function clearErrorOutput() /** * Returns the exit code returned by the process. * - * @return null|int The exit status code, null if the Process is not terminated + * @return int|null The exit status code, null if the Process is not terminated * * @throws RuntimeException In case --enable-sigchild is activated and the sigchild compatibility mode is disabled */ @@ -713,7 +713,7 @@ public function getExitCode() * This method relies on the Unix exit code status standardization * and might not be relevant for other operating systems. * - * @return null|string A string representation for the exit status code, null if the Process is not terminated + * @return string|null A string representation for the exit status code, null if the Process is not terminated * * @see http://tldp.org/LDP/abs/html/exitcodes.html * @see http://en.wikipedia.org/wiki/Unix_signal @@ -939,7 +939,7 @@ public function addErrorOutput($line) */ public function getCommandLine() { - return \is_array($this->commandline) ? implode(' ', array_map(array($this, 'escapeArgument'), $this->commandline)) : $this->commandline; + return \is_array($this->commandline) ? implode(' ', array_map([$this, 'escapeArgument'], $this->commandline)) : $this->commandline; } /** @@ -1035,7 +1035,7 @@ public function setTty($tty) static $isTtySupported; if (null === $isTtySupported) { - $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes); + $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes); } if (!$isTtySupported) { @@ -1359,7 +1359,7 @@ public static function isPtySupported() return $result = false; } - return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes); + return $result = (bool) @proc_open('echo 1 >/dev/null', [['pty'], ['pty'], ['pty']], $pipes); } /** @@ -1563,10 +1563,10 @@ private function resetProcessData() $this->starttime = null; $this->callback = null; $this->exitcode = null; - $this->fallbackStatus = array(); + $this->fallbackStatus = []; $this->processInformation = null; - $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+'); - $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+'); + $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b'); + $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b'); $this->process = null; $this->latestSignal = null; $this->status = self::STATUS_READY; @@ -1610,7 +1610,7 @@ private function doSignal($signal, $throwException) $ok = @proc_terminate($this->process, $signal); } elseif (\function_exists('posix_kill')) { $ok = @posix_kill($pid, $signal); - } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) { + } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), [2 => ['pipe', 'w']], $pipes)) { $ok = false === fgets($pipes[2]); } if (!$ok) { @@ -1634,7 +1634,7 @@ private function prepareWindowsCommandLine($cmd, array &$env) { $uid = uniqid('', true); $varCount = 0; - $varCache = array(); + $varCache = []; $cmd = preg_replace_callback( '/"(?:( [^"%!^]*+ @@ -1657,7 +1657,7 @@ function ($m) use (&$env, &$varCache, &$varCount, $uid) { return '"'.$value.'"'; } - $value = str_replace(array('!LF!', '"^!"', '"^%"', '"^^"', '""'), array("\n", '!', '%', '^', '"'), $value); + $value = str_replace(['!LF!', '"^!"', '"^%"', '"^^"', '""'], ["\n", '!', '%', '^', '"'], $value); $value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"'; $var = $uid.++$varCount; @@ -1727,12 +1727,12 @@ private function escapeArgument($argument) } $argument = preg_replace('/(\\\\+)$/', '$1$1', $argument); - return '"'.str_replace(array('"', '^', '%', '!', "\n"), array('""', '"^^"', '"^%"', '"^!"', '!LF!'), $argument).'"'; + return '"'.str_replace(['"', '^', '%', '!', "\n"], ['""', '"^^"', '"^%"', '"^!"', '!LF!'], $argument).'"'; } private function getDefaultEnv() { - $env = array(); + $env = []; foreach ($_SERVER as $k => $v) { if (\is_string($v) && false !== $v = getenv($k)) { diff --git a/vendor/symfony/process/ProcessBuilder.php b/vendor/symfony/process/ProcessBuilder.php index 916ff4479ea2f3f578e899771e359b31155fb25a..69d13c3f1bca5f3dd36bd113f6935096472c8a18 100644 --- a/vendor/symfony/process/ProcessBuilder.php +++ b/vendor/symfony/process/ProcessBuilder.php @@ -25,18 +25,18 @@ class ProcessBuilder { private $arguments; private $cwd; - private $env = array(); + private $env = []; private $input; private $timeout = 60; private $options; private $inheritEnv = true; - private $prefix = array(); + private $prefix = []; private $outputDisabled = false; /** * @param string[] $arguments An array of arguments */ - public function __construct(array $arguments = array()) + public function __construct(array $arguments = []) { $this->arguments = $arguments; } @@ -48,7 +48,7 @@ public function __construct(array $arguments = array()) * * @return static */ - public static function create(array $arguments = array()) + public static function create(array $arguments = []) { return new static($arguments); } @@ -78,7 +78,7 @@ public function add($argument) */ public function setPrefix($prefix) { - $this->prefix = \is_array($prefix) ? $prefix : array($prefix); + $this->prefix = \is_array($prefix) ? $prefix : [$prefix]; return $this; } @@ -103,7 +103,7 @@ public function setArguments(array $arguments) /** * Sets the working directory. * - * @param null|string $cwd The working directory + * @param string|null $cwd The working directory * * @return $this */ @@ -135,7 +135,7 @@ public function inheritEnvironmentVariables($inheritEnv = true) * defined environment variable. * * @param string $name The variable name - * @param null|string $value The variable value + * @param string|null $value The variable value * * @return $this */ diff --git a/vendor/symfony/process/Tests/ExecutableFinderTest.php b/vendor/symfony/process/Tests/ExecutableFinderTest.php index ee25eda02b453d2ca6182d0cf9caf3cff295f659..a437f2bb6f771b8acf09e5a7c4b7f47b9d36fc4c 100644 --- a/vendor/symfony/process/Tests/ExecutableFinderTest.php +++ b/vendor/symfony/process/Tests/ExecutableFinderTest.php @@ -65,6 +65,21 @@ public function testFindWithDefault() $this->assertEquals($expected, $result); } + public function testFindWithNullAsDefault() + { + if (ini_get('open_basedir')) { + $this->markTestSkipped('Cannot test when open_basedir is set'); + } + + $this->setPath(''); + + $finder = new ExecutableFinder(); + + $result = $finder->find('foo'); + + $this->assertNull($result); + } + public function testFindWithExtraDirs() { if (ini_get('open_basedir')) { @@ -73,7 +88,7 @@ public function testFindWithExtraDirs() $this->setPath(''); - $extraDirs = array(\dirname(PHP_BINARY)); + $extraDirs = [\dirname(PHP_BINARY)]; $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName(), null, $extraDirs); diff --git a/vendor/symfony/process/Tests/PhpExecutableFinderTest.php b/vendor/symfony/process/Tests/PhpExecutableFinderTest.php index 0c9e32d7d72fae7cf6d9a1b155e647a3dce1f9ec..795be8fa24bfcd6f9c9a82e379e3a9909d207962 100644 --- a/vendor/symfony/process/Tests/PhpExecutableFinderTest.php +++ b/vendor/symfony/process/Tests/PhpExecutableFinderTest.php @@ -62,11 +62,11 @@ public function testFindArguments() $f = new PhpExecutableFinder(); if (\defined('HHVM_VERSION')) { - $this->assertEquals($f->findArguments(), array('--php'), '::findArguments() returns HHVM arguments'); + $this->assertEquals($f->findArguments(), ['--php'], '::findArguments() returns HHVM arguments'); } elseif ('phpdbg' === \PHP_SAPI) { - $this->assertEquals($f->findArguments(), array('-qrr'), '::findArguments() returns phpdbg arguments'); + $this->assertEquals($f->findArguments(), ['-qrr'], '::findArguments() returns phpdbg arguments'); } else { - $this->assertEquals($f->findArguments(), array(), '::findArguments() returns no arguments'); + $this->assertEquals($f->findArguments(), [], '::findArguments() returns no arguments'); } } } diff --git a/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php b/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php index 1ea0e127f76b4e376cac50424f7e5bc4493775f4..9ea8981e19b7d72f97f53c45db43f1fc9dc07c9d 100644 --- a/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php +++ b/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php @@ -14,8 +14,8 @@ define('ERR_READ_FAILED', 3); define('ERR_WRITE_FAILED', 4); -$read = array(STDIN); -$write = array(STDOUT, STDERR); +$read = [STDIN]; +$write = [STDOUT, STDERR]; stream_set_blocking(STDIN, 0); stream_set_blocking(STDOUT, 0); @@ -42,7 +42,7 @@ $out = (string) substr($out, $written); } if (null === $read && '' === $out) { - $write = array_diff($write, array(STDOUT)); + $write = array_diff($write, [STDOUT]); } if (in_array(STDERR, $w) && strlen($err) > 0) { @@ -53,7 +53,7 @@ $err = (string) substr($err, $written); } if (null === $read && '' === $err) { - $write = array_diff($write, array(STDERR)); + $write = array_diff($write, [STDERR]); } if ($r) { diff --git a/vendor/symfony/process/Tests/ProcessBuilderTest.php b/vendor/symfony/process/Tests/ProcessBuilderTest.php index c98b8730538fcf6aca3d27f50c68582bc4c2345d..349b197a415b660acc9439f9cd1a25757336700d 100644 --- a/vendor/symfony/process/Tests/ProcessBuilderTest.php +++ b/vendor/symfony/process/Tests/ProcessBuilderTest.php @@ -38,10 +38,10 @@ public function testInheritEnvironmentVars() public function testAddEnvironmentVariables() { $pb = new ProcessBuilder(); - $env = array( + $env = [ 'foo' => 'bar', 'foo2' => 'bar2', - ); + ]; $proc = $pb ->add('command') ->setEnv('foo', 'bar2') @@ -76,8 +76,8 @@ public function testNullTimeout() public function testShouldSetArguments() { - $pb = new ProcessBuilder(array('initial')); - $pb->setArguments(array('second')); + $pb = new ProcessBuilder(['initial']); + $pb->setArguments(['second']); $proc = $pb->getProcess(); @@ -89,14 +89,14 @@ public function testPrefixIsPrependedToAllGeneratedProcess() $pb = new ProcessBuilder(); $pb->setPrefix('/usr/bin/php'); - $proc = $pb->setArguments(array('-v'))->getProcess(); + $proc = $pb->setArguments(['-v'])->getProcess(); if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals('"/usr/bin/php" -v', $proc->getCommandLine()); } else { $this->assertEquals("'/usr/bin/php' '-v'", $proc->getCommandLine()); } - $proc = $pb->setArguments(array('-i'))->getProcess(); + $proc = $pb->setArguments(['-i'])->getProcess(); if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals('"/usr/bin/php" -i', $proc->getCommandLine()); } else { @@ -107,16 +107,16 @@ public function testPrefixIsPrependedToAllGeneratedProcess() public function testArrayPrefixesArePrependedToAllGeneratedProcess() { $pb = new ProcessBuilder(); - $pb->setPrefix(array('/usr/bin/php', 'composer.phar')); + $pb->setPrefix(['/usr/bin/php', 'composer.phar']); - $proc = $pb->setArguments(array('-v'))->getProcess(); + $proc = $pb->setArguments(['-v'])->getProcess(); if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals('"/usr/bin/php" composer.phar -v', $proc->getCommandLine()); } else { $this->assertEquals("'/usr/bin/php' 'composer.phar' '-v'", $proc->getCommandLine()); } - $proc = $pb->setArguments(array('-i'))->getProcess(); + $proc = $pb->setArguments(['-i'])->getProcess(); if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals('"/usr/bin/php" composer.phar -i', $proc->getCommandLine()); } else { @@ -126,7 +126,7 @@ public function testArrayPrefixesArePrependedToAllGeneratedProcess() public function testShouldEscapeArguments() { - $pb = new ProcessBuilder(array('%path%', 'foo " bar', '%baz%baz')); + $pb = new ProcessBuilder(['%path%', 'foo " bar', '%baz%baz']); $proc = $pb->getProcess(); if ('\\' === \DIRECTORY_SEPARATOR) { @@ -138,7 +138,7 @@ public function testShouldEscapeArguments() public function testShouldEscapeArgumentsAndPrefix() { - $pb = new ProcessBuilder(array('arg')); + $pb = new ProcessBuilder(['arg']); $pb->setPrefix('%prefix%'); $proc = $pb->getProcess(); @@ -172,7 +172,7 @@ public function testShouldNotThrowALogicExceptionIfNoArgument() public function testShouldNotThrowALogicExceptionIfNoPrefix() { - $process = ProcessBuilder::create(array('/usr/bin/php')) + $process = ProcessBuilder::create(['/usr/bin/php']) ->getProcess(); if ('\\' === \DIRECTORY_SEPARATOR) { @@ -184,7 +184,7 @@ public function testShouldNotThrowALogicExceptionIfNoPrefix() public function testShouldReturnProcessWithDisabledOutput() { - $process = ProcessBuilder::create(array('/usr/bin/php')) + $process = ProcessBuilder::create(['/usr/bin/php']) ->disableOutput() ->getProcess(); @@ -193,7 +193,7 @@ public function testShouldReturnProcessWithDisabledOutput() public function testShouldReturnProcessWithEnabledOutput() { - $process = ProcessBuilder::create(array('/usr/bin/php')) + $process = ProcessBuilder::create(['/usr/bin/php']) ->disableOutput() ->enableOutput() ->getProcess(); @@ -208,7 +208,7 @@ public function testShouldReturnProcessWithEnabledOutput() public function testInvalidInput() { $builder = ProcessBuilder::create(); - $builder->setInput(array()); + $builder->setInput([]); } public function testDoesNotPrefixExec() @@ -217,7 +217,7 @@ public function testDoesNotPrefixExec() $this->markTestSkipped('This test cannot run on Windows.'); } - $builder = ProcessBuilder::create(array('command', '-v', 'ls')); + $builder = ProcessBuilder::create(['command', '-v', 'ls']); $process = $builder->getProcess(); $process->run(); diff --git a/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php b/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php index 25712af7ded1ac595d8be7b031ea43b8c18ed5bd..4b0376ff4ef5f58e3d3529cbaee74e407b214149 100644 --- a/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php +++ b/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php @@ -24,7 +24,7 @@ class ProcessFailedExceptionTest extends TestCase */ public function testProcessFailedExceptionThrowsException() { - $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(array('isSuccessful'))->setConstructorArgs(array('php'))->getMock(); + $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful'])->setConstructorArgs(['php'])->getMock(); $process->expects($this->once()) ->method('isSuccessful') ->will($this->returnValue(true)); @@ -52,7 +52,7 @@ public function testProcessFailedExceptionPopulatesInformationFromProcessOutput( $errorOutput = 'FATAL: Unexpected error'; $workingDirectory = getcwd(); - $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(array('isSuccessful', 'getOutput', 'getErrorOutput', 'getExitCode', 'getExitCodeText', 'isOutputDisabled', 'getWorkingDirectory'))->setConstructorArgs(array($cmd))->getMock(); + $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful', 'getOutput', 'getErrorOutput', 'getExitCode', 'getExitCodeText', 'isOutputDisabled', 'getWorkingDirectory'])->setConstructorArgs([$cmd])->getMock(); $process->expects($this->once()) ->method('isSuccessful') ->will($this->returnValue(false)); @@ -100,7 +100,7 @@ public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput() $exitText = 'General error'; $workingDirectory = getcwd(); - $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(array('isSuccessful', 'isOutputDisabled', 'getExitCode', 'getExitCodeText', 'getOutput', 'getErrorOutput', 'getWorkingDirectory'))->setConstructorArgs(array($cmd))->getMock(); + $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful', 'isOutputDisabled', 'getExitCode', 'getExitCodeText', 'getOutput', 'getErrorOutput', 'getWorkingDirectory'])->setConstructorArgs([$cmd])->getMock(); $process->expects($this->once()) ->method('isSuccessful') ->will($this->returnValue(false)); diff --git a/vendor/symfony/process/Tests/ProcessTest.php b/vendor/symfony/process/Tests/ProcessTest.php index 9174cac3bce0f9f19772c3e5b86c655c0468d066..a9ecbe8043f640d1faa33ae283a3a7b0c938b094 100644 --- a/vendor/symfony/process/Tests/ProcessTest.php +++ b/vendor/symfony/process/Tests/ProcessTest.php @@ -115,7 +115,7 @@ public function testFloatAndNullTimeout() */ public function testStopWithTimeoutIsActuallyWorking() { - $p = $this->getProcess(array(self::$phpBin, __DIR__.'/NonStopableProcess.php', 30)); + $p = $this->getProcess([self::$phpBin, __DIR__.'/NonStopableProcess.php', 30]); $p->start(); while (false === strpos($p->getOutput(), 'received')) { @@ -276,10 +276,10 @@ public function testInvalidInput($value) public function provideInvalidInputValues() { - return array( - array(array()), - array(new NonStringifiable()), - ); + return [ + [[]], + [new NonStringifiable()], + ]; } /** @@ -294,25 +294,25 @@ public function testValidInput($expected, $value) public function provideInputValues() { - return array( - array(null, null), - array('24.5', 24.5), - array('input data', 'input data'), - ); + return [ + [null, null], + ['24.5', 24.5], + ['input data', 'input data'], + ]; } public function chainedCommandsOutputProvider() { if ('\\' === \DIRECTORY_SEPARATOR) { - return array( - array("2 \r\n2\r\n", '&&', '2'), - ); + return [ + ["2 \r\n2\r\n", '&&', '2'], + ]; } - return array( - array("1\n1\n", ';', '1'), - array("2\n2\n", '&&', '2'), - ); + return [ + ["1\n1\n", ';', '1'], + ["2\n2\n", '&&', '2'], + ]; } /** @@ -381,7 +381,7 @@ public function testIncrementalOutput($getOutput, $getIncrementalOutput, $uri) $p->start(); - foreach (array('foo', 'bar') as $s) { + foreach (['foo', 'bar'] as $s) { while (false === strpos($p->$getOutput(), $s)) { usleep(1000); } @@ -397,10 +397,10 @@ public function testIncrementalOutput($getOutput, $getIncrementalOutput, $uri) public function provideIncrementalOutput() { - return array( - array('getOutput', 'getIncrementalOutput', 'php://stdout'), - array('getErrorOutput', 'getIncrementalErrorOutput', 'php://stderr'), - ); + return [ + ['getOutput', 'getIncrementalOutput', 'php://stdout'], + ['getErrorOutput', 'getIncrementalErrorOutput', 'php://stderr'], + ]; } public function testGetOutput() @@ -447,9 +447,6 @@ public function testExitCodeCommandFailed() $this->assertGreaterThan(0, $process->getExitCode()); } - /** - * @group tty - */ public function testTTYCommand() { if ('\\' === \DIRECTORY_SEPARATOR) { @@ -465,9 +462,6 @@ public function testTTYCommand() $this->assertSame(Process::STATUS_TERMINATED, $process->getStatus()); } - /** - * @group tty - */ public function testTTYCommandExitCode() { if ('\\' === \DIRECTORY_SEPARATOR) { @@ -913,7 +907,7 @@ public function testGetPidIsNullAfterRun() */ public function testSignal() { - $process = $this->getProcess(array(self::$phpBin, __DIR__.'/SignalListener.php')); + $process = $this->getProcess([self::$phpBin, __DIR__.'/SignalListener.php']); $process->start(); while (false === strpos($process->getOutput(), 'Caught')) { @@ -975,13 +969,13 @@ public function testMethodsThatNeedARunningProcess($method) public function provideMethodsThatNeedARunningProcess() { - return array( - array('getOutput'), - array('getIncrementalOutput'), - array('getErrorOutput'), - array('getIncrementalErrorOutput'), - array('wait'), - ); + return [ + ['getOutput'], + ['getIncrementalOutput'], + ['getErrorOutput'], + ['getIncrementalErrorOutput'], + ['wait'], + ]; } /** @@ -1006,12 +1000,12 @@ public function testMethodsThatNeedATerminatedProcess($method) public function provideMethodsThatNeedATerminatedProcess() { - return array( - array('hasBeenSignaled'), - array('getTermSignal'), - array('hasBeenStopped'), - array('getStopSignal'), - ); + return [ + ['hasBeenSignaled'], + ['getTermSignal'], + ['hasBeenStopped'], + ['getStopSignal'], + ]; } /** @@ -1038,10 +1032,10 @@ public function testWrongSignal($signal) public function provideWrongSignal() { - return array( - array(-4), - array('Céphalopodes'), - ); + return [ + [-4], + ['Céphalopodes'], + ]; } public function testDisableOutputDisablesTheOutput() @@ -1131,12 +1125,12 @@ public function testGetOutputWhileDisabled($fetchMethod) public function provideOutputFetchingMethods() { - return array( - array('getOutput'), - array('getIncrementalOutput'), - array('getErrorOutput'), - array('getIncrementalErrorOutput'), - ); + return [ + ['getOutput'], + ['getIncrementalOutput'], + ['getErrorOutput'], + ['getIncrementalErrorOutput'], + ]; } public function testStopTerminatesProcessCleanly() @@ -1168,32 +1162,32 @@ public function testTermSignalTerminatesProcessCleanly() public function responsesCodeProvider() { - return array( + return [ //expected output / getter / code to execute - //array(1,'getExitCode','exit(1);'), - //array(true,'isSuccessful','exit();'), - array('output', 'getOutput', 'echo \'output\';'), - ); + //[1,'getExitCode','exit(1);'], + //[true,'isSuccessful','exit();'], + ['output', 'getOutput', 'echo \'output\';'], + ]; } public function pipesCodeProvider() { - $variations = array( + $variations = [ 'fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);', 'include \''.__DIR__.'/PipeStdinInStdoutStdErrStreamSelect.php\';', - ); + ]; if ('\\' === \DIRECTORY_SEPARATOR) { // Avoid XL buffers on Windows because of https://bugs.php.net/bug.php?id=65650 - $sizes = array(1, 2, 4, 8); + $sizes = [1, 2, 4, 8]; } else { - $sizes = array(1, 16, 64, 1024, 4096); + $sizes = [1, 16, 64, 1024, 4096]; } - $codes = array(); + $codes = []; foreach ($sizes as $size) { foreach ($variations as $code) { - $codes[] = array($code, $size); + $codes[] = [$code, $size]; } } @@ -1221,10 +1215,10 @@ public function testIncrementalOutputDoesNotRequireAnotherCall($stream, $method) public function provideVariousIncrementals() { - return array( - array('php://stdout', 'getIncrementalOutput'), - array('php://stderr', 'getIncrementalErrorOutput'), - ); + return [ + ['php://stdout', 'getIncrementalOutput'], + ['php://stderr', 'getIncrementalErrorOutput'], + ]; } public function testIteratorInput() @@ -1329,32 +1323,32 @@ public function testIteratorOutput() $process = $this->getProcessForCode('fwrite(STDOUT, 123); fwrite(STDERR, 234); flush(); usleep(10000); fwrite(STDOUT, fread(STDIN, 3)); fwrite(STDERR, 456);'); $process->setInput($input); $process->start(); - $output = array(); + $output = []; foreach ($process as $type => $data) { - $output[] = array($type, $data); + $output[] = [$type, $data]; break; } - $expectedOutput = array( - array($process::OUT, '123'), - ); + $expectedOutput = [ + [$process::OUT, '123'], + ]; $this->assertSame($expectedOutput, $output); $input->write(345); foreach ($process as $type => $data) { - $output[] = array($type, $data); + $output[] = [$type, $data]; } $this->assertSame('', $process->getOutput()); $this->assertFalse($process->isRunning()); - $expectedOutput = array( - array($process::OUT, '123'), - array($process::ERR, '234'), - array($process::OUT, '345'), - array($process::ERR, '456'), - ); + $expectedOutput = [ + [$process::OUT, '123'], + [$process::ERR, '234'], + [$process::OUT, '345'], + [$process::ERR, '456'], + ]; $this->assertSame($expectedOutput, $output); } @@ -1365,32 +1359,32 @@ public function testNonBlockingNorClearingIteratorOutput() $process = $this->getProcessForCode('fwrite(STDOUT, fread(STDIN, 3));'); $process->setInput($input); $process->start(); - $output = array(); + $output = []; foreach ($process->getIterator($process::ITER_NON_BLOCKING | $process::ITER_KEEP_OUTPUT) as $type => $data) { - $output[] = array($type, $data); + $output[] = [$type, $data]; break; } - $expectedOutput = array( - array($process::OUT, ''), - ); + $expectedOutput = [ + [$process::OUT, ''], + ]; $this->assertSame($expectedOutput, $output); $input->write(123); foreach ($process->getIterator($process::ITER_NON_BLOCKING | $process::ITER_KEEP_OUTPUT) as $type => $data) { if ('' !== $data) { - $output[] = array($type, $data); + $output[] = [$type, $data]; } } $this->assertSame('123', $process->getOutput()); $this->assertFalse($process->isRunning()); - $expectedOutput = array( - array($process::OUT, ''), - array($process::OUT, '123'), - ); + $expectedOutput = [ + [$process::OUT, ''], + [$process::OUT, '123'], + ]; $this->assertSame($expectedOutput, $output); } @@ -1412,7 +1406,7 @@ public function testChainedProcesses() public function testSetBadEnv() { $process = $this->getProcess('echo hello'); - $process->setEnv(array('bad%%' => '123')); + $process->setEnv(['bad%%' => '123']); $process->inheritEnvironmentVariables(true); $process->run(); @@ -1426,7 +1420,7 @@ public function testEnvBackupDoesNotDeleteExistingVars() putenv('existing_var=foo'); $_ENV['existing_var'] = 'foo'; $process = $this->getProcess('php -r "echo getenv(\'new_test_var\');"'); - $process->setEnv(array('existing_var' => 'bar', 'new_test_var' => 'foo')); + $process->setEnv(['existing_var' => 'bar', 'new_test_var' => 'foo']); $process->inheritEnvironmentVariables(); $process->run(); @@ -1441,14 +1435,14 @@ public function testEnvBackupDoesNotDeleteExistingVars() public function testEnvIsInherited() { - $process = $this->getProcessForCode('echo serialize($_SERVER);', null, array('BAR' => 'BAZ', 'EMPTY' => '')); + $process = $this->getProcessForCode('echo serialize($_SERVER);', null, ['BAR' => 'BAZ', 'EMPTY' => '']); putenv('FOO=BAR'); $_ENV['FOO'] = 'BAR'; $process->run(); - $expected = array('BAR' => 'BAZ', 'EMPTY' => '', 'FOO' => 'BAR'); + $expected = ['BAR' => 'BAZ', 'EMPTY' => '', 'FOO' => 'BAR']; $env = array_intersect_key(unserialize($process->getOutput()), $expected); $this->assertEquals($expected, $env); @@ -1462,7 +1456,7 @@ public function testEnvIsInherited() */ public function testInheritEnvDisabled() { - $process = $this->getProcessForCode('echo serialize($_SERVER);', null, array('BAR' => 'BAZ')); + $process = $this->getProcessForCode('echo serialize($_SERVER);', null, ['BAR' => 'BAZ']); putenv('FOO=BAR'); $_ENV['FOO'] = 'BAR'; @@ -1472,7 +1466,7 @@ public function testInheritEnvDisabled() $process->run(); - $expected = array('BAR' => 'BAZ', 'FOO' => 'BAR'); + $expected = ['BAR' => 'BAZ', 'FOO' => 'BAR']; $env = array_intersect_key(unserialize($process->getOutput()), $expected); unset($expected['FOO']); @@ -1484,7 +1478,7 @@ public function testInheritEnvDisabled() public function testGetCommandLine() { - $p = new Process(array('/usr/bin/php')); + $p = new Process(['/usr/bin/php']); $expected = '\\' === \DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'"; $this->assertSame($expected, $p->getCommandLine()); @@ -1495,10 +1489,10 @@ public function testGetCommandLine() */ public function testEscapeArgument($arg) { - $p = new Process(array(self::$phpBin, '-r', 'echo $argv[1];', $arg)); + $p = new Process([self::$phpBin, '-r', 'echo $argv[1];', $arg]); $p->run(); - $this->assertSame($arg, $p->getOutput()); + $this->assertSame((string) $arg, $p->getOutput()); } /** @@ -1507,11 +1501,11 @@ public function testEscapeArgument($arg) */ public function testEscapeArgumentWhenInheritEnvDisabled($arg) { - $p = new Process(array(self::$phpBin, '-r', 'echo $argv[1];', $arg), null, array('BAR' => 'BAZ')); + $p = new Process([self::$phpBin, '-r', 'echo $argv[1];', $arg], null, ['BAR' => 'BAZ']); $p->inheritEnvironmentVariables(false); $p->run(); - $this->assertSame($arg, $p->getOutput()); + $this->assertSame((string) $arg, $p->getOutput()); } public function testRawCommandLine() @@ -1534,21 +1528,24 @@ public function testRawCommandLine() public function provideEscapeArgument() { - yield array('a"b%c%'); - yield array('a"b^c^'); - yield array("a\nb'c"); - yield array('a^b c!'); - yield array("a!b\tc"); - yield array('a\\\\"\\"'); - yield array('éÉèÈàÀöä'); + yield ['a"b%c%']; + yield ['a"b^c^']; + yield ["a\nb'c"]; + yield ['a^b c!']; + yield ["a!b\tc"]; + yield ['a\\\\"\\"']; + yield ['éÉèÈàÀöä']; + yield [null]; + yield [1]; + yield [1.1]; } public function testEnvArgument() { - $env = array('FOO' => 'Foo', 'BAR' => 'Bar'); + $env = ['FOO' => 'Foo', 'BAR' => 'Bar']; $cmd = '\\' === \DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ'; $p = new Process($cmd, null, $env); - $p->run(null, array('BAR' => 'baR', 'BAZ' => 'baZ')); + $p->run(null, ['BAR' => 'baR', 'BAZ' => 'baZ']); $this->assertSame('Foo baR baZ', rtrim($p->getOutput())); $this->assertSame($env, $p->getEnv()); @@ -1556,9 +1553,9 @@ public function testEnvArgument() /** * @param string $commandline - * @param null|string $cwd - * @param null|array $env - * @param null|string $input + * @param string|null $cwd + * @param array|null $env + * @param string|null $input * @param int $timeout * @param array $options * @@ -1596,7 +1593,7 @@ private function getProcess($commandline, $cwd = null, array $env = null, $input */ private function getProcessForCode($code, $cwd = null, array $env = null, $input = null, $timeout = 60) { - return $this->getProcess(array(self::$phpBin, '-r', $code), $cwd, $env, $input, $timeout); + return $this->getProcess([self::$phpBin, '-r', $code], $cwd, $env, $input, $timeout); } private function skipIfNotEnhancedSigchild($expectException = true) diff --git a/vendor/symfony/process/Tests/ProcessUtilsTest.php b/vendor/symfony/process/Tests/ProcessUtilsTest.php index 0a3ccb5768aa2bd92d3f5ec41616892e6a1458c7..0c2fe94dc1746110af87ea7b242ad04d2d8417dd 100644 --- a/vendor/symfony/process/Tests/ProcessUtilsTest.php +++ b/vendor/symfony/process/Tests/ProcessUtilsTest.php @@ -30,24 +30,24 @@ public function testEscapeArgument($result, $argument) public function dataArguments() { if ('\\' === \DIRECTORY_SEPARATOR) { - return array( - array('"\"php\" \"-v\""', '"php" "-v"'), - array('"foo bar"', 'foo bar'), - array('^%"path"^%', '%path%'), - array('"<|>\\" \\"\'f"', '<|>" "\'f'), - array('""', ''), - array('"with\trailingbs\\\\"', 'with\trailingbs\\'), - ); + return [ + ['"\"php\" \"-v\""', '"php" "-v"'], + ['"foo bar"', 'foo bar'], + ['^%"path"^%', '%path%'], + ['"<|>\\" \\"\'f"', '<|>" "\'f'], + ['""', ''], + ['"with\trailingbs\\\\"', 'with\trailingbs\\'], + ]; } - return array( - array("'\"php\" \"-v\"'", '"php" "-v"'), - array("'foo bar'", 'foo bar'), - array("'%path%'", '%path%'), - array("'<|>\" \"'\\''f'", '<|>" "\'f'), - array("''", ''), - array("'with\\trailingbs\\'", 'with\trailingbs\\'), - array("'withNonAsciiAccentLikeéÉèÈàÀöä'", 'withNonAsciiAccentLikeéÉèÈàÀöä'), - ); + return [ + ["'\"php\" \"-v\"'", '"php" "-v"'], + ["'foo bar'", 'foo bar'], + ["'%path%'", '%path%'], + ["'<|>\" \"'\\''f'", '<|>" "\'f'], + ["''", ''], + ["'with\\trailingbs\\'", 'with\trailingbs\\'], + ["'withNonAsciiAccentLikeéÉèÈàÀöä'", 'withNonAsciiAccentLikeéÉèÈàÀöä'], + ]; } } diff --git a/vendor/symfony/process/phpunit.xml.dist b/vendor/symfony/process/phpunit.xml.dist index d38846730d72b075adf261c0dff03bcceaa2deab..c32f25101efefc33617af9610ab57c544e1fc2d4 100644 --- a/vendor/symfony/process/phpunit.xml.dist +++ b/vendor/symfony/process/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/psr-http-message-bridge/.travis.yml b/vendor/symfony/psr-http-message-bridge/.travis.yml index d9c04e42decdf7b4b512ef489b9791051570da18..6c9646aaa6f2fc298d9b38d130ef999e5606cd65 100644 --- a/vendor/symfony/psr-http-message-bridge/.travis.yml +++ b/vendor/symfony/psr-http-message-bridge/.travis.yml @@ -1,49 +1,69 @@ language: php - sudo: false - cache: directories: - $HOME/.composer/cache/files - $HOME/symfony-bridge/.phpunit +env: + global: + - PHPUNIT_FLAGS="-v" + - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit" + - DEPENDENCIES="zendframework/zend-diactoros:^1.4.1 http-interop/http-factory-diactoros:^1.0" + matrix: + fast_finish: true include: + # Minimum supported dependencies with the latest and oldest PHP version + - php: 7.2 + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors" - php: 5.3 dist: 'precise' - - php: 5.4 - - php: 5.5 - - php: 5.6 + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors" DEPENDENCIES="" + + # Test the latest stable release - php: 5.3 dist: 'precise' - env: COMPOSER_OPTIONS="--prefer-lowest --prefer-stable" SYMFONY_DEPRECATIONS_HELPER=weak + env: DEPENDENCIES="" + - php: 5.4 + env: DEPENDENCIES="zendframework/zend-diactoros:^1.4.1" + - php: 5.5 + env: DEPENDENCIES="zendframework/zend-diactoros:^1.4.1" - php: 5.6 - env: COMPOSER_OPTIONS="" SYMFONY_DEPRECATIONS_HELPER=weak + env: DEPENDENCIES="zendframework/zend-diactoros:^1.4.1" - php: 7.0 - - php: hhvm - allow_failures: - - php: hhvm - fast_finish: true + - php: 7.1 + - php: 7.2 + env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text" -env: - global: - - deps=no - - SYMFONY_DEPRECATIONS_HELPER=strict - - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit" - - COMPOSER_OPTIONS="--prefer-stable" + # Test LTS versions. This makes sure we do not use Symfony packages with version greater + # than 2 or 3 respectively. + - php: 7.2 + env: DEPENDENCIES="$DEPENDENCIES symfony/lts:^2 symfony/force-lowest:~2.8.0" + - php: 7.2 + env: DEPENDENCIES="$DEPENDENCIES symfony/lts:^3 symfony/force-lowest:~3.4.0" + + # Latest commit to master + - php: 7.2 + env: STABILITY="dev" + + allow_failures: + # Dev-master is allowed to fail. + - env: STABILITY="dev" before_install: - - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi; - - composer self-update - - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; - - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi; - # Set the COMPOSER_ROOT_VERSION to the right version according to the branch being built - - if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi; + - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi + - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi; + - if ! [ -v "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi; install: - - if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then composer require --no-update zendframework/zend-diactoros; fi; - - composer update --prefer-source $COMPOSER_OPTIONS - - vendor/bin/simple-phpunit install + # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355 + - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi + - composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction + - ./vendor/bin/simple-phpunit install script: - - vendor/bin/simple-phpunit + - composer validate --strict --no-check-lock + # simple-phpunit is the PHPUnit wrapper provided by the PHPUnit Bridge component and + # it helps with testing legacy code and deprecations (composer require symfony/phpunit-bridge) + - ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS \ No newline at end of file diff --git a/vendor/symfony/psr-http-message-bridge/CHANGELOG b/vendor/symfony/psr-http-message-bridge/CHANGELOG deleted file mode 100644 index cc3e9834eef9d130c21213450eaf078acc921654..0000000000000000000000000000000000000000 --- a/vendor/symfony/psr-http-message-bridge/CHANGELOG +++ /dev/null @@ -1,3 +0,0 @@ -* 1.0.0 (2016-09-14) - - * Initial release diff --git a/vendor/symfony/psr-http-message-bridge/CHANGELOG.md b/vendor/symfony/psr-http-message-bridge/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..70f3b82f998d7359445ad895817ef94d58bc49de --- /dev/null +++ b/vendor/symfony/psr-http-message-bridge/CHANGELOG.md @@ -0,0 +1,18 @@ +CHANGELOG +========= + +* 1.1.0 (2018-08-30) + + * Added support for creating PSR-7 messages using PSR-17 factories + +* 1.0.2 (2017-12-19) + + * Fixed request target in PSR7 Request (mtibben) + +* 1.0.1 (2017-12-04) + + * Added support for Symfony 4 (dunglas) + +* 1.0.0 (2016-09-14) + + * Initial release diff --git a/vendor/symfony/psr-http-message-bridge/Factory/DiactorosFactory.php b/vendor/symfony/psr-http-message-bridge/Factory/DiactorosFactory.php index 0600325373ae3590b05462c838d57f429a96bdb9..0948849c0ae5d8ceaa030e42d2777abaf2c0cd90 100644 --- a/vendor/symfony/psr-http-message-bridge/Factory/DiactorosFactory.php +++ b/vendor/symfony/psr-http-message-bridge/Factory/DiactorosFactory.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\PsrHttpMessage\Factory; +use Psr\Http\Message\UploadedFileInterface; use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface; use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\File\UploadedFile; @@ -42,7 +43,9 @@ public function __construct() */ public function createRequest(Request $symfonyRequest) { - $server = DiactorosRequestFactory::normalizeServer($symfonyRequest->server->all()); + $server = method_exists('Zend\Diactoros\ServerRequestFactory', 'normalizeServer') + ? DiactorosRequestFactory::normalizeServer($symfonyRequest->server->all()) + : \Zend\Diactoros\normalizeServer($symfonyRequest->server->all()); $headers = $symfonyRequest->headers->all(); if (PHP_VERSION_ID < 50600) { @@ -52,9 +55,13 @@ public function createRequest(Request $symfonyRequest) $body = new DiactorosStream($symfonyRequest->getContent(true)); } + $files = method_exists('Zend\Diactoros\ServerRequestFactory', 'normalizeFiles') + ? DiactorosRequestFactory::normalizeFiles($this->getFiles($symfonyRequest->files->all())) + : \Zend\Diactoros\normalizeUploadedFiles($this->getFiles($symfonyRequest->files->all())); + $request = new ServerRequest( $server, - DiactorosRequestFactory::normalizeFiles($this->getFiles($symfonyRequest->files->all())), + $files, $symfonyRequest->getSchemeAndHttpHost().$symfonyRequest->getRequestUri(), $symfonyRequest->getMethod(), $body, @@ -112,7 +119,7 @@ private function createUploadedFile(UploadedFile $symfonyUploadedFile) { return new DiactorosUploadedFile( $symfonyUploadedFile->getRealPath(), - $symfonyUploadedFile->getClientSize(), + (int) $symfonyUploadedFile->getSize(), $symfonyUploadedFile->getError(), $symfonyUploadedFile->getClientOriginalName(), $symfonyUploadedFile->getClientMimeType() @@ -132,7 +139,7 @@ public function createResponse(Response $symfonyResponse) ob_start(function ($buffer) use ($stream) { $stream->write($buffer); - return false; + return ''; }); $symfonyResponse->sendContent(); @@ -143,13 +150,13 @@ public function createResponse(Response $symfonyResponse) } $headers = $symfonyResponse->headers->all(); - - $cookies = $symfonyResponse->headers->getCookies(); - if (!empty($cookies)) { - $headers['Set-Cookie'] = array(); - - foreach ($cookies as $cookie) { - $headers['Set-Cookie'][] = $cookie->__toString(); + if (!isset($headers['Set-Cookie']) && !isset($headers['set-cookie'])) { + $cookies = $symfonyResponse->headers->getCookies(); + if (!empty($cookies)) { + $headers['Set-Cookie'] = array(); + foreach ($cookies as $cookie) { + $headers['Set-Cookie'][] = $cookie->__toString(); + } } } diff --git a/vendor/symfony/psr-http-message-bridge/Factory/HttpFoundationFactory.php b/vendor/symfony/psr-http-message-bridge/Factory/HttpFoundationFactory.php index 76d196bbbeae91a4a1b289bc62eff35c9b558f0a..8bf209dc15ca67666b9dc4e5bf4f26082a0f05e6 100644 --- a/vendor/symfony/psr-http-message-bridge/Factory/HttpFoundationFactory.php +++ b/vendor/symfony/psr-http-message-bridge/Factory/HttpFoundationFactory.php @@ -104,6 +104,17 @@ private function createUploadedFile(UploadedFileInterface $psrUploadedFile) $clientFileName = $psrUploadedFile->getClientFilename(); } + if (class_exists('Symfony\Component\HttpFoundation\HeaderUtils')) { + // Symfony 4.1+ + return new UploadedFile( + $temporaryPath, + null === $clientFileName ? '' : $clientFileName, + $psrUploadedFile->getClientMediaType(), + $psrUploadedFile->getError(), + true + ); + } + return new UploadedFile( $temporaryPath, null === $clientFileName ? '' : $clientFileName, @@ -129,6 +140,9 @@ protected function getTemporaryPath() */ public function createResponse(ResponseInterface $psrResponse) { + $cookies = $psrResponse->getHeader('Set-Cookie'); + $psrResponse = $psrResponse->withHeader('Set-Cookie', array()); + $response = new Response( $psrResponse->getBody()->__toString(), $psrResponse->getStatusCode(), @@ -136,7 +150,7 @@ public function createResponse(ResponseInterface $psrResponse) ); $response->setProtocolVersion($psrResponse->getProtocolVersion()); - foreach ($psrResponse->getHeader('Set-Cookie') as $cookie) { + foreach ($cookies as $cookie) { $response->headers->setCookie($this->createCookie($cookie)); } @@ -199,6 +213,12 @@ private function createCookie($cookie) continue; } + + if ('samesite' === strtolower($name) && null !== $value) { + $samesite = $value; + + continue; + } } if (!isset($cookieName)) { @@ -212,7 +232,9 @@ private function createCookie($cookie) isset($cookiePath) ? $cookiePath : '/', isset($cookieDomain) ? $cookieDomain : null, isset($cookieSecure), - isset($cookieHttpOnly) + isset($cookieHttpOnly), + false, + isset($samesite) ? $samesite : null ); } } diff --git a/vendor/symfony/psr-http-message-bridge/Factory/PsrHttpFactory.php b/vendor/symfony/psr-http-message-bridge/Factory/PsrHttpFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..c4c48a12c6178c0865d8bc916aa16ea681245653 --- /dev/null +++ b/vendor/symfony/psr-http-message-bridge/Factory/PsrHttpFactory.php @@ -0,0 +1,177 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\PsrHttpMessage\Factory; + +use Psr\Http\Message\ResponseFactoryInterface; +use Psr\Http\Message\ServerRequestFactoryInterface; +use Psr\Http\Message\StreamFactoryInterface; +use Psr\Http\Message\UploadedFileFactoryInterface; +use Psr\Http\Message\UploadedFileInterface; +use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface; +use Symfony\Component\HttpFoundation\BinaryFileResponse; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\StreamedResponse; + +/** + * Builds Psr\HttpMessage instances using a PSR-17 implementation. + * + * @author Antonio J. García Lagar <aj@garcialagar.es> + */ +class PsrHttpFactory implements HttpMessageFactoryInterface +{ + private $serverRequestFactory; + private $streamFactory; + private $uploadedFileFactory; + private $responseFactory; + + public function __construct(ServerRequestFactoryInterface $serverRequestFactory, StreamFactoryInterface $streamFactory, UploadedFileFactoryInterface $uploadedFileFactory, ResponseFactoryInterface $responseFactory) + { + $this->serverRequestFactory = $serverRequestFactory; + $this->streamFactory = $streamFactory; + $this->uploadedFileFactory = $uploadedFileFactory; + $this->responseFactory = $responseFactory; + } + + /** + * {@inheritdoc} + */ + public function createRequest(Request $symfonyRequest) + { + $request = $this->serverRequestFactory->createServerRequest( + $symfonyRequest->getMethod(), + $symfonyRequest->getSchemeAndHttpHost().$symfonyRequest->getRequestUri(), + $symfonyRequest->server->all() + ); + + foreach ($symfonyRequest->headers->all() as $name => $value) { + $request = $request->withHeader($name, $value); + } + + if (PHP_VERSION_ID < 50600) { + $body = $this->streamFactory->createStreamFromFile('php://temp', 'wb+'); + $body->write($symfonyRequest->getContent()); + } else { + $body = $this->streamFactory->createStreamFromResource($symfonyRequest->getContent(true)); + } + + $request = $request + ->withBody($body) + ->withUploadedFiles($this->getFiles($symfonyRequest->files->all())) + ->withCookieParams($symfonyRequest->cookies->all()) + ->withQueryParams($symfonyRequest->query->all()) + ->withParsedBody($symfonyRequest->request->all()) + ; + + foreach ($symfonyRequest->attributes->all() as $key => $value) { + $request = $request->withAttribute($key, $value); + } + + return $request; + } + + /** + * Converts Symfony uploaded files array to the PSR one. + * + * @param array $uploadedFiles + * + * @return array + */ + private function getFiles(array $uploadedFiles) + { + $files = array(); + + foreach ($uploadedFiles as $key => $value) { + if (null === $value) { + $files[$key] = $this->uploadedFileFactory->createUploadedFile($this->streamFactory->createStream(), 0, UPLOAD_ERR_NO_FILE); + continue; + } + if ($value instanceof UploadedFile) { + $files[$key] = $this->createUploadedFile($value); + } else { + $files[$key] = $this->getFiles($value); + } + } + + return $files; + } + + /** + * Creates a PSR-7 UploadedFile instance from a Symfony one. + * + * @param UploadedFile $symfonyUploadedFile + * + * @return UploadedFileInterface + */ + private function createUploadedFile(UploadedFile $symfonyUploadedFile) + { + return $this->uploadedFileFactory->createUploadedFile( + $this->streamFactory->createStreamFromFile( + $symfonyUploadedFile->getRealPath() + ), + (int) $symfonyUploadedFile->getSize(), + $symfonyUploadedFile->getError(), + $symfonyUploadedFile->getClientOriginalName(), + $symfonyUploadedFile->getClientMimeType() + ); + } + + /** + * {@inheritdoc} + */ + public function createResponse(Response $symfonyResponse) + { + $response = $this->responseFactory->createResponse($symfonyResponse->getStatusCode()); + + if ($symfonyResponse instanceof BinaryFileResponse) { + $stream = $this->streamFactory->createStreamFromFile( + $symfonyResponse->getFile()->getPathname() + ); + } else { + $stream = $this->streamFactory->createStreamFromFile('php://temp', 'wb+'); + if ($symfonyResponse instanceof StreamedResponse) { + ob_start(function ($buffer) use ($stream) { + $stream->write($buffer); + + return ''; + }); + + $symfonyResponse->sendContent(); + ob_end_clean(); + } else { + $stream->write($symfonyResponse->getContent()); + } + } + + $response = $response->withBody($stream); + + $headers = $symfonyResponse->headers->all(); + $cookies = $symfonyResponse->headers->getCookies(); + if (!empty($cookies)) { + $headers['Set-Cookie'] = array(); + + foreach ($cookies as $cookie) { + $headers['Set-Cookie'][] = $cookie->__toString(); + } + } + + foreach ($headers as $name => $value) { + $response = $response->withHeader($name, $value); + } + + $protocolVersion = $symfonyResponse->getProtocolVersion(); + $response = $response->withProtocolVersion($protocolVersion); + + return $response; + } +} diff --git a/vendor/symfony/psr-http-message-bridge/Tests/Factory/AbstractHttpMessageFactoryTest.php b/vendor/symfony/psr-http-message-bridge/Tests/Factory/AbstractHttpMessageFactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5855c7a4571ac0954f69d3fbbe5a12eadb39054c --- /dev/null +++ b/vendor/symfony/psr-http-message-bridge/Tests/Factory/AbstractHttpMessageFactoryTest.php @@ -0,0 +1,224 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory; + +use PHPUnit\Framework\TestCase; +use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface; +use Symfony\Component\HttpFoundation\BinaryFileResponse; +use Symfony\Component\HttpFoundation\Cookie; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\StreamedResponse; + +/** + * @author Kévin Dunglas <dunglas@gmail.com> + * @author Antonio J. García Lagar <aj@garcialagar.es> + */ +abstract class AbstractHttpMessageFactoryTest extends TestCase +{ + private $factory; + private $tmpDir; + + /** + * @return HttpMessageFactoryInterface + */ + abstract protected function buildHttpMessageFactory(); + + public function setup() + { + $this->factory = $this->buildHttpMessageFactory(); + $this->tmpDir = sys_get_temp_dir(); + } + + public function testCreateRequest() + { + $stdClass = new \stdClass(); + $request = new Request( + array( + 'foo' => '1', + 'bar' => array('baz' => '42'), + ), + array( + 'twitter' => array( + '@dunglas' => 'Kévin Dunglas', + '@coopTilleuls' => 'Les-Tilleuls.coop', + ), + 'baz' => '2', + ), + array( + 'a1' => $stdClass, + 'a2' => array('foo' => 'bar'), + ), + array( + 'c1' => 'foo', + 'c2' => array('c3' => 'bar'), + ), + array( + 'f1' => $this->createUploadedFile('F1', 'f1.txt', 'text/plain', UPLOAD_ERR_OK), + 'foo' => array('f2' => $this->createUploadedFile('F2', 'f2.txt', 'text/plain', UPLOAD_ERR_OK)), + ), + array( + 'REQUEST_METHOD' => 'POST', + 'HTTP_HOST' => 'dunglas.fr', + 'HTTP_X_SYMFONY' => '2.8', + 'REQUEST_URI' => '/testCreateRequest?foo=1&bar[baz]=42', + 'QUERY_STRING' => 'foo=1&bar[baz]=42', + ), + 'Content' + ); + + $psrRequest = $this->factory->createRequest($request); + + $this->assertEquals('Content', $psrRequest->getBody()->__toString()); + + $queryParams = $psrRequest->getQueryParams(); + $this->assertEquals('1', $queryParams['foo']); + $this->assertEquals('42', $queryParams['bar']['baz']); + + $requestTarget = $psrRequest->getRequestTarget(); + $this->assertEquals('/testCreateRequest?foo=1&bar[baz]=42', urldecode($requestTarget)); + + $parsedBody = $psrRequest->getParsedBody(); + $this->assertEquals('Kévin Dunglas', $parsedBody['twitter']['@dunglas']); + $this->assertEquals('Les-Tilleuls.coop', $parsedBody['twitter']['@coopTilleuls']); + $this->assertEquals('2', $parsedBody['baz']); + + $attributes = $psrRequest->getAttributes(); + $this->assertEquals($stdClass, $attributes['a1']); + $this->assertEquals('bar', $attributes['a2']['foo']); + + $cookies = $psrRequest->getCookieParams(); + $this->assertEquals('foo', $cookies['c1']); + $this->assertEquals('bar', $cookies['c2']['c3']); + + $uploadedFiles = $psrRequest->getUploadedFiles(); + $this->assertEquals('F1', $uploadedFiles['f1']->getStream()->__toString()); + $this->assertEquals('f1.txt', $uploadedFiles['f1']->getClientFilename()); + $this->assertEquals('text/plain', $uploadedFiles['f1']->getClientMediaType()); + $this->assertEquals(UPLOAD_ERR_OK, $uploadedFiles['f1']->getError()); + + $this->assertEquals('F2', $uploadedFiles['foo']['f2']->getStream()->__toString()); + $this->assertEquals('f2.txt', $uploadedFiles['foo']['f2']->getClientFilename()); + $this->assertEquals('text/plain', $uploadedFiles['foo']['f2']->getClientMediaType()); + $this->assertEquals(UPLOAD_ERR_OK, $uploadedFiles['foo']['f2']->getError()); + + $serverParams = $psrRequest->getServerParams(); + $this->assertEquals('POST', $serverParams['REQUEST_METHOD']); + $this->assertEquals('2.8', $serverParams['HTTP_X_SYMFONY']); + $this->assertEquals('POST', $psrRequest->getMethod()); + $this->assertEquals(array('2.8'), $psrRequest->getHeader('X-Symfony')); + } + + public function testGetContentCanBeCalledAfterRequestCreation() + { + $header = array('HTTP_HOST' => 'dunglas.fr'); + $request = new Request(array(), array(), array(), array(), array(), $header, 'Content'); + + $psrRequest = $this->factory->createRequest($request); + + $this->assertEquals('Content', $psrRequest->getBody()->__toString()); + $this->assertEquals('Content', $request->getContent()); + } + + private function createUploadedFile($content, $originalName, $mimeType, $error) + { + $path = tempnam($this->tmpDir, uniqid()); + file_put_contents($path, $content); + + if (class_exists('Symfony\Component\HttpFoundation\HeaderUtils')) { + // Symfony 4.1+ + return new UploadedFile($path, $originalName, $mimeType, $error, true); + } + return new UploadedFile($path, $originalName, $mimeType, filesize($path), $error, true); + } + + public function testCreateResponse() + { + $response = new Response( + 'Response content.', + 202, + array('X-Symfony' => array('3.4')) + ); + $response->headers->setCookie(new Cookie('city', 'Lille', new \DateTime('Wed, 13 Jan 2021 22:23:01 GMT'), '/', null, false, true, false, '')); + + $psrResponse = $this->factory->createResponse($response); + $this->assertEquals('Response content.', $psrResponse->getBody()->__toString()); + $this->assertEquals(202, $psrResponse->getStatusCode()); + $this->assertEquals(array('3.4'), $psrResponse->getHeader('X-Symfony')); + + $cookieHeader = $psrResponse->getHeader('Set-Cookie'); + $this->assertInternalType('array', $cookieHeader); + $this->assertCount(1, $cookieHeader); + $this->assertRegExp('{city=Lille; expires=Wed, 13-Jan-2021 22:23:01 GMT;( max-age=\d+;)? path=/; httponly}i', $cookieHeader[0]); + } + + public function testCreateResponseFromStreamed() + { + $response = new StreamedResponse(function () { + echo "Line 1\n"; + flush(); + + echo "Line 2\n"; + flush(); + }); + + $psrResponse = $this->factory->createResponse($response); + + $this->assertEquals("Line 1\nLine 2\n", $psrResponse->getBody()->__toString()); + } + + public function testCreateResponseFromBinaryFile() + { + $path = tempnam($this->tmpDir, uniqid()); + file_put_contents($path, 'Binary'); + + $response = new BinaryFileResponse($path); + + $psrResponse = $this->factory->createResponse($response); + + $this->assertEquals('Binary', $psrResponse->getBody()->__toString()); + } + + public function testUploadErrNoFile() + { + if (class_exists('Symfony\Component\HttpFoundation\HeaderUtils')) { + // Symfony 4.1+ + $file = new UploadedFile('', '', null, UPLOAD_ERR_NO_FILE, true); + } else { + $file = new UploadedFile('', '', null, 0, UPLOAD_ERR_NO_FILE, true); + } + $this->assertEquals(0, $file->getSize()); + $this->assertEquals(UPLOAD_ERR_NO_FILE, $file->getError()); + $this->assertFalse($file->getSize(), 'SplFile::getSize() returns false on error'); + + $request = new Request(array(), array(), array(), array(), + array( + 'f1' => $file, + 'f2' => array('name' => null, 'type' => null, 'tmp_name' => null, 'error' => UPLOAD_ERR_NO_FILE, 'size' => 0), + ), + array( + 'REQUEST_METHOD' => 'POST', + 'HTTP_HOST' => 'dunglas.fr', + 'HTTP_X_SYMFONY' => '2.8', + ), + 'Content' + ); + + $psrRequest = $this->factory->createRequest($request); + + $uploadedFiles = $psrRequest->getUploadedFiles(); + + $this->assertEquals(UPLOAD_ERR_NO_FILE, $uploadedFiles['f1']->getError()); + $this->assertEquals(UPLOAD_ERR_NO_FILE, $uploadedFiles['f2']->getError()); + } +} diff --git a/vendor/symfony/psr-http-message-bridge/Tests/Factory/DiactorosFactoryTest.php b/vendor/symfony/psr-http-message-bridge/Tests/Factory/DiactorosFactoryTest.php index 869fd3203dc26c750a15ae021ddf42a5a9251c7a..08d37bdeaa3d10ae33e5ff95df8c08adc0fe527e 100644 --- a/vendor/symfony/psr-http-message-bridge/Tests/Factory/DiactorosFactoryTest.php +++ b/vendor/symfony/psr-http-message-bridge/Tests/Factory/DiactorosFactoryTest.php @@ -11,204 +11,20 @@ namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory; -use PHPUnit\Framework\TestCase; use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory; -use Symfony\Component\HttpFoundation\BinaryFileResponse; -use Symfony\Component\HttpFoundation\Cookie; -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\StreamedResponse; /** * @author Kévin Dunglas <dunglas@gmail.com> + * @author Antonio J. García Lagar <aj@garcialagar.es> */ -class DiactorosFactoryTest extends TestCase +class DiactorosFactoryTest extends AbstractHttpMessageFactoryTest { - private $factory; - private $tmpDir; - - public function setup() + protected function buildHttpMessageFactory() { if (!class_exists('Zend\Diactoros\ServerRequestFactory')) { $this->markTestSkipped('Zend Diactoros is not installed.'); } - $this->factory = new DiactorosFactory(); - $this->tmpDir = sys_get_temp_dir(); - } - - public function testCreateRequest() - { - $stdClass = new \stdClass(); - $request = new Request( - array( - 'foo' => '1', - 'bar' => array('baz' => '42'), - ), - array( - 'twitter' => array( - '@dunglas' => 'Kévin Dunglas', - '@coopTilleuls' => 'Les-Tilleuls.coop', - ), - 'baz' => '2', - ), - array( - 'a1' => $stdClass, - 'a2' => array('foo' => 'bar'), - ), - array( - 'c1' => 'foo', - 'c2' => array('c3' => 'bar'), - ), - array( - 'f1' => $this->createUploadedFile('F1', 'f1.txt', 'text/plain', UPLOAD_ERR_OK), - 'foo' => array('f2' => $this->createUploadedFile('F2', 'f2.txt', 'text/plain', UPLOAD_ERR_OK)), - ), - array( - 'REQUEST_METHOD' => 'POST', - 'HTTP_HOST' => 'dunglas.fr', - 'HTTP_X_SYMFONY' => '2.8', - 'REQUEST_URI' => '/testCreateRequest?foo=1&bar[baz]=42', - 'QUERY_STRING' => 'foo=1&bar[baz]=42', - ), - 'Content' - ); - - $psrRequest = $this->factory->createRequest($request); - - $this->assertEquals('Content', $psrRequest->getBody()->__toString()); - - $queryParams = $psrRequest->getQueryParams(); - $this->assertEquals('1', $queryParams['foo']); - $this->assertEquals('42', $queryParams['bar']['baz']); - - $requestTarget = $psrRequest->getRequestTarget(); - $this->assertEquals('/testCreateRequest?foo=1&bar[baz]=42', $requestTarget); - - $parsedBody = $psrRequest->getParsedBody(); - $this->assertEquals('Kévin Dunglas', $parsedBody['twitter']['@dunglas']); - $this->assertEquals('Les-Tilleuls.coop', $parsedBody['twitter']['@coopTilleuls']); - $this->assertEquals('2', $parsedBody['baz']); - - $attributes = $psrRequest->getAttributes(); - $this->assertEquals($stdClass, $attributes['a1']); - $this->assertEquals('bar', $attributes['a2']['foo']); - - $cookies = $psrRequest->getCookieParams(); - $this->assertEquals('foo', $cookies['c1']); - $this->assertEquals('bar', $cookies['c2']['c3']); - - $uploadedFiles = $psrRequest->getUploadedFiles(); - $this->assertEquals('F1', $uploadedFiles['f1']->getStream()->__toString()); - $this->assertEquals('f1.txt', $uploadedFiles['f1']->getClientFilename()); - $this->assertEquals('text/plain', $uploadedFiles['f1']->getClientMediaType()); - $this->assertEquals(UPLOAD_ERR_OK, $uploadedFiles['f1']->getError()); - - $this->assertEquals('F2', $uploadedFiles['foo']['f2']->getStream()->__toString()); - $this->assertEquals('f2.txt', $uploadedFiles['foo']['f2']->getClientFilename()); - $this->assertEquals('text/plain', $uploadedFiles['foo']['f2']->getClientMediaType()); - $this->assertEquals(UPLOAD_ERR_OK, $uploadedFiles['foo']['f2']->getError()); - - $serverParams = $psrRequest->getServerParams(); - $this->assertEquals('POST', $serverParams['REQUEST_METHOD']); - $this->assertEquals('2.8', $serverParams['HTTP_X_SYMFONY']); - $this->assertEquals('POST', $psrRequest->getMethod()); - $this->assertEquals(array('2.8'), $psrRequest->getHeader('X-Symfony')); - } - - public function testGetContentCanBeCalledAfterRequestCreation() - { - $header = array('HTTP_HOST' => 'dunglas.fr'); - $request = new Request(array(), array(), array(), array(), array(), $header, 'Content'); - - $psrRequest = $this->factory->createRequest($request); - - $this->assertEquals('Content', $psrRequest->getBody()->__toString()); - $this->assertEquals('Content', $request->getContent()); - } - - private function createUploadedFile($content, $originalName, $mimeType, $error) - { - $path = tempnam($this->tmpDir, uniqid()); - file_put_contents($path, $content); - - return new UploadedFile($path, $originalName, $mimeType, filesize($path), $error, true); - } - - public function testCreateResponse() - { - $response = new Response( - 'Response content.', - 202, - array('X-Symfony' => array('2.8')) - ); - $response->headers->setCookie(new Cookie('city', 'Lille', new \DateTime('Wed, 13 Jan 2021 22:23:01 GMT'))); - - $psrResponse = $this->factory->createResponse($response); - $this->assertEquals('Response content.', $psrResponse->getBody()->__toString()); - $this->assertEquals(202, $psrResponse->getStatusCode()); - $this->assertEquals(array('2.8'), $psrResponse->getHeader('X-Symfony')); - - $cookieHeader = $psrResponse->getHeader('Set-Cookie'); - $this->assertInternalType('array', $cookieHeader); - $this->assertCount(1, $cookieHeader); - $this->assertRegExp('{city=Lille; expires=Wed, 13-Jan-2021 22:23:01 GMT;( max-age=\d+;)? path=/; httponly}', $cookieHeader[0]); - } - - public function testCreateResponseFromStreamed() - { - $response = new StreamedResponse(function () { - echo "Line 1\n"; - flush(); - - echo "Line 2\n"; - flush(); - }); - - $psrResponse = $this->factory->createResponse($response); - - $this->assertEquals("Line 1\nLine 2\n", $psrResponse->getBody()->__toString()); - } - - public function testCreateResponseFromBinaryFile() - { - $path = tempnam($this->tmpDir, uniqid()); - file_put_contents($path, 'Binary'); - - $response = new BinaryFileResponse($path); - - $psrResponse = $this->factory->createResponse($response); - - $this->assertEquals('Binary', $psrResponse->getBody()->__toString()); - } - - public function testUploadErrNoFile() - { - $file = new UploadedFile('', '', null, 0, UPLOAD_ERR_NO_FILE, true); - $this->assertEquals(0, $file->getSize()); - $this->assertEquals(UPLOAD_ERR_NO_FILE, $file->getError()); - $this->assertFalse($file->getSize(), 'SplFile::getSize() returns false on error'); - $this->assertInternalType('integer', $file->getClientSize()); - - $request = new Request(array(), array(), array(), array(), - array( - 'f1' => $file, - 'f2' => array('name' => null, 'type' => null, 'tmp_name' => null, 'error' => UPLOAD_ERR_NO_FILE, 'size' => 0), - ), - array( - 'REQUEST_METHOD' => 'POST', - 'HTTP_HOST' => 'dunglas.fr', - 'HTTP_X_SYMFONY' => '2.8', - ), - 'Content' - ); - - $psrRequest = $this->factory->createRequest($request); - - $uploadedFiles = $psrRequest->getUploadedFiles(); - - $this->assertEquals(UPLOAD_ERR_NO_FILE, $uploadedFiles['f1']->getError()); - $this->assertEquals(UPLOAD_ERR_NO_FILE, $uploadedFiles['f2']->getError()); + return new DiactorosFactory(); } } diff --git a/vendor/symfony/psr-http-message-bridge/Tests/Factory/HttpFoundationFactoryTest.php b/vendor/symfony/psr-http-message-bridge/Tests/Factory/HttpFoundationFactoryTest.php index 8790a20bb8abcf477ffb646ae1fd1d67ea120be7..8daa25693c516b466f9c9b8556df4fad9938de47 100644 --- a/vendor/symfony/psr-http-message-bridge/Tests/Factory/HttpFoundationFactoryTest.php +++ b/vendor/symfony/psr-http-message-bridge/Tests/Factory/HttpFoundationFactoryTest.php @@ -19,6 +19,7 @@ use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Stream; use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\UploadedFile; use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Uri; +use Symfony\Component\HttpFoundation\Cookie; /** * @author Kévin Dunglas <dunglas@gmail.com> @@ -146,11 +147,12 @@ public function testCreateUploadedFile() { $uploadedFile = $this->createUploadedFile('An uploaded file.', UPLOAD_ERR_OK, 'myfile.txt', 'text/plain'); $symfonyUploadedFile = $this->callCreateUploadedFile($uploadedFile); + $size = $symfonyUploadedFile->getSize(); $uniqid = uniqid(); $symfonyUploadedFile->move($this->tmpDir, $uniqid); - $this->assertEquals($uploadedFile->getSize(), $symfonyUploadedFile->getClientSize()); + $this->assertEquals($uploadedFile->getSize(), $size); $this->assertEquals(UPLOAD_ERR_OK, $symfonyUploadedFile->getError()); $this->assertEquals('myfile.txt', $symfonyUploadedFile->getClientOriginalName()); $this->assertEquals('txt', $symfonyUploadedFile->getClientOriginalExtension()); @@ -198,7 +200,7 @@ public function testCreateResponse() 'Set-Cookie' => array( 'theme=light', 'test', - 'ABC=AeD; Domain=dunglas.fr; Path=/kevin; Expires=Wed, 13 Jan 2021 22:23:01 GMT; Secure; HttpOnly', + 'ABC=AeD; Domain=dunglas.fr; Path=/kevin; Expires=Wed, 13 Jan 2021 22:23:01 GMT; Secure; HttpOnly; SameSite=Strict', ), ), new Stream('The response body'), @@ -229,6 +231,9 @@ public function testCreateResponse() $this->assertEquals('/kevin', $cookies[2]->getPath()); $this->assertTrue($cookies[2]->isSecure()); $this->assertTrue($cookies[2]->isHttpOnly()); + if (defined('Symfony\Component\HttpFoundation\Cookie::SAMESITE_STRICT')) { + $this->assertEquals(Cookie::SAMESITE_STRICT, $cookies[2]->getSameSite()); + } $this->assertEquals('The response body', $symfonyResponse->getContent()); $this->assertEquals(200, $symfonyResponse->getStatusCode()); diff --git a/vendor/symfony/psr-http-message-bridge/Tests/Factory/PsrHttpFactoryTest.php b/vendor/symfony/psr-http-message-bridge/Tests/Factory/PsrHttpFactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..da12ea7bd971113f7c40c893429c0ec37fd49003 --- /dev/null +++ b/vendor/symfony/psr-http-message-bridge/Tests/Factory/PsrHttpFactoryTest.php @@ -0,0 +1,29 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\PsrHttpMessage\Tests\Factory; + +use Nyholm\Psr7\Factory\Psr17Factory; +use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory; + +/** + * @author Kévin Dunglas <dunglas@gmail.com> + * @author Antonio J. García Lagar <aj@garcialagar.es> + */ +class PsrHttpFactoryTest extends AbstractHttpMessageFactoryTest +{ + protected function buildHttpMessageFactory() + { + $factory = new Psr17Factory(); + + return new PsrHttpFactory($factory, $factory, $factory, $factory); + } +} diff --git a/vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Message.php b/vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Message.php index 5cd0999413374356a3109f064c7ead7b0c0ea493..43ac394e850a3c2df1d209f1e4a3ea00bc8bcdd7 100644 --- a/vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Message.php +++ b/vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Message.php @@ -64,7 +64,9 @@ public function getHeaderLine($name) public function withHeader($name, $value) { - throw new \BadMethodCallException('Not implemented.'); + $this->headers[$name] = (array) $value; + + return $this; } public function withAddedHeader($name, $value) diff --git a/vendor/symfony/psr-http-message-bridge/composer.json b/vendor/symfony/psr-http-message-bridge/composer.json index 76513b1d6e5356d497330ac4f2fc5f11906eb78a..692f858a67ad157a412f597c3cbee5d336d193c3 100644 --- a/vendor/symfony/psr-http-message-bridge/composer.json +++ b/vendor/symfony/psr-http-message-bridge/composer.json @@ -2,7 +2,7 @@ "name": "symfony/psr-http-message-bridge", "type": "symfony-bridge", "description": "PSR HTTP message bridge", - "keywords": ["http", "psr-7", "http-message"], + "keywords": ["http", "psr-7", "psr-17", "http-message"], "homepage": "http://symfony.com", "license": "MIT", "authors": [ @@ -16,24 +16,26 @@ } ], "require": { - "php": ">=5.3.3", - "psr/http-message": "~1.0", - "symfony/http-foundation": "~2.3|~3.0|~4.0" + "php": "^5.3.3 || ^7.0", + "psr/http-message": "^1.0", + "symfony/http-foundation": "^2.3.42 || ^3.4 || ^4.0" }, "require-dev": { - "symfony/phpunit-bridge": "~3.2|4.0" + "symfony/phpunit-bridge": "^3.4 || ^4.0", + "nyholm/psr7": "^1.1" }, "suggest": { - "psr/http-message-implementation": "To use the HttpFoundation factory", - "zendframework/zend-diactoros": "To use the Zend Diactoros factory" + "nyholm/psr7": "For a super lightweight PSR-7/17 implementation" }, "autoload": { - "psr-4": { "Symfony\\Bridge\\PsrHttpMessage\\": "" } + "psr-4": { "Symfony\\Bridge\\PsrHttpMessage\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, - "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.1-dev" } } } diff --git a/vendor/symfony/routing/Annotation/Route.php b/vendor/symfony/routing/Annotation/Route.php index da47cea4e09dfe8225a43d0c64456f0299ba5c10..338ba512dfe479d8a72a88e74d918ae6b428a8e9 100644 --- a/vendor/symfony/routing/Annotation/Route.php +++ b/vendor/symfony/routing/Annotation/Route.php @@ -23,12 +23,12 @@ class Route { private $path; private $name; - private $requirements = array(); - private $options = array(); - private $defaults = array(); + private $requirements = []; + private $options = []; + private $defaults = []; private $host; - private $methods = array(); - private $schemes = array(); + private $methods = []; + private $schemes = []; private $condition; /** @@ -114,7 +114,7 @@ public function getDefaults() public function setSchemes($schemes) { - $this->schemes = \is_array($schemes) ? $schemes : array($schemes); + $this->schemes = \is_array($schemes) ? $schemes : [$schemes]; } public function getSchemes() @@ -124,7 +124,7 @@ public function getSchemes() public function setMethods($methods) { - $this->methods = \is_array($methods) ? $methods : array($methods); + $this->methods = \is_array($methods) ? $methods : [$methods]; } public function getMethods() diff --git a/vendor/symfony/routing/CHANGELOG.md b/vendor/symfony/routing/CHANGELOG.md index e278f8b1e593688f4e7a5b5e546c69bb90b03b3e..3d34c1d1677c1deba7dbff3d6536ca6bbd3cbbdb 100644 --- a/vendor/symfony/routing/CHANGELOG.md +++ b/vendor/symfony/routing/CHANGELOG.md @@ -41,7 +41,7 @@ CHANGELOG Before: ```php - $router->generate('blog_show', array('slug' => 'my-blog-post'), true); + $router->generate('blog_show', ['slug' => 'my-blog-post'], true); ``` After: @@ -49,7 +49,7 @@ CHANGELOG ```php use Symfony\Component\Routing\Generator\UrlGeneratorInterface; - $router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL); + $router->generate('blog_show', ['slug' => 'my-blog-post'], UrlGeneratorInterface::ABSOLUTE_URL); ``` 2.5.0 @@ -114,7 +114,7 @@ CHANGELOG ```php $route = new Route(); $route->setPath('/article/{id}'); - $route->setMethods(array('POST', 'PUT')); + $route->setMethods(['POST', 'PUT']); $route->setSchemes('https'); ``` @@ -169,10 +169,10 @@ CHANGELOG used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options` will still work, but have been deprecated. The `addPrefix` method should be used for this use-case instead. - Before: `$parentCollection->addCollection($collection, '/prefix', array(...), array(...))` + Before: `$parentCollection->addCollection($collection, '/prefix', [...], [...])` After: ```php - $collection->addPrefix('/prefix', array(...), array(...)); + $collection->addPrefix('/prefix', [...], [...]); $parentCollection->addCollection($collection); ``` * added support for the method default argument values when defining a @Route @@ -197,7 +197,7 @@ CHANGELOG (only relevant if you implemented your own RouteCompiler). * Added possibility to generate relative paths and network paths in the UrlGenerator, e.g. "../parent-file" and "//example.com/dir/file". The third parameter in - `UrlGeneratorInterface::generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)` + `UrlGeneratorInterface::generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH)` now accepts more values and you should use the constants defined in `UrlGeneratorInterface` for claritiy. The old method calls with a Boolean parameter will continue to work because they equal the signature using the constants. diff --git a/vendor/symfony/routing/CompiledRoute.php b/vendor/symfony/routing/CompiledRoute.php index 8ecf5153ce2f73d2a368d6a9ac19df889c7dc7a7..23acc5276e5e45334d56c361bd72244c5e9b94c8 100644 --- a/vendor/symfony/routing/CompiledRoute.php +++ b/vendor/symfony/routing/CompiledRoute.php @@ -37,7 +37,7 @@ class CompiledRoute implements \Serializable * @param array $hostVariables An array of host variables * @param array $variables An array of variables (variables defined in the path and in the host patterns) */ - public function __construct($staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = null, array $hostTokens = array(), array $hostVariables = array(), array $variables = array()) + public function __construct($staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = null, array $hostTokens = [], array $hostVariables = [], array $variables = []) { $this->staticPrefix = (string) $staticPrefix; $this->regex = $regex; @@ -54,7 +54,7 @@ public function __construct($staticPrefix, $regex, array $tokens, array $pathVar */ public function serialize() { - return serialize(array( + return serialize([ 'vars' => $this->variables, 'path_prefix' => $this->staticPrefix, 'path_regex' => $this->regex, @@ -63,7 +63,7 @@ public function serialize() 'host_regex' => $this->hostRegex, 'host_tokens' => $this->hostTokens, 'host_vars' => $this->hostVariables, - )); + ]); } /** @@ -72,7 +72,7 @@ public function serialize() public function unserialize($serialized) { if (\PHP_VERSION_ID >= 70000) { - $data = unserialize($serialized, array('allowed_classes' => false)); + $data = unserialize($serialized, ['allowed_classes' => false]); } else { $data = unserialize($serialized); } diff --git a/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php b/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php index 6e858104cf07dc581d0a2f4f4d6e2aed56e4b7ce..5bdbfb8214d5f787269b8c4865f8aa0e1e905c9a 100644 --- a/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php +++ b/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php @@ -43,7 +43,7 @@ public function process(ContainerBuilder $container) $definition = $container->getDefinition($this->resolverServiceId); foreach ($this->findAndSortTaggedServices($this->loaderTag, $container) as $id) { - $definition->addMethodCall('addLoader', array(new Reference($id))); + $definition->addMethodCall('addLoader', [new Reference($id)]); } } } diff --git a/vendor/symfony/routing/Exception/MethodNotAllowedException.php b/vendor/symfony/routing/Exception/MethodNotAllowedException.php index 712412fecec589af8d009dd32e88e672dd879bed..cf108354a68e8961335afe4f5ca0588b851a20b0 100644 --- a/vendor/symfony/routing/Exception/MethodNotAllowedException.php +++ b/vendor/symfony/routing/Exception/MethodNotAllowedException.php @@ -20,7 +20,7 @@ */ class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface { - protected $allowedMethods = array(); + protected $allowedMethods = []; public function __construct(array $allowedMethods, $message = null, $code = 0, \Exception $previous = null) { diff --git a/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php b/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php index fed34723927735b7ef9a3b902807dd71defdb830..096519aa1a72f1a7db90ce97e11463c1bf386515 100644 --- a/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php +++ b/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php @@ -28,7 +28,7 @@ interface GeneratorDumperInterface * * @return string Executable code */ - public function dump(array $options = array()); + public function dump(array $options = []); /** * Gets the routes to dump. diff --git a/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php b/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php index 60bdf1da3522c19ab982401e59cf5f54f63cc64e..2e99c81d9cc06c67b5a94fff61fb7bb54075f2d4 100644 --- a/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php +++ b/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php @@ -31,12 +31,12 @@ class PhpGeneratorDumper extends GeneratorDumper * * @return string A PHP class representing the generator class */ - public function dump(array $options = array()) + public function dump(array $options = []) { - $options = array_merge(array( + $options = array_merge([ 'class' => 'ProjectUrlGenerator', 'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - ), $options); + ], $options); return <<<EOF <?php @@ -76,11 +76,11 @@ public function __construct(RequestContext \$context, LoggerInterface \$logger = */ private function generateDeclaredRoutes() { - $routes = "array(\n"; + $routes = "[\n"; foreach ($this->getRoutes()->all() as $name => $route) { $compiledRoute = $route->compile(); - $properties = array(); + $properties = []; $properties[] = $compiledRoute->getVariables(); $properties[] = $route->getDefaults(); $properties[] = $route->getRequirements(); @@ -90,7 +90,7 @@ private function generateDeclaredRoutes() $routes .= sprintf(" '%s' => %s,\n", $name, str_replace("\n", '', var_export($properties, true))); } - $routes .= ' )'; + $routes .= ' ]'; return $routes; } @@ -103,7 +103,7 @@ private function generateDeclaredRoutes() private function generateGenerateMethod() { return <<<'EOF' - public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) + public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH) { if (!isset(self::$declaredRoutes[$name])) { throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name)); diff --git a/vendor/symfony/routing/Generator/UrlGenerator.php b/vendor/symfony/routing/Generator/UrlGenerator.php index 6ed70cabdfc219842e6451cee2781848861b2b2d..b87f4bb5c45f788234bd5f39cc6d4aa83453cc5c 100644 --- a/vendor/symfony/routing/Generator/UrlGenerator.php +++ b/vendor/symfony/routing/Generator/UrlGenerator.php @@ -45,7 +45,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt * "?" and "#" (would be interpreted wrongly as query and fragment identifier), * "'" and """ (are used as delimiters in HTML). */ - protected $decodedChars = array( + protected $decodedChars = [ // the slash can be used to designate a hierarchical structure and we want allow using it with this meaning // some webservers don't allow the slash in encoded form in the path for security reasons anyway // see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss @@ -63,7 +63,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt '%21' => '!', '%2A' => '*', '%7C' => '|', - ); + ]; public function __construct(RouteCollection $routes, RequestContext $context, LoggerInterface $logger = null) { @@ -107,7 +107,7 @@ public function isStrictRequirements() /** * {@inheritdoc} */ - public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) + public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH) { if (null === $route = $this->routes->get($name)) { throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name)); @@ -124,7 +124,7 @@ public function generate($name, $parameters = array(), $referenceType = self::AB * @throws InvalidParameterException When a parameter value for a placeholder is not correct because * it does not match the requirement */ - protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = array()) + protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = []) { $variables = array_flip($variables); $mergedParams = array_replace($defaults, $this->context->getParameters(), $parameters); @@ -139,15 +139,15 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa $message = 'Parameter "{parameter}" for route "{route}" must match "{expected}" ("{given}" given) to generate a corresponding URL.'; foreach ($tokens as $token) { if ('variable' === $token[0]) { - if (!$optional || !array_key_exists($token[3], $defaults) || null !== $mergedParams[$token[3]] && (string) $mergedParams[$token[3]] !== (string) $defaults[$token[3]]) { - // check requirement - if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { + if (!$optional || !\array_key_exists($token[3], $defaults) || null !== $mergedParams[$token[3]] && (string) $mergedParams[$token[3]] !== (string) $defaults[$token[3]]) { + // check requirement (while ignoring look-around patterns) + if (null !== $this->strictRequirements && !preg_match('#^'.preg_replace('/\(\?(?:=|<=|!|<!)((?:[^()\\\\]+|\\\\.|\((?1)\))*)\)/', '', $token[2]).'$#'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { if ($this->strictRequirements) { - throw new InvalidParameterException(strtr($message, array('{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]))); + throw new InvalidParameterException(strtr($message, ['{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]])); } if ($this->logger) { - $this->logger->error($message, array('parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]])); + $this->logger->error($message, ['parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]]]); } return; @@ -173,7 +173,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa // the path segments "." and ".." are interpreted as relative reference when resolving a URI; see http://tools.ietf.org/html/rfc3986#section-3.3 // so we need to encode them as they are not used for this purpose here // otherwise we would generate a URI that, when followed by a user agent (e.g. browser), does not match this route - $url = strtr($url, array('/../' => '/%2E%2E/', '/./' => '/%2E/')); + $url = strtr($url, ['/../' => '/%2E%2E/', '/./' => '/%2E/']); if ('/..' === substr($url, -3)) { $url = substr($url, 0, -2).'%2E%2E'; } elseif ('/.' === substr($url, -2)) { @@ -195,13 +195,14 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa $routeHost = ''; foreach ($hostTokens as $token) { if ('variable' === $token[0]) { - if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { + // check requirement (while ignoring look-around patterns) + if (null !== $this->strictRequirements && !preg_match('#^'.preg_replace('/\(\?(?:=|<=|!|<!)((?:[^()\\\\]+|\\\\.|\((?1)\))*)\)/', '', $token[2]).'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { if ($this->strictRequirements) { - throw new InvalidParameterException(strtr($message, array('{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]))); + throw new InvalidParameterException(strtr($message, ['{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]])); } if ($this->logger) { - $this->logger->error($message, array('parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]])); + $this->logger->error($message, ['parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]]]); } return; @@ -258,11 +259,11 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa if ($extra && $query = http_build_query($extra, '', '&', PHP_QUERY_RFC3986)) { // "/" and "?" can be left decoded for better user experience, see // http://tools.ietf.org/html/rfc3986#section-3.4 - $url .= '?'.strtr($query, array('%2F' => '/')); + $url .= '?'.strtr($query, ['%2F' => '/']); } if ('' !== $fragment) { - $url .= '#'.strtr(rawurlencode($fragment), array('%2F' => '/', '%3F' => '?')); + $url .= '#'.strtr(rawurlencode($fragment), ['%2F' => '/', '%3F' => '?']); } return $url; diff --git a/vendor/symfony/routing/Generator/UrlGeneratorInterface.php b/vendor/symfony/routing/Generator/UrlGeneratorInterface.php index d6e7938e5ba065f64718806f0522d9aafbc372c2..f7d37b2564b128892b1487693fc5a0dc2d41aa1b 100644 --- a/vendor/symfony/routing/Generator/UrlGeneratorInterface.php +++ b/vendor/symfony/routing/Generator/UrlGeneratorInterface.php @@ -82,5 +82,5 @@ interface UrlGeneratorInterface extends RequestContextAwareInterface * @throws InvalidParameterException When a parameter value for a placeholder is not correct because * it does not match the requirement */ - public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH); + public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH); } diff --git a/vendor/symfony/routing/LICENSE b/vendor/symfony/routing/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/routing/LICENSE +++ b/vendor/symfony/routing/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/routing/Loader/AnnotationClassLoader.php b/vendor/symfony/routing/Loader/AnnotationClassLoader.php index 8c96835826a9f9c12c437f0b23bfdba3b6463fbc..6a439e710acf5b3231a51ca0bf38336bf5cc67f9 100644 --- a/vendor/symfony/routing/Loader/AnnotationClassLoader.php +++ b/vendor/symfony/routing/Loader/AnnotationClassLoader.php @@ -120,11 +120,9 @@ public function load($class, $type = null) } if (0 === $collection->count() && $class->hasMethod('__invoke')) { + $globals = $this->resetGlobals(); foreach ($this->reader->getClassAnnotations($class) as $annot) { if ($annot instanceof $this->routeAnnotationClass) { - $globals['path'] = ''; - $globals['name'] = ''; - $this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke')); } } @@ -212,17 +210,7 @@ protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMetho protected function getGlobals(\ReflectionClass $class) { - $globals = array( - 'path' => '', - 'requirements' => array(), - 'options' => array(), - 'defaults' => array(), - 'schemes' => array(), - 'methods' => array(), - 'host' => '', - 'condition' => '', - 'name' => '', - ); + $globals = $this->resetGlobals(); if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { if (null !== $annot->getName()) { @@ -265,6 +253,21 @@ protected function getGlobals(\ReflectionClass $class) return $globals; } + private function resetGlobals() + { + return [ + 'path' => '', + 'requirements' => [], + 'options' => [], + 'defaults' => [], + 'schemes' => [], + 'methods' => [], + 'host' => '', + 'condition' => '', + 'name' => '', + ]; + } + protected function createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition) { return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition); diff --git a/vendor/symfony/routing/Loader/AnnotationFileLoader.php b/vendor/symfony/routing/Loader/AnnotationFileLoader.php index 034a1c580c770b503d8a1b23823918d77a1e6af7..dfea551fa16f53bfc45bd72da5527a33342dc571 100644 --- a/vendor/symfony/routing/Loader/AnnotationFileLoader.php +++ b/vendor/symfony/routing/Loader/AnnotationFileLoader.php @@ -105,7 +105,7 @@ protected function findClass($file) if (true === $namespace && T_STRING === $token[0]) { $namespace = $token[1]; - while (isset($tokens[++$i][1]) && \in_array($tokens[$i][0], array(T_NS_SEPARATOR, T_STRING))) { + while (isset($tokens[++$i][1]) && \in_array($tokens[$i][0], [T_NS_SEPARATOR, T_STRING])) { $namespace .= $tokens[$i][1]; } $token = $tokens[$i]; @@ -122,7 +122,7 @@ protected function findClass($file) if (T_DOUBLE_COLON === $tokens[$j][0] || T_NEW === $tokens[$j][0]) { $skipClassToken = true; break; - } elseif (!\in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) { + } elseif (!\in_array($tokens[$j][0], [T_WHITESPACE, T_DOC_COMMENT, T_COMMENT])) { break; } } diff --git a/vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php b/vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php index 4d2e255b14076549d3a7b44bf41c7adb599b48cd..1d019fe48f754103a3a2bc3fd9ad6eaeef3fa7af 100644 --- a/vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php +++ b/vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php @@ -124,7 +124,7 @@ final public function methods(array $methods) */ final public function controller($controller) { - $this->route->addDefaults(array('_controller' => $controller)); + $this->route->addDefaults(['_controller' => $controller]); return $this; } diff --git a/vendor/symfony/routing/Loader/ObjectRouteLoader.php b/vendor/symfony/routing/Loader/ObjectRouteLoader.php index 12fc2bbe16e9a8a7d9fa780a8d36a781aaf91d39..ce58dc7da44e2fe547f3c6984d956de3a5fd8277 100644 --- a/vendor/symfony/routing/Loader/ObjectRouteLoader.php +++ b/vendor/symfony/routing/Loader/ObjectRouteLoader.php @@ -62,7 +62,7 @@ public function load($resource, $type = null) throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, \get_class($loaderObject), $resource)); } - $routeCollection = \call_user_func(array($loaderObject, $method), $this); + $routeCollection = \call_user_func([$loaderObject, $method], $this); if (!$routeCollection instanceof RouteCollection) { $type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection); diff --git a/vendor/symfony/routing/Loader/XmlFileLoader.php b/vendor/symfony/routing/Loader/XmlFileLoader.php index 689245b5ac40e7d2b7826ac130114734f54d149b..e56add97a34ff5629c105c4b47ec9f83e6887c55 100644 --- a/vendor/symfony/routing/Loader/XmlFileLoader.php +++ b/vendor/symfony/routing/Loader/XmlFileLoader.php @@ -149,7 +149,7 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, $ $imported = $this->import($resource, ('' !== $type ? $type : null), false, $file); if (!\is_array($imported)) { - $imported = array($imported); + $imported = [$imported]; } foreach ($imported as $subCollection) { @@ -203,9 +203,9 @@ protected function loadFile($file) */ private function parseConfigs(\DOMElement $node, $path) { - $defaults = array(); - $requirements = array(); - $options = array(); + $defaults = []; + $requirements = []; + $options = []; $condition = null; foreach ($node->getElementsByTagNameNS(self::NAMESPACE_URI, '*') as $n) { @@ -246,7 +246,7 @@ private function parseConfigs(\DOMElement $node, $path) $defaults['_controller'] = $controller; } - return array($defaults, $requirements, $options, $condition); + return [$defaults, $requirements, $options, $condition]; } /** @@ -310,7 +310,7 @@ private function parseDefaultNode(\DOMElement $node, $path) case 'string': return trim($node->nodeValue); case 'list': - $list = array(); + $list = []; foreach ($node->childNodes as $element) { if (!$element instanceof \DOMElement) { @@ -326,7 +326,7 @@ private function parseDefaultNode(\DOMElement $node, $path) return $list; case 'map': - $map = array(); + $map = []; foreach ($node->childNodes as $element) { if (!$element instanceof \DOMElement) { diff --git a/vendor/symfony/routing/Loader/YamlFileLoader.php b/vendor/symfony/routing/Loader/YamlFileLoader.php index f5ce429ab4177645b24f72fae2cd1241c4c26dc4..bc21e9cb4db7c98ff0e2bf4e895c75e3d0e4c67a 100644 --- a/vendor/symfony/routing/Loader/YamlFileLoader.php +++ b/vendor/symfony/routing/Loader/YamlFileLoader.php @@ -26,9 +26,9 @@ */ class YamlFileLoader extends FileLoader { - private static $availableKeys = array( + private static $availableKeys = [ 'resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', 'controller', - ); + ]; private $yamlParser; /** @@ -102,7 +102,7 @@ public function load($file, $type = null) */ public function supports($resource, $type = null) { - return \is_string($resource) && \in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type); + return \is_string($resource) && \in_array(pathinfo($resource, PATHINFO_EXTENSION), ['yml', 'yaml'], true) && (!$type || 'yaml' === $type); } /** @@ -115,12 +115,12 @@ public function supports($resource, $type = null) */ protected function parseRoute(RouteCollection $collection, $name, array $config, $path) { - $defaults = isset($config['defaults']) ? $config['defaults'] : array(); - $requirements = isset($config['requirements']) ? $config['requirements'] : array(); - $options = isset($config['options']) ? $config['options'] : array(); + $defaults = isset($config['defaults']) ? $config['defaults'] : []; + $requirements = isset($config['requirements']) ? $config['requirements'] : []; + $options = isset($config['options']) ? $config['options'] : []; $host = isset($config['host']) ? $config['host'] : ''; - $schemes = isset($config['schemes']) ? $config['schemes'] : array(); - $methods = isset($config['methods']) ? $config['methods'] : array(); + $schemes = isset($config['schemes']) ? $config['schemes'] : []; + $methods = isset($config['methods']) ? $config['methods'] : []; $condition = isset($config['condition']) ? $config['condition'] : null; if (isset($config['controller'])) { @@ -144,9 +144,9 @@ protected function parseImport(RouteCollection $collection, array $config, $path { $type = isset($config['type']) ? $config['type'] : null; $prefix = isset($config['prefix']) ? $config['prefix'] : ''; - $defaults = isset($config['defaults']) ? $config['defaults'] : array(); - $requirements = isset($config['requirements']) ? $config['requirements'] : array(); - $options = isset($config['options']) ? $config['options'] : array(); + $defaults = isset($config['defaults']) ? $config['defaults'] : []; + $requirements = isset($config['requirements']) ? $config['requirements'] : []; + $options = isset($config['options']) ? $config['options'] : []; $host = isset($config['host']) ? $config['host'] : null; $condition = isset($config['condition']) ? $config['condition'] : null; $schemes = isset($config['schemes']) ? $config['schemes'] : null; @@ -161,7 +161,7 @@ protected function parseImport(RouteCollection $collection, array $config, $path $imported = $this->import($config['resource'], $type, false, $file); if (!\is_array($imported)) { - $imported = array($imported); + $imported = [$imported]; } foreach ($imported as $subCollection) { @@ -203,28 +203,16 @@ protected function validate($config, $name, $path) throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path)); } if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) { - throw new \InvalidArgumentException(sprintf( - 'The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', - $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys) - )); + throw new \InvalidArgumentException(sprintf('The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys))); } if (isset($config['resource']) && isset($config['path'])) { - throw new \InvalidArgumentException(sprintf( - 'The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', - $path, $name - )); + throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', $path, $name)); } if (!isset($config['resource']) && isset($config['type'])) { - throw new \InvalidArgumentException(sprintf( - 'The "type" key for the route definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.', - $name, $path - )); + throw new \InvalidArgumentException(sprintf('The "type" key for the route definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.', $name, $path)); } if (!isset($config['resource']) && !isset($config['path'])) { - throw new \InvalidArgumentException(sprintf( - 'You must define a "path" for the route "%s" in file "%s".', - $name, $path - )); + throw new \InvalidArgumentException(sprintf('You must define a "path" for the route "%s" in file "%s".', $name, $path)); } if (isset($config['controller']) && isset($config['defaults']['_controller'])) { throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "controller" key and the defaults key "_controller" for "%s".', $path, $name)); diff --git a/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php b/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php index dd057d2ee8301cf89e04b7df3a31ae08711fa8f9..84ee1892d3b7c361c8e30d932e1945b51e344e8a 100644 --- a/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php +++ b/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php @@ -28,12 +28,12 @@ class DumperCollection implements \IteratorAggregate /** * @var DumperCollection[]|DumperRoute[] */ - private $children = array(); + private $children = []; /** * @var array */ - private $attributes = array(); + private $attributes = []; /** * Returns the children routes and collections. @@ -120,7 +120,7 @@ protected function setParent(self $parent) */ public function hasAttribute($name) { - return array_key_exists($name, $this->attributes); + return \array_key_exists($name, $this->attributes); } /** diff --git a/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php b/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php index 5e7c134b9f394752d3c6d4dd4b1911f2c47db36b..2a25293aa3e5cc52b580202cabd2653c7e8e6962 100644 --- a/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php +++ b/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php @@ -28,7 +28,7 @@ interface MatcherDumperInterface * * @return string Executable code */ - public function dump(array $options = array()); + public function dump(array $options = []); /** * Gets the routes to dump. diff --git a/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php b/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php index ac1f8f813598bf73edfe0dc0d2b49758dbd23665..0a830b64d575ca787f6f1723704e19779e4d4166 100644 --- a/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php @@ -30,7 +30,7 @@ class PhpMatcherDumper extends MatcherDumper /** * @var ExpressionFunctionProviderInterface[] */ - private $expressionLanguageProviders = array(); + private $expressionLanguageProviders = []; /** * Dumps a set of routes to a PHP class. @@ -44,12 +44,12 @@ class PhpMatcherDumper extends MatcherDumper * * @return string A PHP class representing the matcher class */ - public function dump(array $options = array()) + public function dump(array $options = []) { - $options = array_replace(array( + $options = array_replace([ 'class' => 'ProjectUrlMatcher', 'base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', - ), $options); + ], $options); // trailing slash support is only enabled if we know how to redirect the user $interfaces = class_implements($options['base_class']); @@ -98,7 +98,7 @@ private function generateMatchMethod($supportsRedirections) return <<<EOF public function match(\$rawPathinfo) { - \$allow = array(); + \$allow = []; \$pathinfo = rawurldecode(\$rawPathinfo); \$trimmedPathinfo = rtrim(\$pathinfo, '/'); \$context = \$this->context; @@ -230,7 +230,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren { $code = ''; $compiledRoute = $route->compile(); - $conditions = array(); + $conditions = []; $hasTrailingSlash = false; $matches = false; $hostMatches = false; @@ -265,7 +265,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren } if ($route->getCondition()) { - $conditions[] = $this->getExpressionLanguage()->compile($route->getCondition(), array('context', 'request')); + $conditions[] = $this->getExpressionLanguage()->compile($route->getCondition(), ['context', 'request']); } $conditions = implode(' && ', $conditions); @@ -283,14 +283,14 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren // optimize parameters array if ($matches || $hostMatches) { - $vars = array(); + $vars = []; if ($hostMatches) { $vars[] = '$hostMatches'; } if ($matches) { $vars[] = '$matches'; } - $vars[] = "array('_route' => '$name')"; + $vars[] = "['_route' => '$name']"; $code .= sprintf( " \$ret = \$this->mergeDefaults(array_replace(%s), %s);\n", @@ -298,9 +298,9 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren str_replace("\n", '', var_export($route->getDefaults(), true)) ); } elseif ($route->getDefaults()) { - $code .= sprintf(" \$ret = %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), array('_route' => $name)), true))); + $code .= sprintf(" \$ret = %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), ['_route' => $name]), true))); } else { - $code .= sprintf(" \$ret = array('_route' => '%s');\n", $name); + $code .= sprintf(" \$ret = ['_route' => '%s'];\n", $name); } if ($hasTrailingSlash) { @@ -331,9 +331,9 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren $code .= <<<EOF \$requiredSchemes = $schemes; \$hasRequiredScheme = isset(\$requiredSchemes[\$context->getScheme()]); - if (!in_array($methodVariable, array('$methods'))) { + if (!in_array($methodVariable, ['$methods'])) { if (\$hasRequiredScheme) { - \$allow = array_merge(\$allow, array('$methods')); + \$allow = array_merge(\$allow, ['$methods']); } goto $gotoname; } @@ -363,8 +363,8 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren } } elseif ($methods) { $code .= <<<EOF - if (!in_array($methodVariable, array('$methods'))) { - \$allow = array_merge(\$allow, array('$methods')); + if (!in_array($methodVariable, ['$methods'])) { + \$allow = array_merge(\$allow, ['$methods']); goto $gotoname; } diff --git a/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php b/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php index 18c5565354f0353c3be3dffc23c632f17ec94732..15c47051f5b60c7f50d57a62238ebd2bf41b1618 100644 --- a/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php +++ b/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php @@ -28,7 +28,7 @@ class StaticPrefixCollection /** * @var array[]|StaticPrefixCollection[] */ - private $items = array(); + private $items = []; /** * @var int @@ -68,7 +68,7 @@ public function addRoute($prefix, $route) // When a prefix is exactly the same as the base we move up the match start position. // This is needed because otherwise routes that come afterwards have higher precedence // than a possible regular expression, which goes against the input order sorting. - $this->items[] = array($prefix, $route); + $this->items[] = [$prefix, $route]; $this->matchStart = \count($this->items); return; @@ -96,7 +96,7 @@ public function addRoute($prefix, $route) // No optimised case was found, in this case we simple add the route for possible // grouping when new routes are added. - $this->items[] = array($prefix, $route); + $this->items[] = [$prefix, $route]; } /** @@ -106,7 +106,7 @@ public function addRoute($prefix, $route) * @param string $prefix * @param mixed $route * - * @return null|StaticPrefixCollection + * @return StaticPrefixCollection|null */ private function groupWithItem($item, $prefix, $route) { @@ -120,7 +120,7 @@ private function groupWithItem($item, $prefix, $route) $child = new self($commonPrefix); if ($item instanceof self) { - $child->items = array($item); + $child->items = [$item]; } else { $child->addRoute($item[0], $item[1]); } diff --git a/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php b/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php index 67805205c72cf7096e2384b5e157b853152db1fe..bccc78fdee37b24d72ad1d5055d013bdb92f901d 100644 --- a/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php +++ b/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php @@ -27,7 +27,7 @@ public function match($pathinfo) try { $parameters = parent::match($pathinfo); } catch (ResourceNotFoundException $e) { - if ('/' === substr($pathinfo, -1) || !\in_array($this->context->getMethod(), array('HEAD', 'GET'))) { + if ('/' === substr($pathinfo, -1) || !\in_array($this->context->getMethod(), ['HEAD', 'GET'])) { throw $e; } @@ -49,17 +49,17 @@ public function match($pathinfo) protected function handleRouteRequirements($pathinfo, $name, Route $route) { // expression condition - if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) { - return array(self::REQUIREMENT_MISMATCH, null); + if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), ['context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)])) { + return [self::REQUIREMENT_MISMATCH, null]; } // check HTTP scheme requirement $scheme = $this->context->getScheme(); $schemes = $route->getSchemes(); if ($schemes && !$route->hasScheme($scheme)) { - return array(self::ROUTE_MATCH, $this->redirect($pathinfo, $name, current($schemes))); + return [self::ROUTE_MATCH, $this->redirect($pathinfo, $name, current($schemes))]; } - return array(self::REQUIREMENT_MATCH, null); + return [self::REQUIREMENT_MATCH, null]; } } diff --git a/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php b/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php index 61cad8e692f13784f7e4968cc5932d6eb19d5cdf..3c3c4bfcf919e3a8af5cad3e696f045a264710b8 100644 --- a/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php +++ b/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php @@ -31,7 +31,7 @@ class TraceableUrlMatcher extends UrlMatcher public function getTraces($pathinfo) { - $this->traces = array(); + $this->traces = []; try { $this->match($pathinfo); @@ -57,7 +57,7 @@ protected function matchCollection($pathinfo, RouteCollection $routes) if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) { // does it match without any requirements? - $r = new Route($route->getPath(), $route->getDefaults(), array(), $route->getOptions()); + $r = new Route($route->getPath(), $route->getDefaults(), [], $route->getOptions()); $cr = $r->compile(); if (!preg_match($cr->getRegex(), $pathinfo)) { $this->addTrace(sprintf('Path "%s" does not match', $route->getPath()), self::ROUTE_DOES_NOT_MATCH, $name, $route); @@ -66,7 +66,7 @@ protected function matchCollection($pathinfo, RouteCollection $routes) } foreach ($route->getRequirements() as $n => $regex) { - $r = new Route($route->getPath(), $route->getDefaults(), array($n => $regex), $route->getOptions()); + $r = new Route($route->getPath(), $route->getDefaults(), [$n => $regex], $route->getOptions()); $cr = $r->compile(); if (\in_array($n, $cr->getVariables()) && !preg_match($cr->getRegex(), $pathinfo)) { @@ -80,7 +80,7 @@ protected function matchCollection($pathinfo, RouteCollection $routes) } // check host requirement - $hostMatches = array(); + $hostMatches = []; if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) { $this->addTrace(sprintf('Host "%s" does not match the requirement ("%s")', $this->context->getHost(), $route->getHost()), self::ROUTE_ALMOST_MATCHES, $name, $route); @@ -105,7 +105,7 @@ protected function matchCollection($pathinfo, RouteCollection $routes) // check condition if ($condition = $route->getCondition()) { - if (!$this->getExpressionLanguage()->evaluate($condition, array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) { + if (!$this->getExpressionLanguage()->evaluate($condition, ['context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)])) { $this->addTrace(sprintf('Condition "%s" does not evaluate to "true"', $condition), self::ROUTE_ALMOST_MATCHES, $name, $route); continue; @@ -131,11 +131,11 @@ protected function matchCollection($pathinfo, RouteCollection $routes) private function addTrace($log, $level = self::ROUTE_DOES_NOT_MATCH, $name = null, $route = null) { - $this->traces[] = array( + $this->traces[] = [ 'log' => $log, 'name' => $name, 'level' => $level, 'path' => null !== $route ? $route->getPath() : null, - ); + ]; } } diff --git a/vendor/symfony/routing/Matcher/UrlMatcher.php b/vendor/symfony/routing/Matcher/UrlMatcher.php index ec3a05c95f30cfc49e478072e17c507309bf946e..663ebcbefaaecfbee96232b951019d5d41620984 100644 --- a/vendor/symfony/routing/Matcher/UrlMatcher.php +++ b/vendor/symfony/routing/Matcher/UrlMatcher.php @@ -33,7 +33,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface const ROUTE_MATCH = 2; protected $context; - protected $allow = array(); + protected $allow = []; protected $routes; protected $request; protected $expressionLanguage; @@ -41,7 +41,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface /** * @var ExpressionFunctionProviderInterface[] */ - protected $expressionLanguageProviders = array(); + protected $expressionLanguageProviders = []; public function __construct(RouteCollection $routes, RequestContext $context) { @@ -70,7 +70,7 @@ public function getContext() */ public function match($pathinfo) { - $this->allow = array(); + $this->allow = []; if ($ret = $this->matchCollection(rawurldecode($pathinfo), $this->routes)) { return $ret; @@ -118,19 +118,48 @@ public function addExpressionLanguageProvider(ExpressionFunctionProviderInterfac */ protected function matchCollection($pathinfo, RouteCollection $routes) { + // HEAD and GET are equivalent as per RFC + if ('HEAD' === $method = $this->context->getMethod()) { + $method = 'GET'; + } + $supportsTrailingSlash = '/' !== $pathinfo && '' !== $pathinfo && $this instanceof RedirectableUrlMatcherInterface; + foreach ($routes as $name => $route) { $compiledRoute = $route->compile(); + $staticPrefix = $compiledRoute->getStaticPrefix(); + $requiredMethods = $route->getMethods(); // check the static prefix of the URL first. Only use the more expensive preg_match when it matches - if ('' !== $compiledRoute->getStaticPrefix() && 0 !== strpos($pathinfo, $compiledRoute->getStaticPrefix())) { + if ('' === $staticPrefix || 0 === strpos($pathinfo, $staticPrefix)) { + // no-op + } elseif (!$supportsTrailingSlash || ($requiredMethods && !\in_array('GET', $requiredMethods)) || 'GET' !== $method) { + continue; + } elseif ('/' === substr($staticPrefix, -1) && substr($staticPrefix, 0, -1) === $pathinfo) { + return $this->allow = []; + } else { + continue; + } + $regex = $compiledRoute->getRegex(); + + if ($supportsTrailingSlash && $pos = strpos($regex, '/$')) { + $regex = substr($regex, 0, $pos).'/?$'.substr($regex, $pos + 2); + $hasTrailingSlash = true; + } else { + $hasTrailingSlash = false; + } + + if (!preg_match($regex, $pathinfo, $matches)) { continue; } - if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) { + if ($hasTrailingSlash && '/' !== substr($pathinfo, -1)) { + if ((!$requiredMethods || \in_array('GET', $requiredMethods)) && 'GET' === $method) { + return $this->allow = []; + } continue; } - $hostMatches = array(); + $hostMatches = []; if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) { continue; } @@ -142,12 +171,7 @@ protected function matchCollection($pathinfo, RouteCollection $routes) } // check HTTP method requirement - if ($requiredMethods = $route->getMethods()) { - // HEAD and GET are equivalent as per RFC - if ('HEAD' === $method = $this->context->getMethod()) { - $method = 'GET'; - } - + if ($requiredMethods) { if (!\in_array($method, $requiredMethods)) { if (self::REQUIREMENT_MATCH === $status[0]) { $this->allow = array_merge($this->allow, $requiredMethods); @@ -157,8 +181,10 @@ protected function matchCollection($pathinfo, RouteCollection $routes) } } - return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : array())); + return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : [])); } + + return []; } /** @@ -193,15 +219,15 @@ protected function getAttributes(Route $route, $name, array $attributes) protected function handleRouteRequirements($pathinfo, $name, Route $route) { // expression condition - if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) { - return array(self::REQUIREMENT_MISMATCH, null); + if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), ['context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)])) { + return [self::REQUIREMENT_MISMATCH, null]; } // check HTTP scheme requirement $scheme = $this->context->getScheme(); $status = $route->getSchemes() && !$route->hasScheme($scheme) ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; - return array($status, null); + return [$status, null]; } /** @@ -244,9 +270,9 @@ protected function createRequest($pathinfo) return null; } - return Request::create($this->context->getScheme().'://'.$this->context->getHost().$this->context->getBaseUrl().$pathinfo, $this->context->getMethod(), $this->context->getParameters(), array(), array(), array( + return Request::create($this->context->getScheme().'://'.$this->context->getHost().$this->context->getBaseUrl().$pathinfo, $this->context->getMethod(), $this->context->getParameters(), [], [], [ 'SCRIPT_FILENAME' => $this->context->getBaseUrl(), 'SCRIPT_NAME' => $this->context->getBaseUrl(), - )); + ]); } } diff --git a/vendor/symfony/routing/RequestContext.php b/vendor/symfony/routing/RequestContext.php index d62a7766ef85956ad7f4ca59c2cfd4ce32841854..8ebad8e2538db9804ea4e872f8ccaf12ffcda6fa 100644 --- a/vendor/symfony/routing/RequestContext.php +++ b/vendor/symfony/routing/RequestContext.php @@ -31,7 +31,7 @@ class RequestContext private $httpPort; private $httpsPort; private $queryString; - private $parameters = array(); + private $parameters = []; /** * @param string $baseUrl The base URL @@ -316,7 +316,7 @@ public function getParameter($name) */ public function hasParameter($name) { - return array_key_exists($name, $this->parameters); + return \array_key_exists($name, $this->parameters); } /** diff --git a/vendor/symfony/routing/Route.php b/vendor/symfony/routing/Route.php index 20059c649eac053af789de585f1d7a76e689078f..759b6f3b6e66e46a83422221c078881dcc32a981 100644 --- a/vendor/symfony/routing/Route.php +++ b/vendor/symfony/routing/Route.php @@ -21,15 +21,15 @@ class Route implements \Serializable { private $path = '/'; private $host = ''; - private $schemes = array(); - private $methods = array(); - private $defaults = array(); - private $requirements = array(); - private $options = array(); + private $schemes = []; + private $methods = []; + private $defaults = []; + private $requirements = []; + private $options = []; private $condition = ''; /** - * @var null|CompiledRoute + * @var CompiledRoute|null */ private $compiled; @@ -50,7 +50,7 @@ class Route implements \Serializable * @param string|string[] $methods A required HTTP method or an array of restricted methods * @param string $condition A condition that should evaluate to true for the route to match */ - public function __construct($path, array $defaults = array(), array $requirements = array(), array $options = array(), $host = '', $schemes = array(), $methods = array(), $condition = '') + public function __construct($path, array $defaults = [], array $requirements = [], array $options = [], $host = '', $schemes = [], $methods = [], $condition = '') { $this->setPath($path); $this->setDefaults($defaults); @@ -67,7 +67,7 @@ public function __construct($path, array $defaults = array(), array $requirement */ public function serialize() { - return serialize(array( + return serialize([ 'path' => $this->path, 'host' => $this->host, 'defaults' => $this->defaults, @@ -77,7 +77,7 @@ public function serialize() 'methods' => $this->methods, 'condition' => $this->condition, 'compiled' => $this->compiled, - )); + ]); } /** @@ -249,9 +249,9 @@ public function getOptions() */ public function setOptions(array $options) { - $this->options = array( + $this->options = [ 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler', - ); + ]; return $this->addOptions($options); } @@ -314,7 +314,7 @@ public function getOption($name) */ public function hasOption($name) { - return array_key_exists($name, $this->options); + return \array_key_exists($name, $this->options); } /** @@ -338,7 +338,7 @@ public function getDefaults() */ public function setDefaults(array $defaults) { - $this->defaults = array(); + $this->defaults = []; return $this->addDefaults($defaults); } @@ -383,7 +383,7 @@ public function getDefault($name) */ public function hasDefault($name) { - return array_key_exists($name, $this->defaults); + return \array_key_exists($name, $this->defaults); } /** @@ -423,7 +423,7 @@ public function getRequirements() */ public function setRequirements(array $requirements) { - $this->requirements = array(); + $this->requirements = []; return $this->addRequirements($requirements); } @@ -468,7 +468,7 @@ public function getRequirement($key) */ public function hasRequirement($key) { - return array_key_exists($key, $this->requirements); + return \array_key_exists($key, $this->requirements); } /** diff --git a/vendor/symfony/routing/RouteCollection.php b/vendor/symfony/routing/RouteCollection.php index c42229af2878250fe5478eeb253d7c343a8052a2..feac415513081fef22bdf74ae3543def8bb39ffd 100644 --- a/vendor/symfony/routing/RouteCollection.php +++ b/vendor/symfony/routing/RouteCollection.php @@ -28,12 +28,12 @@ class RouteCollection implements \IteratorAggregate, \Countable /** * @var Route[] */ - private $routes = array(); + private $routes = []; /** * @var array */ - private $resources = array(); + private $resources = []; public function __clone() { @@ -138,7 +138,7 @@ public function addCollection(self $collection) * @param array $defaults An array of default values * @param array $requirements An array of requirements */ - public function addPrefix($prefix, array $defaults = array(), array $requirements = array()) + public function addPrefix($prefix, array $defaults = [], array $requirements = []) { $prefix = trim(trim($prefix), '/'); @@ -160,7 +160,7 @@ public function addPrefix($prefix, array $defaults = array(), array $requirement * @param array $defaults An array of default values * @param array $requirements An array of requirements */ - public function setHost($pattern, array $defaults = array(), array $requirements = array()) + public function setHost($pattern, array $defaults = [], array $requirements = []) { foreach ($this->routes as $route) { $route->setHost($pattern); diff --git a/vendor/symfony/routing/RouteCollectionBuilder.php b/vendor/symfony/routing/RouteCollectionBuilder.php index 74d01f41560395d18f08014fd8aa0ee26a536172..800e448cf3b46c798af5a1f37be24cc57e8a69e3 100644 --- a/vendor/symfony/routing/RouteCollectionBuilder.php +++ b/vendor/symfony/routing/RouteCollectionBuilder.php @@ -25,18 +25,18 @@ class RouteCollectionBuilder /** * @var Route[]|RouteCollectionBuilder[] */ - private $routes = array(); + private $routes = []; private $loader; - private $defaults = array(); + private $defaults = []; private $prefix; private $host; private $condition; - private $requirements = array(); - private $options = array(); + private $requirements = []; + private $options = []; private $schemes; private $methods; - private $resources = array(); + private $resources = []; public function __construct(LoaderInterface $loader = null) { @@ -46,7 +46,7 @@ public function __construct(LoaderInterface $loader = null) /** * Import an external routing resource and returns the RouteCollectionBuilder. * - * $routes->import('blog.yml', '/blog'); + * $routes->import('blog.yml', '/blog'); * * @param mixed $resource * @param string|null $prefix @@ -332,7 +332,7 @@ private function generateRouteName(Route $route) $methods = implode('_', $route->getMethods()).'_'; $routeName = $methods.$route->getPath(); - $routeName = str_replace(array('/', ':', '|', '-'), '_', $routeName); + $routeName = str_replace(['/', ':', '|', '-'], '_', $routeName); $routeName = preg_replace('/[^a-z0-9A-Z_.]+/', '', $routeName); // Collapse consecutive underscores down into a single underscore. @@ -360,7 +360,7 @@ private function load($resource, $type = null) if ($this->loader->supports($resource, $type)) { $collections = $this->loader->load($resource, $type); - return \is_array($collections) ? $collections : array($collections); + return \is_array($collections) ? $collections : [$collections]; } if (null === $resolver = $this->loader->getResolver()) { @@ -373,6 +373,6 @@ private function load($resource, $type = null) $collections = $loader->load($resource, $type); - return \is_array($collections) ? $collections : array($collections); + return \is_array($collections) ? $collections : [$collections]; } } diff --git a/vendor/symfony/routing/RouteCompiler.php b/vendor/symfony/routing/RouteCompiler.php index 2562c185b7d1f56046e39b8b8fad8e878e2d5536..391fa8290353e00ac9c7270c05cdbd0197112a4b 100644 --- a/vendor/symfony/routing/RouteCompiler.php +++ b/vendor/symfony/routing/RouteCompiler.php @@ -46,10 +46,10 @@ class RouteCompiler implements RouteCompilerInterface */ public static function compile(Route $route) { - $hostVariables = array(); - $variables = array(); + $hostVariables = []; + $variables = []; $hostRegex = null; - $hostTokens = array(); + $hostTokens = []; if ('' !== $host = $route->getHost()) { $result = self::compilePattern($route, $host, true); @@ -94,9 +94,9 @@ public static function compile(Route $route) private static function compilePattern(Route $route, $pattern, $isHost) { - $tokens = array(); - $variables = array(); - $matches = array(); + $tokens = []; + $variables = []; + $matches = []; $pos = 0; $defaultSeparator = $isHost ? '.' : '/'; $useUtf8 = preg_match('//u', $pattern); @@ -143,9 +143,9 @@ private static function compilePattern(Route $route, $pattern, $isHost) } if ($isSeparator && $precedingText !== $precedingChar) { - $tokens[] = array('text', substr($precedingText, 0, -\strlen($precedingChar))); + $tokens[] = ['text', substr($precedingText, 0, -\strlen($precedingChar))]; } elseif (!$isSeparator && \strlen($precedingText) > 0) { - $tokens[] = array('text', $precedingText); + $tokens[] = ['text', $precedingText]; } $regexp = $route->getRequirement($varName); @@ -154,7 +154,7 @@ private static function compilePattern(Route $route, $pattern, $isHost) // Find the next static character after the variable that functions as a separator. By default, this separator and '/' // are disallowed for the variable. This default requirement makes sure that optional variables can be matched at all // and that the generating-matching-combination of URLs unambiguous, i.e. the params used for generating the URL are - // the same that will be matched. Example: new Route('/{page}.{_format}', array('_format' => 'html')) + // the same that will be matched. Example: new Route('/{page}.{_format}', ['_format' => 'html']) // If {page} would also match the separating dot, {_format} would never match as {page} will eagerly consume everything. // Also even if {_format} was not optional the requirement prevents that {page} matches something that was originally // part of {_format} when generating the URL, e.g. _format = 'mobile.html'. @@ -184,12 +184,12 @@ private static function compilePattern(Route $route, $pattern, $isHost) } } - $tokens[] = array('variable', $isSeparator ? $precedingChar : '', $regexp, $varName); + $tokens[] = ['variable', $isSeparator ? $precedingChar : '', $regexp, $varName]; $variables[] = $varName; } if ($pos < \strlen($pattern)) { - $tokens[] = array('text', substr($pattern, $pos)); + $tokens[] = ['text', substr($pattern, $pos)]; } // find the first optional token @@ -222,12 +222,12 @@ private static function compilePattern(Route $route, $pattern, $isHost) } } - return array( + return [ 'staticPrefix' => self::determineStaticPrefix($route, $tokens), 'regex' => $regexp, 'tokens' => array_reverse($tokens), 'variables' => $variables, - ); + ]; } /** diff --git a/vendor/symfony/routing/Router.php b/vendor/symfony/routing/Router.php index 56842a4d3b864c2a907396fb42dc3047f5eebe76..27c32e14ae8c6016b56292ff55ffe09e3aa18270 100644 --- a/vendor/symfony/routing/Router.php +++ b/vendor/symfony/routing/Router.php @@ -66,7 +66,7 @@ class Router implements RouterInterface, RequestMatcherInterface /** * @var array */ - protected $options = array(); + protected $options = []; /** * @var LoggerInterface|null @@ -81,7 +81,7 @@ class Router implements RouterInterface, RequestMatcherInterface /** * @var ExpressionFunctionProviderInterface[] */ - private $expressionLanguageProviders = array(); + private $expressionLanguageProviders = []; /** * @param LoaderInterface $loader A LoaderInterface instance @@ -90,7 +90,7 @@ class Router implements RouterInterface, RequestMatcherInterface * @param RequestContext $context The context * @param LoggerInterface $logger A logger instance */ - public function __construct(LoaderInterface $loader, $resource, array $options = array(), RequestContext $context = null, LoggerInterface $logger = null) + public function __construct(LoaderInterface $loader, $resource, array $options = [], RequestContext $context = null, LoggerInterface $logger = null) { $this->loader = $loader; $this->resource = $resource; @@ -124,7 +124,7 @@ public function __construct(LoaderInterface $loader, $resource, array $options = */ public function setOptions(array $options) { - $this->options = array( + $this->options = [ 'cache_dir' => null, 'debug' => false, 'generator_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', @@ -137,12 +137,12 @@ public function setOptions(array $options) 'matcher_cache_class' => 'ProjectUrlMatcher', 'resource_type' => null, 'strict_requirements' => true, - ); + ]; // check option names and live merge, if errors are encountered Exception will be thrown - $invalid = array(); + $invalid = []; foreach ($options as $key => $value) { - if (array_key_exists($key, $this->options)) { + if (\array_key_exists($key, $this->options)) { $this->options[$key] = $value; } else { $invalid[] = $key; @@ -164,7 +164,7 @@ public function setOptions(array $options) */ public function setOption($key, $value) { - if (!array_key_exists($key, $this->options)) { + if (!\array_key_exists($key, $this->options)) { throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key)); } @@ -182,7 +182,7 @@ public function setOption($key, $value) */ public function getOption($key) { - if (!array_key_exists($key, $this->options)) { + if (!\array_key_exists($key, $this->options)) { throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key)); } @@ -235,7 +235,7 @@ public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFa /** * {@inheritdoc} */ - public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) + public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH) { return $this->getGenerator()->generate($name, $parameters, $referenceType); } @@ -293,10 +293,10 @@ function (ConfigCacheInterface $cache) { } } - $options = array( + $options = [ 'class' => $this->options['matcher_cache_class'], 'base_class' => $this->options['matcher_base_class'], - ); + ]; $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources()); } @@ -327,10 +327,10 @@ public function getGenerator() function (ConfigCacheInterface $cache) { $dumper = $this->getGeneratorDumperInstance(); - $options = array( + $options = [ 'class' => $this->options['generator_cache_class'], 'base_class' => $this->options['generator_base_class'], - ); + ]; $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources()); } @@ -375,7 +375,7 @@ protected function getMatcherDumperInstance() * Provides the ConfigCache factory implementation, falling back to a * default implementation if necessary. * - * @return ConfigCacheFactoryInterface $configCacheFactory + * @return ConfigCacheFactoryInterface */ private function getConfigCacheFactory() { diff --git a/vendor/symfony/routing/Tests/Annotation/RouteTest.php b/vendor/symfony/routing/Tests/Annotation/RouteTest.php index 9af22f29f802f354607e7a5663839199d998c881..2cbfd7390784116f59b385163ab9b624c3d54fe0 100644 --- a/vendor/symfony/routing/Tests/Annotation/RouteTest.php +++ b/vendor/symfony/routing/Tests/Annotation/RouteTest.php @@ -21,7 +21,7 @@ class RouteTest extends TestCase */ public function testInvalidRouteParameter() { - $route = new Route(array('foo' => 'bar')); + $route = new Route(['foo' => 'bar']); } /** @@ -29,22 +29,22 @@ public function testInvalidRouteParameter() */ public function testRouteParameters($parameter, $value, $getter) { - $route = new Route(array($parameter => $value)); + $route = new Route([$parameter => $value]); $this->assertEquals($route->$getter(), $value); } public function getValidParameters() { - return array( - array('value', '/Blog', 'getPath'), - array('requirements', array('locale' => 'en'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults'), - array('schemes', array('https'), 'getSchemes'), - array('methods', array('GET', 'POST'), 'getMethods'), - array('host', '{locale}.example.com', 'getHost'), - array('condition', 'context.getMethod() == "GET"', 'getCondition'), - ); + return [ + ['value', '/Blog', 'getPath'], + ['requirements', ['locale' => 'en'], 'getRequirements'], + ['options', ['compiler_class' => 'RouteCompiler'], 'getOptions'], + ['name', 'blog_index', 'getName'], + ['defaults', ['_controller' => 'MyBlogBundle:Blog:index'], 'getDefaults'], + ['schemes', ['https'], 'getSchemes'], + ['methods', ['GET', 'POST'], 'getMethods'], + ['host', '{locale}.example.com', 'getHost'], + ['condition', 'context.getMethod() == "GET"', 'getCondition'], + ]; } } diff --git a/vendor/symfony/routing/Tests/CompiledRouteTest.php b/vendor/symfony/routing/Tests/CompiledRouteTest.php index 5bec7bbd7c86397d190d392bc91a4cd150f1320e..9c9f4f286203f42141567496310ca19a12909cc1 100644 --- a/vendor/symfony/routing/Tests/CompiledRouteTest.php +++ b/vendor/symfony/routing/Tests/CompiledRouteTest.php @@ -18,10 +18,10 @@ class CompiledRouteTest extends TestCase { public function testAccessors() { - $compiled = new CompiledRoute('prefix', 'regex', array('tokens'), array(), null, array(), array(), array('variables')); + $compiled = new CompiledRoute('prefix', 'regex', ['tokens'], [], null, [], [], ['variables']); $this->assertEquals('prefix', $compiled->getStaticPrefix(), '__construct() takes a static prefix as its second argument'); $this->assertEquals('regex', $compiled->getRegex(), '__construct() takes a regexp as its third argument'); - $this->assertEquals(array('tokens'), $compiled->getTokens(), '__construct() takes an array of tokens as its fourth argument'); - $this->assertEquals(array('variables'), $compiled->getVariables(), '__construct() takes an array of variables as its ninth argument'); + $this->assertEquals(['tokens'], $compiled->getTokens(), '__construct() takes an array of tokens as its fourth argument'); + $this->assertEquals(['variables'], $compiled->getVariables(), '__construct() takes an array of variables as its ninth argument'); } } diff --git a/vendor/symfony/routing/Tests/DependencyInjection/RoutingResolverPassTest.php b/vendor/symfony/routing/Tests/DependencyInjection/RoutingResolverPassTest.php index 97a34c969c2fee8f9f4c574a253d82f1663b0d6e..30c7516e59711d2485fa529f4d4197673677316d 100644 --- a/vendor/symfony/routing/Tests/DependencyInjection/RoutingResolverPassTest.php +++ b/vendor/symfony/routing/Tests/DependencyInjection/RoutingResolverPassTest.php @@ -29,7 +29,7 @@ public function testProcess() (new RoutingResolverPass())->process($container); $this->assertEquals( - array(array('addLoader', array(new Reference('loader1'))), array('addLoader', array(new Reference('loader2')))), + [['addLoader', [new Reference('loader1')]], ['addLoader', [new Reference('loader2')]]], $container->getDefinition('routing.resolver')->getMethodCalls() ); } diff --git a/vendor/symfony/routing/Tests/Fixtures/CustomRouteCompiler.php b/vendor/symfony/routing/Tests/Fixtures/CustomRouteCompiler.php index c2e2afd9afcd967c6a5dffaae111a704a6c67d6a..22b942d7bc871be44339393416d9e0a6415088b9 100644 --- a/vendor/symfony/routing/Tests/Fixtures/CustomRouteCompiler.php +++ b/vendor/symfony/routing/Tests/Fixtures/CustomRouteCompiler.php @@ -21,6 +21,6 @@ class CustomRouteCompiler extends RouteCompiler */ public static function compile(Route $route) { - return new CustomCompiledRoute('', '', array(), array()); + return new CustomCompiledRoute('', '', [], []); } } diff --git a/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php b/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php index 08b67a07677822df8dba8026e21f548c028d6780..79ae1cce54ca9290e62c278ca80368a1451755ce 100644 --- a/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php +++ b/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php @@ -21,10 +21,10 @@ class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatche { public function redirect($path, $route, $scheme = null) { - return array( + return [ '_controller' => 'Some controller reference...', 'path' => $path, 'scheme' => $scheme, - ); + ]; } } diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php index 9e9b9103bf77e35def4a10c00a013a6ac514649c..4978093fa4e98729ab38e69dc42e5b281c41ea6c 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php @@ -17,7 +17,7 @@ public function __construct(RequestContext $context) public function match($rawPathinfo) { - $allow = array(); + $allow = []; $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php index 23a93c193423d11c1db4d509857ee7c4d46fae9e..16fcc3e502fe512b6529e83cc6b9d8b633e209cb 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php @@ -17,7 +17,7 @@ public function __construct(RequestContext $context) public function match($rawPathinfo) { - $allow = array(); + $allow = []; $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; @@ -31,7 +31,7 @@ public function match($rawPathinfo) if (0 === strpos($pathinfo, '/foo')) { // foo if (preg_match('#^/foo/(?P<bar>baz|symfony)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo']), array ( 'def' => 'test',)); } // foofoo @@ -44,9 +44,9 @@ public function match($rawPathinfo) elseif (0 === strpos($pathinfo, '/bar')) { // bar if (preg_match('#^/bar/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); - if (!in_array($canonicalMethod, array('GET', 'HEAD'))) { - $allow = array_merge($allow, array('GET', 'HEAD')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'bar']), array ()); + if (!in_array($canonicalMethod, ['GET', 'HEAD'])) { + $allow = array_merge($allow, ['GET', 'HEAD']); goto not_bar; } @@ -56,9 +56,9 @@ public function match($rawPathinfo) // barhead if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); - if (!in_array($canonicalMethod, array('GET'))) { - $allow = array_merge($allow, array('GET')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'barhead']), array ()); + if (!in_array($canonicalMethod, ['GET'])) { + $allow = array_merge($allow, ['GET']); goto not_barhead; } @@ -72,31 +72,31 @@ public function match($rawPathinfo) if (0 === strpos($pathinfo, '/test/baz')) { // baz if ('/test/baz' === $pathinfo) { - return array('_route' => 'baz'); + return ['_route' => 'baz']; } // baz2 if ('/test/baz.html' === $pathinfo) { - return array('_route' => 'baz2'); + return ['_route' => 'baz2']; } // baz3 if ('/test/baz3/' === $pathinfo) { - return array('_route' => 'baz3'); + return ['_route' => 'baz3']; } } // baz4 if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'baz4']), array ()); } // baz5 if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); - if (!in_array($requestMethod, array('POST'))) { - $allow = array_merge($allow, array('POST')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz5']), array ()); + if (!in_array($requestMethod, ['POST'])) { + $allow = array_merge($allow, ['POST']); goto not_baz5; } @@ -106,9 +106,9 @@ public function match($rawPathinfo) // baz.baz6 if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); - if (!in_array($requestMethod, array('PUT'))) { - $allow = array_merge($allow, array('PUT')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz.baz6']), array ()); + if (!in_array($requestMethod, ['PUT'])) { + $allow = array_merge($allow, ['PUT']); goto not_bazbaz6; } @@ -120,42 +120,42 @@ public function match($rawPathinfo) // quoter if (preg_match('#^/(?P<quoter>[\']+)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'quoter']), array ()); } // space if ('/spa ce' === $pathinfo) { - return array('_route' => 'space'); + return ['_route' => 'space']; } if (0 === strpos($pathinfo, '/a')) { if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo1']), array ()); } // bar1 if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar1']), array ()); } } // overridden if (preg_match('#^/a/(?P<var>.*)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'overridden']), array ()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P<foo1>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo2']), array ()); } // bar2 if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar2']), array ()); } } @@ -165,40 +165,40 @@ public function match($rawPathinfo) elseif (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'helloWorld']), array ( 'who' => 'World!',)); } // hey if ('/multi/hey/' === $pathinfo) { - return array('_route' => 'hey'); + return ['_route' => 'hey']; } // overridden2 if ('/multi/new' === $pathinfo) { - return array('_route' => 'overridden2'); + return ['_route' => 'overridden2']; } } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo3']), array ()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar3']), array ()); } if (0 === strpos($pathinfo, '/aba')) { // ababa if ('/ababa' === $pathinfo) { - return array('_route' => 'ababa'); + return ['_route' => 'ababa']; } // foo4 if (preg_match('#^/aba/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo4']), array ()); } } @@ -208,12 +208,12 @@ public function match($rawPathinfo) if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) { // route1 if ('/route1' === $pathinfo) { - return array('_route' => 'route1'); + return ['_route' => 'route1']; } // route2 if ('/c2/route2' === $pathinfo) { - return array('_route' => 'route2'); + return ['_route' => 'route2']; } } @@ -221,7 +221,7 @@ public function match($rawPathinfo) if (preg_match('#^b\\.example\\.com$#sDi', $host, $hostMatches)) { // route3 if ('/c2/route3' === $pathinfo) { - return array('_route' => 'route3'); + return ['_route' => 'route3']; } } @@ -229,7 +229,7 @@ public function match($rawPathinfo) if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) { // route4 if ('/route4' === $pathinfo) { - return array('_route' => 'route4'); + return ['_route' => 'route4']; } } @@ -237,36 +237,36 @@ public function match($rawPathinfo) if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) { // route5 if ('/route5' === $pathinfo) { - return array('_route' => 'route5'); + return ['_route' => 'route5']; } } // route6 if ('/route6' === $pathinfo) { - return array('_route' => 'route6'); + return ['_route' => 'route6']; } if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#sDi', $host, $hostMatches)) { if (0 === strpos($pathinfo, '/route1')) { // route11 if ('/route11' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route11']), array ()); } // route12 if ('/route12' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route12']), array ( 'var1' => 'val',)); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route13']), array ()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route14']), array ( 'var1' => 'val',)); } } @@ -276,35 +276,35 @@ public function match($rawPathinfo) if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'route15']), array ()); } } // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'route16']), array ( 'var1' => 'val',)); } // route17 if ('/route17' === $pathinfo) { - return array('_route' => 'route17'); + return ['_route' => 'route17']; } // a if ('/a/a...' === $pathinfo) { - return array('_route' => 'a'); + return ['_route' => 'a']; } if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'b']), array ()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'c']), array ()); } } diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php index e430adb1fba6c3b37fa5850cf2e70f651435a535..2b80be57a83d2e8b011212b57a51cc1e8c198b55 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php @@ -17,7 +17,7 @@ public function __construct(RequestContext $context) public function match($rawPathinfo) { - $allow = array(); + $allow = []; $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; @@ -31,7 +31,7 @@ public function match($rawPathinfo) if (0 === strpos($pathinfo, '/foo')) { // foo if (preg_match('#^/foo/(?P<bar>baz|symfony)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo']), array ( 'def' => 'test',)); } // foofoo @@ -44,9 +44,9 @@ public function match($rawPathinfo) elseif (0 === strpos($pathinfo, '/bar')) { // bar if (preg_match('#^/bar/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); - if (!in_array($canonicalMethod, array('GET', 'HEAD'))) { - $allow = array_merge($allow, array('GET', 'HEAD')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'bar']), array ()); + if (!in_array($canonicalMethod, ['GET', 'HEAD'])) { + $allow = array_merge($allow, ['GET', 'HEAD']); goto not_bar; } @@ -56,9 +56,9 @@ public function match($rawPathinfo) // barhead if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); - if (!in_array($canonicalMethod, array('GET'))) { - $allow = array_merge($allow, array('GET')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'barhead']), array ()); + if (!in_array($canonicalMethod, ['GET'])) { + $allow = array_merge($allow, ['GET']); goto not_barhead; } @@ -72,17 +72,17 @@ public function match($rawPathinfo) if (0 === strpos($pathinfo, '/test/baz')) { // baz if ('/test/baz' === $pathinfo) { - return array('_route' => 'baz'); + return ['_route' => 'baz']; } // baz2 if ('/test/baz.html' === $pathinfo) { - return array('_route' => 'baz2'); + return ['_route' => 'baz2']; } // baz3 if ('/test/baz3' === $trimmedPathinfo) { - $ret = array('_route' => 'baz3'); + $ret = ['_route' => 'baz3']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -99,7 +99,7 @@ public function match($rawPathinfo) // baz4 if (preg_match('#^/test/(?P<foo>[^/]++)/?$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz4']), array ()); if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -114,9 +114,9 @@ public function match($rawPathinfo) // baz5 if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); - if (!in_array($requestMethod, array('POST'))) { - $allow = array_merge($allow, array('POST')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz5']), array ()); + if (!in_array($requestMethod, ['POST'])) { + $allow = array_merge($allow, ['POST']); goto not_baz5; } @@ -126,9 +126,9 @@ public function match($rawPathinfo) // baz.baz6 if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); - if (!in_array($requestMethod, array('PUT'))) { - $allow = array_merge($allow, array('PUT')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'baz.baz6']), array ()); + if (!in_array($requestMethod, ['PUT'])) { + $allow = array_merge($allow, ['PUT']); goto not_bazbaz6; } @@ -140,42 +140,42 @@ public function match($rawPathinfo) // quoter if (preg_match('#^/(?P<quoter>[\']+)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'quoter']), array ()); } // space if ('/spa ce' === $pathinfo) { - return array('_route' => 'space'); + return ['_route' => 'space']; } if (0 === strpos($pathinfo, '/a')) { if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo1']), array ()); } // bar1 if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar1']), array ()); } } // overridden if (preg_match('#^/a/(?P<var>.*)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'overridden']), array ()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P<foo1>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo2']), array ()); } // bar2 if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar2']), array ()); } } @@ -185,12 +185,12 @@ public function match($rawPathinfo) elseif (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'helloWorld']), array ( 'who' => 'World!',)); } // hey if ('/multi/hey' === $trimmedPathinfo) { - $ret = array('_route' => 'hey'); + $ret = ['_route' => 'hey']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -205,30 +205,30 @@ public function match($rawPathinfo) // overridden2 if ('/multi/new' === $pathinfo) { - return array('_route' => 'overridden2'); + return ['_route' => 'overridden2']; } } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo3']), array ()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'bar3']), array ()); } if (0 === strpos($pathinfo, '/aba')) { // ababa if ('/ababa' === $pathinfo) { - return array('_route' => 'ababa'); + return ['_route' => 'ababa']; } // foo4 if (preg_match('#^/aba/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'foo4']), array ()); } } @@ -238,12 +238,12 @@ public function match($rawPathinfo) if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) { // route1 if ('/route1' === $pathinfo) { - return array('_route' => 'route1'); + return ['_route' => 'route1']; } // route2 if ('/c2/route2' === $pathinfo) { - return array('_route' => 'route2'); + return ['_route' => 'route2']; } } @@ -251,7 +251,7 @@ public function match($rawPathinfo) if (preg_match('#^b\\.example\\.com$#sDi', $host, $hostMatches)) { // route3 if ('/c2/route3' === $pathinfo) { - return array('_route' => 'route3'); + return ['_route' => 'route3']; } } @@ -259,7 +259,7 @@ public function match($rawPathinfo) if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) { // route4 if ('/route4' === $pathinfo) { - return array('_route' => 'route4'); + return ['_route' => 'route4']; } } @@ -267,36 +267,36 @@ public function match($rawPathinfo) if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) { // route5 if ('/route5' === $pathinfo) { - return array('_route' => 'route5'); + return ['_route' => 'route5']; } } // route6 if ('/route6' === $pathinfo) { - return array('_route' => 'route6'); + return ['_route' => 'route6']; } if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#sDi', $host, $hostMatches)) { if (0 === strpos($pathinfo, '/route1')) { // route11 if ('/route11' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route11']), array ()); } // route12 if ('/route12' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, ['_route' => 'route12']), array ( 'var1' => 'val',)); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route13']), array ()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, $matches, ['_route' => 'route14']), array ( 'var1' => 'val',)); } } @@ -306,42 +306,42 @@ public function match($rawPathinfo) if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'route15']), array ()); } } // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'route16']), array ( 'var1' => 'val',)); } // route17 if ('/route17' === $pathinfo) { - return array('_route' => 'route17'); + return ['_route' => 'route17']; } // a if ('/a/a...' === $pathinfo) { - return array('_route' => 'a'); + return ['_route' => 'a']; } if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'b']), array ()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'c']), array ()); } } // secure if ('/secure' === $pathinfo) { - $ret = array('_route' => 'secure'); + $ret = ['_route' => 'secure']; $requiredSchemes = array ( 'https' => 0,); if (!isset($requiredSchemes[$context->getScheme()])) { if ('GET' !== $canonicalMethod) { @@ -357,7 +357,7 @@ public function match($rawPathinfo) // nonsecure if ('/nonsecure' === $pathinfo) { - $ret = array('_route' => 'nonsecure'); + $ret = ['_route' => 'nonsecure']; $requiredSchemes = array ( 'http' => 0,); if (!isset($requiredSchemes[$context->getScheme()])) { if ('GET' !== $canonicalMethod) { diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php index 67c4667467e6f56bd4a6f0206e92adc9fe1860c0..03e540f696086f283cdddafa6302753372bccb19 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php @@ -17,7 +17,7 @@ public function __construct(RequestContext $context) public function match($rawPathinfo) { - $allow = array(); + $allow = []; $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; @@ -31,19 +31,19 @@ public function match($rawPathinfo) if (0 === strpos($pathinfo, '/rootprefix')) { // static if ('/rootprefix/test' === $pathinfo) { - return array('_route' => 'static'); + return ['_route' => 'static']; } // dynamic if (preg_match('#^/rootprefix/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'dynamic']), array ()); } } // with-condition if ('/with-condition' === $pathinfo && ($context->getMethod() == "GET")) { - return array('_route' => 'with-condition'); + return ['_route' => 'with-condition']; } if ('/' === $pathinfo && !$allow) { diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php index ed07194a260ecb0f33997e5883eb6669d9f06d0e..2585f12fe1e005c4514d85d06687707a07a829bf 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php @@ -17,7 +17,7 @@ public function __construct(RequestContext $context) public function match($rawPathinfo) { - $allow = array(); + $allow = []; $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; @@ -30,9 +30,9 @@ public function match($rawPathinfo) // just_head if ('/just_head' === $pathinfo) { - $ret = array('_route' => 'just_head'); - if (!in_array($requestMethod, array('HEAD'))) { - $allow = array_merge($allow, array('HEAD')); + $ret = ['_route' => 'just_head']; + if (!in_array($requestMethod, ['HEAD'])) { + $allow = array_merge($allow, ['HEAD']); goto not_just_head; } @@ -42,9 +42,9 @@ public function match($rawPathinfo) // head_and_get if ('/head_and_get' === $pathinfo) { - $ret = array('_route' => 'head_and_get'); - if (!in_array($canonicalMethod, array('HEAD', 'GET'))) { - $allow = array_merge($allow, array('HEAD', 'GET')); + $ret = ['_route' => 'head_and_get']; + if (!in_array($canonicalMethod, ['HEAD', 'GET'])) { + $allow = array_merge($allow, ['HEAD', 'GET']); goto not_head_and_get; } @@ -54,9 +54,9 @@ public function match($rawPathinfo) // get_and_head if ('/get_and_head' === $pathinfo) { - $ret = array('_route' => 'get_and_head'); - if (!in_array($canonicalMethod, array('GET', 'HEAD'))) { - $allow = array_merge($allow, array('GET', 'HEAD')); + $ret = ['_route' => 'get_and_head']; + if (!in_array($canonicalMethod, ['GET', 'HEAD'])) { + $allow = array_merge($allow, ['GET', 'HEAD']); goto not_get_and_head; } @@ -66,9 +66,9 @@ public function match($rawPathinfo) // post_and_head if ('/post_and_head' === $pathinfo) { - $ret = array('_route' => 'post_and_head'); - if (!in_array($requestMethod, array('POST', 'HEAD'))) { - $allow = array_merge($allow, array('POST', 'HEAD')); + $ret = ['_route' => 'post_and_head']; + if (!in_array($requestMethod, ['POST', 'HEAD'])) { + $allow = array_merge($allow, ['POST', 'HEAD']); goto not_post_and_head; } @@ -79,9 +79,9 @@ public function match($rawPathinfo) if (0 === strpos($pathinfo, '/put_and_post')) { // put_and_post if ('/put_and_post' === $pathinfo) { - $ret = array('_route' => 'put_and_post'); - if (!in_array($requestMethod, array('PUT', 'POST'))) { - $allow = array_merge($allow, array('PUT', 'POST')); + $ret = ['_route' => 'put_and_post']; + if (!in_array($requestMethod, ['PUT', 'POST'])) { + $allow = array_merge($allow, ['PUT', 'POST']); goto not_put_and_post; } @@ -91,9 +91,9 @@ public function match($rawPathinfo) // put_and_get_and_head if ('/put_and_post' === $pathinfo) { - $ret = array('_route' => 'put_and_get_and_head'); - if (!in_array($canonicalMethod, array('PUT', 'GET', 'HEAD'))) { - $allow = array_merge($allow, array('PUT', 'GET', 'HEAD')); + $ret = ['_route' => 'put_and_get_and_head']; + if (!in_array($canonicalMethod, ['PUT', 'GET', 'HEAD'])) { + $allow = array_merge($allow, ['PUT', 'GET', 'HEAD']); goto not_put_and_get_and_head; } diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php index 2b22513a6179de25cdc3ff1e15c6a23702fa4da7..ba0622343e5d7889cce1b38bb4af24d0fd4ce960 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php @@ -17,7 +17,7 @@ public function __construct(RequestContext $context) public function match($rawPathinfo) { - $allow = array(); + $allow = []; $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; @@ -31,30 +31,30 @@ public function match($rawPathinfo) if (0 === strpos($pathinfo, '/a')) { // a_first if ('/a/11' === $pathinfo) { - return array('_route' => 'a_first'); + return ['_route' => 'a_first']; } // a_second if ('/a/22' === $pathinfo) { - return array('_route' => 'a_second'); + return ['_route' => 'a_second']; } // a_third if ('/a/333' === $pathinfo) { - return array('_route' => 'a_third'); + return ['_route' => 'a_third']; } } // a_wildcard if (preg_match('#^/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'a_wildcard')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'a_wildcard']), array ()); } if (0 === strpos($pathinfo, '/a')) { // a_fourth if ('/a/44' === $trimmedPathinfo) { - $ret = array('_route' => 'a_fourth'); + $ret = ['_route' => 'a_fourth']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -69,7 +69,7 @@ public function match($rawPathinfo) // a_fifth if ('/a/55' === $trimmedPathinfo) { - $ret = array('_route' => 'a_fifth'); + $ret = ['_route' => 'a_fifth']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -84,7 +84,7 @@ public function match($rawPathinfo) // a_sixth if ('/a/66' === $trimmedPathinfo) { - $ret = array('_route' => 'a_sixth'); + $ret = ['_route' => 'a_sixth']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -101,13 +101,13 @@ public function match($rawPathinfo) // nested_wildcard if (0 === strpos($pathinfo, '/nested') && preg_match('#^/nested/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'nested_wildcard')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'nested_wildcard']), array ()); } if (0 === strpos($pathinfo, '/nested/group')) { // nested_a if ('/nested/group/a' === $trimmedPathinfo) { - $ret = array('_route' => 'nested_a'); + $ret = ['_route' => 'nested_a']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -122,7 +122,7 @@ public function match($rawPathinfo) // nested_b if ('/nested/group/b' === $trimmedPathinfo) { - $ret = array('_route' => 'nested_b'); + $ret = ['_route' => 'nested_b']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -137,7 +137,7 @@ public function match($rawPathinfo) // nested_c if ('/nested/group/c' === $trimmedPathinfo) { - $ret = array('_route' => 'nested_c'); + $ret = ['_route' => 'nested_c']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -155,7 +155,7 @@ public function match($rawPathinfo) elseif (0 === strpos($pathinfo, '/slashed/group')) { // slashed_a if ('/slashed/group' === $trimmedPathinfo) { - $ret = array('_route' => 'slashed_a'); + $ret = ['_route' => 'slashed_a']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -170,7 +170,7 @@ public function match($rawPathinfo) // slashed_b if ('/slashed/group/b' === $trimmedPathinfo) { - $ret = array('_route' => 'slashed_b'); + $ret = ['_route' => 'slashed_b']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -185,7 +185,7 @@ public function match($rawPathinfo) // slashed_c if ('/slashed/group/c' === $trimmedPathinfo) { - $ret = array('_route' => 'slashed_c'); + $ret = ['_route' => 'slashed_c']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php index 48ecdf81c001d3d340acfd1a8280f9af30467f40..a668f09d9b605cc7baeca9bce98cfc95c2e67876 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php @@ -17,7 +17,7 @@ public function __construct(RequestContext $context) public function match($rawPathinfo) { - $allow = array(); + $allow = []; $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; @@ -31,14 +31,14 @@ public function match($rawPathinfo) if (0 === strpos($pathinfo, '/trailing/simple')) { // simple_trailing_slash_no_methods if ('/trailing/simple/no-methods/' === $pathinfo) { - return array('_route' => 'simple_trailing_slash_no_methods'); + return ['_route' => 'simple_trailing_slash_no_methods']; } // simple_trailing_slash_GET_method if ('/trailing/simple/get-method/' === $pathinfo) { - $ret = array('_route' => 'simple_trailing_slash_GET_method'); - if (!in_array($canonicalMethod, array('GET'))) { - $allow = array_merge($allow, array('GET')); + $ret = ['_route' => 'simple_trailing_slash_GET_method']; + if (!in_array($canonicalMethod, ['GET'])) { + $allow = array_merge($allow, ['GET']); goto not_simple_trailing_slash_GET_method; } @@ -48,9 +48,9 @@ public function match($rawPathinfo) // simple_trailing_slash_HEAD_method if ('/trailing/simple/head-method/' === $pathinfo) { - $ret = array('_route' => 'simple_trailing_slash_HEAD_method'); - if (!in_array($requestMethod, array('HEAD'))) { - $allow = array_merge($allow, array('HEAD')); + $ret = ['_route' => 'simple_trailing_slash_HEAD_method']; + if (!in_array($requestMethod, ['HEAD'])) { + $allow = array_merge($allow, ['HEAD']); goto not_simple_trailing_slash_HEAD_method; } @@ -60,9 +60,9 @@ public function match($rawPathinfo) // simple_trailing_slash_POST_method if ('/trailing/simple/post-method/' === $pathinfo) { - $ret = array('_route' => 'simple_trailing_slash_POST_method'); - if (!in_array($requestMethod, array('POST'))) { - $allow = array_merge($allow, array('POST')); + $ret = ['_route' => 'simple_trailing_slash_POST_method']; + if (!in_array($requestMethod, ['POST'])) { + $allow = array_merge($allow, ['POST']); goto not_simple_trailing_slash_POST_method; } @@ -75,14 +75,14 @@ public function match($rawPathinfo) elseif (0 === strpos($pathinfo, '/trailing/regex')) { // regex_trailing_slash_no_methods if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_no_methods']), array ()); } // regex_trailing_slash_GET_method if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ()); - if (!in_array($canonicalMethod, array('GET'))) { - $allow = array_merge($allow, array('GET')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_GET_method']), array ()); + if (!in_array($canonicalMethod, ['GET'])) { + $allow = array_merge($allow, ['GET']); goto not_regex_trailing_slash_GET_method; } @@ -92,9 +92,9 @@ public function match($rawPathinfo) // regex_trailing_slash_HEAD_method if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ()); - if (!in_array($requestMethod, array('HEAD'))) { - $allow = array_merge($allow, array('HEAD')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_HEAD_method']), array ()); + if (!in_array($requestMethod, ['HEAD'])) { + $allow = array_merge($allow, ['HEAD']); goto not_regex_trailing_slash_HEAD_method; } @@ -104,9 +104,9 @@ public function match($rawPathinfo) // regex_trailing_slash_POST_method if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ()); - if (!in_array($requestMethod, array('POST'))) { - $allow = array_merge($allow, array('POST')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_POST_method']), array ()); + if (!in_array($requestMethod, ['POST'])) { + $allow = array_merge($allow, ['POST']); goto not_regex_trailing_slash_POST_method; } @@ -119,14 +119,14 @@ public function match($rawPathinfo) elseif (0 === strpos($pathinfo, '/not-trailing/simple')) { // simple_not_trailing_slash_no_methods if ('/not-trailing/simple/no-methods' === $pathinfo) { - return array('_route' => 'simple_not_trailing_slash_no_methods'); + return ['_route' => 'simple_not_trailing_slash_no_methods']; } // simple_not_trailing_slash_GET_method if ('/not-trailing/simple/get-method' === $pathinfo) { - $ret = array('_route' => 'simple_not_trailing_slash_GET_method'); - if (!in_array($canonicalMethod, array('GET'))) { - $allow = array_merge($allow, array('GET')); + $ret = ['_route' => 'simple_not_trailing_slash_GET_method']; + if (!in_array($canonicalMethod, ['GET'])) { + $allow = array_merge($allow, ['GET']); goto not_simple_not_trailing_slash_GET_method; } @@ -136,9 +136,9 @@ public function match($rawPathinfo) // simple_not_trailing_slash_HEAD_method if ('/not-trailing/simple/head-method' === $pathinfo) { - $ret = array('_route' => 'simple_not_trailing_slash_HEAD_method'); - if (!in_array($requestMethod, array('HEAD'))) { - $allow = array_merge($allow, array('HEAD')); + $ret = ['_route' => 'simple_not_trailing_slash_HEAD_method']; + if (!in_array($requestMethod, ['HEAD'])) { + $allow = array_merge($allow, ['HEAD']); goto not_simple_not_trailing_slash_HEAD_method; } @@ -148,9 +148,9 @@ public function match($rawPathinfo) // simple_not_trailing_slash_POST_method if ('/not-trailing/simple/post-method' === $pathinfo) { - $ret = array('_route' => 'simple_not_trailing_slash_POST_method'); - if (!in_array($requestMethod, array('POST'))) { - $allow = array_merge($allow, array('POST')); + $ret = ['_route' => 'simple_not_trailing_slash_POST_method']; + if (!in_array($requestMethod, ['POST'])) { + $allow = array_merge($allow, ['POST']); goto not_simple_not_trailing_slash_POST_method; } @@ -163,14 +163,14 @@ public function match($rawPathinfo) elseif (0 === strpos($pathinfo, '/not-trailing/regex')) { // regex_not_trailing_slash_no_methods if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_no_methods')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_no_methods']), array ()); } // regex_not_trailing_slash_GET_method if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ()); - if (!in_array($canonicalMethod, array('GET'))) { - $allow = array_merge($allow, array('GET')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_GET_method']), array ()); + if (!in_array($canonicalMethod, ['GET'])) { + $allow = array_merge($allow, ['GET']); goto not_regex_not_trailing_slash_GET_method; } @@ -180,9 +180,9 @@ public function match($rawPathinfo) // regex_not_trailing_slash_HEAD_method if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ()); - if (!in_array($requestMethod, array('HEAD'))) { - $allow = array_merge($allow, array('HEAD')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_HEAD_method']), array ()); + if (!in_array($requestMethod, ['HEAD'])) { + $allow = array_merge($allow, ['HEAD']); goto not_regex_not_trailing_slash_HEAD_method; } @@ -192,9 +192,9 @@ public function match($rawPathinfo) // regex_not_trailing_slash_POST_method if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ()); - if (!in_array($requestMethod, array('POST'))) { - $allow = array_merge($allow, array('POST')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_POST_method']), array ()); + if (!in_array($requestMethod, ['POST'])) { + $allow = array_merge($allow, ['POST']); goto not_regex_not_trailing_slash_POST_method; } diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php index 81d76ea4a047addfa3f9542be7604441811cac6f..c7f8852c5d4ec9bae46bac2cf87bff769cc8e680 100644 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php +++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php @@ -17,7 +17,7 @@ public function __construct(RequestContext $context) public function match($rawPathinfo) { - $allow = array(); + $allow = []; $pathinfo = rawurldecode($rawPathinfo); $trimmedPathinfo = rtrim($pathinfo, '/'); $context = $this->context; @@ -31,7 +31,7 @@ public function match($rawPathinfo) if (0 === strpos($pathinfo, '/trailing/simple')) { // simple_trailing_slash_no_methods if ('/trailing/simple/no-methods' === $trimmedPathinfo) { - $ret = array('_route' => 'simple_trailing_slash_no_methods'); + $ret = ['_route' => 'simple_trailing_slash_no_methods']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -46,7 +46,7 @@ public function match($rawPathinfo) // simple_trailing_slash_GET_method if ('/trailing/simple/get-method' === $trimmedPathinfo) { - $ret = array('_route' => 'simple_trailing_slash_GET_method'); + $ret = ['_route' => 'simple_trailing_slash_GET_method']; if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -55,8 +55,8 @@ public function match($rawPathinfo) return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_GET_method')); } - if (!in_array($canonicalMethod, array('GET'))) { - $allow = array_merge($allow, array('GET')); + if (!in_array($canonicalMethod, ['GET'])) { + $allow = array_merge($allow, ['GET']); goto not_simple_trailing_slash_GET_method; } @@ -66,9 +66,9 @@ public function match($rawPathinfo) // simple_trailing_slash_HEAD_method if ('/trailing/simple/head-method/' === $pathinfo) { - $ret = array('_route' => 'simple_trailing_slash_HEAD_method'); - if (!in_array($requestMethod, array('HEAD'))) { - $allow = array_merge($allow, array('HEAD')); + $ret = ['_route' => 'simple_trailing_slash_HEAD_method']; + if (!in_array($requestMethod, ['HEAD'])) { + $allow = array_merge($allow, ['HEAD']); goto not_simple_trailing_slash_HEAD_method; } @@ -78,9 +78,9 @@ public function match($rawPathinfo) // simple_trailing_slash_POST_method if ('/trailing/simple/post-method/' === $pathinfo) { - $ret = array('_route' => 'simple_trailing_slash_POST_method'); - if (!in_array($requestMethod, array('POST'))) { - $allow = array_merge($allow, array('POST')); + $ret = ['_route' => 'simple_trailing_slash_POST_method']; + if (!in_array($requestMethod, ['POST'])) { + $allow = array_merge($allow, ['POST']); goto not_simple_trailing_slash_POST_method; } @@ -93,7 +93,7 @@ public function match($rawPathinfo) elseif (0 === strpos($pathinfo, '/trailing/regex')) { // regex_trailing_slash_no_methods if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P<param>[^/]++)/?$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_no_methods']), array ()); if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -108,7 +108,7 @@ public function match($rawPathinfo) // regex_trailing_slash_GET_method if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P<param>[^/]++)/?$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ()); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_GET_method']), array ()); if ('/' === substr($pathinfo, -1)) { // no-op } elseif ('GET' !== $canonicalMethod) { @@ -117,8 +117,8 @@ public function match($rawPathinfo) return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_GET_method')); } - if (!in_array($canonicalMethod, array('GET'))) { - $allow = array_merge($allow, array('GET')); + if (!in_array($canonicalMethod, ['GET'])) { + $allow = array_merge($allow, ['GET']); goto not_regex_trailing_slash_GET_method; } @@ -128,9 +128,9 @@ public function match($rawPathinfo) // regex_trailing_slash_HEAD_method if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ()); - if (!in_array($requestMethod, array('HEAD'))) { - $allow = array_merge($allow, array('HEAD')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_HEAD_method']), array ()); + if (!in_array($requestMethod, ['HEAD'])) { + $allow = array_merge($allow, ['HEAD']); goto not_regex_trailing_slash_HEAD_method; } @@ -140,9 +140,9 @@ public function match($rawPathinfo) // regex_trailing_slash_POST_method if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ()); - if (!in_array($requestMethod, array('POST'))) { - $allow = array_merge($allow, array('POST')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_trailing_slash_POST_method']), array ()); + if (!in_array($requestMethod, ['POST'])) { + $allow = array_merge($allow, ['POST']); goto not_regex_trailing_slash_POST_method; } @@ -155,14 +155,14 @@ public function match($rawPathinfo) elseif (0 === strpos($pathinfo, '/not-trailing/simple')) { // simple_not_trailing_slash_no_methods if ('/not-trailing/simple/no-methods' === $pathinfo) { - return array('_route' => 'simple_not_trailing_slash_no_methods'); + return ['_route' => 'simple_not_trailing_slash_no_methods']; } // simple_not_trailing_slash_GET_method if ('/not-trailing/simple/get-method' === $pathinfo) { - $ret = array('_route' => 'simple_not_trailing_slash_GET_method'); - if (!in_array($canonicalMethod, array('GET'))) { - $allow = array_merge($allow, array('GET')); + $ret = ['_route' => 'simple_not_trailing_slash_GET_method']; + if (!in_array($canonicalMethod, ['GET'])) { + $allow = array_merge($allow, ['GET']); goto not_simple_not_trailing_slash_GET_method; } @@ -172,9 +172,9 @@ public function match($rawPathinfo) // simple_not_trailing_slash_HEAD_method if ('/not-trailing/simple/head-method' === $pathinfo) { - $ret = array('_route' => 'simple_not_trailing_slash_HEAD_method'); - if (!in_array($requestMethod, array('HEAD'))) { - $allow = array_merge($allow, array('HEAD')); + $ret = ['_route' => 'simple_not_trailing_slash_HEAD_method']; + if (!in_array($requestMethod, ['HEAD'])) { + $allow = array_merge($allow, ['HEAD']); goto not_simple_not_trailing_slash_HEAD_method; } @@ -184,9 +184,9 @@ public function match($rawPathinfo) // simple_not_trailing_slash_POST_method if ('/not-trailing/simple/post-method' === $pathinfo) { - $ret = array('_route' => 'simple_not_trailing_slash_POST_method'); - if (!in_array($requestMethod, array('POST'))) { - $allow = array_merge($allow, array('POST')); + $ret = ['_route' => 'simple_not_trailing_slash_POST_method']; + if (!in_array($requestMethod, ['POST'])) { + $allow = array_merge($allow, ['POST']); goto not_simple_not_trailing_slash_POST_method; } @@ -199,14 +199,14 @@ public function match($rawPathinfo) elseif (0 === strpos($pathinfo, '/not-trailing/regex')) { // regex_not_trailing_slash_no_methods if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_no_methods')), array ()); + return $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_no_methods']), array ()); } // regex_not_trailing_slash_GET_method if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ()); - if (!in_array($canonicalMethod, array('GET'))) { - $allow = array_merge($allow, array('GET')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_GET_method']), array ()); + if (!in_array($canonicalMethod, ['GET'])) { + $allow = array_merge($allow, ['GET']); goto not_regex_not_trailing_slash_GET_method; } @@ -216,9 +216,9 @@ public function match($rawPathinfo) // regex_not_trailing_slash_HEAD_method if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ()); - if (!in_array($requestMethod, array('HEAD'))) { - $allow = array_merge($allow, array('HEAD')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_HEAD_method']), array ()); + if (!in_array($requestMethod, ['HEAD'])) { + $allow = array_merge($allow, ['HEAD']); goto not_regex_not_trailing_slash_HEAD_method; } @@ -228,9 +228,9 @@ public function match($rawPathinfo) // regex_not_trailing_slash_POST_method if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) { - $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ()); - if (!in_array($requestMethod, array('POST'))) { - $allow = array_merge($allow, array('POST')); + $ret = $this->mergeDefaults(array_replace($matches, ['_route' => 'regex_not_trailing_slash_POST_method']), array ()); + if (!in_array($requestMethod, ['POST'])) { + $allow = array_merge($allow, ['POST']); goto not_regex_not_trailing_slash_POST_method; } diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_bar.php b/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_bar.php index e2b91b17da4908c10d3646417d96dbb08af59926..e6ccf24f4e5299643b145a97d771d678109ac7d2 100644 --- a/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_bar.php +++ b/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_bar.php @@ -6,7 +6,7 @@ $collection = $routes->collection(); $collection->add('bar_route', '/bar') - ->defaults(array('_controller' => 'AppBundle:Bar:view')); + ->defaults(['_controller' => 'AppBundle:Bar:view']); return $collection; }; diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_baz.php b/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_baz.php index ca8f188a7633ece06b1ecbc687b9ff9ec9f3bda7..cce65d7054f9604da7f611d4aea214e8251a324c 100644 --- a/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_baz.php +++ b/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_baz.php @@ -6,7 +6,7 @@ $collection = $routes->collection(); $collection->add('baz_route', '/baz') - ->defaults(array('_controller' => 'AppBundle:Baz:view')); + ->defaults(['_controller' => 'AppBundle:Baz:view']); return $collection; }; diff --git a/vendor/symfony/routing/Tests/Fixtures/php_dsl.php b/vendor/symfony/routing/Tests/Fixtures/php_dsl.php index 0780c9fa80f1d59b517d85130f4af017a732a30c..73da01248403e34fc632d818c97246d6cd1c296a 100644 --- a/vendor/symfony/routing/Tests/Fixtures/php_dsl.php +++ b/vendor/symfony/routing/Tests/Fixtures/php_dsl.php @@ -7,16 +7,16 @@ ->collection() ->add('foo', '/foo') ->condition('abc') - ->options(array('utf8' => true)) + ->options(['utf8' => true]) ->add('buz', 'zub') ->controller('foo:act'); $routes->import('php_dsl_sub.php') ->prefix('/sub') - ->requirements(array('id' => '\d+')); + ->requirements(['id' => '\d+']); $routes->add('ouf', '/ouf') - ->schemes(array('https')) - ->methods(array('GET')) - ->defaults(array('id' => 0)); + ->schemes(['https']) + ->methods(['GET']) + ->defaults(['id' => 0]); }; diff --git a/vendor/symfony/routing/Tests/Fixtures/validpattern.php b/vendor/symfony/routing/Tests/Fixtures/validpattern.php index 52ddfde0208f8de606f9e9f7367da10de7daf45d..3ef0e14862f2a74233b04a28a60e99d54a057fd1 100644 --- a/vendor/symfony/routing/Tests/Fixtures/validpattern.php +++ b/vendor/symfony/routing/Tests/Fixtures/validpattern.php @@ -6,12 +6,12 @@ $collection = new RouteCollection(); $collection->add('blog_show', new Route( '/blog/{slug}', - array('_controller' => 'MyBlogBundle:Blog:show'), - array('locale' => '\w+'), - array('compiler_class' => 'RouteCompiler'), + ['_controller' => 'MyBlogBundle:Blog:show'], + ['locale' => '\w+'], + ['compiler_class' => 'RouteCompiler'], '{locale}.example.com', - array('https'), - array('GET', 'POST', 'put', 'OpTiOnS'), + ['https'], + ['GET', 'POST', 'put', 'OpTiOnS'], 'context.getMethod() == "GET"' )); diff --git a/vendor/symfony/routing/Tests/Fixtures/validresource.php b/vendor/symfony/routing/Tests/Fixtures/validresource.php index 482c80b29e919e0d06c4ef62e7e65e376b955302..31d354a34cd0082d0b989142fc1a2a50c3bbb70a 100644 --- a/vendor/symfony/routing/Tests/Fixtures/validresource.php +++ b/vendor/symfony/routing/Tests/Fixtures/validresource.php @@ -3,15 +3,15 @@ /** @var $loader \Symfony\Component\Routing\Loader\PhpFileLoader */ /** @var \Symfony\Component\Routing\RouteCollection $collection */ $collection = $loader->import('validpattern.php'); -$collection->addDefaults(array( +$collection->addDefaults([ 'foo' => 123, -)); -$collection->addRequirements(array( +]); +$collection->addRequirements([ 'foo' => '\d+', -)); -$collection->addOptions(array( +]); +$collection->addOptions([ 'foo' => 'bar', -)); +]); $collection->setCondition('context.getMethod() == "POST"'); $collection->addPrefix('/prefix'); diff --git a/vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php b/vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php index 32dc83e83e24c480b4b1d00afd8bf007c22d4ae9..a6a47b4ba2fd0870567fe22183f580ccdc815c34 100644 --- a/vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php +++ b/vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php @@ -73,10 +73,10 @@ public function testDumpWithRoutes() $projectUrlGenerator = new \ProjectUrlGenerator(new RequestContext('/app.php')); - $absoluteUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL); - $absoluteUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_URL); - $relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH); - $relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_PATH); + $absoluteUrlWithParameter = $projectUrlGenerator->generate('Test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_URL); + $absoluteUrlWithoutParameter = $projectUrlGenerator->generate('Test2', [], UrlGeneratorInterface::ABSOLUTE_URL); + $relativeUrlWithParameter = $projectUrlGenerator->generate('Test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_PATH); + $relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', [], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('http://localhost/app.php/testing/bar', $absoluteUrlWithParameter); $this->assertEquals('http://localhost/app.php/testing2', $absoluteUrlWithoutParameter); @@ -96,18 +96,18 @@ public function testDumpWithTooManyRoutes() } $this->routeCollection->add('Test2', new Route('/testing2')); - file_put_contents($this->largeTestTmpFilepath, $this->generatorDumper->dump(array( + file_put_contents($this->largeTestTmpFilepath, $this->generatorDumper->dump([ 'class' => 'ProjectLargeUrlGenerator', - ))); + ])); $this->routeCollection = $this->generatorDumper = null; include $this->largeTestTmpFilepath; $projectUrlGenerator = new \ProjectLargeUrlGenerator(new RequestContext('/app.php')); - $absoluteUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL); - $absoluteUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_URL); - $relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH); - $relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_PATH); + $absoluteUrlWithParameter = $projectUrlGenerator->generate('Test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_URL); + $absoluteUrlWithoutParameter = $projectUrlGenerator->generate('Test2', [], UrlGeneratorInterface::ABSOLUTE_URL); + $relativeUrlWithParameter = $projectUrlGenerator->generate('Test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_PATH); + $relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', [], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('http://localhost/app.php/testing/bar', $absoluteUrlWithParameter); $this->assertEquals('http://localhost/app.php/testing2', $absoluteUrlWithoutParameter); @@ -120,12 +120,12 @@ public function testDumpWithTooManyRoutes() */ public function testDumpWithoutRoutes() { - file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'WithoutRoutesUrlGenerator'))); + file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(['class' => 'WithoutRoutesUrlGenerator'])); include $this->testTmpFilepath; $projectUrlGenerator = new \WithoutRoutesUrlGenerator(new RequestContext('/app.php')); - $projectUrlGenerator->generate('Test', array()); + $projectUrlGenerator->generate('Test', []); } /** @@ -135,45 +135,45 @@ public function testGenerateNonExistingRoute() { $this->routeCollection->add('Test', new Route('/test')); - file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'NonExistingRoutesUrlGenerator'))); + file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(['class' => 'NonExistingRoutesUrlGenerator'])); include $this->testTmpFilepath; $projectUrlGenerator = new \NonExistingRoutesUrlGenerator(new RequestContext()); - $url = $projectUrlGenerator->generate('NonExisting', array()); + $url = $projectUrlGenerator->generate('NonExisting', []); } public function testDumpForRouteWithDefaults() { - $this->routeCollection->add('Test', new Route('/testing/{foo}', array('foo' => 'bar'))); + $this->routeCollection->add('Test', new Route('/testing/{foo}', ['foo' => 'bar'])); - file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'DefaultRoutesUrlGenerator'))); + file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(['class' => 'DefaultRoutesUrlGenerator'])); include $this->testTmpFilepath; $projectUrlGenerator = new \DefaultRoutesUrlGenerator(new RequestContext()); - $url = $projectUrlGenerator->generate('Test', array()); + $url = $projectUrlGenerator->generate('Test', []); $this->assertEquals('/testing', $url); } public function testDumpWithSchemeRequirement() { - $this->routeCollection->add('Test1', new Route('/testing', array(), array(), array(), '', array('ftp', 'https'))); + $this->routeCollection->add('Test1', new Route('/testing', [], [], [], '', ['ftp', 'https'])); - file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'SchemeUrlGenerator'))); + file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(['class' => 'SchemeUrlGenerator'])); include $this->testTmpFilepath; $projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php')); - $absoluteUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_URL); - $relativeUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_PATH); + $absoluteUrl = $projectUrlGenerator->generate('Test1', [], UrlGeneratorInterface::ABSOLUTE_URL); + $relativeUrl = $projectUrlGenerator->generate('Test1', [], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('ftp://localhost/app.php/testing', $absoluteUrl); $this->assertEquals('ftp://localhost/app.php/testing', $relativeUrl); $projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php', 'GET', 'localhost', 'https')); - $absoluteUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_URL); - $relativeUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_PATH); + $absoluteUrl = $projectUrlGenerator->generate('Test1', [], UrlGeneratorInterface::ABSOLUTE_URL); + $relativeUrl = $projectUrlGenerator->generate('Test1', [], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('https://localhost/app.php/testing', $absoluteUrl); $this->assertEquals('/app.php/testing', $relativeUrl); diff --git a/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php b/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php index d4bf18ccac929236a86300b88d80c70ad11cc5b6..7f64a1f378326067b8b536e155828b7abde07f22 100644 --- a/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php +++ b/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php @@ -23,7 +23,7 @@ class UrlGeneratorTest extends TestCase public function testAbsoluteUrlWithPort80() { $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); + $url = $this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL); $this->assertEquals('http://localhost/app.php/testing', $url); } @@ -31,7 +31,7 @@ public function testAbsoluteUrlWithPort80() public function testAbsoluteSecureUrlWithPort443() { $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes, array('scheme' => 'https'))->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); + $url = $this->getGenerator($routes, ['scheme' => 'https'])->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL); $this->assertEquals('https://localhost/app.php/testing', $url); } @@ -39,7 +39,7 @@ public function testAbsoluteSecureUrlWithPort443() public function testAbsoluteUrlWithNonStandardPort() { $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes, array('httpPort' => 8080))->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); + $url = $this->getGenerator($routes, ['httpPort' => 8080])->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL); $this->assertEquals('http://localhost:8080/app.php/testing', $url); } @@ -47,7 +47,7 @@ public function testAbsoluteUrlWithNonStandardPort() public function testAbsoluteSecureUrlWithNonStandardPort() { $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes, array('httpsPort' => 8080, 'scheme' => 'https'))->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); + $url = $this->getGenerator($routes, ['httpsPort' => 8080, 'scheme' => 'https'])->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL); $this->assertEquals('https://localhost:8080/app.php/testing', $url); } @@ -55,7 +55,7 @@ public function testAbsoluteSecureUrlWithNonStandardPort() public function testRelativeUrlWithoutParameters() { $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_PATH); + $url = $this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('/app.php/testing', $url); } @@ -63,15 +63,15 @@ public function testRelativeUrlWithoutParameters() public function testRelativeUrlWithParameter() { $routes = $this->getRoutes('test', new Route('/testing/{foo}')); - $url = $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH); + $url = $this->getGenerator($routes)->generate('test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('/app.php/testing/bar', $url); } public function testRelativeUrlWithNullParameter() { - $routes = $this->getRoutes('test', new Route('/testing.{format}', array('format' => null))); - $url = $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_PATH); + $routes = $this->getRoutes('test', new Route('/testing.{format}', ['format' => null])); + $url = $this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('/app.php/testing', $url); } @@ -81,31 +81,31 @@ public function testRelativeUrlWithNullParameter() */ public function testRelativeUrlWithNullParameterButNotOptional() { - $routes = $this->getRoutes('test', new Route('/testing/{foo}/bar', array('foo' => null))); + $routes = $this->getRoutes('test', new Route('/testing/{foo}/bar', ['foo' => null])); // This must raise an exception because the default requirement for "foo" is "[^/]+" which is not met with these params. // Generating path "/testing//bar" would be wrong as matching this route would fail. - $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_PATH); + $this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_PATH); } public function testRelativeUrlWithOptionalZeroParameter() { $routes = $this->getRoutes('test', new Route('/testing/{page}')); - $url = $this->getGenerator($routes)->generate('test', array('page' => 0), UrlGeneratorInterface::ABSOLUTE_PATH); + $url = $this->getGenerator($routes)->generate('test', ['page' => 0], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('/app.php/testing/0', $url); } public function testNotPassedOptionalParameterInBetween() { - $routes = $this->getRoutes('test', new Route('/{slug}/{page}', array('slug' => 'index', 'page' => 0))); - $this->assertSame('/app.php/index/1', $this->getGenerator($routes)->generate('test', array('page' => 1))); + $routes = $this->getRoutes('test', new Route('/{slug}/{page}', ['slug' => 'index', 'page' => 0])); + $this->assertSame('/app.php/index/1', $this->getGenerator($routes)->generate('test', ['page' => 1])); $this->assertSame('/app.php/', $this->getGenerator($routes)->generate('test')); } public function testRelativeUrlWithExtraParameters() { $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH); + $url = $this->getGenerator($routes)->generate('test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('/app.php/testing?foo=bar', $url); } @@ -113,7 +113,7 @@ public function testRelativeUrlWithExtraParameters() public function testAbsoluteUrlWithExtraParameters() { $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL); + $url = $this->getGenerator($routes)->generate('test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_URL); $this->assertEquals('http://localhost/app.php/testing?foo=bar', $url); } @@ -121,7 +121,7 @@ public function testAbsoluteUrlWithExtraParameters() public function testUrlWithNullExtraParameters() { $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array('foo' => null), UrlGeneratorInterface::ABSOLUTE_URL); + $url = $this->getGenerator($routes)->generate('test', ['foo' => null], UrlGeneratorInterface::ABSOLUTE_URL); $this->assertEquals('http://localhost/app.php/testing', $url); } @@ -133,7 +133,7 @@ public function testUrlWithExtraParametersFromGlobals() $context = new RequestContext('/app.php'); $context->setParameter('bar', 'bar'); $generator->setContext($context); - $url = $generator->generate('test', array('foo' => 'bar')); + $url = $generator->generate('test', ['foo' => 'bar']); $this->assertEquals('/app.php/testing?foo=bar', $url); } @@ -145,19 +145,19 @@ public function testUrlWithGlobalParameter() $context = new RequestContext('/app.php'); $context->setParameter('foo', 'bar'); $generator->setContext($context); - $url = $generator->generate('test', array()); + $url = $generator->generate('test', []); $this->assertEquals('/app.php/testing/bar', $url); } public function testGlobalParameterHasHigherPriorityThanDefault() { - $routes = $this->getRoutes('test', new Route('/{_locale}', array('_locale' => 'en'))); + $routes = $this->getRoutes('test', new Route('/{_locale}', ['_locale' => 'en'])); $generator = $this->getGenerator($routes); $context = new RequestContext('/app.php'); $context->setParameter('_locale', 'de'); $generator->setContext($context); - $url = $generator->generate('test', array()); + $url = $generator->generate('test', []); $this->assertSame('/app.php/de', $url); } @@ -168,7 +168,7 @@ public function testGlobalParameterHasHigherPriorityThanDefault() public function testGenerateWithoutRoutes() { $routes = $this->getRoutes('foo', new Route('/testing/{foo}')); - $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); + $this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL); } /** @@ -177,7 +177,7 @@ public function testGenerateWithoutRoutes() public function testGenerateForRouteWithoutMandatoryParameter() { $routes = $this->getRoutes('test', new Route('/testing/{foo}')); - $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); + $this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL); } /** @@ -185,8 +185,8 @@ public function testGenerateForRouteWithoutMandatoryParameter() */ public function testGenerateForRouteWithInvalidOptionalParameter() { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); - $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL); + $routes = $this->getRoutes('test', new Route('/testing/{foo}', ['foo' => '1'], ['foo' => 'd+'])); + $this->getGenerator($routes)->generate('test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_URL); } /** @@ -194,35 +194,35 @@ public function testGenerateForRouteWithInvalidOptionalParameter() */ public function testGenerateForRouteWithInvalidParameter() { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array(), array('foo' => '1|2'))); - $this->getGenerator($routes)->generate('test', array('foo' => '0'), UrlGeneratorInterface::ABSOLUTE_URL); + $routes = $this->getRoutes('test', new Route('/testing/{foo}', [], ['foo' => '1|2'])); + $this->getGenerator($routes)->generate('test', ['foo' => '0'], UrlGeneratorInterface::ABSOLUTE_URL); } public function testGenerateForRouteWithInvalidOptionalParameterNonStrict() { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); + $routes = $this->getRoutes('test', new Route('/testing/{foo}', ['foo' => '1'], ['foo' => 'd+'])); $generator = $this->getGenerator($routes); $generator->setStrictRequirements(false); - $this->assertNull($generator->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL)); + $this->assertNull($generator->generate('test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_URL)); } public function testGenerateForRouteWithInvalidOptionalParameterNonStrictWithLogger() { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); + $routes = $this->getRoutes('test', new Route('/testing/{foo}', ['foo' => '1'], ['foo' => 'd+'])); $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $logger->expects($this->once()) ->method('error'); - $generator = $this->getGenerator($routes, array(), $logger); + $generator = $this->getGenerator($routes, [], $logger); $generator->setStrictRequirements(false); - $this->assertNull($generator->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL)); + $this->assertNull($generator->generate('test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_URL)); } public function testGenerateForRouteWithInvalidParameterButDisabledRequirementsCheck() { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); + $routes = $this->getRoutes('test', new Route('/testing/{foo}', ['foo' => '1'], ['foo' => 'd+'])); $generator = $this->getGenerator($routes); $generator->setStrictRequirements(null); - $this->assertSame('/app.php/testing/bar', $generator->generate('test', array('foo' => 'bar'))); + $this->assertSame('/app.php/testing/bar', $generator->generate('test', ['foo' => 'bar'])); } /** @@ -230,8 +230,8 @@ public function testGenerateForRouteWithInvalidParameterButDisabledRequirementsC */ public function testGenerateForRouteWithInvalidMandatoryParameter() { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array(), array('foo' => 'd+'))); - $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL); + $routes = $this->getRoutes('test', new Route('/testing/{foo}', [], ['foo' => 'd+'])); + $this->getGenerator($routes)->generate('test', ['foo' => 'bar'], UrlGeneratorInterface::ABSOLUTE_URL); } /** @@ -239,8 +239,8 @@ public function testGenerateForRouteWithInvalidMandatoryParameter() */ public function testGenerateForRouteWithInvalidUtf8Parameter() { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array(), array('foo' => '\pL+'), array('utf8' => true))); - $this->getGenerator($routes)->generate('test', array('foo' => 'abc123'), UrlGeneratorInterface::ABSOLUTE_URL); + $routes = $this->getRoutes('test', new Route('/testing/{foo}', [], ['foo' => '\pL+'], ['utf8' => true])); + $this->getGenerator($routes)->generate('test', ['foo' => 'abc123'], UrlGeneratorInterface::ABSOLUTE_URL); } /** @@ -248,31 +248,31 @@ public function testGenerateForRouteWithInvalidUtf8Parameter() */ public function testRequiredParamAndEmptyPassed() { - $routes = $this->getRoutes('test', new Route('/{slug}', array(), array('slug' => '.+'))); - $this->getGenerator($routes)->generate('test', array('slug' => '')); + $routes = $this->getRoutes('test', new Route('/{slug}', [], ['slug' => '.+'])); + $this->getGenerator($routes)->generate('test', ['slug' => '']); } public function testSchemeRequirementDoesNothingIfSameCurrentScheme() { - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('http'))); + $routes = $this->getRoutes('test', new Route('/', [], [], [], '', ['http'])); $this->assertEquals('/app.php/', $this->getGenerator($routes)->generate('test')); - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('https'))); - $this->assertEquals('/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test')); + $routes = $this->getRoutes('test', new Route('/', [], [], [], '', ['https'])); + $this->assertEquals('/app.php/', $this->getGenerator($routes, ['scheme' => 'https'])->generate('test')); } public function testSchemeRequirementForcesAbsoluteUrl() { - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('https'))); + $routes = $this->getRoutes('test', new Route('/', [], [], [], '', ['https'])); $this->assertEquals('https://localhost/app.php/', $this->getGenerator($routes)->generate('test')); - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('http'))); - $this->assertEquals('http://localhost/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test')); + $routes = $this->getRoutes('test', new Route('/', [], [], [], '', ['http'])); + $this->assertEquals('http://localhost/app.php/', $this->getGenerator($routes, ['scheme' => 'https'])->generate('test')); } public function testSchemeRequirementCreatesUrlForFirstRequiredScheme() { - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('Ftp', 'https'))); + $routes = $this->getRoutes('test', new Route('/', [], [], [], '', ['Ftp', 'https'])); $this->assertEquals('ftp://localhost/app.php/', $this->getGenerator($routes)->generate('test')); } @@ -281,48 +281,48 @@ public function testPathWithTwoStartingSlashes() $routes = $this->getRoutes('test', new Route('//path-and-not-domain')); // this must not generate '//path-and-not-domain' because that would be a network path - $this->assertSame('/path-and-not-domain', $this->getGenerator($routes, array('BaseUrl' => ''))->generate('test')); + $this->assertSame('/path-and-not-domain', $this->getGenerator($routes, ['BaseUrl' => ''])->generate('test')); } public function testNoTrailingSlashForMultipleOptionalParameters() { - $routes = $this->getRoutes('test', new Route('/category/{slug1}/{slug2}/{slug3}', array('slug2' => null, 'slug3' => null))); + $routes = $this->getRoutes('test', new Route('/category/{slug1}/{slug2}/{slug3}', ['slug2' => null, 'slug3' => null])); - $this->assertEquals('/app.php/category/foo', $this->getGenerator($routes)->generate('test', array('slug1' => 'foo'))); + $this->assertEquals('/app.php/category/foo', $this->getGenerator($routes)->generate('test', ['slug1' => 'foo'])); } public function testWithAnIntegerAsADefaultValue() { - $routes = $this->getRoutes('test', new Route('/{default}', array('default' => 0))); + $routes = $this->getRoutes('test', new Route('/{default}', ['default' => 0])); - $this->assertEquals('/app.php/foo', $this->getGenerator($routes)->generate('test', array('default' => 'foo'))); + $this->assertEquals('/app.php/foo', $this->getGenerator($routes)->generate('test', ['default' => 'foo'])); } public function testNullForOptionalParameterIsIgnored() { - $routes = $this->getRoutes('test', new Route('/test/{default}', array('default' => 0))); + $routes = $this->getRoutes('test', new Route('/test/{default}', ['default' => 0])); - $this->assertEquals('/app.php/test', $this->getGenerator($routes)->generate('test', array('default' => null))); + $this->assertEquals('/app.php/test', $this->getGenerator($routes)->generate('test', ['default' => null])); } public function testQueryParamSameAsDefault() { - $routes = $this->getRoutes('test', new Route('/test', array('page' => 1))); + $routes = $this->getRoutes('test', new Route('/test', ['page' => 1])); - $this->assertSame('/app.php/test?page=2', $this->getGenerator($routes)->generate('test', array('page' => 2))); - $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', array('page' => 1))); - $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', array('page' => '1'))); + $this->assertSame('/app.php/test?page=2', $this->getGenerator($routes)->generate('test', ['page' => 2])); + $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', ['page' => 1])); + $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', ['page' => '1'])); $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test')); } public function testArrayQueryParamSameAsDefault() { - $routes = $this->getRoutes('test', new Route('/test', array('array' => array('foo', 'bar')))); + $routes = $this->getRoutes('test', new Route('/test', ['array' => ['foo', 'bar']])); - $this->assertSame('/app.php/test?array%5B0%5D=bar&array%5B1%5D=foo', $this->getGenerator($routes)->generate('test', array('array' => array('bar', 'foo')))); - $this->assertSame('/app.php/test?array%5Ba%5D=foo&array%5Bb%5D=bar', $this->getGenerator($routes)->generate('test', array('array' => array('a' => 'foo', 'b' => 'bar')))); - $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', array('array' => array('foo', 'bar')))); - $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', array('array' => array(1 => 'bar', 0 => 'foo')))); + $this->assertSame('/app.php/test?array%5B0%5D=bar&array%5B1%5D=foo', $this->getGenerator($routes)->generate('test', ['array' => ['bar', 'foo']])); + $this->assertSame('/app.php/test?array%5Ba%5D=foo&array%5Bb%5D=bar', $this->getGenerator($routes)->generate('test', ['array' => ['a' => 'foo', 'b' => 'bar']])); + $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', ['array' => ['foo', 'bar']])); + $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', ['array' => [1 => 'bar', 0 => 'foo']])); $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test')); } @@ -342,11 +342,11 @@ public function testUrlEncoding() // This tests the encoding of reserved characters that are used for delimiting of URI components (defined in RFC 3986) // and other special ASCII chars. These chars are tested as static text path, variable path and query param. $chars = '@:[]/()*\'" +,;-._~&$<>|{}%\\^`!?foo=bar#id'; - $routes = $this->getRoutes('test', new Route("/$chars/{varpath}", array(), array('varpath' => '.+'))); - $this->assertSame($expectedPath, $this->getGenerator($routes)->generate('test', array( + $routes = $this->getRoutes('test', new Route("/$chars/{varpath}", [], ['varpath' => '.+'])); + $this->assertSame($expectedPath, $this->getGenerator($routes)->generate('test', [ 'varpath' => $chars, 'query' => $chars, - ))); + ])); } public function testEncodingOfRelativePathSegments() @@ -361,24 +361,24 @@ public function testEncodingOfRelativePathSegments() public function testAdjacentVariables() { - $routes = $this->getRoutes('test', new Route('/{x}{y}{z}.{_format}', array('z' => 'default-z', '_format' => 'html'), array('y' => '\d+'))); + $routes = $this->getRoutes('test', new Route('/{x}{y}{z}.{_format}', ['z' => 'default-z', '_format' => 'html'], ['y' => '\d+'])); $generator = $this->getGenerator($routes); - $this->assertSame('/app.php/foo123', $generator->generate('test', array('x' => 'foo', 'y' => '123'))); - $this->assertSame('/app.php/foo123bar.xml', $generator->generate('test', array('x' => 'foo', 'y' => '123', 'z' => 'bar', '_format' => 'xml'))); + $this->assertSame('/app.php/foo123', $generator->generate('test', ['x' => 'foo', 'y' => '123'])); + $this->assertSame('/app.php/foo123bar.xml', $generator->generate('test', ['x' => 'foo', 'y' => '123', 'z' => 'bar', '_format' => 'xml'])); // The default requirement for 'x' should not allow the separator '.' in this case because it would otherwise match everything // and following optional variables like _format could never match. $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\InvalidParameterException'); - $generator->generate('test', array('x' => 'do.t', 'y' => '123', 'z' => 'bar', '_format' => 'xml')); + $generator->generate('test', ['x' => 'do.t', 'y' => '123', 'z' => 'bar', '_format' => 'xml']); } public function testOptionalVariableWithNoRealSeparator() { - $routes = $this->getRoutes('test', new Route('/get{what}', array('what' => 'All'))); + $routes = $this->getRoutes('test', new Route('/get{what}', ['what' => 'All'])); $generator = $this->getGenerator($routes); $this->assertSame('/app.php/get', $generator->generate('test')); - $this->assertSame('/app.php/getSites', $generator->generate('test', array('what' => 'Sites'))); + $this->assertSame('/app.php/getSites', $generator->generate('test', ['what' => 'Sites'])); } public function testRequiredVariableWithNoRealSeparator() @@ -386,7 +386,7 @@ public function testRequiredVariableWithNoRealSeparator() $routes = $this->getRoutes('test', new Route('/get{what}Suffix')); $generator = $this->getGenerator($routes); - $this->assertSame('/app.php/getSitesSuffix', $generator->generate('test', array('what' => 'Sites'))); + $this->assertSame('/app.php/getSitesSuffix', $generator->generate('test', ['what' => 'Sites'])); } public function testDefaultRequirementOfVariable() @@ -394,7 +394,7 @@ public function testDefaultRequirementOfVariable() $routes = $this->getRoutes('test', new Route('/{page}.{_format}')); $generator = $this->getGenerator($routes); - $this->assertSame('/app.php/index.mobile.html', $generator->generate('test', array('page' => 'index', '_format' => 'mobile.html'))); + $this->assertSame('/app.php/index.mobile.html', $generator->generate('test', ['page' => 'index', '_format' => 'mobile.html'])); } /** @@ -403,7 +403,7 @@ public function testDefaultRequirementOfVariable() public function testDefaultRequirementOfVariableDisallowsSlash() { $routes = $this->getRoutes('test', new Route('/{page}.{_format}')); - $this->getGenerator($routes)->generate('test', array('page' => 'index', '_format' => 'sl/ash')); + $this->getGenerator($routes)->generate('test', ['page' => 'index', '_format' => 'sl/ash']); } /** @@ -412,28 +412,28 @@ public function testDefaultRequirementOfVariableDisallowsSlash() public function testDefaultRequirementOfVariableDisallowsNextSeparator() { $routes = $this->getRoutes('test', new Route('/{page}.{_format}')); - $this->getGenerator($routes)->generate('test', array('page' => 'do.t', '_format' => 'html')); + $this->getGenerator($routes)->generate('test', ['page' => 'do.t', '_format' => 'html']); } public function testWithHostDifferentFromContext() { - $routes = $this->getRoutes('test', new Route('/{name}', array(), array(), array(), '{locale}.example.com')); + $routes = $this->getRoutes('test', new Route('/{name}', [], [], [], '{locale}.example.com')); - $this->assertEquals('//fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', array('name' => 'Fabien', 'locale' => 'fr'))); + $this->assertEquals('//fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', ['name' => 'Fabien', 'locale' => 'fr'])); } public function testWithHostSameAsContext() { - $routes = $this->getRoutes('test', new Route('/{name}', array(), array(), array(), '{locale}.example.com')); + $routes = $this->getRoutes('test', new Route('/{name}', [], [], [], '{locale}.example.com')); - $this->assertEquals('/app.php/Fabien', $this->getGenerator($routes, array('host' => 'fr.example.com'))->generate('test', array('name' => 'Fabien', 'locale' => 'fr'))); + $this->assertEquals('/app.php/Fabien', $this->getGenerator($routes, ['host' => 'fr.example.com'])->generate('test', ['name' => 'Fabien', 'locale' => 'fr'])); } public function testWithHostSameAsContextAndAbsolute() { - $routes = $this->getRoutes('test', new Route('/{name}', array(), array(), array(), '{locale}.example.com')); + $routes = $this->getRoutes('test', new Route('/{name}', [], [], [], '{locale}.example.com')); - $this->assertEquals('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes, array('host' => 'fr.example.com'))->generate('test', array('name' => 'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::ABSOLUTE_URL)); + $this->assertEquals('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes, ['host' => 'fr.example.com'])->generate('test', ['name' => 'Fabien', 'locale' => 'fr'], UrlGeneratorInterface::ABSOLUTE_URL)); } /** @@ -441,8 +441,8 @@ public function testWithHostSameAsContextAndAbsolute() */ public function testUrlWithInvalidParameterInHost() { - $routes = $this->getRoutes('test', new Route('/', array(), array('foo' => 'bar'), array(), '{foo}.example.com')); - $this->getGenerator($routes)->generate('test', array('foo' => 'baz'), UrlGeneratorInterface::ABSOLUTE_PATH); + $routes = $this->getRoutes('test', new Route('/', [], ['foo' => 'bar'], [], '{foo}.example.com')); + $this->getGenerator($routes)->generate('test', ['foo' => 'baz'], UrlGeneratorInterface::ABSOLUTE_PATH); } /** @@ -450,8 +450,8 @@ public function testUrlWithInvalidParameterInHost() */ public function testUrlWithInvalidParameterInHostWhenParamHasADefaultValue() { - $routes = $this->getRoutes('test', new Route('/', array('foo' => 'bar'), array('foo' => 'bar'), array(), '{foo}.example.com')); - $this->getGenerator($routes)->generate('test', array('foo' => 'baz'), UrlGeneratorInterface::ABSOLUTE_PATH); + $routes = $this->getRoutes('test', new Route('/', ['foo' => 'bar'], ['foo' => 'bar'], [], '{foo}.example.com')); + $this->getGenerator($routes)->generate('test', ['foo' => 'baz'], UrlGeneratorInterface::ABSOLUTE_PATH); } /** @@ -459,72 +459,72 @@ public function testUrlWithInvalidParameterInHostWhenParamHasADefaultValue() */ public function testUrlWithInvalidParameterEqualsDefaultValueInHost() { - $routes = $this->getRoutes('test', new Route('/', array('foo' => 'baz'), array('foo' => 'bar'), array(), '{foo}.example.com')); - $this->getGenerator($routes)->generate('test', array('foo' => 'baz'), UrlGeneratorInterface::ABSOLUTE_PATH); + $routes = $this->getRoutes('test', new Route('/', ['foo' => 'baz'], ['foo' => 'bar'], [], '{foo}.example.com')); + $this->getGenerator($routes)->generate('test', ['foo' => 'baz'], UrlGeneratorInterface::ABSOLUTE_PATH); } public function testUrlWithInvalidParameterInHostInNonStrictMode() { - $routes = $this->getRoutes('test', new Route('/', array(), array('foo' => 'bar'), array(), '{foo}.example.com')); + $routes = $this->getRoutes('test', new Route('/', [], ['foo' => 'bar'], [], '{foo}.example.com')); $generator = $this->getGenerator($routes); $generator->setStrictRequirements(false); - $this->assertNull($generator->generate('test', array('foo' => 'baz'), UrlGeneratorInterface::ABSOLUTE_PATH)); + $this->assertNull($generator->generate('test', ['foo' => 'baz'], UrlGeneratorInterface::ABSOLUTE_PATH)); } public function testHostIsCaseInsensitive() { - $routes = $this->getRoutes('test', new Route('/', array(), array('locale' => 'en|de|fr'), array(), '{locale}.FooBar.com')); + $routes = $this->getRoutes('test', new Route('/', [], ['locale' => 'en|de|fr'], [], '{locale}.FooBar.com')); $generator = $this->getGenerator($routes); - $this->assertSame('//EN.FooBar.com/app.php/', $generator->generate('test', array('locale' => 'EN'), UrlGeneratorInterface::NETWORK_PATH)); + $this->assertSame('//EN.FooBar.com/app.php/', $generator->generate('test', ['locale' => 'EN'], UrlGeneratorInterface::NETWORK_PATH)); } public function testDefaultHostIsUsedWhenContextHostIsEmpty() { - $routes = $this->getRoutes('test', new Route('/route', array('domain' => 'my.fallback.host'), array('domain' => '.+'), array(), '{domain}', array('http'))); + $routes = $this->getRoutes('test', new Route('/route', ['domain' => 'my.fallback.host'], ['domain' => '.+'], [], '{domain}', ['http'])); $generator = $this->getGenerator($routes); $generator->getContext()->setHost(''); - $this->assertSame('http://my.fallback.host/app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL)); + $this->assertSame('http://my.fallback.host/app.php/route', $generator->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL)); } public function testDefaultHostIsUsedWhenContextHostIsEmptyAndSchemeIsNot() { - $routes = $this->getRoutes('test', new Route('/route', array('domain' => 'my.fallback.host'), array('domain' => '.+'), array(), '{domain}', array('http', 'https'))); + $routes = $this->getRoutes('test', new Route('/route', ['domain' => 'my.fallback.host'], ['domain' => '.+'], [], '{domain}', ['http', 'https'])); $generator = $this->getGenerator($routes); $generator->getContext()->setHost(''); $generator->getContext()->setScheme('https'); - $this->assertSame('https://my.fallback.host/app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL)); + $this->assertSame('https://my.fallback.host/app.php/route', $generator->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL)); } public function testAbsoluteUrlFallbackToRelativeIfHostIsEmptyAndSchemeIsNot() { - $routes = $this->getRoutes('test', new Route('/route', array(), array(), array(), '', array('http', 'https'))); + $routes = $this->getRoutes('test', new Route('/route', [], [], [], '', ['http', 'https'])); $generator = $this->getGenerator($routes); $generator->getContext()->setHost(''); $generator->getContext()->setScheme('https'); - $this->assertSame('/app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL)); + $this->assertSame('/app.php/route', $generator->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL)); } public function testGenerateNetworkPath() { - $routes = $this->getRoutes('test', new Route('/{name}', array(), array(), array(), '{locale}.example.com', array('http'))); + $routes = $this->getRoutes('test', new Route('/{name}', [], [], [], '{locale}.example.com', ['http'])); $this->assertSame('//fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', - array('name' => 'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::NETWORK_PATH), 'network path with different host' + ['name' => 'Fabien', 'locale' => 'fr'], UrlGeneratorInterface::NETWORK_PATH), 'network path with different host' ); - $this->assertSame('//fr.example.com/app.php/Fabien?query=string', $this->getGenerator($routes, array('host' => 'fr.example.com'))->generate('test', - array('name' => 'Fabien', 'locale' => 'fr', 'query' => 'string'), UrlGeneratorInterface::NETWORK_PATH), 'network path although host same as context' + $this->assertSame('//fr.example.com/app.php/Fabien?query=string', $this->getGenerator($routes, ['host' => 'fr.example.com'])->generate('test', + ['name' => 'Fabien', 'locale' => 'fr', 'query' => 'string'], UrlGeneratorInterface::NETWORK_PATH), 'network path although host same as context' ); - $this->assertSame('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test', - array('name' => 'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::NETWORK_PATH), 'absolute URL because scheme requirement does not match context' + $this->assertSame('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes, ['scheme' => 'https'])->generate('test', + ['name' => 'Fabien', 'locale' => 'fr'], UrlGeneratorInterface::NETWORK_PATH), 'absolute URL because scheme requirement does not match context' ); $this->assertSame('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', - array('name' => 'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::ABSOLUTE_URL), 'absolute URL with same scheme because it is requested' + ['name' => 'Fabien', 'locale' => 'fr'], UrlGeneratorInterface::ABSOLUTE_URL), 'absolute URL with same scheme because it is requested' ); } @@ -533,32 +533,32 @@ public function testGenerateRelativePath() $routes = new RouteCollection(); $routes->add('article', new Route('/{author}/{article}/')); $routes->add('comments', new Route('/{author}/{article}/comments')); - $routes->add('host', new Route('/{article}', array(), array(), array(), '{author}.example.com')); - $routes->add('scheme', new Route('/{author}/blog', array(), array(), array(), '', array('https'))); + $routes->add('host', new Route('/{article}', [], [], [], '{author}.example.com')); + $routes->add('scheme', new Route('/{author}/blog', [], [], [], '', ['https'])); $routes->add('unrelated', new Route('/about')); - $generator = $this->getGenerator($routes, array('host' => 'example.com', 'pathInfo' => '/fabien/symfony-is-great/')); + $generator = $this->getGenerator($routes, ['host' => 'example.com', 'pathInfo' => '/fabien/symfony-is-great/']); $this->assertSame('comments', $generator->generate('comments', - array('author' => 'fabien', 'article' => 'symfony-is-great'), UrlGeneratorInterface::RELATIVE_PATH) + ['author' => 'fabien', 'article' => 'symfony-is-great'], UrlGeneratorInterface::RELATIVE_PATH) ); $this->assertSame('comments?page=2', $generator->generate('comments', - array('author' => 'fabien', 'article' => 'symfony-is-great', 'page' => 2), UrlGeneratorInterface::RELATIVE_PATH) + ['author' => 'fabien', 'article' => 'symfony-is-great', 'page' => 2], UrlGeneratorInterface::RELATIVE_PATH) ); $this->assertSame('../twig-is-great/', $generator->generate('article', - array('author' => 'fabien', 'article' => 'twig-is-great'), UrlGeneratorInterface::RELATIVE_PATH) + ['author' => 'fabien', 'article' => 'twig-is-great'], UrlGeneratorInterface::RELATIVE_PATH) ); $this->assertSame('../../bernhard/forms-are-great/', $generator->generate('article', - array('author' => 'bernhard', 'article' => 'forms-are-great'), UrlGeneratorInterface::RELATIVE_PATH) + ['author' => 'bernhard', 'article' => 'forms-are-great'], UrlGeneratorInterface::RELATIVE_PATH) ); $this->assertSame('//bernhard.example.com/app.php/forms-are-great', $generator->generate('host', - array('author' => 'bernhard', 'article' => 'forms-are-great'), UrlGeneratorInterface::RELATIVE_PATH) + ['author' => 'bernhard', 'article' => 'forms-are-great'], UrlGeneratorInterface::RELATIVE_PATH) ); $this->assertSame('https://example.com/app.php/bernhard/blog', $generator->generate('scheme', - array('author' => 'bernhard'), UrlGeneratorInterface::RELATIVE_PATH) + ['author' => 'bernhard'], UrlGeneratorInterface::RELATIVE_PATH) ); $this->assertSame('../../about', $generator->generate('unrelated', - array(), UrlGeneratorInterface::RELATIVE_PATH) + [], UrlGeneratorInterface::RELATIVE_PATH) ); } @@ -572,138 +572,155 @@ public function testGetRelativePath($sourcePath, $targetPath, $expectedPath) public function provideRelativePaths() { - return array( - array( + return [ + [ '/same/dir/', '/same/dir/', '', - ), - array( + ], + [ '/same/file', '/same/file', '', - ), - array( + ], + [ '/', '/file', 'file', - ), - array( + ], + [ '/', '/dir/file', 'dir/file', - ), - array( + ], + [ '/dir/file.html', '/dir/different-file.html', 'different-file.html', - ), - array( + ], + [ '/same/dir/extra-file', '/same/dir/', './', - ), - array( + ], + [ '/parent/dir/', '/parent/', '../', - ), - array( + ], + [ '/parent/dir/extra-file', '/parent/', '../', - ), - array( + ], + [ '/a/b/', '/x/y/z/', '../../x/y/z/', - ), - array( + ], + [ '/a/b/c/d/e', '/a/c/d', '../../../c/d', - ), - array( + ], + [ '/a/b/c//', '/a/b/c/', '../', - ), - array( + ], + [ '/a/b/c/', '/a/b/c//', './/', - ), - array( + ], + [ '/root/a/b/c/', '/root/x/b/c/', '../../../x/b/c/', - ), - array( + ], + [ '/a/b/c/d/', '/a', '../../../../a', - ), - array( + ], + [ '/special-chars/sp%20ce/1€/mäh/e=mc²', '/special-chars/sp%20ce/1€/<µ>/e=mc²', '../<µ>/e=mc²', - ), - array( + ], + [ 'not-rooted', 'dir/file', 'dir/file', - ), - array( + ], + [ '//dir/', '', '../../', - ), - array( + ], + [ '/dir/', '/dir/file:with-colon', './file:with-colon', - ), - array( + ], + [ '/dir/', '/dir/subdir/file:with-colon', 'subdir/file:with-colon', - ), - array( + ], + [ '/dir/', '/dir/:subdir/', './:subdir/', - ), - ); + ], + ]; } public function testFragmentsCanBeAppendedToUrls() { $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array('_fragment' => 'frag ment'), UrlGeneratorInterface::ABSOLUTE_PATH); + $url = $this->getGenerator($routes)->generate('test', ['_fragment' => 'frag ment'], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('/app.php/testing#frag%20ment', $url); - $url = $this->getGenerator($routes)->generate('test', array('_fragment' => '0'), UrlGeneratorInterface::ABSOLUTE_PATH); + $url = $this->getGenerator($routes)->generate('test', ['_fragment' => '0'], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('/app.php/testing#0', $url); } public function testFragmentsDoNotEscapeValidCharacters() { $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array('_fragment' => '?/'), UrlGeneratorInterface::ABSOLUTE_PATH); + $url = $this->getGenerator($routes)->generate('test', ['_fragment' => '?/'], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('/app.php/testing#?/', $url); } public function testFragmentsCanBeDefinedAsDefaults() { - $routes = $this->getRoutes('test', new Route('/testing', array('_fragment' => 'fragment'))); - $url = $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_PATH); + $routes = $this->getRoutes('test', new Route('/testing', ['_fragment' => 'fragment'])); + $url = $this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_PATH); $this->assertEquals('/app.php/testing#fragment', $url); } - protected function getGenerator(RouteCollection $routes, array $parameters = array(), $logger = null) + /** + * @dataProvider provideLookAroundRequirementsInPath + */ + public function testLookRoundRequirementsInPath($expected, $path, $requirement) + { + $routes = $this->getRoutes('test', new Route($path, [], ['foo' => $requirement, 'baz' => '.+?'])); + $this->assertSame($expected, $this->getGenerator($routes)->generate('test', ['foo' => 'a/b', 'baz' => 'c/d/e'])); + } + + public function provideLookAroundRequirementsInPath() + { + yield ['/app.php/a/b/b%28ar/c/d/e', '/{foo}/b(ar/{baz}', '.+(?=/b\\(ar/)']; + yield ['/app.php/a/b/bar/c/d/e', '/{foo}/bar/{baz}', '.+(?!$)']; + yield ['/app.php/bar/a/b/bam/c/d/e', '/bar/{foo}/bam/{baz}', '(?<=/bar/).+']; + yield ['/app.php/bar/a/b/bam/c/d/e', '/bar/{foo}/bam/{baz}', '(?<!^).+']; + } + + protected function getGenerator(RouteCollection $routes, array $parameters = [], $logger = null) { $context = new RequestContext('/app.php'); foreach ($parameters as $key => $value) { diff --git a/vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php index e8bbe8fcf43e1f774c3398732281e80c468320ee..0ce4a47ec1317dfa7e39599f202e29641ea427be 100644 --- a/vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php @@ -26,7 +26,7 @@ public function getReader() public function getClassLoader($reader) { return $this->getMockBuilder('Symfony\Component\Routing\Loader\AnnotationClassLoader') - ->setConstructorArgs(array($reader)) + ->setConstructorArgs([$reader]) ->getMockForAbstractClass() ; } diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php index beab0b2e835a031d63c42135784577df4f8d79b9..c11ae81e214c9fc2427d61a9980d5418ed4480c8 100644 --- a/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php @@ -52,15 +52,15 @@ public function testSupportsChecksResource($resource, $expectedSupports) public function provideTestSupportsChecksResource() { - return array( - array('class', true), - array('\fully\qualified\class\name', true), - array('namespaced\class\without\leading\slash', true), - array('ÿClassWithLegalSpecialCharacters', true), - array('5', false), - array('foo.foo', false), - array(null, false), - ); + return [ + ['class', true], + ['\fully\qualified\class\name', true], + ['namespaced\class\without\leading\slash', true], + ['ÿClassWithLegalSpecialCharacters', true], + ['5', false], + ['foo.foo', false], + [null, false], + ]; } public function testSupportsChecksTypeIfSpecified() @@ -71,55 +71,55 @@ public function testSupportsChecksTypeIfSpecified() public function getLoadTests() { - return array( - array( + return [ + [ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', - array('name' => 'route1', 'path' => '/path'), - array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'), - ), - array( + ['name' => 'route1', 'path' => '/path'], + ['arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'], + ], + [ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', - array('defaults' => array('arg2' => 'foo'), 'requirements' => array('arg3' => '\w+')), - array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'), - ), - array( + ['defaults' => ['arg2' => 'foo'], 'requirements' => ['arg3' => '\w+']], + ['arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'], + ], + [ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', - array('options' => array('foo' => 'bar')), - array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'), - ), - array( + ['options' => ['foo' => 'bar']], + ['arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'], + ], + [ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', - array('schemes' => array('https'), 'methods' => array('GET')), - array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'), - ), - array( + ['schemes' => ['https'], 'methods' => ['GET']], + ['arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'], + ], + [ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', - array('condition' => 'context.getMethod() == "GET"'), - array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'), - ), - ); + ['condition' => 'context.getMethod() == "GET"'], + ['arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'], + ], + ]; } /** * @dataProvider getLoadTests */ - public function testLoad($className, $routeData = array(), $methodArgs = array()) + public function testLoad($className, $routeData = [], $methodArgs = []) { - $routeData = array_replace(array( + $routeData = array_replace([ 'name' => 'route', 'path' => '/', - 'requirements' => array(), - 'options' => array(), - 'defaults' => array(), - 'schemes' => array(), - 'methods' => array(), + 'requirements' => [], + 'options' => [], + 'defaults' => [], + 'schemes' => [], + 'methods' => [], 'condition' => '', - ), $routeData); + ], $routeData); $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue(array($this->getAnnotatedRoute($routeData)))) + ->will($this->returnValue([$this->getAnnotatedRoute($routeData)])) ; $routeCollection = $this->loader->load($className); @@ -148,19 +148,19 @@ public function testLoad($className, $routeData = array(), $methodArgs = array() public function testClassRouteLoad() { - $classRouteData = array( + $classRouteData = [ 'name' => 'prefix_', 'path' => '/prefix', - 'schemes' => array('https'), - 'methods' => array('GET'), - ); + 'schemes' => ['https'], + 'methods' => ['GET'], + ]; - $methodRouteData = array( + $methodRouteData = [ 'name' => 'route1', 'path' => '/path', - 'schemes' => array('http'), - 'methods' => array('POST', 'PUT'), - ); + 'schemes' => ['http'], + 'methods' => ['POST', 'PUT'], + ]; $this->reader ->expects($this->once()) @@ -170,7 +170,7 @@ public function testClassRouteLoad() $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue(array($this->getAnnotatedRoute($methodRouteData)))) + ->will($this->returnValue([$this->getAnnotatedRoute($methodRouteData)])) ; $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass'); @@ -181,24 +181,59 @@ public function testClassRouteLoad() $this->assertEquals(array_merge($classRouteData['methods'], $methodRouteData['methods']), $route->getMethods(), '->load merges class and method route methods'); } - public function testInvokableClassRouteLoad() + public function testInvokableClassRouteLoadWithMethodAnnotation() { - $classRouteData = array( + $classRouteData = [ 'name' => 'route1', 'path' => '/', - 'schemes' => array('https'), - 'methods' => array('GET'), - ); + 'schemes' => ['https'], + 'methods' => ['GET'], + ]; $this->reader ->expects($this->exactly(1)) ->method('getClassAnnotations') - ->will($this->returnValue(array($this->getAnnotatedRoute($classRouteData)))) + ->will($this->returnValue([$this->getAnnotatedRoute($classRouteData)])) ; $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue(array())) + ->will($this->returnValue([])) + ; + + $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass'); + $route = $routeCollection->get($classRouteData['name']); + + $this->assertSame($classRouteData['path'], $route->getPath(), '->load preserves class route path'); + $this->assertEquals($classRouteData['schemes'], $route->getSchemes(), '->load preserves class route schemes'); + $this->assertEquals($classRouteData['methods'], $route->getMethods(), '->load preserves class route methods'); + } + + public function testInvokableClassRouteLoadWithClassAnnotation() + { + $classRouteData = [ + 'name' => 'route1', + 'path' => '/', + 'schemes' => ['https'], + 'methods' => ['GET'], + ]; + + $this->reader + ->expects($this->exactly(1)) + ->method('getClassAnnotation') + ->will($this->returnValue($this->getAnnotatedRoute($classRouteData))) + ; + + $this->reader + ->expects($this->exactly(1)) + ->method('getClassAnnotations') + ->will($this->returnValue([$this->getAnnotatedRoute($classRouteData)])) + ; + + $this->reader + ->expects($this->once()) + ->method('getMethodAnnotations') + ->will($this->returnValue([])) ; $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass'); @@ -211,29 +246,29 @@ public function testInvokableClassRouteLoad() public function testInvokableClassMultipleRouteLoad() { - $classRouteData1 = array( + $classRouteData1 = [ 'name' => 'route1', 'path' => '/1', - 'schemes' => array('https'), - 'methods' => array('GET'), - ); + 'schemes' => ['https'], + 'methods' => ['GET'], + ]; - $classRouteData2 = array( + $classRouteData2 = [ 'name' => 'route2', 'path' => '/2', - 'schemes' => array('https'), - 'methods' => array('GET'), - ); + 'schemes' => ['https'], + 'methods' => ['GET'], + ]; $this->reader ->expects($this->exactly(1)) ->method('getClassAnnotations') - ->will($this->returnValue(array($this->getAnnotatedRoute($classRouteData1), $this->getAnnotatedRoute($classRouteData2)))) + ->will($this->returnValue([$this->getAnnotatedRoute($classRouteData1), $this->getAnnotatedRoute($classRouteData2)])) ; $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue(array())) + ->will($this->returnValue([])) ; $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass'); @@ -252,19 +287,19 @@ public function testInvokableClassMultipleRouteLoad() public function testInvokableClassWithMethodRouteLoad() { - $classRouteData = array( + $classRouteData = [ 'name' => 'route1', 'path' => '/prefix', - 'schemes' => array('https'), - 'methods' => array('GET'), - ); + 'schemes' => ['https'], + 'methods' => ['GET'], + ]; - $methodRouteData = array( + $methodRouteData = [ 'name' => 'route2', 'path' => '/path', - 'schemes' => array('http'), - 'methods' => array('POST', 'PUT'), - ); + 'schemes' => ['http'], + 'methods' => ['POST', 'PUT'], + ]; $this->reader ->expects($this->once()) @@ -274,7 +309,7 @@ public function testInvokableClassWithMethodRouteLoad() $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue(array($this->getAnnotatedRoute($methodRouteData)))) + ->will($this->returnValue([$this->getAnnotatedRoute($methodRouteData)])) ; $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass'); diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php index 901b858d91cd77ce65f38a8e72712bacb4acb6e7..ac25493481ef6edf498c35dd21b21184264881a1 100644 --- a/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php @@ -34,13 +34,13 @@ public function testLoad() $this->reader ->expects($this->any()) ->method('getMethodAnnotations') - ->will($this->returnValue(array())) + ->will($this->returnValue([])) ; $this->reader ->expects($this->any()) ->method('getClassAnnotations') - ->will($this->returnValue(array())) + ->will($this->returnValue([])) ; $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses'); @@ -48,22 +48,22 @@ public function testLoad() public function testLoadIgnoresHiddenDirectories() { - $this->expectAnnotationsToBeReadFrom(array( + $this->expectAnnotationsToBeReadFrom([ 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass', 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\FooClass', - )); + ]); $this->reader ->expects($this->any()) ->method('getMethodAnnotations') - ->will($this->returnValue(array())) + ->will($this->returnValue([])) ; $this->reader ->expects($this->any()) ->method('getClassAnnotations') - ->will($this->returnValue(array())) + ->will($this->returnValue([])) ; $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses'); @@ -92,7 +92,7 @@ public function testLoadFileIfLocatedResourceIsFile() $this->reader ->expects($this->any()) ->method('getMethodAnnotations') - ->will($this->returnValue(array())) + ->will($this->returnValue([])) ; $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php'); diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php index e0a95c8c011536e18a9a7519a68cd64a3dedafb9..26a897ea64835ca371d83e14213fcae1c4daaeb8 100644 --- a/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php @@ -59,10 +59,10 @@ public function testLoadFileWithoutStartTag() */ public function testLoadVariadic() { - $route = new Route(array('path' => '/path/to/{id}')); + $route = new Route(['path' => '/path/to/{id}']); $this->reader->expects($this->once())->method('getClassAnnotation'); $this->reader->expects($this->once())->method('getMethodAnnotations') - ->will($this->returnValue(array($route))); + ->will($this->returnValue([$route])); $this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/VariadicClass.php'); } diff --git a/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php b/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php index 45968551b245445eba2c46776813a33f20bb37c0..2657751b38cda57e757aec3063fd5f754d37b943 100644 --- a/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php @@ -30,11 +30,11 @@ protected function setUp() $locator = new FileLocator(); $this->reader = $this->getReader(); $this->loader = new DirectoryLoader($locator); - $resolver = new LoaderResolver(array( + $resolver = new LoaderResolver([ new YamlFileLoader($locator), new AnnotationFileLoader($locator, $this->getClassLoader($this->reader)), $this->loader, - )); + ]); $this->loader->setResolver($resolver); } diff --git a/vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php b/vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php index 408fa0b45c48c349c9be70aea5b1747c5d0815b8..89dcd5ba3f11d68d2435f6513f57e9b47c5e365d 100644 --- a/vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php @@ -26,9 +26,9 @@ public function testLoadCallsServiceAndReturnsCollection() $collection = new RouteCollection(); $collection->add('foo', new Route('/foo')); - $loader->loaderMap = array( + $loader->loaderMap = [ 'my_route_provider_service' => new RouteService($collection), - ); + ]; $actualRoutes = $loader->load( 'my_route_provider_service:loadRoutes', @@ -52,11 +52,11 @@ public function testExceptionWithoutSyntax($resourceString) public function getBadResourceStrings() { - return array( - array('Foo'), - array('Bar::baz'), - array('Foo:Bar:baz'), - ); + return [ + ['Foo'], + ['Bar::baz'], + ['Foo:Bar:baz'], + ]; } /** @@ -65,7 +65,7 @@ public function getBadResourceStrings() public function testExceptionOnNoObjectReturned() { $loader = new ObjectRouteLoaderForTest(); - $loader->loaderMap = array('my_service' => 'NOT_AN_OBJECT'); + $loader->loaderMap = ['my_service' => 'NOT_AN_OBJECT']; $loader->load('my_service:method'); } @@ -75,7 +75,7 @@ public function testExceptionOnNoObjectReturned() public function testExceptionOnBadMethod() { $loader = new ObjectRouteLoaderForTest(); - $loader->loaderMap = array('my_service' => new \stdClass()); + $loader->loaderMap = ['my_service' => new \stdClass()]; $loader->load('my_service:method'); } @@ -85,21 +85,21 @@ public function testExceptionOnBadMethod() public function testExceptionOnMethodNotReturningCollection() { $service = $this->getMockBuilder('stdClass') - ->setMethods(array('loadRoutes')) + ->setMethods(['loadRoutes']) ->getMock(); $service->expects($this->once()) ->method('loadRoutes') ->will($this->returnValue('NOT_A_COLLECTION')); $loader = new ObjectRouteLoaderForTest(); - $loader->loaderMap = array('my_service' => $service); + $loader->loaderMap = ['my_service' => $service]; $loader->load('my_service:loadRoutes'); } } class ObjectRouteLoaderForTest extends ObjectRouteLoader { - public $loaderMap = array(); + public $loaderMap = []; protected function getServiceObject($id) { diff --git a/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php index 0dcf5d4941befef6728184670ac83dce3a0f59b8..3e1f1ec2f1118feb0ea37d75f2a916c7e44fd024 100644 --- a/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php @@ -33,7 +33,7 @@ public function testSupports() public function testLoadWithRoute() { - $loader = new PhpFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new PhpFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('validpattern.php'); $routes = $routeCollection->all(); @@ -45,14 +45,14 @@ public function testLoadWithRoute() $this->assertSame('MyBlogBundle:Blog:show', $route->getDefault('_controller')); $this->assertSame('{locale}.example.com', $route->getHost()); $this->assertSame('RouteCompiler', $route->getOption('compiler_class')); - $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods()); - $this->assertEquals(array('https'), $route->getSchemes()); + $this->assertEquals(['GET', 'POST', 'PUT', 'OPTIONS'], $route->getMethods()); + $this->assertEquals(['https'], $route->getSchemes()); } } public function testLoadWithImport() { - $loader = new PhpFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new PhpFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('validresource.php'); $routes = $routeCollection->all(); @@ -64,14 +64,14 @@ public function testLoadWithImport() $this->assertSame('MyBlogBundle:Blog:show', $route->getDefault('_controller')); $this->assertSame('{locale}.example.com', $route->getHost()); $this->assertSame('RouteCompiler', $route->getOption('compiler_class')); - $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods()); - $this->assertEquals(array('https'), $route->getSchemes()); + $this->assertEquals(['GET', 'POST', 'PUT', 'OPTIONS'], $route->getMethods()); + $this->assertEquals(['https'], $route->getSchemes()); } } public function testThatDefiningVariableInConfigFileHasNoSideEffects() { - $locator = new FileLocator(array(__DIR__.'/../Fixtures')); + $locator = new FileLocator([__DIR__.'/../Fixtures']); $loader = new PhpFileLoader($locator); $routeCollection = $loader->load('with_define_path_variable.php'); $resources = $routeCollection->getResources(); @@ -86,30 +86,30 @@ public function testThatDefiningVariableInConfigFileHasNoSideEffects() public function testRoutingConfigurator() { - $locator = new FileLocator(array(__DIR__.'/../Fixtures')); + $locator = new FileLocator([__DIR__.'/../Fixtures']); $loader = new PhpFileLoader($locator); $routeCollection = $loader->load('php_dsl.php'); $expectedCollection = new RouteCollection(); $expectedCollection->add('foo', (new Route('/foo')) - ->setOptions(array('utf8' => true)) + ->setOptions(['utf8' => true]) ->setCondition('abc') ); $expectedCollection->add('buz', (new Route('/zub')) - ->setDefaults(array('_controller' => 'foo:act')) + ->setDefaults(['_controller' => 'foo:act']) ); $expectedCollection->add('c_bar', (new Route('/sub/pub/bar')) - ->setRequirements(array('id' => '\d+')) + ->setRequirements(['id' => '\d+']) ); $expectedCollection->add('c_pub_buz', (new Route('/sub/pub/buz')) ->setHost('host') - ->setRequirements(array('id' => '\d+')) + ->setRequirements(['id' => '\d+']) ); $expectedCollection->add('ouf', (new Route('/ouf')) - ->setSchemes(array('https')) - ->setMethods(array('GET')) - ->setDefaults(array('id' => 0)) + ->setSchemes(['https']) + ->setMethods(['GET']) + ->setDefaults(['id' => 0]) ); $expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl_sub.php'))); @@ -120,7 +120,7 @@ public function testRoutingConfigurator() public function testRoutingConfiguratorCanImportGlobPatterns() { - $locator = new FileLocator(array(__DIR__.'/../Fixtures/glob')); + $locator = new FileLocator([__DIR__.'/../Fixtures/glob']); $loader = new PhpFileLoader($locator); $routeCollection = $loader->load('php_dsl.php'); diff --git a/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php index 21fc3400f249e1a1b067f9f95a3c72f4bd5e24b8..66588e7e900ac8c90093d98a6e3ef711eedea881 100644 --- a/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php @@ -31,7 +31,7 @@ public function testSupports() public function testLoadWithRoute() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('validpattern.xml'); $route = $routeCollection->get('blog_show'); @@ -41,14 +41,14 @@ public function testLoadWithRoute() $this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller')); $this->assertSame('\w+', $route->getRequirement('locale')); $this->assertSame('RouteCompiler', $route->getOption('compiler_class')); - $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods()); - $this->assertEquals(array('https'), $route->getSchemes()); + $this->assertEquals(['GET', 'POST', 'PUT', 'OPTIONS'], $route->getMethods()); + $this->assertEquals(['https'], $route->getSchemes()); $this->assertEquals('context.getMethod() == "GET"', $route->getCondition()); } public function testLoadWithNamespacePrefix() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('namespaceprefix.xml'); $this->assertCount(1, $routeCollection->all(), 'One route is loaded'); @@ -66,7 +66,7 @@ public function testLoadWithNamespacePrefix() public function testLoadWithImport() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('validresource.xml'); $routes = $routeCollection->all(); @@ -89,7 +89,7 @@ public function testLoadWithImport() */ public function testLoadThrowsExceptionWithInvalidFile($filePath) { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $loader->load($filePath); } @@ -99,13 +99,13 @@ public function testLoadThrowsExceptionWithInvalidFile($filePath) */ public function testLoadThrowsExceptionWithInvalidFileEvenWithoutSchemaValidation($filePath) { - $loader = new CustomXmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new CustomXmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $loader->load($filePath); } public function getPathsToInvalidFiles() { - return array(array('nonvalidnode.xml'), array('nonvalidroute.xml'), array('nonvalid.xml'), array('missing_id.xml'), array('missing_path.xml')); + return [['nonvalidnode.xml'], ['nonvalidroute.xml'], ['nonvalid.xml'], ['missing_id.xml'], ['missing_path.xml']]; } /** @@ -114,13 +114,13 @@ public function getPathsToInvalidFiles() */ public function testDocTypeIsNotAllowed() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $loader->load('withdoctype.xml'); } public function testNullValues() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('null_values.xml'); $route = $routeCollection->get('blog_show'); @@ -134,12 +134,12 @@ public function testNullValues() public function testScalarDataTypeDefaults() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('scalar_defaults.xml'); $route = $routeCollection->get('blog'); $this->assertSame( - array( + [ '_controller' => 'AcmeBlogBundle:Blog:index', 'slug' => null, 'published' => true, @@ -150,147 +150,147 @@ public function testScalarDataTypeDefaults() 'locked' => false, 'foo' => null, 'bar' => null, - ), + ], $route->getDefaults() ); } public function testListDefaults() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('list_defaults.xml'); $route = $routeCollection->get('blog'); $this->assertSame( - array( + [ '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array(true, 1, 3.5, 'foo'), - ), + 'values' => [true, 1, 3.5, 'foo'], + ], $route->getDefaults() ); } public function testListInListDefaults() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('list_in_list_defaults.xml'); $route = $routeCollection->get('blog'); $this->assertSame( - array( + [ '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array(array(true, 1, 3.5, 'foo')), - ), + 'values' => [[true, 1, 3.5, 'foo']], + ], $route->getDefaults() ); } public function testListInMapDefaults() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('list_in_map_defaults.xml'); $route = $routeCollection->get('blog'); $this->assertSame( - array( + [ '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array('list' => array(true, 1, 3.5, 'foo')), - ), + 'values' => ['list' => [true, 1, 3.5, 'foo']], + ], $route->getDefaults() ); } public function testMapDefaults() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('map_defaults.xml'); $route = $routeCollection->get('blog'); $this->assertSame( - array( + [ '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array( + 'values' => [ 'public' => true, 'page' => 1, 'price' => 3.5, 'title' => 'foo', - ), - ), + ], + ], $route->getDefaults() ); } public function testMapInListDefaults() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('map_in_list_defaults.xml'); $route = $routeCollection->get('blog'); $this->assertSame( - array( + [ '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array(array( + 'values' => [[ 'public' => true, 'page' => 1, 'price' => 3.5, 'title' => 'foo', - )), - ), + ]], + ], $route->getDefaults() ); } public function testMapInMapDefaults() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('map_in_map_defaults.xml'); $route = $routeCollection->get('blog'); $this->assertSame( - array( + [ '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array('map' => array( + 'values' => ['map' => [ 'public' => true, 'page' => 1, 'price' => 3.5, 'title' => 'foo', - )), - ), + ]], + ], $route->getDefaults() ); } public function testNullValuesInList() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('list_null_values.xml'); $route = $routeCollection->get('blog'); - $this->assertSame(array(null, null, null, null, null, null), $route->getDefault('list')); + $this->assertSame([null, null, null, null, null, null], $route->getDefault('list')); } public function testNullValuesInMap() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('map_null_values.xml'); $route = $routeCollection->get('blog'); $this->assertSame( - array( + [ 'boolean' => null, 'integer' => null, 'float' => null, 'string' => null, 'list' => null, 'map' => null, - ), + ], $route->getDefault('map') ); } public function testLoadRouteWithControllerAttribute() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $routeCollection = $loader->load('routing.xml'); $route = $routeCollection->get('app_homepage'); @@ -300,7 +300,7 @@ public function testLoadRouteWithControllerAttribute() public function testLoadRouteWithoutControllerAttribute() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $routeCollection = $loader->load('routing.xml'); $route = $routeCollection->get('app_logout'); @@ -310,7 +310,7 @@ public function testLoadRouteWithoutControllerAttribute() public function testLoadRouteWithControllerSetInDefaults() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $routeCollection = $loader->load('routing.xml'); $route = $routeCollection->get('app_blog'); @@ -324,7 +324,7 @@ public function testLoadRouteWithControllerSetInDefaults() */ public function testOverrideControllerInDefaults() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $loader->load('override_defaults.xml'); } @@ -333,7 +333,7 @@ public function testOverrideControllerInDefaults() */ public function testImportRouteWithController($file) { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $routeCollection = $loader->load($file); $route = $routeCollection->get('app_homepage'); @@ -348,8 +348,8 @@ public function testImportRouteWithController($file) public function provideFilesImportingRoutesWithControllers() { - yield array('import_controller.xml'); - yield array('import__controller.xml'); + yield ['import_controller.xml']; + yield ['import__controller.xml']; } /** @@ -358,13 +358,13 @@ public function provideFilesImportingRoutesWithControllers() */ public function testImportWithOverriddenController() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $loader->load('import_override_defaults.xml'); } public function testImportRouteWithGlobMatchingSingleFile() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/glob'])); $routeCollection = $loader->load('import_single.xml'); $route = $routeCollection->get('bar_route'); @@ -373,7 +373,7 @@ public function testImportRouteWithGlobMatchingSingleFile() public function testImportRouteWithGlobMatchingMultipleFiles() { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob'))); + $loader = new XmlFileLoader(new FileLocator([__DIR__.'/../Fixtures/glob'])); $routeCollection = $loader->load('import_multiple.xml'); $route = $routeCollection->get('bar_route'); diff --git a/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php index a89c58443f7ddc15b2d93c10b38a2619022a8ae4..4944e5b63651039cfdff546b53faf516b8fcd8f1 100644 --- a/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php @@ -33,11 +33,11 @@ public function testSupports() public function testLoadDoesNothingIfEmpty() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $collection = $loader->load('empty.yml'); - $this->assertEquals(array(), $collection->all()); - $this->assertEquals(array(new FileResource(realpath(__DIR__.'/../Fixtures/empty.yml'))), $collection->getResources()); + $this->assertEquals([], $collection->all()); + $this->assertEquals([new FileResource(realpath(__DIR__.'/../Fixtures/empty.yml'))], $collection->getResources()); } /** @@ -46,26 +46,26 @@ public function testLoadDoesNothingIfEmpty() */ public function testLoadThrowsExceptionWithInvalidFile($filePath) { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $loader->load($filePath); } public function getPathsToInvalidFiles() { - return array( - array('nonvalid.yml'), - array('nonvalid2.yml'), - array('incomplete.yml'), - array('nonvalidkeys.yml'), - array('nonesense_resource_plus_path.yml'), - array('nonesense_type_without_resource.yml'), - array('bad_format.yml'), - ); + return [ + ['nonvalid.yml'], + ['nonvalid2.yml'], + ['incomplete.yml'], + ['nonvalidkeys.yml'], + ['nonesense_resource_plus_path.yml'], + ['nonesense_type_without_resource.yml'], + ['bad_format.yml'], + ]; } public function testLoadSpecialRouteName() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('special_route_name.yml'); $route = $routeCollection->get('#$péß^a|'); @@ -75,7 +75,7 @@ public function testLoadSpecialRouteName() public function testLoadWithRoute() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('validpattern.yml'); $route = $routeCollection->get('blog_show'); @@ -85,14 +85,14 @@ public function testLoadWithRoute() $this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller')); $this->assertSame('\w+', $route->getRequirement('locale')); $this->assertSame('RouteCompiler', $route->getOption('compiler_class')); - $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods()); - $this->assertEquals(array('https'), $route->getSchemes()); + $this->assertEquals(['GET', 'POST', 'PUT', 'OPTIONS'], $route->getMethods()); + $this->assertEquals(['https'], $route->getSchemes()); $this->assertEquals('context.getMethod() == "GET"', $route->getCondition()); } public function testLoadWithResource() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures'])); $routeCollection = $loader->load('validresource.yml'); $routes = $routeCollection->all(); @@ -111,7 +111,7 @@ public function testLoadWithResource() public function testLoadRouteWithControllerAttribute() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $routeCollection = $loader->load('routing.yml'); $route = $routeCollection->get('app_homepage'); @@ -121,7 +121,7 @@ public function testLoadRouteWithControllerAttribute() public function testLoadRouteWithoutControllerAttribute() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $routeCollection = $loader->load('routing.yml'); $route = $routeCollection->get('app_logout'); @@ -131,7 +131,7 @@ public function testLoadRouteWithoutControllerAttribute() public function testLoadRouteWithControllerSetInDefaults() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $routeCollection = $loader->load('routing.yml'); $route = $routeCollection->get('app_blog'); @@ -145,7 +145,7 @@ public function testLoadRouteWithControllerSetInDefaults() */ public function testOverrideControllerInDefaults() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $loader->load('override_defaults.yml'); } @@ -154,7 +154,7 @@ public function testOverrideControllerInDefaults() */ public function testImportRouteWithController($file) { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $routeCollection = $loader->load($file); $route = $routeCollection->get('app_homepage'); @@ -169,8 +169,8 @@ public function testImportRouteWithController($file) public function provideFilesImportingRoutesWithControllers() { - yield array('import_controller.yml'); - yield array('import__controller.yml'); + yield ['import_controller.yml']; + yield ['import__controller.yml']; } /** @@ -179,13 +179,13 @@ public function provideFilesImportingRoutesWithControllers() */ public function testImportWithOverriddenController() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/controller'])); $loader->load('import_override_defaults.yml'); } public function testImportRouteWithGlobMatchingSingleFile() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/glob'])); $routeCollection = $loader->load('import_single.yml'); $route = $routeCollection->get('bar_route'); @@ -194,7 +194,7 @@ public function testImportRouteWithGlobMatchingSingleFile() public function testImportRouteWithGlobMatchingMultipleFiles() { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob'))); + $loader = new YamlFileLoader(new FileLocator([__DIR__.'/../Fixtures/glob'])); $routeCollection = $loader->load('import_multiple.yml'); $route = $routeCollection->get('bar_route'); diff --git a/vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php index 1785c3ad20f41ea3ce206dd6d3747fd1ad1aefb7..235e47768f5058a06a2f2d47f9ece278a984602d 100644 --- a/vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php @@ -25,11 +25,11 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex $class = 'DumpedRedirectableUrlMatcher'.++$i; $dumper = new PhpMatcherDumper($routes); - eval('?>'.$dumper->dump(array('class' => $class, 'base_class' => 'Symfony\Component\Routing\Tests\Matcher\TestDumpedRedirectableUrlMatcher'))); + eval('?>'.$dumper->dump(['class' => $class, 'base_class' => 'Symfony\Component\Routing\Tests\Matcher\TestDumpedRedirectableUrlMatcher'])); return $this->getMockBuilder($class) - ->setConstructorArgs(array($context ?: new RequestContext())) - ->setMethods(array('redirect')) + ->setConstructorArgs([$context ?: new RequestContext()]) + ->setMethods(['redirect']) ->getMock(); } } @@ -38,6 +38,6 @@ class TestDumpedRedirectableUrlMatcher extends UrlMatcher implements Redirectabl { public function redirect($path, $route, $scheme = null) { - return array(); + return []; } } diff --git a/vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php index b00dfdf5fa8da5b02464e780955fbb73cc84e6c4..34946f3f2b26c27e0f03857581ec75a1bd0342b5 100644 --- a/vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php @@ -41,7 +41,7 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex $class = 'DumpedUrlMatcher'.++$i; $dumper = new PhpMatcherDumper($routes); - eval('?>'.$dumper->dump(array('class' => $class))); + eval('?>'.$dumper->dump(['class' => $class])); return new $class($context ?: new RequestContext()); } diff --git a/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php index 66e858a82fd68783bf3b08923022a7e28e1dc4ea..2816567c1eea8ffae71efa162324c8236f041040 100644 --- a/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php +++ b/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php @@ -54,11 +54,11 @@ public function testDumpWhenSchemeIsUsedWithoutAProperDumper() $collection = new RouteCollection(); $collection->add('secure', new Route( '/secure', - array(), - array(), - array(), + [], + [], + [], '', - array('https') + ['https'] )); $dumper = new PhpMatcherDumper($collection); $dumper->dump(); @@ -72,11 +72,11 @@ public function testRedirectPreservesUrlEncoding() $class = $this->generateDumpedMatcher($collection, true); $matcher = $this->getMockBuilder($class) - ->setMethods(array('redirect')) - ->setConstructorArgs(array(new RequestContext())) + ->setMethods(['redirect']) + ->setConstructorArgs([new RequestContext()]) ->getMock(); - $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo')->willReturn(array()); + $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo')->willReturn([]); $matcher->match('/foo%3Abar'); } @@ -84,7 +84,7 @@ public function testRedirectPreservesUrlEncoding() /** * @dataProvider getRouteCollections */ - public function testDump(RouteCollection $collection, $fixture, $options = array()) + public function testDump(RouteCollection $collection, $fixture, $options = []) { $basePath = __DIR__.'/../../Fixtures/dumper/'; @@ -103,28 +103,28 @@ public function getRouteCollections() // defaults and requirements $collection->add('foo', new Route( '/foo/{bar}', - array('def' => 'test'), - array('bar' => 'baz|symfony') + ['def' => 'test'], + ['bar' => 'baz|symfony'] )); // method requirement $collection->add('bar', new Route( '/bar/{foo}', - array(), - array(), - array(), + [], + [], + [], '', - array(), - array('GET', 'head') + [], + ['GET', 'head'] )); // GET method requirement automatically adds HEAD as valid $collection->add('barhead', new Route( '/barhead/{foo}', - array(), - array(), - array(), + [], + [], + [], '', - array(), - array('GET') + [], + ['GET'] )); // simple $collection->add('baz', new Route( @@ -145,33 +145,33 @@ public function getRouteCollections() // trailing slash and method $collection->add('baz5', new Route( '/test/{foo}/', - array(), - array(), - array(), + [], + [], + [], '', - array(), - array('post') + [], + ['post'] )); // complex name $collection->add('baz.baz6', new Route( '/test/{foo}/', - array(), - array(), - array(), + [], + [], + [], '', - array(), - array('put') + [], + ['put'] )); // defaults without variable $collection->add('foofoo', new Route( '/foofoo', - array('def' => 'test') + ['def' => 'test'] )); // pattern with quotes $collection->add('quoter', new Route( '/{quoter}', - array(), - array('quoter' => '[\']+') + [], + ['quoter' => '[\']+'] )); // space in pattern $collection->add('space', new Route( @@ -186,7 +186,7 @@ public function getRouteCollections() $collection1->addPrefix('/b\'b'); $collection2 = new RouteCollection(); $collection2->addCollection($collection1); - $collection2->add('overridden', new Route('/{var}', array(), array('var' => '.*'))); + $collection2->add('overridden', new Route('/{var}', [], ['var' => '.*'])); $collection1 = new RouteCollection(); $collection1->add('foo2', new Route('/{foo1}')); $collection1->add('bar2', new Route('/{bar1}')); @@ -198,7 +198,7 @@ public function getRouteCollections() // overridden through addCollection() and multiple sub-collections with no own prefix $collection1 = new RouteCollection(); $collection1->add('overridden2', new Route('/old')); - $collection1->add('helloWorld', new Route('/hello/{who}', array('who' => 'World!'))); + $collection1->add('helloWorld', new Route('/hello/{who}', ['who' => 'World!'])); $collection2 = new RouteCollection(); $collection3 = new RouteCollection(); $collection3->add('overridden2', new Route('/new')); @@ -229,22 +229,22 @@ public function getRouteCollections() $collection1 = new RouteCollection(); - $route1 = new Route('/route1', array(), array(), array(), 'a.example.com'); + $route1 = new Route('/route1', [], [], [], 'a.example.com'); $collection1->add('route1', $route1); - $route2 = new Route('/c2/route2', array(), array(), array(), 'a.example.com'); + $route2 = new Route('/c2/route2', [], [], [], 'a.example.com'); $collection1->add('route2', $route2); - $route3 = new Route('/c2/route3', array(), array(), array(), 'b.example.com'); + $route3 = new Route('/c2/route3', [], [], [], 'b.example.com'); $collection1->add('route3', $route3); - $route4 = new Route('/route4', array(), array(), array(), 'a.example.com'); + $route4 = new Route('/route4', [], [], [], 'a.example.com'); $collection1->add('route4', $route4); - $route5 = new Route('/route5', array(), array(), array(), 'c.example.com'); + $route5 = new Route('/route5', [], [], [], 'c.example.com'); $collection1->add('route5', $route5); - $route6 = new Route('/route6', array(), array(), array(), null); + $route6 = new Route('/route6', [], [], [], null); $collection1->add('route6', $route6); $collection->addCollection($collection1); @@ -253,25 +253,25 @@ public function getRouteCollections() $collection1 = new RouteCollection(); - $route11 = new Route('/route11', array(), array(), array(), '{var1}.example.com'); + $route11 = new Route('/route11', [], [], [], '{var1}.example.com'); $collection1->add('route11', $route11); - $route12 = new Route('/route12', array('var1' => 'val'), array(), array(), '{var1}.example.com'); + $route12 = new Route('/route12', ['var1' => 'val'], [], [], '{var1}.example.com'); $collection1->add('route12', $route12); - $route13 = new Route('/route13/{name}', array(), array(), array(), '{var1}.example.com'); + $route13 = new Route('/route13/{name}', [], [], [], '{var1}.example.com'); $collection1->add('route13', $route13); - $route14 = new Route('/route14/{name}', array('var1' => 'val'), array(), array(), '{var1}.example.com'); + $route14 = new Route('/route14/{name}', ['var1' => 'val'], [], [], '{var1}.example.com'); $collection1->add('route14', $route14); - $route15 = new Route('/route15/{name}', array(), array(), array(), 'c.example.com'); + $route15 = new Route('/route15/{name}', [], [], [], 'c.example.com'); $collection1->add('route15', $route15); - $route16 = new Route('/route16/{name}', array('var1' => 'val'), array(), array(), null); + $route16 = new Route('/route16/{name}', ['var1' => 'val'], [], [], null); $collection1->add('route16', $route16); - $route17 = new Route('/route17', array(), array(), array(), null); + $route17 = new Route('/route17', [], [], [], null); $collection1->add('route17', $route17); $collection->addCollection($collection1); @@ -297,21 +297,21 @@ public function getRouteCollections() // force HTTPS redirection $redirectCollection->add('secure', new Route( '/secure', - array(), - array(), - array(), + [], + [], + [], '', - array('https') + ['https'] )); // force HTTP redirection $redirectCollection->add('nonsecure', new Route( '/nonsecure', - array(), - array(), - array(), + [], + [], + [], '', - array('http') + ['http'] )); /* test case 3 */ @@ -328,57 +328,57 @@ public function getRouteCollections() $headMatchCasesCollection = new RouteCollection(); $headMatchCasesCollection->add('just_head', new Route( '/just_head', - array(), - array(), - array(), + [], + [], + [], '', - array(), - array('HEAD') + [], + ['HEAD'] )); $headMatchCasesCollection->add('head_and_get', new Route( '/head_and_get', - array(), - array(), - array(), + [], + [], + [], '', - array(), - array('HEAD', 'GET') + [], + ['HEAD', 'GET'] )); $headMatchCasesCollection->add('get_and_head', new Route( '/get_and_head', - array(), - array(), - array(), + [], + [], + [], '', - array(), - array('GET', 'HEAD') + [], + ['GET', 'HEAD'] )); $headMatchCasesCollection->add('post_and_head', new Route( '/post_and_head', - array(), - array(), - array(), + [], + [], + [], '', - array(), - array('POST', 'HEAD') + [], + ['POST', 'HEAD'] )); $headMatchCasesCollection->add('put_and_post', new Route( '/put_and_post', - array(), - array(), - array(), + [], + [], + [], '', - array(), - array('PUT', 'POST') + [], + ['PUT', 'POST'] )); $headMatchCasesCollection->add('put_and_get_and_head', new Route( '/put_and_post', - array(), - array(), - array(), + [], + [], + [], '', - array(), - array('PUT', 'GET', 'HEAD') + [], + ['PUT', 'GET', 'HEAD'] )); /* test case 5 */ @@ -400,42 +400,39 @@ public function getRouteCollections() $groupOptimisedCollection->add('slashed_c', new Route('/slashed/group/c/')); $trailingSlashCollection = new RouteCollection(); - $trailingSlashCollection->add('simple_trailing_slash_no_methods', new Route('/trailing/simple/no-methods/', array(), array(), array(), '', array(), array())); - $trailingSlashCollection->add('simple_trailing_slash_GET_method', new Route('/trailing/simple/get-method/', array(), array(), array(), '', array(), array('GET'))); - $trailingSlashCollection->add('simple_trailing_slash_HEAD_method', new Route('/trailing/simple/head-method/', array(), array(), array(), '', array(), array('HEAD'))); - $trailingSlashCollection->add('simple_trailing_slash_POST_method', new Route('/trailing/simple/post-method/', array(), array(), array(), '', array(), array('POST'))); - $trailingSlashCollection->add('regex_trailing_slash_no_methods', new Route('/trailing/regex/no-methods/{param}/', array(), array(), array(), '', array(), array())); - $trailingSlashCollection->add('regex_trailing_slash_GET_method', new Route('/trailing/regex/get-method/{param}/', array(), array(), array(), '', array(), array('GET'))); - $trailingSlashCollection->add('regex_trailing_slash_HEAD_method', new Route('/trailing/regex/head-method/{param}/', array(), array(), array(), '', array(), array('HEAD'))); - $trailingSlashCollection->add('regex_trailing_slash_POST_method', new Route('/trailing/regex/post-method/{param}/', array(), array(), array(), '', array(), array('POST'))); - - $trailingSlashCollection->add('simple_not_trailing_slash_no_methods', new Route('/not-trailing/simple/no-methods', array(), array(), array(), '', array(), array())); - $trailingSlashCollection->add('simple_not_trailing_slash_GET_method', new Route('/not-trailing/simple/get-method', array(), array(), array(), '', array(), array('GET'))); - $trailingSlashCollection->add('simple_not_trailing_slash_HEAD_method', new Route('/not-trailing/simple/head-method', array(), array(), array(), '', array(), array('HEAD'))); - $trailingSlashCollection->add('simple_not_trailing_slash_POST_method', new Route('/not-trailing/simple/post-method', array(), array(), array(), '', array(), array('POST'))); - $trailingSlashCollection->add('regex_not_trailing_slash_no_methods', new Route('/not-trailing/regex/no-methods/{param}', array(), array(), array(), '', array(), array())); - $trailingSlashCollection->add('regex_not_trailing_slash_GET_method', new Route('/not-trailing/regex/get-method/{param}', array(), array(), array(), '', array(), array('GET'))); - $trailingSlashCollection->add('regex_not_trailing_slash_HEAD_method', new Route('/not-trailing/regex/head-method/{param}', array(), array(), array(), '', array(), array('HEAD'))); - $trailingSlashCollection->add('regex_not_trailing_slash_POST_method', new Route('/not-trailing/regex/post-method/{param}', array(), array(), array(), '', array(), array('POST'))); - - return array( - array(new RouteCollection(), 'url_matcher0.php', array()), - array($collection, 'url_matcher1.php', array()), - array($redirectCollection, 'url_matcher2.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')), - array($rootprefixCollection, 'url_matcher3.php', array()), - array($headMatchCasesCollection, 'url_matcher4.php', array()), - array($groupOptimisedCollection, 'url_matcher5.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')), - array($trailingSlashCollection, 'url_matcher6.php', array()), - array($trailingSlashCollection, 'url_matcher7.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')), - ); + $trailingSlashCollection->add('simple_trailing_slash_no_methods', new Route('/trailing/simple/no-methods/', [], [], [], '', [], [])); + $trailingSlashCollection->add('simple_trailing_slash_GET_method', new Route('/trailing/simple/get-method/', [], [], [], '', [], ['GET'])); + $trailingSlashCollection->add('simple_trailing_slash_HEAD_method', new Route('/trailing/simple/head-method/', [], [], [], '', [], ['HEAD'])); + $trailingSlashCollection->add('simple_trailing_slash_POST_method', new Route('/trailing/simple/post-method/', [], [], [], '', [], ['POST'])); + $trailingSlashCollection->add('regex_trailing_slash_no_methods', new Route('/trailing/regex/no-methods/{param}/', [], [], [], '', [], [])); + $trailingSlashCollection->add('regex_trailing_slash_GET_method', new Route('/trailing/regex/get-method/{param}/', [], [], [], '', [], ['GET'])); + $trailingSlashCollection->add('regex_trailing_slash_HEAD_method', new Route('/trailing/regex/head-method/{param}/', [], [], [], '', [], ['HEAD'])); + $trailingSlashCollection->add('regex_trailing_slash_POST_method', new Route('/trailing/regex/post-method/{param}/', [], [], [], '', [], ['POST'])); + + $trailingSlashCollection->add('simple_not_trailing_slash_no_methods', new Route('/not-trailing/simple/no-methods', [], [], [], '', [], [])); + $trailingSlashCollection->add('simple_not_trailing_slash_GET_method', new Route('/not-trailing/simple/get-method', [], [], [], '', [], ['GET'])); + $trailingSlashCollection->add('simple_not_trailing_slash_HEAD_method', new Route('/not-trailing/simple/head-method', [], [], [], '', [], ['HEAD'])); + $trailingSlashCollection->add('simple_not_trailing_slash_POST_method', new Route('/not-trailing/simple/post-method', [], [], [], '', [], ['POST'])); + $trailingSlashCollection->add('regex_not_trailing_slash_no_methods', new Route('/not-trailing/regex/no-methods/{param}', [], [], [], '', [], [])); + $trailingSlashCollection->add('regex_not_trailing_slash_GET_method', new Route('/not-trailing/regex/get-method/{param}', [], [], [], '', [], ['GET'])); + $trailingSlashCollection->add('regex_not_trailing_slash_HEAD_method', new Route('/not-trailing/regex/head-method/{param}', [], [], [], '', [], ['HEAD'])); + $trailingSlashCollection->add('regex_not_trailing_slash_POST_method', new Route('/not-trailing/regex/post-method/{param}', [], [], [], '', [], ['POST'])); + + return [ + [new RouteCollection(), 'url_matcher0.php', []], + [$collection, 'url_matcher1.php', []], + [$redirectCollection, 'url_matcher2.php', ['base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher']], + [$rootprefixCollection, 'url_matcher3.php', []], + [$headMatchCasesCollection, 'url_matcher4.php', []], + [$groupOptimisedCollection, 'url_matcher5.php', ['base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher']], + [$trailingSlashCollection, 'url_matcher6.php', []], + [$trailingSlashCollection, 'url_matcher7.php', ['base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher']], + ]; } - /** - * @param $dumper - */ private function generateDumpedMatcher(RouteCollection $collection, $redirectableStub = false) { - $options = array('class' => $this->matcherClass); + $options = ['class' => $this->matcherClass]; if ($redirectableStub) { $options['base_class'] = '\Symfony\Component\Routing\Tests\Matcher\Dumper\RedirectableUrlMatcherStub'; diff --git a/vendor/symfony/routing/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php b/vendor/symfony/routing/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php index 37419e77436405b833b3a17d7e14589958581d5b..e0ee4e8ee9d12a6708fa439baaf2255deafae89f 100644 --- a/vendor/symfony/routing/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php +++ b/vendor/symfony/routing/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php @@ -28,51 +28,51 @@ public function testGrouping(array $routes, $expected) public function routeProvider() { - return array( - 'Simple - not nested' => array( - array( - array('/', 'root'), - array('/prefix/segment/', 'prefix_segment'), - array('/leading/segment/', 'leading_segment'), - ), + return [ + 'Simple - not nested' => [ + [ + ['/', 'root'], + ['/prefix/segment/', 'prefix_segment'], + ['/leading/segment/', 'leading_segment'], + ], <<<EOF / root /prefix/segment prefix_segment /leading/segment leading_segment EOF - ), - 'Not nested - group too small' => array( - array( - array('/', 'root'), - array('/prefix/segment/aa', 'prefix_segment'), - array('/prefix/segment/bb', 'leading_segment'), - ), + ], + 'Not nested - group too small' => [ + [ + ['/', 'root'], + ['/prefix/segment/aa', 'prefix_segment'], + ['/prefix/segment/bb', 'leading_segment'], + ], <<<EOF / root /prefix/segment/aa prefix_segment /prefix/segment/bb leading_segment EOF - ), - 'Nested - contains item at intersection' => array( - array( - array('/', 'root'), - array('/prefix/segment/', 'prefix_segment'), - array('/prefix/segment/bb', 'leading_segment'), - ), + ], + 'Nested - contains item at intersection' => [ + [ + ['/', 'root'], + ['/prefix/segment/', 'prefix_segment'], + ['/prefix/segment/bb', 'leading_segment'], + ], <<<EOF / root /prefix/segment -> /prefix/segment prefix_segment -> /prefix/segment/bb leading_segment EOF - ), - 'Simple one level nesting' => array( - array( - array('/', 'root'), - array('/group/segment/', 'nested_segment'), - array('/group/thing/', 'some_segment'), - array('/group/other/', 'other_segment'), - ), + ], + 'Simple one level nesting' => [ + [ + ['/', 'root'], + ['/group/segment/', 'nested_segment'], + ['/group/thing/', 'some_segment'], + ['/group/other/', 'other_segment'], + ], <<<EOF / root /group @@ -80,17 +80,17 @@ public function routeProvider() -> /group/thing some_segment -> /group/other other_segment EOF - ), - 'Retain matching order with groups' => array( - array( - array('/group/aa/', 'aa'), - array('/group/bb/', 'bb'), - array('/group/cc/', 'cc'), - array('/', 'root'), - array('/group/dd/', 'dd'), - array('/group/ee/', 'ee'), - array('/group/ff/', 'ff'), - ), + ], + 'Retain matching order with groups' => [ + [ + ['/group/aa/', 'aa'], + ['/group/bb/', 'bb'], + ['/group/cc/', 'cc'], + ['/', 'root'], + ['/group/dd/', 'dd'], + ['/group/ee/', 'ee'], + ['/group/ff/', 'ff'], + ], <<<EOF /group -> /group/aa aa @@ -102,20 +102,20 @@ public function routeProvider() -> /group/ee ee -> /group/ff ff EOF - ), - 'Retain complex matching order with groups at base' => array( - array( - array('/aaa/111/', 'first_aaa'), - array('/prefixed/group/aa/', 'aa'), - array('/prefixed/group/bb/', 'bb'), - array('/prefixed/group/cc/', 'cc'), - array('/prefixed/', 'root'), - array('/prefixed/group/dd/', 'dd'), - array('/prefixed/group/ee/', 'ee'), - array('/prefixed/group/ff/', 'ff'), - array('/aaa/222/', 'second_aaa'), - array('/aaa/333/', 'third_aaa'), - ), + ], + 'Retain complex matching order with groups at base' => [ + [ + ['/aaa/111/', 'first_aaa'], + ['/prefixed/group/aa/', 'aa'], + ['/prefixed/group/bb/', 'bb'], + ['/prefixed/group/cc/', 'cc'], + ['/prefixed/', 'root'], + ['/prefixed/group/dd/', 'dd'], + ['/prefixed/group/ee/', 'ee'], + ['/prefixed/group/ff/', 'ff'], + ['/aaa/222/', 'second_aaa'], + ['/aaa/333/', 'third_aaa'], + ], <<<EOF /aaa -> /aaa/111 first_aaa @@ -132,17 +132,17 @@ public function routeProvider() -> -> /prefixed/group/ee ee -> -> /prefixed/group/ff ff EOF - ), + ], - 'Group regardless of segments' => array( - array( - array('/aaa-111/', 'a1'), - array('/aaa-222/', 'a2'), - array('/aaa-333/', 'a3'), - array('/group-aa/', 'g1'), - array('/group-bb/', 'g2'), - array('/group-cc/', 'g3'), - ), + 'Group regardless of segments' => [ + [ + ['/aaa-111/', 'a1'], + ['/aaa-222/', 'a2'], + ['/aaa-333/', 'a3'], + ['/group-aa/', 'g1'], + ['/group-bb/', 'g2'], + ['/group-cc/', 'g3'], + ], <<<EOF /aaa- -> /aaa-111 a1 @@ -153,13 +153,13 @@ public function routeProvider() -> /group-bb g2 -> /group-cc g3 EOF - ), - ); + ], + ]; } private function dumpCollection(StaticPrefixCollection $collection, $prefix = '') { - $lines = array(); + $lines = []; foreach ($collection->getItems() as $item) { if ($item instanceof StaticPrefixCollection) { diff --git a/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php index 0f3cdeabac39feb054a60bc04f5bb95f1cac561c..e4336cdcac6c5a5ae6350b1cf02434ba1f7fd16d 100644 --- a/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php @@ -23,7 +23,7 @@ public function testMissingTrailingSlash() $coll->add('foo', new Route('/foo/')); $matcher = $this->getUrlMatcher($coll); - $matcher->expects($this->once())->method('redirect')->will($this->returnValue(array())); + $matcher->expects($this->once())->method('redirect')->will($this->returnValue([])); $matcher->match('/foo'); } @@ -44,14 +44,14 @@ public function testRedirectWhenNoSlashForNonSafeMethod() public function testSchemeRedirectRedirectsToFirstScheme() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('FTP', 'HTTPS'))); + $coll->add('foo', new Route('/foo', [], [], [], '', ['FTP', 'HTTPS'])); $matcher = $this->getUrlMatcher($coll); $matcher ->expects($this->once()) ->method('redirect') ->with('/foo', 'foo', 'ftp') - ->will($this->returnValue(array('_route' => 'foo'))) + ->will($this->returnValue(['_route' => 'foo'])) ; $matcher->match('/foo'); } @@ -59,7 +59,7 @@ public function testSchemeRedirectRedirectsToFirstScheme() public function testNoSchemaRedirectIfOneOfMultipleSchemesMatches() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https', 'http'))); + $coll->add('foo', new Route('/foo', [], [], [], '', ['https', 'http'])); $matcher = $this->getUrlMatcher($coll); $matcher @@ -71,16 +71,16 @@ public function testNoSchemaRedirectIfOneOfMultipleSchemesMatches() public function testSchemeRedirectWithParams() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo/{bar}', array(), array(), array(), '', array('https'))); + $coll->add('foo', new Route('/foo/{bar}', [], [], [], '', ['https'])); $matcher = $this->getUrlMatcher($coll); $matcher ->expects($this->once()) ->method('redirect') ->with('/foo/baz', 'foo', 'https') - ->will($this->returnValue(array('redirect' => 'value'))) + ->will($this->returnValue(['redirect' => 'value'])) ; - $this->assertEquals(array('_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'), $matcher->match('/foo/baz')); + $this->assertEquals(['_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'], $matcher->match('/foo/baz')); } public function testSlashRedirectWithParams() @@ -93,9 +93,9 @@ public function testSlashRedirectWithParams() ->expects($this->once()) ->method('redirect') ->with('/foo/baz/', 'foo', null) - ->will($this->returnValue(array('redirect' => 'value'))) + ->will($this->returnValue(['redirect' => 'value'])) ; - $this->assertEquals(array('_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'), $matcher->match('/foo/baz')); + $this->assertEquals(['_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'], $matcher->match('/foo/baz')); } public function testRedirectPreservesUrlEncoding() @@ -104,21 +104,49 @@ public function testRedirectPreservesUrlEncoding() $coll->add('foo', new Route('/foo:bar/')); $matcher = $this->getUrlMatcher($coll); - $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/')->willReturn(array()); + $matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/')->willReturn([]); $matcher->match('/foo%3Abar'); } public function testSchemeRequirement() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https'))); + $coll->add('foo', new Route('/foo', [], [], [], '', ['https'])); $matcher = $this->getUrlMatcher($coll, new RequestContext()); - $matcher->expects($this->once())->method('redirect')->with('/foo', 'foo', 'https')->willReturn(array()); - $this->assertSame(array('_route' => 'foo'), $matcher->match('/foo')); + $matcher->expects($this->once())->method('redirect')->with('/foo', 'foo', 'https')->willReturn([]); + $this->assertSame(['_route' => 'foo'], $matcher->match('/foo')); + } + + public function testFallbackPage() + { + $coll = new RouteCollection(); + $coll->add('foo', new Route('/foo/')); + $coll->add('bar', new Route('/{name}')); + + $matcher = $this->getUrlMatcher($coll); + $matcher->expects($this->once())->method('redirect')->with('/foo/')->will($this->returnValue(['_route' => 'foo'])); + $this->assertSame(['_route' => 'foo'], $matcher->match('/foo')); + } + + public function testSlashAndVerbPrecedenceWithRedirection() + { + $coll = new RouteCollection(); + $coll->add('a', new Route('/api/customers/{customerId}/contactpersons', [], [], [], '', [], ['post'])); + $coll->add('b', new Route('/api/customers/{customerId}/contactpersons/', [], [], [], '', [], ['get'])); + + $matcher = $this->getUrlMatcher($coll); + $expected = [ + '_route' => 'b', + 'customerId' => '123', + ]; + $this->assertEquals($expected, $matcher->match('/api/customers/123/contactpersons/')); + + $matcher->expects($this->once())->method('redirect')->with('/api/customers/123/contactpersons/')->willReturn([]); + $this->assertEquals($expected, $matcher->match('/api/customers/123/contactpersons')); } protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null) { - return $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($routes, $context ?: new RequestContext())); + return $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', [$routes, $context ?: new RequestContext()]); } } diff --git a/vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php index 1f026a6ec731312c6ed494399680d66a7312c8cc..04ddf845f0d7e00fe86915ae57ce16550e001725 100644 --- a/vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php @@ -23,41 +23,41 @@ class TraceableUrlMatcherTest extends TestCase public function test() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('POST'))); - $coll->add('bar', new Route('/bar/{id}', array(), array('id' => '\d+'))); - $coll->add('bar1', new Route('/bar/{name}', array(), array('id' => '\w+'), array(), '', array(), array('POST'))); - $coll->add('bar2', new Route('/foo', array(), array(), array(), 'baz')); - $coll->add('bar3', new Route('/foo1', array(), array(), array(), 'baz')); - $coll->add('bar4', new Route('/foo2', array(), array(), array(), 'baz', array(), array(), 'context.getMethod() == "GET"')); + $coll->add('foo', new Route('/foo', [], [], [], '', [], ['POST'])); + $coll->add('bar', new Route('/bar/{id}', [], ['id' => '\d+'])); + $coll->add('bar1', new Route('/bar/{name}', [], ['id' => '\w+'], [], '', [], ['POST'])); + $coll->add('bar2', new Route('/foo', [], [], [], 'baz')); + $coll->add('bar3', new Route('/foo1', [], [], [], 'baz')); + $coll->add('bar4', new Route('/foo2', [], [], [], 'baz', [], [], 'context.getMethod() == "GET"')); $context = new RequestContext(); $context->setHost('baz'); $matcher = new TraceableUrlMatcher($coll, $context); $traces = $matcher->getTraces('/babar'); - $this->assertSame(array(0, 0, 0, 0, 0, 0), $this->getLevels($traces)); + $this->assertSame([0, 0, 0, 0, 0, 0], $this->getLevels($traces)); $traces = $matcher->getTraces('/foo'); - $this->assertSame(array(1, 0, 0, 2), $this->getLevels($traces)); + $this->assertSame([1, 0, 0, 2], $this->getLevels($traces)); $traces = $matcher->getTraces('/bar/12'); - $this->assertSame(array(0, 2), $this->getLevels($traces)); + $this->assertSame([0, 2], $this->getLevels($traces)); $traces = $matcher->getTraces('/bar/dd'); - $this->assertSame(array(0, 1, 1, 0, 0, 0), $this->getLevels($traces)); + $this->assertSame([0, 1, 1, 0, 0, 0], $this->getLevels($traces)); $traces = $matcher->getTraces('/foo1'); - $this->assertSame(array(0, 0, 0, 0, 2), $this->getLevels($traces)); + $this->assertSame([0, 0, 0, 0, 2], $this->getLevels($traces)); $context->setMethod('POST'); $traces = $matcher->getTraces('/foo'); - $this->assertSame(array(2), $this->getLevels($traces)); + $this->assertSame([2], $this->getLevels($traces)); $traces = $matcher->getTraces('/bar/dd'); - $this->assertSame(array(0, 1, 2), $this->getLevels($traces)); + $this->assertSame([0, 1, 2], $this->getLevels($traces)); $traces = $matcher->getTraces('/foo2'); - $this->assertSame(array(0, 0, 0, 0, 0, 1), $this->getLevels($traces)); + $this->assertSame([0, 0, 0, 0, 0, 1], $this->getLevels($traces)); } public function testMatchRouteOnMultipleHosts() @@ -65,17 +65,17 @@ public function testMatchRouteOnMultipleHosts() $routes = new RouteCollection(); $routes->add('first', new Route( '/mypath/', - array('_controller' => 'MainBundle:Info:first'), - array(), - array(), + ['_controller' => 'MainBundle:Info:first'], + [], + [], 'some.example.com' )); $routes->add('second', new Route( '/mypath/', - array('_controller' => 'MainBundle:Info:second'), - array(), - array(), + ['_controller' => 'MainBundle:Info:second'], + [], + [], 'another.example.com' )); @@ -86,14 +86,14 @@ public function testMatchRouteOnMultipleHosts() $traces = $matcher->getTraces('/mypath/'); $this->assertSame( - array(TraceableUrlMatcher::ROUTE_ALMOST_MATCHES, TraceableUrlMatcher::ROUTE_ALMOST_MATCHES), + [TraceableUrlMatcher::ROUTE_ALMOST_MATCHES, TraceableUrlMatcher::ROUTE_ALMOST_MATCHES], $this->getLevels($traces) ); } public function getLevels($traces) { - $levels = array(); + $levels = []; foreach ($traces as $trace) { $levels[] = $trace['level']; } @@ -104,7 +104,7 @@ public function getLevels($traces) public function testRoutesWithConditions() { $routes = new RouteCollection(); - $routes->add('foo', new Route('/foo', array(), array(), array(), 'baz', array(), array(), "request.headers.get('User-Agent') matches '/firefox/i'")); + $routes->add('foo', new Route('/foo', [], [], [], 'baz', [], [], "request.headers.get('User-Agent') matches '/firefox/i'")); $context = new RequestContext(); $context->setHost('baz'); @@ -115,7 +115,7 @@ public function testRoutesWithConditions() $traces = $matcher->getTracesForRequest($notMatchingRequest); $this->assertEquals("Condition \"request.headers.get('User-Agent') matches '/firefox/i'\" does not evaluate to \"true\"", $traces[0]['log']); - $matchingRequest = Request::create('/foo', 'GET', array(), array(), array(), array('HTTP_USER_AGENT' => 'Firefox')); + $matchingRequest = Request::create('/foo', 'GET', [], [], [], ['HTTP_USER_AGENT' => 'Firefox']); $traces = $matcher->getTracesForRequest($matchingRequest); $this->assertEquals('Route matches!', $traces[0]['log']); } diff --git a/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php index 0d4b44b09070490432f9d98c38429cdf036a1e47..61f9be335847104b4047dad8770edda0154e8467 100644 --- a/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php @@ -33,7 +33,7 @@ public function testNoMethodSoAllowed() public function testMethodNotAllowed() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('post'))); + $coll->add('foo', new Route('/foo', [], [], [], '', [], ['post'])); $matcher = $this->getUrlMatcher($coll); @@ -41,14 +41,14 @@ public function testMethodNotAllowed() $matcher->match('/foo'); $this->fail(); } catch (MethodNotAllowedException $e) { - $this->assertEquals(array('POST'), $e->getAllowedMethods()); + $this->assertEquals(['POST'], $e->getAllowedMethods()); } } public function testMethodNotAllowedOnRoot() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/', array(), array(), array(), '', array(), array('GET'))); + $coll->add('foo', new Route('/', [], [], [], '', [], ['GET'])); $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'POST')); @@ -56,14 +56,14 @@ public function testMethodNotAllowedOnRoot() $matcher->match('/'); $this->fail(); } catch (MethodNotAllowedException $e) { - $this->assertEquals(array('GET'), $e->getAllowedMethods()); + $this->assertEquals(['GET'], $e->getAllowedMethods()); } } public function testHeadAllowedWhenRequirementContainsGet() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('get'))); + $coll->add('foo', new Route('/foo', [], [], [], '', [], ['get'])); $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'head')); $this->assertInternalType('array', $matcher->match('/foo')); @@ -72,8 +72,8 @@ public function testHeadAllowedWhenRequirementContainsGet() public function testMethodNotAllowedAggregatesAllowedMethods() { $coll = new RouteCollection(); - $coll->add('foo1', new Route('/foo', array(), array(), array(), '', array(), array('post'))); - $coll->add('foo2', new Route('/foo', array(), array(), array(), '', array(), array('put', 'delete'))); + $coll->add('foo1', new Route('/foo', [], [], [], '', [], ['post'])); + $coll->add('foo2', new Route('/foo', [], [], [], '', [], ['put', 'delete'])); $matcher = $this->getUrlMatcher($coll); @@ -81,7 +81,7 @@ public function testMethodNotAllowedAggregatesAllowedMethods() $matcher->match('/foo'); $this->fail(); } catch (MethodNotAllowedException $e) { - $this->assertEquals(array('POST', 'PUT', 'DELETE'), $e->getAllowedMethods()); + $this->assertEquals(['POST', 'PUT', 'DELETE'], $e->getAllowedMethods()); } } @@ -96,17 +96,17 @@ public function testMatch() $this->fail(); } catch (ResourceNotFoundException $e) { } - $this->assertEquals(array('_route' => 'foo', 'bar' => 'baz'), $matcher->match('/foo/baz')); + $this->assertEquals(['_route' => 'foo', 'bar' => 'baz'], $matcher->match('/foo/baz')); // test that defaults are merged $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo/{bar}', array('def' => 'test'))); + $collection->add('foo', new Route('/foo/{bar}', ['def' => 'test'])); $matcher = $this->getUrlMatcher($collection); - $this->assertEquals(array('_route' => 'foo', 'bar' => 'baz', 'def' => 'test'), $matcher->match('/foo/baz')); + $this->assertEquals(['_route' => 'foo', 'bar' => 'baz', 'def' => 'test'], $matcher->match('/foo/baz')); // test that route "method" is ignored if no method is given in the context $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('get', 'head'))); + $collection->add('foo', new Route('/foo', [], [], [], '', [], ['get', 'head'])); $matcher = $this->getUrlMatcher($collection); $this->assertInternalType('array', $matcher->match('/foo')); @@ -126,24 +126,24 @@ public function testMatch() // route with an optional variable as the first segment $collection = new RouteCollection(); - $collection->add('bar', new Route('/{bar}/foo', array('bar' => 'bar'), array('bar' => 'foo|bar'))); + $collection->add('bar', new Route('/{bar}/foo', ['bar' => 'bar'], ['bar' => 'foo|bar'])); $matcher = $this->getUrlMatcher($collection); - $this->assertEquals(array('_route' => 'bar', 'bar' => 'bar'), $matcher->match('/bar/foo')); - $this->assertEquals(array('_route' => 'bar', 'bar' => 'foo'), $matcher->match('/foo/foo')); + $this->assertEquals(['_route' => 'bar', 'bar' => 'bar'], $matcher->match('/bar/foo')); + $this->assertEquals(['_route' => 'bar', 'bar' => 'foo'], $matcher->match('/foo/foo')); $collection = new RouteCollection(); - $collection->add('bar', new Route('/{bar}', array('bar' => 'bar'), array('bar' => 'foo|bar'))); + $collection->add('bar', new Route('/{bar}', ['bar' => 'bar'], ['bar' => 'foo|bar'])); $matcher = $this->getUrlMatcher($collection); - $this->assertEquals(array('_route' => 'bar', 'bar' => 'foo'), $matcher->match('/foo')); - $this->assertEquals(array('_route' => 'bar', 'bar' => 'bar'), $matcher->match('/')); + $this->assertEquals(['_route' => 'bar', 'bar' => 'foo'], $matcher->match('/foo')); + $this->assertEquals(['_route' => 'bar', 'bar' => 'bar'], $matcher->match('/')); // route with only optional variables $collection = new RouteCollection(); - $collection->add('bar', new Route('/{foo}/{bar}', array('foo' => 'foo', 'bar' => 'bar'), array())); + $collection->add('bar', new Route('/{foo}/{bar}', ['foo' => 'foo', 'bar' => 'bar'], [])); $matcher = $this->getUrlMatcher($collection); - $this->assertEquals(array('_route' => 'bar', 'foo' => 'foo', 'bar' => 'bar'), $matcher->match('/')); - $this->assertEquals(array('_route' => 'bar', 'foo' => 'a', 'bar' => 'bar'), $matcher->match('/a')); - $this->assertEquals(array('_route' => 'bar', 'foo' => 'a', 'bar' => 'b'), $matcher->match('/a/b')); + $this->assertEquals(['_route' => 'bar', 'foo' => 'foo', 'bar' => 'bar'], $matcher->match('/')); + $this->assertEquals(['_route' => 'bar', 'foo' => 'a', 'bar' => 'bar'], $matcher->match('/a')); + $this->assertEquals(['_route' => 'bar', 'foo' => 'a', 'bar' => 'b'], $matcher->match('/a/b')); } public function testMatchWithPrefixes() @@ -154,7 +154,7 @@ public function testMatchWithPrefixes() $collection->addPrefix('/a'); $matcher = $this->getUrlMatcher($collection); - $this->assertEquals(array('_route' => 'foo', 'foo' => 'foo'), $matcher->match('/a/b/foo')); + $this->assertEquals(['_route' => 'foo', 'foo' => 'foo'], $matcher->match('/a/b/foo')); } public function testMatchWithDynamicPrefix() @@ -165,7 +165,7 @@ public function testMatchWithDynamicPrefix() $collection->addPrefix('/{_locale}'); $matcher = $this->getUrlMatcher($collection); - $this->assertEquals(array('_locale' => 'fr', '_route' => 'foo', 'foo' => 'foo'), $matcher->match('/fr/b/foo')); + $this->assertEquals(['_locale' => 'fr', '_route' => 'foo', 'foo' => 'foo'], $matcher->match('/fr/b/foo')); } public function testMatchSpecialRouteName() @@ -174,7 +174,7 @@ public function testMatchSpecialRouteName() $collection->add('$péß^a|', new Route('/bar')); $matcher = $this->getUrlMatcher($collection); - $this->assertEquals(array('_route' => '$péß^a|'), $matcher->match('/bar')); + $this->assertEquals(['_route' => '$péß^a|'], $matcher->match('/bar')); } /** @@ -193,20 +193,20 @@ public function testMatchNonAlpha() { $collection = new RouteCollection(); $chars = '!"$%éà &\'()*+,./:;<=>@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\[]^_`abcdefghijklmnopqrstuvwxyz{|}~-'; - $collection->add('foo', new Route('/{foo}/bar', array(), array('foo' => '['.preg_quote($chars).']+'), array('utf8' => true))); + $collection->add('foo', new Route('/{foo}/bar', [], ['foo' => '['.preg_quote($chars).']+'], ['utf8' => true])); $matcher = $this->getUrlMatcher($collection); - $this->assertEquals(array('_route' => 'foo', 'foo' => $chars), $matcher->match('/'.rawurlencode($chars).'/bar')); - $this->assertEquals(array('_route' => 'foo', 'foo' => $chars), $matcher->match('/'.strtr($chars, array('%' => '%25')).'/bar')); + $this->assertEquals(['_route' => 'foo', 'foo' => $chars], $matcher->match('/'.rawurlencode($chars).'/bar')); + $this->assertEquals(['_route' => 'foo', 'foo' => $chars], $matcher->match('/'.strtr($chars, ['%' => '%25']).'/bar')); } public function testMatchWithDotMetacharacterInRequirements() { $collection = new RouteCollection(); - $collection->add('foo', new Route('/{foo}/bar', array(), array('foo' => '.+'))); + $collection->add('foo', new Route('/{foo}/bar', [], ['foo' => '.+'])); $matcher = $this->getUrlMatcher($collection); - $this->assertEquals(array('_route' => 'foo', 'foo' => "\n"), $matcher->match('/'.urlencode("\n").'/bar'), 'linefeed character is matched'); + $this->assertEquals(['_route' => 'foo', 'foo' => "\n"], $matcher->match('/'.urlencode("\n").'/bar'), 'linefeed character is matched'); } public function testMatchOverriddenRoute() @@ -221,9 +221,9 @@ public function testMatchOverriddenRoute() $matcher = $this->getUrlMatcher($collection); - $this->assertEquals(array('_route' => 'foo'), $matcher->match('/foo1')); + $this->assertEquals(['_route' => 'foo'], $matcher->match('/foo1')); $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException'); - $this->assertEquals(array(), $matcher->match('/foo')); + $this->assertEquals([], $matcher->match('/foo')); } public function testMatchRegression() @@ -233,7 +233,7 @@ public function testMatchRegression() $coll->add('bar', new Route('/foo/bar/{foo}')); $matcher = $this->getUrlMatcher($coll); - $this->assertEquals(array('foo' => 'bar', '_route' => 'bar'), $matcher->match('/foo/bar/bar')); + $this->assertEquals(['foo' => 'bar', '_route' => 'bar'], $matcher->match('/foo/bar/bar')); $collection = new RouteCollection(); $collection->add('foo', new Route('/{bar}')); @@ -248,36 +248,36 @@ public function testMatchRegression() public function testDefaultRequirementForOptionalVariables() { $coll = new RouteCollection(); - $coll->add('test', new Route('/{page}.{_format}', array('page' => 'index', '_format' => 'html'))); + $coll->add('test', new Route('/{page}.{_format}', ['page' => 'index', '_format' => 'html'])); $matcher = $this->getUrlMatcher($coll); - $this->assertEquals(array('page' => 'my-page', '_format' => 'xml', '_route' => 'test'), $matcher->match('/my-page.xml')); + $this->assertEquals(['page' => 'my-page', '_format' => 'xml', '_route' => 'test'], $matcher->match('/my-page.xml')); } public function testMatchingIsEager() { $coll = new RouteCollection(); - $coll->add('test', new Route('/{foo}-{bar}-', array(), array('foo' => '.+', 'bar' => '.+'))); + $coll->add('test', new Route('/{foo}-{bar}-', [], ['foo' => '.+', 'bar' => '.+'])); $matcher = $this->getUrlMatcher($coll); - $this->assertEquals(array('foo' => 'text1-text2-text3', 'bar' => 'text4', '_route' => 'test'), $matcher->match('/text1-text2-text3-text4-')); + $this->assertEquals(['foo' => 'text1-text2-text3', 'bar' => 'text4', '_route' => 'test'], $matcher->match('/text1-text2-text3-text4-')); } public function testAdjacentVariables() { $coll = new RouteCollection(); - $coll->add('test', new Route('/{w}{x}{y}{z}.{_format}', array('z' => 'default-z', '_format' => 'html'), array('y' => 'y|Y'))); + $coll->add('test', new Route('/{w}{x}{y}{z}.{_format}', ['z' => 'default-z', '_format' => 'html'], ['y' => 'y|Y'])); $matcher = $this->getUrlMatcher($coll); // 'w' eagerly matches as much as possible and the other variables match the remaining chars. // This also shows that the variables w-z must all exclude the separating char (the dot '.' in this case) by default requirement. // Otherwise they would also consume '.xml' and _format would never match as it's an optional variable. - $this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'Y', 'z' => 'Z', '_format' => 'xml', '_route' => 'test'), $matcher->match('/wwwwwxYZ.xml')); + $this->assertEquals(['w' => 'wwwww', 'x' => 'x', 'y' => 'Y', 'z' => 'Z', '_format' => 'xml', '_route' => 'test'], $matcher->match('/wwwwwxYZ.xml')); // As 'y' has custom requirement and can only be of value 'y|Y', it will leave 'ZZZ' to variable z. // So with carefully chosen requirements adjacent variables, can be useful. - $this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'ZZZ', '_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxyZZZ')); + $this->assertEquals(['w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'ZZZ', '_format' => 'html', '_route' => 'test'], $matcher->match('/wwwwwxyZZZ')); // z and _format are optional. - $this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'default-z', '_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxy')); + $this->assertEquals(['w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'default-z', '_format' => 'html', '_route' => 'test'], $matcher->match('/wwwwwxy')); $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException'); $matcher->match('/wxy.html'); @@ -286,11 +286,11 @@ public function testAdjacentVariables() public function testOptionalVariableWithNoRealSeparator() { $coll = new RouteCollection(); - $coll->add('test', new Route('/get{what}', array('what' => 'All'))); + $coll->add('test', new Route('/get{what}', ['what' => 'All'])); $matcher = $this->getUrlMatcher($coll); - $this->assertEquals(array('what' => 'All', '_route' => 'test'), $matcher->match('/get')); - $this->assertEquals(array('what' => 'Sites', '_route' => 'test'), $matcher->match('/getSites')); + $this->assertEquals(['what' => 'All', '_route' => 'test'], $matcher->match('/get')); + $this->assertEquals(['what' => 'Sites', '_route' => 'test'], $matcher->match('/getSites')); // Usually the character in front of an optional parameter can be left out, e.g. with pattern '/get/{what}' just '/get' would match. // But here the 't' in 'get' is not a separating character, so it makes no sense to match without it. @@ -304,7 +304,7 @@ public function testRequiredVariableWithNoRealSeparator() $coll->add('test', new Route('/get{what}Suffix')); $matcher = $this->getUrlMatcher($coll); - $this->assertEquals(array('what' => 'Sites', '_route' => 'test'), $matcher->match('/getSitesSuffix')); + $this->assertEquals(['what' => 'Sites', '_route' => 'test'], $matcher->match('/getSitesSuffix')); } public function testDefaultRequirementOfVariable() @@ -313,7 +313,7 @@ public function testDefaultRequirementOfVariable() $coll->add('test', new Route('/{page}.{_format}')); $matcher = $this->getUrlMatcher($coll); - $this->assertEquals(array('page' => 'index', '_format' => 'mobile.html', '_route' => 'test'), $matcher->match('/index.mobile.html')); + $this->assertEquals(['page' => 'index', '_format' => 'mobile.html', '_route' => 'test'], $matcher->match('/index.mobile.html')); } /** @@ -334,7 +334,7 @@ public function testDefaultRequirementOfVariableDisallowsSlash() public function testDefaultRequirementOfVariableDisallowsNextSeparator() { $coll = new RouteCollection(); - $coll->add('test', new Route('/{page}.{_format}', array(), array('_format' => 'html|xml'))); + $coll->add('test', new Route('/{page}.{_format}', [], ['_format' => 'html|xml'])); $matcher = $this->getUrlMatcher($coll); $matcher->match('/do.t.html'); @@ -346,7 +346,7 @@ public function testDefaultRequirementOfVariableDisallowsNextSeparator() public function testSchemeRequirement() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https'))); + $coll->add('foo', new Route('/foo', [], [], [], '', ['https'])); $matcher = $this->getUrlMatcher($coll); $matcher->match('/foo'); } @@ -371,7 +371,7 @@ public function testRequestCondition() $route->setCondition('request.getBaseUrl() == "/sub/front.php" and request.getPathInfo() == "/foo/bar"'); $coll->add('foo', $route); $matcher = $this->getUrlMatcher($coll, new RequestContext('/sub/front.php')); - $this->assertEquals(array('bar' => 'bar', '_route' => 'foo'), $matcher->match('/foo/bar')); + $this->assertEquals(['bar' => 'bar', '_route' => 'foo'], $matcher->match('/foo/bar')); } public function testDecodeOnce() @@ -380,7 +380,7 @@ public function testDecodeOnce() $coll->add('foo', new Route('/foo/{foo}')); $matcher = $this->getUrlMatcher($coll); - $this->assertEquals(array('foo' => 'bar%23', '_route' => 'foo'), $matcher->match('/foo/bar%2523')); + $this->assertEquals(['foo' => 'bar%23', '_route' => 'foo'], $matcher->match('/foo/bar%2523')); } public function testCannotRelyOnPrefix() @@ -396,30 +396,30 @@ public function testCannotRelyOnPrefix() $coll->addCollection($subColl); $matcher = $this->getUrlMatcher($coll); - $this->assertEquals(array('_route' => 'bar'), $matcher->match('/new')); + $this->assertEquals(['_route' => 'bar'], $matcher->match('/new')); } public function testWithHost() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo/{foo}', array(), array(), array(), '{locale}.example.com')); + $coll->add('foo', new Route('/foo/{foo}', [], [], [], '{locale}.example.com')); $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com')); - $this->assertEquals(array('foo' => 'bar', '_route' => 'foo', 'locale' => 'en'), $matcher->match('/foo/bar')); + $this->assertEquals(['foo' => 'bar', '_route' => 'foo', 'locale' => 'en'], $matcher->match('/foo/bar')); } public function testWithHostOnRouteCollection() { $coll = new RouteCollection(); $coll->add('foo', new Route('/foo/{foo}')); - $coll->add('bar', new Route('/bar/{foo}', array(), array(), array(), '{locale}.example.net')); + $coll->add('bar', new Route('/bar/{foo}', [], [], [], '{locale}.example.net')); $coll->setHost('{locale}.example.com'); $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com')); - $this->assertEquals(array('foo' => 'bar', '_route' => 'foo', 'locale' => 'en'), $matcher->match('/foo/bar')); + $this->assertEquals(['foo' => 'bar', '_route' => 'foo', 'locale' => 'en'], $matcher->match('/foo/bar')); $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com')); - $this->assertEquals(array('foo' => 'bar', '_route' => 'bar', 'locale' => 'en'), $matcher->match('/bar/bar')); + $this->assertEquals(['foo' => 'bar', '_route' => 'bar', 'locale' => 'en'], $matcher->match('/bar/bar')); } /** @@ -428,7 +428,7 @@ public function testWithHostOnRouteCollection() public function testWithOutHostHostDoesNotMatch() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo/{foo}', array(), array(), array(), '{locale}.example.com')); + $coll->add('foo', new Route('/foo/{foo}', [], [], [], '{locale}.example.com')); $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'GET', 'example.com')); $matcher->match('/foo/bar'); @@ -440,7 +440,7 @@ public function testWithOutHostHostDoesNotMatch() public function testPathIsCaseSensitive() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/locale', array(), array('locale' => 'EN|FR|DE'))); + $coll->add('foo', new Route('/locale', [], ['locale' => 'EN|FR|DE'])); $matcher = $this->getUrlMatcher($coll); $matcher->match('/en'); @@ -449,10 +449,10 @@ public function testPathIsCaseSensitive() public function testHostIsCaseInsensitive() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/', array(), array('locale' => 'EN|FR|DE'), array(), '{locale}.example.com')); + $coll->add('foo', new Route('/', [], ['locale' => 'EN|FR|DE'], [], '{locale}.example.com')); $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com')); - $this->assertEquals(array('_route' => 'foo', 'locale' => 'en'), $matcher->match('/')); + $this->assertEquals(['_route' => 'foo', 'locale' => 'en'], $matcher->match('/')); } /** @@ -485,9 +485,9 @@ public function testNestedCollections() $coll->addCollection($subColl); $matcher = $this->getUrlMatcher($coll); - $this->assertEquals(array('_route' => 'a'), $matcher->match('/p/a')); - $this->assertEquals(array('_route' => 'baz', 'baz' => 'p'), $matcher->match('/p')); - $this->assertEquals(array('_route' => 'buz'), $matcher->match('/prefix/buz')); + $this->assertEquals(['_route' => 'a'], $matcher->match('/p/a')); + $this->assertEquals(['_route' => 'baz', 'baz' => 'p'], $matcher->match('/p')); + $this->assertEquals(['_route' => 'buz'], $matcher->match('/prefix/buz')); } /** @@ -496,12 +496,137 @@ public function testNestedCollections() public function testSchemeAndMethodMismatch() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/', array(), array(), array(), null, array('https'), array('POST'))); + $coll->add('foo', new Route('/', [], [], [], null, ['https'], ['POST'])); $matcher = $this->getUrlMatcher($coll); $matcher->match('/'); } + public function testSiblingRoutes() + { + $coll = new RouteCollection(); + $coll->add('a', (new Route('/a{a}'))->setMethods('POST')); + $coll->add('b', (new Route('/a{a}'))->setMethods('PUT')); + $coll->add('c', new Route('/a{a}')); + $coll->add('d', (new Route('/b{a}'))->setCondition('false')); + $coll->add('e', (new Route('/{b}{a}'))->setCondition('false')); + $coll->add('f', (new Route('/{b}{a}'))->setRequirements(['b' => 'b'])); + + $matcher = $this->getUrlMatcher($coll); + $this->assertEquals(['_route' => 'c', 'a' => 'a'], $matcher->match('/aa')); + $this->assertEquals(['_route' => 'f', 'b' => 'b', 'a' => 'a'], $matcher->match('/ba')); + } + + public function testRequirementWithCapturingGroup() + { + $coll = new RouteCollection(); + $coll->add('a', new Route('/{a}/{b}', [], ['a' => '(a|b)'])); + + $matcher = $this->getUrlMatcher($coll); + $this->assertEquals(['_route' => 'a', 'a' => 'a', 'b' => 'b'], $matcher->match('/a/b')); + } + + public function testDotAllWithCatchAll() + { + $coll = new RouteCollection(); + $coll->add('a', new Route('/{id}.html', [], ['id' => '.+'])); + $coll->add('b', new Route('/{all}', [], ['all' => '.+'])); + + $matcher = $this->getUrlMatcher($coll); + $this->assertEquals(['_route' => 'a', 'id' => 'foo/bar'], $matcher->match('/foo/bar.html')); + } + + public function testHostPattern() + { + $coll = new RouteCollection(); + $coll->add('a', new Route('/{app}/{action}/{unused}', [], [], [], '{host}')); + + $expected = [ + '_route' => 'a', + 'app' => 'an_app', + 'action' => 'an_action', + 'unused' => 'unused', + 'host' => 'foo', + ]; + $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'GET', 'foo')); + $this->assertEquals($expected, $matcher->match('/an_app/an_action/unused')); + } + + public function testHostWithDot() + { + $coll = new RouteCollection(); + $coll->add('a', new Route('/foo', [], [], [], 'foo.example.com')); + $coll->add('b', new Route('/bar/{baz}')); + + $matcher = $this->getUrlMatcher($coll); + $this->assertEquals('b', $matcher->match('/bar/abc.123')['_route']); + } + + public function testSlashVariant() + { + $coll = new RouteCollection(); + $coll->add('a', new Route('/foo/{bar}', [], ['bar' => '.*'])); + + $matcher = $this->getUrlMatcher($coll); + $this->assertEquals('a', $matcher->match('/foo/')['_route']); + } + + public function testSlashWithVerb() + { + $coll = new RouteCollection(); + $coll->add('a', new Route('/{foo}', [], [], [], '', [], ['put', 'delete'])); + $coll->add('b', new Route('/bar/')); + + $matcher = $this->getUrlMatcher($coll); + $this->assertSame(['_route' => 'b'], $matcher->match('/bar/')); + + $coll = new RouteCollection(); + $coll->add('a', new Route('/dav/{foo}', [], ['foo' => '.*'], [], '', [], ['GET', 'OPTIONS'])); + + $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'OPTIONS')); + $expected = [ + '_route' => 'a', + 'foo' => 'files/bar/', + ]; + $this->assertEquals($expected, $matcher->match('/dav/files/bar/')); + } + + public function testSlashAndVerbPrecedence() + { + $coll = new RouteCollection(); + $coll->add('a', new Route('/api/customers/{customerId}/contactpersons/', [], [], [], '', [], ['post'])); + $coll->add('b', new Route('/api/customers/{customerId}/contactpersons', [], [], [], '', [], ['get'])); + + $matcher = $this->getUrlMatcher($coll); + $expected = [ + '_route' => 'b', + 'customerId' => '123', + ]; + $this->assertEquals($expected, $matcher->match('/api/customers/123/contactpersons')); + + $coll = new RouteCollection(); + $coll->add('a', new Route('/api/customers/{customerId}/contactpersons/', [], [], [], '', [], ['get'])); + $coll->add('b', new Route('/api/customers/{customerId}/contactpersons', [], [], [], '', [], ['post'])); + + $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'POST')); + $expected = [ + '_route' => 'b', + 'customerId' => '123', + ]; + $this->assertEquals($expected, $matcher->match('/api/customers/123/contactpersons')); + } + + public function testGreedyTrailingRequirement() + { + $coll = new RouteCollection(); + $coll->add('a', new Route('/{a}', [], ['a' => '.+'])); + + $matcher = $this->getUrlMatcher($coll); + + $this->assertEquals(['_route' => 'a', 'a' => 'foo'], $matcher->match('/foo')); + $this->assertEquals(['_route' => 'a', 'a' => 'foo/'], $matcher->match('/foo/')); + } + protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null) { return new UrlMatcher($routes, $context ?: new RequestContext()); diff --git a/vendor/symfony/routing/Tests/RequestContextTest.php b/vendor/symfony/routing/Tests/RequestContextTest.php index ffe29d1a747c9fdad60e741e14553f2774003a33..3d23b0e8947a2e07cd52daad4e9b43e95477f662 100644 --- a/vendor/symfony/routing/Tests/RequestContextTest.php +++ b/vendor/symfony/routing/Tests/RequestContextTest.php @@ -68,16 +68,16 @@ public function testFromRequest() public function testGetParameters() { $requestContext = new RequestContext(); - $this->assertEquals(array(), $requestContext->getParameters()); + $this->assertEquals([], $requestContext->getParameters()); - $requestContext->setParameters(array('foo' => 'bar')); - $this->assertEquals(array('foo' => 'bar'), $requestContext->getParameters()); + $requestContext->setParameters(['foo' => 'bar']); + $this->assertEquals(['foo' => 'bar'], $requestContext->getParameters()); } public function testHasParameter() { $requestContext = new RequestContext(); - $requestContext->setParameters(array('foo' => 'bar')); + $requestContext->setParameters(['foo' => 'bar']); $this->assertTrue($requestContext->hasParameter('foo')); $this->assertFalse($requestContext->hasParameter('baz')); @@ -86,7 +86,7 @@ public function testHasParameter() public function testGetParameter() { $requestContext = new RequestContext(); - $requestContext->setParameters(array('foo' => 'bar')); + $requestContext->setParameters(['foo' => 'bar']); $this->assertEquals('bar', $requestContext->getParameter('foo')); $this->assertNull($requestContext->getParameter('baz')); @@ -154,7 +154,7 @@ public function testFluentInterface() $this->assertSame($requestContext, $requestContext->setQueryString('foo=bar')); $this->assertSame($requestContext, $requestContext->setHttpPort(80)); $this->assertSame($requestContext, $requestContext->setHttpsPort(443)); - $this->assertSame($requestContext, $requestContext->setParameters(array())); + $this->assertSame($requestContext, $requestContext->setParameters([])); $this->assertSame($requestContext, $requestContext->setParameter('foo', 'bar')); } } diff --git a/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php b/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php index 76a042d670b29114005a984be58d1ea48fbda8f0..20afdff484f8aaecb3b85f61ce15d3e108c4805d 100644 --- a/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php +++ b/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php @@ -68,7 +68,7 @@ public function testImport() public function testImportAddResources() { - $routeCollectionBuilder = new RouteCollectionBuilder(new YamlFileLoader(new FileLocator(array(__DIR__.'/Fixtures/')))); + $routeCollectionBuilder = new RouteCollectionBuilder(new YamlFileLoader(new FileLocator([__DIR__.'/Fixtures/']))); $routeCollectionBuilder->import('file_resource.yml'); $routeCollection = $routeCollectionBuilder->build(); @@ -131,13 +131,13 @@ public function testFlushOrdering() $this->assertCount(5, $actualCollection); $actualRouteNames = array_keys($actualCollection->all()); - $this->assertEquals(array( + $this->assertEquals([ 'checkout_route', 'imported_route1', 'imported_route2', 'homepage', 'admin_dashboard', - ), $actualRouteNames); + ], $actualRouteNames); // make sure the defaults were set $checkoutRoute = $actualCollection->get('checkout_route'); @@ -154,18 +154,18 @@ public function testFlushSetsRouteNames() $collectionBuilder->add('/admin', 'AppBundle:Admin:dashboard', 'admin_dashboard'); // add an unnamed route $collectionBuilder->add('/blogs', 'AppBundle:Blog:list') - ->setMethods(array('GET')); + ->setMethods(['GET']); // integer route names are allowed - they don't confuse things $collectionBuilder->add('/products', 'AppBundle:Product:list', 100); $actualCollection = $collectionBuilder->build(); $actualRouteNames = array_keys($actualCollection->all()); - $this->assertEquals(array( + $this->assertEquals([ 'admin_dashboard', 'GET_blogs', '100', - ), $actualRouteNames); + ], $actualRouteNames); } public function testFlushSetsDetailsOnChildrenRoutes() @@ -183,8 +183,8 @@ public function testFlushSetsDetailsOnChildrenRoutes() ->setOption('fooBar', true) ->setHost('example.com') ->setCondition('request.isSecure()') - ->setSchemes(array('https')) - ->setMethods(array('POST')); + ->setSchemes(['https']) + ->setMethods(['POST']); // a simple route, nothing added to it $routes->add('/blogs/{id}', 'editAction', 'blog_edit'); @@ -201,8 +201,8 @@ public function testFlushSetsDetailsOnChildrenRoutes() ->setDefault('_locale', 'fr') ->setRequirement('_locale', 'fr|en') ->setOption('niceRoute', true) - ->setSchemes(array('http')) - ->setMethods(array('GET', 'POST')); + ->setSchemes(['http']) + ->setMethods(['GET', 'POST']); $collection = $routes->build(); $actualListRoute = $collection->get('blog_list'); @@ -216,8 +216,8 @@ public function testFlushSetsDetailsOnChildrenRoutes() $this->assertTrue($actualListRoute->getOption('fooBar')); $this->assertEquals('example.com', $actualListRoute->getHost()); $this->assertEquals('request.isSecure()', $actualListRoute->getCondition()); - $this->assertEquals(array('https'), $actualListRoute->getSchemes()); - $this->assertEquals(array('POST'), $actualListRoute->getMethods()); + $this->assertEquals(['https'], $actualListRoute->getSchemes()); + $this->assertEquals(['POST'], $actualListRoute->getMethods()); // inherited from the main collection $this->assertEquals('fr', $actualListRoute->getDefault('_locale')); $this->assertEquals('fr|en', $actualListRoute->getRequirement('_locale')); @@ -227,8 +227,8 @@ public function testFlushSetsDetailsOnChildrenRoutes() // inherited from the collection $this->assertEquals('symfony.com', $actualEditRoute->getHost()); $this->assertEquals('request.query.get("page")==1', $actualEditRoute->getCondition()); - $this->assertEquals(array('http'), $actualEditRoute->getSchemes()); - $this->assertEquals(array('GET', 'POST'), $actualEditRoute->getMethods()); + $this->assertEquals(['http'], $actualEditRoute->getSchemes()); + $this->assertEquals(['GET', 'POST'], $actualEditRoute->getMethods()); } /** @@ -250,16 +250,16 @@ public function testFlushPrefixesPaths($collectionPrefix, $routePath, $expectedP public function providePrefixTests() { - $tests = array(); + $tests = []; // empty prefix is of course ok - $tests[] = array('', '/foo', '/foo'); + $tests[] = ['', '/foo', '/foo']; // normal prefix - does not matter if it's a wildcard - $tests[] = array('/{admin}', '/foo', '/{admin}/foo'); + $tests[] = ['/{admin}', '/foo', '/{admin}/foo']; // shows that a prefix will always be given the starting slash - $tests[] = array('0', '/foo', '/0/foo'); + $tests[] = ['0', '/foo', '/0/foo']; // spaces are ok, and double slahses at the end are cleaned - $tests[] = array('/ /', '/foo', '/ /foo'); + $tests[] = ['/ /', '/foo', '/ /foo']; return $tests; } @@ -323,10 +323,10 @@ public function testAutomaticRouteNamesDoNotConflict() $accountRoutes = $routes->createBuilder(); // route 2 $accountRoutes->add('/dashboard', '') - ->setMethods(array('GET')); + ->setMethods(['GET']); // route 3 $accountRoutes->add('/dashboard', '') - ->setMethods(array('POST')); + ->setMethods(['POST']); $routes->mount('/admin', $adminRoutes); $routes->mount('/account', $accountRoutes); @@ -351,7 +351,7 @@ public function testAddsThePrefixOnlyOnceWhenLoadingMultipleCollections() $loader ->expects($this->any()) ->method('load') - ->will($this->returnValue(array($firstCollection, $secondCollection))); + ->will($this->returnValue([$firstCollection, $secondCollection])); $routeCollectionBuilder = new RouteCollectionBuilder($loader); $routeCollectionBuilder->import('/directory/recurse/*', '/other/', 'glob'); diff --git a/vendor/symfony/routing/Tests/RouteCollectionTest.php b/vendor/symfony/routing/Tests/RouteCollectionTest.php index 78eb5ba5395f876a19555151f32b880a8ac616b1..2d29d32968d50617dd2adf69f3b11d21ed30dbe6 100644 --- a/vendor/symfony/routing/Tests/RouteCollectionTest.php +++ b/vendor/symfony/routing/Tests/RouteCollectionTest.php @@ -23,7 +23,7 @@ public function testRoute() $collection = new RouteCollection(); $route = new Route('/foo'); $collection->add('foo', $route); - $this->assertEquals(array('foo' => $route), $collection->all(), '->add() adds a route'); + $this->assertEquals(['foo' => $route], $collection->all(), '->add() adds a route'); $this->assertEquals($route, $collection->get('foo'), '->get() returns a route by name'); $this->assertNull($collection->get('bar'), '->get() returns null if a route does not exist'); } @@ -67,7 +67,7 @@ public function testIterator() $collection->add('last', $last = new Route('/last')); $this->assertInstanceOf('\ArrayIterator', $collection->getIterator()); - $this->assertSame(array('bar' => $bar, 'foo' => $foo, 'last' => $last), $collection->getIterator()->getArrayCopy()); + $this->assertSame(['bar' => $bar, 'foo' => $foo, 'last' => $last], $collection->getIterator()->getArrayCopy()); } public function testCount() @@ -98,7 +98,7 @@ public function testAddCollection() $collection->addCollection($collection1); $collection->add('last', $last = new Route('/last')); - $this->assertSame(array('bar' => $bar, 'foo' => $foo, 'grandchild' => $grandchild, 'last' => $last), $collection->all(), + $this->assertSame(['bar' => $bar, 'foo' => $foo, 'grandchild' => $grandchild, 'last' => $last], $collection->all(), '->addCollection() imports routes of another collection, overrides if necessary and adds them at the end'); } @@ -109,7 +109,7 @@ public function testAddCollectionWithResources() $collection1 = new RouteCollection(); $collection1->addResource($foo1 = new FileResource(__DIR__.'/Fixtures/foo1.xml')); $collection->addCollection($collection1); - $this->assertEquals(array($foo, $foo1), $collection->getResources(), '->addCollection() merges resources'); + $this->assertEquals([$foo, $foo1], $collection->getResources(), '->addCollection() merges resources'); } public function testAddDefaultsAndRequirementsAndOptions() @@ -118,23 +118,23 @@ public function testAddDefaultsAndRequirementsAndOptions() $collection->add('foo', new Route('/{placeholder}')); $collection1 = new RouteCollection(); $collection1->add('bar', new Route('/{placeholder}', - array('_controller' => 'fixed', 'placeholder' => 'default'), array('placeholder' => '.+'), array('option' => 'value')) + ['_controller' => 'fixed', 'placeholder' => 'default'], ['placeholder' => '.+'], ['option' => 'value']) ); $collection->addCollection($collection1); - $collection->addDefaults(array('placeholder' => 'new-default')); - $this->assertEquals(array('placeholder' => 'new-default'), $collection->get('foo')->getDefaults(), '->addDefaults() adds defaults to all routes'); - $this->assertEquals(array('_controller' => 'fixed', 'placeholder' => 'new-default'), $collection->get('bar')->getDefaults(), + $collection->addDefaults(['placeholder' => 'new-default']); + $this->assertEquals(['placeholder' => 'new-default'], $collection->get('foo')->getDefaults(), '->addDefaults() adds defaults to all routes'); + $this->assertEquals(['_controller' => 'fixed', 'placeholder' => 'new-default'], $collection->get('bar')->getDefaults(), '->addDefaults() adds defaults to all routes and overwrites existing ones'); - $collection->addRequirements(array('placeholder' => '\d+')); - $this->assertEquals(array('placeholder' => '\d+'), $collection->get('foo')->getRequirements(), '->addRequirements() adds requirements to all routes'); - $this->assertEquals(array('placeholder' => '\d+'), $collection->get('bar')->getRequirements(), + $collection->addRequirements(['placeholder' => '\d+']); + $this->assertEquals(['placeholder' => '\d+'], $collection->get('foo')->getRequirements(), '->addRequirements() adds requirements to all routes'); + $this->assertEquals(['placeholder' => '\d+'], $collection->get('bar')->getRequirements(), '->addRequirements() adds requirements to all routes and overwrites existing ones'); - $collection->addOptions(array('option' => 'new-value')); + $collection->addOptions(['option' => 'new-value']); $this->assertEquals( - array('option' => 'new-value', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), + ['option' => 'new-value', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'], $collection->get('bar')->getOptions(), '->addOptions() adds options to all routes and overwrites existing ones' ); } @@ -148,13 +148,13 @@ public function testAddPrefix() $collection->addCollection($collection2); $collection->addPrefix(' / '); $this->assertSame('/foo', $collection->get('foo')->getPath(), '->addPrefix() trims the prefix and a single slash has no effect'); - $collection->addPrefix('/{admin}', array('admin' => 'admin'), array('admin' => '\d+')); + $collection->addPrefix('/{admin}', ['admin' => 'admin'], ['admin' => '\d+']); $this->assertEquals('/{admin}/foo', $collection->get('foo')->getPath(), '->addPrefix() adds a prefix to all routes'); $this->assertEquals('/{admin}/bar', $collection->get('bar')->getPath(), '->addPrefix() adds a prefix to all routes'); - $this->assertEquals(array('admin' => 'admin'), $collection->get('foo')->getDefaults(), '->addPrefix() adds defaults to all routes'); - $this->assertEquals(array('admin' => 'admin'), $collection->get('bar')->getDefaults(), '->addPrefix() adds defaults to all routes'); - $this->assertEquals(array('admin' => '\d+'), $collection->get('foo')->getRequirements(), '->addPrefix() adds requirements to all routes'); - $this->assertEquals(array('admin' => '\d+'), $collection->get('bar')->getRequirements(), '->addPrefix() adds requirements to all routes'); + $this->assertEquals(['admin' => 'admin'], $collection->get('foo')->getDefaults(), '->addPrefix() adds defaults to all routes'); + $this->assertEquals(['admin' => 'admin'], $collection->get('bar')->getDefaults(), '->addPrefix() adds defaults to all routes'); + $this->assertEquals(['admin' => '\d+'], $collection->get('foo')->getRequirements(), '->addPrefix() adds requirements to all routes'); + $this->assertEquals(['admin' => '\d+'], $collection->get('bar')->getRequirements(), '->addPrefix() adds requirements to all routes'); $collection->addPrefix('0'); $this->assertEquals('/0/{admin}/foo', $collection->get('foo')->getPath(), '->addPrefix() ensures a prefix must start with a slash and must not end with a slash'); $collection->addPrefix('/ /'); @@ -166,8 +166,8 @@ public function testAddPrefixOverridesDefaultsAndRequirements() { $collection = new RouteCollection(); $collection->add('foo', $foo = new Route('/foo.{_format}')); - $collection->add('bar', $bar = new Route('/bar.{_format}', array(), array('_format' => 'json'))); - $collection->addPrefix('/admin', array(), array('_format' => 'html')); + $collection->add('bar', $bar = new Route('/bar.{_format}', [], ['_format' => 'json'])); + $collection->addPrefix('/admin', [], ['_format' => 'html']); $this->assertEquals('html', $collection->get('foo')->getRequirement('_format'), '->addPrefix() overrides existing requirements'); $this->assertEquals('html', $collection->get('bar')->getRequirement('_format'), '->addPrefix() overrides existing requirements'); @@ -180,7 +180,7 @@ public function testResource() $collection->addResource($bar = new FileResource(__DIR__.'/Fixtures/bar.xml')); $collection->addResource(new FileResource(__DIR__.'/Fixtures/foo.xml')); - $this->assertEquals(array($foo, $bar), $collection->getResources(), + $this->assertEquals([$foo, $bar], $collection->getResources(), '->addResource() adds a resource and getResources() only returns unique ones by comparing the string representation'); } @@ -227,16 +227,16 @@ public function testRemove() $collection->add('last', $last = new Route('/last')); $collection->remove('foo'); - $this->assertSame(array('bar' => $bar, 'last' => $last), $collection->all(), '->remove() can remove a single route'); - $collection->remove(array('bar', 'last')); - $this->assertSame(array(), $collection->all(), '->remove() accepts an array and can remove multiple routes at once'); + $this->assertSame(['bar' => $bar, 'last' => $last], $collection->all(), '->remove() can remove a single route'); + $collection->remove(['bar', 'last']); + $this->assertSame([], $collection->all(), '->remove() accepts an array and can remove multiple routes at once'); } public function testSetHost() { $collection = new RouteCollection(); $routea = new Route('/a'); - $routeb = new Route('/b', array(), array(), array(), '{locale}.example.net'); + $routeb = new Route('/b', [], [], [], '{locale}.example.net'); $collection->add('a', $routea); $collection->add('b', $routeb); @@ -250,7 +250,7 @@ public function testSetCondition() { $collection = new RouteCollection(); $routea = new Route('/a'); - $routeb = new Route('/b', array(), array(), array(), '{locale}.example.net', array(), array(), 'context.getMethod() == "GET"'); + $routeb = new Route('/b', [], [], [], '{locale}.example.net', [], [], 'context.getMethod() == "GET"'); $collection->add('a', $routea); $collection->add('b', $routeb); @@ -264,7 +264,7 @@ public function testClone() { $collection = new RouteCollection(); $collection->add('a', new Route('/a')); - $collection->add('b', new Route('/b', array('placeholder' => 'default'), array('placeholder' => '.+'))); + $collection->add('b', new Route('/b', ['placeholder' => 'default'], ['placeholder' => '.+'])); $clonedCollection = clone $collection; @@ -278,28 +278,28 @@ public function testClone() public function testSetSchemes() { $collection = new RouteCollection(); - $routea = new Route('/a', array(), array(), array(), '', 'http'); + $routea = new Route('/a', [], [], [], '', 'http'); $routeb = new Route('/b'); $collection->add('a', $routea); $collection->add('b', $routeb); - $collection->setSchemes(array('http', 'https')); + $collection->setSchemes(['http', 'https']); - $this->assertEquals(array('http', 'https'), $routea->getSchemes()); - $this->assertEquals(array('http', 'https'), $routeb->getSchemes()); + $this->assertEquals(['http', 'https'], $routea->getSchemes()); + $this->assertEquals(['http', 'https'], $routeb->getSchemes()); } public function testSetMethods() { $collection = new RouteCollection(); - $routea = new Route('/a', array(), array(), array(), '', array(), array('GET', 'POST')); + $routea = new Route('/a', [], [], [], '', [], ['GET', 'POST']); $routeb = new Route('/b'); $collection->add('a', $routea); $collection->add('b', $routeb); $collection->setMethods('PUT'); - $this->assertEquals(array('PUT'), $routea->getMethods()); - $this->assertEquals(array('PUT'), $routeb->getMethods()); + $this->assertEquals(['PUT'], $routea->getMethods()); + $this->assertEquals(['PUT'], $routeb->getMethods()); } } diff --git a/vendor/symfony/routing/Tests/RouteCompilerTest.php b/vendor/symfony/routing/Tests/RouteCompilerTest.php index dc304e3e7d54e4fe53e64638393cd714b7433d83..d9783147b8de70b1ce6e29d19684038af0145f3f 100644 --- a/vendor/symfony/routing/Tests/RouteCompilerTest.php +++ b/vendor/symfony/routing/Tests/RouteCompilerTest.php @@ -34,153 +34,153 @@ public function testCompile($name, $arguments, $prefix, $regex, $variables, $tok public function provideCompileData() { - return array( - array( + return [ + [ 'Static route', - array('/foo'), - '/foo', '#^/foo$#sD', array(), array( - array('text', '/foo'), - ), - ), + ['/foo'], + '/foo', '#^/foo$#sD', [], [ + ['text', '/foo'], + ], + ], - array( + [ 'Route with a variable', - array('/foo/{bar}'), - '/foo', '#^/foo/(?P<bar>[^/]++)$#sD', array('bar'), array( - array('variable', '/', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( + ['/foo/{bar}'], + '/foo', '#^/foo/(?P<bar>[^/]++)$#sD', ['bar'], [ + ['variable', '/', '[^/]++', 'bar'], + ['text', '/foo'], + ], + ], + + [ 'Route with a variable that has a default value', - array('/foo/{bar}', array('bar' => 'bar')), - '/foo', '#^/foo(?:/(?P<bar>[^/]++))?$#sD', array('bar'), array( - array('variable', '/', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( + ['/foo/{bar}', ['bar' => 'bar']], + '/foo', '#^/foo(?:/(?P<bar>[^/]++))?$#sD', ['bar'], [ + ['variable', '/', '[^/]++', 'bar'], + ['text', '/foo'], + ], + ], + + [ 'Route with several variables', - array('/foo/{bar}/{foobar}'), - '/foo', '#^/foo/(?P<bar>[^/]++)/(?P<foobar>[^/]++)$#sD', array('bar', 'foobar'), array( - array('variable', '/', '[^/]++', 'foobar'), - array('variable', '/', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( + ['/foo/{bar}/{foobar}'], + '/foo', '#^/foo/(?P<bar>[^/]++)/(?P<foobar>[^/]++)$#sD', ['bar', 'foobar'], [ + ['variable', '/', '[^/]++', 'foobar'], + ['variable', '/', '[^/]++', 'bar'], + ['text', '/foo'], + ], + ], + + [ 'Route with several variables that have default values', - array('/foo/{bar}/{foobar}', array('bar' => 'bar', 'foobar' => '')), - '/foo', '#^/foo(?:/(?P<bar>[^/]++)(?:/(?P<foobar>[^/]++))?)?$#sD', array('bar', 'foobar'), array( - array('variable', '/', '[^/]++', 'foobar'), - array('variable', '/', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( + ['/foo/{bar}/{foobar}', ['bar' => 'bar', 'foobar' => '']], + '/foo', '#^/foo(?:/(?P<bar>[^/]++)(?:/(?P<foobar>[^/]++))?)?$#sD', ['bar', 'foobar'], [ + ['variable', '/', '[^/]++', 'foobar'], + ['variable', '/', '[^/]++', 'bar'], + ['text', '/foo'], + ], + ], + + [ 'Route with several variables but some of them have no default values', - array('/foo/{bar}/{foobar}', array('bar' => 'bar')), - '/foo', '#^/foo/(?P<bar>[^/]++)/(?P<foobar>[^/]++)$#sD', array('bar', 'foobar'), array( - array('variable', '/', '[^/]++', 'foobar'), - array('variable', '/', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( + ['/foo/{bar}/{foobar}', ['bar' => 'bar']], + '/foo', '#^/foo/(?P<bar>[^/]++)/(?P<foobar>[^/]++)$#sD', ['bar', 'foobar'], [ + ['variable', '/', '[^/]++', 'foobar'], + ['variable', '/', '[^/]++', 'bar'], + ['text', '/foo'], + ], + ], + + [ 'Route with an optional variable as the first segment', - array('/{bar}', array('bar' => 'bar')), - '', '#^/(?P<bar>[^/]++)?$#sD', array('bar'), array( - array('variable', '/', '[^/]++', 'bar'), - ), - ), + ['/{bar}', ['bar' => 'bar']], + '', '#^/(?P<bar>[^/]++)?$#sD', ['bar'], [ + ['variable', '/', '[^/]++', 'bar'], + ], + ], - array( + [ 'Route with a requirement of 0', - array('/{bar}', array('bar' => null), array('bar' => '0')), - '', '#^/(?P<bar>0)?$#sD', array('bar'), array( - array('variable', '/', '0', 'bar'), - ), - ), + ['/{bar}', ['bar' => null], ['bar' => '0']], + '', '#^/(?P<bar>0)?$#sD', ['bar'], [ + ['variable', '/', '0', 'bar'], + ], + ], - array( + [ 'Route with an optional variable as the first segment with requirements', - array('/{bar}', array('bar' => 'bar'), array('bar' => '(foo|bar)')), - '', '#^/(?P<bar>(foo|bar))?$#sD', array('bar'), array( - array('variable', '/', '(foo|bar)', 'bar'), - ), - ), + ['/{bar}', ['bar' => 'bar'], ['bar' => '(foo|bar)']], + '', '#^/(?P<bar>(foo|bar))?$#sD', ['bar'], [ + ['variable', '/', '(foo|bar)', 'bar'], + ], + ], - array( + [ 'Route with only optional variables', - array('/{foo}/{bar}', array('foo' => 'foo', 'bar' => 'bar')), - '', '#^/(?P<foo>[^/]++)?(?:/(?P<bar>[^/]++))?$#sD', array('foo', 'bar'), array( - array('variable', '/', '[^/]++', 'bar'), - array('variable', '/', '[^/]++', 'foo'), - ), - ), - - array( + ['/{foo}/{bar}', ['foo' => 'foo', 'bar' => 'bar']], + '', '#^/(?P<foo>[^/]++)?(?:/(?P<bar>[^/]++))?$#sD', ['foo', 'bar'], [ + ['variable', '/', '[^/]++', 'bar'], + ['variable', '/', '[^/]++', 'foo'], + ], + ], + + [ 'Route with a variable in last position', - array('/foo-{bar}'), - '/foo-', '#^/foo\-(?P<bar>[^/]++)$#sD', array('bar'), array( - array('variable', '-', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( + ['/foo-{bar}'], + '/foo-', '#^/foo\-(?P<bar>[^/]++)$#sD', ['bar'], [ + ['variable', '-', '[^/]++', 'bar'], + ['text', '/foo'], + ], + ], + + [ 'Route with nested placeholders', - array('/{static{var}static}'), - '/{static', '#^/\{static(?P<var>[^/]+)static\}$#sD', array('var'), array( - array('text', 'static}'), - array('variable', '', '[^/]+', 'var'), - array('text', '/{static'), - ), - ), - - array( + ['/{static{var}static}'], + '/{static', '#^/\{static(?P<var>[^/]+)static\}$#sD', ['var'], [ + ['text', 'static}'], + ['variable', '', '[^/]+', 'var'], + ['text', '/{static'], + ], + ], + + [ 'Route without separator between variables', - array('/{w}{x}{y}{z}.{_format}', array('z' => 'default-z', '_format' => 'html'), array('y' => '(y|Y)')), - '', '#^/(?P<w>[^/\.]+)(?P<x>[^/\.]+)(?P<y>(y|Y))(?:(?P<z>[^/\.]++)(?:\.(?P<_format>[^/]++))?)?$#sD', array('w', 'x', 'y', 'z', '_format'), array( - array('variable', '.', '[^/]++', '_format'), - array('variable', '', '[^/\.]++', 'z'), - array('variable', '', '(y|Y)', 'y'), - array('variable', '', '[^/\.]+', 'x'), - array('variable', '/', '[^/\.]+', 'w'), - ), - ), - - array( + ['/{w}{x}{y}{z}.{_format}', ['z' => 'default-z', '_format' => 'html'], ['y' => '(y|Y)']], + '', '#^/(?P<w>[^/\.]+)(?P<x>[^/\.]+)(?P<y>(y|Y))(?:(?P<z>[^/\.]++)(?:\.(?P<_format>[^/]++))?)?$#sD', ['w', 'x', 'y', 'z', '_format'], [ + ['variable', '.', '[^/]++', '_format'], + ['variable', '', '[^/\.]++', 'z'], + ['variable', '', '(y|Y)', 'y'], + ['variable', '', '[^/\.]+', 'x'], + ['variable', '/', '[^/\.]+', 'w'], + ], + ], + + [ 'Route with a format', - array('/foo/{bar}.{_format}'), - '/foo', '#^/foo/(?P<bar>[^/\.]++)\.(?P<_format>[^/]++)$#sD', array('bar', '_format'), array( - array('variable', '.', '[^/]++', '_format'), - array('variable', '/', '[^/\.]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( + ['/foo/{bar}.{_format}'], + '/foo', '#^/foo/(?P<bar>[^/\.]++)\.(?P<_format>[^/]++)$#sD', ['bar', '_format'], [ + ['variable', '.', '[^/]++', '_format'], + ['variable', '/', '[^/\.]++', 'bar'], + ['text', '/foo'], + ], + ], + + [ 'Static non UTF-8 route', - array("/fo\xE9"), - "/fo\xE9", "#^/fo\xE9$#sD", array(), array( - array('text', "/fo\xE9"), - ), - ), + ["/fo\xE9"], + "/fo\xE9", "#^/fo\xE9$#sD", [], [ + ['text', "/fo\xE9"], + ], + ], - array( + [ 'Route with an explicit UTF-8 requirement', - array('/{bar}', array('bar' => null), array('bar' => '.'), array('utf8' => true)), - '', '#^/(?P<bar>.)?$#sDu', array('bar'), array( - array('variable', '/', '.', 'bar', true), - ), - ), - ); + ['/{bar}', ['bar' => null], ['bar' => '.'], ['utf8' => true]], + '', '#^/(?P<bar>.)?$#sDu', ['bar'], [ + ['variable', '/', '.', 'bar', true], + ], + ], + ]; } /** @@ -202,45 +202,45 @@ public function testCompileImplicitUtf8Data($name, $arguments, $prefix, $regex, public function provideCompileImplicitUtf8Data() { - return array( - array( + return [ + [ 'Static UTF-8 route', - array('/foé'), - '/foé', '#^/foé$#sDu', array(), array( - array('text', '/foé'), - ), + ['/foé'], + '/foé', '#^/foé$#sDu', [], [ + ['text', '/foé'], + ], 'patterns', - ), + ], - array( + [ 'Route with an implicit UTF-8 requirement', - array('/{bar}', array('bar' => null), array('bar' => 'é')), - '', '#^/(?P<bar>é)?$#sDu', array('bar'), array( - array('variable', '/', 'é', 'bar', true), - ), + ['/{bar}', ['bar' => null], ['bar' => 'é']], + '', '#^/(?P<bar>é)?$#sDu', ['bar'], [ + ['variable', '/', 'é', 'bar', true], + ], 'requirements', - ), + ], - array( + [ 'Route with a UTF-8 class requirement', - array('/{bar}', array('bar' => null), array('bar' => '\pM')), - '', '#^/(?P<bar>\pM)?$#sDu', array('bar'), array( - array('variable', '/', '\pM', 'bar', true), - ), + ['/{bar}', ['bar' => null], ['bar' => '\pM']], + '', '#^/(?P<bar>\pM)?$#sDu', ['bar'], [ + ['variable', '/', '\pM', 'bar', true], + ], 'requirements', - ), + ], - array( + [ 'Route with a UTF-8 separator', - array('/foo/{bar}§{_format}', array(), array(), array('compiler_class' => Utf8RouteCompiler::class)), - '/foo', '#^/foo/(?P<bar>[^/§]++)§(?P<_format>[^/]++)$#sDu', array('bar', '_format'), array( - array('variable', '§', '[^/]++', '_format', true), - array('variable', '/', '[^/§]++', 'bar', true), - array('text', '/foo'), - ), + ['/foo/{bar}§{_format}', [], [], ['compiler_class' => Utf8RouteCompiler::class]], + '/foo', '#^/foo/(?P<bar>[^/§]++)§(?P<_format>[^/]++)$#sDu', ['bar', '_format'], [ + ['variable', '§', '[^/]++', '_format', true], + ['variable', '/', '[^/§]++', 'bar', true], + ['text', '/foo'], + ], 'patterns', - ), - ); + ], + ]; } /** @@ -258,7 +258,7 @@ public function testRouteWithSameVariableTwice() */ public function testRouteCharsetMismatch() { - $route = new Route("/\xE9/{bar}", array(), array('bar' => '.'), array('utf8' => true)); + $route = new Route("/\xE9/{bar}", [], ['bar' => '.'], ['utf8' => true]); $compiled = $route->compile(); } @@ -268,7 +268,7 @@ public function testRouteCharsetMismatch() */ public function testRequirementCharsetMismatch() { - $route = new Route('/foo/{bar}', array(), array('bar' => "\xE9"), array('utf8' => true)); + $route = new Route('/foo/{bar}', [], ['bar' => "\xE9"], ['utf8' => true]); $compiled = $route->compile(); } @@ -295,11 +295,11 @@ public function testRouteWithVariableNameStartingWithADigit($name) public function getVariableNamesStartingWithADigit() { - return array( - array('09'), - array('123'), - array('1e2'), - ); + return [ + ['09'], + ['123'], + ['1e2'], + ]; } /** @@ -312,65 +312,65 @@ public function testCompileWithHost($name, $arguments, $prefix, $regex, $variabl $compiled = $route->compile(); $this->assertEquals($prefix, $compiled->getStaticPrefix(), $name.' (static prefix)'); - $this->assertEquals($regex, str_replace(array("\n", ' '), '', $compiled->getRegex()), $name.' (regex)'); + $this->assertEquals($regex, str_replace(["\n", ' '], '', $compiled->getRegex()), $name.' (regex)'); $this->assertEquals($variables, $compiled->getVariables(), $name.' (variables)'); $this->assertEquals($pathVariables, $compiled->getPathVariables(), $name.' (path variables)'); $this->assertEquals($tokens, $compiled->getTokens(), $name.' (tokens)'); - $this->assertEquals($hostRegex, str_replace(array("\n", ' '), '', $compiled->getHostRegex()), $name.' (host regex)'); + $this->assertEquals($hostRegex, str_replace(["\n", ' '], '', $compiled->getHostRegex()), $name.' (host regex)'); $this->assertEquals($hostVariables, $compiled->getHostVariables(), $name.' (host variables)'); $this->assertEquals($hostTokens, $compiled->getHostTokens(), $name.' (host tokens)'); } public function provideCompileWithHostData() { - return array( - array( + return [ + [ 'Route with host pattern', - array('/hello', array(), array(), array(), 'www.example.com'), - '/hello', '#^/hello$#sD', array(), array(), array( - array('text', '/hello'), - ), - '#^www\.example\.com$#sDi', array(), array( - array('text', 'www.example.com'), - ), - ), - array( + ['/hello', [], [], [], 'www.example.com'], + '/hello', '#^/hello$#sD', [], [], [ + ['text', '/hello'], + ], + '#^www\.example\.com$#sDi', [], [ + ['text', 'www.example.com'], + ], + ], + [ 'Route with host pattern and some variables', - array('/hello/{name}', array(), array(), array(), 'www.example.{tld}'), - '/hello', '#^/hello/(?P<name>[^/]++)$#sD', array('tld', 'name'), array('name'), array( - array('variable', '/', '[^/]++', 'name'), - array('text', '/hello'), - ), - '#^www\.example\.(?P<tld>[^\.]++)$#sDi', array('tld'), array( - array('variable', '.', '[^\.]++', 'tld'), - array('text', 'www.example'), - ), - ), - array( + ['/hello/{name}', [], [], [], 'www.example.{tld}'], + '/hello', '#^/hello/(?P<name>[^/]++)$#sD', ['tld', 'name'], ['name'], [ + ['variable', '/', '[^/]++', 'name'], + ['text', '/hello'], + ], + '#^www\.example\.(?P<tld>[^\.]++)$#sDi', ['tld'], [ + ['variable', '.', '[^\.]++', 'tld'], + ['text', 'www.example'], + ], + ], + [ 'Route with variable at beginning of host', - array('/hello', array(), array(), array(), '{locale}.example.{tld}'), - '/hello', '#^/hello$#sD', array('locale', 'tld'), array(), array( - array('text', '/hello'), - ), - '#^(?P<locale>[^\.]++)\.example\.(?P<tld>[^\.]++)$#sDi', array('locale', 'tld'), array( - array('variable', '.', '[^\.]++', 'tld'), - array('text', '.example'), - array('variable', '', '[^\.]++', 'locale'), - ), - ), - array( + ['/hello', [], [], [], '{locale}.example.{tld}'], + '/hello', '#^/hello$#sD', ['locale', 'tld'], [], [ + ['text', '/hello'], + ], + '#^(?P<locale>[^\.]++)\.example\.(?P<tld>[^\.]++)$#sDi', ['locale', 'tld'], [ + ['variable', '.', '[^\.]++', 'tld'], + ['text', '.example'], + ['variable', '', '[^\.]++', 'locale'], + ], + ], + [ 'Route with host variables that has a default value', - array('/hello', array('locale' => 'a', 'tld' => 'b'), array(), array(), '{locale}.example.{tld}'), - '/hello', '#^/hello$#sD', array('locale', 'tld'), array(), array( - array('text', '/hello'), - ), - '#^(?P<locale>[^\.]++)\.example\.(?P<tld>[^\.]++)$#sDi', array('locale', 'tld'), array( - array('variable', '.', '[^\.]++', 'tld'), - array('text', '.example'), - array('variable', '', '[^\.]++', 'locale'), - ), - ), - ); + ['/hello', ['locale' => 'a', 'tld' => 'b'], [], [], '{locale}.example.{tld}'], + '/hello', '#^/hello$#sD', ['locale', 'tld'], [], [ + ['text', '/hello'], + ], + '#^(?P<locale>[^\.]++)\.example\.(?P<tld>[^\.]++)$#sDi', ['locale', 'tld'], [ + ['variable', '.', '[^\.]++', 'tld'], + ['text', '.example'], + ['variable', '', '[^\.]++', 'locale'], + ], + ], + ]; } /** diff --git a/vendor/symfony/routing/Tests/RouteTest.php b/vendor/symfony/routing/Tests/RouteTest.php index c7af058e3b09d5cb75fba0cf040b0e0b52430c64..179f4880d0d889a195c0738401385eec56049522 100644 --- a/vendor/symfony/routing/Tests/RouteTest.php +++ b/vendor/symfony/routing/Tests/RouteTest.php @@ -18,21 +18,21 @@ class RouteTest extends TestCase { public function testConstructor() { - $route = new Route('/{foo}', array('foo' => 'bar'), array('foo' => '\d+'), array('foo' => 'bar'), '{locale}.example.com'); + $route = new Route('/{foo}', ['foo' => 'bar'], ['foo' => '\d+'], ['foo' => 'bar'], '{locale}.example.com'); $this->assertEquals('/{foo}', $route->getPath(), '__construct() takes a path as its first argument'); - $this->assertEquals(array('foo' => 'bar'), $route->getDefaults(), '__construct() takes defaults as its second argument'); - $this->assertEquals(array('foo' => '\d+'), $route->getRequirements(), '__construct() takes requirements as its third argument'); + $this->assertEquals(['foo' => 'bar'], $route->getDefaults(), '__construct() takes defaults as its second argument'); + $this->assertEquals(['foo' => '\d+'], $route->getRequirements(), '__construct() takes requirements as its third argument'); $this->assertEquals('bar', $route->getOption('foo'), '__construct() takes options as its fourth argument'); $this->assertEquals('{locale}.example.com', $route->getHost(), '__construct() takes a host pattern as its fifth argument'); - $route = new Route('/', array(), array(), array(), '', array('Https'), array('POST', 'put'), 'context.getMethod() == "GET"'); - $this->assertEquals(array('https'), $route->getSchemes(), '__construct() takes schemes as its sixth argument and lowercases it'); - $this->assertEquals(array('POST', 'PUT'), $route->getMethods(), '__construct() takes methods as its seventh argument and uppercases it'); + $route = new Route('/', [], [], [], '', ['Https'], ['POST', 'put'], 'context.getMethod() == "GET"'); + $this->assertEquals(['https'], $route->getSchemes(), '__construct() takes schemes as its sixth argument and lowercases it'); + $this->assertEquals(['POST', 'PUT'], $route->getMethods(), '__construct() takes methods as its seventh argument and uppercases it'); $this->assertEquals('context.getMethod() == "GET"', $route->getCondition(), '__construct() takes a condition as its eight argument'); - $route = new Route('/', array(), array(), array(), '', 'Https', 'Post'); - $this->assertEquals(array('https'), $route->getSchemes(), '__construct() takes a single scheme as its sixth argument'); - $this->assertEquals(array('POST'), $route->getMethods(), '__construct() takes a single method as its seventh argument'); + $route = new Route('/', [], [], [], '', 'Https', 'Post'); + $this->assertEquals(['https'], $route->getSchemes(), '__construct() takes a single scheme as its sixth argument'); + $this->assertEquals(['POST'], $route->getMethods(), '__construct() takes a single method as its seventh argument'); } public function testPath() @@ -52,16 +52,16 @@ public function testPath() public function testOptions() { $route = new Route('/{foo}'); - $route->setOptions(array('foo' => 'bar')); - $this->assertEquals(array_merge(array( + $route->setOptions(['foo' => 'bar']); + $this->assertEquals(array_merge([ 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler', - ), array('foo' => 'bar')), $route->getOptions(), '->setOptions() sets the options'); - $this->assertEquals($route, $route->setOptions(array()), '->setOptions() implements a fluent interface'); + ], ['foo' => 'bar']), $route->getOptions(), '->setOptions() sets the options'); + $this->assertEquals($route, $route->setOptions([]), '->setOptions() implements a fluent interface'); - $route->setOptions(array('foo' => 'foo')); - $route->addOptions(array('bar' => 'bar')); - $this->assertEquals($route, $route->addOptions(array()), '->addOptions() implements a fluent interface'); - $this->assertEquals(array('foo' => 'foo', 'bar' => 'bar', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), $route->getOptions(), '->addDefaults() keep previous defaults'); + $route->setOptions(['foo' => 'foo']); + $route->addOptions(['bar' => 'bar']); + $this->assertEquals($route, $route->addOptions([]), '->addOptions() implements a fluent interface'); + $this->assertEquals(['foo' => 'foo', 'bar' => 'bar', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'], $route->getOptions(), '->addDefaults() keep previous defaults'); } public function testOption() @@ -76,9 +76,9 @@ public function testOption() public function testDefaults() { $route = new Route('/{foo}'); - $route->setDefaults(array('foo' => 'bar')); - $this->assertEquals(array('foo' => 'bar'), $route->getDefaults(), '->setDefaults() sets the defaults'); - $this->assertEquals($route, $route->setDefaults(array()), '->setDefaults() implements a fluent interface'); + $route->setDefaults(['foo' => 'bar']); + $this->assertEquals(['foo' => 'bar'], $route->getDefaults(), '->setDefaults() sets the defaults'); + $this->assertEquals($route, $route->setDefaults([]), '->setDefaults() implements a fluent interface'); $route->setDefault('foo', 'bar'); $this->assertEquals('bar', $route->getDefault('foo'), '->setDefault() sets a default value'); @@ -90,27 +90,27 @@ public function testDefaults() $route->setDefault('_controller', $closure = function () { return 'Hello'; }); $this->assertEquals($closure, $route->getDefault('_controller'), '->setDefault() sets a default value'); - $route->setDefaults(array('foo' => 'foo')); - $route->addDefaults(array('bar' => 'bar')); - $this->assertEquals($route, $route->addDefaults(array()), '->addDefaults() implements a fluent interface'); - $this->assertEquals(array('foo' => 'foo', 'bar' => 'bar'), $route->getDefaults(), '->addDefaults() keep previous defaults'); + $route->setDefaults(['foo' => 'foo']); + $route->addDefaults(['bar' => 'bar']); + $this->assertEquals($route, $route->addDefaults([]), '->addDefaults() implements a fluent interface'); + $this->assertEquals(['foo' => 'foo', 'bar' => 'bar'], $route->getDefaults(), '->addDefaults() keep previous defaults'); } public function testRequirements() { $route = new Route('/{foo}'); - $route->setRequirements(array('foo' => '\d+')); - $this->assertEquals(array('foo' => '\d+'), $route->getRequirements(), '->setRequirements() sets the requirements'); + $route->setRequirements(['foo' => '\d+']); + $this->assertEquals(['foo' => '\d+'], $route->getRequirements(), '->setRequirements() sets the requirements'); $this->assertEquals('\d+', $route->getRequirement('foo'), '->getRequirement() returns a requirement'); $this->assertNull($route->getRequirement('bar'), '->getRequirement() returns null if a requirement is not defined'); - $route->setRequirements(array('foo' => '^\d+$')); + $route->setRequirements(['foo' => '^\d+$']); $this->assertEquals('\d+', $route->getRequirement('foo'), '->getRequirement() removes ^ and $ from the path'); - $this->assertEquals($route, $route->setRequirements(array()), '->setRequirements() implements a fluent interface'); + $this->assertEquals($route, $route->setRequirements([]), '->setRequirements() implements a fluent interface'); - $route->setRequirements(array('foo' => '\d+')); - $route->addRequirements(array('bar' => '\d+')); - $this->assertEquals($route, $route->addRequirements(array()), '->addRequirements() implements a fluent interface'); - $this->assertEquals(array('foo' => '\d+', 'bar' => '\d+'), $route->getRequirements(), '->addRequirement() keep previous requirements'); + $route->setRequirements(['foo' => '\d+']); + $route->addRequirements(['bar' => '\d+']); + $this->assertEquals($route, $route->addRequirements([]), '->addRequirements() implements a fluent interface'); + $this->assertEquals(['foo' => '\d+', 'bar' => '\d+'], $route->getRequirements(), '->addRequirement() keep previous requirements'); } public function testRequirement() @@ -134,13 +134,13 @@ public function testSetInvalidRequirement($req) public function getInvalidRequirements() { - return array( - array(''), - array(array()), - array('^$'), - array('^'), - array('$'), - ); + return [ + [''], + [[]], + ['^$'], + ['^'], + ['$'], + ]; } public function testHost() @@ -153,14 +153,14 @@ public function testHost() public function testScheme() { $route = new Route('/'); - $this->assertEquals(array(), $route->getSchemes(), 'schemes is initialized with array()'); + $this->assertEquals([], $route->getSchemes(), 'schemes is initialized with []'); $this->assertFalse($route->hasScheme('http')); $route->setSchemes('hTTp'); - $this->assertEquals(array('http'), $route->getSchemes(), '->setSchemes() accepts a single scheme string and lowercases it'); + $this->assertEquals(['http'], $route->getSchemes(), '->setSchemes() accepts a single scheme string and lowercases it'); $this->assertTrue($route->hasScheme('htTp')); $this->assertFalse($route->hasScheme('httpS')); - $route->setSchemes(array('HttpS', 'hTTp')); - $this->assertEquals(array('https', 'http'), $route->getSchemes(), '->setSchemes() accepts an array of schemes and lowercases them'); + $route->setSchemes(['HttpS', 'hTTp']); + $this->assertEquals(['https', 'http'], $route->getSchemes(), '->setSchemes() accepts an array of schemes and lowercases them'); $this->assertTrue($route->hasScheme('htTp')); $this->assertTrue($route->hasScheme('httpS')); } @@ -168,11 +168,11 @@ public function testScheme() public function testMethod() { $route = new Route('/'); - $this->assertEquals(array(), $route->getMethods(), 'methods is initialized with array()'); + $this->assertEquals([], $route->getMethods(), 'methods is initialized with []'); $route->setMethods('gEt'); - $this->assertEquals(array('GET'), $route->getMethods(), '->setMethods() accepts a single method string and uppercases it'); - $route->setMethods(array('gEt', 'PosT')); - $this->assertEquals(array('GET', 'POST'), $route->getMethods(), '->setMethods() accepts an array of methods and uppercases them'); + $this->assertEquals(['GET'], $route->getMethods(), '->setMethods() accepts a single method string and uppercases it'); + $route->setMethods(['gEt', 'PosT']); + $this->assertEquals(['GET', 'POST'], $route->getMethods(), '->setMethods() accepts an array of methods and uppercases them'); } public function testCondition() @@ -194,7 +194,7 @@ public function testCompile() public function testSerialize() { - $route = new Route('/prefix/{foo}', array('foo' => 'default'), array('foo' => '\d+')); + $route = new Route('/prefix/{foo}', ['foo' => 'default'], ['foo' => '\d+']); $serialized = serialize($route); $unserialized = unserialize($serialized); @@ -209,7 +209,7 @@ public function testSerialize() */ public function testSerializeWhenCompiled() { - $route = new Route('/prefix/{foo}', array('foo' => 'default'), array('foo' => '\d+')); + $route = new Route('/prefix/{foo}', ['foo' => 'default'], ['foo' => '\d+']); $route->setHost('{locale}.example.net'); $route->compile(); @@ -226,7 +226,7 @@ public function testSerializeWhenCompiled() */ public function testSerializeWhenCompiledWithClass() { - $route = new Route('/', array(), array(), array('compiler_class' => '\Symfony\Component\Routing\Tests\Fixtures\CustomRouteCompiler')); + $route = new Route('/', [], [], ['compiler_class' => '\Symfony\Component\Routing\Tests\Fixtures\CustomRouteCompiler']); $this->assertInstanceOf('\Symfony\Component\Routing\Tests\Fixtures\CustomCompiledRoute', $route->compile(), '->compile() returned a proper route'); $serialized = serialize($route); @@ -248,7 +248,7 @@ public function testSerializedRepresentationKeepsWorking() $serialized = 'C:31:"Symfony\Component\Routing\Route":936:{a:8:{s:4:"path";s:13:"/prefix/{foo}";s:4:"host";s:20:"{locale}.example.net";s:8:"defaults";a:1:{s:3:"foo";s:7:"default";}s:12:"requirements";a:1:{s:3:"foo";s:3:"\d+";}s:7:"options";a:1:{s:14:"compiler_class";s:39:"Symfony\Component\Routing\RouteCompiler";}s:7:"schemes";a:0:{}s:7:"methods";a:0:{}s:8:"compiled";C:39:"Symfony\Component\Routing\CompiledRoute":571:{a:8:{s:4:"vars";a:2:{i:0;s:6:"locale";i:1;s:3:"foo";}s:11:"path_prefix";s:7:"/prefix";s:10:"path_regex";s:31:"#^/prefix(?:/(?P<foo>\d+))?$#sD";s:11:"path_tokens";a:2:{i:0;a:4:{i:0;s:8:"variable";i:1;s:1:"/";i:2;s:3:"\d+";i:3;s:3:"foo";}i:1;a:2:{i:0;s:4:"text";i:1;s:7:"/prefix";}}s:9:"path_vars";a:1:{i:0;s:3:"foo";}s:10:"host_regex";s:40:"#^(?P<locale>[^\.]++)\.example\.net$#sDi";s:11:"host_tokens";a:2:{i:0;a:2:{i:0;s:4:"text";i:1;s:12:".example.net";}i:1;a:4:{i:0;s:8:"variable";i:1;s:0:"";i:2;s:7:"[^\.]++";i:3;s:6:"locale";}}s:9:"host_vars";a:1:{i:0;s:6:"locale";}}}}}'; $unserialized = unserialize($serialized); - $route = new Route('/prefix/{foo}', array('foo' => 'default'), array('foo' => '\d+')); + $route = new Route('/prefix/{foo}', ['foo' => 'default'], ['foo' => '\d+']); $route->setHost('{locale}.example.net'); $route->compile(); diff --git a/vendor/symfony/routing/Tests/RouterTest.php b/vendor/symfony/routing/Tests/RouterTest.php index e01bd9c610c27fc33eab4d5410c260973febd97c..589ce5403ac2b88081a507c477b395041f233741 100644 --- a/vendor/symfony/routing/Tests/RouterTest.php +++ b/vendor/symfony/routing/Tests/RouterTest.php @@ -30,11 +30,11 @@ protected function setUp() public function testSetOptionsWithSupportedOptions() { - $this->router->setOptions(array( + $this->router->setOptions([ 'cache_dir' => './cache', 'debug' => true, 'resource_type' => 'ResourceType', - )); + ]); $this->assertSame('./cache', $this->router->getOption('cache_dir')); $this->assertTrue($this->router->getOption('debug')); @@ -47,12 +47,12 @@ public function testSetOptionsWithSupportedOptions() */ public function testSetOptionsWithUnsupportedOptions() { - $this->router->setOptions(array( + $this->router->setOptions([ 'cache_dir' => './cache', 'option_foo' => true, 'option_bar' => 'baz', 'resource_type' => 'ResourceType', - )); + ]); } public function testSetOptionWithSupportedOption() @@ -109,10 +109,10 @@ public function testMatcherIsCreatedIfCacheIsNotConfigured($option) public function provideMatcherOptionsPreventingCaching() { - return array( - array('cache_dir'), - array('matcher_cache_class'), - ); + return [ + ['cache_dir'], + ['matcher_cache_class'], + ]; } /** @@ -131,10 +131,10 @@ public function testGeneratorIsCreatedIfCacheIsNotConfigured($option) public function provideGeneratorOptionsPreventingCaching() { - return array( - array('cache_dir'), - array('generator_cache_class'), - ); + return [ + ['cache_dir'], + ['generator_cache_class'], + ]; } public function testMatchRequestWithUrlMatcherInterface() diff --git a/vendor/symfony/routing/phpunit.xml.dist b/vendor/symfony/routing/phpunit.xml.dist index bcc0959522cb6c77e12956bcec9b30beb077fa2b..df742eab0033133b1fabeb16564ca165e37f7c1c 100644 --- a/vendor/symfony/routing/phpunit.xml.dist +++ b/vendor/symfony/routing/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/serializer/Encoder/ChainDecoder.php b/vendor/symfony/serializer/Encoder/ChainDecoder.php index 71af8eadc42e11a8cfbe31cb98c43959941f6de9..1c76fe4bba0a5d2a39bf3e0f65224ec5a180dd28 100644 --- a/vendor/symfony/serializer/Encoder/ChainDecoder.php +++ b/vendor/symfony/serializer/Encoder/ChainDecoder.php @@ -24,10 +24,10 @@ */ class ChainDecoder implements DecoderInterface /*, ContextAwareDecoderInterface*/ { - protected $decoders = array(); - protected $decoderByFormat = array(); + protected $decoders = []; + protected $decoderByFormat = []; - public function __construct(array $decoders = array()) + public function __construct(array $decoders = []) { $this->decoders = $decoders; } @@ -35,7 +35,7 @@ public function __construct(array $decoders = array()) /** * {@inheritdoc} */ - final public function decode($data, $format, array $context = array()) + final public function decode($data, $format, array $context = []) { return $this->getDecoder($format, $context)->decode($data, $format, $context); } @@ -43,9 +43,9 @@ final public function decode($data, $format, array $context = array()) /** * {@inheritdoc} */ - public function supportsDecoding($format/*, array $context = array()*/) + public function supportsDecoding($format/*, array $context = []*/) { - $context = \func_num_args() > 1 ? func_get_arg(1) : array(); + $context = \func_num_args() > 1 ? func_get_arg(1) : []; try { $this->getDecoder($format, $context); diff --git a/vendor/symfony/serializer/Encoder/ChainEncoder.php b/vendor/symfony/serializer/Encoder/ChainEncoder.php index 6e2b85bf27ee3c0224ceca78dbb571434bd78d77..a0a718356c857c18096b11bf7d3c9cb058d10361 100644 --- a/vendor/symfony/serializer/Encoder/ChainEncoder.php +++ b/vendor/symfony/serializer/Encoder/ChainEncoder.php @@ -24,10 +24,10 @@ */ class ChainEncoder implements EncoderInterface /*, ContextAwareEncoderInterface*/ { - protected $encoders = array(); - protected $encoderByFormat = array(); + protected $encoders = []; + protected $encoderByFormat = []; - public function __construct(array $encoders = array()) + public function __construct(array $encoders = []) { $this->encoders = $encoders; } @@ -35,7 +35,7 @@ public function __construct(array $encoders = array()) /** * {@inheritdoc} */ - final public function encode($data, $format, array $context = array()) + final public function encode($data, $format, array $context = []) { return $this->getEncoder($format, $context)->encode($data, $format, $context); } @@ -43,9 +43,9 @@ final public function encode($data, $format, array $context = array()) /** * {@inheritdoc} */ - public function supportsEncoding($format/*, array $context = array()*/) + public function supportsEncoding($format/*, array $context = []*/) { - $context = \func_num_args() > 1 ? func_get_arg(1) : array(); + $context = \func_num_args() > 1 ? func_get_arg(1) : []; try { $this->getEncoder($format, $context); @@ -64,9 +64,9 @@ public function supportsEncoding($format/*, array $context = array()*/) * * @return bool */ - public function needsNormalization($format/*, array $context = array()*/) + public function needsNormalization($format/*, array $context = []*/) { - $context = \func_num_args() > 1 ? func_get_arg(1) : array(); + $context = \func_num_args() > 1 ? func_get_arg(1) : []; $encoder = $this->getEncoder($format, $context); if (!$encoder instanceof NormalizationAwareInterface) { diff --git a/vendor/symfony/serializer/Encoder/ContextAwareDecoderInterface.php b/vendor/symfony/serializer/Encoder/ContextAwareDecoderInterface.php index eefea0ecae120684119b48209ac80f7289a8892e..5ef89d5596cab56f205c5779053a8ca74e61219c 100644 --- a/vendor/symfony/serializer/Encoder/ContextAwareDecoderInterface.php +++ b/vendor/symfony/serializer/Encoder/ContextAwareDecoderInterface.php @@ -23,5 +23,5 @@ interface ContextAwareDecoderInterface extends DecoderInterface * * @param array $context options that decoders have access to */ - public function supportsDecoding($format, array $context = array()); + public function supportsDecoding($format, array $context = []); } diff --git a/vendor/symfony/serializer/Encoder/ContextAwareEncoderInterface.php b/vendor/symfony/serializer/Encoder/ContextAwareEncoderInterface.php index 0268df3d8d1cbdcf97f6428addf807e2286d3654..a8893a80f91b1cd0608b35759cc282971f81bf30 100644 --- a/vendor/symfony/serializer/Encoder/ContextAwareEncoderInterface.php +++ b/vendor/symfony/serializer/Encoder/ContextAwareEncoderInterface.php @@ -23,5 +23,5 @@ interface ContextAwareEncoderInterface extends EncoderInterface * * @param array $context options that encoders have access to */ - public function supportsEncoding($format, array $context = array()); + public function supportsEncoding($format, array $context = []); } diff --git a/vendor/symfony/serializer/Encoder/CsvEncoder.php b/vendor/symfony/serializer/Encoder/CsvEncoder.php index c2a70eed8d233507410c9f228a5d42c7ac3fde0e..1e47d35f17c7f5e4379f9160b8209acd5731cc0c 100644 --- a/vendor/symfony/serializer/Encoder/CsvEncoder.php +++ b/vendor/symfony/serializer/Encoder/CsvEncoder.php @@ -50,20 +50,20 @@ public function __construct($delimiter = ',', $enclosure = '"', $escapeChar = '\ /** * {@inheritdoc} */ - public function encode($data, $format, array $context = array()) + public function encode($data, $format, array $context = []) { $handle = fopen('php://temp,', 'w+'); if (!\is_array($data)) { - $data = array(array($data)); + $data = [[$data]]; } elseif (empty($data)) { - $data = array(array()); + $data = [[]]; } else { // Sequential arrays of arrays are considered as collections $i = 0; foreach ($data as $key => $value) { if ($i !== $key || !\is_array($value)) { - $data = array($data); + $data = [$data]; break; } @@ -74,7 +74,7 @@ public function encode($data, $format, array $context = array()) list($delimiter, $enclosure, $escapeChar, $keySeparator, $headers) = $this->getCsvOptions($context); foreach ($data as &$value) { - $flattened = array(); + $flattened = []; $this->flatten($value, $flattened, $keySeparator); $value = $flattened; } @@ -107,7 +107,7 @@ public function supportsEncoding($format) /** * {@inheritdoc} */ - public function decode($data, $format, array $context = array()) + public function decode($data, $format, array $context = []) { $handle = fopen('php://temp', 'r+'); fwrite($handle, $data); @@ -115,8 +115,8 @@ public function decode($data, $format, array $context = array()) $headers = null; $nbHeaders = 0; - $headerCount = array(); - $result = array(); + $headerCount = []; + $result = []; list($delimiter, $enclosure, $escapeChar, $keySeparator) = $this->getCsvOptions($context); @@ -135,7 +135,7 @@ public function decode($data, $format, array $context = array()) continue; } - $item = array(); + $item = []; for ($i = 0; ($i < $nbCols) && ($i < $nbHeaders); ++$i) { $depth = $headerCount[$i]; $arr = &$item; @@ -148,7 +148,7 @@ public function decode($data, $format, array $context = array()) } if (!isset($arr[$headers[$i][$j]])) { - $arr[$headers[$i][$j]] = array(); + $arr[$headers[$i][$j]] = []; } $arr = &$arr[$headers[$i][$j]]; @@ -200,13 +200,13 @@ private function getCsvOptions(array $context) $enclosure = isset($context[self::ENCLOSURE_KEY]) ? $context[self::ENCLOSURE_KEY] : $this->enclosure; $escapeChar = isset($context[self::ESCAPE_CHAR_KEY]) ? $context[self::ESCAPE_CHAR_KEY] : $this->escapeChar; $keySeparator = isset($context[self::KEY_SEPARATOR_KEY]) ? $context[self::KEY_SEPARATOR_KEY] : $this->keySeparator; - $headers = isset($context[self::HEADERS_KEY]) ? $context[self::HEADERS_KEY] : array(); + $headers = isset($context[self::HEADERS_KEY]) ? $context[self::HEADERS_KEY] : []; if (!\is_array($headers)) { throw new InvalidArgumentException(sprintf('The "%s" context variable must be an array or null, given "%s".', self::HEADERS_KEY, \gettype($headers))); } - return array($delimiter, $enclosure, $escapeChar, $keySeparator, $headers); + return [$delimiter, $enclosure, $escapeChar, $keySeparator, $headers]; } /** @@ -214,8 +214,8 @@ private function getCsvOptions(array $context) */ private function extractHeaders(array $data) { - $headers = array(); - $flippedHeaders = array(); + $headers = []; + $flippedHeaders = []; foreach ($data as $row) { $previousHeader = null; diff --git a/vendor/symfony/serializer/Encoder/DecoderInterface.php b/vendor/symfony/serializer/Encoder/DecoderInterface.php index 0fa578099f13f945c0b2b4a491235999864ba9b5..cfc591e7adf81a4fc0bfb5ba4e05adc9cf9fd6d6 100644 --- a/vendor/symfony/serializer/Encoder/DecoderInterface.php +++ b/vendor/symfony/serializer/Encoder/DecoderInterface.php @@ -36,7 +36,7 @@ interface DecoderInterface * * @throws UnexpectedValueException */ - public function decode($data, $format, array $context = array()); + public function decode($data, $format, array $context = []); /** * Checks whether the deserializer can decode from given format. diff --git a/vendor/symfony/serializer/Encoder/EncoderInterface.php b/vendor/symfony/serializer/Encoder/EncoderInterface.php index 077e4422e484a1255c225d0c2cae1d4caa10876b..9b9862e2acb23944da630abf0efe2ba273e74f54 100644 --- a/vendor/symfony/serializer/Encoder/EncoderInterface.php +++ b/vendor/symfony/serializer/Encoder/EncoderInterface.php @@ -31,7 +31,7 @@ interface EncoderInterface * * @throws UnexpectedValueException */ - public function encode($data, $format, array $context = array()); + public function encode($data, $format, array $context = []); /** * Checks whether the serializer can encode to given format. diff --git a/vendor/symfony/serializer/Encoder/JsonDecode.php b/vendor/symfony/serializer/Encoder/JsonDecode.php index bee1f7d4449f4f2d0390d66607258268b32ac33e..1d0b86afc5d07a0a9dce2787a1b7082e87a9481f 100644 --- a/vendor/symfony/serializer/Encoder/JsonDecode.php +++ b/vendor/symfony/serializer/Encoder/JsonDecode.php @@ -64,7 +64,7 @@ public function __construct($associative = false, $depth = 512) * * @see http://php.net/json_decode json_decode */ - public function decode($data, $format, array $context = array()) + public function decode($data, $format, array $context = []) { $context = $this->resolveContext($context); @@ -96,11 +96,11 @@ public function supportsDecoding($format) */ private function resolveContext(array $context) { - $defaultOptions = array( + $defaultOptions = [ 'json_decode_associative' => $this->associative, 'json_decode_recursion_depth' => $this->recursionDepth, 'json_decode_options' => 0, - ); + ]; return array_merge($defaultOptions, $context); } diff --git a/vendor/symfony/serializer/Encoder/JsonEncode.php b/vendor/symfony/serializer/Encoder/JsonEncode.php index ef084eeab2b9c2dc13ad6606be533b7dbf9a5588..9b07d709b8cffff9dfcca6505d2bf255165400eb 100644 --- a/vendor/symfony/serializer/Encoder/JsonEncode.php +++ b/vendor/symfony/serializer/Encoder/JsonEncode.php @@ -32,7 +32,7 @@ public function __construct($bitmask = 0) * * {@inheritdoc} */ - public function encode($data, $format, array $context = array()) + public function encode($data, $format, array $context = []) { $context = $this->resolveContext($context); @@ -58,8 +58,8 @@ public function supportsEncoding($format) * * @return array */ - private function resolveContext(array $context = array()) + private function resolveContext(array $context = []) { - return array_merge(array('json_encode_options' => $this->options), $context); + return array_merge(['json_encode_options' => $this->options], $context); } } diff --git a/vendor/symfony/serializer/Encoder/JsonEncoder.php b/vendor/symfony/serializer/Encoder/JsonEncoder.php index f4950cb3b3f47dc9788c7480c5f8c1a8ab23b81e..87f6be0b177c9674414ca88c49b010f7e5717c94 100644 --- a/vendor/symfony/serializer/Encoder/JsonEncoder.php +++ b/vendor/symfony/serializer/Encoder/JsonEncoder.php @@ -32,7 +32,7 @@ public function __construct(JsonEncode $encodingImpl = null, JsonDecode $decodin /** * {@inheritdoc} */ - public function encode($data, $format, array $context = array()) + public function encode($data, $format, array $context = []) { return $this->encodingImpl->encode($data, self::FORMAT, $context); } @@ -40,7 +40,7 @@ public function encode($data, $format, array $context = array()) /** * {@inheritdoc} */ - public function decode($data, $format, array $context = array()) + public function decode($data, $format, array $context = []) { return $this->decodingImpl->decode($data, self::FORMAT, $context); } diff --git a/vendor/symfony/serializer/Encoder/XmlEncoder.php b/vendor/symfony/serializer/Encoder/XmlEncoder.php index 96578c6bc75ea6ba986be79b9479c072d7572457..f0a4afb191b3a0d88b56db47083494b5bb3e5293 100644 --- a/vendor/symfony/serializer/Encoder/XmlEncoder.php +++ b/vendor/symfony/serializer/Encoder/XmlEncoder.php @@ -49,7 +49,7 @@ public function __construct($rootNodeName = 'response', $loadOptions = null) /** * {@inheritdoc} */ - public function encode($data, $format, array $context = array()) + public function encode($data, $format, array $context = []) { if ($data instanceof \DOMDocument) { return $data->saveXML(); @@ -75,7 +75,7 @@ public function encode($data, $format, array $context = array()) /** * {@inheritdoc} */ - public function decode($data, $format, array $context = array()) + public function decode($data, $format, array $context = []) { if ('' === trim($data)) { throw new NotEncodableValueException('Invalid XML data, it can not be empty.'); @@ -111,7 +111,7 @@ public function decode($data, $format, array $context = array()) if ($rootNode->hasChildNodes()) { $xpath = new \DOMXPath($dom); - $data = array(); + $data = []; foreach ($xpath->query('namespace::*', $dom->documentElement) as $nsNode) { $data['@'.$nsNode->nodeName] = $nsNode->nodeValue; } @@ -129,7 +129,7 @@ public function decode($data, $format, array $context = array()) return $rootNode->nodeValue; } - $data = array(); + $data = []; foreach ($rootNode->attributes as $attrKey => $attr) { $data['@'.$attrKey] = $attr->nodeValue; @@ -259,7 +259,7 @@ final protected function isElementNameValid($name) * * @return array|string */ - private function parseXml(\DOMNode $node, array $context = array()) + private function parseXml(\DOMNode $node, array $context = []) { $data = $this->parseXmlAttributes($node, $context); @@ -293,13 +293,13 @@ private function parseXml(\DOMNode $node, array $context = array()) * * @return array */ - private function parseXmlAttributes(\DOMNode $node, array $context = array()) + private function parseXmlAttributes(\DOMNode $node, array $context = []) { if (!$node->hasAttributes()) { - return array(); + return []; } - $data = array(); + $data = []; $typeCastAttributes = $this->resolveXmlTypeCastAttributes($context); foreach ($node->attributes as $attr) { @@ -326,17 +326,17 @@ private function parseXmlAttributes(\DOMNode $node, array $context = array()) * * @return array|string */ - private function parseXmlValue(\DOMNode $node, array $context = array()) + private function parseXmlValue(\DOMNode $node, array $context = []) { if (!$node->hasChildNodes()) { return $node->nodeValue; } - if (1 === $node->childNodes->length && \in_array($node->firstChild->nodeType, array(XML_TEXT_NODE, XML_CDATA_SECTION_NODE))) { + if (1 === $node->childNodes->length && \in_array($node->firstChild->nodeType, [XML_TEXT_NODE, XML_CDATA_SECTION_NODE])) { return $node->firstChild->nodeValue; } - $value = array(); + $value = []; foreach ($node->childNodes as $subnode) { if (XML_PI_NODE === $subnode->nodeType) { @@ -396,7 +396,7 @@ private function buildXml(\DOMNode $parentNode, $data, $xmlRootNodeName = null) /* * Create nodes to append to $parentNode based on the $key of this array * Produces <xml><item>0</item><item>1</item></xml> - * From array("item" => array(0,1));. + * From ["item" => [0,1]];. */ foreach ($data as $subData) { $append = $this->appendNode($parentNode, $subData, $key); @@ -513,7 +513,7 @@ private function selectNodeType(\DOMNode $node, $val) * * @return string */ - private function resolveXmlRootName(array $context = array()) + private function resolveXmlRootName(array $context = []) { return isset($context['xml_root_node_name']) ? $context['xml_root_node_name'] @@ -527,7 +527,7 @@ private function resolveXmlRootName(array $context = array()) * * @return bool */ - private function resolveXmlTypeCastAttributes(array $context = array()) + private function resolveXmlTypeCastAttributes(array $context = []) { return isset($context['xml_type_cast_attributes']) ? (bool) $context['xml_type_cast_attributes'] @@ -546,7 +546,7 @@ private function createDomDocument(array $context) $document = new \DOMDocument(); // Set an attribute on the DOM document specifying, as part of the XML declaration, - $xmlOptions = array( + $xmlOptions = [ // nicely formats output with indentation and extra space 'xml_format_output' => 'formatOutput', // the version number of the document @@ -555,7 +555,7 @@ private function createDomDocument(array $context) 'xml_encoding' => 'encoding', // whether the document is standalone 'xml_standalone' => 'xmlStandalone', - ); + ]; foreach ($xmlOptions as $xmlOption => $documentProperty) { if (isset($context[$xmlOption])) { $document->$documentProperty = $context[$xmlOption]; diff --git a/vendor/symfony/serializer/Encoder/YamlEncoder.php b/vendor/symfony/serializer/Encoder/YamlEncoder.php index 3ac1af679a4a1a43f97a5ea0136ad681cc96fd7a..62e5212077dce354f6dcc4bbdc97030969a8dbd5 100644 --- a/vendor/symfony/serializer/Encoder/YamlEncoder.php +++ b/vendor/symfony/serializer/Encoder/YamlEncoder.php @@ -26,9 +26,9 @@ class YamlEncoder implements EncoderInterface, DecoderInterface private $dumper; private $parser; - private $defaultContext = array('yaml_inline' => 0, 'yaml_indent' => 0, 'yaml_flags' => 0); + private $defaultContext = ['yaml_inline' => 0, 'yaml_indent' => 0, 'yaml_flags' => 0]; - public function __construct(Dumper $dumper = null, Parser $parser = null, array $defaultContext = array()) + public function __construct(Dumper $dumper = null, Parser $parser = null, array $defaultContext = []) { if (!class_exists(Dumper::class)) { throw new RuntimeException('The YamlEncoder class requires the "Yaml" component. Install "symfony/yaml" to use it.'); @@ -42,7 +42,7 @@ public function __construct(Dumper $dumper = null, Parser $parser = null, array /** * {@inheritdoc} */ - public function encode($data, $format, array $context = array()) + public function encode($data, $format, array $context = []) { $context = array_merge($this->defaultContext, $context); @@ -60,7 +60,7 @@ public function supportsEncoding($format) /** * {@inheritdoc} */ - public function decode($data, $format, array $context = array()) + public function decode($data, $format, array $context = []) { $context = array_merge($this->defaultContext, $context); diff --git a/vendor/symfony/serializer/LICENSE b/vendor/symfony/serializer/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/serializer/LICENSE +++ b/vendor/symfony/serializer/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/serializer/Mapping/AttributeMetadata.php b/vendor/symfony/serializer/Mapping/AttributeMetadata.php index 9ad6e30810d8f7c7a1feff459c3b0b526c91f992..d82369f04250acb860f52aadd89f5c33e72a921f 100644 --- a/vendor/symfony/serializer/Mapping/AttributeMetadata.php +++ b/vendor/symfony/serializer/Mapping/AttributeMetadata.php @@ -30,7 +30,7 @@ class AttributeMetadata implements AttributeMetadataInterface * class' serialized representation. Do not access it. Use * {@link getGroups()} instead. */ - public $groups = array(); + public $groups = []; /** * @var int|null @@ -115,6 +115,6 @@ public function merge(AttributeMetadataInterface $attributeMetadata) */ public function __sleep() { - return array('name', 'groups', 'maxDepth'); + return ['name', 'groups', 'maxDepth']; } } diff --git a/vendor/symfony/serializer/Mapping/AttributeMetadataInterface.php b/vendor/symfony/serializer/Mapping/AttributeMetadataInterface.php index 944a7b3133f358807104f41ff3b13a29b02d6854..d9a15d5ac0de5c74437cfc1a923bf0c2cc0418bc 100644 --- a/vendor/symfony/serializer/Mapping/AttributeMetadataInterface.php +++ b/vendor/symfony/serializer/Mapping/AttributeMetadataInterface.php @@ -60,5 +60,5 @@ public function getMaxDepth(); /** * Merges an {@see AttributeMetadataInterface} with in the current one. */ - public function merge(AttributeMetadataInterface $attributeMetadata); + public function merge(self $attributeMetadata); } diff --git a/vendor/symfony/serializer/Mapping/ClassMetadata.php b/vendor/symfony/serializer/Mapping/ClassMetadata.php index 7858f74dbbe2939e12c7c6311146d1462909c8ab..206077626050562c39cf9d9ab606f155462bb6c1 100644 --- a/vendor/symfony/serializer/Mapping/ClassMetadata.php +++ b/vendor/symfony/serializer/Mapping/ClassMetadata.php @@ -32,7 +32,7 @@ class ClassMetadata implements ClassMetadataInterface * class' serialized representation. Do not access it. Use * {@link getAttributesMetadata()} instead. */ - public $attributesMetadata = array(); + public $attributesMetadata = []; /** * @var \ReflectionClass @@ -106,9 +106,9 @@ public function getReflectionClass() */ public function __sleep() { - return array( + return [ 'name', 'attributesMetadata', - ); + ]; } } diff --git a/vendor/symfony/serializer/Mapping/Loader/XmlFileLoader.php b/vendor/symfony/serializer/Mapping/Loader/XmlFileLoader.php index 76d064326f168b59197d96da802d9ccca9203bb8..2013e5897b49e769cd2682eb4a215e9fbbd0598a 100644 --- a/vendor/symfony/serializer/Mapping/Loader/XmlFileLoader.php +++ b/vendor/symfony/serializer/Mapping/Loader/XmlFileLoader.php @@ -110,7 +110,7 @@ private function parseFile($file) private function getClassesFromXml() { $xml = $this->parseFile($this->file); - $classes = array(); + $classes = []; foreach ($xml->class as $class) { $classes[(string) $class['name']] = $class; diff --git a/vendor/symfony/serializer/Mapping/Loader/YamlFileLoader.php b/vendor/symfony/serializer/Mapping/Loader/YamlFileLoader.php index 886da0d1b509f2d88a74f945dc31305d5c1fbda5..910919106d14ec95f1aa53ee09bde074bd15904d 100644 --- a/vendor/symfony/serializer/Mapping/Loader/YamlFileLoader.php +++ b/vendor/symfony/serializer/Mapping/Loader/YamlFileLoader.php @@ -116,7 +116,7 @@ private function getClassesFromYaml() $classes = $this->yamlParser->parseFile($this->file); if (empty($classes)) { - return array(); + return []; } if (!\is_array($classes)) { diff --git a/vendor/symfony/serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php b/vendor/symfony/serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php index 9c3f318edd1d4df06bad1aa1432b9d3c4449ba9b..f513c82e8110f45a2b16ff2b3f887ca77245661d 100644 --- a/vendor/symfony/serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php +++ b/vendor/symfony/serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php @@ -22,7 +22,7 @@ class CamelCaseToSnakeCaseNameConverter implements NameConverterInterface private $lowerCamelCase; /** - * @param null|array $attributes The list of attributes to rename or null for all attributes + * @param array|null $attributes The list of attributes to rename or null for all attributes * @param bool $lowerCamelCase Use lowerCamelCase style */ public function __construct(array $attributes = null, $lowerCamelCase = true) diff --git a/vendor/symfony/serializer/Normalizer/AbstractNormalizer.php b/vendor/symfony/serializer/Normalizer/AbstractNormalizer.php index fb9702f0487975eab18ce8ad374df5c5583a7229..3f181e4e99a55e2a71b4ac5b34b6eee88ef99eb9 100644 --- a/vendor/symfony/serializer/Normalizer/AbstractNormalizer.php +++ b/vendor/symfony/serializer/Normalizer/AbstractNormalizer.php @@ -58,17 +58,17 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N /** * @var array */ - protected $callbacks = array(); + protected $callbacks = []; /** * @var array */ - protected $ignoredAttributes = array(); + protected $ignoredAttributes = []; /** * @var array */ - protected $camelizedAttributes = array(); + protected $camelizedAttributes = []; /** * Sets the {@link ClassMetadataFactoryInterface} to use. @@ -120,10 +120,7 @@ public function setCallbacks(array $callbacks) { foreach ($callbacks as $attribute => $callback) { if (!\is_callable($callback)) { - throw new InvalidArgumentException(sprintf( - 'The given callback for attribute "%s" is not callable.', - $attribute - )); + throw new InvalidArgumentException(sprintf('The given callback for attribute "%s" is not callable.', $attribute)); } } $this->callbacks = $callbacks; @@ -221,7 +218,7 @@ protected function getAllowedAttributes($classOrObject, array $context, $attribu return false; } - $allowedAttributes = array(); + $allowedAttributes = []; foreach ($this->classMetadataFactory->getMetadataFor($classOrObject)->getAttributesMetadata() as $attributeMetadata) { $name = $attributeMetadata->getName(); @@ -246,7 +243,7 @@ protected function getAllowedAttributes($classOrObject, array $context, $attribu * * @return bool */ - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = array()) + protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) { if (\in_array($attribute, $this->ignoredAttributes)) { return false; @@ -338,7 +335,7 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref if ($constructor) { $constructorParameters = $constructor->getParameters(); - $params = array(); + $params = []; foreach ($constructorParameters as $constructorParameter) { $paramName = $constructorParameter->name; $key = $this->nameConverter ? $this->nameConverter->normalize($paramName) : $paramName; @@ -346,14 +343,14 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref $allowed = false === $allowedAttributes || \in_array($paramName, $allowedAttributes); $ignored = !$this->isAllowedAttribute($class, $paramName, $format, $context); if (method_exists($constructorParameter, 'isVariadic') && $constructorParameter->isVariadic()) { - if ($allowed && !$ignored && (isset($data[$key]) || array_key_exists($key, $data))) { + if ($allowed && !$ignored && (isset($data[$key]) || \array_key_exists($key, $data))) { if (!\is_array($data[$paramName])) { throw new RuntimeException(sprintf('Cannot create an instance of %s from serialized data because the variadic parameter %s can only accept an array.', $class, $constructorParameter->name)); } $params = array_merge($params, $data[$paramName]); } - } elseif ($allowed && !$ignored && (isset($data[$key]) || array_key_exists($key, $data))) { + } elseif ($allowed && !$ignored && (isset($data[$key]) || \array_key_exists($key, $data))) { $parameterData = $data[$key]; if (null === $parameterData && $constructorParameter->allowsNull()) { $params[] = null; @@ -361,31 +358,14 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref unset($data[$key]); continue; } - try { - if (null !== $constructorParameter->getClass()) { - if (!$this->serializer instanceof DenormalizerInterface) { - throw new LogicException(sprintf('Cannot create an instance of %s from serialized data because the serializer inject in "%s" is not a denormalizer', $constructorParameter->getClass(), static::class)); - } - $parameterClass = $constructorParameter->getClass()->getName(); - $parameterData = $this->serializer->denormalize($parameterData, $parameterClass, $format, $this->createChildContext($context, $paramName)); - } - } catch (\ReflectionException $e) { - throw new RuntimeException(sprintf('Could not determine the class of the parameter "%s".', $key), 0, $e); - } // Don't run set for a parameter passed to the constructor - $params[] = $parameterData; + $params[] = $this->denormalizeParameter($reflectionClass, $constructorParameter, $paramName, $parameterData, $context, $format); unset($data[$key]); } elseif ($constructorParameter->isDefaultValueAvailable()) { $params[] = $constructorParameter->getDefaultValue(); } else { - throw new RuntimeException( - sprintf( - 'Cannot create an instance of %s from serialized data because its constructor requires parameter "%s" to be present.', - $class, - $constructorParameter->name - ) - ); + throw new RuntimeException(sprintf('Cannot create an instance of %s from serialized data because its constructor requires parameter "%s" to be present.', $class, $constructorParameter->name)); } } @@ -399,6 +379,27 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref return new $class(); } + /** + * @internal + */ + protected function denormalizeParameter(\ReflectionClass $class, \ReflectionParameter $parameter, $parameterName, $parameterData, array $context, $format = null) + { + try { + if (null !== $parameter->getClass()) { + if (!$this->serializer instanceof DenormalizerInterface) { + throw new LogicException(sprintf('Cannot create an instance of %s from serialized data because the serializer inject in "%s" is not a denormalizer', $parameter->getClass(), static::class)); + } + $parameterClass = $parameter->getClass()->getName(); + + return $this->serializer->denormalize($parameterData, $parameterClass, $format, $this->createChildContext($context, $parameterName)); + } + + return $parameterData; + } catch (\ReflectionException $e) { + throw new RuntimeException(sprintf('Could not determine the class of the parameter "%s".', $parameterName), 0, $e); + } + } + /** * @param array $parentContext * @param string $attribute diff --git a/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php b/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php index aff70ee4ce309a13b00b528626ad5cf3936f7edd..17c31b132b29c2e8f8ccf58b2963cc7787910640 100644 --- a/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php +++ b/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php @@ -34,8 +34,8 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer const DISABLE_TYPE_ENFORCEMENT = 'disable_type_enforcement'; private $propertyTypeExtractor; - private $attributesCache = array(); - private $cache = array(); + private $attributesCache = []; + private $cache = []; public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null) { @@ -55,7 +55,7 @@ public function supportsNormalization($data, $format = null) /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = array()) + public function normalize($object, $format = null, array $context = []) { if (!isset($context['cache_key'])) { $context['cache_key'] = $this->getCacheKey($format, $context); @@ -65,8 +65,8 @@ public function normalize($object, $format = null, array $context = array()) return $this->handleCircularReference($object); } - $data = array(); - $stack = array(); + $data = []; + $stack = []; $attributes = $this->getAttributes($object, $format, $context); $class = \get_class($object); $attributesMetadata = $this->classMetadataFactory ? $this->classMetadataFactory->getMetadataFor($class)->getAttributesMetadata() : null; @@ -148,7 +148,7 @@ protected function getAttributes($object, $format = null, array $context) * * @return string[] */ - abstract protected function extractAttributes($object, $format = null, array $context = array()); + abstract protected function extractAttributes($object, $format = null, array $context = []); /** * Gets the attribute value. @@ -160,7 +160,7 @@ abstract protected function extractAttributes($object, $format = null, array $co * * @return mixed */ - abstract protected function getAttributeValue($object, $attribute, $format = null, array $context = array()); + abstract protected function getAttributeValue($object, $attribute, $format = null, array $context = []); /** * {@inheritdoc} @@ -173,7 +173,7 @@ public function supportsDenormalization($data, $type, $format = null) /** * {@inheritdoc} */ - public function denormalize($data, $class, $format = null, array $context = array()) + public function denormalize($data, $class, $format = null, array $context = []) { if (!isset($context['cache_key'])) { $context['cache_key'] = $this->getCacheKey($format, $context); @@ -181,7 +181,7 @@ public function denormalize($data, $class, $format = null, array $context = arra $allowedAttributes = $this->getAllowedAttributes($class, $context, true); $normalizedData = $this->prepareForDenormalization($data); - $extraAttributes = array(); + $extraAttributes = []; $reflectionClass = new \ReflectionClass($class); $object = $this->instantiateObject($normalizedData, $class, $context, $reflectionClass, $allowedAttributes, $format); @@ -223,7 +223,7 @@ public function denormalize($data, $class, $format = null, array $context = arra * @param string|null $format * @param array $context */ - abstract protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = array()); + abstract protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []); /** * Validates the submitted data and denormalizes it. @@ -245,7 +245,7 @@ private function validateAndDenormalize($currentClass, $attribute, $data, $forma return $data; } - $expectedTypes = array(); + $expectedTypes = []; foreach ($types as $type) { if (null === $data && $type->isNullable()) { return; @@ -258,7 +258,7 @@ private function validateAndDenormalize($currentClass, $attribute, $data, $forma // Fix a collection that contains the only one element // This is special to xml format only if ('xml' === $format && !\is_int(key($data))) { - $data = array($data); + $data = [$data]; } if (null !== $collectionKeyType = $type->getCollectionKeyType()) { @@ -304,6 +304,18 @@ private function validateAndDenormalize($currentClass, $attribute, $data, $forma throw new NotNormalizableValueException(sprintf('The type of the "%s" attribute for class "%s" must be one of "%s" ("%s" given).', $attribute, $currentClass, implode('", "', array_keys($expectedTypes)), \gettype($data))); } + /** + * @internal + */ + protected function denormalizeParameter(\ReflectionClass $class, \ReflectionParameter $parameter, $parameterName, $parameterData, array $context, $format = null) + { + if (null === $this->propertyTypeExtractor || null === $types = $this->propertyTypeExtractor->getTypes($class->getName(), $parameterName)) { + return parent::denormalizeParameter($class, $parameter, $parameterName, $parameterData, $context, $format); + } + + return $this->validateAndDenormalize($class->getName(), $parameterName, $parameterData, $format, $context); + } + /** * Sets an attribute and apply the name converter if necessary. * diff --git a/vendor/symfony/serializer/Normalizer/ArrayDenormalizer.php b/vendor/symfony/serializer/Normalizer/ArrayDenormalizer.php index 23b3a0e95b023ebdeefd3339ebf1c0a17114a779..af80d00ba0f804a8983406a368d24e3149ea9f5e 100644 --- a/vendor/symfony/serializer/Normalizer/ArrayDenormalizer.php +++ b/vendor/symfony/serializer/Normalizer/ArrayDenormalizer.php @@ -36,7 +36,7 @@ class ArrayDenormalizer implements DenormalizerInterface, SerializerAwareInterfa * * @throws NotNormalizableValueException */ - public function denormalize($data, $class, $format = null, array $context = array()) + public function denormalize($data, $class, $format = null, array $context = []) { if (null === $this->serializer) { throw new BadMethodCallException('Please set a serializer before calling denormalize()!'); @@ -66,9 +66,9 @@ public function denormalize($data, $class, $format = null, array $context = arra /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null/*, array $context = array()*/) + public function supportsDenormalization($data, $type, $format = null/*, array $context = []*/) { - $context = \func_num_args() > 3 ? func_get_arg(3) : array(); + $context = \func_num_args() > 3 ? func_get_arg(3) : []; return '[]' === substr($type, -2) && $this->serializer->supportsDenormalization($data, substr($type, 0, -2), $format, $context); diff --git a/vendor/symfony/serializer/Normalizer/ContextAwareDenormalizerInterface.php b/vendor/symfony/serializer/Normalizer/ContextAwareDenormalizerInterface.php index f0bb48c5c649efd11670e7a45274cb7f0a11c564..4e68dae1ee3ddbc06d74006bdca4cc79d1d6fa23 100644 --- a/vendor/symfony/serializer/Normalizer/ContextAwareDenormalizerInterface.php +++ b/vendor/symfony/serializer/Normalizer/ContextAwareDenormalizerInterface.php @@ -23,5 +23,5 @@ interface ContextAwareDenormalizerInterface extends DenormalizerInterface * * @param array $context options that denormalizers have access to */ - public function supportsDenormalization($data, $type, $format = null, array $context = array()); + public function supportsDenormalization($data, $type, $format = null, array $context = []); } diff --git a/vendor/symfony/serializer/Normalizer/ContextAwareNormalizerInterface.php b/vendor/symfony/serializer/Normalizer/ContextAwareNormalizerInterface.php index b6ab05b713af66cd9f04bee4d65fb0ae1f4d9f35..c278b7ded9f28aebf8fb12a530e573bb3f06fbc0 100644 --- a/vendor/symfony/serializer/Normalizer/ContextAwareNormalizerInterface.php +++ b/vendor/symfony/serializer/Normalizer/ContextAwareNormalizerInterface.php @@ -23,5 +23,5 @@ interface ContextAwareNormalizerInterface extends NormalizerInterface * * @param array $context options that normalizers have access to */ - public function supportsNormalization($data, $format = null, array $context = array()); + public function supportsNormalization($data, $format = null, array $context = []); } diff --git a/vendor/symfony/serializer/Normalizer/CustomNormalizer.php b/vendor/symfony/serializer/Normalizer/CustomNormalizer.php index 6a15d8da9027063bcd36d05331a34f61c5649f3d..969dcf5fc923904530a4881e83efc1751952d5ad 100644 --- a/vendor/symfony/serializer/Normalizer/CustomNormalizer.php +++ b/vendor/symfony/serializer/Normalizer/CustomNormalizer.php @@ -22,12 +22,12 @@ class CustomNormalizer implements NormalizerInterface, DenormalizerInterface, Se use ObjectToPopulateTrait; use SerializerAwareTrait; - private $cache = array(); + private $cache = []; /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = array()) + public function normalize($object, $format = null, array $context = []) { return $object->normalize($this->serializer, $format, $context); } @@ -35,7 +35,7 @@ public function normalize($object, $format = null, array $context = array()) /** * {@inheritdoc} */ - public function denormalize($data, $class, $format = null, array $context = array()) + public function denormalize($data, $class, $format = null, array $context = []) { $object = $this->extractObjectToPopulate($class, $context) ?: new $class(); $object->denormalize($this->serializer, $data, $format, $context); diff --git a/vendor/symfony/serializer/Normalizer/DataUriNormalizer.php b/vendor/symfony/serializer/Normalizer/DataUriNormalizer.php index 995bdf14417763d74dcc74b05eb7af90955d5253..0284ca6ebcc4196b121a1be5b2bb4e190117ab36 100644 --- a/vendor/symfony/serializer/Normalizer/DataUriNormalizer.php +++ b/vendor/symfony/serializer/Normalizer/DataUriNormalizer.php @@ -25,11 +25,11 @@ */ class DataUriNormalizer implements NormalizerInterface, DenormalizerInterface { - private static $supportedTypes = array( + private static $supportedTypes = [ \SplFileInfo::class => true, \SplFileObject::class => true, File::class => true, - ); + ]; /** * @var MimeTypeGuesserInterface @@ -48,7 +48,7 @@ public function __construct(MimeTypeGuesserInterface $mimeTypeGuesser = null) /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = array()) + public function normalize($object, $format = null, array $context = []) { if (!$object instanceof \SplFileInfo) { throw new InvalidArgumentException('The object must be an instance of "\SplFileInfo".'); @@ -89,7 +89,7 @@ public function supportsNormalization($data, $format = null) * @throws InvalidArgumentException * @throws NotNormalizableValueException */ - public function denormalize($data, $class, $format = null, array $context = array()) + public function denormalize($data, $class, $format = null, array $context = []) { if (!preg_match('/^data:([a-z0-9][a-z0-9\!\#\$\&\-\^\_\+\.]{0,126}\/[a-z0-9][a-z0-9\!\#\$\&\-\^\_\+\.]{0,126}(;[a-z0-9\-]+\=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9\!\$\&\\\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i', $data)) { throw new NotNormalizableValueException('The provided "data:" URI is not valid.'); diff --git a/vendor/symfony/serializer/Normalizer/DateIntervalNormalizer.php b/vendor/symfony/serializer/Normalizer/DateIntervalNormalizer.php index 7f23aec354d13d8a132d8c4fa7af741ef08e3f80..56527a8eb4ecfc02b84e04e6e852858c9fa9491c 100644 --- a/vendor/symfony/serializer/Normalizer/DateIntervalNormalizer.php +++ b/vendor/symfony/serializer/Normalizer/DateIntervalNormalizer.php @@ -39,7 +39,7 @@ public function __construct($format = 'P%yY%mM%dDT%hH%iM%sS') * * @throws InvalidArgumentException */ - public function normalize($object, $format = null, array $context = array()) + public function normalize($object, $format = null, array $context = []) { if (!$object instanceof \DateInterval) { throw new InvalidArgumentException('The object must be an instance of "\DateInterval".'); @@ -64,7 +64,7 @@ public function supportsNormalization($data, $format = null) * @throws InvalidArgumentException * @throws UnexpectedValueException */ - public function denormalize($data, $class, $format = null, array $context = array()) + public function denormalize($data, $class, $format = null, array $context = []) { if (!\is_string($data)) { throw new InvalidArgumentException(sprintf('Data expected to be a string, %s given.', \gettype($data))); diff --git a/vendor/symfony/serializer/Normalizer/DateTimeNormalizer.php b/vendor/symfony/serializer/Normalizer/DateTimeNormalizer.php index be469a4d53c5f2b6e7457f8557b132135547ad95..a36549c3b225ce16b78e48ee3a21f9953c3a7adf 100644 --- a/vendor/symfony/serializer/Normalizer/DateTimeNormalizer.php +++ b/vendor/symfony/serializer/Normalizer/DateTimeNormalizer.php @@ -28,11 +28,11 @@ class DateTimeNormalizer implements NormalizerInterface, DenormalizerInterface private $format; private $timezone; - private static $supportedTypes = array( + private static $supportedTypes = [ \DateTimeInterface::class => true, \DateTimeImmutable::class => true, \DateTime::class => true, - ); + ]; /** * @param string $format @@ -49,7 +49,7 @@ public function __construct($format = \DateTime::RFC3339, \DateTimeZone $timezon * * @throws InvalidArgumentException */ - public function normalize($object, $format = null, array $context = array()) + public function normalize($object, $format = null, array $context = []) { if (!$object instanceof \DateTimeInterface) { throw new InvalidArgumentException('The object must implement the "\DateTimeInterface".'); @@ -59,7 +59,8 @@ public function normalize($object, $format = null, array $context = array()) $timezone = $this->getTimezone($context); if (null !== $timezone) { - $object = (new \DateTimeImmutable('@'.$object->getTimestamp()))->setTimezone($timezone); + $object = clone $object; + $object = $object->setTimezone($timezone); } return $object->format($format); @@ -78,7 +79,7 @@ public function supportsNormalization($data, $format = null) * * @throws NotNormalizableValueException */ - public function denormalize($data, $class, $format = null, array $context = array()) + public function denormalize($data, $class, $format = null, array $context = []) { $dateTimeFormat = isset($context[self::FORMAT_KEY]) ? $context[self::FORMAT_KEY] : null; $timezone = $this->getTimezone($context); @@ -132,7 +133,7 @@ public function supportsDenormalization($data, $type, $format = null) */ private function formatDateTimeErrors(array $errors) { - $formattedErrors = array(); + $formattedErrors = []; foreach ($errors as $pos => $message) { $formattedErrors[] = sprintf('at position %d: %s', $pos, $message); @@ -143,7 +144,7 @@ private function formatDateTimeErrors(array $errors) private function getTimezone(array $context) { - $dateTimeZone = array_key_exists(self::TIMEZONE_KEY, $context) ? $context[self::TIMEZONE_KEY] : $this->timezone; + $dateTimeZone = \array_key_exists(self::TIMEZONE_KEY, $context) ? $context[self::TIMEZONE_KEY] : $this->timezone; if (null === $dateTimeZone) { return null; diff --git a/vendor/symfony/serializer/Normalizer/DenormalizableInterface.php b/vendor/symfony/serializer/Normalizer/DenormalizableInterface.php index 5db15418b5c0208aaf9df578999c07ed40fdf53c..31e27a85cb024ebdbb4c049c4f8389aa53f46e1d 100644 --- a/vendor/symfony/serializer/Normalizer/DenormalizableInterface.php +++ b/vendor/symfony/serializer/Normalizer/DenormalizableInterface.php @@ -36,5 +36,5 @@ interface DenormalizableInterface * * @return object */ - public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array()); + public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []); } diff --git a/vendor/symfony/serializer/Normalizer/DenormalizerInterface.php b/vendor/symfony/serializer/Normalizer/DenormalizerInterface.php index c3a2bb535632e62244a2666ac0295495acb386ff..7a12d20f1132eb6917483bc7abbe1dcb764e3532 100644 --- a/vendor/symfony/serializer/Normalizer/DenormalizerInterface.php +++ b/vendor/symfony/serializer/Normalizer/DenormalizerInterface.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Serializer\Normalizer; use Symfony\Component\Serializer\Exception\BadMethodCallException; +use Symfony\Component\Serializer\Exception\ExceptionInterface; use Symfony\Component\Serializer\Exception\ExtraAttributesException; use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Exception\LogicException; @@ -41,8 +42,9 @@ interface DenormalizerInterface * @throws ExtraAttributesException Occurs when the item doesn't have attribute to receive given data * @throws LogicException Occurs when the normalizer is not supposed to denormalize * @throws RuntimeException Occurs if the class cannot be instantiated + * @throws ExceptionInterface Occurs for all the other cases of errors */ - public function denormalize($data, $class, $format = null, array $context = array()); + public function denormalize($data, $class, $format = null, array $context = []); /** * Checks whether the given class is supported for denormalization by this normalizer. diff --git a/vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php b/vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php index 6eec9dd4d9bd06059dcf2b5b070ca81c773d20c7..d4be31d3d1c9c19c490b7284b450eae44a6c240f 100644 --- a/vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php +++ b/vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php @@ -34,8 +34,8 @@ */ class GetSetMethodNormalizer extends AbstractObjectNormalizer { - private static $setterAccessibleCache = array(); - private $cache = array(); + private static $setterAccessibleCache = []; + private $cache = []; /** * {@inheritdoc} @@ -96,12 +96,12 @@ private function isGetMethod(\ReflectionMethod $method) /** * {@inheritdoc} */ - protected function extractAttributes($object, $format = null, array $context = array()) + protected function extractAttributes($object, $format = null, array $context = []) { $reflectionObject = new \ReflectionObject($object); $reflectionMethods = $reflectionObject->getMethods(\ReflectionMethod::IS_PUBLIC); - $attributes = array(); + $attributes = []; foreach ($reflectionMethods as $method) { if (!$this->isGetMethod($method)) { continue; @@ -120,22 +120,22 @@ protected function extractAttributes($object, $format = null, array $context = a /** * {@inheritdoc} */ - protected function getAttributeValue($object, $attribute, $format = null, array $context = array()) + protected function getAttributeValue($object, $attribute, $format = null, array $context = []) { $ucfirsted = ucfirst($attribute); $getter = 'get'.$ucfirsted; - if (\is_callable(array($object, $getter))) { + if (\is_callable([$object, $getter])) { return $object->$getter(); } $isser = 'is'.$ucfirsted; - if (\is_callable(array($object, $isser))) { + if (\is_callable([$object, $isser])) { return $object->$isser(); } $haser = 'has'.$ucfirsted; - if (\is_callable(array($object, $haser))) { + if (\is_callable([$object, $haser])) { return $object->$haser(); } } @@ -143,13 +143,13 @@ protected function getAttributeValue($object, $attribute, $format = null, array /** * {@inheritdoc} */ - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = array()) + protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) { $setter = 'set'.ucfirst($attribute); $key = \get_class($object).':'.$setter; if (!isset(self::$setterAccessibleCache[$key])) { - self::$setterAccessibleCache[$key] = \is_callable(array($object, $setter)) && !(new \ReflectionMethod($object, $setter))->isStatic(); + self::$setterAccessibleCache[$key] = \is_callable([$object, $setter]) && !(new \ReflectionMethod($object, $setter))->isStatic(); } if (self::$setterAccessibleCache[$key]) { diff --git a/vendor/symfony/serializer/Normalizer/JsonSerializableNormalizer.php b/vendor/symfony/serializer/Normalizer/JsonSerializableNormalizer.php index 27ccf8023cba36c269eeb83b5e8c57f846bd5c3d..b4e53e51358aa111052b783f47a17ba52efbfdac 100644 --- a/vendor/symfony/serializer/Normalizer/JsonSerializableNormalizer.php +++ b/vendor/symfony/serializer/Normalizer/JsonSerializableNormalizer.php @@ -24,7 +24,7 @@ class JsonSerializableNormalizer extends AbstractNormalizer /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = array()) + public function normalize($object, $format = null, array $context = []) { if ($this->isCircularReference($object, $context)) { return $this->handleCircularReference($object); @@ -60,7 +60,7 @@ public function supportsDenormalization($data, $type, $format = null) /** * {@inheritdoc} */ - public function denormalize($data, $class, $format = null, array $context = array()) + public function denormalize($data, $class, $format = null, array $context = []) { throw new LogicException(sprintf('Cannot denormalize with "%s".', \JsonSerializable::class)); } diff --git a/vendor/symfony/serializer/Normalizer/NormalizableInterface.php b/vendor/symfony/serializer/Normalizer/NormalizableInterface.php index 8542e4f80e1c4c40975b84b5e14ddcf34c65f702..f7a5560143633ea9c8c6e609e89376c2ff950046 100644 --- a/vendor/symfony/serializer/Normalizer/NormalizableInterface.php +++ b/vendor/symfony/serializer/Normalizer/NormalizableInterface.php @@ -35,5 +35,5 @@ interface NormalizableInterface * * @return array|string|int|float|bool */ - public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array()); + public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []); } diff --git a/vendor/symfony/serializer/Normalizer/NormalizerInterface.php b/vendor/symfony/serializer/Normalizer/NormalizerInterface.php index 5cccdb3360095c3083538e764b7f10150c8063ca..02a211858492324796f5f94d4201dc05e7a3a0ae 100644 --- a/vendor/symfony/serializer/Normalizer/NormalizerInterface.php +++ b/vendor/symfony/serializer/Normalizer/NormalizerInterface.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Serializer\Normalizer; use Symfony\Component\Serializer\Exception\CircularReferenceException; +use Symfony\Component\Serializer\Exception\ExceptionInterface; use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Exception\LogicException; @@ -35,8 +36,9 @@ interface NormalizerInterface * @throws CircularReferenceException Occurs when the normalizer detects a circular reference when no circular * reference handler can fix it * @throws LogicException Occurs when the normalizer is not called in an expected context + * @throws ExceptionInterface Occurs for all the other cases of errors */ - public function normalize($object, $format = null, array $context = array()); + public function normalize($object, $format = null, array $context = []); /** * Checks whether the given class is supported for normalization by this normalizer. diff --git a/vendor/symfony/serializer/Normalizer/ObjectNormalizer.php b/vendor/symfony/serializer/Normalizer/ObjectNormalizer.php index 614d6cd4a93a2247ccb9e7ce92e2ff0d5092d903..854962da6c94d0a678daa4433114cd34955b0bf4 100644 --- a/vendor/symfony/serializer/Normalizer/ObjectNormalizer.php +++ b/vendor/symfony/serializer/Normalizer/ObjectNormalizer.php @@ -42,10 +42,10 @@ public function __construct(ClassMetadataFactoryInterface $classMetadataFactory /** * {@inheritdoc} */ - protected function extractAttributes($object, $format = null, array $context = array()) + protected function extractAttributes($object, $format = null, array $context = []) { // If not using groups, detect manually - $attributes = array(); + $attributes = []; // methods $reflClass = new \ReflectionClass($object); @@ -98,7 +98,7 @@ protected function extractAttributes($object, $format = null, array $context = a /** * {@inheritdoc} */ - protected function getAttributeValue($object, $attribute, $format = null, array $context = array()) + protected function getAttributeValue($object, $attribute, $format = null, array $context = []) { return $this->propertyAccessor->getValue($object, $attribute); } @@ -106,7 +106,7 @@ protected function getAttributeValue($object, $attribute, $format = null, array /** * {@inheritdoc} */ - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = array()) + protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) { try { $this->propertyAccessor->setValue($object, $attribute, $value); diff --git a/vendor/symfony/serializer/Normalizer/PropertyNormalizer.php b/vendor/symfony/serializer/Normalizer/PropertyNormalizer.php index 52dc4f4a52dcc424512ff1fe99aa828c4a3360dc..ece267873f25f87bdf0e53840539c5e4cd22a2e7 100644 --- a/vendor/symfony/serializer/Normalizer/PropertyNormalizer.php +++ b/vendor/symfony/serializer/Normalizer/PropertyNormalizer.php @@ -30,7 +30,7 @@ */ class PropertyNormalizer extends AbstractObjectNormalizer { - private $cache = array(); + private $cache = []; /** * {@inheritdoc} @@ -74,7 +74,7 @@ private function supports($class) /** * {@inheritdoc} */ - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = array()) + protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) { if (!parent::isAllowedAttribute($classOrObject, $attribute, $format, $context)) { return false; @@ -95,10 +95,10 @@ protected function isAllowedAttribute($classOrObject, $attribute, $format = null /** * {@inheritdoc} */ - protected function extractAttributes($object, $format = null, array $context = array()) + protected function extractAttributes($object, $format = null, array $context = []) { $reflectionObject = new \ReflectionObject($object); - $attributes = array(); + $attributes = []; do { foreach ($reflectionObject->getProperties() as $property) { @@ -116,7 +116,7 @@ protected function extractAttributes($object, $format = null, array $context = a /** * {@inheritdoc} */ - protected function getAttributeValue($object, $attribute, $format = null, array $context = array()) + protected function getAttributeValue($object, $attribute, $format = null, array $context = []) { try { $reflectionProperty = $this->getReflectionProperty($object, $attribute); @@ -135,7 +135,7 @@ protected function getAttributeValue($object, $attribute, $format = null, array /** * {@inheritdoc} */ - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = array()) + protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) { try { $reflectionProperty = $this->getReflectionProperty($object, $attribute); diff --git a/vendor/symfony/serializer/Serializer.php b/vendor/symfony/serializer/Serializer.php index 7b405399043f647049d74a643bcd4f9111504f58..4528e385a7ff6cecf6a5f0f9f92c84b1daee5dc4 100644 --- a/vendor/symfony/serializer/Serializer.php +++ b/vendor/symfony/serializer/Serializer.php @@ -29,9 +29,9 @@ * objects are turned into arrays by normalizers. * arrays are turned into various output formats by encoders. * - * $serializer->serialize($obj, 'xml') - * $serializer->decode($data, 'xml') - * $serializer->denormalize($data, 'Class', 'xml') + * $serializer->serialize($obj, 'xml') + * $serializer->decode($data, 'xml') + * $serializer->denormalize($data, 'Class', 'xml') * * @author Jordi Boggiano <j.boggiano@seld.be> * @author Johannes M. Schmitt <schmittjoh@gmail.com> @@ -53,23 +53,23 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz /** * @var array */ - protected $normalizers = array(); + protected $normalizers = []; /** * @var array * * @deprecated since 3.1 will be removed in 4.0 */ - protected $normalizerCache = array(); + protected $normalizerCache = []; /** * @var array * * @deprecated since 3.1 will be removed in 4.0 */ - protected $denormalizerCache = array(); + protected $denormalizerCache = []; - public function __construct(array $normalizers = array(), array $encoders = array()) + public function __construct(array $normalizers = [], array $encoders = []) { foreach ($normalizers as $normalizer) { if ($normalizer instanceof SerializerAwareInterface) { @@ -86,8 +86,8 @@ public function __construct(array $normalizers = array(), array $encoders = arra } $this->normalizers = $normalizers; - $decoders = array(); - $realEncoders = array(); + $decoders = []; + $realEncoders = []; foreach ($encoders as $encoder) { if ($encoder instanceof SerializerAwareInterface) { $encoder->setSerializer($this); @@ -106,7 +106,7 @@ public function __construct(array $normalizers = array(), array $encoders = arra /** * {@inheritdoc} */ - final public function serialize($data, $format, array $context = array()) + final public function serialize($data, $format, array $context = []) { if (!$this->supportsEncoding($format, $context)) { throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported', $format)); @@ -122,7 +122,7 @@ final public function serialize($data, $format, array $context = array()) /** * {@inheritdoc} */ - final public function deserialize($data, $type, $format, array $context = array()) + final public function deserialize($data, $type, $format, array $context = []) { if (!$this->supportsDecoding($format, $context)) { throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported', $format)); @@ -136,7 +136,7 @@ final public function deserialize($data, $type, $format, array $context = array( /** * {@inheritdoc} */ - public function normalize($data, $format = null, array $context = array()) + public function normalize($data, $format = null, array $context = []) { // If a normalizer supports the given data, use it if ($normalizer = $this->getNormalizer($data, $format, $context)) { @@ -148,7 +148,7 @@ public function normalize($data, $format = null, array $context = array()) } if (\is_array($data) || $data instanceof \Traversable) { - $normalized = array(); + $normalized = []; foreach ($data as $key => $val) { $normalized[$key] = $this->normalize($val, $format, $context); } @@ -172,7 +172,7 @@ public function normalize($data, $format = null, array $context = array()) * * @throws NotNormalizableValueException */ - public function denormalize($data, $type, $format = null, array $context = array()) + public function denormalize($data, $type, $format = null, array $context = []) { if (!$this->normalizers) { throw new LogicException('You must register at least one normalizer to be able to denormalize objects.'); @@ -188,7 +188,7 @@ public function denormalize($data, $type, $format = null, array $context = array /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null/*, array $context = array()*/) + public function supportsNormalization($data, $format = null/*, array $context = []*/) { if (\func_num_args() > 2) { $context = \func_get_arg(2); @@ -196,11 +196,11 @@ public function supportsNormalization($data, $format = null/*, array $context = if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('The "%s()" method will have a third `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method will have a third `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); } } - $context = array(); + $context = []; } return null !== $this->getNormalizer($data, $format, $context); @@ -209,7 +209,7 @@ public function supportsNormalization($data, $format = null/*, array $context = /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null/*, array $context = array()*/) + public function supportsDenormalization($data, $type, $format = null/*, array $context = []*/) { if (\func_num_args() > 3) { $context = \func_get_arg(3); @@ -217,11 +217,11 @@ public function supportsDenormalization($data, $type, $format = null/*, array $c if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('The "%s()" method will have a fourth `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method will have a fourth `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); } } - $context = array(); + $context = []; } return null !== $this->getDenormalizer($data, $type, $format, $context); @@ -267,7 +267,7 @@ private function getDenormalizer($data, $class, $format, array $context) /** * {@inheritdoc} */ - final public function encode($data, $format, array $context = array()) + final public function encode($data, $format, array $context = []) { return $this->encoder->encode($data, $format, $context); } @@ -275,7 +275,7 @@ final public function encode($data, $format, array $context = array()) /** * {@inheritdoc} */ - final public function decode($data, $format, array $context = array()) + final public function decode($data, $format, array $context = []) { return $this->decoder->decode($data, $format, $context); } @@ -283,7 +283,7 @@ final public function decode($data, $format, array $context = array()) /** * {@inheritdoc} */ - public function supportsEncoding($format/*, array $context = array()*/) + public function supportsEncoding($format/*, array $context = []*/) { if (\func_num_args() > 1) { $context = \func_get_arg(1); @@ -291,11 +291,11 @@ public function supportsEncoding($format/*, array $context = array()*/) if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('The "%s()" method will have a second `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); } } - $context = array(); + $context = []; } return $this->encoder->supportsEncoding($format, $context); @@ -304,7 +304,7 @@ public function supportsEncoding($format/*, array $context = array()*/) /** * {@inheritdoc} */ - public function supportsDecoding($format/*, array $context = array()*/) + public function supportsDecoding($format/*, array $context = []*/) { if (\func_num_args() > 1) { $context = \func_get_arg(1); @@ -312,11 +312,11 @@ public function supportsDecoding($format/*, array $context = array()*/) if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error(sprintf('The "%s()" method will have a second `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED); } } - $context = array(); + $context = []; } return $this->decoder->supportsDecoding($format, $context); diff --git a/vendor/symfony/serializer/SerializerInterface.php b/vendor/symfony/serializer/SerializerInterface.php index 196bff1a21c62a8fc84f32eef2dbdd44b49e07b9..7a03ef943a20ce13fd9ea14762aba71c9cefe82f 100644 --- a/vendor/symfony/serializer/SerializerInterface.php +++ b/vendor/symfony/serializer/SerializerInterface.php @@ -27,7 +27,7 @@ interface SerializerInterface * * @return string */ - public function serialize($data, $format, array $context = array()); + public function serialize($data, $format, array $context = []); /** * Deserializes data into the given type. @@ -39,5 +39,5 @@ public function serialize($data, $format, array $context = array()); * * @return object */ - public function deserialize($data, $type, $format, array $context = array()); + public function deserialize($data, $type, $format, array $context = []); } diff --git a/vendor/symfony/serializer/Tests/Annotation/GroupsTest.php b/vendor/symfony/serializer/Tests/Annotation/GroupsTest.php index 04729ccbb9765bbb1c68e71ac6de6281529d1582..9b54221d7630ded8e692d0ee27c6c410ca3f8851 100644 --- a/vendor/symfony/serializer/Tests/Annotation/GroupsTest.php +++ b/vendor/symfony/serializer/Tests/Annotation/GroupsTest.php @@ -24,7 +24,7 @@ class GroupsTest extends TestCase */ public function testEmptyGroupsParameter() { - new Groups(array('value' => array())); + new Groups(['value' => []]); } /** @@ -32,7 +32,7 @@ public function testEmptyGroupsParameter() */ public function testNotAnArrayGroupsParameter() { - new Groups(array('value' => 12)); + new Groups(['value' => 12]); } /** @@ -40,20 +40,20 @@ public function testNotAnArrayGroupsParameter() */ public function testInvalidGroupsParameter() { - new Groups(array('value' => array('a', 1, new \stdClass()))); + new Groups(['value' => ['a', 1, new \stdClass()]]); } public function testGroupsParameters() { - $validData = array('a', 'b'); + $validData = ['a', 'b']; - $groups = new Groups(array('value' => $validData)); + $groups = new Groups(['value' => $validData]); $this->assertEquals($validData, $groups->getGroups()); } public function testSingleGroup() { - $groups = new Groups(array('value' => 'a')); - $this->assertEquals(array('a'), $groups->getGroups()); + $groups = new Groups(['value' => 'a']); + $this->assertEquals(['a'], $groups->getGroups()); } } diff --git a/vendor/symfony/serializer/Tests/Annotation/MaxDepthTest.php b/vendor/symfony/serializer/Tests/Annotation/MaxDepthTest.php index 4554fc9905ca674a6f609ebdd9e2ab3be206a402..16f10e143459b29f2885149bbb7880ed18e7061f 100644 --- a/vendor/symfony/serializer/Tests/Annotation/MaxDepthTest.php +++ b/vendor/symfony/serializer/Tests/Annotation/MaxDepthTest.php @@ -25,17 +25,17 @@ class MaxDepthTest extends TestCase */ public function testNotSetMaxDepthParameter() { - new MaxDepth(array()); + new MaxDepth([]); } public function provideInvalidValues() { - return array( - array(''), - array('foo'), - array('1'), - array(0), - ); + return [ + [''], + ['foo'], + ['1'], + [0], + ]; } /** @@ -46,12 +46,12 @@ public function provideInvalidValues() */ public function testNotAnIntMaxDepthParameter($value) { - new MaxDepth(array('value' => $value)); + new MaxDepth(['value' => $value]); } public function testMaxDepthParameters() { - $maxDepth = new MaxDepth(array('value' => 3)); + $maxDepth = new MaxDepth(['value' => 3]); $this->assertEquals(3, $maxDepth->getMaxDepth()); } } diff --git a/vendor/symfony/serializer/Tests/DependencyInjection/SerializerPassTest.php b/vendor/symfony/serializer/Tests/DependencyInjection/SerializerPassTest.php index fa12454fd094e49af1ab8be3cf94afb01f60868a..5c3fedfe895a7c8dabe35a6fa862c44cab14e195 100644 --- a/vendor/symfony/serializer/Tests/DependencyInjection/SerializerPassTest.php +++ b/vendor/symfony/serializer/Tests/DependencyInjection/SerializerPassTest.php @@ -44,8 +44,8 @@ public function testThrowExceptionWhenNoEncoders() { $container = new ContainerBuilder(); $container->register('serializer') - ->addArgument(array()) - ->addArgument(array()); + ->addArgument([]) + ->addArgument([]); $container->register('normalizer')->addTag('serializer.normalizer'); $serializerPass = new SerializerPass(); @@ -56,19 +56,19 @@ public function testServicesAreOrderedAccordingToPriority() { $container = new ContainerBuilder(); - $definition = $container->register('serializer')->setArguments(array(null, null)); - $container->register('n2')->addTag('serializer.normalizer', array('priority' => 100))->addTag('serializer.encoder', array('priority' => 100)); - $container->register('n1')->addTag('serializer.normalizer', array('priority' => 200))->addTag('serializer.encoder', array('priority' => 200)); + $definition = $container->register('serializer')->setArguments([null, null]); + $container->register('n2')->addTag('serializer.normalizer', ['priority' => 100])->addTag('serializer.encoder', ['priority' => 100]); + $container->register('n1')->addTag('serializer.normalizer', ['priority' => 200])->addTag('serializer.encoder', ['priority' => 200]); $container->register('n3')->addTag('serializer.normalizer')->addTag('serializer.encoder'); $serializerPass = new SerializerPass(); $serializerPass->process($container); - $expected = array( + $expected = [ new Reference('n1'), new Reference('n2'), new Reference('n3'), - ); + ]; $this->assertEquals($expected, $definition->getArgument(0)); $this->assertEquals($expected, $definition->getArgument(1)); } diff --git a/vendor/symfony/serializer/Tests/DeserializeNestedArrayOfObjectsTest.php b/vendor/symfony/serializer/Tests/DeserializeNestedArrayOfObjectsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ffdae811bb512a2a6416b7d78e2c637b25eb4c89 --- /dev/null +++ b/vendor/symfony/serializer/Tests/DeserializeNestedArrayOfObjectsTest.php @@ -0,0 +1,128 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Serializer\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; +use Symfony\Component\Serializer\Encoder\JsonEncoder; +use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer; +use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +use Symfony\Component\Serializer\Serializer; + +class DeserializeNestedArrayOfObjectsTest extends TestCase +{ + public function provider() + { + return [ + //from property PhpDoc + [Zoo::class], + //from argument constructor PhpDoc + [ZooImmutable::class], + ]; + } + + /** + * @dataProvider provider + */ + public function testPropertyPhpDoc($class) + { + //GIVEN + $json = <<<EOF +{ + "animals": [ + {"name": "Bug"} + ] +} +EOF; + $serializer = new Serializer([ + new ObjectNormalizer(null, null, null, new PhpDocExtractor()), + new ArrayDenormalizer(), + ], ['json' => new JsonEncoder()]); + //WHEN + /** @var Zoo $zoo */ + $zoo = $serializer->deserialize($json, $class, 'json'); + //THEN + self::assertCount(1, $zoo->getAnimals()); + self::assertInstanceOf(Animal::class, $zoo->getAnimals()[0]); + } +} + +class Zoo +{ + /** @var Animal[] */ + private $animals = []; + + /** + * @return Animal[] + */ + public function getAnimals() + { + return $this->animals; + } + + /** + * @param Animal[] $animals + */ + public function setAnimals(array $animals) + { + $this->animals = $animals; + } +} + +class ZooImmutable +{ + /** @var Animal[] */ + private $animals = []; + + /** + * @param Animal[] $animals + */ + public function __construct(array $animals = []) + { + $this->animals = $animals; + } + + /** + * @return Animal[] + */ + public function getAnimals() + { + return $this->animals; + } +} + +class Animal +{ + /** @var string */ + private $name; + + public function __construct() + { + echo ''; + } + + /** + * @return string|null + */ + public function getName() + { + return $this->name; + } + + /** + * @param string|null $name + */ + public function setName($name) + { + $this->name = $name; + } +} diff --git a/vendor/symfony/serializer/Tests/Encoder/ChainDecoderTest.php b/vendor/symfony/serializer/Tests/Encoder/ChainDecoderTest.php index 7d860f65f27f33f799973a005d5f099f13553ee7..3a84d99dde286a376a50523c3f664a3f1a1024a4 100644 --- a/vendor/symfony/serializer/Tests/Encoder/ChainDecoderTest.php +++ b/vendor/symfony/serializer/Tests/Encoder/ChainDecoderTest.php @@ -32,12 +32,12 @@ protected function setUp() $this->decoder1 ->method('supportsDecoding') - ->will($this->returnValueMap(array( - array(self::FORMAT_1, array(), true), - array(self::FORMAT_2, array(), false), - array(self::FORMAT_3, array(), false), - array(self::FORMAT_3, array('foo' => 'bar'), true), - ))); + ->will($this->returnValueMap([ + [self::FORMAT_1, [], true], + [self::FORMAT_2, [], false], + [self::FORMAT_3, [], false], + [self::FORMAT_3, ['foo' => 'bar'], true], + ])); $this->decoder2 = $this ->getMockBuilder('Symfony\Component\Serializer\Encoder\DecoderInterface') @@ -45,13 +45,13 @@ protected function setUp() $this->decoder2 ->method('supportsDecoding') - ->will($this->returnValueMap(array( - array(self::FORMAT_1, array(), false), - array(self::FORMAT_2, array(), true), - array(self::FORMAT_3, array(), false), - ))); + ->will($this->returnValueMap([ + [self::FORMAT_1, [], false], + [self::FORMAT_2, [], true], + [self::FORMAT_3, [], false], + ])); - $this->chainDecoder = new ChainDecoder(array($this->decoder1, $this->decoder2)); + $this->chainDecoder = new ChainDecoder([$this->decoder1, $this->decoder2]); } public function testSupportsDecoding() @@ -59,7 +59,7 @@ public function testSupportsDecoding() $this->assertTrue($this->chainDecoder->supportsDecoding(self::FORMAT_1)); $this->assertTrue($this->chainDecoder->supportsDecoding(self::FORMAT_2)); $this->assertFalse($this->chainDecoder->supportsDecoding(self::FORMAT_3)); - $this->assertTrue($this->chainDecoder->supportsDecoding(self::FORMAT_3, array('foo' => 'bar'))); + $this->assertTrue($this->chainDecoder->supportsDecoding(self::FORMAT_3, ['foo' => 'bar'])); } public function testDecode() diff --git a/vendor/symfony/serializer/Tests/Encoder/ChainEncoderTest.php b/vendor/symfony/serializer/Tests/Encoder/ChainEncoderTest.php index 82c64cc149c633f475f2ab5d1c2d810a995ec8b2..48ccbdca0aca6f5bb849b142a9a32e9c4a41519d 100644 --- a/vendor/symfony/serializer/Tests/Encoder/ChainEncoderTest.php +++ b/vendor/symfony/serializer/Tests/Encoder/ChainEncoderTest.php @@ -34,12 +34,12 @@ protected function setUp() $this->encoder1 ->method('supportsEncoding') - ->will($this->returnValueMap(array( - array(self::FORMAT_1, array(), true), - array(self::FORMAT_2, array(), false), - array(self::FORMAT_3, array(), false), - array(self::FORMAT_3, array('foo' => 'bar'), true), - ))); + ->will($this->returnValueMap([ + [self::FORMAT_1, [], true], + [self::FORMAT_2, [], false], + [self::FORMAT_3, [], false], + [self::FORMAT_3, ['foo' => 'bar'], true], + ])); $this->encoder2 = $this ->getMockBuilder('Symfony\Component\Serializer\Encoder\EncoderInterface') @@ -47,13 +47,13 @@ protected function setUp() $this->encoder2 ->method('supportsEncoding') - ->will($this->returnValueMap(array( - array(self::FORMAT_1, array(), false), - array(self::FORMAT_2, array(), true), - array(self::FORMAT_3, array(), false), - ))); + ->will($this->returnValueMap([ + [self::FORMAT_1, [], false], + [self::FORMAT_2, [], true], + [self::FORMAT_3, [], false], + ])); - $this->chainEncoder = new ChainEncoder(array($this->encoder1, $this->encoder2)); + $this->chainEncoder = new ChainEncoder([$this->encoder1, $this->encoder2]); } public function testSupportsEncoding() @@ -61,7 +61,7 @@ public function testSupportsEncoding() $this->assertTrue($this->chainEncoder->supportsEncoding(self::FORMAT_1)); $this->assertTrue($this->chainEncoder->supportsEncoding(self::FORMAT_2)); $this->assertFalse($this->chainEncoder->supportsEncoding(self::FORMAT_3)); - $this->assertTrue($this->chainEncoder->supportsEncoding(self::FORMAT_3, array('foo' => 'bar'))); + $this->assertTrue($this->chainEncoder->supportsEncoding(self::FORMAT_3, ['foo' => 'bar'])); } public function testEncode() @@ -69,7 +69,7 @@ public function testEncode() $this->encoder1->expects($this->never())->method('encode'); $this->encoder2->expects($this->once())->method('encode'); - $this->chainEncoder->encode(array('foo' => 123), self::FORMAT_2); + $this->chainEncoder->encode(['foo' => 123], self::FORMAT_2); } /** @@ -77,7 +77,7 @@ public function testEncode() */ public function testEncodeUnsupportedFormat() { - $this->chainEncoder->encode(array('foo' => 123), self::FORMAT_3); + $this->chainEncoder->encode(['foo' => 123], self::FORMAT_3); } public function testNeedsNormalizationBasic() @@ -98,7 +98,7 @@ public function testNeedsNormalizationChainNormalizationAware($bool) $chainEncoder->method('supportsEncoding')->willReturn(true); $chainEncoder->method('needsNormalization')->willReturn($bool); - $sut = new ChainEncoder(array($chainEncoder)); + $sut = new ChainEncoder([$chainEncoder]); $this->assertEquals($bool, $sut->needsNormalization(self::FORMAT_1)); } @@ -106,17 +106,17 @@ public function testNeedsNormalizationChainNormalizationAware($bool) public function testNeedsNormalizationNormalizationAware() { $encoder = new NormalizationAwareEncoder(); - $sut = new ChainEncoder(array($encoder)); + $sut = new ChainEncoder([$encoder]); $this->assertFalse($sut->needsNormalization(self::FORMAT_1)); } public function booleanProvider() { - return array( - array(true), - array(false), - ); + return [ + [true], + [false], + ]; } } @@ -131,7 +131,7 @@ public function supportsEncoding($format) return true; } - public function encode($data, $format, array $context = array()) + public function encode($data, $format, array $context = []) { } } diff --git a/vendor/symfony/serializer/Tests/Encoder/CsvEncoderTest.php b/vendor/symfony/serializer/Tests/Encoder/CsvEncoderTest.php index a5e5c256f34ad2b13855bc4cb7fc26166d7ed274..1eb673e8e21ba805255fc07e7e8197e8b752c1ed 100644 --- a/vendor/symfony/serializer/Tests/Encoder/CsvEncoderTest.php +++ b/vendor/symfony/serializer/Tests/Encoder/CsvEncoderTest.php @@ -37,7 +37,7 @@ public function testSupportEncoding() public function testEncode() { - $value = array('foo' => 'hello', 'bar' => 'hey ho'); + $value = ['foo' => 'hello', 'bar' => 'hey ho']; $this->assertEquals(<<<'CSV' foo,bar @@ -49,10 +49,10 @@ public function testEncode() public function testEncodeCollection() { - $value = array( - array('foo' => 'hello', 'bar' => 'hey ho'), - array('foo' => 'hi', 'bar' => 'let\'s go'), - ); + $value = [ + ['foo' => 'hello', 'bar' => 'hey ho'], + ['foo' => 'hi', 'bar' => 'let\'s go'], + ]; $this->assertEquals(<<<'CSV' foo,bar @@ -70,7 +70,7 @@ public function testEncodePlainIndexedArray() a,b,c CSV - , $this->encoder->encode(array('a', 'b', 'c'), 'csv')); + , $this->encoder->encode(['a', 'b', 'c'], 'csv')); } public function testEncodeNonArray() @@ -85,10 +85,10 @@ public function testEncodeNonArray() public function testEncodeNestedArrays() { - $value = array('foo' => 'hello', 'bar' => array( - array('id' => 'yo', 1 => 'wesh'), - array('baz' => 'Halo', 'foo' => 'olá'), - )); + $value = ['foo' => 'hello', 'bar' => [ + ['id' => 'yo', 1 => 'wesh'], + ['baz' => 'Halo', 'foo' => 'olá'], + ]]; $this->assertEquals(<<<'CSV' foo,bar.0.id,bar.0.1,bar.1.baz,bar.1.foo @@ -102,7 +102,7 @@ public function testEncodeCustomSettings() { $this->encoder = new CsvEncoder(';', "'", '|', '-'); - $value = array('a' => 'he\'llo', 'c' => array('d' => 'foo')); + $value = ['a' => 'he\'llo', 'c' => ['d' => 'foo']]; $this->assertEquals(<<<'CSV' a;c-d @@ -114,34 +114,34 @@ public function testEncodeCustomSettings() public function testEncodeCustomSettingsPassedInContext() { - $value = array('a' => 'he\'llo', 'c' => array('d' => 'foo')); + $value = ['a' => 'he\'llo', 'c' => ['d' => 'foo']]; $this->assertSame(<<<'CSV' a;c-d 'he''llo';foo CSV - , $this->encoder->encode($value, 'csv', array( + , $this->encoder->encode($value, 'csv', [ CsvEncoder::DELIMITER_KEY => ';', CsvEncoder::ENCLOSURE_KEY => "'", CsvEncoder::ESCAPE_CHAR_KEY => '|', CsvEncoder::KEY_SEPARATOR_KEY => '-', - ))); + ])); } public function testEncodeEmptyArray() { - $this->assertEquals("\n\n", $this->encoder->encode(array(), 'csv')); - $this->assertEquals("\n\n", $this->encoder->encode(array(array()), 'csv')); + $this->assertEquals("\n\n", $this->encoder->encode([], 'csv')); + $this->assertEquals("\n\n", $this->encoder->encode([[]], 'csv')); } public function testEncodeVariableStructure() { - $value = array( - array('a' => array('foo', 'bar')), - array('a' => array(), 'b' => 'baz'), - array('a' => array('bar', 'foo'), 'c' => 'pong'), - ); + $value = [ + ['a' => ['foo', 'bar']], + ['a' => [], 'b' => 'baz'], + ['a' => ['bar', 'foo'], 'c' => 'pong'], + ]; $csv = <<<CSV a.0,a.1,c,b foo,bar,, @@ -155,15 +155,15 @@ public function testEncodeVariableStructure() public function testEncodeCustomHeaders() { - $context = array( - CsvEncoder::HEADERS_KEY => array( + $context = [ + CsvEncoder::HEADERS_KEY => [ 'b', 'c', - ), - ); - $value = array( - array('a' => 'foo', 'b' => 'bar'), - ); + ], + ]; + $value = [ + ['a' => 'foo', 'b' => 'bar'], + ]; $csv = <<<CSV b,c,a bar,,foo @@ -181,7 +181,7 @@ public function testSupportsDecoding() public function testDecode() { - $expected = array('foo' => 'a', 'bar' => 'b'); + $expected = ['foo' => 'a', 'bar' => 'b']; $this->assertEquals($expected, $this->encoder->decode(<<<'CSV' foo,bar @@ -192,11 +192,11 @@ public function testDecode() public function testDecodeCollection() { - $expected = array( - array('foo' => 'a', 'bar' => 'b'), - array('foo' => 'c', 'bar' => 'd'), - array('foo' => 'f'), - ); + $expected = [ + ['foo' => 'a', 'bar' => 'b'], + ['foo' => 'c', 'bar' => 'd'], + ['foo' => 'f'], + ]; $this->assertEquals($expected, $this->encoder->decode(<<<'CSV' foo,bar @@ -210,12 +210,12 @@ public function testDecodeCollection() public function testDecodeToManyRelation() { - $expected = array( - array('foo' => 'bar', 'relations' => array(array('a' => 'b'), array('a' => 'b'))), - array('foo' => 'bat', 'relations' => array(array('a' => 'b'), array('a' => ''))), - array('foo' => 'bat', 'relations' => array(array('a' => 'b'))), - array('foo' => 'baz', 'relations' => array(array('a' => 'c'), array('a' => 'c'))), - ); + $expected = [ + ['foo' => 'bar', 'relations' => [['a' => 'b'], ['a' => 'b']]], + ['foo' => 'bat', 'relations' => [['a' => 'b'], ['a' => '']]], + ['foo' => 'bat', 'relations' => [['a' => 'b']]], + ['foo' => 'baz', 'relations' => [['a' => 'c'], ['a' => 'c']]], + ]; $this->assertEquals($expected, $this->encoder->decode(<<<'CSV' foo,relations.0.a,relations.1.a @@ -229,10 +229,10 @@ public function testDecodeToManyRelation() public function testDecodeNestedArrays() { - $expected = array( - array('foo' => 'a', 'bar' => array('baz' => array('bat' => 'b'))), - array('foo' => 'c', 'bar' => array('baz' => array('bat' => 'd'))), - ); + $expected = [ + ['foo' => 'a', 'bar' => ['baz' => ['bat' => 'b']]], + ['foo' => 'c', 'bar' => ['baz' => ['bat' => 'd']]], + ]; $this->assertEquals($expected, $this->encoder->decode(<<<'CSV' foo,bar.baz.bat @@ -246,7 +246,7 @@ public function testDecodeCustomSettings() { $this->encoder = new CsvEncoder(';', "'", '|', '-'); - $expected = array('a' => 'hell\'o', 'bar' => array('baz' => 'b')); + $expected = ['a' => 'hell\'o', 'bar' => ['baz' => 'b']]; $this->assertEquals($expected, $this->encoder->decode(<<<'CSV' a;bar-baz 'hell''o';b;c @@ -256,26 +256,26 @@ public function testDecodeCustomSettings() public function testDecodeCustomSettingsPassedInContext() { - $expected = array('a' => 'hell\'o', 'bar' => array('baz' => 'b')); + $expected = ['a' => 'hell\'o', 'bar' => ['baz' => 'b']]; $this->assertEquals($expected, $this->encoder->decode(<<<'CSV' a;bar-baz 'hell''o';b;c CSV - , 'csv', array( + , 'csv', [ CsvEncoder::DELIMITER_KEY => ';', CsvEncoder::ENCLOSURE_KEY => "'", CsvEncoder::ESCAPE_CHAR_KEY => '|', CsvEncoder::KEY_SEPARATOR_KEY => '-', - ))); + ])); } public function testDecodeMalformedCollection() { - $expected = array( - array('foo' => 'a', 'bar' => 'b'), - array('foo' => 'c', 'bar' => 'd'), - array('foo' => 'f'), - ); + $expected = [ + ['foo' => 'a', 'bar' => 'b'], + ['foo' => 'c', 'bar' => 'd'], + ['foo' => 'f'], + ]; $this->assertEquals($expected, $this->encoder->decode(<<<'CSV' foo,bar @@ -289,6 +289,6 @@ public function testDecodeMalformedCollection() public function testDecodeEmptyArray() { - $this->assertEquals(array(), $this->encoder->decode('', 'csv')); + $this->assertEquals([], $this->encoder->decode('', 'csv')); } } diff --git a/vendor/symfony/serializer/Tests/Encoder/JsonDecodeTest.php b/vendor/symfony/serializer/Tests/Encoder/JsonDecodeTest.php index 774064d43a8537ed85b8fcf4b27197d0bb3e2150..76a1b6324631cca5dfdf45269bbb267fdff7ec9c 100644 --- a/vendor/symfony/serializer/Tests/Encoder/JsonDecodeTest.php +++ b/vendor/symfony/serializer/Tests/Encoder/JsonDecodeTest.php @@ -47,12 +47,12 @@ public function decodeProvider() $stdClass = new \stdClass(); $stdClass->foo = 'bar'; - $assoc = array('foo' => 'bar'); + $assoc = ['foo' => 'bar']; - return array( - array('{"foo": "bar"}', $stdClass, array()), - array('{"foo": "bar"}', $assoc, array('json_decode_associative' => true)), - ); + return [ + ['{"foo": "bar"}', $stdClass, []], + ['{"foo": "bar"}', $assoc, ['json_decode_associative' => true]], + ]; } /** @@ -67,9 +67,9 @@ public function testDecodeWithException($value) public function decodeProviderException() { - return array( - array("{'foo': 'bar'}"), - array('kaboom!'), - ); + return [ + ["{'foo': 'bar'}"], + ['kaboom!'], + ]; } } diff --git a/vendor/symfony/serializer/Tests/Encoder/JsonEncodeTest.php b/vendor/symfony/serializer/Tests/Encoder/JsonEncodeTest.php index ed33233fb47ea4686212e534eab7d65fef389740..42a460e520400cd6515e35f04dac3cadd0551219 100644 --- a/vendor/symfony/serializer/Tests/Encoder/JsonEncodeTest.php +++ b/vendor/symfony/serializer/Tests/Encoder/JsonEncodeTest.php @@ -43,10 +43,10 @@ public function testEncode($toEncode, $expected, $context) public function encodeProvider() { - return array( - array(array(), '[]', array()), - array(array(), '{}', array('json_encode_options' => JSON_FORCE_OBJECT)), - ); + return [ + [[], '[]', []], + [[], '{}', ['json_encode_options' => JSON_FORCE_OBJECT]], + ]; } /** diff --git a/vendor/symfony/serializer/Tests/Encoder/JsonEncoderTest.php b/vendor/symfony/serializer/Tests/Encoder/JsonEncoderTest.php index 1977d4f19ce84bd48c39318ca70f555ab46dd44d..439fbda1638a3e9d4708d28fadbd92c4f897a3fe 100644 --- a/vendor/symfony/serializer/Tests/Encoder/JsonEncoderTest.php +++ b/vendor/symfony/serializer/Tests/Encoder/JsonEncoderTest.php @@ -24,7 +24,7 @@ class JsonEncoderTest extends TestCase protected function setUp() { $this->encoder = new JsonEncoder(); - $this->serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder())); + $this->serializer = new Serializer([new CustomNormalizer()], ['json' => new JsonEncoder()]); } public function testEncodeScalar() @@ -48,16 +48,16 @@ public function testComplexObject() public function testOptions() { - $context = array('json_encode_options' => JSON_NUMERIC_CHECK); + $context = ['json_encode_options' => JSON_NUMERIC_CHECK]; - $arr = array(); + $arr = []; $arr['foo'] = '3'; $expected = '{"foo":3}'; $this->assertEquals($expected, $this->serializer->serialize($arr, 'json', $context)); - $arr = array(); + $arr = []; $arr['foo'] = '3'; $expected = '{"foo":"3"}'; @@ -70,22 +70,22 @@ public function testOptions() */ public function testEncodeNotUtf8WithoutPartialOnError() { - $arr = array( + $arr = [ 'utf8' => 'Hello World!', 'notUtf8' => "\xb0\xd0\xb5\xd0", - ); + ]; $this->encoder->encode($arr, 'json'); } public function testEncodeNotUtf8WithPartialOnError() { - $context = array('json_encode_options' => JSON_PARTIAL_OUTPUT_ON_ERROR); + $context = ['json_encode_options' => JSON_PARTIAL_OUTPUT_ON_ERROR]; - $arr = array( + $arr = [ 'utf8' => 'Hello World!', 'notUtf8' => "\xb0\xd0\xb5\xd0", - ); + ]; $result = $this->encoder->encode($arr, 'json', $context); $jsonLastError = json_last_error(); @@ -112,8 +112,8 @@ protected function getObject() { $obj = new \stdClass(); $obj->foo = 'foo'; - $obj->bar = array('a', 'b'); - $obj->baz = array('key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => array(array('title' => 'title1'), array('title' => 'title2')), 'Barry' => array('FooBar' => array('Baz' => 'Ed', '@id' => 1))); + $obj->bar = ['a', 'b']; + $obj->baz = ['key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => [['title' => 'title1'], ['title' => 'title2']], 'Barry' => ['FooBar' => ['Baz' => 'Ed', '@id' => 1]]]; $obj->qux = '1'; return $obj; diff --git a/vendor/symfony/serializer/Tests/Encoder/XmlEncoderTest.php b/vendor/symfony/serializer/Tests/Encoder/XmlEncoderTest.php index e9b748e292b7b6f5393f8fb46c21f8b438cdab8d..7a6a7d3fbca19c27983cfbe59447f4ad11db26ea 100644 --- a/vendor/symfony/serializer/Tests/Encoder/XmlEncoderTest.php +++ b/vendor/symfony/serializer/Tests/Encoder/XmlEncoderTest.php @@ -32,7 +32,7 @@ class XmlEncoderTest extends TestCase protected function setUp() { $this->encoder = new XmlEncoder(); - $serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder())); + $serializer = new Serializer([new CustomNormalizer()], ['xml' => new XmlEncoder()]); $this->encoder->setSerializer($serializer); } @@ -71,19 +71,19 @@ public function testDocTypeIsNotAllowed() public function testAttributes() { $obj = new ScalarDummy(); - $obj->xmlFoo = array( - 'foo-bar' => array( + $obj->xmlFoo = [ + 'foo-bar' => [ '@id' => 1, '@name' => 'Bar', - ), - 'Foo' => array( + ], + 'Foo' => [ 'Bar' => 'Test', '@Type' => 'test', - ), + ], 'föo_bär' => 'a', - 'Bar' => array(1, 2, 3), + 'Bar' => [1, 2, 3], 'a' => 'b', - ); + ]; $expected = '<?xml version="1.0"?>'."\n". '<response>'. '<foo-bar id="1" name="Bar"/>'. @@ -100,11 +100,11 @@ public function testAttributes() public function testElementNameValid() { $obj = new ScalarDummy(); - $obj->xmlFoo = array( + $obj->xmlFoo = [ 'foo-bar' => 'a', 'foo_bar' => 'a', 'föo_bär' => 'a', - ); + ]; $expected = '<?xml version="1.0"?>'."\n". '<response>'. @@ -119,7 +119,7 @@ public function testElementNameValid() public function testEncodeSimpleXML() { $xml = simplexml_load_string('<firstname>Peter</firstname>'); - $array = array('person' => $xml); + $array = ['person' => $xml]; $expected = '<?xml version="1.0"?>'."\n". '<response><person><firstname>Peter</firstname></person></response>'."\n"; @@ -130,35 +130,35 @@ public function testEncodeSimpleXML() public function testEncodeXmlAttributes() { $xml = simplexml_load_string('<firstname>Peter</firstname>'); - $array = array('person' => $xml); + $array = ['person' => $xml]; $expected = '<?xml version="1.1" encoding="utf-8" standalone="yes"?>'."\n". '<response><person><firstname>Peter</firstname></person></response>'."\n"; - $context = array( + $context = [ 'xml_version' => '1.1', 'xml_encoding' => 'utf-8', 'xml_standalone' => true, - ); + ]; $this->assertSame($expected, $this->encoder->encode($array, 'xml', $context)); } public function testEncodeRemovingEmptyTags() { - $array = array('person' => array('firstname' => 'Peter', 'lastname' => null)); + $array = ['person' => ['firstname' => 'Peter', 'lastname' => null]]; $expected = '<?xml version="1.0"?>'."\n". '<response><person><firstname>Peter</firstname></person></response>'."\n"; - $context = array('remove_empty_tags' => true); + $context = ['remove_empty_tags' => true]; $this->assertSame($expected, $this->encoder->encode($array, 'xml', $context)); } public function testEncodeNotRemovingEmptyTags() { - $array = array('person' => array('firstname' => 'Peter', 'lastname' => null)); + $array = ['person' => ['firstname' => 'Peter', 'lastname' => null]]; $expected = '<?xml version="1.0"?>'."\n". '<response><person><firstname>Peter</firstname><lastname/></person></response>'."\n"; @@ -168,7 +168,7 @@ public function testEncodeNotRemovingEmptyTags() public function testContext() { - $array = array('person' => array('name' => 'George Abitbol')); + $array = ['person' => ['name' => 'George Abitbol']]; $expected = <<<'XML' <?xml version="1.0"?> <response> @@ -179,44 +179,44 @@ public function testContext() XML; - $context = array( + $context = [ 'xml_format_output' => true, - ); + ]; $this->assertSame($expected, $this->encoder->encode($array, 'xml', $context)); } public function testEncodeScalarRootAttributes() { - $array = array( - '#' => 'Paul', - '@gender' => 'm', - ); + $array = [ + '#' => 'Paul', + '@eye-color' => 'brown', + ]; $expected = '<?xml version="1.0"?>'."\n". - '<response gender="m">Paul</response>'."\n"; + '<response eye-color="brown">Paul</response>'."\n"; $this->assertEquals($expected, $this->encoder->encode($array, 'xml')); } public function testEncodeRootAttributes() { - $array = array( - 'firstname' => 'Paul', - '@gender' => 'm', - ); + $array = [ + 'firstname' => 'Paul', + '@eye-color' => 'brown', + ]; $expected = '<?xml version="1.0"?>'."\n". - '<response gender="m"><firstname>Paul</firstname></response>'."\n"; + '<response eye-color="brown"><firstname>Paul</firstname></response>'."\n"; $this->assertEquals($expected, $this->encoder->encode($array, 'xml')); } public function testEncodeCdataWrapping() { - $array = array( - 'firstname' => 'Paul <or Me>', - ); + $array = [ + 'firstname' => 'Paul <or Me>', + ]; $expected = '<?xml version="1.0"?>'."\n". '<response><firstname><![CDATA[Paul <or Me>]]></firstname></response>'."\n"; @@ -226,12 +226,12 @@ public function testEncodeCdataWrapping() public function testEncodeScalarWithAttribute() { - $array = array( - 'person' => array('@gender' => 'M', '#' => 'Peter'), - ); + $array = [ + 'person' => ['@eye-color' => 'brown', '#' => 'Peter'], + ]; $expected = '<?xml version="1.0"?>'."\n". - '<response><person gender="M">Peter</person></response>'."\n"; + '<response><person eye-color="brown">Peter</person></response>'."\n"; $this->assertEquals($expected, $this->encoder->encode($array, 'xml')); } @@ -251,7 +251,7 @@ public function testDecodeBigDigitAttributes() <document index="182077241760011681341821060401202210011000045913000000017100">Name</document> XML; - $this->assertSame(array('@index' => 182077241760011681341821060401202210011000045913000000017100, '#' => 'Name'), $this->encoder->decode($source, 'xml')); + $this->assertSame(['@index' => 182077241760011681341821060401202210011000045913000000017100, '#' => 'Name'], $this->encoder->decode($source, 'xml')); } public function testDecodeNegativeIntAttribute() @@ -261,7 +261,7 @@ public function testDecodeNegativeIntAttribute() <document index="-1234">Name</document> XML; - $this->assertSame(array('@index' => -1234, '#' => 'Name'), $this->encoder->decode($source, 'xml')); + $this->assertSame(['@index' => -1234, '#' => 'Name'], $this->encoder->decode($source, 'xml')); } public function testDecodeFloatAttribute() @@ -271,7 +271,7 @@ public function testDecodeFloatAttribute() <document index="-12.11">Name</document> XML; - $this->assertSame(array('@index' => -12.11, '#' => 'Name'), $this->encoder->decode($source, 'xml')); + $this->assertSame(['@index' => -12.11, '#' => 'Name'], $this->encoder->decode($source, 'xml')); } public function testDecodeNegativeFloatAttribute() @@ -281,7 +281,7 @@ public function testDecodeNegativeFloatAttribute() <document index="-12.11">Name</document> XML; - $this->assertSame(array('@index' => -12.11, '#' => 'Name'), $this->encoder->decode($source, 'xml')); + $this->assertSame(['@index' => -12.11, '#' => 'Name'], $this->encoder->decode($source, 'xml')); } public function testNoTypeCastAttribute() @@ -293,16 +293,16 @@ public function testNoTypeCastAttribute() </document> XML; - $data = $this->encoder->decode($source, 'xml', array('xml_type_cast_attributes' => false)); - $expected = array( + $data = $this->encoder->decode($source, 'xml', ['xml_type_cast_attributes' => false]); + $expected = [ '@a' => '018', '@b' => '-12.11', - 'node' => array( + 'node' => [ '@a' => '018', '@b' => '-12.11', '#' => '', - ), - ); + ], + ]; $this->assertSame($expected, $data); } @@ -324,17 +324,17 @@ public function testEncodeWithNamespace() public function testEncodeSerializerXmlRootNodeNameOption() { - $options = array('xml_root_node_name' => 'test'); + $options = ['xml_root_node_name' => 'test']; $this->encoder = new XmlEncoder(); - $serializer = new Serializer(array(), array('xml' => new XmlEncoder())); + $serializer = new Serializer([], ['xml' => new XmlEncoder()]); $this->encoder->setSerializer($serializer); - $array = array( - 'person' => array('@gender' => 'M', '#' => 'Peter'), - ); + $array = [ + 'person' => ['@eye-color' => 'brown', '#' => 'Peter'], + ]; $expected = '<?xml version="1.0"?>'."\n". - '<test><person gender="M">Peter</person></test>'."\n"; + '<test><person eye-color="brown">Peter</person></test>'."\n"; $this->assertEquals($expected, $serializer->serialize($array, 'xml', $options)); } @@ -342,7 +342,7 @@ public function testEncodeSerializerXmlRootNodeNameOption() public function testEncodeTraversableWhenNormalizable() { $this->encoder = new XmlEncoder(); - $serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder())); + $serializer = new Serializer([new CustomNormalizer()], ['xml' => new XmlEncoder()]); $this->encoder->setSerializer($serializer); $expected = <<<'XML' @@ -364,9 +364,9 @@ public function testDecode() public function testDecodeCdataWrapping() { - $expected = array( + $expected = [ 'firstname' => 'Paul <or Me>', - ); + ]; $xml = '<?xml version="1.0"?>'."\n". '<response><firstname><![CDATA[Paul <or Me>]]></firstname></response>'."\n"; @@ -376,9 +376,9 @@ public function testDecodeCdataWrapping() public function testDecodeCdataWrappingAndWhitespace() { - $expected = array( + $expected = [ 'firstname' => 'Paul <or Me>', - ); + ]; $xml = '<?xml version="1.0"?>'."\n". '<response><firstname>'."\n". @@ -398,11 +398,11 @@ public function testDecodeWithNamespace() public function testDecodeScalarWithAttribute() { $source = '<?xml version="1.0"?>'."\n". - '<response><person gender="M">Peter</person></response>'."\n"; + '<response><person eye-color="brown">Peter</person></response>'."\n"; - $expected = array( - 'person' => array('@gender' => 'M', '#' => 'Peter'), - ); + $expected = [ + 'person' => ['@eye-color' => 'brown', '#' => 'Peter'], + ]; $this->assertEquals($expected, $this->encoder->decode($source, 'xml')); } @@ -410,12 +410,12 @@ public function testDecodeScalarWithAttribute() public function testDecodeScalarRootAttributes() { $source = '<?xml version="1.0"?>'."\n". - '<person gender="M">Peter</person>'."\n"; + '<person eye-color="brown">Peter</person>'."\n"; - $expected = array( + $expected = [ '#' => 'Peter', - '@gender' => 'M', - ); + '@eye-color' => 'brown', + ]; $this->assertEquals($expected, $this->encoder->decode($source, 'xml')); } @@ -423,13 +423,13 @@ public function testDecodeScalarRootAttributes() public function testDecodeRootAttributes() { $source = '<?xml version="1.0"?>'."\n". - '<person gender="M"><firstname>Peter</firstname><lastname>Mac Calloway</lastname></person>'."\n"; + '<person eye-color="brown"><firstname>Peter</firstname><lastname>Mac Calloway</lastname></person>'."\n"; - $expected = array( + $expected = [ 'firstname' => 'Peter', 'lastname' => 'Mac Calloway', - '@gender' => 'M', - ); + '@eye-color' => 'brown', + ]; $this->assertEquals($expected, $this->encoder->decode($source, 'xml')); } @@ -444,12 +444,12 @@ public function testDecodeArray() '</people>'. '</response>'."\n"; - $expected = array( - 'people' => array('person' => array( - array('firstname' => 'Benjamin', 'lastname' => 'Alexandre'), - array('firstname' => 'Damien', 'lastname' => 'Clay'), - )), - ); + $expected = [ + 'people' => ['person' => [ + ['firstname' => 'Benjamin', 'lastname' => 'Alexandre'], + ['firstname' => 'Damien', 'lastname' => 'Clay'], + ]], + ]; $this->assertEquals($expected, $this->encoder->decode($source, 'xml')); } @@ -507,10 +507,10 @@ public function testDecodeIgnoreWhiteSpace() </person> </people> XML; - $expected = array('person' => array( - array('firstname' => 'Benjamin', 'lastname' => 'Alexandre'), - array('firstname' => 'Damien', 'lastname' => 'Clay'), - )); + $expected = ['person' => [ + ['firstname' => 'Benjamin', 'lastname' => 'Alexandre'], + ['firstname' => 'Damien', 'lastname' => 'Clay'], + ]]; $this->assertEquals($expected, $this->encoder->decode($source, 'xml')); } @@ -518,32 +518,32 @@ public function testDecodeIgnoreWhiteSpace() public function testDecodeWithoutItemHash() { $obj = new ScalarDummy(); - $obj->xmlFoo = array( - 'foo-bar' => array( + $obj->xmlFoo = [ + 'foo-bar' => [ '@key' => 'value', - 'item' => array('@key' => 'key', 'key-val' => 'val'), - ), - 'Foo' => array( + 'item' => ['@key' => 'key', 'key-val' => 'val'], + ], + 'Foo' => [ 'Bar' => 'Test', '@Type' => 'test', - ), + ], 'föo_bär' => 'a', - 'Bar' => array(1, 2, 3), + 'Bar' => [1, 2, 3], 'a' => 'b', - ); - $expected = array( - 'foo-bar' => array( + ]; + $expected = [ + 'foo-bar' => [ '@key' => 'value', - 'key' => array('@key' => 'key', 'key-val' => 'val'), - ), - 'Foo' => array( + 'key' => ['@key' => 'key', 'key-val' => 'val'], + ], + 'Foo' => [ 'Bar' => 'Test', '@Type' => 'test', - ), + ], 'föo_bär' => 'a', - 'Bar' => array(1, 2, 3), + 'Bar' => [1, 2, 3], 'a' => 'b', - ); + ]; $xml = $this->encoder->encode($obj, 'xml'); $this->assertEquals($expected, $this->encoder->decode($xml, 'xml')); } @@ -603,7 +603,7 @@ protected function getNamespacedXmlSource() protected function getNamespacedArray() { - return array( + return [ '@xmlns' => 'http://www.w3.org/2005/Atom', '@xmlns:app' => 'http://www.w3.org/2007/app', '@xmlns:media' => 'http://search.yahoo.com/mrss/', @@ -611,36 +611,36 @@ protected function getNamespacedArray() '@xmlns:yt' => 'http://gdata.youtube.com/schemas/2007', 'qux' => '1', 'app:foo' => 'foo', - 'yt:bar' => array('a', 'b'), - 'media:baz' => array( + 'yt:bar' => ['a', 'b'], + 'media:baz' => [ 'media:key' => 'val', 'media:key2' => 'val', 'A B' => 'bar', - 'item' => array( - array( + 'item' => [ + [ 'title' => 'title1', - ), - array( + ], + [ 'title' => 'title2', - ), - ), - 'Barry' => array( + ], + ], + 'Barry' => [ '@size' => 'large', - 'FooBar' => array( + 'FooBar' => [ 'Baz' => 'Ed', '@gd:id' => 1, - ), - ), - ), - ); + ], + ], + ], + ]; } protected function getObject() { $obj = new Dummy(); $obj->foo = 'foo'; - $obj->bar = array('a', 'b'); - $obj->baz = array('key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => array(array('title' => 'title1'), array('title' => 'title2')), 'Barry' => array('FooBar' => array('Baz' => 'Ed', '@id' => 1))); + $obj->bar = ['a', 'b']; + $obj->baz = ['key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => [['title' => 'title1'], ['title' => 'title2']], 'Barry' => ['FooBar' => ['Baz' => 'Ed', '@id' => 1]]]; $obj->qux = '1'; return $obj; @@ -654,7 +654,7 @@ public function testEncodeXmlWithBoolValue() XML; - $actualXml = $this->encoder->encode(array('foo' => true, 'bar' => false), 'xml'); + $actualXml = $this->encoder->encode(['foo' => true, 'bar' => false], 'xml'); $this->assertEquals($expectedXml, $actualXml); } @@ -663,7 +663,7 @@ public function testEncodeXmlWithDateTimeObjectValue() { $xmlEncoder = $this->createXmlEncoderWithDateTimeNormalizer(); - $actualXml = $xmlEncoder->encode(array('dateTime' => new \DateTime($this->exampleDateTimeString)), 'xml'); + $actualXml = $xmlEncoder->encode(['dateTime' => new \DateTime($this->exampleDateTimeString)], 'xml'); $this->assertEquals($this->createXmlWithDateTime(), $actualXml); } @@ -672,7 +672,7 @@ public function testEncodeXmlWithDateTimeObjectField() { $xmlEncoder = $this->createXmlEncoderWithDateTimeNormalizer(); - $actualXml = $xmlEncoder->encode(array('foo' => array('@dateTime' => new \DateTime($this->exampleDateTimeString))), 'xml'); + $actualXml = $xmlEncoder->encode(['foo' => ['@dateTime' => new \DateTime($this->exampleDateTimeString)]], 'xml'); $this->assertEquals($this->createXmlWithDateTimeField(), $actualXml); } @@ -683,7 +683,7 @@ public function testEncodeXmlWithDateTimeObjectField() private function createXmlEncoderWithDateTimeNormalizer() { $encoder = new XmlEncoder(); - $serializer = new Serializer(array($this->createMockDateTimeNormalizer()), array('xml' => new XmlEncoder())); + $serializer = new Serializer([$this->createMockDateTimeNormalizer()], ['xml' => new XmlEncoder()]); $encoder->setSerializer($serializer); return $encoder; @@ -699,7 +699,7 @@ private function createMockDateTimeNormalizer() $mock ->expects($this->once()) ->method('normalize') - ->with(new \DateTime($this->exampleDateTimeString), 'xml', array()) + ->with(new \DateTime($this->exampleDateTimeString), 'xml', []) ->willReturn($this->exampleDateTimeString); $mock diff --git a/vendor/symfony/serializer/Tests/Encoder/YamlEncoderTest.php b/vendor/symfony/serializer/Tests/Encoder/YamlEncoderTest.php index d08272df50482e6f0bb45ae51efb4136daa98271..9936ecb8bc8cc530018199d04670d99d1d93a7f7 100644 --- a/vendor/symfony/serializer/Tests/Encoder/YamlEncoderTest.php +++ b/vendor/symfony/serializer/Tests/Encoder/YamlEncoderTest.php @@ -27,7 +27,7 @@ public function testEncode() $encoder = new YamlEncoder(); $this->assertEquals('foo', $encoder->encode('foo', 'yaml')); - $this->assertEquals('{ foo: 1 }', $encoder->encode(array('foo' => 1), 'yaml')); + $this->assertEquals('{ foo: 1 }', $encoder->encode(['foo' => 1], 'yaml')); } public function testSupportsEncoding() @@ -43,7 +43,7 @@ public function testDecode() $encoder = new YamlEncoder(); $this->assertEquals('foo', $encoder->decode('foo', 'yaml')); - $this->assertEquals(array('foo' => 1), $encoder->decode('{ foo: 1 }', 'yaml')); + $this->assertEquals(['foo' => 1], $encoder->decode('{ foo: 1 }', 'yaml')); } public function testSupportsDecoding() @@ -56,16 +56,16 @@ public function testSupportsDecoding() public function testContext() { - $encoder = new YamlEncoder(new Dumper(), new Parser(), array('yaml_inline' => 1, 'yaml_indent' => 4, 'yaml_flags' => Yaml::DUMP_OBJECT | Yaml::PARSE_OBJECT)); + $encoder = new YamlEncoder(new Dumper(), new Parser(), ['yaml_inline' => 1, 'yaml_indent' => 4, 'yaml_flags' => Yaml::DUMP_OBJECT | Yaml::PARSE_OBJECT]); $obj = new \stdClass(); $obj->bar = 2; $legacyTag = " foo: !php/object:O:8:\"stdClass\":1:{s:3:\"bar\";i:2;}\n"; $spacedTag = " foo: !php/object 'O:8:\"stdClass\":1:{s:3:\"bar\";i:2;}'\n"; - $this->assertThat($encoder->encode(array('foo' => $obj), 'yaml'), $this->logicalOr($this->equalTo($legacyTag), $this->equalTo($spacedTag))); - $this->assertEquals(' { foo: null }', $encoder->encode(array('foo' => $obj), 'yaml', array('yaml_inline' => 0, 'yaml_indent' => 2, 'yaml_flags' => 0))); - $this->assertEquals(array('foo' => $obj), $encoder->decode("foo: !php/object 'O:8:\"stdClass\":1:{s:3:\"bar\";i:2;}'", 'yaml')); - $this->assertEquals(array('foo' => null), $encoder->decode("foo: !php/object 'O:8:\"stdClass\":1:{s:3:\"bar\";i:2;}'", 'yaml', array('yaml_flags' => 0))); + $this->assertThat($encoder->encode(['foo' => $obj], 'yaml'), $this->logicalOr($this->equalTo($legacyTag), $this->equalTo($spacedTag))); + $this->assertEquals(' { foo: null }', $encoder->encode(['foo' => $obj], 'yaml', ['yaml_inline' => 0, 'yaml_indent' => 2, 'yaml_flags' => 0])); + $this->assertEquals(['foo' => $obj], $encoder->decode("foo: !php/object 'O:8:\"stdClass\":1:{s:3:\"bar\";i:2;}'", 'yaml')); + $this->assertEquals(['foo' => null], $encoder->decode("foo: !php/object 'O:8:\"stdClass\":1:{s:3:\"bar\";i:2;}'", 'yaml', ['yaml_flags' => 0])); } } diff --git a/vendor/symfony/serializer/Tests/Fixtures/AbstractNormalizerDummy.php b/vendor/symfony/serializer/Tests/Fixtures/AbstractNormalizerDummy.php index 27b2f24f53fb1127dc277047433245ed1814d208..f576a241a487876af890008c6e682356aba88cfd 100644 --- a/vendor/symfony/serializer/Tests/Fixtures/AbstractNormalizerDummy.php +++ b/vendor/symfony/serializer/Tests/Fixtures/AbstractNormalizerDummy.php @@ -31,7 +31,7 @@ public function getAllowedAttributes($classOrObject, array $context, $attributes /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = array()) + public function normalize($object, $format = null, array $context = []) { } @@ -46,7 +46,7 @@ public function supportsNormalization($data, $format = null) /** * {@inheritdoc} */ - public function denormalize($data, $class, $format = null, array $context = array()) + public function denormalize($data, $class, $format = null, array $context = []) { } diff --git a/vendor/symfony/serializer/Tests/Fixtures/DenormalizableDummy.php b/vendor/symfony/serializer/Tests/Fixtures/DenormalizableDummy.php index d78f34a3cde71d95038d29d2ad1390d6284bb096..ded194ba80fcb1b8bed59b068f951939ca066f43 100644 --- a/vendor/symfony/serializer/Tests/Fixtures/DenormalizableDummy.php +++ b/vendor/symfony/serializer/Tests/Fixtures/DenormalizableDummy.php @@ -16,7 +16,7 @@ class DenormalizableDummy implements DenormalizableInterface { - public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array()) + public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []) { } } diff --git a/vendor/symfony/serializer/Tests/Fixtures/Dummy.php b/vendor/symfony/serializer/Tests/Fixtures/Dummy.php index 3f4582559e7a01661682d334d2953ce32cececa7..bb734ddc7e09bb3d69e5c548f5b232d9da9fba4a 100644 --- a/vendor/symfony/serializer/Tests/Fixtures/Dummy.php +++ b/vendor/symfony/serializer/Tests/Fixtures/Dummy.php @@ -23,17 +23,17 @@ class Dummy implements NormalizableInterface, DenormalizableInterface public $baz; public $qux; - public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array()) + public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []) { - return array( + return [ 'foo' => $this->foo, 'bar' => $this->bar, 'baz' => $this->baz, 'qux' => $this->qux, - ); + ]; } - public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array()) + public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []) { $this->foo = $data['foo']; $this->bar = $data['bar']; diff --git a/vendor/symfony/serializer/Tests/Fixtures/JsonSerializableDummy.php b/vendor/symfony/serializer/Tests/Fixtures/JsonSerializableDummy.php index 6d89890b8f4c64d16d5def8dd44f455d31c6131f..958200fdc74e7ef13b9a51b69e8a1bfe48b05cc7 100644 --- a/vendor/symfony/serializer/Tests/Fixtures/JsonSerializableDummy.php +++ b/vendor/symfony/serializer/Tests/Fixtures/JsonSerializableDummy.php @@ -15,11 +15,11 @@ class JsonSerializableDummy implements \JsonSerializable { public function jsonSerialize() { - return array( + return [ 'foo' => 'a', 'bar' => 'b', 'baz' => 'c', 'qux' => $this, - ); + ]; } } diff --git a/vendor/symfony/serializer/Tests/Fixtures/NormalizableTraversableDummy.php b/vendor/symfony/serializer/Tests/Fixtures/NormalizableTraversableDummy.php index a786fa1cc19229fc54d45a2bcceac573d4d3806c..2ce2adffd798a8e18ca988f2eb1b6616761036d0 100644 --- a/vendor/symfony/serializer/Tests/Fixtures/NormalizableTraversableDummy.php +++ b/vendor/symfony/serializer/Tests/Fixtures/NormalizableTraversableDummy.php @@ -18,19 +18,19 @@ class NormalizableTraversableDummy extends TraversableDummy implements NormalizableInterface, DenormalizableInterface { - public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array()) + public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []) { - return array( + return [ 'foo' => 'normalizedFoo', 'bar' => 'normalizedBar', - ); + ]; } - public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array()) + public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []) { - return array( + return [ 'foo' => 'denormalizedFoo', 'bar' => 'denormalizedBar', - ); + ]; } } diff --git a/vendor/symfony/serializer/Tests/Fixtures/ScalarDummy.php b/vendor/symfony/serializer/Tests/Fixtures/ScalarDummy.php index fb45e12c650ad8dbd7be0724417f6263e63dbb41..438a902e23e3f928f5a457e1e30ccd195fcff035 100644 --- a/vendor/symfony/serializer/Tests/Fixtures/ScalarDummy.php +++ b/vendor/symfony/serializer/Tests/Fixtures/ScalarDummy.php @@ -21,12 +21,12 @@ class ScalarDummy implements NormalizableInterface, DenormalizableInterface public $foo; public $xmlFoo; - public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array()) + public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []) { return 'xml' === $format ? $this->xmlFoo : $this->foo; } - public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array()) + public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []) { if ('xml' === $format) { $this->xmlFoo = $data; diff --git a/vendor/symfony/serializer/Tests/Mapping/AttributeMetadataTest.php b/vendor/symfony/serializer/Tests/Mapping/AttributeMetadataTest.php index 16ebcb1aac8dc02eef162d9bb74a2ae56c7ccd41..622a35ee6306ee68a885c8efacde60788ccdb1b9 100644 --- a/vendor/symfony/serializer/Tests/Mapping/AttributeMetadataTest.php +++ b/vendor/symfony/serializer/Tests/Mapping/AttributeMetadataTest.php @@ -38,7 +38,7 @@ public function testGroups() $attributeMetadata->addGroup('a'); $attributeMetadata->addGroup('b'); - $this->assertEquals(array('a', 'b'), $attributeMetadata->getGroups()); + $this->assertEquals(['a', 'b'], $attributeMetadata->getGroups()); } public function testMaxDepth() @@ -62,7 +62,7 @@ public function testMerge() $attributeMetadata1->merge($attributeMetadata2); - $this->assertEquals(array('a', 'b', 'c'), $attributeMetadata1->getGroups()); + $this->assertEquals(['a', 'b', 'c'], $attributeMetadata1->getGroups()); $this->assertEquals(2, $attributeMetadata1->getMaxDepth()); } diff --git a/vendor/symfony/serializer/Tests/Mapping/ClassMetadataTest.php b/vendor/symfony/serializer/Tests/Mapping/ClassMetadataTest.php index f2db1c51f6fcd50e3f6a0800abf9244269290430..636d8a8ab891fed6156232dd3bc33d3b65cf4d27 100644 --- a/vendor/symfony/serializer/Tests/Mapping/ClassMetadataTest.php +++ b/vendor/symfony/serializer/Tests/Mapping/ClassMetadataTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Serializer\Tests\Mapping; use PHPUnit\Framework\TestCase; +use Symfony\Component\Serializer\Mapping\AttributeMetadata; use Symfony\Component\Serializer\Mapping\ClassMetadata; /** @@ -29,16 +30,13 @@ public function testAttributeMetadata() { $classMetadata = new ClassMetadata('c'); - $a1 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock(); - $a1->method('getName')->willReturn('a1'); - - $a2 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock(); - $a2->method('getName')->willReturn('a2'); + $a1 = new AttributeMetadata('a1'); + $a2 = new AttributeMetadata('a2'); $classMetadata->addAttributeMetadata($a1); $classMetadata->addAttributeMetadata($a2); - $this->assertEquals(array('a1' => $a1, 'a2' => $a2), $classMetadata->getAttributesMetadata()); + $this->assertEquals(['a1' => $a1, 'a2' => $a2], $classMetadata->getAttributesMetadata()); } public function testMerge() @@ -46,33 +44,28 @@ public function testMerge() $classMetadata1 = new ClassMetadata('c1'); $classMetadata2 = new ClassMetadata('c2'); - $ac1 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock(); - $ac1->method('getName')->willReturn('a1'); - $ac1->method('getGroups')->willReturn(array('a', 'b')); - - $ac2 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock(); - $ac2->method('getName')->willReturn('a1'); - $ac2->method('getGroups')->willReturn(array('b', 'c')); + $ac1 = new AttributeMetadata('a1'); + $ac1->addGroup('a'); + $ac1->addGroup('b'); + $ac2 = new AttributeMetadata('a1'); + $ac2->addGroup('b'); + $ac2->addGroup('c'); $classMetadata1->addAttributeMetadata($ac1); $classMetadata2->addAttributeMetadata($ac2); $classMetadata1->merge($classMetadata2); - $ac1->method('getGroups')->willReturn('a', 'b', 'c'); - - $this->assertEquals(array('a1' => $ac1), $classMetadata2->getAttributesMetadata()); + $this->assertSame(['a', 'b', 'c'], $ac1->getGroups()); + $this->assertEquals(['a1' => $ac1], $classMetadata1->getAttributesMetadata()); } public function testSerialize() { $classMetadata = new ClassMetadata('a'); - $a1 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock(); - $a1->method('getName')->willReturn('b1'); - - $a2 = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface')->getMock(); - $a2->method('getName')->willReturn('b2'); + $a1 = new AttributeMetadata('b1'); + $a2 = new AttributeMetadata('b2'); $classMetadata->addAttributeMetadata($a1); $classMetadata->addAttributeMetadata($a2); diff --git a/vendor/symfony/serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php b/vendor/symfony/serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php index 903cc04d1f49fe8d572a7daf1785c40003e88b00..3d2aaa4c7ccdd02bd9f5282c5cb9700f69288909 100644 --- a/vendor/symfony/serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php +++ b/vendor/symfony/serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php @@ -25,7 +25,7 @@ class ClassMetadataFactoryTest extends TestCase { public function testInterface() { - $classMetadata = new ClassMetadataFactory(new LoaderChain(array())); + $classMetadata = new ClassMetadataFactory(new LoaderChain([])); $this->assertInstanceOf('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface', $classMetadata); } diff --git a/vendor/symfony/serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php b/vendor/symfony/serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php index b0dec5183976ae7f8167da737eefcd39b76eae98..4847004c972cd17a0949d961eb4a2b3ec4967e88 100644 --- a/vendor/symfony/serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php +++ b/vendor/symfony/serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php @@ -45,13 +45,13 @@ public function testDenormalize($underscored, $camelCased, $useLowerCamelCase) public function attributeProvider() { - return array( - array('coop_tilleuls', 'coopTilleuls', true), - array('_kevin_dunglas', '_kevinDunglas', true), - array('this_is_a_test', 'thisIsATest', true), - array('coop_tilleuls', 'CoopTilleuls', false), - array('_kevin_dunglas', '_kevinDunglas', false), - array('this_is_a_test', 'ThisIsATest', false), - ); + return [ + ['coop_tilleuls', 'coopTilleuls', true], + ['_kevin_dunglas', '_kevinDunglas', true], + ['this_is_a_test', 'thisIsATest', true], + ['coop_tilleuls', 'CoopTilleuls', false], + ['_kevin_dunglas', '_kevinDunglas', false], + ['this_is_a_test', 'ThisIsATest', false], + ]; } } diff --git a/vendor/symfony/serializer/Tests/Normalizer/AbstractNormalizerTest.php b/vendor/symfony/serializer/Tests/Normalizer/AbstractNormalizerTest.php index 28edc05872710aed8c84cd555f5492cb423e7258..890cb270193096573f8e6637e22bbb476e228f30 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/AbstractNormalizerTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/AbstractNormalizerTest.php @@ -33,8 +33,8 @@ class AbstractNormalizerTest extends TestCase protected function setUp() { - $loader = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Loader\LoaderChain')->setConstructorArgs(array(array()))->getMock(); - $this->classMetadata = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory')->setConstructorArgs(array($loader))->getMock(); + $loader = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Loader\LoaderChain')->setConstructorArgs([[]])->getMock(); + $this->classMetadata = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory')->setConstructorArgs([$loader])->getMock(); $this->normalizer = new AbstractNormalizerDummy($this->classMetadata); } @@ -60,11 +60,11 @@ public function testGetAllowedAttributesAsString() $this->classMetadata->method('getMetadataFor')->willReturn($classMetadata); - $result = $this->normalizer->getAllowedAttributes('c', array(AbstractNormalizer::GROUPS => array('test')), true); - $this->assertEquals(array('a2', 'a4'), $result); + $result = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS => ['test']], true); + $this->assertEquals(['a2', 'a4'], $result); - $result = $this->normalizer->getAllowedAttributes('c', array(AbstractNormalizer::GROUPS => array('other')), true); - $this->assertEquals(array('a3', 'a4'), $result); + $result = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS => ['other']], true); + $this->assertEquals(['a3', 'a4'], $result); } public function testGetAllowedAttributesAsObjects() @@ -89,21 +89,21 @@ public function testGetAllowedAttributesAsObjects() $this->classMetadata->method('getMetadataFor')->willReturn($classMetadata); - $result = $this->normalizer->getAllowedAttributes('c', array(AbstractNormalizer::GROUPS => array('test')), false); - $this->assertEquals(array($a2, $a4), $result); + $result = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS => ['test']], false); + $this->assertEquals([$a2, $a4], $result); - $result = $this->normalizer->getAllowedAttributes('c', array(AbstractNormalizer::GROUPS => array('other')), false); - $this->assertEquals(array($a3, $a4), $result); + $result = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS => ['other']], false); + $this->assertEquals([$a3, $a4], $result); } public function testObjectToPopulateWithProxy() { $proxyDummy = new ProxyDummy(); - $context = array(AbstractNormalizer::OBJECT_TO_POPULATE => $proxyDummy); + $context = [AbstractNormalizer::OBJECT_TO_POPULATE => $proxyDummy]; $normalizer = new ObjectNormalizer(); - $normalizer->denormalize(array('foo' => 'bar'), 'Symfony\Component\Serializer\Tests\Fixtures\ToBeProxyfiedDummy', null, $context); + $normalizer->denormalize(['foo' => 'bar'], 'Symfony\Component\Serializer\Tests\Fixtures\ToBeProxyfiedDummy', null, $context); $this->assertSame('bar', $proxyDummy->getFoo()); } @@ -111,7 +111,7 @@ public function testObjectToPopulateWithProxy() public function testObjectWithStaticConstructor() { $normalizer = new StaticConstructorNormalizer(); - $dummy = $normalizer->denormalize(array('foo' => 'baz'), StaticConstructorDummy::class); + $dummy = $normalizer->denormalize(['foo' => 'baz'], StaticConstructorDummy::class); $this->assertInstanceOf(StaticConstructorDummy::class, $dummy); $this->assertEquals('baz', $dummy->quz); @@ -124,7 +124,7 @@ public function testObjectWithStaticConstructor() public function testObjectWithNullableConstructorArgument() { $normalizer = new ObjectNormalizer(); - $dummy = $normalizer->denormalize(array('foo' => null), NullableConstructorArgumentDummy::class); + $dummy = $normalizer->denormalize(['foo' => null], NullableConstructorArgumentDummy::class); $this->assertNull($dummy->getFoo()); } diff --git a/vendor/symfony/serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/vendor/symfony/serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php index 73ccf6891dec02658027b79f74810c2ab0987817..6155cc3ea0f3e40315fe2bddae301e5e0688a582 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -29,7 +29,7 @@ class AbstractObjectNormalizerTest extends TestCase public function testDenormalize() { $normalizer = new AbstractObjectNormalizerDummy(); - $normalizedData = $normalizer->denormalize(array('foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'), __NAMESPACE__.'\Dummy'); + $normalizedData = $normalizer->denormalize(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'], __NAMESPACE__.'\Dummy'); $this->assertSame('foo', $normalizedData->foo); $this->assertNull($normalizedData->bar); @@ -38,13 +38,13 @@ public function testDenormalize() public function testInstantiateObjectDenormalizer() { - $data = array('foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'); + $data = ['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz']; $class = __NAMESPACE__.'\Dummy'; - $context = array(); + $context = []; $normalizer = new AbstractObjectNormalizerDummy(); - $this->assertInstanceOf(__NAMESPACE__.'\Dummy', $normalizer->instantiateObject($data, $class, $context, new \ReflectionClass($class), array())); + $this->assertInstanceOf(__NAMESPACE__.'\Dummy', $normalizer->instantiateObject($data, $class, $context, new \ReflectionClass($class), [])); } /** @@ -56,10 +56,10 @@ public function testDenormalizeWithExtraAttributes() $factory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); $normalizer = new AbstractObjectNormalizerDummy($factory); $normalizer->denormalize( - array('fooFoo' => 'foo', 'fooBar' => 'bar'), + ['fooFoo' => 'foo', 'fooBar' => 'bar'], __NAMESPACE__.'\Dummy', 'any', - array('allow_extra_attributes' => false) + ['allow_extra_attributes' => false] ); } @@ -71,10 +71,10 @@ public function testDenormalizeWithExtraAttributesAndNoGroupsWithMetadataFactory { $normalizer = new AbstractObjectNormalizerWithMetadata(); $normalizer->denormalize( - array('fooFoo' => 'foo', 'fooBar' => 'bar', 'bar' => 'bar'), + ['fooFoo' => 'foo', 'fooBar' => 'bar', 'bar' => 'bar'], Dummy::class, 'any', - array('allow_extra_attributes' => false) + ['allow_extra_attributes' => false] ); } @@ -83,11 +83,11 @@ public function testDenormalizeCollectionDecodedFromXmlWithOneChild() $denormalizer = $this->getDenormalizerForDummyCollection(); $dummyCollection = $denormalizer->denormalize( - array( - 'children' => array( + [ + 'children' => [ 'bar' => 'first', - ), - ), + ], + ], DummyCollection::class, 'xml' ); @@ -103,12 +103,12 @@ public function testDenormalizeCollectionDecodedFromXmlWithTwoChildren() $denormalizer = $this->getDenormalizerForDummyCollection(); $dummyCollection = $denormalizer->denormalize( - array( - 'children' => array( - array('bar' => 'first'), - array('bar' => 'second'), - ), - ), + [ + 'children' => [ + ['bar' => 'first'], + ['bar' => 'second'], + ], + ], DummyCollection::class, 'xml' ); @@ -125,7 +125,7 @@ private function getDenormalizerForDummyCollection() $extractor = $this->getMockBuilder(PhpDocExtractor::class)->getMock(); $extractor->method('getTypes') ->will($this->onConsecutiveCalls( - array( + [ new Type( 'array', false, @@ -134,13 +134,13 @@ private function getDenormalizerForDummyCollection() new Type('int'), new Type('object', false, DummyChild::class) ), - ), + ], null )); $denormalizer = new AbstractObjectNormalizerCollectionDummy(null, null, $extractor); $arrayDenormalizer = new ArrayDenormalizerDummy(); - $serializer = new SerializerCollectionDummy(array($arrayDenormalizer, $denormalizer)); + $serializer = new SerializerCollectionDummy([$arrayDenormalizer, $denormalizer]); $arrayDenormalizer->setSerializer($serializer); $denormalizer->setSerializer($serializer); @@ -157,30 +157,30 @@ public function testExtraAttributesException() { $normalizer = new ObjectNormalizer(); - $normalizer->denormalize(array(), \stdClass::class, 'xml', array( + $normalizer->denormalize([], \stdClass::class, 'xml', [ 'allow_extra_attributes' => false, - )); + ]); } } class AbstractObjectNormalizerDummy extends AbstractObjectNormalizer { - protected function extractAttributes($object, $format = null, array $context = array()) + protected function extractAttributes($object, $format = null, array $context = []) { } - protected function getAttributeValue($object, $attribute, $format = null, array $context = array()) + protected function getAttributeValue($object, $attribute, $format = null, array $context = []) { } - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = array()) + protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) { $object->$attribute = $value; } - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = array()) + protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) { - return \in_array($attribute, array('foo', 'baz')); + return \in_array($attribute, ['foo', 'baz']); } public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, $format = null) @@ -203,15 +203,15 @@ public function __construct() parent::__construct(new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()))); } - protected function extractAttributes($object, $format = null, array $context = array()) + protected function extractAttributes($object, $format = null, array $context = []) { } - protected function getAttributeValue($object, $attribute, $format = null, array $context = array()) + protected function getAttributeValue($object, $attribute, $format = null, array $context = []) { } - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = array()) + protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) { $object->$attribute = $value; } @@ -240,15 +240,15 @@ public function __construct($normalizers) $this->normalizers = $normalizers; } - public function serialize($data, $format, array $context = array()) + public function serialize($data, $format, array $context = []) { } - public function deserialize($data, $type, $format, array $context = array()) + public function deserialize($data, $type, $format, array $context = []) { } - public function denormalize($data, $type, $format = null, array $context = array()) + public function denormalize($data, $type, $format = null, array $context = []) { foreach ($this->normalizers as $normalizer) { if ($normalizer instanceof DenormalizerInterface && $normalizer->supportsDenormalization($data, $type, $format, $context)) { @@ -265,20 +265,20 @@ public function supportsDenormalization($data, $type, $format = null) class AbstractObjectNormalizerCollectionDummy extends AbstractObjectNormalizer { - protected function extractAttributes($object, $format = null, array $context = array()) + protected function extractAttributes($object, $format = null, array $context = []) { } - protected function getAttributeValue($object, $attribute, $format = null, array $context = array()) + protected function getAttributeValue($object, $attribute, $format = null, array $context = []) { } - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = array()) + protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) { $object->$attribute = $value; } - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = array()) + protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) { return true; } @@ -288,11 +288,11 @@ public function instantiateObject(array &$data, $class, array &$context, \Reflec return parent::instantiateObject($data, $class, $context, $reflectionClass, $allowedAttributes, $format); } - public function serialize($data, $format, array $context = array()) + public function serialize($data, $format, array $context = []) { } - public function deserialize($data, $type, $format, array $context = array()) + public function deserialize($data, $type, $format, array $context = []) { } } @@ -309,7 +309,7 @@ class ArrayDenormalizerDummy implements DenormalizerInterface, SerializerAwareIn * * @throws NotNormalizableValueException */ - public function denormalize($data, $class, $format = null, array $context = array()) + public function denormalize($data, $class, $format = null, array $context = []) { $serializer = $this->serializer; $class = substr($class, 0, -2); @@ -324,7 +324,7 @@ public function denormalize($data, $class, $format = null, array $context = arra /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null, array $context = array()) + public function supportsDenormalization($data, $type, $format = null, array $context = []) { return '[]' === substr($type, -2) && $this->serializer->supportsDenormalization($data, substr($type, 0, -2), $format, $context); diff --git a/vendor/symfony/serializer/Tests/Normalizer/ArrayDenormalizerTest.php b/vendor/symfony/serializer/Tests/Normalizer/ArrayDenormalizerTest.php index e5876a04e1e56e192fd9c3122299f1829ba90ade..fd456cb9dd4d863eb4fa70bde050e082091652ff 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/ArrayDenormalizerTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/ArrayDenormalizerTest.php @@ -38,27 +38,27 @@ public function testDenormalize() { $this->serializer->expects($this->at(0)) ->method('denormalize') - ->with(array('foo' => 'one', 'bar' => 'two')) + ->with(['foo' => 'one', 'bar' => 'two']) ->will($this->returnValue(new ArrayDummy('one', 'two'))); $this->serializer->expects($this->at(1)) ->method('denormalize') - ->with(array('foo' => 'three', 'bar' => 'four')) + ->with(['foo' => 'three', 'bar' => 'four']) ->will($this->returnValue(new ArrayDummy('three', 'four'))); $result = $this->denormalizer->denormalize( - array( - array('foo' => 'one', 'bar' => 'two'), - array('foo' => 'three', 'bar' => 'four'), - ), + [ + ['foo' => 'one', 'bar' => 'two'], + ['foo' => 'three', 'bar' => 'four'], + ], __NAMESPACE__.'\ArrayDummy[]' ); $this->assertEquals( - array( + [ new ArrayDummy('one', 'two'), new ArrayDummy('three', 'four'), - ), + ], $result ); } @@ -72,10 +72,10 @@ public function testSupportsValidArray() $this->assertTrue( $this->denormalizer->supportsDenormalization( - array( - array('foo' => 'one', 'bar' => 'two'), - array('foo' => 'three', 'bar' => 'four'), - ), + [ + ['foo' => 'one', 'bar' => 'two'], + ['foo' => 'three', 'bar' => 'four'], + ], __NAMESPACE__.'\ArrayDummy[]' ) ); @@ -89,10 +89,10 @@ public function testSupportsInvalidArray() $this->assertFalse( $this->denormalizer->supportsDenormalization( - array( - array('foo' => 'one', 'bar' => 'two'), - array('foo' => 'three', 'bar' => 'four'), - ), + [ + ['foo' => 'one', 'bar' => 'two'], + ['foo' => 'three', 'bar' => 'four'], + ], __NAMESPACE__.'\InvalidClass[]' ) ); @@ -102,7 +102,7 @@ public function testSupportsNoArray() { $this->assertFalse( $this->denormalizer->supportsDenormalization( - array('foo' => 'one', 'bar' => 'two'), + ['foo' => 'one', 'bar' => 'two'], __NAMESPACE__.'\ArrayDummy' ) ); diff --git a/vendor/symfony/serializer/Tests/Normalizer/CustomNormalizerTest.php b/vendor/symfony/serializer/Tests/Normalizer/CustomNormalizerTest.php index 55378c773a557eec551c8e7a60d1d531a9d53915..28fb73ece5bcd62298c02ba39ae54db08dc60519 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/CustomNormalizerTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/CustomNormalizerTest.php @@ -59,9 +59,9 @@ public function testDeserialize() public function testDenormalizeWithObjectToPopulateUsesProvidedObject() { $expected = new ScalarDummy(); - $obj = $this->normalizer->denormalize('foo', ScalarDummy::class, 'json', array( + $obj = $this->normalizer->denormalize('foo', ScalarDummy::class, 'json', [ 'object_to_populate' => $expected, - )); + ]); $this->assertSame($expected, $obj); $this->assertEquals('foo', $obj->foo); @@ -76,8 +76,8 @@ public function testSupportsNormalization() public function testSupportsDenormalization() { - $this->assertTrue($this->normalizer->supportsDenormalization(array(), 'Symfony\Component\Serializer\Tests\Fixtures\ScalarDummy')); - $this->assertFalse($this->normalizer->supportsDenormalization(array(), 'stdClass')); - $this->assertTrue($this->normalizer->supportsDenormalization(array(), 'Symfony\Component\Serializer\Tests\Fixtures\DenormalizableDummy')); + $this->assertTrue($this->normalizer->supportsDenormalization([], 'Symfony\Component\Serializer\Tests\Fixtures\ScalarDummy')); + $this->assertFalse($this->normalizer->supportsDenormalization([], 'stdClass')); + $this->assertTrue($this->normalizer->supportsDenormalization([], 'Symfony\Component\Serializer\Tests\Fixtures\DenormalizableDummy')); } } diff --git a/vendor/symfony/serializer/Tests/Normalizer/DataUriNormalizerTest.php b/vendor/symfony/serializer/Tests/Normalizer/DataUriNormalizerTest.php index d3ad2af8363538e71a3bdf134f322c2211e32bda..e1f714b55c1e9c40e4d3b086ee43c537d19f64a8 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/DataUriNormalizerTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/DataUriNormalizerTest.php @@ -131,19 +131,19 @@ public function testInvalidData($uri) public function invalidUriProvider() { - return array( - array('dataxbase64'), - array('data:HelloWorld'), - array('data:text/html;charset=,%3Ch1%3EHello!%3C%2Fh1%3E'), - array('data:text/html;charset,%3Ch1%3EHello!%3C%2Fh1%3E'), - array('data:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC'), - array(''), - array('http://wikipedia.org'), - array('base64'), - array('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC'), - array(' data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC'), - array(' data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC'), - ); + return [ + ['dataxbase64'], + ['data:HelloWorld'], + ['data:text/html;charset=,%3Ch1%3EHello!%3C%2Fh1%3E'], + ['data:text/html;charset,%3Ch1%3EHello!%3C%2Fh1%3E'], + ['data:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC'], + [''], + ['http://wikipedia.org'], + ['base64'], + ['iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC'], + [' data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC'], + [' data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC'], + ]; } /** @@ -156,22 +156,22 @@ public function testValidData($uri) public function validUriProvider() { - $data = array( - array('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC'), - array('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC'), - array('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC '), - array('data:,Hello%2C%20World!'), - array('data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E'), - array('data:,A%20brief%20note'), - array('data:text/html;charset=US-ASCII,%3Ch1%3EHello!%3C%2Fh1%3E'), - array('data:application/ld+json;base64,eyJAaWQiOiAiL2ZvbyJ9'), - array('data:application/vnd.ms-word.document.macroenabled.12;base64,UEsDBBQABgAIAAAAIQBnzQ+udAEAADoFAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC0lMtOwzAQRfdI/EPkLUrcskAINe0CyhIqUT7AtSepIX7Idl9/zzhpI1TRBFG6iZTM3HvPOJmMJltVJWtwXhqdk2E2IAloboTUZU7e58/pPUl8YFqwymjIyQ48mYyvr0bznQWfoFr7nCxDsA+Uer4ExXxmLGisFMYpFvDWldQy/slKoLeDwR3lRgfQIQ3Rg4xHT1CwVRWS6RYfNyQoJ8lj0xejcsKsrSRnAcs0VumPOgeV7xCutTiiS/dkGSrrHr+U1t+cTviwUB4lSBVHqwuoecXjdFJAMmMuvDCFDXRjnKDC8JVCUdY9XGRUPo2SrJUoxp2ZaraoAKtM6gPhyTQfdhX4X2QdnYcpCsmhDY5e1hkO3uM3oaqs8e2PhxBQcAmAvXMvwgYWbxej+GbeC1Jg7jy+uv/HaK17IQLuJjTX4dkctU1XJHbOnLEed939YezDUkZ1igNbcEF2f3VtIlqfPR/EfRcgfsim9Z9v/AUAAP//AwBQSwMEFAAGAAgAAAAhAMfCJ7z/AAAA3wIAAAsACAJfcmVscy8ucmVscyCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsks1KAzEQgO+C7xDm3s22iog024sIvYmsDzAm093o5odkqu3bG0XUhWUR7HH+Pr5JZr05uEG8Uso2eAXLqgZBXgdjfafgsb1bXIPIjN7gEDwpOFKGTXN+tn6gAbkM5d7GLArFZwU9c7yRMuueHOYqRPKlsgvJIZcwdTKifsGO5Kqur2T6zYBmxBRboyBtzQWI9hjpf2zpiNEgo9Qh0SKmMp3Yll1Ei6kjVmCCvi/p/NlRFTLIaaHLvwuF3c5qug1678jzlBcdmLwhM6+EMc4ZLU9pNO74kXkLyUjzlZ6zWZ32w7jfuyePdph4l+9a9Ryp+xCSo7Ns3gEAAP//AwBQSwMEFAAGAAgAAAAhABOqPof2AAAAMQMAABwACAF3b3JkL19yZWxzL2RvY3VtZW50LnhtbC5yZWxzIKIEASigAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArJLLasMwEEX3hf6DmH0tO31QQuRsSiHb1v0ARR4/qCwJzfThv69oSOvQYLrw8l4x955Bs9l+Dla8Y6TeOwVFloNAZ3zdu1bBS/V4dQ+CWLtaW+9QwYgE2/LyYvOEVnMaoq4PJFKKIwUdc1hLSabDQVPmA7r00vg4aE4ytjJo86pblKs8v5NxmgHlSabY1Qrirr4GUY0B/5Ptm6Y3+ODN24COz1TID9w/I3NajlKsji2ygomZpUSQ50FulgRpvONK7y3+YvxYcxC3S0Jwmp0AfMuDWcwxFEsyEI8WJ59x0HP1q0Xr/1zD0TkiyJNDL78AAAD//wMAUEsDBBQABgAIAAAAIQAz6gHKYAIAAAIHAAARAAAAd29yZC9kb2N1bWVudC54bWykld1u2jAUx+8n7R2Q70sSCpRGQKVBh9A0qRrb9WQcJ7GIfSzbQLs32nPsxXacL7JNQ7QgFPt8+Of/sWNn+vAsi96BGytAzUjUD0mPKwaJUNmMfPv68WZCetZRldACFJ+RF27Jw/z9u+kxToDtJVeuhwhl46NmM5I7p+MgsCznktq+FMyAhdT1GcgA0lQwHhzBJMEgjMKypw0wbi3Ot6DqQC2pcRIuo0nKmu4gDCdoC9Uy/lUEmisMpmAkdWiaDEeY3V7fIFNTJ7aiEO7Fs8Yt5jAje6PimnHT6vBjYhQQH2TRJMO53Epo3TQjzCUiqyHLeslLeYHhBQoGZXOhT+v2VhoG8wZytuBOsUcdDa/b9KWhR2xOwEvkJ9UgWVTKzxOj8IId8Yh2xCUS/pyzUdJ9+Y5vW5rO4kaj1wEGfwN0dt3mrAzs9YkmrqOt1a5l+avkFax6k7ul2evEbHKq8QRKFq8zBYZuC1SEW9bDVe/515rM8YrbQvLiW43uYaypoetkRsLB8hb/Q1J6HX923ntX/9Ab43WafMHEcHQXLUaD1rXkKd0Xzkduw9FitChnMf7h5p9+/TwINQ183z9L9xZg5y+ojaPGIUb4+T1PUYmKv6/gA2U7EnRzH1XSZgYlSvuw5cw9mf+r22Dcex+j0eQ+LJXpbPMDo3gioug+LOfNsT+eDEuyT/hMPdIBHtxoGFXViyx3J3MLzoE82QVPO9Gc04TjFXgXTryZAriOme1dadbTMSgseq2mjFc5pRu/RCsjfNGFUPxJOIYqb8dN9VXhZbfa0OD08Zr/BgAA//8DAFBLAwQUAAYACAAAACEAJyDgAjMGAACMGgAAFQAAAHdvcmQvdGhlbWUvdGhlbWUxLnhtbOxZTYvbRhi+F/ofhO6OZVvyxxJvsGU7abObhOwmJcexNJYmO9KYmdHumhAoybFQKE1LDw301kJpG0igl/TUn7JtSptC/kJHI8uesccsaTawhNhgzcfzvvPM+848I1kXLx0n2DqElCGSdu3aBce2YBqQEKVR1761P6q0bYtxkIYAkxR27Rlk9qXtDz+4CLZ4DBNoCfuUbYGuHXM+3apWWSCaAbtApjAVfRNCE8BFlUbVkIIj4TfB1brjNKsJQKltpSARbvfj338Qzq5PJiiA9nbpfYjFT8pZ3hBgupf7hnOTfkYhyCQ2PKjlFzZjPqbWIcBdWwwUkqN9eMxtCwPGRUfXduTHrm5frC6MMN9gq9iN5GduNzcID+rSjkbjhaHrem6zt/AvAZiv44atYXPYXPiTABAEYqYFFxXr9Tv9gTfHKqCiaPA9aA0aNQ2v+G+s4Xte/tXwElQU3TX8aOQvY6iAiqJniEmr7rsaXoKKYnMN33J6A7el4SUoxig9WEM7XrPhl7NdQCYEXzHCO547atXn8CWqqqyuwj7lm9ZaAu4SOhIAmVzAUWrx2RROQCBwPsBoTJG1g6JYLLwpSAkTzU7dGTkN8Zt/XVmSEQFbECjWRVPA1ppyPhYLKJryrv2x8GorkFfPf3r1/Kl18uDZyYNfTx4+PHnwi8HqCkgj1erl91/8+/hT65+n37189JUZz1T8nz9/9sdvX5qBXAW++PrJX8+evPjm879/fGSA9ygYq/B9lEBmXYNH1k2SiIkZBoBj+noW+zFAqkUvjRhIQW5jQA95rKGvzQAGBlwf6hG8TYVMmICXs7sa4b2YZhwZgFfjRAPuEoL7hBrndDUfS41ClkbmwWmm4m4CcGga21/J7zCbivWOTC79GGo0b2CRchDBFHIr7yMHEBrM7iCkxXUXBZQwMuHWHWT1ATKGZB+NtdW0NLqCEpGXmYmgyLcWm93bVp9gk/sBPNSRYlcAbHIJsRbGyyDjIDEyBglWkTuAxyaSezMaaAFnXGQ6gphYwxAyZrK5Tmca3atCXsxp38WzREdSjg5MyB1AiIockAM/BsnUyBmlsYr9iB2IJQqsG4QbSRB9h+R1kQeQbkz3bQS1dJ++t28JZTUvkLwno6YtAYm+H2d4AqB0Xl3R8wSlp4r7iqx7b1fWhZC++PaxWXfPpaD3KDLuqFUZ34RbFW+f0BCdf+0egCy9AcV2MUDfS/d76X7npXvTfj57wV5qtLyJL2/VpZtk4337BGG8x2cY7jCp7kxMLxyJRlmRRovHhGksivPhNFxEgSxblPBPEI/3YjAVw9TkCBGbu46YNSVMnA+y2eg778BZskvCorVWK59MhQHgy3ZxvpTt4jTiRWuztXwEW7iXtUg+KpcEctvXIaEMppNoGEi0ysZTSMiZnQmLjoFFO3e/kYW8zLMi9p8F8n81PLdgJNYbwDDM81TYl9k980xvCqY+7bphep2c69lkWiOhLDedhLIMYxDC1eYzznVnmVKNXh6KdRqt9tvIdS4iK9qAU71mHYk91/CEmwBMu/ZE3BmKYjIV/liumwBHadcO+DzQ/0dZppTxAWBxAZNdxfwTxCG1MErEWlfTgNMlt1q9lc/xnJLrOOcvcvKiJhlOJjDgG1qWVdFXODH2viE4r5BMkN6LwyNrjDN6E4hAea1aHsAQMb6IZoiosriXUVyRq/lW1P4xW25RgKcxmJ8oqpgXcFle0FHmIZmuzkqvzyczjvIkvfGpe7pR3qGI5oYDJD81zfrx9g55hdVS9zVWhXSval2n1LpNp8SbHwgKteVgGrWcsYHaslWndoY3BMpwi6W56Yw469NgddXmB0R5Xylra68myPiuWPkDcbuaYc4kVXgsnhH88k/lQglka6kux9zKKOra9xyv5/p1z684bW9YcRuuU2l7vUal53mN2tCrOYN+/b4ICo+TmleMPRLPM3g2f/Ui29devyTlbfaFgCRVIt+rVKWxfP1Sq2uvX4r3LtZ+3m9bSETmXrM+6jQ6/Wal0+iNKu6g3650/Ga/Mmj6rcFo4Hvtzui+bR1KsNtr+G5z2K40a75fcZtOTr/dqbTcer3ntnrtodu7P4+1mHl5LcMreW3/BwAA//8DAFBLAwQKAAAAAAAAACEAahPYDYwlAACMJQAAFwAAAGRvY1Byb3BzL3RodW1ibmFpbC5qcGVn/9j/4AAQSkZJRgABAQAASABIAAD/4QCARXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAIdpAAQAAAABAAAATgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAWmgAwAEAAAAAQAAAgAAAAAA/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIAgABaQMBEQACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/3QAEAC7/2gAMAwEAAhEDEQA/AP7Yfgx8GPg9N8HvhRLL8KPhrLLL8NfAskkkngTws8kkj+F9LZ3d200s7uxLMzHczEk5JNAHpX/ClPg3/wBEl+GX/hBeFf8A5W0AH/ClPg3/ANEl+GX/AIQXhX/5W0AH/ClPg3/0SX4Zf+EF4V/+VtAB/wAKU+Df/RJfhl/4QXhX/wCVtAB/wpT4N/8ARJfhl/4QXhX/AOVtAB/wpT4N/wDRJfhl/wCEF4V/+VtAB/wpT4N/9El+GX/hBeFf/lbQAf8AClPg3/0SX4Zf+EF4V/8AlbQAf8KU+Df/AESX4Zf+EF4V/wDlbQAf8KU+Df8A0SX4Zf8AhBeFf/lbQAf8KU+Df/RJfhl/4QXhX/5W0AH/AApT4N/9El+GX/hBeFf/AJW0AH/ClPg3/wBEl+GX/hBeFf8A5W0AH/ClPg3/ANEl+GX/AIQXhX/5W0AH/ClPg3/0SX4Zf+EF4V/+VtAB/wAKU+Df/RJfhl/4QXhX/wCVtAB/wpT4N/8ARJfhl/4QXhX/AOVtAB/wpT4N/wDRJfhl/wCEF4V/+VtAB/wpT4N/9El+GX/hBeFf/lbQAf8AClPg3/0SX4Zf+EF4V/8AlbQAf8KU+Df/AESX4Zf+EF4V/wDlbQAf8KU+Df8A0SX4Zf8AhBeFf/lbQAf8KU+Df/RJfhl/4QXhX/5W0AH/AApT4N/9El+GX/hBeFf/AJW0AH/ClPg3/wBEl+GX/hBeFf8A5W0AH/ClPg3/ANEl+GX/AIQXhX/5W0AH/ClPg3/0SX4Zf+EF4V/+VtAB/wAKU+Df/RJfhl/4QXhX/wCVtAB/wpT4N/8ARJfhl/4QXhX/AOVtAB/wpT4N/wDRJfhl/wCEF4V/+VtAB/wpT4N/9El+GX/hBeFf/lbQAf8AClPg3/0SX4Zf+EF4V/8AlbQAf8KU+Df/AESX4Zf+EF4V/wDlbQAf8KU+Df8A0SX4Zf8AhBeFf/lbQAf8KU+Df/RJfhl/4QXhX/5W0AH/AApT4N/9El+GX/hBeFf/AJW0AH/ClPg3/wBEl+GX/hBeFf8A5W0AH/ClPg3/ANEl+GX/AIQXhX/5W0AH/ClPg3/0SX4Zf+EF4V/+VtAB/wAKU+Df/RJfhl/4QXhX/wCVtAB/wpT4N/8ARJfhl/4QXhX/AOVtAB/wpT4N/wDRJfhl/wCEF4V/+VtAB/wpT4N/9El+GX/hBeFf/lbQAf8AClPg3/0SX4Zf+EF4V/8AlbQB/Nd/wrT4c/8ARP8AwT/4Sug//INAH//Q/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9H+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/T/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9T+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAfP3j79pv4T/DT4n6P8IvFmr3Vj4w1jwRqvxN2GC3TSNH+G3hs6v/AMJj8QPEmsXV5a2Xh3wZ4JTSB/wlPiPVnttK0+81vwpokdxc+IPFfh/SdQAMPQ/2v/gXr2heH9WtvFlrZ6n4g8X6B4Gi8GatfaFpnjPS/Eev+N2+HyafrmjXWsxx6bdaV4lg1DTtasZbxtUstX0rUvCS6fP45gXwu4B6v8L/AIufDX40+GR4x+FfjDSPG3hk3ENqNW0eSZoPNu9I0rxFp7GO5ht7hbfV/DevaD4m0O7aL7LrnhjXtC8SaRPe6JrOmX10AejUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/1f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQB4L8Vv2YvgX8b9UbWvij4Ct/FWqP4Yv/BbXsut+JtKlPhTV9K8WaFrWgf8SPWdMT+zNd0Lx14t0TXrbAXW9H1y70zVftliILeIA4/Rv2Jv2Y9AvvDuqaX8Mkg1Pwr4a8O+D9Dv5PF3ju6u7Xw74T+M9h+0J4e06aW68TzG/GnfGDTLTxglzqH2q7mKS6FczzeGbm50eUA9j+Gfwk+Hvwd0e80D4c+H/wDhHdJv5PDUl3a/2rrerec/hD4eeCvhT4dbz9c1LU7lP7O8A/DvwdoOI5lF3/Y/9qX32nWdQ1PUb0A9HoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoA/mXoA/9b+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1/7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/Q/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9H+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/T/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9T+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/W/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9f+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0P7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/R/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9L+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0/7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/U/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9X+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/X/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9D+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/S/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9P+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1P7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/V/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9b+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1/7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/Q/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9H+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/T/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9T+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/W/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9f+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0P7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/R/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9L+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0/7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/U/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9X+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/X/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9D+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/S/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9P+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1P7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/V/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9b+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1/7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/Q/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9H+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/T/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9T+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/W/th+DHxn+D0Pwe+FEUvxX+GsUsXw18CxyRyeO/CySRyJ4X0tXR0bUgyOjAqysNysCDgg0Aelf8Lr+Df/AEVr4Zf+F74V/wDllQAf8Lr+Df8A0Vr4Zf8Ahe+Ff/llQAf8Lr+Df/RWvhl/4XvhX/5ZUAH/AAuv4N/9Fa+GX/he+Ff/AJZUAH/C6/g3/wBFa+GX/he+Ff8A5ZUAH/C6/g3/ANFa+GX/AIXvhX/5ZUAH/C6/g3/0Vr4Zf+F74V/+WVAB/wALr+Df/RWvhl/4XvhX/wCWVAB/wuv4N/8ARWvhl/4XvhX/AOWVAB/wuv4N/wDRWvhl/wCF74V/+WVAB/wuv4N/9Fa+GX/he+Ff/llQAf8AC6/g3/0Vr4Zf+F74V/8AllQAf8Lr+Df/AEVr4Zf+F74V/wDllQAf8Lr+Df8A0Vr4Zf8Ahe+Ff/llQAf8Lr+Df/RWvhl/4XvhX/5ZUAH/AAuv4N/9Fa+GX/he+Ff/AJZUAH/C6/g3/wBFa+GX/he+Ff8A5ZUAH/C6/g3/ANFa+GX/AIXvhX/5ZUAH/C6/g3/0Vr4Zf+F74V/+WVAB/wALr+Df/RWvhl/4XvhX/wCWVAB/wuv4N/8ARWvhl/4XvhX/AOWVAB/wuv4N/wDRWvhl/wCF74V/+WVAB/wuv4N/9Fa+GX/he+Ff/llQAf8AC6/g3/0Vr4Zf+F74V/8AllQAf8Lr+Df/AEVr4Zf+F74V/wDllQAf8Lr+Df8A0Vr4Zf8Ahe+Ff/llQAf8Lr+Df/RWvhl/4XvhX/5ZUAH/AAuv4N/9Fa+GX/he+Ff/AJZUAH/C6/g3/wBFa+GX/he+Ff8A5ZUAH/C6/g3/ANFa+GX/AIXvhX/5ZUAH/C6/g3/0Vr4Zf+F74V/+WVAB/wALr+Df/RWvhl/4XvhX/wCWVAB/wuv4N/8ARWvhl/4XvhX/AOWVAB/wuv4N/wDRWvhl/wCF74V/+WVAB/wuv4N/9Fa+GX/he+Ff/llQAf8AC6/g3/0Vr4Zf+F74V/8AllQAf8Lr+Df/AEVr4Zf+F74V/wDllQAf8Lr+Df8A0Vr4Zf8Ahe+Ff/llQAf8Lr+Df/RWvhl/4XvhX/5ZUAH/AAuv4N/9Fa+GX/he+Ff/AJZUAH/C6/g3/wBFa+GX/he+Ff8A5ZUAH/C6/g3/ANFa+GX/AIXvhX/5ZUAH/C6/g3/0Vr4Zf+F74V/+WVAB/wALr+Df/RWvhl/4XvhX/wCWVAH813/Cy/hz/wBFA8E/+FVoP/ydQB//2QAAUEsDBBQABgAIAAAAIQDSXhXfgQMAAEwJAAARAAAAd29yZC9zZXR0aW5ncy54bWy0Vltv2zYUfh/Q/2DouYolxXJdrU4RO/GaIl6D2H3ZGyVRNhFehEPKmjvsv++IFCNvDQp3Rf1i8nznzu8c+937PwUfHShopuQ8iC+iYERloUomd/Pg83YVzoKRNkSWhCtJ58GR6uD91atf3rWZpsagmh6hC6kzUcyDvTF1Nh7rYk8F0ReqphLBSoEgBq+wGwsCT00dFkrUxLCccWaO4ySKpkHvRs2DBmTWuwgFK0BpVZnOJFNVxQraf3kLOCeuM7lRRSOoNDbiGCjHHJTUe1Zr7038X28I7r2Tw7eKOAju9do4OqPcVkH5bHFOep1BDaqgWuMDCe4TZHIIPPnK0XPsC4zdl2hdoXkc2dNp5un3OUj+40Dzcypx0D3LgYDjSV+GKLK7nVRAco6sxHJGmFFwhbT8opQYtVlNocC3QU5PomDcASWtSMPNluQbo2pUORDM4U00c/D+WO+ptIT4A6nu8UmSOrzYEyCFobCpSYFtXSppQHGvV6rflVkirQG77iw0OdAHoAdG2wdWmAaoc2S5P5w2bo7QkSQCi/nXbKxViURvswbY+f3uDGxSsc/9xUAK5x5YSbddEzfmyOkKa9qwL/Ralh8bbRh6tA35gQy+lQC2GyN/wmffHmu6oqTrkf5JwewDrTir1wxAwZ0skR4/LRirKgoYgBFD18g6Bqq1ff5ASYnr9gfjjk9phMu71P7wqJTxqlF0GaXLdOky7dBzkPRNvEyTl5DbOJ29tdM0fo4qsm7xPYA/dRQaCWexJCIHRkbrbjWOO40cnhZMejynOOv0FNk0uQfD0AFaEM5XOHoesAmIrGS6vqGVPfM1gd3gt9eAF6W4Bj4+++pWBIXfQDW1Q1sgtaOGV4knboGIjElzz4SX6ybfeCuJ2+kEamT56QC2T0N72szgE9sRuyeWKla3gnD12FOJw6ajAV2TunZsynfxPOBstzdxRwCDtxJ/Qe0l3yU9llgscZi9kKKrDLX7wyBLvOxE79LLLgfZxMsmgyz1snSQTb1s2slwiVLgTD4hsf2xk1eKc9XS8sOAfyXyW7pg+OKbo8iH5fraYZxpnLQa97BR4LFfLRZPslIVd0hWPLl3i5LbWZIsHJza/W22yKMnbO0jrRZE07LHvGnqTP9adZ9Zsgiv45sknEzTRThLlrfhYpVcx8vrt9N0mfzdz4H/G3T1DwAAAP//AwBQSwMEFAAGAAgAAAAhAPC8NQHcAQAA8QUAABIAAAB3b3JkL2ZvbnRUYWJsZS54bWy8k9tq4zAQhu8LfQej+8ay4vRg6pQ0bWBh6cXSfQBFkW2xOhhJiTdvvyPZcQMhbJallUHI/4x+jT40j0+/lUx23DphdImyCUYJ18xshK5L9PN9dXOPEuep3lBpNC/Rnjv0NL++euyKymjvEtivXaFYiRrv2yJNHWu4om5iWq4hWBmrqIdfW6eK2l/b9oYZ1VIv1kIKv08JxrdosLGXuJiqEoy/GLZVXPu4P7VcgqPRrhGtO7h1l7h1xm5aaxh3Du6sZO+nqNCjTZafGCnBrHGm8hO4zFBRtILtGY4rJT8MZv9mQEYDxYpvtTaWriXAh0oSMEPzgX7SFZoqCCypFGsrYqCl2jieQWxHZYkwwSs8gzl8OZ6GGaUhkTXUOh5M+kTcyxVVQu4PKt160+ut8Kw5yDtqRaipDzlRQ2Dr1rhErxgGWa1Qr2QlykFYLEeFhKPiyAZlOio4KCz69BkPcReLPmMOnJn2AE5AvAvFXfLGu+SHUVSfAULwLYCYAY4AZvr5QMji9QjIEpS7+/xw/Q8gD38H0mO8HMgCypJnMDwDhnx4GfF1fD6G43cxYJh+BYahQZLvom782TYJzfFFbbIIFZPjVxHahOC75xMc8fL/2SbDws3/AAAA//8DAFBLAwQUAAYACAAAACEA4IvKVR8BAAARAgAAFAAAAHdvcmQvd2ViU2V0dGluZ3MueG1slNFRS8MwEAfwd8HvUPK+pRs6tKwbgkz2MgbVD5Cl1zWY5EIua7dv71nnRHyZbzku9+P+3Hx5dDbrIJJBX4rJOBcZeI218ftSvL2uRg8io6R8rSx6KMUJSCwXtzfzvuhhV0FK/JMyVjwVTpeiTSkUUpJuwSkaYwDPzQajU4nLuJdOxfdDGGl0QSWzM9akk5zm+UycmXiNgk1jNDyjPjjwaZiXESyL6Kk1gb61/hqtx1iHiBqIOI+zX55Txl+Yyd0fyBkdkbBJYw5z3migeHySDy9nf4D7/wHTC+B0sd57jGpn+QS8ScaYWPANlLXYbzcv8rOocYOpUh08UcUpLKyMhaETzBEsbSGuvW6zvuiULcXjTHBT/jrk4gMAAP//AwBQSwMEFAAGAAgAAAAhAJ/qVV97AQAAFQMAABEACAFkb2NQcm9wcy9jb3JlLnhtbCCiBAEooAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJySUU/CMBCA3038D0vfRzdQgssYiRqeJJoI0fhW2xtUtrZpDwb/3m6DIZHExLfe7ruvt7umk11ZBFuwTmo1JnEvIgEoroVUyzFZzKfhiAQOmRKs0ArGZA+OTLLrq5SbhGsLL1YbsCjBBd6kXMLNmKwQTUKp4ysomet5Qvlkrm3J0Id2SQ3ja7YE2o+iIS0BmWDIaC0MTWckB6XgndJsbNEIBKdQQAkKHY17MT2xCLZ0FwuazA+ylLg3cBE9Jjt652QHVlXVqwYN6vuP6fvs6bX51VCqelYcSJYKnqDEArKUno7+5DafX8Cx/dwF/swtMNQ2W6AspGMIGxsICGaSW+10jsFznksOTd2Rrbewhn2lrXDeeBZ5TIDjVhr0u23vO/vg6YI5nPll5xLE/f7vq3+X1BYLW1m/nyxuiC5MD8to2wUR+CEm7ciPmbfBw+N8SrJ+FA/DOAr7N/NolNzeJVH0UXd8Vn8SlocG/m08CtqhnT/k7BsAAP//AwBQSwMEFAAGAAgAAAAhAIGW/TkyCwAAZHIAAA8AAAB3b3JkL3N0eWxlcy54bWy8ndty27oVhu8703fg6Kq9cHyMnXi2s8d24tpTO9s7cppriIQk1CCh8uBDn74gSEmQF0FxAau+siVqfQDx4wewQFL67feXVEZPPC+Eys5G+x/2RhHPYpWIbHY2+vlwtfNpFBUlyxImVcbPRq+8GP3+5a9/+e35tChfJS8iDciK0zQ+G83LcnG6u1vEc56y4oNa8EwfnKo8ZaV+mc92U5Y/VoudWKULVoqJkKJ83T3Y2zsetZh8CEVNpyLmX1VcpTwrTfxuzqUmqqyYi0WxpD0PoT2rPFnkKuZFoU86lQ0vZSJbYfaPACgVca4KNS0/6JNpa2RQOnx/z/yXyjXgIw5wsAKk8enNLFM5m0jd+romkYaNvujmT1T8lU9ZJcuifpnf5+3L9pX5c6WysoieT1kRC/GgS9aQVGje9XlWiJE+wllRnheCdR6c1/90HomL0nr7QiRitFuXWPxXH3xi8mx0cLR857KuwcZ7kmWz5XvTfOfqh12TsxHPdn6O67cmmns2YvnO+LwO3G1PrPlrne5i9ar51Ju20V1Dd5Rx01/1UT69VfEjT8alPnA22quL0m/+vLnPhcp1nzwbff7cvjnmqbgWScIz64PZXCT815xnPwuerN//88r0q/aNWFWZ/v/w057RSxbJt5eYL+peqo9mrG6973WArD9diXXhJvw/S9h+22Zd8XPOaqtG+28RpvooxEEdUVhn282s3py7+RSqoMP3KujovQr6+F4FHb9XQSfvVdCn9yrIYP6fBYks4S+NEWExgLqN43AjmuMwG5rj8BKa47AKmuNwAprj6OhojqMfozmOborglCp29UKrsx86ens/d/sc4cfdPiX4cbfPAH7c7QO+H3f7+O7H3T6c+3G3j95+3O2DNZ7bLLWiG22zrAx22VSpMlMlj0r+Ek5jmWaZ/IWGV096PCc5SQJMM7K1E3EwLWbm9fYeYkzqP5+XdcoVqWk0FbMq12lvaMV59sSlTkAjliSaRwjMeVnljhbx6dM5n/KcZzGn7Nh0UCkyHmVVOiHomws2I2PxLCFuviWRZFBYdWhWlfPaJIKgU6cszlV41RQjGx9uRRHeVjUkuqik5ESs7zRdzLDCcwODCU8NDCY8MzCY8MTA0oyqiVoaUUu1NKIGa2lE7db0T6p2a2lE7dbSiNqtpYW324MopRni7VXH/vC9u0up6h3n4HqMxSxjegEQPt20e6bRPcvZLGeLeVTvH3dj7XPGlnOhktfogWJOW5Go1vWmi1zqsxZZFd6gGzQqc614RPZa8YgMtuKFW+xOL5PrBdo1TT4zriZlp2kNaZBpx0xWzYI23G2sDO9hawNcibwgs0E3lqAHf6+Xs7WcFCPfupbhFVuzwm31dlQirV6LJKilVPEjzTB8/brguU7LHoNJV0pK9cwTOuK4zFXT12zLHxhJBln+W7qYs0KYXGkDMXyqX16rju7YIviE7iUTGY1u33ZSJmREt4K4fri7jR7Uok4z64ahAV6oslQpGbPdCfzbLz75O00Fz3USnL0Sne050faQgV0KgkmmIamEiKSXmSITJHOo4f2Tv04UyxMa2n3Om9tDSk5EHLN00Sw6CLylx8VnPf4QrIYM718sF/W+EJWpHkhg1rZhUU3+zePwoe67ikh2hv6oSrP/aJa6JpoOF75M2MCFLxGMmnp6qPsvwclu4MJPdgNHdbKXkhWFcF5C9eZRne6SR32+4clfy1NS5dNK0jXgEkjWgksgWRMqWaVZQXnGhkd4woZHfb6EXcbwCLbkDO8fuUjIxDAwKiUMjEoGA6PSwMBIBQi/Q8eChd+mY8HC79VpYERLAAtG1c9Ip3+iqzwWjKqfGRhVPzMwqn5mYFT97PBrxKdTvQimm2IsJFWfs5B0E01W8nShcpa/EiG/ST5jBBukDe0+V9P6uQGVNTdxEyDrPWpJuNhucFQi/+ITsqrVLMp6EeyIMimVItpbW084JnLz3rVtYeaZi+AqmM32W/7EKVbjFozoMkADC5fNgoVPUxYsfJqyYOHTlAULn6YsWPg0ZcHC71++lyzmcyUTnjuM2FeRaLxgcXttCVyjHrRXfytm8zIaz1eXqGzM8d7WyOUu00bY9gK7Borjg56wO56IKl1WFD4BdHw4PNgYeiN4+aBWT/B6+bsR+XFgJCzzeHvkOrXbiDwZGAnL/DQw0oxSG5F9g/hXlj92doSTvv6z2phwdL6Tvl60Cu4stq8jrSK7uuBJXy/asEp0Hsf1JS6ozjDPuOOHmccdj3GRm4Kxk5sy2FduRJ/BfvAnUS9HMYOmKW91y8/b4g7NlDpo5PyzUs3Fpo2rpMOfRLzRq/2s4FEn53D41daNUcbdjoOHGzdi8LjjRgwegNyIQSORMxw1JLkpg8cmN2LwIOVGoEcrOCPgRisYjxutYLzPaAUpPqNVwCrAjRi8HHAj0EaFCLRRA1YKbgTKqCDcy6iQgjYqRKCNChFoo8IFGM6oMB5nVBjvY1RI8TEqpKCNChFoo0IE2qgQgTYqRKCN6rm2d4Z7GRVS0EaFCLRRIQJtVLNeDDAqjMcZFcb7GBVSfIwKKWijQgTaqBCBNipEoI0KEWijQgTKqCDcy6iQgjYqRKCNChFoozbPx/obFcbjjArjfYwKKT5GhRS0USECbVSIQBsVItBGhQi0USECZVQQ7mVUSEEbFSLQRoUItFHNpYMAo8J4nFFhvI9RIcXHqJCCNipEoI0KEWijQgTaqBCBNipEoIwKwr2MCiloo0IE2qgQ0dc/2+vqrmdD9vG7ns7HTIZfumor9cP+/gEbdTgctayVmzX8AZoLpR6jzqdlD02+MQwiJlIos0XtuBfE5poLpKir9X9c9j+WZtMDvymsfYDHXOgH8KOhkWBP5aivy9uRIMk76uvpdiRYdR71jb52JJgGj/oGXePL5Z1UejoCwX3DjBW87wjvG62tcNjEfWO0FQhbuG9ktgJhA/eNx1bgx6genN9GfxzYTserm6IBoa87WoQTN6GvW0KtlsMxNMZQ0dyEoeq5CUNldBNQejoxeGHdKLTCbpSf1NBmWKn9jeomYKWGBC+pAcZfaojylhqi/KSGAyNWakjASu0/OLsJXlIDjL/UEOUtNUT5SQ2nMqzUkICVGhKwUgdOyE6Mv9QQ5S01RPlJDRd3WKkhASs1JGClhgQvqQHGX2qI8pYaovykBlkyWmpIwEoNCVipIcFLaoDxlxqivKWGqD6pzS7KhtQoha1w3CLMCsRNyFYgbnC2Aj2yJSvaM1uyCJ7ZEtRqqTkuW7JFcxOGqucmDJXRTUDp6cTghXWj0Aq7UX5S47KlLqn9jeomYKXGZUtOqXHZUq/UuGypV2pctuSWGpctdUmNy5a6pPYfnN0EL6lx2VKv1LhsqVdqXLbklhqXLXVJjcuWuqTGZUtdUgdOyE6Mv9S4bKlXaly25JYaly11SY3LlrqkxmVLXVLjsiWn1LhsqVdqXLbUKzUuW3JLjcuWuqTGZUtdUuOypS6pcdmSU2pcttQrNS5b6pXakS3tPm/8aljNNr93pz9cvi54/cXx1gMzSfPFue1FQPPBm2T16151cF2TqP3Fs/ZtU+H2gmFTogmERcVzXVbcfuWXo6h7JYU+b5Yn+nAJinR8s6+pwvrkl59uG3N9EbT53MYFz94al3Vj99TWiMGq3vZpFHNV8XPbBbfVUddoIpsfw9P/3GSJBjy3v7DW1DV5YQ1KH7/kUt6x5tNq4f6o5NOyObq/Zx6ffXN80nxhoTM+N4OEE7C7WZnmZfvDd44Wb37CoL167Wj18yquMi61G3hHm5v7KUKbe13B5X/Fl/8BAAD//wMAUEsDBBQABgAIAAAAIQDtJ+K6ZQEAALUCAAAQAAgBZG9jUHJvcHMvYXBwLnhtbCCiBAEooAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJxSwUrFMBC8C/5D6d2XPkER2RcRRTyoCK/qOSTbNpgmIVnF9/durNaqN3Pand1MZobA2dvoqldM2Qa/qderpq7Q62Cs7zf1Q3t1cFJXmZQ3ygWPm3qHuT6T+3twn0LERBZzxRQ+b+qBKJ4KkfWAo8orHnuedCGNirhNvQhdZzVeBv0yoidx2DTHAt8IvUFzEGfCemI8faX/kpqgi7782O4i80locYxOEcq7ctOtTKARxIxCG0i51o4oG4bnBu5Vj1muQUwFPIVkctmZCrgYVFKaOD95BGLRwXmMzmpFnKu8tTqFHDqqbpW2nkIeqkIAYrkF7GGL+iVZ2pUnli3cWD8JmQoWllSfVBw+1c0dbLVyeMHuZadcRhDfQGF5zg+xDZfF9ef8J7iw9GRp2Eal8Ze5BQ5bRtGw1Pm1GYBrDj+5ws53fY/ma+fvoMT1OP1CuT5aNXw+wvnC2OL8PeQ7AAAA//8DAFBLAQItABQABgAIAAAAIQBnzQ+udAEAADoFAAATAAAAAAAAAAAAAAAAAAAAAABbQ29udGVudF9UeXBlc10ueG1sUEsBAi0AFAAGAAgAAAAhAMfCJ7z/AAAA3wIAAAsAAAAAAAAAAAAAAAAArQMAAF9yZWxzLy5yZWxzUEsBAi0AFAAGAAgAAAAhABOqPof2AAAAMQMAABwAAAAAAAAAAAAAAAAA3QYAAHdvcmQvX3JlbHMvZG9jdW1lbnQueG1sLnJlbHNQSwECLQAUAAYACAAAACEAM+oBymACAAACBwAAEQAAAAAAAAAAAAAAAAAVCQAAd29yZC9kb2N1bWVudC54bWxQSwECLQAUAAYACAAAACEAJyDgAjMGAACMGgAAFQAAAAAAAAAAAAAAAACkCwAAd29yZC90aGVtZS90aGVtZTEueG1sUEsBAi0ACgAAAAAAAAAhAGoT2A2MJQAAjCUAABcAAAAAAAAAAAAAAAAAChIAAGRvY1Byb3BzL3RodW1ibmFpbC5qcGVnUEsBAi0AFAAGAAgAAAAhANJeFd+BAwAATAkAABEAAAAAAAAAAAAAAAAAyzcAAHdvcmQvc2V0dGluZ3MueG1sUEsBAi0AFAAGAAgAAAAhAPC8NQHcAQAA8QUAABIAAAAAAAAAAAAAAAAAezsAAHdvcmQvZm9udFRhYmxlLnhtbFBLAQItABQABgAIAAAAIQDgi8pVHwEAABECAAAUAAAAAAAAAAAAAAAAAIc9AAB3b3JkL3dlYlNldHRpbmdzLnhtbFBLAQItABQABgAIAAAAIQCf6lVfewEAABUDAAARAAAAAAAAAAAAAAAAANg+AABkb2NQcm9wcy9jb3JlLnhtbFBLAQItABQABgAIAAAAIQCBlv05MgsAAGRyAAAPAAAAAAAAAAAAAAAAAIpBAAB3b3JkL3N0eWxlcy54bWxQSwECLQAUAAYACAAAACEA7SfiumUBAAC1AgAAEAAAAAAAAAAAAAAAAADpTAAAZG9jUHJvcHMvYXBwLnhtbFBLBQYAAAAADAAMAAYDAACETwAAAAA='), - array('data:a!b#c&d-e^f_g+h.i/a!b#c&d-e^f_g+h.i;base64,foobar'), - ); + $data = [ + ['data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC'], + ['data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC'], + ['data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC '], + ['data:,Hello%2C%20World!'], + ['data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E'], + ['data:,A%20brief%20note'], + ['data:text/html;charset=US-ASCII,%3Ch1%3EHello!%3C%2Fh1%3E'], + ['data:application/ld+json;base64,eyJAaWQiOiAiL2ZvbyJ9'], + ['data:application/vnd.ms-word.document.macroenabled.12;base64,UEsDBBQABgAIAAAAIQBnzQ+udAEAADoFAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC0lMtOwzAQRfdI/EPkLUrcskAINe0CyhIqUT7AtSepIX7Idl9/zzhpI1TRBFG6iZTM3HvPOJmMJltVJWtwXhqdk2E2IAloboTUZU7e58/pPUl8YFqwymjIyQ48mYyvr0bznQWfoFr7nCxDsA+Uer4ExXxmLGisFMYpFvDWldQy/slKoLeDwR3lRgfQIQ3Rg4xHT1CwVRWS6RYfNyQoJ8lj0xejcsKsrSRnAcs0VumPOgeV7xCutTiiS/dkGSrrHr+U1t+cTviwUB4lSBVHqwuoecXjdFJAMmMuvDCFDXRjnKDC8JVCUdY9XGRUPo2SrJUoxp2ZaraoAKtM6gPhyTQfdhX4X2QdnYcpCsmhDY5e1hkO3uM3oaqs8e2PhxBQcAmAvXMvwgYWbxej+GbeC1Jg7jy+uv/HaK17IQLuJjTX4dkctU1XJHbOnLEed939YezDUkZ1igNbcEF2f3VtIlqfPR/EfRcgfsim9Z9v/AUAAP//AwBQSwMEFAAGAAgAAAAhAMfCJ7z/AAAA3wIAAAsACAJfcmVscy8ucmVscyCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsks1KAzEQgO+C7xDm3s22iog024sIvYmsDzAm093o5odkqu3bG0XUhWUR7HH+Pr5JZr05uEG8Uso2eAXLqgZBXgdjfafgsb1bXIPIjN7gEDwpOFKGTXN+tn6gAbkM5d7GLArFZwU9c7yRMuueHOYqRPKlsgvJIZcwdTKifsGO5Kqur2T6zYBmxBRboyBtzQWI9hjpf2zpiNEgo9Qh0SKmMp3Yll1Ei6kjVmCCvi/p/NlRFTLIaaHLvwuF3c5qug1678jzlBcdmLwhM6+EMc4ZLU9pNO74kXkLyUjzlZ6zWZ32w7jfuyePdph4l+9a9Ryp+xCSo7Ns3gEAAP//AwBQSwMEFAAGAAgAAAAhABOqPof2AAAAMQMAABwACAF3b3JkL19yZWxzL2RvY3VtZW50LnhtbC5yZWxzIKIEASigAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArJLLasMwEEX3hf6DmH0tO31QQuRsSiHb1v0ARR4/qCwJzfThv69oSOvQYLrw8l4x955Bs9l+Dla8Y6TeOwVFloNAZ3zdu1bBS/V4dQ+CWLtaW+9QwYgE2/LyYvOEVnMaoq4PJFKKIwUdc1hLSabDQVPmA7r00vg4aE4ytjJo86pblKs8v5NxmgHlSabY1Qrirr4GUY0B/5Ptm6Y3+ODN24COz1TID9w/I3NajlKsji2ygomZpUSQ50FulgRpvONK7y3+YvxYcxC3S0Jwmp0AfMuDWcwxFEsyEI8WJ59x0HP1q0Xr/1zD0TkiyJNDL78AAAD//wMAUEsDBBQABgAIAAAAIQAz6gHKYAIAAAIHAAARAAAAd29yZC9kb2N1bWVudC54bWykld1u2jAUx+8n7R2Q70sSCpRGQKVBh9A0qRrb9WQcJ7GIfSzbQLs32nPsxXacL7JNQ7QgFPt8+Of/sWNn+vAsi96BGytAzUjUD0mPKwaJUNmMfPv68WZCetZRldACFJ+RF27Jw/z9u+kxToDtJVeuhwhl46NmM5I7p+MgsCznktq+FMyAhdT1GcgA0lQwHhzBJMEgjMKypw0wbi3Ot6DqQC2pcRIuo0nKmu4gDCdoC9Uy/lUEmisMpmAkdWiaDEeY3V7fIFNTJ7aiEO7Fs8Yt5jAje6PimnHT6vBjYhQQH2TRJMO53Epo3TQjzCUiqyHLeslLeYHhBQoGZXOhT+v2VhoG8wZytuBOsUcdDa/b9KWhR2xOwEvkJ9UgWVTKzxOj8IId8Yh2xCUS/pyzUdJ9+Y5vW5rO4kaj1wEGfwN0dt3mrAzs9YkmrqOt1a5l+avkFax6k7ul2evEbHKq8QRKFq8zBYZuC1SEW9bDVe/515rM8YrbQvLiW43uYaypoetkRsLB8hb/Q1J6HX923ntX/9Ab43WafMHEcHQXLUaD1rXkKd0Xzkduw9FitChnMf7h5p9+/TwINQ183z9L9xZg5y+ojaPGIUb4+T1PUYmKv6/gA2U7EnRzH1XSZgYlSvuw5cw9mf+r22Dcex+j0eQ+LJXpbPMDo3gioug+LOfNsT+eDEuyT/hMPdIBHtxoGFXViyx3J3MLzoE82QVPO9Gc04TjFXgXTryZAriOme1dadbTMSgseq2mjFc5pRu/RCsjfNGFUPxJOIYqb8dN9VXhZbfa0OD08Zr/BgAA//8DAFBLAwQUAAYACAAAACEAJyDgAjMGAACMGgAAFQAAAHdvcmQvdGhlbWUvdGhlbWUxLnhtbOxZTYvbRhi+F/ofhO6OZVvyxxJvsGU7abObhOwmJcexNJYmO9KYmdHumhAoybFQKE1LDw301kJpG0igl/TUn7JtSptC/kJHI8uesccsaTawhNhgzcfzvvPM+848I1kXLx0n2DqElCGSdu3aBce2YBqQEKVR1761P6q0bYtxkIYAkxR27Rlk9qXtDz+4CLZ4DBNoCfuUbYGuHXM+3apWWSCaAbtApjAVfRNCE8BFlUbVkIIj4TfB1brjNKsJQKltpSARbvfj338Qzq5PJiiA9nbpfYjFT8pZ3hBgupf7hnOTfkYhyCQ2PKjlFzZjPqbWIcBdWwwUkqN9eMxtCwPGRUfXduTHrm5frC6MMN9gq9iN5GduNzcID+rSjkbjhaHrem6zt/AvAZiv44atYXPYXPiTABAEYqYFFxXr9Tv9gTfHKqCiaPA9aA0aNQ2v+G+s4Xte/tXwElQU3TX8aOQvY6iAiqJniEmr7rsaXoKKYnMN33J6A7el4SUoxig9WEM7XrPhl7NdQCYEXzHCO547atXn8CWqqqyuwj7lm9ZaAu4SOhIAmVzAUWrx2RROQCBwPsBoTJG1g6JYLLwpSAkTzU7dGTkN8Zt/XVmSEQFbECjWRVPA1ppyPhYLKJryrv2x8GorkFfPf3r1/Kl18uDZyYNfTx4+PHnwi8HqCkgj1erl91/8+/hT65+n37189JUZz1T8nz9/9sdvX5qBXAW++PrJX8+evPjm879/fGSA9ygYq/B9lEBmXYNH1k2SiIkZBoBj+noW+zFAqkUvjRhIQW5jQA95rKGvzQAGBlwf6hG8TYVMmICXs7sa4b2YZhwZgFfjRAPuEoL7hBrndDUfS41ClkbmwWmm4m4CcGga21/J7zCbivWOTC79GGo0b2CRchDBFHIr7yMHEBrM7iCkxXUXBZQwMuHWHWT1ATKGZB+NtdW0NLqCEpGXmYmgyLcWm93bVp9gk/sBPNSRYlcAbHIJsRbGyyDjIDEyBglWkTuAxyaSezMaaAFnXGQ6gphYwxAyZrK5Tmca3atCXsxp38WzREdSjg5MyB1AiIockAM/BsnUyBmlsYr9iB2IJQqsG4QbSRB9h+R1kQeQbkz3bQS1dJ++t28JZTUvkLwno6YtAYm+H2d4AqB0Xl3R8wSlp4r7iqx7b1fWhZC++PaxWXfPpaD3KDLuqFUZ34RbFW+f0BCdf+0egCy9AcV2MUDfS/d76X7npXvTfj57wV5qtLyJL2/VpZtk4337BGG8x2cY7jCp7kxMLxyJRlmRRovHhGksivPhNFxEgSxblPBPEI/3YjAVw9TkCBGbu46YNSVMnA+y2eg778BZskvCorVWK59MhQHgy3ZxvpTt4jTiRWuztXwEW7iXtUg+KpcEctvXIaEMppNoGEi0ysZTSMiZnQmLjoFFO3e/kYW8zLMi9p8F8n81PLdgJNYbwDDM81TYl9k980xvCqY+7bphep2c69lkWiOhLDedhLIMYxDC1eYzznVnmVKNXh6KdRqt9tvIdS4iK9qAU71mHYk91/CEmwBMu/ZE3BmKYjIV/liumwBHadcO+DzQ/0dZppTxAWBxAZNdxfwTxCG1MErEWlfTgNMlt1q9lc/xnJLrOOcvcvKiJhlOJjDgG1qWVdFXODH2viE4r5BMkN6LwyNrjDN6E4hAea1aHsAQMb6IZoiosriXUVyRq/lW1P4xW25RgKcxmJ8oqpgXcFle0FHmIZmuzkqvzyczjvIkvfGpe7pR3qGI5oYDJD81zfrx9g55hdVS9zVWhXSval2n1LpNp8SbHwgKteVgGrWcsYHaslWndoY3BMpwi6W56Yw469NgddXmB0R5Xylra68myPiuWPkDcbuaYc4kVXgsnhH88k/lQglka6kux9zKKOra9xyv5/p1z684bW9YcRuuU2l7vUal53mN2tCrOYN+/b4ICo+TmleMPRLPM3g2f/Ui29devyTlbfaFgCRVIt+rVKWxfP1Sq2uvX4r3LtZ+3m9bSETmXrM+6jQ6/Wal0+iNKu6g3650/Ga/Mmj6rcFo4Hvtzui+bR1KsNtr+G5z2K40a75fcZtOTr/dqbTcer3ntnrtodu7P4+1mHl5LcMreW3/BwAA//8DAFBLAwQKAAAAAAAAACEAahPYDYwlAACMJQAAFwAAAGRvY1Byb3BzL3RodW1ibmFpbC5qcGVn/9j/4AAQSkZJRgABAQAASABIAAD/4QCARXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAIdpAAQAAAABAAAATgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAWmgAwAEAAAAAQAAAgAAAAAA/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIAgABaQMBEQACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/3QAEAC7/2gAMAwEAAhEDEQA/AP7Yfgx8GPg9N8HvhRLL8KPhrLLL8NfAskkkngTws8kkj+F9LZ3d200s7uxLMzHczEk5JNAHpX/ClPg3/wBEl+GX/hBeFf8A5W0AH/ClPg3/ANEl+GX/AIQXhX/5W0AH/ClPg3/0SX4Zf+EF4V/+VtAB/wAKU+Df/RJfhl/4QXhX/wCVtAB/wpT4N/8ARJfhl/4QXhX/AOVtAB/wpT4N/wDRJfhl/wCEF4V/+VtAB/wpT4N/9El+GX/hBeFf/lbQAf8AClPg3/0SX4Zf+EF4V/8AlbQAf8KU+Df/AESX4Zf+EF4V/wDlbQAf8KU+Df8A0SX4Zf8AhBeFf/lbQAf8KU+Df/RJfhl/4QXhX/5W0AH/AApT4N/9El+GX/hBeFf/AJW0AH/ClPg3/wBEl+GX/hBeFf8A5W0AH/ClPg3/ANEl+GX/AIQXhX/5W0AH/ClPg3/0SX4Zf+EF4V/+VtAB/wAKU+Df/RJfhl/4QXhX/wCVtAB/wpT4N/8ARJfhl/4QXhX/AOVtAB/wpT4N/wDRJfhl/wCEF4V/+VtAB/wpT4N/9El+GX/hBeFf/lbQAf8AClPg3/0SX4Zf+EF4V/8AlbQAf8KU+Df/AESX4Zf+EF4V/wDlbQAf8KU+Df8A0SX4Zf8AhBeFf/lbQAf8KU+Df/RJfhl/4QXhX/5W0AH/AApT4N/9El+GX/hBeFf/AJW0AH/ClPg3/wBEl+GX/hBeFf8A5W0AH/ClPg3/ANEl+GX/AIQXhX/5W0AH/ClPg3/0SX4Zf+EF4V/+VtAB/wAKU+Df/RJfhl/4QXhX/wCVtAB/wpT4N/8ARJfhl/4QXhX/AOVtAB/wpT4N/wDRJfhl/wCEF4V/+VtAB/wpT4N/9El+GX/hBeFf/lbQAf8AClPg3/0SX4Zf+EF4V/8AlbQAf8KU+Df/AESX4Zf+EF4V/wDlbQAf8KU+Df8A0SX4Zf8AhBeFf/lbQAf8KU+Df/RJfhl/4QXhX/5W0AH/AApT4N/9El+GX/hBeFf/AJW0AH/ClPg3/wBEl+GX/hBeFf8A5W0AH/ClPg3/ANEl+GX/AIQXhX/5W0AH/ClPg3/0SX4Zf+EF4V/+VtAB/wAKU+Df/RJfhl/4QXhX/wCVtAB/wpT4N/8ARJfhl/4QXhX/AOVtAB/wpT4N/wDRJfhl/wCEF4V/+VtAB/wpT4N/9El+GX/hBeFf/lbQAf8AClPg3/0SX4Zf+EF4V/8AlbQB/Nd/wrT4c/8ARP8AwT/4Sug//INAH//Q/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9H+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/T/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9T+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAfP3j79pv4T/DT4n6P8IvFmr3Vj4w1jwRqvxN2GC3TSNH+G3hs6v/AMJj8QPEmsXV5a2Xh3wZ4JTSB/wlPiPVnttK0+81vwpokdxc+IPFfh/SdQAMPQ/2v/gXr2heH9WtvFlrZ6n4g8X6B4Gi8GatfaFpnjPS/Eev+N2+HyafrmjXWsxx6bdaV4lg1DTtasZbxtUstX0rUvCS6fP45gXwu4B6v8L/AIufDX40+GR4x+FfjDSPG3hk3ENqNW0eSZoPNu9I0rxFp7GO5ht7hbfV/DevaD4m0O7aL7LrnhjXtC8SaRPe6JrOmX10AejUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/1f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQB4L8Vv2YvgX8b9UbWvij4Ct/FWqP4Yv/BbXsut+JtKlPhTV9K8WaFrWgf8SPWdMT+zNd0Lx14t0TXrbAXW9H1y70zVftliILeIA4/Rv2Jv2Y9AvvDuqaX8Mkg1Pwr4a8O+D9Dv5PF3ju6u7Xw74T+M9h+0J4e06aW68TzG/GnfGDTLTxglzqH2q7mKS6FczzeGbm50eUA9j+Gfwk+Hvwd0e80D4c+H/wDhHdJv5PDUl3a/2rrerec/hD4eeCvhT4dbz9c1LU7lP7O8A/DvwdoOI5lF3/Y/9qX32nWdQ1PUb0A9HoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoA/mXoA/9b+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1/7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/Q/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9H+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/T/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9T+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/W/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9f+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0P7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/R/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9L+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0/7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/U/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9X+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/X/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9D+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/S/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9P+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1P7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/V/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9b+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1/7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/Q/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9H+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/T/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9T+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/W/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9f+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0P7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/R/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9L+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0/7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/U/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9X+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/X/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9D+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/S/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9P+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1P7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/V/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9b+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1/7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/Q/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9H+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/0v7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/T/ur+Cn/JGvhJ/wBky8B/+orpVAHptABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQB/MvQB/9T+6v4Kf8ka+En/AGTLwH/6iulUAem0AFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFAH8y9AH/1f7q/gp/yRr4Sf8AZMvAf/qK6VQB6bQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAfzL0Af/W/th+DHxn+D0Pwe+FEUvxX+GsUsXw18CxyRyeO/CySRyJ4X0tXR0bUgyOjAqysNysCDgg0Aelf8Lr+Df/AEVr4Zf+F74V/wDllQAf8Lr+Df8A0Vr4Zf8Ahe+Ff/llQAf8Lr+Df/RWvhl/4XvhX/5ZUAH/AAuv4N/9Fa+GX/he+Ff/AJZUAH/C6/g3/wBFa+GX/he+Ff8A5ZUAH/C6/g3/ANFa+GX/AIXvhX/5ZUAH/C6/g3/0Vr4Zf+F74V/+WVAB/wALr+Df/RWvhl/4XvhX/wCWVAB/wuv4N/8ARWvhl/4XvhX/AOWVAB/wuv4N/wDRWvhl/wCF74V/+WVAB/wuv4N/9Fa+GX/he+Ff/llQAf8AC6/g3/0Vr4Zf+F74V/8AllQAf8Lr+Df/AEVr4Zf+F74V/wDllQAf8Lr+Df8A0Vr4Zf8Ahe+Ff/llQAf8Lr+Df/RWvhl/4XvhX/5ZUAH/AAuv4N/9Fa+GX/he+Ff/AJZUAH/C6/g3/wBFa+GX/he+Ff8A5ZUAH/C6/g3/ANFa+GX/AIXvhX/5ZUAH/C6/g3/0Vr4Zf+F74V/+WVAB/wALr+Df/RWvhl/4XvhX/wCWVAB/wuv4N/8ARWvhl/4XvhX/AOWVAB/wuv4N/wDRWvhl/wCF74V/+WVAB/wuv4N/9Fa+GX/he+Ff/llQAf8AC6/g3/0Vr4Zf+F74V/8AllQAf8Lr+Df/AEVr4Zf+F74V/wDllQAf8Lr+Df8A0Vr4Zf8Ahe+Ff/llQAf8Lr+Df/RWvhl/4XvhX/5ZUAH/AAuv4N/9Fa+GX/he+Ff/AJZUAH/C6/g3/wBFa+GX/he+Ff8A5ZUAH/C6/g3/ANFa+GX/AIXvhX/5ZUAH/C6/g3/0Vr4Zf+F74V/+WVAB/wALr+Df/RWvhl/4XvhX/wCWVAB/wuv4N/8ARWvhl/4XvhX/AOWVAB/wuv4N/wDRWvhl/wCF74V/+WVAB/wuv4N/9Fa+GX/he+Ff/llQAf8AC6/g3/0Vr4Zf+F74V/8AllQAf8Lr+Df/AEVr4Zf+F74V/wDllQAf8Lr+Df8A0Vr4Zf8Ahe+Ff/llQAf8Lr+Df/RWvhl/4XvhX/5ZUAH/AAuv4N/9Fa+GX/he+Ff/AJZUAH/C6/g3/wBFa+GX/he+Ff8A5ZUAH/C6/g3/ANFa+GX/AIXvhX/5ZUAH/C6/g3/0Vr4Zf+F74V/+WVAB/wALr+Df/RWvhl/4XvhX/wCWVAH813/Cy/hz/wBFA8E/+FVoP/ydQB//2QAAUEsDBBQABgAIAAAAIQDSXhXfgQMAAEwJAAARAAAAd29yZC9zZXR0aW5ncy54bWy0Vltv2zYUfh/Q/2DouYolxXJdrU4RO/GaIl6D2H3ZGyVRNhFehEPKmjvsv++IFCNvDQp3Rf1i8nznzu8c+937PwUfHShopuQ8iC+iYERloUomd/Pg83YVzoKRNkSWhCtJ58GR6uD91atf3rWZpsagmh6hC6kzUcyDvTF1Nh7rYk8F0ReqphLBSoEgBq+wGwsCT00dFkrUxLCccWaO4ySKpkHvRs2DBmTWuwgFK0BpVZnOJFNVxQraf3kLOCeuM7lRRSOoNDbiGCjHHJTUe1Zr7038X28I7r2Tw7eKOAju9do4OqPcVkH5bHFOep1BDaqgWuMDCe4TZHIIPPnK0XPsC4zdl2hdoXkc2dNp5un3OUj+40Dzcypx0D3LgYDjSV+GKLK7nVRAco6sxHJGmFFwhbT8opQYtVlNocC3QU5PomDcASWtSMPNluQbo2pUORDM4U00c/D+WO+ptIT4A6nu8UmSOrzYEyCFobCpSYFtXSppQHGvV6rflVkirQG77iw0OdAHoAdG2wdWmAaoc2S5P5w2bo7QkSQCi/nXbKxViURvswbY+f3uDGxSsc/9xUAK5x5YSbddEzfmyOkKa9qwL/Ralh8bbRh6tA35gQy+lQC2GyN/wmffHmu6oqTrkf5JwewDrTir1wxAwZ0skR4/LRirKgoYgBFD18g6Bqq1ff5ASYnr9gfjjk9phMu71P7wqJTxqlF0GaXLdOky7dBzkPRNvEyTl5DbOJ29tdM0fo4qsm7xPYA/dRQaCWexJCIHRkbrbjWOO40cnhZMejynOOv0FNk0uQfD0AFaEM5XOHoesAmIrGS6vqGVPfM1gd3gt9eAF6W4Bj4+++pWBIXfQDW1Q1sgtaOGV4knboGIjElzz4SX6ybfeCuJ2+kEamT56QC2T0N72szgE9sRuyeWKla3gnD12FOJw6ajAV2TunZsynfxPOBstzdxRwCDtxJ/Qe0l3yU9llgscZi9kKKrDLX7wyBLvOxE79LLLgfZxMsmgyz1snSQTb1s2slwiVLgTD4hsf2xk1eKc9XS8sOAfyXyW7pg+OKbo8iH5fraYZxpnLQa97BR4LFfLRZPslIVd0hWPLl3i5LbWZIsHJza/W22yKMnbO0jrRZE07LHvGnqTP9adZ9Zsgiv45sknEzTRThLlrfhYpVcx8vrt9N0mfzdz4H/G3T1DwAAAP//AwBQSwMEFAAGAAgAAAAhAPC8NQHcAQAA8QUAABIAAAB3b3JkL2ZvbnRUYWJsZS54bWy8k9tq4zAQhu8LfQej+8ay4vRg6pQ0bWBh6cXSfQBFkW2xOhhJiTdvvyPZcQMhbJallUHI/4x+jT40j0+/lUx23DphdImyCUYJ18xshK5L9PN9dXOPEuep3lBpNC/Rnjv0NL++euyKymjvEtivXaFYiRrv2yJNHWu4om5iWq4hWBmrqIdfW6eK2l/b9oYZ1VIv1kIKv08JxrdosLGXuJiqEoy/GLZVXPu4P7VcgqPRrhGtO7h1l7h1xm5aaxh3Du6sZO+nqNCjTZafGCnBrHGm8hO4zFBRtILtGY4rJT8MZv9mQEYDxYpvtTaWriXAh0oSMEPzgX7SFZoqCCypFGsrYqCl2jieQWxHZYkwwSs8gzl8OZ6GGaUhkTXUOh5M+kTcyxVVQu4PKt160+ut8Kw5yDtqRaipDzlRQ2Dr1rhErxgGWa1Qr2QlykFYLEeFhKPiyAZlOio4KCz69BkPcReLPmMOnJn2AE5AvAvFXfLGu+SHUVSfAULwLYCYAY4AZvr5QMji9QjIEpS7+/xw/Q8gD38H0mO8HMgCypJnMDwDhnx4GfF1fD6G43cxYJh+BYahQZLvom782TYJzfFFbbIIFZPjVxHahOC75xMc8fL/2SbDws3/AAAA//8DAFBLAwQUAAYACAAAACEA4IvKVR8BAAARAgAAFAAAAHdvcmQvd2ViU2V0dGluZ3MueG1slNFRS8MwEAfwd8HvUPK+pRs6tKwbgkz2MgbVD5Cl1zWY5EIua7dv71nnRHyZbzku9+P+3Hx5dDbrIJJBX4rJOBcZeI218ftSvL2uRg8io6R8rSx6KMUJSCwXtzfzvuhhV0FK/JMyVjwVTpeiTSkUUpJuwSkaYwDPzQajU4nLuJdOxfdDGGl0QSWzM9akk5zm+UycmXiNgk1jNDyjPjjwaZiXESyL6Kk1gb61/hqtx1iHiBqIOI+zX55Txl+Yyd0fyBkdkbBJYw5z3migeHySDy9nf4D7/wHTC+B0sd57jGpn+QS8ScaYWPANlLXYbzcv8rOocYOpUh08UcUpLKyMhaETzBEsbSGuvW6zvuiULcXjTHBT/jrk4gMAAP//AwBQSwMEFAAGAAgAAAAhAJ/qVV97AQAAFQMAABEACAFkb2NQcm9wcy9jb3JlLnhtbCCiBAEooAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJySUU/CMBCA3038D0vfRzdQgssYiRqeJJoI0fhW2xtUtrZpDwb/3m6DIZHExLfe7ruvt7umk11ZBFuwTmo1JnEvIgEoroVUyzFZzKfhiAQOmRKs0ArGZA+OTLLrq5SbhGsLL1YbsCjBBd6kXMLNmKwQTUKp4ysomet5Qvlkrm3J0Id2SQ3ja7YE2o+iIS0BmWDIaC0MTWckB6XgndJsbNEIBKdQQAkKHY17MT2xCLZ0FwuazA+ylLg3cBE9Jjt652QHVlXVqwYN6vuP6fvs6bX51VCqelYcSJYKnqDEArKUno7+5DafX8Cx/dwF/swtMNQ2W6AspGMIGxsICGaSW+10jsFznksOTd2Rrbewhn2lrXDeeBZ5TIDjVhr0u23vO/vg6YI5nPll5xLE/f7vq3+X1BYLW1m/nyxuiC5MD8to2wUR+CEm7ciPmbfBw+N8SrJ+FA/DOAr7N/NolNzeJVH0UXd8Vn8SlocG/m08CtqhnT/k7BsAAP//AwBQSwMEFAAGAAgAAAAhAIGW/TkyCwAAZHIAAA8AAAB3b3JkL3N0eWxlcy54bWy8ndty27oVhu8703fg6Kq9cHyMnXi2s8d24tpTO9s7cppriIQk1CCh8uBDn74gSEmQF0FxAau+siVqfQDx4wewQFL67feXVEZPPC+Eys5G+x/2RhHPYpWIbHY2+vlwtfNpFBUlyxImVcbPRq+8GP3+5a9/+e35tChfJS8iDciK0zQ+G83LcnG6u1vEc56y4oNa8EwfnKo8ZaV+mc92U5Y/VoudWKULVoqJkKJ83T3Y2zsetZh8CEVNpyLmX1VcpTwrTfxuzqUmqqyYi0WxpD0PoT2rPFnkKuZFoU86lQ0vZSJbYfaPACgVca4KNS0/6JNpa2RQOnx/z/yXyjXgIw5wsAKk8enNLFM5m0jd+romkYaNvujmT1T8lU9ZJcuifpnf5+3L9pX5c6WysoieT1kRC/GgS9aQVGje9XlWiJE+wllRnheCdR6c1/90HomL0nr7QiRitFuXWPxXH3xi8mx0cLR857KuwcZ7kmWz5XvTfOfqh12TsxHPdn6O67cmmns2YvnO+LwO3G1PrPlrne5i9ar51Ju20V1Dd5Rx01/1UT69VfEjT8alPnA22quL0m/+vLnPhcp1nzwbff7cvjnmqbgWScIz64PZXCT815xnPwuerN//88r0q/aNWFWZ/v/w057RSxbJt5eYL+peqo9mrG6973WArD9diXXhJvw/S9h+22Zd8XPOaqtG+28RpvooxEEdUVhn282s3py7+RSqoMP3KujovQr6+F4FHb9XQSfvVdCn9yrIYP6fBYks4S+NEWExgLqN43AjmuMwG5rj8BKa47AKmuNwAprj6OhojqMfozmOborglCp29UKrsx86ens/d/sc4cfdPiX4cbfPAH7c7QO+H3f7+O7H3T6c+3G3j95+3O2DNZ7bLLWiG22zrAx22VSpMlMlj0r+Ek5jmWaZ/IWGV096PCc5SQJMM7K1E3EwLWbm9fYeYkzqP5+XdcoVqWk0FbMq12lvaMV59sSlTkAjliSaRwjMeVnljhbx6dM5n/KcZzGn7Nh0UCkyHmVVOiHomws2I2PxLCFuviWRZFBYdWhWlfPaJIKgU6cszlV41RQjGx9uRRHeVjUkuqik5ESs7zRdzLDCcwODCU8NDCY8MzCY8MTA0oyqiVoaUUu1NKIGa2lE7db0T6p2a2lE7dbSiNqtpYW324MopRni7VXH/vC9u0up6h3n4HqMxSxjegEQPt20e6bRPcvZLGeLeVTvH3dj7XPGlnOhktfogWJOW5Go1vWmi1zqsxZZFd6gGzQqc614RPZa8YgMtuKFW+xOL5PrBdo1TT4zriZlp2kNaZBpx0xWzYI23G2sDO9hawNcibwgs0E3lqAHf6+Xs7WcFCPfupbhFVuzwm31dlQirV6LJKilVPEjzTB8/brguU7LHoNJV0pK9cwTOuK4zFXT12zLHxhJBln+W7qYs0KYXGkDMXyqX16rju7YIviE7iUTGY1u33ZSJmREt4K4fri7jR7Uok4z64ahAV6oslQpGbPdCfzbLz75O00Fz3USnL0Sne050faQgV0KgkmmIamEiKSXmSITJHOo4f2Tv04UyxMa2n3Om9tDSk5EHLN00Sw6CLylx8VnPf4QrIYM718sF/W+EJWpHkhg1rZhUU3+zePwoe67ikh2hv6oSrP/aJa6JpoOF75M2MCFLxGMmnp6qPsvwclu4MJPdgNHdbKXkhWFcF5C9eZRne6SR32+4clfy1NS5dNK0jXgEkjWgksgWRMqWaVZQXnGhkd4woZHfb6EXcbwCLbkDO8fuUjIxDAwKiUMjEoGA6PSwMBIBQi/Q8eChd+mY8HC79VpYERLAAtG1c9Ip3+iqzwWjKqfGRhVPzMwqn5mYFT97PBrxKdTvQimm2IsJFWfs5B0E01W8nShcpa/EiG/ST5jBBukDe0+V9P6uQGVNTdxEyDrPWpJuNhucFQi/+ITsqrVLMp6EeyIMimVItpbW084JnLz3rVtYeaZi+AqmM32W/7EKVbjFozoMkADC5fNgoVPUxYsfJqyYOHTlAULn6YsWPg0ZcHC71++lyzmcyUTnjuM2FeRaLxgcXttCVyjHrRXfytm8zIaz1eXqGzM8d7WyOUu00bY9gK7Borjg56wO56IKl1WFD4BdHw4PNgYeiN4+aBWT/B6+bsR+XFgJCzzeHvkOrXbiDwZGAnL/DQw0oxSG5F9g/hXlj92doSTvv6z2phwdL6Tvl60Cu4stq8jrSK7uuBJXy/asEp0Hsf1JS6ozjDPuOOHmccdj3GRm4Kxk5sy2FduRJ/BfvAnUS9HMYOmKW91y8/b4g7NlDpo5PyzUs3Fpo2rpMOfRLzRq/2s4FEn53D41daNUcbdjoOHGzdi8LjjRgwegNyIQSORMxw1JLkpg8cmN2LwIOVGoEcrOCPgRisYjxutYLzPaAUpPqNVwCrAjRi8HHAj0EaFCLRRA1YKbgTKqCDcy6iQgjYqRKCNChFoo8IFGM6oMB5nVBjvY1RI8TEqpKCNChFoo0IE2qgQgTYqRKCN6rm2d4Z7GRVS0EaFCLRRIQJtVLNeDDAqjMcZFcb7GBVSfIwKKWijQgTaqBCBNipEoI0KEWijQgTKqCDcy6iQgjYqRKCNChFoozbPx/obFcbjjArjfYwKKT5GhRS0USECbVSIQBsVItBGhQi0USECZVQQ7mVUSEEbFSLQRoUItFHNpYMAo8J4nFFhvI9RIcXHqJCCNipEoI0KEWijQgTaqBCBNipEoIwKwr2MCiloo0IE2qgQ0dc/2+vqrmdD9vG7ns7HTIZfumor9cP+/gEbdTgctayVmzX8AZoLpR6jzqdlD02+MQwiJlIos0XtuBfE5poLpKir9X9c9j+WZtMDvymsfYDHXOgH8KOhkWBP5aivy9uRIMk76uvpdiRYdR71jb52JJgGj/oGXePL5Z1UejoCwX3DjBW87wjvG62tcNjEfWO0FQhbuG9ktgJhA/eNx1bgx6genN9GfxzYTserm6IBoa87WoQTN6GvW0KtlsMxNMZQ0dyEoeq5CUNldBNQejoxeGHdKLTCbpSf1NBmWKn9jeomYKWGBC+pAcZfaojylhqi/KSGAyNWakjASu0/OLsJXlIDjL/UEOUtNUT5SQ2nMqzUkICVGhKwUgdOyE6Mv9QQ5S01RPlJDRd3WKkhASs1JGClhgQvqQHGX2qI8pYaovykBlkyWmpIwEoNCVipIcFLaoDxlxqivKWGqD6pzS7KhtQoha1w3CLMCsRNyFYgbnC2Aj2yJSvaM1uyCJ7ZEtRqqTkuW7JFcxOGqucmDJXRTUDp6cTghXWj0Aq7UX5S47KlLqn9jeomYKXGZUtOqXHZUq/UuGypV2pctuSWGpctdUmNy5a6pPYfnN0EL6lx2VKv1LhsqVdqXLbklhqXLXVJjcuWuqTGZUtdUgdOyE6Mv9S4bKlXaly25JYaly11SY3LlrqkxmVLXVLjsiWn1LhsqVdqXLbUKzUuW3JLjcuWuqTGZUtdUuOypS6pcdmSU2pcttQrNS5b6pXakS3tPm/8aljNNr93pz9cvi54/cXx1gMzSfPFue1FQPPBm2T16151cF2TqP3Fs/ZtU+H2gmFTogmERcVzXVbcfuWXo6h7JYU+b5Yn+nAJinR8s6+pwvrkl59uG3N9EbT53MYFz94al3Vj99TWiMGq3vZpFHNV8XPbBbfVUddoIpsfw9P/3GSJBjy3v7DW1DV5YQ1KH7/kUt6x5tNq4f6o5NOyObq/Zx6ffXN80nxhoTM+N4OEE7C7WZnmZfvDd44Wb37CoL167Wj18yquMi61G3hHm5v7KUKbe13B5X/Fl/8BAAD//wMAUEsDBBQABgAIAAAAIQDtJ+K6ZQEAALUCAAAQAAgBZG9jUHJvcHMvYXBwLnhtbCCiBAEooAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJxSwUrFMBC8C/5D6d2XPkER2RcRRTyoCK/qOSTbNpgmIVnF9/durNaqN3Pand1MZobA2dvoqldM2Qa/qderpq7Q62Cs7zf1Q3t1cFJXmZQ3ygWPm3qHuT6T+3twn0LERBZzxRQ+b+qBKJ4KkfWAo8orHnuedCGNirhNvQhdZzVeBv0yoidx2DTHAt8IvUFzEGfCemI8faX/kpqgi7782O4i80locYxOEcq7ctOtTKARxIxCG0i51o4oG4bnBu5Vj1muQUwFPIVkctmZCrgYVFKaOD95BGLRwXmMzmpFnKu8tTqFHDqqbpW2nkIeqkIAYrkF7GGL+iVZ2pUnli3cWD8JmQoWllSfVBw+1c0dbLVyeMHuZadcRhDfQGF5zg+xDZfF9ef8J7iw9GRp2Eal8Ze5BQ5bRtGw1Pm1GYBrDj+5ws53fY/ma+fvoMT1OP1CuT5aNXw+wvnC2OL8PeQ7AAAA//8DAFBLAQItABQABgAIAAAAIQBnzQ+udAEAADoFAAATAAAAAAAAAAAAAAAAAAAAAABbQ29udGVudF9UeXBlc10ueG1sUEsBAi0AFAAGAAgAAAAhAMfCJ7z/AAAA3wIAAAsAAAAAAAAAAAAAAAAArQMAAF9yZWxzLy5yZWxzUEsBAi0AFAAGAAgAAAAhABOqPof2AAAAMQMAABwAAAAAAAAAAAAAAAAA3QYAAHdvcmQvX3JlbHMvZG9jdW1lbnQueG1sLnJlbHNQSwECLQAUAAYACAAAACEAM+oBymACAAACBwAAEQAAAAAAAAAAAAAAAAAVCQAAd29yZC9kb2N1bWVudC54bWxQSwECLQAUAAYACAAAACEAJyDgAjMGAACMGgAAFQAAAAAAAAAAAAAAAACkCwAAd29yZC90aGVtZS90aGVtZTEueG1sUEsBAi0ACgAAAAAAAAAhAGoT2A2MJQAAjCUAABcAAAAAAAAAAAAAAAAAChIAAGRvY1Byb3BzL3RodW1ibmFpbC5qcGVnUEsBAi0AFAAGAAgAAAAhANJeFd+BAwAATAkAABEAAAAAAAAAAAAAAAAAyzcAAHdvcmQvc2V0dGluZ3MueG1sUEsBAi0AFAAGAAgAAAAhAPC8NQHcAQAA8QUAABIAAAAAAAAAAAAAAAAAezsAAHdvcmQvZm9udFRhYmxlLnhtbFBLAQItABQABgAIAAAAIQDgi8pVHwEAABECAAAUAAAAAAAAAAAAAAAAAIc9AAB3b3JkL3dlYlNldHRpbmdzLnhtbFBLAQItABQABgAIAAAAIQCf6lVfewEAABUDAAARAAAAAAAAAAAAAAAAANg+AABkb2NQcm9wcy9jb3JlLnhtbFBLAQItABQABgAIAAAAIQCBlv05MgsAAGRyAAAPAAAAAAAAAAAAAAAAAIpBAAB3b3JkL3N0eWxlcy54bWxQSwECLQAUAAYACAAAACEA7SfiumUBAAC1AgAAEAAAAAAAAAAAAAAAAADpTAAAZG9jUHJvcHMvYXBwLnhtbFBLBQYAAAAADAAMAAYDAACETwAAAAA='], + ['data:a!b#c&d-e^f_g+h.i/a!b#c&d-e^f_g+h.i;base64,foobar'], + ]; if (!\defined('HHVM_VERSION')) { // See https://github.com/facebook/hhvm/issues/6354 - $data[] = array('data:text/plain;charset=utf-8;base64,SGVsbG8gV29ybGQh'); + $data[] = ['data:text/plain;charset=utf-8;base64,SGVsbG8gV29ybGQh']; } return $data; diff --git a/vendor/symfony/serializer/Tests/Normalizer/DateIntervalNormalizerTest.php b/vendor/symfony/serializer/Tests/Normalizer/DateIntervalNormalizerTest.php index f6dc6c2475e53737614a122a0a069f179c7848a7..b092c779a8cf8419fbb89ca12493adfabc53509d 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/DateIntervalNormalizerTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/DateIntervalNormalizerTest.php @@ -22,14 +22,14 @@ protected function setUp() public function dataProviderISO() { - $data = array( - array('P%YY%MM%DDT%HH%IM%SS', 'P00Y00M00DT00H00M00S', 'PT0S'), - array('P%yY%mM%dDT%hH%iM%sS', 'P0Y0M0DT0H0M0S', 'PT0S'), - array('P%yY%mM%dDT%hH%iM%sS', 'P10Y2M3DT16H5M6S', 'P10Y2M3DT16H5M6S'), - array('P%yY%mM%dDT%hH%iM', 'P10Y2M3DT16H5M', 'P10Y2M3DT16H5M'), - array('P%yY%mM%dDT%hH', 'P10Y2M3DT16H', 'P10Y2M3DT16H'), - array('P%yY%mM%dD', 'P10Y2M3D', 'P10Y2M3DT0H'), - ); + $data = [ + ['P%YY%MM%DDT%HH%IM%SS', 'P00Y00M00DT00H00M00S', 'PT0S'], + ['P%yY%mM%dDT%hH%iM%sS', 'P0Y0M0DT0H0M0S', 'PT0S'], + ['P%yY%mM%dDT%hH%iM%sS', 'P10Y2M3DT16H5M6S', 'P10Y2M3DT16H5M6S'], + ['P%yY%mM%dDT%hH%iM', 'P10Y2M3DT16H5M', 'P10Y2M3DT16H5M'], + ['P%yY%mM%dDT%hH', 'P10Y2M3DT16H', 'P10Y2M3DT16H'], + ['P%yY%mM%dD', 'P10Y2M3D', 'P10Y2M3DT0H'], + ]; return $data; } @@ -50,7 +50,7 @@ public function testNormalize() */ public function testNormalizeUsingFormatPassedInContext($format, $output, $input) { - $this->assertEquals($output, $this->normalizer->normalize(new \DateInterval($input), null, array(DateIntervalNormalizer::FORMAT_KEY => $format))); + $this->assertEquals($output, $this->normalizer->normalize(new \DateInterval($input), null, [DateIntervalNormalizer::FORMAT_KEY => $format])); } /** @@ -86,7 +86,7 @@ public function testDenormalize() */ public function testDenormalizeUsingFormatPassedInContext($format, $input, $output) { - $this->assertDateIntervalEquals(new \DateInterval($output), $this->normalizer->denormalize($input, \DateInterval::class, null, array(DateIntervalNormalizer::FORMAT_KEY => $format))); + $this->assertDateIntervalEquals(new \DateInterval($output), $this->normalizer->denormalize($input, \DateInterval::class, null, [DateIntervalNormalizer::FORMAT_KEY => $format])); } /** @@ -127,7 +127,7 @@ public function testDenormalizeInvalidDataThrowsException() */ public function testDenormalizeFormatMismatchThrowsException() { - $this->normalizer->denormalize('P00Y00M00DT00H00M00S', \DateInterval::class, null, array(DateIntervalNormalizer::FORMAT_KEY => 'P%yY%mM%dD')); + $this->normalizer->denormalize('P00Y00M00DT00H00M00S', \DateInterval::class, null, [DateIntervalNormalizer::FORMAT_KEY => 'P%yY%mM%dD']); } private function assertDateIntervalEquals(\DateInterval $expected, \DateInterval $actual) diff --git a/vendor/symfony/serializer/Tests/Normalizer/DateTimeNormalizerTest.php b/vendor/symfony/serializer/Tests/Normalizer/DateTimeNormalizerTest.php index 178519b30e687648ee1be0cef6ac690a7888e2cc..5ff41c80337a51b27161442ae5181c2a9689d04e 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/DateTimeNormalizerTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/DateTimeNormalizerTest.php @@ -44,7 +44,7 @@ public function testNormalize() public function testNormalizeUsingFormatPassedInContext() { - $this->assertEquals('2016', $this->normalizer->normalize(new \DateTime('2016/01/01'), null, array(DateTimeNormalizer::FORMAT_KEY => 'Y'))); + $this->assertEquals('2016', $this->normalizer->normalize(new \DateTime('2016/01/01'), null, [DateTimeNormalizer::FORMAT_KEY => 'Y'])); } public function testNormalizeUsingFormatPassedInConstructor() @@ -65,17 +65,93 @@ public function testNormalizeUsingTimeZonePassedInConstructor() */ public function testNormalizeUsingTimeZonePassedInContext($expected, $input, $timezone) { - $this->assertSame($expected, $this->normalizer->normalize($input, null, array( + $this->assertSame($expected, $this->normalizer->normalize($input, null, [ DateTimeNormalizer::TIMEZONE_KEY => $timezone, - ))); + ])); } public function normalizeUsingTimeZonePassedInContextProvider() { - yield array('2016-12-01T00:00:00+00:00', new \DateTime('2016/12/01', new \DateTimeZone('UTC')), null); - yield array('2016-12-01T00:00:00+09:00', new \DateTime('2016/12/01', new \DateTimeZone('Japan')), new \DateTimeZone('Japan')); - yield array('2016-12-01T09:00:00+09:00', new \DateTime('2016/12/01', new \DateTimeZone('UTC')), new \DateTimeZone('Japan')); - yield array('2016-12-01T09:00:00+09:00', new \DateTimeImmutable('2016/12/01', new \DateTimeZone('UTC')), new \DateTimeZone('Japan')); + yield ['2016-12-01T00:00:00+00:00', new \DateTime('2016/12/01', new \DateTimeZone('UTC')), null]; + yield ['2016-12-01T00:00:00+09:00', new \DateTime('2016/12/01', new \DateTimeZone('Japan')), new \DateTimeZone('Japan')]; + yield ['2016-12-01T09:00:00+09:00', new \DateTime('2016/12/01', new \DateTimeZone('UTC')), new \DateTimeZone('Japan')]; + yield ['2016-12-01T09:00:00+09:00', new \DateTimeImmutable('2016/12/01', new \DateTimeZone('UTC')), new \DateTimeZone('Japan')]; + } + + /** + * @dataProvider normalizeUsingTimeZonePassedInContextAndExpectedFormatWithMicrosecondsProvider + */ + public function testNormalizeUsingTimeZonePassedInContextAndFormattedWithMicroseconds($expected, $expectedFormat, $input, $timezone) + { + $this->assertSame( + $expected, + $this->normalizer->normalize( + $input, + null, + [ + DateTimeNormalizer::TIMEZONE_KEY => $timezone, + DateTimeNormalizer::FORMAT_KEY => $expectedFormat, + ] + ) + ); + } + + public function normalizeUsingTimeZonePassedInContextAndExpectedFormatWithMicrosecondsProvider() + { + yield [ + '2018-12-01T18:03:06.067634', + 'Y-m-d\TH:i:s.u', + \DateTime::createFromFormat( + 'Y-m-d\TH:i:s.u', + '2018-12-01T18:03:06.067634', + new \DateTimeZone('UTC') + ), + null, + ]; + + yield [ + '2018-12-01T18:03:06.067634', + 'Y-m-d\TH:i:s.u', + \DateTime::createFromFormat( + 'Y-m-d\TH:i:s.u', + '2018-12-01T18:03:06.067634', + new \DateTimeZone('UTC') + ), + new \DateTimeZone('UTC'), + ]; + + yield [ + '2018-12-01T19:03:06.067634+01:00', + 'Y-m-d\TH:i:s.uP', + \DateTimeImmutable::createFromFormat( + 'Y-m-d\TH:i:s.u', + '2018-12-01T18:03:06.067634', + new \DateTimeZone('UTC') + ), + new \DateTimeZone('Europe/Rome'), + ]; + + yield [ + '2018-12-01T20:03:06.067634+02:00', + 'Y-m-d\TH:i:s.uP', + \DateTime::createFromFormat( + 'Y-m-d\TH:i:s.u', + '2018-12-01T18:03:06.067634', + new \DateTimeZone('UTC') + ), + new \DateTimeZone('Europe/Kiev'), + ]; + + yield [ + '2018-12-01T19:03:06.067634', + 'Y-m-d\TH:i:s.u', + \DateTime::createFromFormat( + 'Y-m-d\TH:i:s.u', + '2018-12-01T18:03:06.067634', + new \DateTimeZone('UTC') + ), + new \DateTimeZone('Europe/Berlin'), + ]; } /** @@ -108,16 +184,16 @@ public function testDenormalizeUsingTimezonePassedInConstructor() $expected = new \DateTime('2016/12/01 17:35:00', $timezone); $normalizer = new DateTimeNormalizer(null, $timezone); - $this->assertEquals($expected, $normalizer->denormalize('2016.12.01 17:35:00', \DateTime::class, null, array( + $this->assertEquals($expected, $normalizer->denormalize('2016.12.01 17:35:00', \DateTime::class, null, [ DateTimeNormalizer::FORMAT_KEY => 'Y.m.d H:i:s', - ))); + ])); } public function testDenormalizeUsingFormatPassedInContext() { - $this->assertEquals(new \DateTimeImmutable('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTimeInterface::class, null, array(DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|'))); - $this->assertEquals(new \DateTimeImmutable('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTimeImmutable::class, null, array(DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|'))); - $this->assertEquals(new \DateTime('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTime::class, null, array(DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|'))); + $this->assertEquals(new \DateTimeImmutable('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTimeInterface::class, null, [DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|'])); + $this->assertEquals(new \DateTimeImmutable('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTimeImmutable::class, null, [DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|'])); + $this->assertEquals(new \DateTime('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTime::class, null, [DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|'])); } /** @@ -125,38 +201,38 @@ public function testDenormalizeUsingFormatPassedInContext() */ public function testDenormalizeUsingTimezonePassedInContext($input, $expected, $timezone, $format = null) { - $actual = $this->normalizer->denormalize($input, \DateTimeInterface::class, null, array( + $actual = $this->normalizer->denormalize($input, \DateTimeInterface::class, null, [ DateTimeNormalizer::TIMEZONE_KEY => $timezone, DateTimeNormalizer::FORMAT_KEY => $format, - )); + ]); $this->assertEquals($expected, $actual); } public function denormalizeUsingTimezonePassedInContextProvider() { - yield 'with timezone' => array( + yield 'with timezone' => [ '2016/12/01 17:35:00', new \DateTimeImmutable('2016/12/01 17:35:00', new \DateTimeZone('Japan')), new \DateTimeZone('Japan'), - ); - yield 'with timezone as string' => array( + ]; + yield 'with timezone as string' => [ '2016/12/01 17:35:00', new \DateTimeImmutable('2016/12/01 17:35:00', new \DateTimeZone('Japan')), 'Japan', - ); - yield 'with format without timezone information' => array( + ]; + yield 'with format without timezone information' => [ '2016.12.01 17:35:00', new \DateTimeImmutable('2016/12/01 17:35:00', new \DateTimeZone('Japan')), new \DateTimeZone('Japan'), 'Y.m.d H:i:s', - ); - yield 'ignored with format with timezone information' => array( + ]; + yield 'ignored with format with timezone information' => [ '2016-12-01T17:35:00Z', new \DateTimeImmutable('2016/12/01 17:35:00', new \DateTimeZone('UTC')), 'Europe/Paris', \DateTime::RFC3339, - ); + ]; } /** @@ -190,6 +266,6 @@ public function testDenormalizeEmptyStringThrowsException() */ public function testDenormalizeFormatMismatchThrowsException() { - $this->normalizer->denormalize('2016-01-01T00:00:00+00:00', \DateTimeInterface::class, null, array(DateTimeNormalizer::FORMAT_KEY => 'Y-m-d|')); + $this->normalizer->denormalize('2016-01-01T00:00:00+00:00', \DateTimeInterface::class, null, [DateTimeNormalizer::FORMAT_KEY => 'Y-m-d|']); } } diff --git a/vendor/symfony/serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/vendor/symfony/serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index a087d3de093dd972842d4a98c6166eaec9f7f5e6..fe56c38ae43f176c4be65f0c127f126765da2bf7 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -67,14 +67,14 @@ public function testNormalize() ; $this->assertEquals( - array( + [ 'foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar', 'camelCase' => 'camelcase', 'object' => 'string_object', - ), + ], $this->normalizer->normalize($obj, 'any') ); } @@ -82,7 +82,7 @@ public function testNormalize() public function testDenormalize() { $obj = $this->normalizer->denormalize( - array('foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar'), + ['foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar'], __NAMESPACE__.'\GetSetDummy', 'any' ); @@ -110,7 +110,7 @@ public function testDenormalizeNull() public function testConstructorDenormalize() { $obj = $this->normalizer->denormalize( - array('foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar'), + ['foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar'], __NAMESPACE__.'\GetConstructorDummy', 'any'); $this->assertEquals('foo', $obj->getFoo()); $this->assertEquals('bar', $obj->getBar()); @@ -120,7 +120,7 @@ public function testConstructorDenormalize() public function testConstructorDenormalizeWithNullArgument() { $obj = $this->normalizer->denormalize( - array('foo' => 'foo', 'bar' => null, 'baz' => true), + ['foo' => 'foo', 'bar' => null, 'baz' => true], __NAMESPACE__.'\GetConstructorDummy', 'any'); $this->assertEquals('foo', $obj->getFoo()); $this->assertNull($obj->getBar()); @@ -130,19 +130,19 @@ public function testConstructorDenormalizeWithNullArgument() public function testConstructorDenormalizeWithMissingOptionalArgument() { $obj = $this->normalizer->denormalize( - array('foo' => 'test', 'baz' => array(1, 2, 3)), + ['foo' => 'test', 'baz' => [1, 2, 3]], __NAMESPACE__.'\GetConstructorOptionalArgsDummy', 'any'); $this->assertEquals('test', $obj->getFoo()); - $this->assertEquals(array(), $obj->getBar()); - $this->assertEquals(array(1, 2, 3), $obj->getBaz()); + $this->assertEquals([], $obj->getBar()); + $this->assertEquals([1, 2, 3], $obj->getBaz()); } public function testConstructorDenormalizeWithOptionalDefaultArgument() { $obj = $this->normalizer->denormalize( - array('bar' => 'test'), + ['bar' => 'test'], __NAMESPACE__.'\GetConstructorArgsWithDefaultValueDummy', 'any'); - $this->assertEquals(array(), $obj->getFoo()); + $this->assertEquals([], $obj->getFoo()); $this->assertEquals('test', $obj->getBar()); } @@ -152,9 +152,9 @@ public function testConstructorDenormalizeWithOptionalDefaultArgument() public function testConstructorDenormalizeWithVariadicArgument() { $obj = $this->normalizer->denormalize( - array('foo' => array(1, 2, 3)), + ['foo' => [1, 2, 3]], 'Symfony\Component\Serializer\Tests\Fixtures\VariadicConstructorArgsDummy', 'any'); - $this->assertEquals(array(1, 2, 3), $obj->getFoo()); + $this->assertEquals([1, 2, 3], $obj->getFoo()); } /** @@ -163,9 +163,9 @@ public function testConstructorDenormalizeWithVariadicArgument() public function testConstructorDenormalizeWithMissingVariadicArgument() { $obj = $this->normalizer->denormalize( - array(), + [], 'Symfony\Component\Serializer\Tests\Fixtures\VariadicConstructorArgsDummy', 'any'); - $this->assertEquals(array(), $obj->getFoo()); + $this->assertEquals([], $obj->getFoo()); } public function testConstructorWithObjectDenormalize() @@ -182,7 +182,7 @@ public function testConstructorWithObjectDenormalize() public function testConstructorWArgWithPrivateMutator() { - $obj = $this->normalizer->denormalize(array('foo' => 'bar'), __NAMESPACE__.'\ObjectConstructorArgsWithPrivateMutatorDummy', 'any'); + $obj = $this->normalizer->denormalize(['foo' => 'bar'], __NAMESPACE__.'\ObjectConstructorArgsWithPrivateMutatorDummy', 'any'); $this->assertEquals('bar', $obj->getFoo()); } @@ -200,18 +200,18 @@ public function testGroupsNormalize() $obj->setKevin('kevin'); $obj->setCoopTilleuls('coopTilleuls'); - $this->assertEquals(array( + $this->assertEquals([ 'bar' => 'bar', - ), $this->normalizer->normalize($obj, null, array(GetSetMethodNormalizer::GROUPS => array('c')))); + ], $this->normalizer->normalize($obj, null, [GetSetMethodNormalizer::GROUPS => ['c']])); - $this->assertEquals(array( + $this->assertEquals([ 'symfony' => 'symfony', 'foo' => 'foo', 'fooBar' => 'fooBar', 'bar' => 'bar', 'kevin' => 'kevin', 'coopTilleuls' => 'coopTilleuls', - ), $this->normalizer->normalize($obj, null, array(GetSetMethodNormalizer::GROUPS => array('a', 'c')))); + ], $this->normalizer->normalize($obj, null, [GetSetMethodNormalizer::GROUPS => ['a', 'c']])); } public function testGroupsDenormalize() @@ -223,13 +223,13 @@ public function testGroupsDenormalize() $obj = new GroupDummy(); $obj->setFoo('foo'); - $toNormalize = array('foo' => 'foo', 'bar' => 'bar'); + $toNormalize = ['foo' => 'foo', 'bar' => 'bar']; $normalized = $this->normalizer->denormalize( $toNormalize, 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, - array(GetSetMethodNormalizer::GROUPS => array('a')) + [GetSetMethodNormalizer::GROUPS => ['a']] ); $this->assertEquals($obj, $normalized); @@ -239,7 +239,7 @@ public function testGroupsDenormalize() $toNormalize, 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, - array(GetSetMethodNormalizer::GROUPS => array('a', 'b')) + [GetSetMethodNormalizer::GROUPS => ['a', 'b']] ); $this->assertEquals($obj, $normalized); } @@ -256,12 +256,12 @@ public function testGroupsNormalizeWithNameConverter() $obj->setCoopTilleuls('les-tilleuls.coop'); $this->assertEquals( - array( + [ 'bar' => null, 'foo_bar' => '@dunglas', 'symfony' => '@coopTilleuls', - ), - $this->normalizer->normalize($obj, null, array(GetSetMethodNormalizer::GROUPS => array('name_converter'))) + ], + $this->normalizer->normalize($obj, null, [GetSetMethodNormalizer::GROUPS => ['name_converter']]) ); } @@ -277,12 +277,12 @@ public function testGroupsDenormalizeWithNameConverter() $this->assertEquals( $obj, - $this->normalizer->denormalize(array( + $this->normalizer->denormalize([ 'bar' => null, 'foo_bar' => '@dunglas', 'symfony' => '@coopTilleuls', 'coop_tilleuls' => 'les-tilleuls.coop', - ), 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, array(GetSetMethodNormalizer::GROUPS => array('name_converter'))) + ], 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, [GetSetMethodNormalizer::GROUPS => ['name_converter']]) ); } @@ -307,7 +307,7 @@ public function testCallbacks($callbacks, $value, $result, $message) */ public function testUncallableCallbacks() { - $this->normalizer->setCallbacks(array('bar' => null)); + $this->normalizer->setCallbacks(['bar' => null]); $obj = new GetConstructorDummy('baz', 'quux', true); @@ -316,7 +316,7 @@ public function testUncallableCallbacks() public function testIgnoredAttributes() { - $this->normalizer->setIgnoredAttributes(array('foo', 'bar', 'baz', 'camelCase', 'object')); + $this->normalizer->setIgnoredAttributes(['foo', 'bar', 'baz', 'camelCase', 'object']); $obj = new GetSetDummy(); $obj->setFoo('foo'); @@ -324,45 +324,45 @@ public function testIgnoredAttributes() $obj->setBaz(true); $this->assertEquals( - array('fooBar' => 'foobar'), + ['fooBar' => 'foobar'], $this->normalizer->normalize($obj, 'any') ); } public function provideCallbacks() { - return array( - array( - array( + return [ + [ + [ 'bar' => function ($bar) { return 'baz'; }, - ), + ], 'baz', - array('foo' => '', 'bar' => 'baz', 'baz' => true), + ['foo' => '', 'bar' => 'baz', 'baz' => true], 'Change a string', - ), - array( - array( + ], + [ + [ 'bar' => function ($bar) { }, - ), + ], 'baz', - array('foo' => '', 'bar' => null, 'baz' => true), + ['foo' => '', 'bar' => null, 'baz' => true], 'Null an item', - ), - array( - array( + ], + [ + [ 'bar' => function ($bar) { return $bar->format('d-m-Y H:i:s'); }, - ), + ], new \DateTime('2011-09-10 06:30:00'), - array('foo' => '', 'bar' => '10-09-2011 06:30:00', 'baz' => true), + ['foo' => '', 'bar' => '10-09-2011 06:30:00', 'baz' => true], 'Format a date', - ), - array( - array( + ], + [ + [ 'bar' => function ($bars) { $foos = ''; foreach ($bars as $bar) { @@ -371,22 +371,22 @@ public function provideCallbacks() return $foos; }, - ), - array(new GetConstructorDummy('baz', '', false), new GetConstructorDummy('quux', '', false)), - array('foo' => '', 'bar' => 'bazquux', 'baz' => true), + ], + [new GetConstructorDummy('baz', '', false), new GetConstructorDummy('quux', '', false)], + ['foo' => '', 'bar' => 'bazquux', 'baz' => true], 'Collect a property', - ), - array( - array( + ], + [ + [ 'bar' => function ($bars) { return \count($bars); }, - ), - array(new GetConstructorDummy('baz', '', false), new GetConstructorDummy('quux', '', false)), - array('foo' => '', 'bar' => 2, 'baz' => true), + ], + [new GetConstructorDummy('baz', '', false), new GetConstructorDummy('quux', '', false)], + ['foo' => '', 'bar' => 2, 'baz' => true], 'Count a property', - ), - ); + ], + ]; } /** @@ -410,7 +410,7 @@ public function testUnableToNormalizeObjectAttribute() */ public function testUnableToNormalizeCircularReference() { - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $this->normalizer->setCircularReferenceLimit(2); @@ -421,22 +421,22 @@ public function testUnableToNormalizeCircularReference() public function testSiblingReference() { - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $siblingHolder = new SiblingHolder(); - $expected = array( - 'sibling0' => array('coopTilleuls' => 'Les-Tilleuls.coop'), - 'sibling1' => array('coopTilleuls' => 'Les-Tilleuls.coop'), - 'sibling2' => array('coopTilleuls' => 'Les-Tilleuls.coop'), - ); + $expected = [ + 'sibling0' => ['coopTilleuls' => 'Les-Tilleuls.coop'], + 'sibling1' => ['coopTilleuls' => 'Les-Tilleuls.coop'], + 'sibling2' => ['coopTilleuls' => 'Les-Tilleuls.coop'], + ]; $this->assertEquals($expected, $this->normalizer->normalize($siblingHolder)); } public function testCircularReferenceHandler() { - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $this->normalizer->setCircularReferenceHandler(function ($obj) { return \get_class($obj); @@ -444,7 +444,7 @@ public function testCircularReferenceHandler() $obj = new CircularReferenceDummy(); - $expected = array('me' => 'Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy'); + $expected = ['me' => 'Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy']; $this->assertEquals($expected, $this->normalizer->normalize($obj)); } @@ -454,10 +454,10 @@ public function testObjectToPopulate() $dummy->setFoo('foo'); $obj = $this->normalizer->denormalize( - array('bar' => 'bar'), + ['bar' => 'bar'], __NAMESPACE__.'\GetSetDummy', null, - array(GetSetMethodNormalizer::OBJECT_TO_POPULATE => $dummy) + [GetSetMethodNormalizer::OBJECT_TO_POPULATE => $dummy] ); $this->assertEquals($dummy, $obj); @@ -469,13 +469,13 @@ public function testDenormalizeNonExistingAttribute() { $this->assertEquals( new GetSetDummy(), - $this->normalizer->denormalize(array('non_existing' => true), __NAMESPACE__.'\GetSetDummy') + $this->normalizer->denormalize(['non_existing' => true], __NAMESPACE__.'\GetSetDummy') ); } public function testDenormalizeShouldNotSetStaticAttribute() { - $obj = $this->normalizer->denormalize(array('staticObject' => true), __NAMESPACE__.'\GetSetDummy'); + $obj = $this->normalizer->denormalize(['staticObject' => true], __NAMESPACE__.'\GetSetDummy'); $this->assertEquals(new GetSetDummy(), $obj); $this->assertNull(GetSetDummy::getStaticObject()); @@ -493,13 +493,13 @@ public function testNoStaticGetSetSupport() public function testPrivateSetter() { - $obj = $this->normalizer->denormalize(array('foo' => 'foobar'), __NAMESPACE__.'\ObjectWithPrivateSetterDummy'); + $obj = $this->normalizer->denormalize(['foo' => 'foobar'], __NAMESPACE__.'\ObjectWithPrivateSetterDummy'); $this->assertEquals('bar', $obj->getFoo()); } public function testHasGetterDenormalize() { - $obj = $this->normalizer->denormalize(array('foo' => true), ObjectWithHasGetterDummy::class); + $obj = $this->normalizer->denormalize(['foo' => true], ObjectWithHasGetterDummy::class); $this->assertTrue($obj->hasFoo()); } @@ -509,7 +509,7 @@ public function testHasGetterNormalize() $obj->setFoo(true); $this->assertEquals( - array('foo' => true), + ['foo' => true], $this->normalizer->normalize($obj, 'any') ); } @@ -518,7 +518,7 @@ public function testMaxDepth() { $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); $this->normalizer = new GetSetMethodNormalizer($classMetadataFactory); - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $level1 = new MaxDepthDummy(); @@ -536,20 +536,20 @@ public function testMaxDepth() $level4->bar = 'level4'; $level3->child = $level4; - $result = $serializer->normalize($level1, null, array(GetSetMethodNormalizer::ENABLE_MAX_DEPTH => true)); + $result = $serializer->normalize($level1, null, [GetSetMethodNormalizer::ENABLE_MAX_DEPTH => true]); - $expected = array( + $expected = [ 'bar' => 'level1', - 'child' => array( + 'child' => [ 'bar' => 'level2', - 'child' => array( + 'child' => [ 'bar' => 'level3', - 'child' => array( + 'child' => [ 'child' => null, - ), - ), - ), - ); + ], + ], + ], + ]; $this->assertEquals($expected, $result); } @@ -684,7 +684,7 @@ class GetConstructorOptionalArgsDummy private $bar; private $baz; - public function __construct($foo, $bar = array(), $baz = array()) + public function __construct($foo, $bar = [], $baz = []) { $this->foo = $foo; $this->bar = $bar; @@ -717,7 +717,7 @@ class GetConstructorArgsWithDefaultValueDummy protected $foo; protected $bar; - public function __construct($foo = array(), $bar) + public function __construct($foo = [], $bar) { $this->foo = $foo; $this->bar = $bar; diff --git a/vendor/symfony/serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php b/vendor/symfony/serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php index 065d92b99f05e05a3ce7a75c540b3f5411c7b2ed..c6b167cbbe13e5d40984c97ea5c0200443ead4ce 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php @@ -51,7 +51,7 @@ public function testNormalize() ->expects($this->once()) ->method('normalize') ->will($this->returnCallback(function ($data) { - $this->assertArraySubset(array('foo' => 'a', 'bar' => 'b', 'baz' => 'c'), $data); + $this->assertArraySubset(['foo' => 'a', 'bar' => 'b', 'baz' => 'c'], $data); return 'string_object'; })) diff --git a/vendor/symfony/serializer/Tests/Normalizer/ObjectNormalizerTest.php b/vendor/symfony/serializer/Tests/Normalizer/ObjectNormalizerTest.php index 0a855d22be72663e1f80561ad9e468d8ad261c32..4068479c87001e48bfc310677112280485f00b7a 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/ObjectNormalizerTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/ObjectNormalizerTest.php @@ -69,14 +69,14 @@ public function testNormalize() ; $this->assertEquals( - array( + [ 'foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar', 'camelCase' => 'camelcase', 'object' => 'string_object', - ), + ], $this->normalizer->normalize($obj, 'any') ); } @@ -84,7 +84,7 @@ public function testNormalize() public function testDenormalize() { $obj = $this->normalizer->denormalize( - array('foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar'), + ['foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar'], __NAMESPACE__.'\ObjectDummy', 'any' ); @@ -112,7 +112,7 @@ public function testDenormalizeNull() public function testConstructorDenormalize() { $obj = $this->normalizer->denormalize( - array('foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar'), + ['foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar'], __NAMESPACE__.'\ObjectConstructorDummy', 'any'); $this->assertEquals('foo', $obj->getFoo()); $this->assertEquals('bar', $obj->bar); @@ -122,7 +122,7 @@ public function testConstructorDenormalize() public function testConstructorDenormalizeWithNullArgument() { $obj = $this->normalizer->denormalize( - array('foo' => 'foo', 'bar' => null, 'baz' => true), + ['foo' => 'foo', 'bar' => null, 'baz' => true], __NAMESPACE__.'\ObjectConstructorDummy', 'any'); $this->assertEquals('foo', $obj->getFoo()); $this->assertNull($obj->bar); @@ -132,19 +132,19 @@ public function testConstructorDenormalizeWithNullArgument() public function testConstructorDenormalizeWithMissingOptionalArgument() { $obj = $this->normalizer->denormalize( - array('foo' => 'test', 'baz' => array(1, 2, 3)), + ['foo' => 'test', 'baz' => [1, 2, 3]], __NAMESPACE__.'\ObjectConstructorOptionalArgsDummy', 'any'); $this->assertEquals('test', $obj->getFoo()); - $this->assertEquals(array(), $obj->bar); - $this->assertEquals(array(1, 2, 3), $obj->getBaz()); + $this->assertEquals([], $obj->bar); + $this->assertEquals([1, 2, 3], $obj->getBaz()); } public function testConstructorDenormalizeWithOptionalDefaultArgument() { $obj = $this->normalizer->denormalize( - array('bar' => 'test'), + ['bar' => 'test'], __NAMESPACE__.'\ObjectConstructorArgsWithDefaultValueDummy', 'any'); - $this->assertEquals(array(), $obj->getFoo()); + $this->assertEquals([], $obj->getFoo()); $this->assertEquals('test', $obj->getBar()); } @@ -162,16 +162,16 @@ public function testConstructorWithObjectDenormalize() public function testConstructorWithObjectTypeHintDenormalize() { - $data = array( + $data = [ 'id' => 10, - 'inner' => array( + 'inner' => [ 'foo' => 'oof', 'bar' => 'rab', - ), - ); + ], + ]; $normalizer = new ObjectNormalizer(); - $serializer = new Serializer(array($normalizer)); + $serializer = new Serializer([$normalizer]); $normalizer->setSerializer($serializer); $obj = $normalizer->denormalize($data, DummyWithConstructorObject::class); @@ -188,16 +188,16 @@ public function testConstructorWithObjectTypeHintDenormalize() */ public function testConstructorWithUnknownObjectTypeHintDenormalize() { - $data = array( + $data = [ 'id' => 10, - 'unknown' => array( + 'unknown' => [ 'foo' => 'oof', 'bar' => 'rab', - ), - ); + ], + ]; $normalizer = new ObjectNormalizer(); - $serializer = new Serializer(array($normalizer)); + $serializer = new Serializer([$normalizer]); $normalizer->setSerializer($serializer); $normalizer->denormalize($data, DummyWithConstructorInexistingObject::class); @@ -217,18 +217,18 @@ public function testGroupsNormalize() $obj->setKevin('kevin'); $obj->setCoopTilleuls('coopTilleuls'); - $this->assertEquals(array( + $this->assertEquals([ 'bar' => 'bar', - ), $this->normalizer->normalize($obj, null, array(ObjectNormalizer::GROUPS => array('c')))); + ], $this->normalizer->normalize($obj, null, [ObjectNormalizer::GROUPS => ['c']])); - $this->assertEquals(array( + $this->assertEquals([ 'symfony' => 'symfony', 'foo' => 'foo', 'fooBar' => 'fooBar', 'bar' => 'bar', 'kevin' => 'kevin', 'coopTilleuls' => 'coopTilleuls', - ), $this->normalizer->normalize($obj, null, array(ObjectNormalizer::GROUPS => array('a', 'c')))); + ], $this->normalizer->normalize($obj, null, [ObjectNormalizer::GROUPS => ['a', 'c']])); } public function testGroupsDenormalize() @@ -240,13 +240,13 @@ public function testGroupsDenormalize() $obj = new GroupDummy(); $obj->setFoo('foo'); - $toNormalize = array('foo' => 'foo', 'bar' => 'bar'); + $toNormalize = ['foo' => 'foo', 'bar' => 'bar']; $normalized = $this->normalizer->denormalize( $toNormalize, 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, - array(ObjectNormalizer::GROUPS => array('a')) + [ObjectNormalizer::GROUPS => ['a']] ); $this->assertEquals($obj, $normalized); @@ -256,7 +256,7 @@ public function testGroupsDenormalize() $toNormalize, 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, - array(ObjectNormalizer::GROUPS => array('a', 'b')) + [ObjectNormalizer::GROUPS => ['a', 'b']] ); $this->assertEquals($obj, $normalized); } @@ -270,7 +270,7 @@ public function testNormalizeNoPropertyInGroup() $obj = new GroupDummy(); $obj->setFoo('foo'); - $this->assertEquals(array(), $this->normalizer->normalize($obj, null, array('groups' => array('notExist')))); + $this->assertEquals([], $this->normalizer->normalize($obj, null, ['groups' => ['notExist']])); } public function testGroupsNormalizeWithNameConverter() @@ -285,12 +285,12 @@ public function testGroupsNormalizeWithNameConverter() $obj->setCoopTilleuls('les-tilleuls.coop'); $this->assertEquals( - array( + [ 'bar' => null, 'foo_bar' => '@dunglas', 'symfony' => '@coopTilleuls', - ), - $this->normalizer->normalize($obj, null, array(ObjectNormalizer::GROUPS => array('name_converter'))) + ], + $this->normalizer->normalize($obj, null, [ObjectNormalizer::GROUPS => ['name_converter']]) ); } @@ -306,12 +306,12 @@ public function testGroupsDenormalizeWithNameConverter() $this->assertEquals( $obj, - $this->normalizer->denormalize(array( + $this->normalizer->denormalize([ 'bar' => null, 'foo_bar' => '@dunglas', 'symfony' => '@coopTilleuls', 'coop_tilleuls' => 'les-tilleuls.coop', - ), 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, array(ObjectNormalizer::GROUPS => array('name_converter'))) + ], 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, [ObjectNormalizer::GROUPS => ['name_converter']]) ); } @@ -336,7 +336,7 @@ public function testCallbacks($callbacks, $value, $result, $message) */ public function testUncallableCallbacks() { - $this->normalizer->setCallbacks(array('bar' => null)); + $this->normalizer->setCallbacks(['bar' => null]); $obj = new ObjectConstructorDummy('baz', 'quux', true); @@ -345,7 +345,7 @@ public function testUncallableCallbacks() public function testIgnoredAttributes() { - $this->normalizer->setIgnoredAttributes(array('foo', 'bar', 'baz', 'camelCase', 'object')); + $this->normalizer->setIgnoredAttributes(['foo', 'bar', 'baz', 'camelCase', 'object']); $obj = new ObjectDummy(); $obj->setFoo('foo'); @@ -353,59 +353,59 @@ public function testIgnoredAttributes() $obj->setBaz(true); $this->assertEquals( - array('fooBar' => 'foobar'), + ['fooBar' => 'foobar'], $this->normalizer->normalize($obj, 'any') ); } public function testIgnoredAttributesDenormalize() { - $this->normalizer->setIgnoredAttributes(array('fooBar', 'bar', 'baz')); + $this->normalizer->setIgnoredAttributes(['fooBar', 'bar', 'baz']); $obj = new ObjectDummy(); $obj->setFoo('foo'); $this->assertEquals( $obj, - $this->normalizer->denormalize(array('fooBar' => 'fooBar', 'foo' => 'foo', 'baz' => 'baz'), __NAMESPACE__.'\ObjectDummy') + $this->normalizer->denormalize(['fooBar' => 'fooBar', 'foo' => 'foo', 'baz' => 'baz'], __NAMESPACE__.'\ObjectDummy') ); } public function provideCallbacks() { - return array( - array( - array( + return [ + [ + [ 'bar' => function ($bar) { return 'baz'; }, - ), + ], 'baz', - array('foo' => '', 'bar' => 'baz', 'baz' => true), + ['foo' => '', 'bar' => 'baz', 'baz' => true], 'Change a string', - ), - array( - array( + ], + [ + [ 'bar' => function ($bar) { return; }, - ), + ], 'baz', - array('foo' => '', 'bar' => null, 'baz' => true), + ['foo' => '', 'bar' => null, 'baz' => true], 'Null an item', - ), - array( - array( + ], + [ + [ 'bar' => function ($bar) { return $bar->format('d-m-Y H:i:s'); }, - ), + ], new \DateTime('2011-09-10 06:30:00'), - array('foo' => '', 'bar' => '10-09-2011 06:30:00', 'baz' => true), + ['foo' => '', 'bar' => '10-09-2011 06:30:00', 'baz' => true], 'Format a date', - ), - array( - array( + ], + [ + [ 'bar' => function ($bars) { $foos = ''; foreach ($bars as $bar) { @@ -414,22 +414,22 @@ public function provideCallbacks() return $foos; }, - ), - array(new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)), - array('foo' => '', 'bar' => 'bazquux', 'baz' => true), + ], + [new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)], + ['foo' => '', 'bar' => 'bazquux', 'baz' => true], 'Collect a property', - ), - array( - array( + ], + [ + [ 'bar' => function ($bars) { return \count($bars); }, - ), - array(new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)), - array('foo' => '', 'bar' => 2, 'baz' => true), + ], + [new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)], + ['foo' => '', 'bar' => 2, 'baz' => true], 'Count a property', - ), - ); + ], + ]; } /** @@ -453,7 +453,7 @@ public function testUnableToNormalizeObjectAttribute() */ public function testUnableToNormalizeCircularReference() { - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $this->normalizer->setCircularReferenceLimit(2); @@ -464,22 +464,22 @@ public function testUnableToNormalizeCircularReference() public function testSiblingReference() { - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $siblingHolder = new SiblingHolder(); - $expected = array( - 'sibling0' => array('coopTilleuls' => 'Les-Tilleuls.coop'), - 'sibling1' => array('coopTilleuls' => 'Les-Tilleuls.coop'), - 'sibling2' => array('coopTilleuls' => 'Les-Tilleuls.coop'), - ); + $expected = [ + 'sibling0' => ['coopTilleuls' => 'Les-Tilleuls.coop'], + 'sibling1' => ['coopTilleuls' => 'Les-Tilleuls.coop'], + 'sibling2' => ['coopTilleuls' => 'Les-Tilleuls.coop'], + ]; $this->assertEquals($expected, $this->normalizer->normalize($siblingHolder)); } public function testCircularReferenceHandler() { - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $this->normalizer->setCircularReferenceHandler(function ($obj) { return \get_class($obj); @@ -487,7 +487,7 @@ public function testCircularReferenceHandler() $obj = new CircularReferenceDummy(); - $expected = array('me' => 'Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy'); + $expected = ['me' => 'Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy']; $this->assertEquals($expected, $this->normalizer->normalize($obj)); } @@ -495,7 +495,7 @@ public function testDenormalizeNonExistingAttribute() { $this->assertEquals( new ObjectDummy(), - $this->normalizer->denormalize(array('non_existing' => true), __NAMESPACE__.'\ObjectDummy') + $this->normalizer->denormalize(['non_existing' => true], __NAMESPACE__.'\ObjectDummy') ); } @@ -506,35 +506,35 @@ public function testNoTraversableSupport() public function testNormalizeStatic() { - $this->assertEquals(array('foo' => 'K'), $this->normalizer->normalize(new ObjectWithStaticPropertiesAndMethods())); + $this->assertEquals(['foo' => 'K'], $this->normalizer->normalize(new ObjectWithStaticPropertiesAndMethods())); } public function testNormalizeUpperCaseAttributes() { - $this->assertEquals(array('Foo' => 'Foo', 'Bar' => 'BarBar'), $this->normalizer->normalize(new ObjectWithUpperCaseAttributeNames())); + $this->assertEquals(['Foo' => 'Foo', 'Bar' => 'BarBar'], $this->normalizer->normalize(new ObjectWithUpperCaseAttributeNames())); } public function testNormalizeNotSerializableContext() { $objectDummy = new ObjectDummy(); - $expected = array( + $expected = [ 'foo' => null, 'baz' => null, 'fooBar' => '', 'camelCase' => null, 'object' => null, 'bar' => null, - ); + ]; - $this->assertEquals($expected, $this->normalizer->normalize($objectDummy, null, array('not_serializable' => function () { - }))); + $this->assertEquals($expected, $this->normalizer->normalize($objectDummy, null, ['not_serializable' => function () { + }])); } public function testMaxDepth() { $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); $this->normalizer = new ObjectNormalizer($classMetadataFactory); - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $level1 = new MaxDepthDummy(); @@ -548,20 +548,20 @@ public function testMaxDepth() $level3->foo = 'level3'; $level2->child = $level3; - $result = $serializer->normalize($level1, null, array(ObjectNormalizer::ENABLE_MAX_DEPTH => true)); + $result = $serializer->normalize($level1, null, [ObjectNormalizer::ENABLE_MAX_DEPTH => true]); - $expected = array( + $expected = [ 'bar' => null, 'foo' => 'level1', - 'child' => array( + 'child' => [ 'bar' => null, 'foo' => 'level2', - 'child' => array( + 'child' => [ 'bar' => null, 'child' => null, - ), - ), - ); + ], + ], + ]; $this->assertEquals($expected, $result); } @@ -571,20 +571,20 @@ public function testMaxDepth() */ public function testThrowUnexpectedValueException() { - $this->normalizer->denormalize(array('foo' => 'bar'), ObjectTypeHinted::class); + $this->normalizer->denormalize(['foo' => 'bar'], ObjectTypeHinted::class); } public function testDenomalizeRecursive() { - $extractor = new PropertyInfoExtractor(array(), array(new PhpDocExtractor(), new ReflectionExtractor())); + $extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]); $normalizer = new ObjectNormalizer(null, null, null, $extractor); - $serializer = new Serializer(array(new ArrayDenormalizer(), new DateTimeNormalizer(), $normalizer)); + $serializer = new Serializer([new ArrayDenormalizer(), new DateTimeNormalizer(), $normalizer]); - $obj = $serializer->denormalize(array( - 'inner' => array('foo' => 'foo', 'bar' => 'bar'), + $obj = $serializer->denormalize([ + 'inner' => ['foo' => 'foo', 'bar' => 'bar'], 'date' => '1988/01/21', - 'inners' => array(array('foo' => 1), array('foo' => 2)), - ), ObjectOuter::class); + 'inners' => [['foo' => 1], ['foo' => 2]], + ], ObjectOuter::class); $this->assertSame('foo', $obj->getInner()->foo); $this->assertSame('bar', $obj->getInner()->bar); @@ -595,12 +595,12 @@ public function testDenomalizeRecursive() public function testAcceptJsonNumber() { - $extractor = new PropertyInfoExtractor(array(), array(new PhpDocExtractor(), new ReflectionExtractor())); + $extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]); $normalizer = new ObjectNormalizer(null, null, null, $extractor); - $serializer = new Serializer(array(new ArrayDenormalizer(), new DateTimeNormalizer(), $normalizer)); + $serializer = new Serializer([new ArrayDenormalizer(), new DateTimeNormalizer(), $normalizer]); - $this->assertSame(10.0, $serializer->denormalize(array('number' => 10), JsonNumber::class, 'json')->number); - $this->assertSame(10.0, $serializer->denormalize(array('number' => 10), JsonNumber::class, 'jsonld')->number); + $this->assertSame(10.0, $serializer->denormalize(['number' => 10], JsonNumber::class, 'json')->number); + $this->assertSame(10.0, $serializer->denormalize(['number' => 10], JsonNumber::class, 'jsonld')->number); } /** @@ -610,9 +610,9 @@ public function testAcceptJsonNumber() public function testRejectInvalidType() { $normalizer = new ObjectNormalizer(null, null, null, new ReflectionExtractor()); - $serializer = new Serializer(array($normalizer)); + $serializer = new Serializer([$normalizer]); - $serializer->denormalize(array('date' => 'foo'), ObjectOuter::class); + $serializer->denormalize(['date' => 'foo'], ObjectOuter::class); } /** @@ -621,21 +621,21 @@ public function testRejectInvalidType() */ public function testRejectInvalidKey() { - $extractor = new PropertyInfoExtractor(array(), array(new PhpDocExtractor(), new ReflectionExtractor())); + $extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]); $normalizer = new ObjectNormalizer(null, null, null, $extractor); - $serializer = new Serializer(array(new ArrayDenormalizer(), new DateTimeNormalizer(), $normalizer)); + $serializer = new Serializer([new ArrayDenormalizer(), new DateTimeNormalizer(), $normalizer]); - $serializer->denormalize(array('inners' => array('a' => array('foo' => 1))), ObjectOuter::class); + $serializer->denormalize(['inners' => ['a' => ['foo' => 1]]], ObjectOuter::class); } public function testDoNotRejectInvalidTypeOnDisableTypeEnforcementContextOption() { - $extractor = new PropertyInfoExtractor(array(), array(new PhpDocExtractor())); + $extractor = new PropertyInfoExtractor([], [new PhpDocExtractor()]); $normalizer = new ObjectNormalizer(null, null, null, $extractor); - $serializer = new Serializer(array($normalizer)); - $context = array(ObjectNormalizer::DISABLE_TYPE_ENFORCEMENT => true); + $serializer = new Serializer([$normalizer]); + $context = [ObjectNormalizer::DISABLE_TYPE_ENFORCEMENT => true]; - $this->assertSame('foo', $serializer->denormalize(array('number' => 'foo'), JsonNumber::class, null, $context)->number); + $this->assertSame('foo', $serializer->denormalize(['number' => 'foo'], JsonNumber::class, null, $context)->number); } public function testExtractAttributesRespectsFormat() @@ -646,7 +646,7 @@ public function testExtractAttributesRespectsFormat() $data->setFoo('bar'); $data->bar = 'foo'; - $this->assertSame(array('foo' => 'bar', 'bar' => 'foo'), $normalizer->normalize($data, 'foo_and_bar_included')); + $this->assertSame(['foo' => 'bar', 'bar' => 'foo'], $normalizer->normalize($data, 'foo_and_bar_included')); } public function testExtractAttributesRespectsContext() @@ -657,13 +657,13 @@ public function testExtractAttributesRespectsContext() $data->setFoo('bar'); $data->bar = 'foo'; - $this->assertSame(array('foo' => 'bar', 'bar' => 'foo'), $normalizer->normalize($data, null, array('include_foo_and_bar' => true))); + $this->assertSame(['foo' => 'bar', 'bar' => 'foo'], $normalizer->normalize($data, null, ['include_foo_and_bar' => true])); } public function testAttributesContextNormalize() { $normalizer = new ObjectNormalizer(); - $serializer = new Serializer(array($normalizer)); + $serializer = new Serializer([$normalizer]); $objectInner = new ObjectInner(); $objectInner->foo = 'innerFoo'; @@ -674,23 +674,23 @@ public function testAttributesContextNormalize() $objectDummy->setBaz(true); $objectDummy->setObject($objectInner); - $context = array('attributes' => array('foo', 'baz', 'object' => array('foo'))); + $context = ['attributes' => ['foo', 'baz', 'object' => ['foo']]]; $this->assertEquals( - array( + [ 'foo' => 'foo', 'baz' => true, - 'object' => array('foo' => 'innerFoo'), - ), + 'object' => ['foo' => 'innerFoo'], + ], $serializer->normalize($objectDummy, null, $context) ); - $context = array('attributes' => array('foo', 'baz', 'object')); + $context = ['attributes' => ['foo', 'baz', 'object']]; $this->assertEquals( - array( + [ 'foo' => 'foo', 'baz' => true, - 'object' => array('foo' => 'innerFoo', 'bar' => 'innerBar'), - ), + 'object' => ['foo' => 'innerFoo', 'bar' => 'innerBar'], + ], $serializer->normalize($objectDummy, null, $context) ); } @@ -698,7 +698,7 @@ public function testAttributesContextNormalize() public function testAttributesContextDenormalize() { $normalizer = new ObjectNormalizer(null, null, null, new ReflectionExtractor()); - $serializer = new Serializer(array($normalizer)); + $serializer = new Serializer([$normalizer]); $objectInner = new ObjectInner(); $objectInner->foo = 'innerFoo'; @@ -707,38 +707,38 @@ public function testAttributesContextDenormalize() $objectOuter->bar = 'bar'; $objectOuter->setInner($objectInner); - $context = array('attributes' => array('bar', 'inner' => array('foo'))); + $context = ['attributes' => ['bar', 'inner' => ['foo']]]; $this->assertEquals($objectOuter, $serializer->denormalize( - array( + [ 'foo' => 'foo', 'bar' => 'bar', 'date' => '2017-02-03', - 'inner' => array('foo' => 'innerFoo', 'bar' => 'innerBar'), - ), ObjectOuter::class, null, $context)); + 'inner' => ['foo' => 'innerFoo', 'bar' => 'innerBar'], + ], ObjectOuter::class, null, $context)); } public function testAttributesContextDenormalizeConstructor() { $normalizer = new ObjectNormalizer(null, null, null, new ReflectionExtractor()); - $serializer = new Serializer(array($normalizer)); + $serializer = new Serializer([$normalizer]); $objectInner = new ObjectInner(); $objectInner->bar = 'bar'; $obj = new DummyWithConstructorObjectAndDefaultValue('a', $objectInner); - $context = array('attributes' => array('inner' => array('bar'))); - $this->assertEquals($obj, $serializer->denormalize(array( + $context = ['attributes' => ['inner' => ['bar']]]; + $this->assertEquals($obj, $serializer->denormalize([ 'foo' => 'b', - 'inner' => array('foo' => 'foo', 'bar' => 'bar'), - ), DummyWithConstructorObjectAndDefaultValue::class, null, $context)); + 'inner' => ['foo' => 'foo', 'bar' => 'bar'], + ], DummyWithConstructorObjectAndDefaultValue::class, null, $context)); } public function testNormalizeSameObjectWithDifferentAttributes() { $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); $this->normalizer = new ObjectNormalizer($classMetadataFactory); - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $dummy = new ObjectOuter(); @@ -750,19 +750,19 @@ public function testNormalizeSameObjectWithDifferentAttributes() $dummy->bar->foo = 'bar.foo'; $dummy->bar->bar = 'bar.bar'; - $this->assertEquals(array( - 'foo' => array( + $this->assertEquals([ + 'foo' => [ 'bar' => 'foo.bar', - ), - 'bar' => array( + ], + 'bar' => [ 'foo' => 'bar.foo', - ), - ), $this->normalizer->normalize($dummy, 'json', array( - 'attributes' => array( - 'foo' => array('bar'), - 'bar' => array('foo'), - ), - ))); + ], + ], $this->normalizer->normalize($dummy, 'json', [ + 'attributes' => [ + 'foo' => ['bar'], + 'bar' => ['foo'], + ], + ])); } } @@ -864,7 +864,7 @@ class ObjectConstructorOptionalArgsDummy public $bar; private $baz; - public function __construct($foo, $bar = array(), $baz = array()) + public function __construct($foo, $bar = [], $baz = []) { $this->foo = $foo; $this->bar = $bar; @@ -892,7 +892,7 @@ class ObjectConstructorArgsWithDefaultValueDummy protected $foo; protected $bar; - public function __construct($foo = array(), $bar) + public function __construct($foo = [], $bar) { $this->foo = $foo; $this->bar = $bar; @@ -983,13 +983,13 @@ class ObjectInner class FormatAndContextAwareNormalizer extends ObjectNormalizer { - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = array()) + protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) { - if (\in_array($attribute, array('foo', 'bar')) && 'foo_and_bar_included' === $format) { + if (\in_array($attribute, ['foo', 'bar']) && 'foo_and_bar_included' === $format) { return true; } - if (\in_array($attribute, array('foo', 'bar')) && isset($context['include_foo_and_bar']) && true === $context['include_foo_and_bar']) { + if (\in_array($attribute, ['foo', 'bar']) && isset($context['include_foo_and_bar']) && true === $context['include_foo_and_bar']) { return true; } diff --git a/vendor/symfony/serializer/Tests/Normalizer/ObjectToPopulateTraitTest.php b/vendor/symfony/serializer/Tests/Normalizer/ObjectToPopulateTraitTest.php index def71e5def5d7a48d69381a2c1af74d88f8e6426..aa924be0dc9225d20772876bc7e71160d1b8addf 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/ObjectToPopulateTraitTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/ObjectToPopulateTraitTest.php @@ -12,25 +12,25 @@ class ObjectToPopulateTraitTest extends TestCase public function testExtractObjectToPopulateReturnsNullWhenKeyIsMissing() { - $object = $this->extractObjectToPopulate(ProxyDummy::class, array()); + $object = $this->extractObjectToPopulate(ProxyDummy::class, []); $this->assertNull($object); } public function testExtractObjectToPopulateReturnsNullWhenNonObjectIsProvided() { - $object = $this->extractObjectToPopulate(ProxyDummy::class, array( + $object = $this->extractObjectToPopulate(ProxyDummy::class, [ 'object_to_populate' => 'not an object', - )); + ]); $this->assertNull($object); } public function testExtractObjectToPopulateReturnsNullWhenTheClassIsNotAnInstanceOfTheProvidedClass() { - $object = $this->extractObjectToPopulate(ProxyDummy::class, array( + $object = $this->extractObjectToPopulate(ProxyDummy::class, [ 'object_to_populate' => new \stdClass(), - )); + ]); $this->assertNull($object); } @@ -38,9 +38,9 @@ public function testExtractObjectToPopulateReturnsNullWhenTheClassIsNotAnInstanc public function testExtractObjectToPopulateReturnsObjectWhenEverythingChecksOut() { $expected = new ProxyDummy(); - $object = $this->extractObjectToPopulate(ProxyDummy::class, array( + $object = $this->extractObjectToPopulate(ProxyDummy::class, [ 'object_to_populate' => $expected, - )); + ]); $this->assertSame($expected, $object); } diff --git a/vendor/symfony/serializer/Tests/Normalizer/PropertyNormalizerTest.php b/vendor/symfony/serializer/Tests/Normalizer/PropertyNormalizerTest.php index 26273b3a5b85da1ee77c0f050d42462b9c53fdd1..f8d1eb8db8d7fe518bc559a82a094395d83eb55a 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/PropertyNormalizerTest.php +++ b/vendor/symfony/serializer/Tests/Normalizer/PropertyNormalizerTest.php @@ -50,7 +50,7 @@ public function testNormalize() $obj->setBar('bar'); $obj->setCamelCase('camelcase'); $this->assertEquals( - array('foo' => 'foo', 'bar' => 'bar', 'camelCase' => 'camelcase'), + ['foo' => 'foo', 'bar' => 'bar', 'camelCase' => 'camelcase'], $this->normalizer->normalize($obj, 'any') ); } @@ -58,7 +58,7 @@ public function testNormalize() public function testDenormalize() { $obj = $this->normalizer->denormalize( - array('foo' => 'foo', 'bar' => 'bar'), + ['foo' => 'foo', 'bar' => 'bar'], __NAMESPACE__.'\PropertyDummy', 'any' ); @@ -75,8 +75,7 @@ public function testNormalizeWithParentClass() $group->setKevin('Kevin'); $group->setCoopTilleuls('coop'); $this->assertEquals( - array('foo' => 'foo', 'bar' => 'bar', 'kevin' => 'Kevin', - 'coopTilleuls' => 'coop', 'fooBar' => null, 'symfony' => null, 'baz' => 'baz', ), + ['foo' => 'foo', 'bar' => 'bar', 'kevin' => 'Kevin', 'coopTilleuls' => 'coop', 'fooBar' => null, 'symfony' => null, 'baz' => 'baz'], $this->normalizer->normalize($group, 'any') ); } @@ -84,7 +83,7 @@ public function testNormalizeWithParentClass() public function testDenormalizeWithParentClass() { $obj = $this->normalizer->denormalize( - array('foo' => 'foo', 'bar' => 'bar', 'kevin' => 'Kevin', 'baz' => 'baz'), + ['foo' => 'foo', 'bar' => 'bar', 'kevin' => 'Kevin', 'baz' => 'baz'], GroupDummyChild::class, 'any' ); @@ -98,7 +97,7 @@ public function testDenormalizeWithParentClass() public function testConstructorDenormalize() { $obj = $this->normalizer->denormalize( - array('foo' => 'foo', 'bar' => 'bar'), + ['foo' => 'foo', 'bar' => 'bar'], __NAMESPACE__.'\PropertyConstructorDummy', 'any' ); @@ -109,7 +108,7 @@ public function testConstructorDenormalize() public function testConstructorDenormalizeWithNullArgument() { $obj = $this->normalizer->denormalize( - array('foo' => null, 'bar' => 'bar'), + ['foo' => null, 'bar' => 'bar'], __NAMESPACE__.'\PropertyConstructorDummy', ' any' ); @@ -138,7 +137,7 @@ public function testCallbacks($callbacks, $value, $result, $message) */ public function testUncallableCallbacks() { - $this->normalizer->setCallbacks(array('bar' => null)); + $this->normalizer->setCallbacks(['bar' => null]); $obj = new PropertyConstructorDummy('baz', 'quux'); @@ -147,14 +146,14 @@ public function testUncallableCallbacks() public function testIgnoredAttributes() { - $this->normalizer->setIgnoredAttributes(array('foo', 'bar', 'camelCase')); + $this->normalizer->setIgnoredAttributes(['foo', 'bar', 'camelCase']); $obj = new PropertyDummy(); $obj->foo = 'foo'; $obj->setBar('bar'); $this->assertEquals( - array(), + [], $this->normalizer->normalize($obj, 'any') ); } @@ -173,19 +172,19 @@ public function testGroupsNormalize() $obj->setKevin('kevin'); $obj->setCoopTilleuls('coopTilleuls'); - $this->assertEquals(array( + $this->assertEquals([ 'bar' => 'bar', - ), $this->normalizer->normalize($obj, null, array(PropertyNormalizer::GROUPS => array('c')))); + ], $this->normalizer->normalize($obj, null, [PropertyNormalizer::GROUPS => ['c']])); // The PropertyNormalizer is also able to hydrate properties from parent classes - $this->assertEquals(array( + $this->assertEquals([ 'symfony' => 'symfony', 'foo' => 'foo', 'fooBar' => 'fooBar', 'bar' => 'bar', 'kevin' => 'kevin', 'coopTilleuls' => 'coopTilleuls', - ), $this->normalizer->normalize($obj, null, array(PropertyNormalizer::GROUPS => array('a', 'c')))); + ], $this->normalizer->normalize($obj, null, [PropertyNormalizer::GROUPS => ['a', 'c']])); } public function testGroupsDenormalize() @@ -197,13 +196,13 @@ public function testGroupsDenormalize() $obj = new GroupDummy(); $obj->setFoo('foo'); - $toNormalize = array('foo' => 'foo', 'bar' => 'bar'); + $toNormalize = ['foo' => 'foo', 'bar' => 'bar']; $normalized = $this->normalizer->denormalize( $toNormalize, 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, - array(PropertyNormalizer::GROUPS => array('a')) + [PropertyNormalizer::GROUPS => ['a']] ); $this->assertEquals($obj, $normalized); @@ -213,7 +212,7 @@ public function testGroupsDenormalize() $toNormalize, 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, - array(PropertyNormalizer::GROUPS => array('a', 'b')) + [PropertyNormalizer::GROUPS => ['a', 'b']] ); $this->assertEquals($obj, $normalized); } @@ -230,12 +229,12 @@ public function testGroupsNormalizeWithNameConverter() $obj->setCoopTilleuls('les-tilleuls.coop'); $this->assertEquals( - array( + [ 'bar' => null, 'foo_bar' => '@dunglas', 'symfony' => '@coopTilleuls', - ), - $this->normalizer->normalize($obj, null, array(PropertyNormalizer::GROUPS => array('name_converter'))) + ], + $this->normalizer->normalize($obj, null, [PropertyNormalizer::GROUPS => ['name_converter']]) ); } @@ -251,50 +250,50 @@ public function testGroupsDenormalizeWithNameConverter() $this->assertEquals( $obj, - $this->normalizer->denormalize(array( + $this->normalizer->denormalize([ 'bar' => null, 'foo_bar' => '@dunglas', 'symfony' => '@coopTilleuls', 'coop_tilleuls' => 'les-tilleuls.coop', - ), 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, array(PropertyNormalizer::GROUPS => array('name_converter'))) + ], 'Symfony\Component\Serializer\Tests\Fixtures\GroupDummy', null, [PropertyNormalizer::GROUPS => ['name_converter']]) ); } public function provideCallbacks() { - return array( - array( - array( + return [ + [ + [ 'bar' => function ($bar) { return 'baz'; }, - ), + ], 'baz', - array('foo' => '', 'bar' => 'baz'), + ['foo' => '', 'bar' => 'baz'], 'Change a string', - ), - array( - array( + ], + [ + [ 'bar' => function ($bar) { return; }, - ), + ], 'baz', - array('foo' => '', 'bar' => null), + ['foo' => '', 'bar' => null], 'Null an item', - ), - array( - array( + ], + [ + [ 'bar' => function ($bar) { return $bar->format('d-m-Y H:i:s'); }, - ), + ], new \DateTime('2011-09-10 06:30:00'), - array('foo' => '', 'bar' => '10-09-2011 06:30:00'), + ['foo' => '', 'bar' => '10-09-2011 06:30:00'], 'Format a date', - ), - array( - array( + ], + [ + [ 'bar' => function ($bars) { $foos = ''; foreach ($bars as $bar) { @@ -303,22 +302,22 @@ public function provideCallbacks() return $foos; }, - ), - array(new PropertyConstructorDummy('baz', ''), new PropertyConstructorDummy('quux', '')), - array('foo' => '', 'bar' => 'bazquux'), + ], + [new PropertyConstructorDummy('baz', ''), new PropertyConstructorDummy('quux', '')], + ['foo' => '', 'bar' => 'bazquux'], 'Collect a property', - ), - array( - array( + ], + [ + [ 'bar' => function ($bars) { return \count($bars); }, - ), - array(new PropertyConstructorDummy('baz', ''), new PropertyConstructorDummy('quux', '')), - array('foo' => '', 'bar' => 2), + ], + [new PropertyConstructorDummy('baz', ''), new PropertyConstructorDummy('quux', '')], + ['foo' => '', 'bar' => 2], 'Count a property', - ), - ); + ], + ]; } /** @@ -326,7 +325,7 @@ public function provideCallbacks() */ public function testUnableToNormalizeCircularReference() { - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $this->normalizer->setCircularReferenceLimit(2); @@ -337,22 +336,22 @@ public function testUnableToNormalizeCircularReference() public function testSiblingReference() { - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $siblingHolder = new PropertySiblingHolder(); - $expected = array( - 'sibling0' => array('coopTilleuls' => 'Les-Tilleuls.coop'), - 'sibling1' => array('coopTilleuls' => 'Les-Tilleuls.coop'), - 'sibling2' => array('coopTilleuls' => 'Les-Tilleuls.coop'), - ); + $expected = [ + 'sibling0' => ['coopTilleuls' => 'Les-Tilleuls.coop'], + 'sibling1' => ['coopTilleuls' => 'Les-Tilleuls.coop'], + 'sibling2' => ['coopTilleuls' => 'Les-Tilleuls.coop'], + ]; $this->assertEquals($expected, $this->normalizer->normalize($siblingHolder)); } public function testCircularReferenceHandler() { - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $this->normalizer->setCircularReferenceHandler(function ($obj) { return \get_class($obj); @@ -360,7 +359,7 @@ public function testCircularReferenceHandler() $obj = new PropertyCircularReferenceDummy(); - $expected = array('me' => 'Symfony\Component\Serializer\Tests\Fixtures\PropertyCircularReferenceDummy'); + $expected = ['me' => 'Symfony\Component\Serializer\Tests\Fixtures\PropertyCircularReferenceDummy']; $this->assertEquals($expected, $this->normalizer->normalize($obj)); } @@ -368,13 +367,13 @@ public function testDenormalizeNonExistingAttribute() { $this->assertEquals( new PropertyDummy(), - $this->normalizer->denormalize(array('non_existing' => true), __NAMESPACE__.'\PropertyDummy') + $this->normalizer->denormalize(['non_existing' => true], __NAMESPACE__.'\PropertyDummy') ); } public function testDenormalizeShouldIgnoreStaticProperty() { - $obj = $this->normalizer->denormalize(array('outOfScope' => true), __NAMESPACE__.'\PropertyDummy'); + $obj = $this->normalizer->denormalize(['outOfScope' => true], __NAMESPACE__.'\PropertyDummy'); $this->assertEquals(new PropertyDummy(), $obj); $this->assertEquals('out_of_scope', PropertyDummy::$outOfScope); @@ -410,7 +409,7 @@ public function testMaxDepth() { $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); $this->normalizer = new PropertyNormalizer($classMetadataFactory); - $serializer = new Serializer(array($this->normalizer)); + $serializer = new Serializer([$this->normalizer]); $this->normalizer->setSerializer($serializer); $level1 = new MaxDepthDummy(); @@ -424,20 +423,20 @@ public function testMaxDepth() $level3->foo = 'level3'; $level2->child = $level3; - $result = $serializer->normalize($level1, null, array(PropertyNormalizer::ENABLE_MAX_DEPTH => true)); + $result = $serializer->normalize($level1, null, [PropertyNormalizer::ENABLE_MAX_DEPTH => true]); - $expected = array( + $expected = [ 'foo' => 'level1', - 'child' => array( + 'child' => [ 'foo' => 'level2', - 'child' => array( + 'child' => [ 'child' => null, 'bar' => null, - ), + ], 'bar' => null, - ), + ], 'bar' => null, - ); + ]; $this->assertEquals($expected, $result); } diff --git a/vendor/symfony/serializer/Tests/Normalizer/TestDenormalizer.php b/vendor/symfony/serializer/Tests/Normalizer/TestDenormalizer.php index 7525d5c92888edaf90f9ae98cdcef1e1d7551c26..036d2bb84cd5def43d7273030d10cdf89aba46a1 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/TestDenormalizer.php +++ b/vendor/symfony/serializer/Tests/Normalizer/TestDenormalizer.php @@ -23,7 +23,7 @@ class TestDenormalizer implements DenormalizerInterface /** * {@inheritdoc} */ - public function denormalize($data, $class, $format = null, array $context = array()) + public function denormalize($data, $class, $format = null, array $context = []) { } diff --git a/vendor/symfony/serializer/Tests/Normalizer/TestNormalizer.php b/vendor/symfony/serializer/Tests/Normalizer/TestNormalizer.php index 4b29e8fa5d10c5d268349eb605ddaa02f49b8237..ea57d2dfff541398c57512dd849fe59b1131dc98 100644 --- a/vendor/symfony/serializer/Tests/Normalizer/TestNormalizer.php +++ b/vendor/symfony/serializer/Tests/Normalizer/TestNormalizer.php @@ -23,7 +23,7 @@ class TestNormalizer implements NormalizerInterface /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = array()) + public function normalize($object, $format = null, array $context = []) { } diff --git a/vendor/symfony/serializer/Tests/SerializerTest.php b/vendor/symfony/serializer/Tests/SerializerTest.php index e320bee3a6da9e432185031b0c235d5da4c0e6f1..405317d5fb26a346ff4ab7ff850a364630b09f97 100644 --- a/vendor/symfony/serializer/Tests/SerializerTest.php +++ b/vendor/symfony/serializer/Tests/SerializerTest.php @@ -46,20 +46,20 @@ public function testInterface() */ public function testNormalizeNoMatch() { - $serializer = new Serializer(array($this->getMockBuilder('Symfony\Component\Serializer\Normalizer\CustomNormalizer')->getMock())); + $serializer = new Serializer([$this->getMockBuilder('Symfony\Component\Serializer\Normalizer\CustomNormalizer')->getMock()]); $serializer->normalize(new \stdClass(), 'xml'); } public function testNormalizeTraversable() { - $serializer = new Serializer(array(), array('json' => new JsonEncoder())); + $serializer = new Serializer([], ['json' => new JsonEncoder()]); $result = $serializer->serialize(new TraversableDummy(), 'json'); $this->assertEquals('{"foo":"foo","bar":"bar"}', $result); } public function testNormalizeGivesPriorityToInterfaceOverTraversable() { - $serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder())); + $serializer = new Serializer([new CustomNormalizer()], ['json' => new JsonEncoder()]); $result = $serializer->serialize(new NormalizableTraversableDummy(), 'json'); $this->assertEquals('{"foo":"normalizedFoo","bar":"normalizedBar"}', $result); } @@ -69,7 +69,7 @@ public function testNormalizeGivesPriorityToInterfaceOverTraversable() */ public function testNormalizeOnDenormalizer() { - $serializer = new Serializer(array(new TestDenormalizer()), array()); + $serializer = new Serializer([new TestDenormalizer()], []); $this->assertTrue($serializer->normalize(new \stdClass(), 'json')); } @@ -78,7 +78,7 @@ public function testNormalizeOnDenormalizer() */ public function testDenormalizeNoMatch() { - $serializer = new Serializer(array($this->getMockBuilder('Symfony\Component\Serializer\Normalizer\CustomNormalizer')->getMock())); + $serializer = new Serializer([$this->getMockBuilder('Symfony\Component\Serializer\Normalizer\CustomNormalizer')->getMock()]); $serializer->denormalize('foo', 'stdClass'); } @@ -87,17 +87,17 @@ public function testDenormalizeNoMatch() */ public function testDenormalizeOnNormalizer() { - $serializer = new Serializer(array(new TestNormalizer()), array()); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([new TestNormalizer()], []); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $this->assertTrue($serializer->denormalize(json_encode($data), 'stdClass', 'json')); } public function testCustomNormalizerCanNormalizeCollectionsAndScalar() { - $serializer = new Serializer(array(new TestNormalizer()), array()); - $this->assertNull($serializer->normalize(array('a', 'b'))); - $this->assertNull($serializer->normalize(new \ArrayObject(array('c', 'd')))); - $this->assertNull($serializer->normalize(array())); + $serializer = new Serializer([new TestNormalizer()], []); + $this->assertNull($serializer->normalize(['a', 'b'])); + $this->assertNull($serializer->normalize(new \ArrayObject(['c', 'd']))); + $this->assertNull($serializer->normalize([])); $this->assertNull($serializer->normalize('test')); } @@ -115,7 +115,7 @@ public function testNormalizeWithSupportOnData() ->willReturn(true); $normalizer2->method('normalize')->willReturn('test2'); - $serializer = new Serializer(array($normalizer1, $normalizer2)); + $serializer = new Serializer([$normalizer1, $normalizer2]); $data = new \stdClass(); $data->test = true; @@ -138,32 +138,32 @@ public function testDenormalizeWithSupportOnData() ->willReturn(true); $denormalizer2->method('denormalize')->willReturn('test2'); - $serializer = new Serializer(array($denormalizer1, $denormalizer2)); + $serializer = new Serializer([$denormalizer1, $denormalizer2]); - $this->assertEquals('test1', $serializer->denormalize(array('test1' => true), 'test')); + $this->assertEquals('test1', $serializer->denormalize(['test1' => true], 'test')); - $this->assertEquals('test2', $serializer->denormalize(array(), 'test')); + $this->assertEquals('test2', $serializer->denormalize([], 'test')); } public function testSerialize() { - $serializer = new Serializer(array(new GetSetMethodNormalizer()), array('json' => new JsonEncoder())); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([new GetSetMethodNormalizer()], ['json' => new JsonEncoder()]); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $result = $serializer->serialize(Model::fromArray($data), 'json'); $this->assertEquals(json_encode($data), $result); } public function testSerializeScalar() { - $serializer = new Serializer(array(), array('json' => new JsonEncoder())); + $serializer = new Serializer([], ['json' => new JsonEncoder()]); $result = $serializer->serialize('foo', 'json'); $this->assertEquals('"foo"', $result); } public function testSerializeArrayOfScalars() { - $serializer = new Serializer(array(), array('json' => new JsonEncoder())); - $data = array('foo', array(5, 3)); + $serializer = new Serializer([], ['json' => new JsonEncoder()]); + $data = ['foo', [5, 3]]; $result = $serializer->serialize($data, 'json'); $this->assertEquals(json_encode($data), $result); } @@ -173,8 +173,8 @@ public function testSerializeArrayOfScalars() */ public function testSerializeNoEncoder() { - $serializer = new Serializer(array(), array()); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([], []); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $serializer->serialize($data, 'json'); } @@ -183,25 +183,25 @@ public function testSerializeNoEncoder() */ public function testSerializeNoNormalizer() { - $serializer = new Serializer(array(), array('json' => new JsonEncoder())); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([], ['json' => new JsonEncoder()]); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $serializer->serialize(Model::fromArray($data), 'json'); } public function testDeserialize() { - $serializer = new Serializer(array(new GetSetMethodNormalizer()), array('json' => new JsonEncoder())); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([new GetSetMethodNormalizer()], ['json' => new JsonEncoder()]); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $result = $serializer->deserialize(json_encode($data), '\Symfony\Component\Serializer\Tests\Model', 'json'); $this->assertEquals($data, $result->toArray()); } public function testDeserializeUseCache() { - $serializer = new Serializer(array(new GetSetMethodNormalizer()), array('json' => new JsonEncoder())); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([new GetSetMethodNormalizer()], ['json' => new JsonEncoder()]); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $serializer->deserialize(json_encode($data), '\Symfony\Component\Serializer\Tests\Model', 'json'); - $data = array('title' => 'bar', 'numbers' => array(2, 8)); + $data = ['title' => 'bar', 'numbers' => [2, 8]]; $result = $serializer->deserialize(json_encode($data), '\Symfony\Component\Serializer\Tests\Model', 'json'); $this->assertEquals($data, $result->toArray()); } @@ -211,8 +211,8 @@ public function testDeserializeUseCache() */ public function testDeserializeNoNormalizer() { - $serializer = new Serializer(array(), array('json' => new JsonEncoder())); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([], ['json' => new JsonEncoder()]); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $serializer->deserialize(json_encode($data), '\Symfony\Component\Serializer\Tests\Model', 'json'); } @@ -221,8 +221,8 @@ public function testDeserializeNoNormalizer() */ public function testDeserializeWrongNormalizer() { - $serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder())); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([new CustomNormalizer()], ['json' => new JsonEncoder()]); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $serializer->deserialize(json_encode($data), '\Symfony\Component\Serializer\Tests\Model', 'json'); } @@ -231,44 +231,44 @@ public function testDeserializeWrongNormalizer() */ public function testDeserializeNoEncoder() { - $serializer = new Serializer(array(), array()); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([], []); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $serializer->deserialize(json_encode($data), '\Symfony\Component\Serializer\Tests\Model', 'json'); } public function testDeserializeSupported() { - $serializer = new Serializer(array(new GetSetMethodNormalizer()), array()); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([new GetSetMethodNormalizer()], []); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $this->assertTrue($serializer->supportsDenormalization(json_encode($data), '\Symfony\Component\Serializer\Tests\Model', 'json')); } public function testDeserializeNotSupported() { - $serializer = new Serializer(array(new GetSetMethodNormalizer()), array()); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([new GetSetMethodNormalizer()], []); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $this->assertFalse($serializer->supportsDenormalization(json_encode($data), 'stdClass', 'json')); } public function testDeserializeNotSupportedMissing() { - $serializer = new Serializer(array(), array()); - $data = array('title' => 'foo', 'numbers' => array(5, 3)); + $serializer = new Serializer([], []); + $data = ['title' => 'foo', 'numbers' => [5, 3]]; $this->assertFalse($serializer->supportsDenormalization(json_encode($data), '\Symfony\Component\Serializer\Tests\Model', 'json')); } public function testEncode() { - $serializer = new Serializer(array(), array('json' => new JsonEncoder())); - $data = array('foo', array(5, 3)); + $serializer = new Serializer([], ['json' => new JsonEncoder()]); + $data = ['foo', [5, 3]]; $result = $serializer->encode($data, 'json'); $this->assertEquals(json_encode($data), $result); } public function testDecode() { - $serializer = new Serializer(array(), array('json' => new JsonEncoder())); - $data = array('foo', array(5, 3)); + $serializer = new Serializer([], ['json' => new JsonEncoder()]); + $data = ['foo', [5, 3]]; $result = $serializer->decode(json_encode($data), 'json'); $this->assertEquals($data, $result); } @@ -276,20 +276,20 @@ public function testDecode() public function testSupportsArrayDeserialization() { $serializer = new Serializer( - array( + [ new GetSetMethodNormalizer(), new PropertyNormalizer(), new ObjectNormalizer(), new CustomNormalizer(), new ArrayDenormalizer(), - ), - array( + ], + [ 'json' => new JsonEncoder(), - ) + ] ); $this->assertTrue( - $serializer->supportsDenormalization(array(), __NAMESPACE__.'\Model[]', 'json') + $serializer->supportsDenormalization([], __NAMESPACE__.'\Model[]', 'json') ); } @@ -297,19 +297,19 @@ public function testDeserializeArray() { $jsonData = '[{"title":"foo","numbers":[5,3]},{"title":"bar","numbers":[2,8]}]'; - $expectedData = array( - Model::fromArray(array('title' => 'foo', 'numbers' => array(5, 3))), - Model::fromArray(array('title' => 'bar', 'numbers' => array(2, 8))), - ); + $expectedData = [ + Model::fromArray(['title' => 'foo', 'numbers' => [5, 3]]), + Model::fromArray(['title' => 'bar', 'numbers' => [2, 8]]), + ]; $serializer = new Serializer( - array( + [ new GetSetMethodNormalizer(), new ArrayDenormalizer(), - ), - array( + ], + [ 'json' => new JsonEncoder(), - ) + ] ); $this->assertEquals( @@ -325,7 +325,7 @@ public function testNormalizerAware() ->method('setNormalizer') ->with($this->isInstanceOf(NormalizerInterface::class)); - new Serializer(array($normalizerAware)); + new Serializer([$normalizerAware]); } public function testDenormalizerAware() @@ -335,14 +335,14 @@ public function testDenormalizerAware() ->method('setDenormalizer') ->with($this->isInstanceOf(DenormalizerInterface::class)); - new Serializer(array($denormalizerAware)); + new Serializer([$denormalizerAware]); } public function testDeserializeObjectConstructorWithObjectTypeHint() { $jsonData = '{"bar":{"value":"baz"}}'; - $serializer = new Serializer(array(new ObjectNormalizer()), array('json' => new JsonEncoder())); + $serializer = new Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()]); $this->assertEquals(new Foo(new Bar('baz')), $serializer->deserialize($jsonData, Foo::class, 'json')); } @@ -388,7 +388,7 @@ public function setNumbers($numbers) public function toArray() { - return array('title' => $this->title, 'numbers' => $this->numbers); + return ['title' => $this->title, 'numbers' => $this->numbers]; } } diff --git a/vendor/symfony/serializer/phpunit.xml.dist b/vendor/symfony/serializer/phpunit.xml.dist index ce9af71d90a7cf844ff7a6afb7a2f7e4c91b7aab..2d99ce1d435997779a2103c8642a68a34ddf10b6 100644 --- a/vendor/symfony/serializer/phpunit.xml.dist +++ b/vendor/symfony/serializer/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/translation/Catalogue/AbstractOperation.php b/vendor/symfony/translation/Catalogue/AbstractOperation.php index c303a4f6e491cbb9ca7fc707f34e0b824b475dfd..919bab8fff97fb25be11ed25ded3b35d93e8b2ab 100644 --- a/vendor/symfony/translation/Catalogue/AbstractOperation.php +++ b/vendor/symfony/translation/Catalogue/AbstractOperation.php @@ -31,7 +31,7 @@ abstract class AbstractOperation implements OperationInterface protected $result; /** - * @var null|array The domains affected by this operation + * @var array|null The domains affected by this operation */ private $domains; @@ -39,21 +39,20 @@ abstract class AbstractOperation implements OperationInterface * This array stores 'all', 'new' and 'obsolete' messages for all valid domains. * * The data structure of this array is as follows: - * ```php - * array( - * 'domain 1' => array( - * 'all' => array(...), - * 'new' => array(...), - * 'obsolete' => array(...) - * ), - * 'domain 2' => array( - * 'all' => array(...), - * 'new' => array(...), - * 'obsolete' => array(...) - * ), - * ... - * ) - * ``` + * + * [ + * 'domain 1' => [ + * 'all' => [...], + * 'new' => [...], + * 'obsolete' => [...] + * ], + * 'domain 2' => [ + * 'all' => [...], + * 'new' => [...], + * 'obsolete' => [...] + * ], + * ... + * ] * * @var array The array that stores 'all', 'new' and 'obsolete' messages */ @@ -71,7 +70,7 @@ public function __construct(MessageCatalogueInterface $source, MessageCatalogueI $this->source = $source; $this->target = $target; $this->result = new MessageCatalogue($source->getLocale()); - $this->messages = array(); + $this->messages = []; } /** diff --git a/vendor/symfony/translation/Catalogue/MergeOperation.php b/vendor/symfony/translation/Catalogue/MergeOperation.php index 6db3f801f3b2b19a804a0246e52336517d674d59..4e1e3cec3d77a7fb29b34ba399178f880625cb90 100644 --- a/vendor/symfony/translation/Catalogue/MergeOperation.php +++ b/vendor/symfony/translation/Catalogue/MergeOperation.php @@ -27,15 +27,15 @@ class MergeOperation extends AbstractOperation */ protected function processDomain($domain) { - $this->messages[$domain] = array( - 'all' => array(), - 'new' => array(), - 'obsolete' => array(), - ); + $this->messages[$domain] = [ + 'all' => [], + 'new' => [], + 'obsolete' => [], + ]; foreach ($this->source->all($domain) as $id => $message) { $this->messages[$domain]['all'][$id] = $message; - $this->result->add(array($id => $message), $domain); + $this->result->add([$id => $message], $domain); if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } @@ -45,7 +45,7 @@ protected function processDomain($domain) if (!$this->source->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; $this->messages[$domain]['new'][$id] = $message; - $this->result->add(array($id => $message), $domain); + $this->result->add([$id => $message], $domain); if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } diff --git a/vendor/symfony/translation/Catalogue/TargetOperation.php b/vendor/symfony/translation/Catalogue/TargetOperation.php index f3b0a29dfb99685261862d8e5c44b38516e22a0b..35eff71ff90ab97c101790ad352bc63e4eeb42ff 100644 --- a/vendor/symfony/translation/Catalogue/TargetOperation.php +++ b/vendor/symfony/translation/Catalogue/TargetOperation.php @@ -28,25 +28,25 @@ class TargetOperation extends AbstractOperation */ protected function processDomain($domain) { - $this->messages[$domain] = array( - 'all' => array(), - 'new' => array(), - 'obsolete' => array(), - ); + $this->messages[$domain] = [ + 'all' => [], + 'new' => [], + 'obsolete' => [], + ]; // For 'all' messages, the code can't be simplified as ``$this->messages[$domain]['all'] = $target->all($domain);``, // because doing so will drop messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback} // - // For 'new' messages, the code can't be simplied as ``array_diff_assoc($this->target->all($domain), $this->source->all($domain));`` + // For 'new' messages, the code can't be simplified as ``array_diff_assoc($this->target->all($domain), $this->source->all($domain));`` // because doing so will not exclude messages like {x: x ∈ target ∧ x ∉ source.all ∧ x ∈ source.fallback} // - // For 'obsolete' messages, the code can't be simplifed as ``array_diff_assoc($this->source->all($domain), $this->target->all($domain))`` + // For 'obsolete' messages, the code can't be simplified as ``array_diff_assoc($this->source->all($domain), $this->target->all($domain))`` // because doing so will not exclude messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback} foreach ($this->source->all($domain) as $id => $message) { if ($this->target->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; - $this->result->add(array($id => $message), $domain); + $this->result->add([$id => $message], $domain); if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } @@ -59,7 +59,7 @@ protected function processDomain($domain) if (!$this->source->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; $this->messages[$domain]['new'][$id] = $message; - $this->result->add(array($id => $message), $domain); + $this->result->add([$id => $message], $domain); if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } diff --git a/vendor/symfony/translation/Command/XliffLintCommand.php b/vendor/symfony/translation/Command/XliffLintCommand.php index 885d20e4b0d3618896ff81f9dfcdde7d1542f7b0..89a4e50e21fa32991a61f337ba58da506d112c7e 100644 --- a/vendor/symfony/translation/Command/XliffLintCommand.php +++ b/vendor/symfony/translation/Command/XliffLintCommand.php @@ -85,14 +85,14 @@ protected function execute(InputInterface $input, OutputInterface $output) throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); } - return $this->display($io, array($this->validate($stdin))); + return $this->display($io, [$this->validate($stdin)]); } if (!$this->isReadable($filename)) { throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); } - $filesInfo = array(); + $filesInfo = []; foreach ($this->getFiles($filename) as $file) { $filesInfo[] = $this->validate(file_get_contents($file), $file); } @@ -104,7 +104,7 @@ private function validate($content, $file = null) { // Avoid: Warning DOMDocument::loadXML(): Empty string supplied as input if ('' === trim($content)) { - return array('file' => $file, 'valid' => true); + return ['file' => $file, 'valid' => true]; } libxml_use_internal_errors(true); @@ -112,21 +112,21 @@ private function validate($content, $file = null) $document = new \DOMDocument(); $document->loadXML($content); if ($document->schemaValidate(__DIR__.'/../Resources/schemas/xliff-core-1.2-strict.xsd')) { - return array('file' => $file, 'valid' => true); + return ['file' => $file, 'valid' => true]; } $errorMessages = array_map(function ($error) { - return array( + return [ 'line' => $error->line, 'column' => $error->column, 'message' => trim($error->message), - ); + ]; }, libxml_get_errors()); libxml_clear_errors(); libxml_use_internal_errors(false); - return array('file' => $file, 'valid' => false, 'messages' => $errorMessages); + return ['file' => $file, 'valid' => false, 'messages' => $errorMessages]; } private function display(SymfonyStyle $io, array $files) @@ -193,7 +193,7 @@ private function getFiles($fileOrDirectory) } foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) { - if (!\in_array($file->getExtension(), array('xlf', 'xliff'))) { + if (!\in_array($file->getExtension(), ['xlf', 'xliff'])) { continue; } diff --git a/vendor/symfony/translation/DataCollector/TranslationDataCollector.php b/vendor/symfony/translation/DataCollector/TranslationDataCollector.php index edd712dd145717d4a4f463fdc5d8150ec6598d9a..7aabcb24d5591837eb6ff56443f3cfee409dfda5 100644 --- a/vendor/symfony/translation/DataCollector/TranslationDataCollector.php +++ b/vendor/symfony/translation/DataCollector/TranslationDataCollector.php @@ -57,7 +57,7 @@ public function collect(Request $request, Response $response, \Exception $except */ public function reset() { - $this->data = array(); + $this->data = []; } /** @@ -65,7 +65,7 @@ public function reset() */ public function getMessages() { - return isset($this->data['messages']) ? $this->data['messages'] : array(); + return isset($this->data['messages']) ? $this->data['messages'] : []; } /** @@ -99,7 +99,7 @@ public function getLocale() public function getFallbackLocales() { - return (isset($this->data['fallback_locales']) && \count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : array(); + return (isset($this->data['fallback_locales']) && \count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : []; } /** @@ -112,13 +112,13 @@ public function getName() private function sanitizeCollectedMessages($messages) { - $result = array(); + $result = []; foreach ($messages as $key => $message) { $messageId = $message['locale'].$message['domain'].$message['id']; if (!isset($result[$messageId])) { $message['count'] = 1; - $message['parameters'] = !empty($message['parameters']) ? array($message['parameters']) : array(); + $message['parameters'] = !empty($message['parameters']) ? [$message['parameters']] : []; $messages[$key]['translation'] = $this->sanitizeString($message['translation']); $result[$messageId] = $message; } else { @@ -137,11 +137,11 @@ private function sanitizeCollectedMessages($messages) private function computeCount($messages) { - $count = array( + $count = [ DataCollectorTranslator::MESSAGE_DEFINED => 0, DataCollectorTranslator::MESSAGE_MISSING => 0, DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK => 0, - ); + ]; foreach ($messages as $message) { ++$count[$message['state']]; diff --git a/vendor/symfony/translation/DataCollectorTranslator.php b/vendor/symfony/translation/DataCollectorTranslator.php index 5d4d819e0ad9b956d57426bbf57755f968950eb4..6f826dfaa6ff43dcc4a429a4a3b182efee01b54e 100644 --- a/vendor/symfony/translation/DataCollectorTranslator.php +++ b/vendor/symfony/translation/DataCollectorTranslator.php @@ -27,7 +27,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter */ private $translator; - private $messages = array(); + private $messages = []; /** * @param TranslatorInterface $translator The translator must implement TranslatorBagInterface @@ -44,7 +44,7 @@ public function __construct(TranslatorInterface $translator) /** * {@inheritdoc} */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) + public function trans($id, array $parameters = [], $domain = null, $locale = null) { $trans = $this->translator->trans($id, $parameters, $domain, $locale); $this->collectMessage($locale, $domain, $id, $trans, $parameters); @@ -55,7 +55,7 @@ public function trans($id, array $parameters = array(), $domain = null, $locale /** * {@inheritdoc} */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) + public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); $this->collectMessage($locale, $domain, $id, $trans, $parameters, $number); @@ -90,7 +90,7 @@ public function getCatalogue($locale = null) /** * Gets the fallback locales. * - * @return array $locales The fallback locales + * @return array The fallback locales */ public function getFallbackLocales() { @@ -98,7 +98,7 @@ public function getFallbackLocales() return $this->translator->getFallbackLocales(); } - return array(); + return []; } /** @@ -106,7 +106,7 @@ public function getFallbackLocales() */ public function __call($method, $args) { - return \call_user_func_array(array($this->translator, $method), $args); + return \call_user_func_array([$this->translator, $method], $args); } /** @@ -125,7 +125,7 @@ public function getCollectedMessages() * @param array|null $parameters * @param int|null $number */ - private function collectMessage($locale, $domain, $id, $translation, $parameters = array(), $number = null) + private function collectMessage($locale, $domain, $id, $translation, $parameters = [], $number = null) { if (null === $domain) { $domain = 'messages'; @@ -152,7 +152,7 @@ private function collectMessage($locale, $domain, $id, $translation, $parameters $state = self::MESSAGE_MISSING; } - $this->messages[] = array( + $this->messages[] = [ 'locale' => $locale, 'domain' => $domain, 'id' => $id, @@ -160,6 +160,6 @@ private function collectMessage($locale, $domain, $id, $translation, $parameters 'parameters' => $parameters, 'transChoiceNumber' => $number, 'state' => $state, - ); + ]; } } diff --git a/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php b/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php index 92bac5be2f5734d31c62d74267c4ce75b3459700..4656d667a05a38fc03f646542b003c2649104bb3 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php @@ -38,7 +38,7 @@ public function process(ContainerBuilder $container) $definition = $container->getDefinition($this->writerServiceId); foreach ($container->findTaggedServiceIds($this->dumperTag, true) as $id => $attributes) { - $definition->addMethodCall('addDumper', array($attributes[0]['alias'], new Reference($id))); + $definition->addMethodCall('addDumper', [$attributes[0]['alias'], new Reference($id)]); } } } diff --git a/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php b/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php index 4014d499cce60d593f39e3714020dd7cbcf3bed6..bb4c5dca70d31272a6178ca9050e5aed8c1c2c9e 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php @@ -43,7 +43,7 @@ public function process(ContainerBuilder $container) throw new RuntimeException(sprintf('The alias for the tag "translation.extractor" of service "%s" must be set.', $id)); } - $definition->addMethodCall('addExtractor', array($attributes[0]['alias'], new Reference($id))); + $definition->addMethodCall('addExtractor', [$attributes[0]['alias'], new Reference($id)]); } } } diff --git a/vendor/symfony/translation/DependencyInjection/TranslatorPass.php b/vendor/symfony/translation/DependencyInjection/TranslatorPass.php index 2d50715ffb352f6cc75ab4749bb75b83e3dade9b..373a556ea47173e411b3c3cc2bf4f1d4558e31a5 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslatorPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslatorPass.php @@ -43,8 +43,8 @@ public function process(ContainerBuilder $container) return; } - $loaders = array(); - $loaderRefs = array(); + $loaders = []; + $loaderRefs = []; foreach ($container->findTaggedServiceIds($this->loaderTag, true) as $id => $attributes) { $loaderRefs[$id] = new Reference($id); $loaders[$id][] = $attributes[0]['alias']; @@ -57,7 +57,7 @@ public function process(ContainerBuilder $container) $definition = $container->getDefinition($this->readerServiceId); foreach ($loaders as $id => $formats) { foreach ($formats as $format) { - $definition->addMethodCall('addLoader', array($format, $loaderRefs[$id])); + $definition->addMethodCall('addLoader', [$format, $loaderRefs[$id]]); } } } @@ -68,7 +68,7 @@ public function process(ContainerBuilder $container) $definition = $container->getDefinition('translation.reader'); foreach ($loaders as $id => $formats) { foreach ($formats as $format) { - $definition->addMethodCall('addLoader', array($format, $loaderRefs[$id])); + $definition->addMethodCall('addLoader', [$format, $loaderRefs[$id]]); } } } diff --git a/vendor/symfony/translation/Dumper/CsvFileDumper.php b/vendor/symfony/translation/Dumper/CsvFileDumper.php index ebfa831dbd0caa11a8fa24829c21f04eb7fa17b2..bfa8db61adefc202464e289e752862d079dd4370 100644 --- a/vendor/symfony/translation/Dumper/CsvFileDumper.php +++ b/vendor/symfony/translation/Dumper/CsvFileDumper.php @@ -26,12 +26,12 @@ class CsvFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { - $handle = fopen('php://memory', 'rb+'); + $handle = fopen('php://memory', 'r+b'); foreach ($messages->all($domain) as $source => $target) { - fputcsv($handle, array($source, $target), $this->delimiter, $this->enclosure); + fputcsv($handle, [$source, $target], $this->delimiter, $this->enclosure); } rewind($handle); diff --git a/vendor/symfony/translation/Dumper/DumperInterface.php b/vendor/symfony/translation/Dumper/DumperInterface.php index cebc65ed89d90f6b1a2c7e5f627d5b6afce60353..9965e8091f86a1055e6761499b10ded9767cc6aa 100644 --- a/vendor/symfony/translation/Dumper/DumperInterface.php +++ b/vendor/symfony/translation/Dumper/DumperInterface.php @@ -27,5 +27,5 @@ interface DumperInterface * @param MessageCatalogue $messages The message catalogue * @param array $options Options that are used by the dumper */ - public function dump(MessageCatalogue $messages, $options = array()); + public function dump(MessageCatalogue $messages, $options = []); } diff --git a/vendor/symfony/translation/Dumper/FileDumper.php b/vendor/symfony/translation/Dumper/FileDumper.php index fe85e5dee906d6185c162370d6f8726be3b8e1f2..102f9285842f89eb970e495536930b06c18a5365 100644 --- a/vendor/symfony/translation/Dumper/FileDumper.php +++ b/vendor/symfony/translation/Dumper/FileDumper.php @@ -53,7 +53,7 @@ public function setRelativePathTemplate($relativePathTemplate) /** * Sets backup flag. * - * @param bool + * @param bool $backup */ public function setBackup($backup) { @@ -63,9 +63,9 @@ public function setBackup($backup) /** * {@inheritdoc} */ - public function dump(MessageCatalogue $messages, $options = array()) + public function dump(MessageCatalogue $messages, $options = []) { - if (!array_key_exists('path', $options)) { + if (!\array_key_exists('path', $options)) { throw new InvalidArgumentException('The file dumper needs a path option.'); } @@ -98,7 +98,7 @@ public function dump(MessageCatalogue $messages, $options = array()) * * @return string representation */ - abstract public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()); + abstract public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []); /** * Gets the file extension of the dumper. @@ -117,10 +117,10 @@ abstract protected function getExtension(); */ private function getRelativePath($domain, $locale) { - return strtr($this->relativePathTemplate, array( + return strtr($this->relativePathTemplate, [ '%domain%' => $domain, '%locale%' => $locale, '%extension%' => $this->getExtension(), - )); + ]); } } diff --git a/vendor/symfony/translation/Dumper/IcuResFileDumper.php b/vendor/symfony/translation/Dumper/IcuResFileDumper.php index efa9d7fee6becb1026b469322c418790f2747885..48d0befdf9412f8739d0faaace9bd608488ff29d 100644 --- a/vendor/symfony/translation/Dumper/IcuResFileDumper.php +++ b/vendor/symfony/translation/Dumper/IcuResFileDumper.php @@ -28,7 +28,7 @@ class IcuResFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $data = $indexes = $resources = ''; diff --git a/vendor/symfony/translation/Dumper/IniFileDumper.php b/vendor/symfony/translation/Dumper/IniFileDumper.php index 9ed3754037fb534431feb7baf32286e2100f1348..45ff9614b146b815c273ecf49fa8e7f402758c64 100644 --- a/vendor/symfony/translation/Dumper/IniFileDumper.php +++ b/vendor/symfony/translation/Dumper/IniFileDumper.php @@ -23,7 +23,7 @@ class IniFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $output = ''; diff --git a/vendor/symfony/translation/Dumper/JsonFileDumper.php b/vendor/symfony/translation/Dumper/JsonFileDumper.php index 11fe13d0e794661f4ca3d0f56e4b037177054d98..3ee446dc731836cba0ac5b5fd93621f94ebba9d9 100644 --- a/vendor/symfony/translation/Dumper/JsonFileDumper.php +++ b/vendor/symfony/translation/Dumper/JsonFileDumper.php @@ -23,7 +23,7 @@ class JsonFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { if (isset($options['json_encoding'])) { $flags = $options['json_encoding']; diff --git a/vendor/symfony/translation/Dumper/MoFileDumper.php b/vendor/symfony/translation/Dumper/MoFileDumper.php index 2022a421115cbbd5f8a13a42105ec178c9659a9c..27be16d573f4e8a9b1d82c762a1c14cc320b3c6e 100644 --- a/vendor/symfony/translation/Dumper/MoFileDumper.php +++ b/vendor/symfony/translation/Dumper/MoFileDumper.php @@ -24,20 +24,20 @@ class MoFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $sources = $targets = $sourceOffsets = $targetOffsets = ''; - $offsets = array(); + $offsets = []; $size = 0; foreach ($messages->all($domain) as $source => $target) { - $offsets[] = array_map('strlen', array($sources, $source, $targets, $target)); + $offsets[] = array_map('strlen', [$sources, $source, $targets, $target]); $sources .= "\0".$source; $targets .= "\0".$target; ++$size; } - $header = array( + $header = [ 'magicNumber' => MoFileLoader::MO_LITTLE_ENDIAN_MAGIC, 'formatRevision' => 0, 'count' => $size, @@ -45,7 +45,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti 'offsetTranslated' => MoFileLoader::MO_HEADER_SIZE + (8 * $size), 'sizeHashes' => 0, 'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size), - ); + ]; $sourcesSize = \strlen($sources); $sourcesStart = $header['offsetHashes'] + 1; @@ -57,7 +57,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); } - $output = implode(array_map(array($this, 'writeLong'), $header)) + $output = implode('', array_map([$this, 'writeLong'], $header)) .$sourceOffsets .$targetOffsets .$sources diff --git a/vendor/symfony/translation/Dumper/PhpFileDumper.php b/vendor/symfony/translation/Dumper/PhpFileDumper.php index c7c37aac9232b25b0298fa2e82447dc1a23edf0f..e77afc2fbfde34055383126beca85635ba8c6452 100644 --- a/vendor/symfony/translation/Dumper/PhpFileDumper.php +++ b/vendor/symfony/translation/Dumper/PhpFileDumper.php @@ -23,7 +23,7 @@ class PhpFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { return "<?php\n\nreturn ".var_export($messages->all($domain), true).";\n"; } diff --git a/vendor/symfony/translation/Dumper/PoFileDumper.php b/vendor/symfony/translation/Dumper/PoFileDumper.php index ed4418b1489eab83e9146e5fc617e00f413775a7..e9673b6d29908d52a6140c42b291875bb52d442f 100644 --- a/vendor/symfony/translation/Dumper/PoFileDumper.php +++ b/vendor/symfony/translation/Dumper/PoFileDumper.php @@ -23,7 +23,7 @@ class PoFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $output = 'msgid ""'."\n"; $output .= 'msgstr ""'."\n"; diff --git a/vendor/symfony/translation/Dumper/QtFileDumper.php b/vendor/symfony/translation/Dumper/QtFileDumper.php index a9073f26df479d032099f28fcb70a0eaa0b0a8d7..ec93f92e4a1f9ce361827d6ab489af169318a59c 100644 --- a/vendor/symfony/translation/Dumper/QtFileDumper.php +++ b/vendor/symfony/translation/Dumper/QtFileDumper.php @@ -23,7 +23,7 @@ class QtFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $dom = new \DOMDocument('1.0', 'utf-8'); $dom->formatOutput = true; diff --git a/vendor/symfony/translation/Dumper/XliffFileDumper.php b/vendor/symfony/translation/Dumper/XliffFileDumper.php index e714463c9f0e00a3628d3c38454c2551f87db495..cd867b0967908ece7d6592786f7d976757edd217 100644 --- a/vendor/symfony/translation/Dumper/XliffFileDumper.php +++ b/vendor/symfony/translation/Dumper/XliffFileDumper.php @@ -24,14 +24,14 @@ class XliffFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $xliffVersion = '1.2'; - if (array_key_exists('xliff_version', $options)) { + if (\array_key_exists('xliff_version', $options)) { $xliffVersion = $options['xliff_version']; } - if (array_key_exists('default_locale', $options)) { + if (\array_key_exists('default_locale', $options)) { $defaultLocale = $options['default_locale']; } else { $defaultLocale = \Locale::getDefault(); @@ -55,10 +55,10 @@ protected function getExtension() return 'xlf'; } - private function dumpXliff1($defaultLocale, MessageCatalogue $messages, $domain, array $options = array()) + private function dumpXliff1($defaultLocale, MessageCatalogue $messages, $domain, array $options = []) { - $toolInfo = array('tool-id' => 'symfony', 'tool-name' => 'Symfony'); - if (array_key_exists('tool_info', $options)) { + $toolInfo = ['tool-id' => 'symfony', 'tool-name' => 'Symfony']; + if (\array_key_exists('tool_info', $options)) { $toolInfo = array_merge($toolInfo, $options['tool_info']); } @@ -129,7 +129,7 @@ private function dumpXliff1($defaultLocale, MessageCatalogue $messages, $domain, return $dom->saveXML(); } - private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain, array $options = array()) + private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain, array $options = []) { $dom = new \DOMDocument('1.0', 'utf-8'); $dom->formatOutput = true; @@ -195,6 +195,6 @@ private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain, */ private function hasMetadataArrayInfo($key, $metadata = null) { - return null !== $metadata && array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || \is_array($metadata[$key])); + return null !== $metadata && \array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || \is_array($metadata[$key])); } } diff --git a/vendor/symfony/translation/Dumper/YamlFileDumper.php b/vendor/symfony/translation/Dumper/YamlFileDumper.php index aab6ad9b234fb8872ced2e80d739d5479d0e2023..f7e1bcb80b9be81d936061e8451cdbbe3311bb96 100644 --- a/vendor/symfony/translation/Dumper/YamlFileDumper.php +++ b/vendor/symfony/translation/Dumper/YamlFileDumper.php @@ -33,7 +33,7 @@ public function __construct(/**string */$extension = 'yml') /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { if (!class_exists('Symfony\Component\Yaml\Yaml')) { throw new LogicException('Dumping translations in the YAML format requires the Symfony Yaml component.'); diff --git a/vendor/symfony/translation/Extractor/AbstractFileExtractor.php b/vendor/symfony/translation/Extractor/AbstractFileExtractor.php index 184102236e091dc3b46bf09d25ee399321277e73..08a27fb07c980f7dc7b1f617ea9e266704788719 100644 --- a/vendor/symfony/translation/Extractor/AbstractFileExtractor.php +++ b/vendor/symfony/translation/Extractor/AbstractFileExtractor.php @@ -28,14 +28,14 @@ abstract class AbstractFileExtractor protected function extractFiles($resource) { if (\is_array($resource) || $resource instanceof \Traversable) { - $files = array(); + $files = []; foreach ($resource as $file) { if ($this->canBeExtracted($file)) { $files[] = $this->toSplFileInfo($file); } } } elseif (is_file($resource)) { - $files = $this->canBeExtracted($resource) ? array($this->toSplFileInfo($resource)) : array(); + $files = $this->canBeExtracted($resource) ? [$this->toSplFileInfo($resource)] : []; } else { $files = $this->extractFromDirectory($resource); } diff --git a/vendor/symfony/translation/Extractor/ChainExtractor.php b/vendor/symfony/translation/Extractor/ChainExtractor.php index 50e3c84579f2bcbcd1174cf9de019904e7c1d6fc..69ee2dfc39e63e1346742ef3ac239e869039820c 100644 --- a/vendor/symfony/translation/Extractor/ChainExtractor.php +++ b/vendor/symfony/translation/Extractor/ChainExtractor.php @@ -25,7 +25,7 @@ class ChainExtractor implements ExtractorInterface * * @var ExtractorInterface[] */ - private $extractors = array(); + private $extractors = []; /** * Adds a loader to the translation extractor. diff --git a/vendor/symfony/translation/Extractor/PhpExtractor.php b/vendor/symfony/translation/Extractor/PhpExtractor.php index ce62621238df318f1c3a224b5b8b63adaf60504a..7f4c6e60394c41b9f38ddb8b62cfc027c398a2c4 100644 --- a/vendor/symfony/translation/Extractor/PhpExtractor.php +++ b/vendor/symfony/translation/Extractor/PhpExtractor.php @@ -37,8 +37,8 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface * * @var array */ - protected $sequences = array( - array( + protected $sequences = [ + [ '->', 'trans', '(', @@ -47,8 +47,8 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface self::METHOD_ARGUMENTS_TOKEN, ',', self::DOMAIN_TOKEN, - ), - array( + ], + [ '->', 'transChoice', '(', @@ -59,20 +59,20 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface self::METHOD_ARGUMENTS_TOKEN, ',', self::DOMAIN_TOKEN, - ), - array( + ], + [ '->', 'trans', '(', self::MESSAGE_TOKEN, - ), - array( + ], + [ '->', 'transChoice', '(', self::MESSAGE_TOKEN, - ), - ); + ], + ]; /** * {@inheritdoc} @@ -156,9 +156,14 @@ private function getValue(\Iterator $tokenIterator) { $message = ''; $docToken = ''; + $docPart = ''; for (; $tokenIterator->valid(); $tokenIterator->next()) { $t = $tokenIterator->current(); + if ('.' === $t) { + // Concatenate with next token + continue; + } if (!isset($t[1])) { break; } @@ -169,19 +174,24 @@ private function getValue(\Iterator $tokenIterator) break; case T_ENCAPSED_AND_WHITESPACE: case T_CONSTANT_ENCAPSED_STRING: - $message .= $t[1]; + if ('' === $docToken) { + $message .= PhpStringTokenParser::parse($t[1]); + } else { + $docPart = $t[1]; + } break; case T_END_HEREDOC: - return PhpStringTokenParser::parseDocString($docToken, $message); + $message .= PhpStringTokenParser::parseDocString($docToken, $docPart); + $docToken = ''; + $docPart = ''; + break; + case T_WHITESPACE: + break; default: break 2; } } - if ($message) { - $message = PhpStringTokenParser::parse($message); - } - return $message; } diff --git a/vendor/symfony/translation/Extractor/PhpStringTokenParser.php b/vendor/symfony/translation/Extractor/PhpStringTokenParser.php index 6ed39d465f07862516fbabaaa08e0f3abf73a14f..8a8ccb1f1aae3d570452d0d173d51df99a9c95db 100644 --- a/vendor/symfony/translation/Extractor/PhpStringTokenParser.php +++ b/vendor/symfony/translation/Extractor/PhpStringTokenParser.php @@ -49,7 +49,7 @@ class PhpStringTokenParser { - protected static $replacements = array( + protected static $replacements = [ '\\' => '\\', '$' => '$', 'n' => "\n", @@ -58,7 +58,7 @@ class PhpStringTokenParser 'f' => "\f", 'v' => "\v", 'e' => "\x1B", - ); + ]; /** * Parses a string token. @@ -76,8 +76,8 @@ public static function parse($str) if ('\'' === $str[$bLength]) { return str_replace( - array('\\\\', '\\\''), - array('\\', '\''), + ['\\\\', '\\\''], + ['\\', '\''], substr($str, $bLength + 1, -1) ); } else { @@ -89,7 +89,7 @@ public static function parse($str) * Parses escape sequences in strings (all string types apart from single quoted). * * @param string $str String without quotes - * @param null|string $quote Quote type + * @param string|null $quote Quote type * * @return string String with escape sequences parsed */ @@ -101,7 +101,7 @@ public static function parseEscapeSequences($str, $quote) return preg_replace_callback( '~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3})~', - array(__CLASS__, 'parseCallback'), + [__CLASS__, 'parseCallback'], $str ); } diff --git a/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php b/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php index 92acbcafe2032885d5398deba58a2486caabd99d..027b2eb5ba4e18458a24d42aa30456a9523ad120 100644 --- a/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php +++ b/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php @@ -26,5 +26,5 @@ interface ChoiceMessageFormatterInterface * * @return string */ - public function choiceFormat($message, $number, $locale, array $parameters = array()); + public function choiceFormat($message, $number, $locale, array $parameters = []); } diff --git a/vendor/symfony/translation/Formatter/MessageFormatter.php b/vendor/symfony/translation/Formatter/MessageFormatter.php index e174be36c3a4629b175a6b5130386d1801f202bf..f7204c3b0f0c67d37fcc2e290dad352dc2101ae0 100644 --- a/vendor/symfony/translation/Formatter/MessageFormatter.php +++ b/vendor/symfony/translation/Formatter/MessageFormatter.php @@ -31,7 +31,7 @@ public function __construct(MessageSelector $selector = null) /** * {@inheritdoc} */ - public function format($message, $locale, array $parameters = array()) + public function format($message, $locale, array $parameters = []) { return strtr($message, $parameters); } @@ -39,9 +39,9 @@ public function format($message, $locale, array $parameters = array()) /** * {@inheritdoc} */ - public function choiceFormat($message, $number, $locale, array $parameters = array()) + public function choiceFormat($message, $number, $locale, array $parameters = []) { - $parameters = array_merge(array('%count%' => $number), $parameters); + $parameters = array_merge(['%count%' => $number], $parameters); return $this->format($this->selector->choose($message, (int) $number, $locale), $locale, $parameters); } diff --git a/vendor/symfony/translation/Formatter/MessageFormatterInterface.php b/vendor/symfony/translation/Formatter/MessageFormatterInterface.php index 86937fb2f0853c70498301ac234943c2fce9d510..370c055866c0f266fd944f0aae0b3de08d419790 100644 --- a/vendor/symfony/translation/Formatter/MessageFormatterInterface.php +++ b/vendor/symfony/translation/Formatter/MessageFormatterInterface.php @@ -26,5 +26,5 @@ interface MessageFormatterInterface * * @return string */ - public function format($message, $locale, array $parameters = array()); + public function format($message, $locale, array $parameters = []); } diff --git a/vendor/symfony/translation/IdentityTranslator.php b/vendor/symfony/translation/IdentityTranslator.php index 82b247015bfe62fe936ff9253efba9c536d82ed8..2d90509d88b58650e4420a7252f96d66b0c728f5 100644 --- a/vendor/symfony/translation/IdentityTranslator.php +++ b/vendor/symfony/translation/IdentityTranslator.php @@ -48,7 +48,7 @@ public function getLocale() /** * {@inheritdoc} */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) + public function trans($id, array $parameters = [], $domain = null, $locale = null) { return strtr((string) $id, $parameters); } @@ -56,7 +56,7 @@ public function trans($id, array $parameters = array(), $domain = null, $locale /** * {@inheritdoc} */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) + public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { return strtr($this->selector->choose((string) $id, (int) $number, $locale ?: $this->getLocale()), $parameters); } diff --git a/vendor/symfony/translation/LICENSE b/vendor/symfony/translation/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/translation/LICENSE +++ b/vendor/symfony/translation/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/translation/Loader/ArrayLoader.php b/vendor/symfony/translation/Loader/ArrayLoader.php index 7bbfca68a4b0cb7d01e273378ad500099f556ea7..0a6f9f089d5b76c20f3a500ebc329c4e0c8e7dca 100644 --- a/vendor/symfony/translation/Loader/ArrayLoader.php +++ b/vendor/symfony/translation/Loader/ArrayLoader.php @@ -36,7 +36,7 @@ public function load($resource, $locale, $domain = 'messages') * Flattens an nested array of translations. * * The scheme used is: - * 'key' => array('key2' => array('key3' => 'value')) + * 'key' => ['key2' => ['key3' => 'value']] * Becomes: * 'key.key2.key3' => 'value' * diff --git a/vendor/symfony/translation/Loader/CsvFileLoader.php b/vendor/symfony/translation/Loader/CsvFileLoader.php index 8a763e725d6d7b6f32557f3c8a298f65744d4815..18cc83ed686c6b217ffb9170b28689ecc6883e66 100644 --- a/vendor/symfony/translation/Loader/CsvFileLoader.php +++ b/vendor/symfony/translation/Loader/CsvFileLoader.php @@ -29,7 +29,7 @@ class CsvFileLoader extends FileLoader */ protected function loadResource($resource) { - $messages = array(); + $messages = []; try { $file = new \SplFileObject($resource, 'rb'); diff --git a/vendor/symfony/translation/Loader/FileLoader.php b/vendor/symfony/translation/Loader/FileLoader.php index 9a02f5250617ff44c6c530da6205316eb1b94de5..7ec54a3c874fb6d6cb5e6eb4328d77ec87a0ff45 100644 --- a/vendor/symfony/translation/Loader/FileLoader.php +++ b/vendor/symfony/translation/Loader/FileLoader.php @@ -37,7 +37,7 @@ public function load($resource, $locale, $domain = 'messages') // empty resource if (null === $messages) { - $messages = array(); + $messages = []; } // not an array diff --git a/vendor/symfony/translation/Loader/IcuResFileLoader.php b/vendor/symfony/translation/Loader/IcuResFileLoader.php index fd2d1e4d3196c6c4d7b082ac37ba8a135e0615ed..b59c021469e6ef0ecbeca2c547a84735e5f96117 100644 --- a/vendor/symfony/translation/Loader/IcuResFileLoader.php +++ b/vendor/symfony/translation/Loader/IcuResFileLoader.php @@ -76,7 +76,7 @@ public function load($resource, $locale, $domain = 'messages') * * @return array the flattened ResourceBundle */ - protected function flatten(\ResourceBundle $rb, array &$messages = array(), $path = null) + protected function flatten(\ResourceBundle $rb, array &$messages = [], $path = null) { foreach ($rb as $key => $value) { $nodePath = $path ? $path.'.'.$key : $key; diff --git a/vendor/symfony/translation/Loader/JsonFileLoader.php b/vendor/symfony/translation/Loader/JsonFileLoader.php index ce4e91ff4fbee75f3f58048d744425c4836763b3..526721277d76ee25207558f33ce56c031b3eb160 100644 --- a/vendor/symfony/translation/Loader/JsonFileLoader.php +++ b/vendor/symfony/translation/Loader/JsonFileLoader.php @@ -25,7 +25,7 @@ class JsonFileLoader extends FileLoader */ protected function loadResource($resource) { - $messages = array(); + $messages = []; if ($data = file_get_contents($resource)) { $messages = json_decode($data, true); diff --git a/vendor/symfony/translation/Loader/MoFileLoader.php b/vendor/symfony/translation/Loader/MoFileLoader.php index 93ecffa6655060752a39dc2d574f34c0e817ecdf..74d2b2f4411df3e34c0f029b051f3d6a06d522e8 100644 --- a/vendor/symfony/translation/Loader/MoFileLoader.php +++ b/vendor/symfony/translation/Loader/MoFileLoader.php @@ -71,7 +71,7 @@ protected function loadResource($resource) // offsetHashes $this->readLong($stream, $isBigEndian); - $messages = array(); + $messages = []; for ($i = 0; $i < $count; ++$i) { $pluralId = null; @@ -108,13 +108,13 @@ protected function loadResource($resource) $translated = explode("\000", $translated); } - $ids = array('singular' => $singularId, 'plural' => $pluralId); + $ids = ['singular' => $singularId, 'plural' => $pluralId]; $item = compact('ids', 'translated'); if (\is_array($item['translated'])) { $messages[$item['ids']['singular']] = stripcslashes($item['translated'][0]); if (isset($item['ids']['plural'])) { - $plurals = array(); + $plurals = []; foreach ($item['translated'] as $plural => $translated) { $plurals[] = sprintf('{%d} %s', $plural, $translated); } diff --git a/vendor/symfony/translation/Loader/PoFileLoader.php b/vendor/symfony/translation/Loader/PoFileLoader.php index 066168dc71d98198018312deb9363f1a1c092b8a..1412a786a79b7da7696de1b900da14f6f57dfc32 100644 --- a/vendor/symfony/translation/Loader/PoFileLoader.php +++ b/vendor/symfony/translation/Loader/PoFileLoader.php @@ -64,14 +64,14 @@ protected function loadResource($resource) { $stream = fopen($resource, 'r'); - $defaults = array( - 'ids' => array(), + $defaults = [ + 'ids' => [], 'translated' => null, - ); + ]; - $messages = array(); + $messages = []; $item = $defaults; - $flags = array(); + $flags = []; while ($line = fgets($stream)) { $line = trim($line); @@ -82,7 +82,7 @@ protected function loadResource($resource) $this->addMessage($messages, $item); } $item = $defaults; - $flags = array(); + $flags = []; } elseif ('#,' === substr($line, 0, 2)) { $flags = array_map('trim', explode(',', substr($line, 2))); } elseif ('msgid "' === substr($line, 0, 7)) { diff --git a/vendor/symfony/translation/Loader/XliffFileLoader.php b/vendor/symfony/translation/Loader/XliffFileLoader.php index 4cb196f9db315efa65c169b7010c05b30340813d..e6750826237dcab2a9c4248ed63e456891f149ee 100644 --- a/vendor/symfony/translation/Loader/XliffFileLoader.php +++ b/vendor/symfony/translation/Loader/XliffFileLoader.php @@ -91,17 +91,17 @@ private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, $ $source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source; // If the xlf file has another encoding specified, try to convert it because // simple_xml will always return utf-8 encoded values - $target = $this->utf8ToCharset((string) (isset($translation->target) ? $translation->target : $source), $encoding); + $target = $this->utf8ToCharset((string) (isset($translation->target) ? $translation->target : $translation->source), $encoding); $catalogue->set((string) $source, $target, $domain); - $metadata = array(); + $metadata = []; if ($notes = $this->parseNotesMetadata($translation->note, $encoding)) { $metadata['notes'] = $notes; } if (isset($translation->target) && $translation->target->attributes()) { - $metadata['target-attributes'] = array(); + $metadata['target-attributes'] = []; foreach ($translation->target->attributes() as $key => $value) { $metadata['target-attributes'][$key] = (string) $value; } @@ -137,18 +137,18 @@ private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, $ $catalogue->set((string) $source, $target, $domain); - $metadata = array(); + $metadata = []; if (isset($segment->target) && $segment->target->attributes()) { - $metadata['target-attributes'] = array(); + $metadata['target-attributes'] = []; foreach ($segment->target->attributes() as $key => $value) { $metadata['target-attributes'][$key] = (string) $value; } } if (isset($unit->notes)) { - $metadata['notes'] = array(); + $metadata['notes'] = []; foreach ($unit->notes->note as $noteNode) { - $note = array(); + $note = []; foreach ($noteNode->attributes() as $key => $value) { $note[$key] = (string) $value; } @@ -262,7 +262,7 @@ private function fixXmlLocation($schemaSource, $xmlUri) */ private function getXmlErrors($internalErrors) { - $errors = array(); + $errors = []; foreach (libxml_get_errors() as $error) { $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', @@ -321,7 +321,7 @@ private function getVersionNumber(\DOMDocument $dom) */ private function parseNotesMetadata(\SimpleXMLElement $noteElement = null, $encoding = null) { - $notes = array(); + $notes = []; if (null === $noteElement) { return $notes; @@ -330,7 +330,7 @@ private function parseNotesMetadata(\SimpleXMLElement $noteElement = null, $enco /** @var \SimpleXMLElement $xmlNote */ foreach ($noteElement as $xmlNote) { $noteAttributes = $xmlNote->attributes(); - $note = array('content' => $this->utf8ToCharset((string) $xmlNote, $encoding)); + $note = ['content' => $this->utf8ToCharset((string) $xmlNote, $encoding)]; if (isset($noteAttributes['priority'])) { $note['priority'] = (int) $noteAttributes['priority']; } diff --git a/vendor/symfony/translation/LoggingTranslator.php b/vendor/symfony/translation/LoggingTranslator.php index 01456708639ac72a8a399155f83baef8edfda84c..306776e007d3b2a44732b4e753e57eab50717947 100644 --- a/vendor/symfony/translation/LoggingTranslator.php +++ b/vendor/symfony/translation/LoggingTranslator.php @@ -43,7 +43,7 @@ public function __construct(TranslatorInterface $translator, LoggerInterface $lo /** * {@inheritdoc} */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) + public function trans($id, array $parameters = [], $domain = null, $locale = null) { $trans = $this->translator->trans($id, $parameters, $domain, $locale); $this->log($id, $domain, $locale); @@ -54,7 +54,7 @@ public function trans($id, array $parameters = array(), $domain = null, $locale /** * {@inheritdoc} */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) + public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); $this->log($id, $domain, $locale); @@ -89,7 +89,7 @@ public function getCatalogue($locale = null) /** * Gets the fallback locales. * - * @return array $locales The fallback locales + * @return array The fallback locales */ public function getFallbackLocales() { @@ -97,7 +97,7 @@ public function getFallbackLocales() return $this->translator->getFallbackLocales(); } - return array(); + return []; } /** @@ -105,7 +105,7 @@ public function getFallbackLocales() */ public function __call($method, $args) { - return \call_user_func_array(array($this->translator, $method), $args); + return \call_user_func_array([$this->translator, $method], $args); } /** @@ -128,9 +128,9 @@ private function log($id, $domain, $locale) } if ($catalogue->has($id, $domain)) { - $this->logger->debug('Translation use fallback catalogue.', array('id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale())); + $this->logger->debug('Translation use fallback catalogue.', ['id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale()]); } else { - $this->logger->warning('Translation not found.', array('id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale())); + $this->logger->warning('Translation not found.', ['id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale()]); } } } diff --git a/vendor/symfony/translation/MessageCatalogue.php b/vendor/symfony/translation/MessageCatalogue.php index df917bbba9e346e55c3d91b7b43762a51b8995f6..73fdcfdc829f42183e285e81c898eb0ab14edac2 100644 --- a/vendor/symfony/translation/MessageCatalogue.php +++ b/vendor/symfony/translation/MessageCatalogue.php @@ -19,9 +19,9 @@ */ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterface { - private $messages = array(); - private $metadata = array(); - private $resources = array(); + private $messages = []; + private $metadata = []; + private $resources = []; private $locale; private $fallbackCatalogue; private $parent; @@ -30,7 +30,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf * @param string $locale The locale * @param array $messages An array of messages classified by domain */ - public function __construct($locale, array $messages = array()) + public function __construct($locale, array $messages = []) { $this->locale = $locale; $this->messages = $messages; @@ -61,7 +61,7 @@ public function all($domain = null) return $this->messages; } - return isset($this->messages[$domain]) ? $this->messages[$domain] : array(); + return isset($this->messages[$domain]) ? $this->messages[$domain] : []; } /** @@ -69,7 +69,7 @@ public function all($domain = null) */ public function set($id, $translation, $domain = 'messages') { - $this->add(array($id => $translation), $domain); + $this->add([$id => $translation], $domain); } /** @@ -117,7 +117,7 @@ public function get($id, $domain = 'messages') */ public function replace($messages, $domain = 'messages') { - $this->messages[$domain] = array(); + $this->messages[$domain] = []; $this->add($messages, $domain); } @@ -247,7 +247,7 @@ public function setMetadata($key, $value, $domain = 'messages') public function deleteMetadata($key = '', $domain = 'messages') { if ('' == $domain) { - $this->metadata = array(); + $this->metadata = []; } elseif ('' == $key) { unset($this->metadata[$domain]); } else { diff --git a/vendor/symfony/translation/MessageSelector.php b/vendor/symfony/translation/MessageSelector.php index 5de171c5f4a408c84d7b85453be7c271d69980ea..a7743ebae30e10745233009315e9d45e67bac252 100644 --- a/vendor/symfony/translation/MessageSelector.php +++ b/vendor/symfony/translation/MessageSelector.php @@ -49,15 +49,15 @@ class MessageSelector */ public function choose($message, $number, $locale) { - $parts = array(); + $parts = []; if (preg_match('/^\|++$/', $message)) { $parts = explode('|', $message); } elseif (preg_match_all('/(?:\|\||[^\|])++/', $message, $matches)) { $parts = $matches[0]; } - $explicitRules = array(); - $standardRules = array(); + $explicitRules = []; + $standardRules = []; foreach ($parts as $part) { $part = trim(str_replace('||', '|', $part)); diff --git a/vendor/symfony/translation/PluralizationRules.php b/vendor/symfony/translation/PluralizationRules.php index 3aca0ba9632989d9f716974013a3dab713e2b663..d369f5f3fabf32e9c46e123b35c09edd06883b65 100644 --- a/vendor/symfony/translation/PluralizationRules.php +++ b/vendor/symfony/translation/PluralizationRules.php @@ -18,7 +18,7 @@ */ class PluralizationRules { - private static $rules = array(); + private static $rules = []; /** * Returns the plural position to use for the given locale and number. diff --git a/vendor/symfony/translation/Reader/TranslationReader.php b/vendor/symfony/translation/Reader/TranslationReader.php index 948edec492e58d2aeac203ef2e6eae1104242da3..e4554f39b4ee5641972f84d10deecb55fb4c6136 100644 --- a/vendor/symfony/translation/Reader/TranslationReader.php +++ b/vendor/symfony/translation/Reader/TranslationReader.php @@ -27,7 +27,7 @@ class TranslationReader implements TranslationReaderInterface * * @var array */ - private $loaders = array(); + private $loaders = []; /** * Adds a loader to the translation extractor. diff --git a/vendor/symfony/translation/Resources/bin/translation-status.php b/vendor/symfony/translation/Resources/bin/translation-status.php new file mode 100644 index 0000000000000000000000000000000000000000..acc8b4e227222d10c545eb7569fd02432bedc15f --- /dev/null +++ b/vendor/symfony/translation/Resources/bin/translation-status.php @@ -0,0 +1,195 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +$usageInstructions = <<<END + + Usage instructions + ------------------------------------------------------------------------------- + + $ cd symfony-code-root-directory/ + + # show the translation status of all locales + $ php translation-status.php + + # show the translation status of all locales and all their missing translations + $ php translation-status.php -v + + # show the status of a single locale + $ php translation-status.php fr + + # show the status of a single locale and all its missing translations + $ php translation-status.php fr -v + +END; + +$config = [ + // if TRUE, the full list of missing translations is displayed + 'verbose_output' => false, + // NULL = analyze all locales + 'locale_to_analyze' => null, + // the reference files all the other translations are compared to + 'original_files' => [ + 'src/Symfony/Component/Form/Resources/translations/validators.en.xlf', + 'src/Symfony/Component/Security/Core/Resources/translations/security.en.xlf', + 'src/Symfony/Component/Validator/Resources/translations/validators.en.xlf', + ], +]; + +$argc = $_SERVER['argc']; +$argv = $_SERVER['argv']; + +if ($argc > 3) { + echo str_replace('translation-status.php', $argv[0], $usageInstructions); + exit(1); +} + +foreach (array_slice($argv, 1) as $argumentOrOption) { + if (0 === strpos($argumentOrOption, '-')) { + $config['verbose_output'] = true; + } else { + $config['locale_to_analyze'] = $argumentOrOption; + } +} + +foreach ($config['original_files'] as $originalFilePath) { + if (!file_exists($originalFilePath)) { + echo sprintf('The following file does not exist. Make sure that you execute this command at the root dir of the Symfony code repository.%s %s', PHP_EOL, $originalFilePath); + exit(1); + } +} + +$totalMissingTranslations = 0; + +foreach ($config['original_files'] as $originalFilePath) { + $translationFilePaths = findTranslationFiles($originalFilePath, $config['locale_to_analyze']); + $translationStatus = calculateTranslationStatus($originalFilePath, $translationFilePaths); + + $totalMissingTranslations += array_sum(array_map(function ($translation) { + return \count($translation['missingKeys']); + }, array_values($translationStatus))); + + printTranslationStatus($originalFilePath, $translationStatus, $config['verbose_output']); +} + +exit($totalMissingTranslations > 0 ? 1 : 0); + +function findTranslationFiles($originalFilePath, $localeToAnalyze) +{ + $translations = []; + + $translationsDir = dirname($originalFilePath); + $originalFileName = basename($originalFilePath); + $translationFileNamePattern = str_replace('.en.', '.*.', $originalFileName); + + $translationFiles = glob($translationsDir.'/'.$translationFileNamePattern); + foreach ($translationFiles as $filePath) { + $locale = extractLocaleFromFilePath($filePath); + + if (null !== $localeToAnalyze && $locale !== $localeToAnalyze) { + continue; + } + + $translations[$locale] = $filePath; + } + + return $translations; +} + +function calculateTranslationStatus($originalFilePath, $translationFilePaths) +{ + $translationStatus = []; + $allTranslationKeys = extractTranslationKeys($originalFilePath); + + foreach ($translationFilePaths as $locale => $translationPath) { + $translatedKeys = extractTranslationKeys($translationPath); + $missingKeys = array_diff_key($allTranslationKeys, $translatedKeys); + + $translationStatus[$locale] = [ + 'total' => \count($allTranslationKeys), + 'translated' => \count($translatedKeys), + 'missingKeys' => $missingKeys, + ]; + } + + return $translationStatus; +} + +function printTranslationStatus($originalFilePath, $translationStatus, $verboseOutput) +{ + printTitle($originalFilePath); + printTable($translationStatus, $verboseOutput); + echo PHP_EOL.PHP_EOL; +} + +function extractLocaleFromFilePath($filePath) +{ + $parts = explode('.', $filePath); + + return $parts[count($parts) - 2]; +} + +function extractTranslationKeys($filePath) +{ + $translationKeys = []; + $contents = new \SimpleXMLElement(file_get_contents($filePath)); + + foreach ($contents->file->body->{'trans-unit'} as $translationKey) { + $translationId = (string) $translationKey['id']; + $translationKey = (string) $translationKey->source; + + $translationKeys[$translationId] = $translationKey; + } + + return $translationKeys; +} + +function printTitle($title) +{ + echo $title.PHP_EOL; + echo str_repeat('=', strlen($title)).PHP_EOL.PHP_EOL; +} + +function printTable($translations, $verboseOutput) +{ + $longestLocaleNameLength = max(array_map('strlen', array_keys($translations))); + + foreach ($translations as $locale => $translation) { + $isTranslationCompleted = $translation['translated'] === $translation['total']; + if ($isTranslationCompleted) { + textColorGreen(); + } + + echo sprintf('| Locale: %-'.$longestLocaleNameLength.'s | Translated: %d/%d', $locale, $translation['translated'], $translation['total']).PHP_EOL; + + textColorNormal(); + + if (true === $verboseOutput && \count($translation['missingKeys']) > 0) { + echo str_repeat('-', 80).PHP_EOL; + echo '| Missing Translations:'.PHP_EOL; + + foreach ($translation['missingKeys'] as $id => $content) { + echo sprintf('| (id=%s) %s', $id, $content).PHP_EOL; + } + + echo str_repeat('-', 80).PHP_EOL; + } + } +} + +function textColorGreen() +{ + echo "\033[32m"; +} + +function textColorNormal() +{ + echo "\033[0m"; +} diff --git a/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php b/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php index 90cf4a5dc381ed7203daa71dded03bade0a5f50b..e39ef39ec51fcc3c94146542b7a7757b312c03f7 100644 --- a/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php +++ b/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php @@ -20,7 +20,7 @@ abstract class AbstractOperationTest extends TestCase public function testGetEmptyDomains() { $this->assertEquals( - array(), + [], $this->createOperation( new MessageCatalogue('en'), new MessageCatalogue('en') @@ -31,10 +31,10 @@ public function testGetEmptyDomains() public function testGetMergedDomains() { $this->assertEquals( - array('a', 'b', 'c'), + ['a', 'b', 'c'], $this->createOperation( - new MessageCatalogue('en', array('a' => array(), 'b' => array())), - new MessageCatalogue('en', array('b' => array(), 'c' => array())) + new MessageCatalogue('en', ['a' => [], 'b' => []]), + new MessageCatalogue('en', ['b' => [], 'c' => []]) )->getDomains() ); } @@ -51,9 +51,9 @@ public function testGetMessagesFromUnknownDomain() public function testGetEmptyMessages() { $this->assertEquals( - array(), + [], $this->createOperation( - new MessageCatalogue('en', array('a' => array())), + new MessageCatalogue('en', ['a' => []]), new MessageCatalogue('en') )->getMessages('a') ); diff --git a/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php b/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php index 8b51c15daec9210788f1e6d7ba5754664401bd63..0dc68beb9baa38c1a77b3a07db267908c2553f66 100644 --- a/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php +++ b/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php @@ -20,22 +20,22 @@ class MergeOperationTest extends AbstractOperationTest public function testGetMessagesFromSingleDomain() { $operation = $this->createOperation( - new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), - new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) + new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), + new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) ); $this->assertEquals( - array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'), + ['a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'], $operation->getMessages('messages') ); $this->assertEquals( - array('c' => 'new_c'), + ['c' => 'new_c'], $operation->getNewMessages('messages') ); $this->assertEquals( - array(), + [], $operation->getObsoleteMessages('messages') ); } @@ -43,26 +43,26 @@ public function testGetMessagesFromSingleDomain() public function testGetResultFromSingleDomain() { $this->assertEquals( - new MessageCatalogue('en', array( - 'messages' => array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'), - )), + new MessageCatalogue('en', [ + 'messages' => ['a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'], + ]), $this->createOperation( - new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), - new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) + new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), + new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) )->getResult() ); } public function testGetResultWithMetadata() { - $leftCatalogue = new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))); + $leftCatalogue = new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]); $leftCatalogue->setMetadata('a', 'foo', 'messages'); $leftCatalogue->setMetadata('b', 'bar', 'messages'); - $rightCatalogue = new MessageCatalogue('en', array('messages' => array('b' => 'new_b', 'c' => 'new_c'))); + $rightCatalogue = new MessageCatalogue('en', ['messages' => ['b' => 'new_b', 'c' => 'new_c']]); $rightCatalogue->setMetadata('b', 'baz', 'messages'); $rightCatalogue->setMetadata('c', 'qux', 'messages'); - $mergedCatalogue = new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'))); + $mergedCatalogue = new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c']]); $mergedCatalogue->setMetadata('a', 'foo', 'messages'); $mergedCatalogue->setMetadata('b', 'bar', 'messages'); $mergedCatalogue->setMetadata('c', 'qux', 'messages'); diff --git a/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php b/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php index 271d17fb8f311bc347ca7c52a488f8758389eb5c..8077ff095620e9b672efdc0133790af158353e97 100644 --- a/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php +++ b/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php @@ -20,22 +20,22 @@ class TargetOperationTest extends AbstractOperationTest public function testGetMessagesFromSingleDomain() { $operation = $this->createOperation( - new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), - new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) + new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), + new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) ); $this->assertEquals( - array('a' => 'old_a', 'c' => 'new_c'), + ['a' => 'old_a', 'c' => 'new_c'], $operation->getMessages('messages') ); $this->assertEquals( - array('c' => 'new_c'), + ['c' => 'new_c'], $operation->getNewMessages('messages') ); $this->assertEquals( - array('b' => 'old_b'), + ['b' => 'old_b'], $operation->getObsoleteMessages('messages') ); } @@ -43,26 +43,26 @@ public function testGetMessagesFromSingleDomain() public function testGetResultFromSingleDomain() { $this->assertEquals( - new MessageCatalogue('en', array( - 'messages' => array('a' => 'old_a', 'c' => 'new_c'), - )), + new MessageCatalogue('en', [ + 'messages' => ['a' => 'old_a', 'c' => 'new_c'], + ]), $this->createOperation( - new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), - new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) + new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), + new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) )->getResult() ); } public function testGetResultWithMetadata() { - $leftCatalogue = new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))); + $leftCatalogue = new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]); $leftCatalogue->setMetadata('a', 'foo', 'messages'); $leftCatalogue->setMetadata('b', 'bar', 'messages'); - $rightCatalogue = new MessageCatalogue('en', array('messages' => array('b' => 'new_b', 'c' => 'new_c'))); + $rightCatalogue = new MessageCatalogue('en', ['messages' => ['b' => 'new_b', 'c' => 'new_c']]); $rightCatalogue->setMetadata('b', 'baz', 'messages'); $rightCatalogue->setMetadata('c', 'qux', 'messages'); - $diffCatalogue = new MessageCatalogue('en', array('messages' => array('b' => 'old_b', 'c' => 'new_c'))); + $diffCatalogue = new MessageCatalogue('en', ['messages' => ['b' => 'old_b', 'c' => 'new_c']]); $diffCatalogue->setMetadata('b', 'bar', 'messages'); $diffCatalogue->setMetadata('c', 'qux', 'messages'); diff --git a/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php b/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php index 504a69e6dd0b12391ca3fac0adcef904790b4722..b4d350ef862e5487425bbe59ec56a48f91d99430 100644 --- a/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php +++ b/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php @@ -27,7 +27,7 @@ protected function setUp() public function testCollectEmptyMessages() { $translator = $this->getTranslator(); - $translator->expects($this->any())->method('getCollectedMessages')->will($this->returnValue(array())); + $translator->expects($this->any())->method('getCollectedMessages')->will($this->returnValue([])); $dataCollector = new TranslationDataCollector($translator); $dataCollector->lateCollect(); @@ -35,94 +35,94 @@ public function testCollectEmptyMessages() $this->assertEquals(0, $dataCollector->getCountMissings()); $this->assertEquals(0, $dataCollector->getCountFallbacks()); $this->assertEquals(0, $dataCollector->getCountDefines()); - $this->assertEquals(array(), $dataCollector->getMessages()->getValue()); + $this->assertEquals([], $dataCollector->getMessages()->getValue()); } public function testCollect() { - $collectedMessages = array( - array( - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'parameters' => array(), - 'transChoiceNumber' => null, - ), - array( - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), - 'transChoiceNumber' => null, - ), - array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 3), - 'transChoiceNumber' => 3, - ), - array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 3), - 'transChoiceNumber' => 3, - ), - array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 4, '%foo%' => 'bar'), - 'transChoiceNumber' => 4, - ), - ); - $expectedMessages = array( - array( - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'count' => 1, - 'parameters' => array(), - 'transChoiceNumber' => null, - ), - array( - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'count' => 1, - 'parameters' => array(), - 'transChoiceNumber' => null, - ), - array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'count' => 3, - 'parameters' => array( - array('%count%' => 3), - array('%count%' => 3), - array('%count%' => 4, '%foo%' => 'bar'), - ), - 'transChoiceNumber' => 3, - ), - ); + $collectedMessages = [ + [ + 'id' => 'foo', + 'translation' => 'foo (en)', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_DEFINED, + 'parameters' => [], + 'transChoiceNumber' => null, + ], + [ + 'id' => 'bar', + 'translation' => 'bar (fr)', + 'locale' => 'fr', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => [], + 'transChoiceNumber' => null, + ], + [ + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => ['%count%' => 3], + 'transChoiceNumber' => 3, + ], + [ + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => ['%count%' => 3], + 'transChoiceNumber' => 3, + ], + [ + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => ['%count%' => 4, '%foo%' => 'bar'], + 'transChoiceNumber' => 4, + ], + ]; + $expectedMessages = [ + [ + 'id' => 'foo', + 'translation' => 'foo (en)', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_DEFINED, + 'count' => 1, + 'parameters' => [], + 'transChoiceNumber' => null, + ], + [ + 'id' => 'bar', + 'translation' => 'bar (fr)', + 'locale' => 'fr', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'count' => 1, + 'parameters' => [], + 'transChoiceNumber' => null, + ], + [ + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'count' => 3, + 'parameters' => [ + ['%count%' => 3], + ['%count%' => 3], + ['%count%' => 4, '%foo%' => 'bar'], + ], + 'transChoiceNumber' => 3, + ], + ]; $translator = $this->getTranslator(); $translator->expects($this->any())->method('getCollectedMessages')->will($this->returnValue($collectedMessages)); diff --git a/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php b/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php index cc196223ccfa89d14db37cf531f0976b45068025..059d074648722a5cefd64b3f0de06c22334af2a7 100644 --- a/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php +++ b/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php @@ -21,60 +21,60 @@ class DataCollectorTranslatorTest extends TestCase public function testCollectMessages() { $collector = $this->createCollector(); - $collector->setFallbackLocales(array('fr', 'ru')); + $collector->setFallbackLocales(['fr', 'ru']); $collector->trans('foo'); $collector->trans('bar'); $collector->transChoice('choice', 0); $collector->trans('bar_ru'); - $collector->trans('bar_ru', array('foo' => 'bar')); + $collector->trans('bar_ru', ['foo' => 'bar']); - $expectedMessages = array(); - $expectedMessages[] = array( - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'parameters' => array(), - 'transChoiceNumber' => null, - ); - $expectedMessages[] = array( - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), - 'transChoiceNumber' => null, - ); - $expectedMessages[] = array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array(), - 'transChoiceNumber' => 0, - ); - $expectedMessages[] = array( - 'id' => 'bar_ru', - 'translation' => 'bar (ru)', - 'locale' => 'ru', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), - 'transChoiceNumber' => null, - ); - $expectedMessages[] = array( - 'id' => 'bar_ru', - 'translation' => 'bar (ru)', - 'locale' => 'ru', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array('foo' => 'bar'), - 'transChoiceNumber' => null, - ); + $expectedMessages = []; + $expectedMessages[] = [ + 'id' => 'foo', + 'translation' => 'foo (en)', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_DEFINED, + 'parameters' => [], + 'transChoiceNumber' => null, + ]; + $expectedMessages[] = [ + 'id' => 'bar', + 'translation' => 'bar (fr)', + 'locale' => 'fr', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => [], + 'transChoiceNumber' => null, + ]; + $expectedMessages[] = [ + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => [], + 'transChoiceNumber' => 0, + ]; + $expectedMessages[] = [ + 'id' => 'bar_ru', + 'translation' => 'bar (ru)', + 'locale' => 'ru', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => [], + 'transChoiceNumber' => null, + ]; + $expectedMessages[] = [ + 'id' => 'bar_ru', + 'translation' => 'bar (ru)', + 'locale' => 'ru', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => ['foo' => 'bar'], + 'transChoiceNumber' => null, + ]; $this->assertEquals($expectedMessages, $collector->getCollectedMessages()); } @@ -83,9 +83,9 @@ private function createCollector() { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (en)'), 'en'); - $translator->addResource('array', array('bar' => 'bar (fr)'), 'fr'); - $translator->addResource('array', array('bar_ru' => 'bar (ru)'), 'ru'); + $translator->addResource('array', ['foo' => 'foo (en)'], 'en'); + $translator->addResource('array', ['bar' => 'bar (fr)'], 'fr'); + $translator->addResource('array', ['bar_ru' => 'bar (ru)'], 'ru'); return new DataCollectorTranslator($translator); } diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php index 759bb0e97d3b4be339749c442d310dc6807c9c08..94769e9dae9e05a65ba542e4c922de1824355b9c 100644 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php +++ b/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php @@ -23,12 +23,12 @@ public function testProcess() $container = new ContainerBuilder(); $writerDefinition = $container->register('translation.writer'); $container->register('foo.id') - ->addTag('translation.dumper', array('alias' => 'bar.alias')); + ->addTag('translation.dumper', ['alias' => 'bar.alias']); $translationDumperPass = new TranslationDumperPass(); $translationDumperPass->process($container); - $this->assertEquals(array(array('addDumper', array('bar.alias', new Reference('foo.id')))), $writerDefinition->getMethodCalls()); + $this->assertEquals([['addDumper', ['bar.alias', new Reference('foo.id')]]], $writerDefinition->getMethodCalls()); } public function testProcessNoDefinitionFound() diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php index 14d164d0ee3c6ddcc78a26fa957feff52d72d566..a638498b6bdefa42c80dc612d16e5fc61defd2ac 100644 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php +++ b/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php @@ -23,12 +23,12 @@ public function testProcess() $container = new ContainerBuilder(); $extractorDefinition = $container->register('translation.extractor'); $container->register('foo.id') - ->addTag('translation.extractor', array('alias' => 'bar.alias')); + ->addTag('translation.extractor', ['alias' => 'bar.alias']); $translationDumperPass = new TranslationExtractorPass(); $translationDumperPass->process($container); - $this->assertEquals(array(array('addExtractor', array('bar.alias', new Reference('foo.id')))), $extractorDefinition->getMethodCalls()); + $this->assertEquals([['addExtractor', ['bar.alias', new Reference('foo.id')]]], $extractorDefinition->getMethodCalls()); } public function testProcessNoDefinitionFound() @@ -56,7 +56,7 @@ public function testProcessMissingAlias() $container = new ContainerBuilder(); $container->register('translation.extractor'); $container->register('foo.id') - ->addTag('translation.extractor', array()); + ->addTag('translation.extractor', []); $definition->expects($this->never())->method('addMethodCall'); diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php index 4c03aaca57003c62fd9d4bfc1d60563b89346d0f..96ec625026f69d22fbce416e34f407daf88d05fa 100644 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php +++ b/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php @@ -23,12 +23,12 @@ class TranslationPassTest extends TestCase public function testValidCollector() { $loader = (new Definition()) - ->addTag('translation.loader', array('alias' => 'xliff', 'legacy-alias' => 'xlf')); + ->addTag('translation.loader', ['alias' => 'xliff', 'legacy-alias' => 'xlf']); $reader = new Definition(); $translator = (new Definition()) - ->setArguments(array(null, null, null, null)); + ->setArguments([null, null, null, null]); $container = new ContainerBuilder(); $container->setDefinition('translator.default', $translator); @@ -39,19 +39,19 @@ public function testValidCollector() $pass->process($container); $expectedReader = (new Definition()) - ->addMethodCall('addLoader', array('xliff', new Reference('translation.xliff_loader'))) - ->addMethodCall('addLoader', array('xlf', new Reference('translation.xliff_loader'))) + ->addMethodCall('addLoader', ['xliff', new Reference('translation.xliff_loader')]) + ->addMethodCall('addLoader', ['xlf', new Reference('translation.xliff_loader')]) ; $this->assertEquals($expectedReader, $reader); $expectedLoader = (new Definition()) - ->addTag('translation.loader', array('alias' => 'xliff', 'legacy-alias' => 'xlf')) + ->addTag('translation.loader', ['alias' => 'xliff', 'legacy-alias' => 'xlf']) ; $this->assertEquals($expectedLoader, $loader); - $this->assertSame(array('translation.xliff_loader' => array('xliff', 'xlf')), $translator->getArgument(3)); + $this->assertSame(['translation.xliff_loader' => ['xliff', 'xlf']], $translator->getArgument(3)); - $expected = array('translation.xliff_loader' => new ServiceClosureArgument(new Reference('translation.xliff_loader'))); + $expected = ['translation.xliff_loader' => new ServiceClosureArgument(new Reference('translation.xliff_loader'))]; $this->assertEquals($expected, $container->getDefinition((string) $translator->getArgument(0))->getArgument(0)); } @@ -66,13 +66,13 @@ public function testValidCollector() public function testValidCollectorWithDeprecatedTranslationLoader() { $loader = (new Definition()) - ->addTag('translation.loader', array('alias' => 'xliff', 'legacy-alias' => 'xlf')); + ->addTag('translation.loader', ['alias' => 'xliff', 'legacy-alias' => 'xlf']); $legacyReader = new Definition(); $reader = new Definition(); $translator = (new Definition()) - ->setArguments(array(null, null, null, null)); + ->setArguments([null, null, null, null]); $container = new ContainerBuilder(); $container->setDefinition('translator.default', $translator); @@ -84,20 +84,20 @@ public function testValidCollectorWithDeprecatedTranslationLoader() $pass->process($container); $expectedReader = (new Definition()) - ->addMethodCall('addLoader', array('xliff', new Reference('translation.xliff_loader'))) - ->addMethodCall('addLoader', array('xlf', new Reference('translation.xliff_loader'))) + ->addMethodCall('addLoader', ['xliff', new Reference('translation.xliff_loader')]) + ->addMethodCall('addLoader', ['xlf', new Reference('translation.xliff_loader')]) ; $this->assertEquals($expectedReader, $legacyReader); $this->assertEquals($expectedReader, $reader); $expectedLoader = (new Definition()) - ->addTag('translation.loader', array('alias' => 'xliff', 'legacy-alias' => 'xlf')) + ->addTag('translation.loader', ['alias' => 'xliff', 'legacy-alias' => 'xlf']) ; $this->assertEquals($expectedLoader, $loader); - $this->assertSame(array('translation.xliff_loader' => array('xliff', 'xlf')), $translator->getArgument(3)); + $this->assertSame(['translation.xliff_loader' => ['xliff', 'xlf']], $translator->getArgument(3)); - $expected = array('translation.xliff_loader' => new ServiceClosureArgument(new Reference('translation.xliff_loader'))); + $expected = ['translation.xliff_loader' => new ServiceClosureArgument(new Reference('translation.xliff_loader'))]; $this->assertEquals($expected, $container->getDefinition((string) $translator->getArgument(0))->getArgument(0)); } } diff --git a/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php index 9a7a059a4e823204d208d314a83bcb5fecf8dcf7..0d1cf2c628651d6e1bbbbbb4159cb06fbfb6ad6b 100644 --- a/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php @@ -20,8 +20,8 @@ class CsvFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar', 'bar' => 'foo -foo', 'foo;foo' => 'bar')); + $catalogue->add(['foo' => 'bar', 'bar' => 'foo +foo', 'foo;foo' => 'bar']); $dumper = new CsvFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php index bac567fd5fb7fb81d5e4ab266c420b05f4421b99..df201461a7b867c6dcbae190cde98ae5b68af966 100644 --- a/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php @@ -22,10 +22,10 @@ public function testDump() $tempDir = sys_get_temp_dir(); $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new ConcreteFileDumper(); - $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, ['path' => $tempDir]); $this->assertFileExists($tempDir.'/messages.en.concrete'); @@ -44,10 +44,10 @@ public function testDumpBackupsFileIfExisting() @touch($file); $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new ConcreteFileDumper(); - $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, ['path' => $tempDir]); $this->assertFileExists($backupFile); @@ -62,11 +62,11 @@ public function testDumpCreatesNestedDirectoriesAndFile() $file = $translationsDir.'/messages.en.concrete'; $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new ConcreteFileDumper(); $dumper->setRelativePathTemplate('test/translations/%domain%.%locale%.%extension%'); - $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, ['path' => $tempDir]); $this->assertFileExists($file); @@ -77,7 +77,7 @@ public function testDumpCreatesNestedDirectoriesAndFile() class ConcreteFileDumper extends FileDumper { - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { return ''; } diff --git a/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php index 78d0abb6e4e1cf2223ab4a5c5ba27a241a7a9bee..dcb9c2c38f78bce17742469c1e2d0d0233423e7d 100644 --- a/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php @@ -20,7 +20,7 @@ class IcuResFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new IcuResFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php index 5f3c1236c7f50bcbc05718215c42a5ba6e336ceb..1ed168bdc3a1240bd30e07852e580b90fb1044c7 100644 --- a/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php @@ -20,7 +20,7 @@ class IniFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new IniFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php index b134ce4f23149baa34d39d63959aade5d5f46504..04e3d86bec4cbb89cedce440365cef623bbfce29 100644 --- a/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php @@ -20,7 +20,7 @@ class JsonFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new JsonFileDumper(); @@ -30,10 +30,10 @@ public function testFormatCatalogue() public function testDumpWithCustomEncoding() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => '"bar"')); + $catalogue->add(['foo' => '"bar"']); $dumper = new JsonFileDumper(); - $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.dump.json', $dumper->formatCatalogue($catalogue, 'messages', array('json_encoding' => JSON_HEX_QUOT))); + $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.dump.json', $dumper->formatCatalogue($catalogue, 'messages', ['json_encoding' => JSON_HEX_QUOT])); } } diff --git a/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php index d0519675bc4017ef3fb7e8991163999ec77a72d7..fbbd75dc3b4902fb43cfa4dd03464faa2cf7364c 100644 --- a/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php @@ -20,7 +20,7 @@ class MoFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new MoFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php index 22a39dd43d73d65f5eebe9c42e42816da937e122..00e535da391cd85d55636cb7b384cf711f6b92c1 100644 --- a/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php @@ -20,7 +20,7 @@ class PhpFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new PhpFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php index 5d75247103d8074cafb37ee4cb82bf5c50a7e4e4..d694a6dd3fb115cfedb70a5592984bd151dd889d 100644 --- a/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php @@ -20,7 +20,7 @@ class PoFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new PoFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php index 8e4a6f43fcf677bba63e4260709bfa8d74f0c2b0..edfad6005cb71393322bf1066605f955035c3b2b 100644 --- a/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php @@ -20,7 +20,7 @@ class QtFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar'), 'resources'); + $catalogue->add(['foo' => 'bar'], 'resources'); $dumper = new QtFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php index 443dccf2bcdc03a6e050ca24eb1eefaa6e183504..c634a2793671144cb407af60606db38ce74a9731 100644 --- a/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php @@ -20,49 +20,49 @@ class XliffFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array( + $catalogue->add([ 'foo' => 'bar', 'key' => '', 'key.with.cdata' => '<source> & <target>', - )); - $catalogue->setMetadata('foo', array('notes' => array(array('priority' => 1, 'from' => 'bar', 'content' => 'baz')))); - $catalogue->setMetadata('key', array('notes' => array(array('content' => 'baz'), array('content' => 'qux')))); + ]); + $catalogue->setMetadata('foo', ['notes' => [['priority' => 1, 'from' => 'bar', 'content' => 'baz']]]); + $catalogue->setMetadata('key', ['notes' => [['content' => 'baz'], ['content' => 'qux']]]); $dumper = new XliffFileDumper(); $this->assertStringEqualsFile( __DIR__.'/../fixtures/resources-clean.xlf', - $dumper->formatCatalogue($catalogue, 'messages', array('default_locale' => 'fr_FR')) + $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR']) ); } public function testFormatCatalogueXliff2() { $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array( + $catalogue->add([ 'foo' => 'bar', 'key' => '', 'key.with.cdata' => '<source> & <target>', - )); - $catalogue->setMetadata('key', array('target-attributes' => array('order' => 1))); + ]); + $catalogue->setMetadata('key', ['target-attributes' => ['order' => 1]]); $dumper = new XliffFileDumper(); $this->assertStringEqualsFile( __DIR__.'/../fixtures/resources-2.0-clean.xlf', - $dumper->formatCatalogue($catalogue, 'messages', array('default_locale' => 'fr_FR', 'xliff_version' => '2.0')) + $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR', 'xliff_version' => '2.0']) ); } public function testFormatCatalogueWithCustomToolInfo() { - $options = array( + $options = [ 'default_locale' => 'en_US', - 'tool_info' => array('tool-id' => 'foo', 'tool-name' => 'foo', 'tool-version' => '0.0', 'tool-company' => 'Foo'), - ); + 'tool_info' => ['tool-id' => 'foo', 'tool-name' => 'foo', 'tool-version' => '0.0', 'tool-company' => 'Foo'], + ]; $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new XliffFileDumper(); @@ -75,41 +75,41 @@ public function testFormatCatalogueWithCustomToolInfo() public function testFormatCatalogueWithTargetAttributesMetadata() { $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array( + $catalogue->add([ 'foo' => 'bar', - )); - $catalogue->setMetadata('foo', array('target-attributes' => array('state' => 'needs-translation'))); + ]); + $catalogue->setMetadata('foo', ['target-attributes' => ['state' => 'needs-translation']]); $dumper = new XliffFileDumper(); $this->assertStringEqualsFile( __DIR__.'/../fixtures/resources-target-attributes.xlf', - $dumper->formatCatalogue($catalogue, 'messages', array('default_locale' => 'fr_FR')) + $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR']) ); } public function testFormatCatalogueWithNotesMetadata() { $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array( + $catalogue->add([ 'foo' => 'bar', 'baz' => 'biz', - )); - $catalogue->setMetadata('foo', array('notes' => array( - array('category' => 'state', 'content' => 'new'), - array('category' => 'approved', 'content' => 'true'), - array('category' => 'section', 'content' => 'user login', 'priority' => '1'), - ))); - $catalogue->setMetadata('baz', array('notes' => array( - array('id' => 'x', 'content' => 'x_content'), - array('appliesTo' => 'target', 'category' => 'quality', 'content' => 'Fuzzy'), - ))); + ]); + $catalogue->setMetadata('foo', ['notes' => [ + ['category' => 'state', 'content' => 'new'], + ['category' => 'approved', 'content' => 'true'], + ['category' => 'section', 'content' => 'user login', 'priority' => '1'], + ]]); + $catalogue->setMetadata('baz', ['notes' => [ + ['id' => 'x', 'content' => 'x_content'], + ['appliesTo' => 'target', 'category' => 'quality', 'content' => 'Fuzzy'], + ]]); $dumper = new XliffFileDumper(); $this->assertStringEqualsFile( __DIR__.'/../fixtures/resources-notes-meta.xlf', - $dumper->formatCatalogue($catalogue, 'messages', array('default_locale' => 'fr_FR', 'xliff_version' => '2.0')) + $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR', 'xliff_version' => '2.0']) ); } } diff --git a/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php index a5549a2e93007e9a01049fee4760641b274221af..24bc65ba248fbfa9dd894930a6d63819c2c50fef 100644 --- a/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php @@ -21,24 +21,24 @@ public function testTreeFormatCatalogue() { $catalogue = new MessageCatalogue('en'); $catalogue->add( - array( + [ 'foo.bar1' => 'value1', 'foo.bar2' => 'value2', - )); + ]); $dumper = new YamlFileDumper(); - $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages.yml', $dumper->formatCatalogue($catalogue, 'messages', array('as_tree' => true, 'inline' => 999))); + $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages.yml', $dumper->formatCatalogue($catalogue, 'messages', ['as_tree' => true, 'inline' => 999])); } public function testLinearFormatCatalogue() { $catalogue = new MessageCatalogue('en'); $catalogue->add( - array( + [ 'foo.bar1' => 'value1', 'foo.bar2' => 'value2', - )); + ]); $dumper = new YamlFileDumper(); diff --git a/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php b/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php index 3487dd62489ee2071349253b2f7541356f06df1d..73ccb07cfb07e8c63eeeacb9b3615df0ef1afa1c 100644 --- a/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php +++ b/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php @@ -39,8 +39,8 @@ public function testExtraction($resource) nowdoc key with whitespace and nonescaped \$\n sequences EOF; // Assert - $expectedCatalogue = array( - 'messages' => array( + $expectedCatalogue = [ + 'messages' => [ 'single-quoted key' => 'prefixsingle-quoted key', 'double-quoted key' => 'prefixdouble-quoted key', 'heredoc key' => 'prefixheredoc key', @@ -51,8 +51,9 @@ public function testExtraction($resource) $expectedHeredoc => 'prefix'.$expectedHeredoc, $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', - ), - 'not_messages' => array( + 'concatenated message with heredoc and nowdoc' => 'prefixconcatenated message with heredoc and nowdoc', + ], + 'not_messages' => [ 'other-domain-test-no-params-short-array' => 'prefixother-domain-test-no-params-short-array', 'other-domain-test-no-params-long-array' => 'prefixother-domain-test-no-params-long-array', 'other-domain-test-params-short-array' => 'prefixother-domain-test-params-short-array', @@ -62,8 +63,8 @@ public function testExtraction($resource) 'typecast' => 'prefixtypecast', 'msg1' => 'prefixmsg1', 'msg2' => 'prefixmsg2', - ), - ); + ], + ]; $actualCatalogue = $catalogue->all(); $this->assertEquals($expectedCatalogue, $actualCatalogue); @@ -72,7 +73,7 @@ public function testExtraction($resource) public function resourcesProvider() { $directory = __DIR__.'/../fixtures/extractor/'; - $splFiles = array(); + $splFiles = []; foreach (new \DirectoryIterator($directory) as $fileInfo) { if ($fileInfo->isDot()) { continue; @@ -83,13 +84,13 @@ public function resourcesProvider() $splFiles[] = $fileInfo->getFileInfo(); } - return array( - array($directory), - array($phpFile), - array(glob($directory.'*')), - array($splFiles), - array(new \ArrayObject(glob($directory.'*'))), - array(new \ArrayObject($splFiles)), - ); + return [ + [$directory], + [$phpFile], + [glob($directory.'*')], + [$splFiles], + [new \ArrayObject(glob($directory.'*'))], + [new \ArrayObject($splFiles)], + ]; } } diff --git a/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php b/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php index 1fa736e7e3df40d3eaba693f34aa5b03bb0a8ee3..17b815d306eedb893e365ae6fb623bea8be94e5a 100644 --- a/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php +++ b/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php @@ -19,7 +19,7 @@ class MessageFormatterTest extends TestCase /** * @dataProvider getTransMessages */ - public function testFormat($expected, $message, $parameters = array()) + public function testFormat($expected, $message, $parameters = []) { $this->assertEquals($expected, $this->getMessageFormatter()->format($message, 'en', $parameters)); } @@ -34,45 +34,45 @@ public function testFormatPlural($expected, $message, $number, $parameters) public function getTransMessages() { - return array( - array( + return [ + [ 'There is one apple', 'There is one apple', - ), - array( + ], + [ 'There are 5 apples', 'There are %count% apples', - array('%count%' => 5), - ), - array( + ['%count%' => 5], + ], + [ 'There are 5 apples', 'There are {{count}} apples', - array('{{count}}' => 5), - ), - ); + ['{{count}}' => 5], + ], + ]; } public function getTransChoiceMessages() { - return array( - array('Il y a 0 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array('%count%' => 0)), - array('Il y a 1 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 1, array('%count%' => 1)), - array('Il y a 10 pommes', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 10, array('%count%' => 10)), + return [ + ['Il y a 0 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, ['%count%' => 0]], + ['Il y a 1 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 1, ['%count%' => 1]], + ['Il y a 10 pommes', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 10, ['%count%' => 10]], - array('Il y a 0 pomme', 'Il y a %count% pomme|Il y a %count% pommes', 0, array('%count%' => 0)), - array('Il y a 1 pomme', 'Il y a %count% pomme|Il y a %count% pommes', 1, array('%count%' => 1)), - array('Il y a 10 pommes', 'Il y a %count% pomme|Il y a %count% pommes', 10, array('%count%' => 10)), + ['Il y a 0 pomme', 'Il y a %count% pomme|Il y a %count% pommes', 0, ['%count%' => 0]], + ['Il y a 1 pomme', 'Il y a %count% pomme|Il y a %count% pommes', 1, ['%count%' => 1]], + ['Il y a 10 pommes', 'Il y a %count% pomme|Il y a %count% pommes', 10, ['%count%' => 10]], - array('Il y a 0 pomme', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 0, array('%count%' => 0)), - array('Il y a 1 pomme', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array('%count%' => 1)), - array('Il y a 10 pommes', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array('%count%' => 10)), + ['Il y a 0 pomme', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 0, ['%count%' => 0]], + ['Il y a 1 pomme', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 1, ['%count%' => 1]], + ['Il y a 10 pommes', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 10, ['%count%' => 10]], - array('Il n\'y a aucune pomme', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 0, array('%count%' => 0)), - array('Il y a 1 pomme', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array('%count%' => 1)), - array('Il y a 10 pommes', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array('%count%' => 10)), + ['Il n\'y a aucune pomme', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 0, ['%count%' => 0]], + ['Il y a 1 pomme', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, ['%count%' => 1]], + ['Il y a 10 pommes', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, ['%count%' => 10]], - array('Il y a 0 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array('%count%' => 0)), - ); + ['Il y a 0 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, ['%count%' => 0]], + ]; } private function getMessageFormatter() diff --git a/vendor/symfony/translation/Tests/IdentityTranslatorTest.php b/vendor/symfony/translation/Tests/IdentityTranslatorTest.php index 78288da40e150b964d5c7a3ce6a370af824fa073..c3d7b1f7d128d92b06af0fdf115462033edc3640 100644 --- a/vendor/symfony/translation/Tests/IdentityTranslatorTest.php +++ b/vendor/symfony/translation/Tests/IdentityTranslatorTest.php @@ -74,23 +74,23 @@ public function testGetLocaleReturnsDefaultLocaleIfNotSet() public function getTransTests() { - return array( - array('Symfony is great!', 'Symfony is great!', array()), - array('Symfony is awesome!', 'Symfony is %what%!', array('%what%' => 'awesome')), - ); + return [ + ['Symfony is great!', 'Symfony is great!', []], + ['Symfony is awesome!', 'Symfony is %what%!', ['%what%' => 'awesome']], + ]; } public function getTransChoiceTests() { - return array( - array('There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0, array('%count%' => 0)), - array('There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1, array('%count%' => 1)), - array('There are 10 apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10, array('%count%' => 10)), - array('There are 0 apples', 'There is 1 apple|There are %count% apples', 0, array('%count%' => 0)), - array('There is 1 apple', 'There is 1 apple|There are %count% apples', 1, array('%count%' => 1)), - array('There are 10 apples', 'There is 1 apple|There are %count% apples', 10, array('%count%' => 10)), + return [ + ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0, ['%count%' => 0]], + ['There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1, ['%count%' => 1]], + ['There are 10 apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10, ['%count%' => 10]], + ['There are 0 apples', 'There is 1 apple|There are %count% apples', 0, ['%count%' => 0]], + ['There is 1 apple', 'There is 1 apple|There are %count% apples', 1, ['%count%' => 1]], + ['There are 10 apples', 'There is 1 apple|There are %count% apples', 10, ['%count%' => 10]], // custom validation messages may be coded with a fixed value - array('There are 2 apples', 'There are 2 apples', 2, array('%count%' => 2)), - ); + ['There are 2 apples', 'There are 2 apples', 2, ['%count%' => 2]], + ]; } } diff --git a/vendor/symfony/translation/Tests/IntervalTest.php b/vendor/symfony/translation/Tests/IntervalTest.php index 99b209a70825d2cac55eb415a88d4499e0a42e4c..8da3bb151722a7af61f5528d124478a81b16d1aa 100644 --- a/vendor/symfony/translation/Tests/IntervalTest.php +++ b/vendor/symfony/translation/Tests/IntervalTest.php @@ -34,16 +34,16 @@ public function testTestException() public function getTests() { - return array( - array(true, 3, '{1,2, 3 ,4}'), - array(false, 10, '{1,2, 3 ,4}'), - array(false, 3, '[1,2]'), - array(true, 1, '[1,2]'), - array(true, 2, '[1,2]'), - array(false, 1, ']1,2['), - array(false, 2, ']1,2['), - array(true, log(0), '[-Inf,2['), - array(true, -log(0), '[-2,+Inf]'), - ); + return [ + [true, 3, '{1,2, 3 ,4}'], + [false, 10, '{1,2, 3 ,4}'], + [false, 3, '[1,2]'], + [true, 1, '[1,2]'], + [true, 2, '[1,2]'], + [false, 1, ']1,2['], + [false, 2, ']1,2['], + [true, log(0), '[-Inf,2['], + [true, -log(0), '[-2,+Inf]'], + ]; } } diff --git a/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php index 29efdef00d96c4abd365f0738525c2249947eae3..4fd5752db222b7bb285e4381d60be6c8ce3083af 100644 --- a/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php @@ -23,9 +23,9 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resources.csv'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadDoesNothingIfEmpty() @@ -34,9 +34,9 @@ public function testLoadDoesNothingIfEmpty() $resource = __DIR__.'/../fixtures/empty.csv'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array(), $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php index e28db60135e4490964b727647e8c77bbde24476e..601680af8afd174239f3927fb07ac816f037d685 100644 --- a/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php @@ -37,9 +37,9 @@ public function testDatEnglishLoad() $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('symfony' => 'Symfony 2 is great'), $catalogue->all('domain1')); + $this->assertEquals(['symfony' => 'Symfony 2 is great'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource.'.dat')], $catalogue->getResources()); } public function testDatFrenchLoad() @@ -48,9 +48,9 @@ public function testDatFrenchLoad() $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; $catalogue = $loader->load($resource, 'fr', 'domain1'); - $this->assertEquals(array('symfony' => 'Symfony 2 est génial'), $catalogue->all('domain1')); + $this->assertEquals(['symfony' => 'Symfony 2 est génial'], $catalogue->all('domain1')); $this->assertEquals('fr', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource.'.dat')], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php index 92d8933c8e7e3254352139911a37b7f1dd41b3b5..962c3af2efeb271360995787102c7fe85d649b20 100644 --- a/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php @@ -26,9 +26,9 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resourcebundle/res'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new DirectoryResource($resource)), $catalogue->getResources()); + $this->assertEquals([new DirectoryResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php index d9dcc5e8f015ebfc679bc9dac3117a46b98d3dec..e0d8b2f4c4a09991bd9f083d7b93b817b3be55ec 100644 --- a/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php @@ -23,9 +23,9 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resources.ini'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadDoesNothingIfEmpty() @@ -34,9 +34,9 @@ public function testLoadDoesNothingIfEmpty() $resource = __DIR__.'/../fixtures/empty.ini'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array(), $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php index cea0aef4bb2f4a433a5138b215517f35815b6535..4c507da5abdfc1347b8b761ed7d67521bbe1f688 100644 --- a/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php @@ -23,9 +23,9 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resources.json'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadDoesNothingIfEmpty() @@ -34,9 +34,9 @@ public function testLoadDoesNothingIfEmpty() $resource = __DIR__.'/../fixtures/empty.json'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array(), $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php index 6ad3d44d2144e03319ae65e48013cc66482001fb..63de5cebaa4dcf491389c3af2090375c1ad3b125 100644 --- a/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php @@ -23,9 +23,9 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resources.mo'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadPlurals() @@ -34,9 +34,9 @@ public function testLoadPlurals() $resource = __DIR__.'/../fixtures/plurals.mo'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar', 'foos' => '{0} bar|{1} bars'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar', 'foos' => '{0} bar|{1} bars'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** @@ -65,8 +65,8 @@ public function testLoadEmptyTranslation() $resource = __DIR__.'/../fixtures/empty-translation.mo'; $catalogue = $loader->load($resource, 'en', 'message'); - $this->assertEquals(array(), $catalogue->all('message')); + $this->assertEquals([], $catalogue->all('message')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } } diff --git a/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php index 01b7a5feab7266b74396d28eef6e733aba5169c0..68cb2d0b72b5102778e11c3bc5c88e6db4ea0896 100644 --- a/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php @@ -23,9 +23,9 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resources.php'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php index 4176cb7ffcc9e2af361144b0af6b2d7b47e51f45..4bf2ee6545b6fe8fb7ddfa046403521ccfcb0cab 100644 --- a/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php @@ -23,9 +23,9 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resources.po'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadPlurals() @@ -34,9 +34,9 @@ public function testLoadPlurals() $resource = __DIR__.'/../fixtures/plurals.po'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar', 'foos' => 'bar|bars'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar', 'foos' => 'bar|bars'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadDoesNothingIfEmpty() @@ -45,9 +45,9 @@ public function testLoadDoesNothingIfEmpty() $resource = __DIR__.'/../fixtures/empty.po'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array(), $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** @@ -66,9 +66,9 @@ public function testLoadEmptyTranslation() $resource = __DIR__.'/../fixtures/empty-translation.po'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => ''), $catalogue->all('domain1')); + $this->assertEquals(['foo' => ''], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testEscapedId() diff --git a/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php index 8a00fdedcf155031e2d06bfe3bcda1cae9e12a2f..08f55e9022b890fd782a82f6cb2d30d44fba504f 100644 --- a/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php @@ -23,9 +23,9 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resources.ts'; $catalogue = $loader->load($resource, 'en', 'resources'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('resources')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('resources')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php index 94406fd5f65d3a031e8977d378501338d2124840..7cb9f54fde2e226737847827004f5da458c35a67 100644 --- a/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php @@ -24,8 +24,8 @@ public function testLoad() $catalogue = $loader->load($resource, 'en', 'domain1'); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); - $this->assertSame(array(), libxml_get_errors()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); + $this->assertSame([], libxml_get_errors()); $this->assertContainsOnly('string', $catalogue->all('domain1')); } @@ -33,15 +33,15 @@ public function testLoadWithInternalErrorsEnabled() { $internalErrors = libxml_use_internal_errors(true); - $this->assertSame(array(), libxml_get_errors()); + $this->assertSame([], libxml_get_errors()); $loader = new XliffFileLoader(); $resource = __DIR__.'/../fixtures/resources.xlf'; $catalogue = $loader->load($resource, 'en', 'domain1'); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); - $this->assertSame(array(), libxml_get_errors()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); + $this->assertSame([], libxml_get_errors()); libxml_clear_errors(); libxml_use_internal_errors($internalErrors); @@ -58,7 +58,7 @@ public function testLoadWithExternalEntitiesDisabled() libxml_disable_entity_loader($disableEntities); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadWithResname() @@ -66,7 +66,7 @@ public function testLoadWithResname() $loader = new XliffFileLoader(); $catalogue = $loader->load(__DIR__.'/../fixtures/resname.xlf', 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo', 'qux' => 'qux source'], $catalogue->all('domain1')); } public function testIncompleteResource() @@ -74,7 +74,7 @@ public function testIncompleteResource() $loader = new XliffFileLoader(); $catalogue = $loader->load(__DIR__.'/../fixtures/resources.xlf', 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar', 'extra' => 'extra', 'key' => '', 'test' => 'with'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar', 'extra' => 'extra', 'key' => '', 'test' => 'with'], $catalogue->all('domain1')); } public function testEncoding() @@ -84,7 +84,7 @@ public function testEncoding() $this->assertEquals(utf8_decode('föö'), $catalogue->get('bar', 'domain1')); $this->assertEquals(utf8_decode('bär'), $catalogue->get('foo', 'domain1')); - $this->assertEquals(array('notes' => array(array('content' => utf8_decode('bäz'))), 'id' => '1'), $catalogue->getMetadata('foo', 'domain1')); + $this->assertEquals(['notes' => [['content' => utf8_decode('bäz')]], 'id' => '1'], $catalogue->getMetadata('foo', 'domain1')); } public function testTargetAttributesAreStoredCorrectly() @@ -164,11 +164,11 @@ public function testLoadNotes() $loader = new XliffFileLoader(); $catalogue = $loader->load(__DIR__.'/../fixtures/withnote.xlf', 'en', 'domain1'); - $this->assertEquals(array('notes' => array(array('priority' => 1, 'content' => 'foo')), 'id' => '1'), $catalogue->getMetadata('foo', 'domain1')); + $this->assertEquals(['notes' => [['priority' => 1, 'content' => 'foo']], 'id' => '1'], $catalogue->getMetadata('foo', 'domain1')); // message without target - $this->assertEquals(array('notes' => array(array('content' => 'bar', 'from' => 'foo')), 'id' => '2'), $catalogue->getMetadata('extra', 'domain1')); + $this->assertEquals(['notes' => [['content' => 'bar', 'from' => 'foo']], 'id' => '2'], $catalogue->getMetadata('extra', 'domain1')); // message with empty target - $this->assertEquals(array('notes' => array(array('content' => 'baz'), array('priority' => 2, 'from' => 'bar', 'content' => 'qux')), 'id' => '123'), $catalogue->getMetadata('key', 'domain1')); + $this->assertEquals(['notes' => [['content' => 'baz'], ['priority' => 2, 'from' => 'bar', 'content' => 'qux']], 'id' => '123'], $catalogue->getMetadata('key', 'domain1')); } public function testLoadVersion2() @@ -178,15 +178,15 @@ public function testLoadVersion2() $catalogue = $loader->load($resource, 'en', 'domain1'); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); - $this->assertSame(array(), libxml_get_errors()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); + $this->assertSame([], libxml_get_errors()); $domains = $catalogue->all(); $this->assertCount(3, $domains['domain1']); $this->assertContainsOnly('string', $catalogue->all('domain1')); // target attributes - $this->assertEquals(array('target-attributes' => array('order' => 1)), $catalogue->getMetadata('bar', 'domain1')); + $this->assertEquals(['target-attributes' => ['order' => 1]], $catalogue->getMetadata('bar', 'domain1')); } public function testLoadVersion2WithNoteMeta() @@ -196,8 +196,8 @@ public function testLoadVersion2WithNoteMeta() $catalogue = $loader->load($resource, 'en', 'domain1'); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); - $this->assertSame(array(), libxml_get_errors()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); + $this->assertSame([], libxml_get_errors()); // test for "foo" metadata $this->assertTrue($catalogue->defines('foo', 'domain1')); @@ -236,7 +236,7 @@ public function testLoadVersion2WithMultiSegmentUnit() $catalog = $loader->load($resource, 'en', 'domain1'); $this->assertSame('en', $catalog->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalog->getResources()); + $this->assertEquals([new FileResource($resource)], $catalog->getResources()); $this->assertFalse(libxml_get_last_error()); // test for "foo" metadata diff --git a/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php index bb3c1a99a7dc7ec717e6942da72b34b41e2b26a8..a535db56fc0e40751cbc9353bfaf1ec027749244 100644 --- a/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php @@ -23,9 +23,9 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resources.yml'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadDoesNothingIfEmpty() @@ -34,9 +34,9 @@ public function testLoadDoesNothingIfEmpty() $resource = __DIR__.'/../fixtures/empty.yml'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array(), $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/LoggingTranslatorTest.php b/vendor/symfony/translation/Tests/LoggingTranslatorTest.php index 022379e9348346bf092a5d48f634faf28aa2d818..1d3f065a5224a5a9dd02ceaac809928dab6bd5a8 100644 --- a/vendor/symfony/translation/Tests/LoggingTranslatorTest.php +++ b/vendor/symfony/translation/Tests/LoggingTranslatorTest.php @@ -28,7 +28,7 @@ public function testTransWithNoTranslationIsLogged() $translator = new Translator('ar'); $loggableTranslator = new LoggingTranslator($translator, $logger); - $loggableTranslator->transChoice('some_message2', 10, array('%count%' => 10)); + $loggableTranslator->transChoice('some_message2', 10, ['%count%' => 10]); $loggableTranslator->trans('bar'); } @@ -41,10 +41,10 @@ public function testTransChoiceFallbackIsLogged() ; $translator = new Translator('ar'); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en'); + $translator->addResource('array', ['some_message2' => 'one thing|%count% things'], 'en'); $loggableTranslator = new LoggingTranslator($translator, $logger); - $loggableTranslator->transChoice('some_message2', 10, array('%count%' => 10)); + $loggableTranslator->transChoice('some_message2', 10, ['%count%' => 10]); } } diff --git a/vendor/symfony/translation/Tests/MessageCatalogueTest.php b/vendor/symfony/translation/Tests/MessageCatalogueTest.php index 1ab8246969ca56229bd1d0940621f01332606856..433be2eeaf45c34f2a400a74586a0f3bcdce7cbe 100644 --- a/vendor/symfony/translation/Tests/MessageCatalogueTest.php +++ b/vendor/symfony/translation/Tests/MessageCatalogueTest.php @@ -25,23 +25,23 @@ public function testGetLocale() public function testGetDomains() { - $catalogue = new MessageCatalogue('en', array('domain1' => array(), 'domain2' => array())); + $catalogue = new MessageCatalogue('en', ['domain1' => [], 'domain2' => []]); - $this->assertEquals(array('domain1', 'domain2'), $catalogue->getDomains()); + $this->assertEquals(['domain1', 'domain2'], $catalogue->getDomains()); } public function testAll() { - $catalogue = new MessageCatalogue('en', $messages = array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); + $catalogue = new MessageCatalogue('en', $messages = ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); - $this->assertEquals(array('foo' => 'foo'), $catalogue->all('domain1')); - $this->assertEquals(array(), $catalogue->all('domain88')); + $this->assertEquals(['foo' => 'foo'], $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain88')); $this->assertEquals($messages, $catalogue->all()); } public function testHas() { - $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); + $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); $this->assertTrue($catalogue->has('foo', 'domain1')); $this->assertFalse($catalogue->has('bar', 'domain1')); @@ -50,7 +50,7 @@ public function testHas() public function testGetSet() { - $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); + $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); $catalogue->set('foo1', 'foo1', 'domain1'); $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); @@ -59,24 +59,24 @@ public function testGetSet() public function testAdd() { - $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); - $catalogue->add(array('foo1' => 'foo1'), 'domain1'); + $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); + $catalogue->add(['foo1' => 'foo1'], 'domain1'); $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - $catalogue->add(array('foo' => 'bar'), 'domain1'); + $catalogue->add(['foo' => 'bar'], 'domain1'); $this->assertEquals('bar', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - $catalogue->add(array('foo' => 'bar'), 'domain88'); + $catalogue->add(['foo' => 'bar'], 'domain88'); $this->assertEquals('bar', $catalogue->get('foo', 'domain88')); } public function testReplace() { - $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); - $catalogue->replace($messages = array('foo1' => 'foo1'), 'domain1'); + $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); + $catalogue->replace($messages = ['foo1' => 'foo1'], 'domain1'); $this->assertEquals($messages, $catalogue->all('domain1')); } @@ -89,10 +89,10 @@ public function testAddCatalogue() $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); - $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); + $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); $catalogue->addResource($r); - $catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo1' => 'foo1'))); + $catalogue1 = new MessageCatalogue('en', ['domain1' => ['foo1' => 'foo1']]); $catalogue1->addResource($r1); $catalogue->addCatalogue($catalogue1); @@ -100,7 +100,7 @@ public function testAddCatalogue() $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - $this->assertEquals(array($r, $r1), $catalogue->getResources()); + $this->assertEquals([$r, $r1], $catalogue->getResources()); } public function testAddFallbackCatalogue() @@ -114,10 +114,10 @@ public function testAddFallbackCatalogue() $r2 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); $r2->expects($this->any())->method('__toString')->will($this->returnValue('r2')); - $catalogue = new MessageCatalogue('fr_FR', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); + $catalogue = new MessageCatalogue('fr_FR', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); $catalogue->addResource($r); - $catalogue1 = new MessageCatalogue('fr', array('domain1' => array('foo' => 'bar', 'foo1' => 'foo1'))); + $catalogue1 = new MessageCatalogue('fr', ['domain1' => ['foo' => 'bar', 'foo1' => 'foo1']]); $catalogue1->addResource($r1); $catalogue2 = new MessageCatalogue('en'); @@ -129,7 +129,7 @@ public function testAddFallbackCatalogue() $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - $this->assertEquals(array($r, $r1, $r2), $catalogue->getResources()); + $this->assertEquals([$r, $r1, $r2], $catalogue->getResources()); } /** @@ -164,7 +164,7 @@ public function testAddFallbackCatalogueWithFallbackCircularReference() public function testAddCatalogueWhenLocaleIsNotTheSameAsTheCurrentOne() { $catalogue = new MessageCatalogue('en'); - $catalogue->addCatalogue(new MessageCatalogue('fr', array())); + $catalogue->addCatalogue(new MessageCatalogue('fr', [])); } public function testGetAddResource() @@ -178,13 +178,13 @@ public function testGetAddResource() $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); $catalogue->addResource($r1); - $this->assertEquals(array($r, $r1), $catalogue->getResources()); + $this->assertEquals([$r, $r1], $catalogue->getResources()); } public function testMetadataDelete() { $catalogue = new MessageCatalogue('en'); - $this->assertEquals(array(), $catalogue->getMetadata('', ''), 'Metadata is empty'); + $this->assertEquals([], $catalogue->getMetadata('', ''), 'Metadata is empty'); $catalogue->deleteMetadata('key', 'messages'); $catalogue->deleteMetadata('', 'messages'); $catalogue->deleteMetadata(); @@ -196,8 +196,8 @@ public function testMetadataSetGetDelete() $catalogue->setMetadata('key', 'value'); $this->assertEquals('value', $catalogue->getMetadata('key', 'messages'), "Metadata 'key' = 'value'"); - $catalogue->setMetadata('key2', array()); - $this->assertEquals(array(), $catalogue->getMetadata('key2', 'messages'), 'Metadata key2 is array'); + $catalogue->setMetadata('key2', []); + $this->assertEquals([], $catalogue->getMetadata('key2', 'messages'), 'Metadata key2 is array'); $catalogue->deleteMetadata('key2', 'messages'); $this->assertNull($catalogue->getMetadata('key2', 'messages'), 'Metadata key2 should is deleted.'); @@ -210,13 +210,13 @@ public function testMetadataMerge() { $cat1 = new MessageCatalogue('en'); $cat1->setMetadata('a', 'b'); - $this->assertEquals(array('messages' => array('a' => 'b')), $cat1->getMetadata('', ''), 'Cat1 contains messages metadata.'); + $this->assertEquals(['messages' => ['a' => 'b']], $cat1->getMetadata('', ''), 'Cat1 contains messages metadata.'); $cat2 = new MessageCatalogue('en'); $cat2->setMetadata('b', 'c', 'domain'); - $this->assertEquals(array('domain' => array('b' => 'c')), $cat2->getMetadata('', ''), 'Cat2 contains domain metadata.'); + $this->assertEquals(['domain' => ['b' => 'c']], $cat2->getMetadata('', ''), 'Cat2 contains domain metadata.'); $cat1->addCatalogue($cat2); - $this->assertEquals(array('messages' => array('a' => 'b'), 'domain' => array('b' => 'c')), $cat1->getMetadata('', ''), 'Cat1 contains merged metadata.'); + $this->assertEquals(['messages' => ['a' => 'b'], 'domain' => ['b' => 'c']], $cat1->getMetadata('', ''), 'Cat1 contains merged metadata.'); } } diff --git a/vendor/symfony/translation/Tests/MessageSelectorTest.php b/vendor/symfony/translation/Tests/MessageSelectorTest.php index 42b7e0a3fada8fe41289e8b25710e596776f454c..a887411eed453e6f38d7e0f990fa3c4837ad1f36 100644 --- a/vendor/symfony/translation/Tests/MessageSelectorTest.php +++ b/vendor/symfony/translation/Tests/MessageSelectorTest.php @@ -46,92 +46,92 @@ public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number) public function getNonMatchingMessages() { - return array( - array('{0} There are no apples|{1} There is one apple', 2), - array('{1} There is one apple|]1,Inf] There are %count% apples', 0), - array('{1} There is one apple|]2,Inf] There are %count% apples', 2), - array('{0} There are no apples|There is one apple', 2), - ); + return [ + ['{0} There are no apples|{1} There is one apple', 2], + ['{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['{1} There is one apple|]2,Inf] There are %count% apples', 2], + ['{0} There are no apples|There is one apple', 2], + ]; } public function getChooseTests() { - return array( - array('There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0), - array('There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0), - array('There are no apples', '{0}There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0), + return [ + ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['There are no apples', '{0}There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], - array('There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1), + ['There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1], - array('There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10), - array('There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf]There are %count% apples', 10), - array('There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10), + ['There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10], + ['There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf]There are %count% apples', 10], + ['There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10], - array('There are %count% apples', 'There is one apple|There are %count% apples', 0), - array('There is one apple', 'There is one apple|There are %count% apples', 1), - array('There are %count% apples', 'There is one apple|There are %count% apples', 10), + ['There are %count% apples', 'There is one apple|There are %count% apples', 0], + ['There is one apple', 'There is one apple|There are %count% apples', 1], + ['There are %count% apples', 'There is one apple|There are %count% apples', 10], - array('There are %count% apples', 'one: There is one apple|more: There are %count% apples', 0), - array('There is one apple', 'one: There is one apple|more: There are %count% apples', 1), - array('There are %count% apples', 'one: There is one apple|more: There are %count% apples', 10), + ['There are %count% apples', 'one: There is one apple|more: There are %count% apples', 0], + ['There is one apple', 'one: There is one apple|more: There are %count% apples', 1], + ['There are %count% apples', 'one: There is one apple|more: There are %count% apples', 10], - array('There are no apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 0), - array('There is one apple', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 1), - array('There are %count% apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 10), + ['There are no apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 0], + ['There is one apple', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 1], + ['There are %count% apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 10], - array('', '{0}|{1} There is one apple|]1,Inf] There are %count% apples', 0), - array('', '{0} There are no apples|{1}|]1,Inf] There are %count% apples', 1), + ['', '{0}|{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['', '{0} There are no apples|{1}|]1,Inf] There are %count% apples', 1], // Indexed only tests which are Gettext PoFile* compatible strings. - array('There are %count% apples', 'There is one apple|There are %count% apples', 0), - array('There is one apple', 'There is one apple|There are %count% apples', 1), - array('There are %count% apples', 'There is one apple|There are %count% apples', 2), + ['There are %count% apples', 'There is one apple|There are %count% apples', 0], + ['There is one apple', 'There is one apple|There are %count% apples', 1], + ['There are %count% apples', 'There is one apple|There are %count% apples', 2], // Tests for float numbers - array('There is almost one apple', '{0} There are no apples|]0,1[ There is almost one apple|{1} There is one apple|[1,Inf] There is more than one apple', 0.7), - array('There is one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1), - array('There is more than one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1.7), - array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0), - array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0.0), - array('There are no apples', '{0.0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0), + ['There is almost one apple', '{0} There are no apples|]0,1[ There is almost one apple|{1} There is one apple|[1,Inf] There is more than one apple', 0.7], + ['There is one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1], + ['There is more than one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1.7], + ['There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0], + ['There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0.0], + ['There are no apples', '{0.0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0], // Test texts with new-lines // with double-quotes and \n in id & double-quotes and actual newlines in text - array("This is a text with a\n new-line in it. Selector = 0.", '{0}This is a text with a + ["This is a text with a\n new-line in it. Selector = 0.", '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 0), + new-line in it. Selector > 1.', 0], // with double-quotes and \n in id and single-quotes and actual newlines in text - array("This is a text with a\n new-line in it. Selector = 1.", '{0}This is a text with a + ["This is a text with a\n new-line in it. Selector = 1.", '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 1), - array("This is a text with a\n new-line in it. Selector > 1.", '{0}This is a text with a + new-line in it. Selector > 1.', 1], + ["This is a text with a\n new-line in it. Selector > 1.", '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 5), + new-line in it. Selector > 1.', 5], // with double-quotes and id split accros lines - array('This is a text with a + ['This is a text with a new-line in it. Selector = 1.', '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 1), + new-line in it. Selector > 1.', 1], // with single-quotes and id split accros lines - array('This is a text with a + ['This is a text with a new-line in it. Selector > 1.', '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 5), + new-line in it. Selector > 1.', 5], // with single-quotes and \n in text - array('This is a text with a\nnew-line in it. Selector = 0.', '{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.', 0), + ['This is a text with a\nnew-line in it. Selector = 0.', '{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.', 0], // with double-quotes and id split accros lines - array("This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1), + ["This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1], // esacape pipe - array('This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0), + ['This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0], // Empty plural set (2 plural forms) from a .PO file - array('', '|', 1), + ['', '|', 1], // Empty plural set (3 plural forms) from a .PO file - array('', '||', 1), - ); + ['', '||', 1], + ]; } } diff --git a/vendor/symfony/translation/Tests/PluralizationRulesTest.php b/vendor/symfony/translation/Tests/PluralizationRulesTest.php index 5eb6c01f5d21dd8c4cd51abaab5ccc9f7c67cfc7..287764327a42fd8d2c33af94ba4c93ac7d38e870 100644 --- a/vendor/symfony/translation/Tests/PluralizationRulesTest.php +++ b/vendor/symfony/translation/Tests/PluralizationRulesTest.php @@ -60,13 +60,13 @@ public function testLangcodes($nplural, $langCodes) */ public function successLangcodes() { - return array( - array('1', array('ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky')), - array('2', array('nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM')), - array('3', array('be', 'bs', 'cs', 'hr')), - array('4', array('cy', 'mt', 'sl')), - array('6', array('ar')), - ); + return [ + ['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']], + ['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM']], + ['3', ['be', 'bs', 'cs', 'hr']], + ['4', ['cy', 'mt', 'sl']], + ['6', ['ar']], + ]; } /** @@ -79,13 +79,13 @@ public function successLangcodes() */ public function failingLangcodes() { - return array( - array('1', array('fa')), - array('2', array('jbo')), - array('3', array('cbs')), - array('4', array('gd', 'kw')), - array('5', array('ga')), - ); + return [ + ['1', ['fa']], + ['2', ['jbo']], + ['3', ['cbs']], + ['4', ['gd', 'kw']], + ['5', ['ga']], + ]; } /** @@ -109,7 +109,7 @@ protected function validateMatrix($nplural, $matrix, $expectSuccess = true) protected function generateTestData($langCodes) { - $matrix = array(); + $matrix = []; foreach ($langCodes as $langCode) { for ($count = 0; $count < 200; ++$count) { $plural = PluralizationRules::get($count, $langCode); diff --git a/vendor/symfony/translation/Tests/TranslatorCacheTest.php b/vendor/symfony/translation/Tests/TranslatorCacheTest.php index 3e71ae74ec78793ae9611beaebb82732c8afc7f4..decda70cc4cd046d62b8b4983a649aef2ef2e608 100644 --- a/vendor/symfony/translation/Tests/TranslatorCacheTest.php +++ b/vendor/symfony/translation/Tests/TranslatorCacheTest.php @@ -65,13 +65,13 @@ public function testThatACacheIsUsed($debug) // Prime the cache $translator = new Translator($locale, null, $this->tmpDir, $debug); $translator->addLoader($format, new ArrayLoader()); - $translator->addResource($format, array($msgid => 'OK'), $locale); + $translator->addResource($format, [$msgid => 'OK'], $locale); $translator->trans($msgid); // Try again and see we get a valid result whilst no loader can be used $translator = new Translator($locale, null, $this->tmpDir, $debug); $translator->addLoader($format, $this->createFailingLoader()); - $translator->addResource($format, array($msgid => 'OK'), $locale); + $translator->addResource($format, [$msgid => 'OK'], $locale); $this->assertEquals('OK', $translator->trans($msgid), '-> caching does not work in '.($debug ? 'debug' : 'production')); } @@ -92,7 +92,7 @@ public function testCatalogueIsReloadedWhenResourcesAreNoLongerFresh() $format = 'some_format'; $msgid = 'test'; - $catalogue = new MessageCatalogue($locale, array()); + $catalogue = new MessageCatalogue($locale, []); $catalogue->addResource(new StaleResource()); // better use a helper class than a mock, because it gets serialized in the cache and re-loaded /** @var LoaderInterface|\PHPUnit_Framework_MockObject_MockObject $loader */ @@ -123,7 +123,7 @@ public function testDifferentTranslatorsForSameLocaleDoNotOverwriteEachOthersCac { /* * Similar to the previous test. After we used the second translator, make - * sure there's still a useable cache for the first one. + * sure there's still a usable cache for the first one. */ $locale = 'any_locale'; @@ -133,26 +133,26 @@ public function testDifferentTranslatorsForSameLocaleDoNotOverwriteEachOthersCac // Create a Translator and prime its cache $translator = new Translator($locale, null, $this->tmpDir, $debug); $translator->addLoader($format, new ArrayLoader()); - $translator->addResource($format, array($msgid => 'OK'), $locale); + $translator->addResource($format, [$msgid => 'OK'], $locale); $translator->trans($msgid); // Create another Translator with a different catalogue for the same locale $translator = new Translator($locale, null, $this->tmpDir, $debug); $translator->addLoader($format, new ArrayLoader()); - $translator->addResource($format, array($msgid => 'FAIL'), $locale); + $translator->addResource($format, [$msgid => 'FAIL'], $locale); $translator->trans($msgid); - // Now the first translator must still have a useable cache. + // Now the first translator must still have a usable cache. $translator = new Translator($locale, null, $this->tmpDir, $debug); $translator->addLoader($format, $this->createFailingLoader()); - $translator->addResource($format, array($msgid => 'OK'), $locale); + $translator->addResource($format, [$msgid => 'OK'], $locale); $this->assertEquals('OK', $translator->trans($msgid), '-> the cache was overwritten by another translator instance in '.($debug ? 'debug' : 'production')); } public function testGeneratedCacheFilesAreOnlyBelongRequestedLocales() { $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(array('b')); + $translator->setFallbackLocales(['b']); $translator->trans('bar'); $cachedFiles = glob($this->tmpDir.'/*.php'); @@ -168,24 +168,24 @@ public function testDifferentCacheFilesAreUsedForDifferentSetsOfFallbackLocales( * loading a catalogue from the cache. */ $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(array('b')); + $translator->setFallbackLocales(['b']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (a)'), 'a'); - $translator->addResource('array', array('bar' => 'bar (b)'), 'b'); + $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); + $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); $this->assertEquals('bar (b)', $translator->trans('bar')); // Remove fallback locale - $translator->setFallbackLocales(array()); + $translator->setFallbackLocales([]); $this->assertEquals('bar', $translator->trans('bar')); // Use a fresh translator with no fallback locales, result should be the same $translator = new Translator('a', null, $this->tmpDir); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (a)'), 'a'); - $translator->addResource('array', array('bar' => 'bar (b)'), 'b'); + $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); + $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); $this->assertEquals('bar', $translator->trans('bar')); } @@ -206,12 +206,12 @@ public function testPrimaryAndFallbackCataloguesContainTheSameMessagesRegardless * The catalogues contain distinct sets of messages. */ $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(array('b')); + $translator->setFallbackLocales(['b']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (a)'), 'a'); - $translator->addResource('array', array('foo' => 'foo (b)'), 'b'); - $translator->addResource('array', array('bar' => 'bar (b)'), 'b'); + $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); + $translator->addResource('array', ['foo' => 'foo (b)'], 'b'); + $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); $catalogue = $translator->getCatalogue('a'); $this->assertFalse($catalogue->defines('bar')); // Sure, the "a" catalogue does not contain that message. @@ -224,12 +224,12 @@ public function testPrimaryAndFallbackCataloguesContainTheSameMessagesRegardless * Behind the scenes, the cache is used. But that should not matter, right? */ $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(array('b')); + $translator->setFallbackLocales(['b']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (a)'), 'a'); - $translator->addResource('array', array('foo' => 'foo (b)'), 'b'); - $translator->addResource('array', array('bar' => 'bar (b)'), 'b'); + $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); + $translator->addResource('array', ['foo' => 'foo (b)'], 'b'); + $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); $catalogue = $translator->getCatalogue('a'); $this->assertFalse($catalogue->defines('bar')); @@ -246,7 +246,7 @@ public function testRefreshCacheWhenResourcesAreNoLongerFresh() $loader ->expects($this->exactly(2)) ->method('load') - ->will($this->returnValue($this->getCatalogue('fr', array(), array($resource)))); + ->will($this->returnValue($this->getCatalogue('fr', [], [$resource]))); // prime the cache $translator = new Translator('fr', null, $this->tmpDir, true); @@ -261,7 +261,7 @@ public function testRefreshCacheWhenResourcesAreNoLongerFresh() $translator->trans('foo'); } - protected function getCatalogue($locale, $messages, $resources = array()) + protected function getCatalogue($locale, $messages, $resources = []) { $catalogue = new MessageCatalogue($locale); foreach ($messages as $key => $translation) { @@ -276,7 +276,7 @@ protected function getCatalogue($locale, $messages, $resources = array()) public function runForDebugAndProduction() { - return array(array(true), array(false)); + return [[true], [false]]; } /** diff --git a/vendor/symfony/translation/Tests/TranslatorTest.php b/vendor/symfony/translation/Tests/TranslatorTest.php index 3e54839f77ee8f1725aeae00162b9f293a2ab4c1..ab6dc5b8d4d42eaa4176b6d87ca5ff57463283e0 100644 --- a/vendor/symfony/translation/Tests/TranslatorTest.php +++ b/vendor/symfony/translation/Tests/TranslatorTest.php @@ -97,8 +97,8 @@ public function testGetCatalogueReturnsConsolidatedCatalogue() $translator = new Translator($locale); $translator->addLoader('loader-a', new ArrayLoader()); $translator->addLoader('loader-b', new ArrayLoader()); - $translator->addResource('loader-a', array('foo' => 'foofoo'), $locale, 'domain-a'); - $translator->addResource('loader-b', array('bar' => 'foobar'), $locale, 'domain-b'); + $translator->addResource('loader-a', ['foo' => 'foofoo'], $locale, 'domain-a'); + $translator->addResource('loader-b', ['bar' => 'foobar'], $locale, 'domain-b'); /* * Test that we get a single catalogue comprising messages @@ -113,13 +113,13 @@ public function testSetFallbackLocales() { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); - $translator->addResource('array', array('bar' => 'foobar'), 'fr'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); + $translator->addResource('array', ['bar' => 'foobar'], 'fr'); // force catalogue loading $translator->trans('bar'); - $translator->setFallbackLocales(array('fr')); + $translator->setFallbackLocales(['fr']); $this->assertEquals('foobar', $translator->trans('bar')); } @@ -127,13 +127,13 @@ public function testSetFallbackLocalesMultiple() { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (en)'), 'en'); - $translator->addResource('array', array('bar' => 'bar (fr)'), 'fr'); + $translator->addResource('array', ['foo' => 'foo (en)'], 'en'); + $translator->addResource('array', ['bar' => 'bar (fr)'], 'fr'); // force catalogue loading $translator->trans('bar'); - $translator->setFallbackLocales(array('fr_FR', 'fr')); + $translator->setFallbackLocales(['fr_FR', 'fr']); $this->assertEquals('bar (fr)', $translator->trans('bar')); } @@ -144,7 +144,7 @@ public function testSetFallbackLocalesMultiple() public function testSetFallbackInvalidLocales($locale) { $translator = new Translator('fr'); - $translator->setFallbackLocales(array('fr', $locale)); + $translator->setFallbackLocales(['fr', $locale]); } /** @@ -153,7 +153,7 @@ public function testSetFallbackInvalidLocales($locale) public function testSetFallbackValidLocales($locale) { $translator = new Translator($locale); - $translator->setFallbackLocales(array('fr', $locale)); + $translator->setFallbackLocales(['fr', $locale]); // no assertion. this method just asserts that no exception is thrown $this->addToAssertionCount(1); } @@ -161,10 +161,10 @@ public function testSetFallbackValidLocales($locale) public function testTransWithFallbackLocale() { $translator = new Translator('fr_FR'); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('bar' => 'foobar'), 'en'); + $translator->addResource('array', ['bar' => 'foobar'], 'en'); $this->assertEquals('foobar', $translator->trans('bar')); } @@ -176,7 +176,7 @@ public function testTransWithFallbackLocale() public function testAddResourceInvalidLocales($locale) { $translator = new Translator('fr'); - $translator->addResource('array', array('foo' => 'foofoo'), $locale); + $translator->addResource('array', ['foo' => 'foofoo'], $locale); } /** @@ -185,7 +185,7 @@ public function testAddResourceInvalidLocales($locale) public function testAddResourceValidLocales($locale) { $translator = new Translator('fr'); - $translator->addResource('array', array('foo' => 'foofoo'), $locale); + $translator->addResource('array', ['foo' => 'foofoo'], $locale); // no assertion. this method just asserts that no exception is thrown $this->addToAssertionCount(1); } @@ -195,12 +195,12 @@ public function testAddResourceAfterTrans() $translator = new Translator('fr'); $translator->addLoader('array', new ArrayLoader()); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); $this->assertEquals('foofoo', $translator->trans('foo')); - $translator->addResource('array', array('bar' => 'foobar'), 'en'); + $translator->addResource('array', ['bar' => 'foobar'], 'en'); $this->assertEquals('foobar', $translator->trans('bar')); } @@ -231,15 +231,15 @@ public function testTransWithFallbackLocaleFile($format, $loader) $translator->addResource($format, __DIR__.'/fixtures/non-existing', 'en_GB'); $translator->addResource($format, __DIR__.'/fixtures/resources.'.$format, 'en', 'resources'); - $this->assertEquals('bar', $translator->trans('foo', array(), 'resources')); + $this->assertEquals('bar', $translator->trans('foo', [], 'resources')); } public function testTransWithFallbackLocaleBis() { $translator = new Translator('en_US'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en_US'); - $translator->addResource('array', array('bar' => 'foobar'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en_US'); + $translator->addResource('array', ['bar' => 'foobar'], 'en'); $this->assertEquals('foobar', $translator->trans('bar')); } @@ -247,10 +247,10 @@ public function testTransWithFallbackLocaleTer() { $translator = new Translator('fr_FR'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (en_US)'), 'en_US'); - $translator->addResource('array', array('bar' => 'bar (en)'), 'en'); + $translator->addResource('array', ['foo' => 'foo (en_US)'], 'en_US'); + $translator->addResource('array', ['bar' => 'bar (en)'], 'en'); - $translator->setFallbackLocales(array('en_US', 'en')); + $translator->setFallbackLocales(['en_US', 'en']); $this->assertEquals('foo (en_US)', $translator->trans('foo')); $this->assertEquals('bar (en)', $translator->trans('bar')); @@ -259,7 +259,7 @@ public function testTransWithFallbackLocaleTer() public function testTransNonExistentWithFallback() { $translator = new Translator('fr'); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); $translator->addLoader('array', new ArrayLoader()); $this->assertEquals('non-existent', $translator->trans('non-existent')); } @@ -270,7 +270,7 @@ public function testTransNonExistentWithFallback() public function testWhenAResourceHasNoRegisteredLoader() { $translator = new Translator('en'); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); $translator->trans('foo'); } @@ -278,7 +278,7 @@ public function testWhenAResourceHasNoRegisteredLoader() public function testNestedFallbackCatalogueWhenUsingMultipleLocales() { $translator = new Translator('fr'); - $translator->setFallbackLocales(array('ru', 'en')); + $translator->setFallbackLocales(['ru', 'en']); $translator->getCatalogue('fr'); @@ -293,7 +293,7 @@ public function testFallbackCatalogueResources() $translator->addResource('yml', __DIR__.'/fixtures/resources.yml', 'en'); // force catalogue loading - $this->assertEquals('bar', $translator->trans('foo', array())); + $this->assertEquals('bar', $translator->trans('foo', [])); $resources = $translator->getCatalogue('en')->getResources(); $this->assertCount(1, $resources); @@ -312,7 +312,7 @@ public function testTrans($expected, $id, $translation, $parameters, $locale, $d { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array((string) $id => $translation), $locale, $domain); + $translator->addResource('array', [(string) $id => $translation], $locale, $domain); $this->assertEquals($expected, $translator->trans($id, $parameters, $domain, $locale)); } @@ -325,9 +325,9 @@ public function testTransInvalidLocale($locale) { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - $translator->trans('foo', array(), '', $locale); + $translator->trans('foo', [], '', $locale); } /** @@ -337,10 +337,10 @@ public function testTransValidLocale($locale) { $translator = new Translator($locale); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('test' => 'OK'), $locale); + $translator->addResource('array', ['test' => 'OK'], $locale); $this->assertEquals('OK', $translator->trans('test')); - $this->assertEquals('OK', $translator->trans('test', array(), null, $locale)); + $this->assertEquals('OK', $translator->trans('test', [], null, $locale)); } /** @@ -352,7 +352,7 @@ public function testFlattenedTrans($expected, $messages, $id) $translator->addLoader('array', new ArrayLoader()); $translator->addResource('array', $messages, 'fr', ''); - $this->assertEquals($expected, $translator->trans($id, array(), '', 'fr')); + $this->assertEquals($expected, $translator->trans($id, [], '', 'fr')); } /** @@ -362,7 +362,7 @@ public function testTransChoice($expected, $id, $translation, $number, $paramete { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array((string) $id => $translation), $locale, $domain); + $translator->addResource('array', [(string) $id => $translation], $locale, $domain); $this->assertEquals($expected, $translator->transChoice($id, $number, $parameters, $domain, $locale)); } @@ -375,9 +375,9 @@ public function testTransChoiceInvalidLocale($locale) { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - $translator->transChoice('foo', 1, array(), '', $locale); + $translator->transChoice('foo', 1, [], '', $locale); } /** @@ -387,149 +387,149 @@ public function testTransChoiceValidLocale($locale) { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - $translator->transChoice('foo', 1, array(), '', $locale); + $translator->transChoice('foo', 1, [], '', $locale); // no assertion. this method just asserts that no exception is thrown $this->addToAssertionCount(1); } public function getTransFileTests() { - return array( - array('csv', 'CsvFileLoader'), - array('ini', 'IniFileLoader'), - array('mo', 'MoFileLoader'), - array('po', 'PoFileLoader'), - array('php', 'PhpFileLoader'), - array('ts', 'QtFileLoader'), - array('xlf', 'XliffFileLoader'), - array('yml', 'YamlFileLoader'), - array('json', 'JsonFileLoader'), - ); + return [ + ['csv', 'CsvFileLoader'], + ['ini', 'IniFileLoader'], + ['mo', 'MoFileLoader'], + ['po', 'PoFileLoader'], + ['php', 'PhpFileLoader'], + ['ts', 'QtFileLoader'], + ['xlf', 'XliffFileLoader'], + ['yml', 'YamlFileLoader'], + ['json', 'JsonFileLoader'], + ]; } public function getTransTests() { - return array( - array('Symfony est super !', 'Symfony is great!', 'Symfony est super !', array(), 'fr', ''), - array('Symfony est awesome !', 'Symfony is %what%!', 'Symfony est %what% !', array('%what%' => 'awesome'), 'fr', ''), - array('Symfony est super !', new StringClass('Symfony is great!'), 'Symfony est super !', array(), 'fr', ''), - ); + return [ + ['Symfony est super !', 'Symfony is great!', 'Symfony est super !', [], 'fr', ''], + ['Symfony est awesome !', 'Symfony is %what%!', 'Symfony est %what% !', ['%what%' => 'awesome'], 'fr', ''], + ['Symfony est super !', new StringClass('Symfony is great!'), 'Symfony est super !', [], 'fr', ''], + ]; } public function getFlattenedTransTests() { - $messages = array( - 'symfony' => array( - 'is' => array( + $messages = [ + 'symfony' => [ + 'is' => [ 'great' => 'Symfony est super!', - ), - ), - 'foo' => array( - 'bar' => array( + ], + ], + 'foo' => [ + 'bar' => [ 'baz' => 'Foo Bar Baz', - ), + ], 'baz' => 'Foo Baz', - ), - ); + ], + ]; - return array( - array('Symfony est super!', $messages, 'symfony.is.great'), - array('Foo Bar Baz', $messages, 'foo.bar.baz'), - array('Foo Baz', $messages, 'foo.baz'), - ); + return [ + ['Symfony est super!', $messages, 'symfony.is.great'], + ['Foo Bar Baz', $messages, 'foo.bar.baz'], + ['Foo Baz', $messages, 'foo.baz'], + ]; } public function getTransChoiceTests() { - return array( - array('Il y a 0 pomme', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array(), 'fr', ''), - array('Il y a 1 pomme', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 1, array(), 'fr', ''), - array('Il y a 10 pommes', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 10, array(), 'fr', ''), + return [ + ['Il y a 0 pomme', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, [], 'fr', ''], + ['Il y a 1 pomme', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 1, [], 'fr', ''], + ['Il y a 10 pommes', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 10, [], 'fr', ''], - array('Il y a 0 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 0, array(), 'fr', ''), - array('Il y a 1 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 1, array(), 'fr', ''), - array('Il y a 10 pommes', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 10, array(), 'fr', ''), + ['Il y a 0 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 0, [], 'fr', ''], + ['Il y a 1 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 1, [], 'fr', ''], + ['Il y a 10 pommes', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 10, [], 'fr', ''], - array('Il y a 0 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 0, array(), 'fr', ''), - array('Il y a 1 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array(), 'fr', ''), - array('Il y a 10 pommes', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array(), 'fr', ''), + ['Il y a 0 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 0, [], 'fr', ''], + ['Il y a 1 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 1, [], 'fr', ''], + ['Il y a 10 pommes', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 10, [], 'fr', ''], - array('Il n\'y a aucune pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 0, array(), 'fr', ''), - array('Il y a 1 pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array(), 'fr', ''), - array('Il y a 10 pommes', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array(), 'fr', ''), + ['Il n\'y a aucune pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 0, [], 'fr', ''], + ['Il y a 1 pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, [], 'fr', ''], + ['Il y a 10 pommes', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, [], 'fr', ''], - array('Il y a 0 pomme', new StringClass('{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples'), '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array(), 'fr', ''), + ['Il y a 0 pomme', new StringClass('{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples'), '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, [], 'fr', ''], // Override %count% with a custom value - array('Il y a quelques pommes', 'one: There is one apple|more: There are %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 2, array('%count%' => 'quelques'), 'fr', ''), - ); + ['Il y a quelques pommes', 'one: There is one apple|more: There are %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 2, ['%count%' => 'quelques'], 'fr', ''], + ]; } public function getInvalidLocalesTests() { - return array( - array('fr FR'), - array('français'), - array('fr+en'), - array('utf#8'), - array('fr&en'), - array('fr~FR'), - array(' fr'), - array('fr '), - array('fr*'), - array('fr/FR'), - array('fr\\FR'), - ); + return [ + ['fr FR'], + ['français'], + ['fr+en'], + ['utf#8'], + ['fr&en'], + ['fr~FR'], + [' fr'], + ['fr '], + ['fr*'], + ['fr/FR'], + ['fr\\FR'], + ]; } public function getValidLocalesTests() { - return array( - array(''), - array(null), - array('fr'), - array('francais'), - array('FR'), - array('frFR'), - array('fr-FR'), - array('fr_FR'), - array('fr.FR'), - array('fr-FR.UTF8'), - array('sr@latin'), - ); + return [ + [''], + [null], + ['fr'], + ['francais'], + ['FR'], + ['frFR'], + ['fr-FR'], + ['fr_FR'], + ['fr.FR'], + ['fr-FR.UTF8'], + ['sr@latin'], + ]; } public function testTransChoiceFallback() { $translator = new Translator('ru'); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en'); + $translator->addResource('array', ['some_message2' => 'one thing|%count% things'], 'en'); - $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, array('%count%' => 10))); + $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, ['%count%' => 10])); } public function testTransChoiceFallbackBis() { $translator = new Translator('ru'); - $translator->setFallbackLocales(array('en_US', 'en')); + $translator->setFallbackLocales(['en_US', 'en']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en_US'); + $translator->addResource('array', ['some_message2' => 'one thing|%count% things'], 'en_US'); - $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, array('%count%' => 10))); + $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, ['%count%' => 10])); } public function testTransChoiceFallbackWithNoTranslation() { $translator = new Translator('ru'); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); $translator->addLoader('array', new ArrayLoader()); // consistent behavior with Translator::trans(), which returns the string // unchanged if it can't be found - $this->assertEquals('some_message2', $translator->transChoice('some_message2', 10, array('%count%' => 10))); + $this->assertEquals('some_message2', $translator->transChoice('some_message2', 10, ['%count%' => 10])); } } diff --git a/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php b/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php index dbb5424f1c69c078c78c4f092223a437f67c1813..b0335415e1b3d645a2d235cb775829a7e8bc1a07 100644 --- a/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php +++ b/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php @@ -26,49 +26,49 @@ public function testDump($input, $expectedOutput) public function messagesData() { - return array( - array( + return [ + [ // input - array( + [ 'foo1' => 'bar', 'foo.bar' => 'value', - ), + ], // expected output - array( + [ 'foo1' => 'bar', - 'foo' => array('bar' => 'value'), - ), - ), - array( + 'foo' => ['bar' => 'value'], + ], + ], + [ // input - array( + [ 'foo.bar' => 'value1', 'foo.bar.test' => 'value2', - ), + ], // expected output - array( - 'foo' => array( + [ + 'foo' => [ 'bar' => 'value1', 'bar.test' => 'value2', - ), - ), - ), - array( + ], + ], + ], + [ // input - array( + [ 'foo.level2.level3.level4' => 'value1', 'foo.level2' => 'value2', 'foo.bar' => 'value3', - ), + ], // expected output - array( - 'foo' => array( + [ + 'foo' => [ 'level2' => 'value2', 'level2.level3.level4' => 'value1', 'bar' => 'value3', - ), - ), - ), - ); + ], + ], + ], + ]; } } diff --git a/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php b/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php index 26a846ea90d94c82768f2f4e2d14e4a620266bc8..dbcc14e6e1ccbff677366cf46413f80f045157c7 100644 --- a/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php +++ b/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php @@ -43,7 +43,7 @@ public function testWrite() $writer = new TranslationWriter(); $writer->addDumper('test', $dumper); - $writer->write(new MessageCatalogue(array()), 'test'); + $writer->write(new MessageCatalogue([]), 'test'); } public function testDisableBackup() @@ -62,7 +62,7 @@ public function testDisableBackup() class NonBackupDumper implements DumperInterface { - public function dump(MessageCatalogue $messages, $options = array()) + public function dump(MessageCatalogue $messages, $options = []) { } } @@ -71,7 +71,7 @@ class BackupDumper implements DumperInterface { public $backup = true; - public function dump(MessageCatalogue $messages, $options = array()) + public function dump(MessageCatalogue $messages, $options = []) { } diff --git a/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php b/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php index 1ce8ea94fd339299f670beedd34d4711ffd008ff..55520203c6cb1d97c05566156639af91eab78459 100644 --- a/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php +++ b/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php @@ -1,7 +1,7 @@ This template is used for translation message extraction tests <?php echo $view['translator']->trans('single-quoted key'); ?> <?php echo $view['translator']->trans('double-quoted key'); ?> -<?php echo $view['translator']->trans(<<<'EOF' +<?php echo $view['translator']->trans(<<<EOF heredoc key EOF ); ?> @@ -29,21 +29,29 @@ <?php echo $view['translator']->transChoice( '{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples', 10, - array('%count%' => 10) + ['%count%' => 10] +); ?> + +<?php echo $view['translator']->trans('concatenated'.' message'.<<<EOF + with heredoc +EOF +.<<<'EOF' + and nowdoc +EOF ); ?> -<?php echo $view['translator']->trans('other-domain-test-no-params-short-array', array(), 'not_messages'); ?> +<?php echo $view['translator']->trans('other-domain-test-no-params-short-array', [], 'not_messages'); ?> -<?php echo $view['translator']->trans('other-domain-test-no-params-long-array', array(), 'not_messages'); ?> +<?php echo $view['translator']->trans('other-domain-test-no-params-long-array', [], 'not_messages'); ?> -<?php echo $view['translator']->trans('other-domain-test-params-short-array', array('foo' => 'bar'), 'not_messages'); ?> +<?php echo $view['translator']->trans('other-domain-test-params-short-array', ['foo' => 'bar'], 'not_messages'); ?> -<?php echo $view['translator']->trans('other-domain-test-params-long-array', array('foo' => 'bar'), 'not_messages'); ?> +<?php echo $view['translator']->trans('other-domain-test-params-long-array', ['foo' => 'bar'], 'not_messages'); ?> -<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-short-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?> +<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-short-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?> -<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-long-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?> +<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-long-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?> -<?php echo $view['translator']->trans('typecast', array('a' => (int) '123'), 'not_messages'); ?> -<?php echo $view['translator']->transChoice('msg1', 10 + 1, array(), 'not_messages'); ?> -<?php echo $view['translator']->transChoice('msg2', ceil(4.5), array(), 'not_messages'); ?> +<?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'); ?> diff --git a/vendor/symfony/translation/Tests/fixtures/resname.xlf b/vendor/symfony/translation/Tests/fixtures/resname.xlf index 2df16af942f4348158a46090268b9b8a4631413d..4fa5c0017eff06d367d04215fa50289d6e079fd0 100644 --- a/vendor/symfony/translation/Tests/fixtures/resname.xlf +++ b/vendor/symfony/translation/Tests/fixtures/resname.xlf @@ -14,6 +14,9 @@ <source>baz</source> <target>foo</target> </trans-unit> + <trans-unit id="4" resname="qux"> + <source>qux source</source> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/translation/Translator.php b/vendor/symfony/translation/Translator.php index b76aabb8d822d1f8591101350aa076c21c869103..e72d20a86f512e0dc76fbb9d2c7dd55fbd200ccd 100644 --- a/vendor/symfony/translation/Translator.php +++ b/vendor/symfony/translation/Translator.php @@ -31,7 +31,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface /** * @var MessageCatalogueInterface[] */ - protected $catalogues = array(); + protected $catalogues = []; /** * @var string @@ -41,17 +41,17 @@ class Translator implements TranslatorInterface, TranslatorBagInterface /** * @var array */ - private $fallbackLocales = array(); + private $fallbackLocales = []; /** * @var LoaderInterface[] */ - private $loaders = array(); + private $loaders = []; /** * @var array */ - private $resources = array(); + private $resources = []; /** * @var MessageFormatterInterface @@ -131,10 +131,10 @@ public function addResource($format, $resource, $locale, $domain = null) $this->assertValidLocale($locale); - $this->resources[$locale][] = array($format, $resource, $domain); + $this->resources[$locale][] = [$format, $resource, $domain]; if (\in_array($locale, $this->fallbackLocales)) { - $this->catalogues = array(); + $this->catalogues = []; } else { unset($this->catalogues[$locale]); } @@ -167,7 +167,7 @@ public function getLocale() public function setFallbackLocales(array $locales) { // needed as the fallback locales are linked to the already loaded catalogues - $this->catalogues = array(); + $this->catalogues = []; foreach ($locales as $locale) { $this->assertValidLocale($locale); @@ -179,7 +179,7 @@ public function setFallbackLocales(array $locales) /** * Gets the fallback locales. * - * @return array $locales The fallback locales + * @return array The fallback locales */ public function getFallbackLocales() { @@ -189,7 +189,7 @@ public function getFallbackLocales() /** * {@inheritdoc} */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) + public function trans($id, array $parameters = [], $domain = null, $locale = null) { if (null === $domain) { $domain = 'messages'; @@ -201,7 +201,7 @@ public function trans($id, array $parameters = array(), $domain = null, $locale /** * {@inheritdoc} */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) + public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { if (!$this->formatter instanceof ChoiceMessageFormatterInterface) { throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', \get_class($this->formatter))); @@ -403,7 +403,7 @@ private function loadFallbackCatalogues($locale) protected function computeFallbackLocales($locale) { - $locales = array(); + $locales = []; foreach ($this->fallbackLocales as $fallback) { if ($fallback === $locale) { continue; diff --git a/vendor/symfony/translation/TranslatorInterface.php b/vendor/symfony/translation/TranslatorInterface.php index 9fcfd5bcf40510d8c22cc6d6375541e0ec32a189..4fbaedb457ffc6110aebf30a1f3ae6ad1660f4e2 100644 --- a/vendor/symfony/translation/TranslatorInterface.php +++ b/vendor/symfony/translation/TranslatorInterface.php @@ -32,13 +32,13 @@ interface TranslatorInterface * * @throws InvalidArgumentException If the locale contains invalid characters */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null); + public function trans($id, array $parameters = [], $domain = null, $locale = null); /** * Translates the given choice message by choosing a translation according to a number. * * @param string $id The message id (may also be an object that can be cast to string) - * @param int $number The number to use to find the indice of the message + * @param int $number The number to use to find the index of the message * @param array $parameters An array of parameters for the message * @param string|null $domain The domain for the message or null to use the default * @param string|null $locale The locale or null to use the default @@ -47,7 +47,7 @@ public function trans($id, array $parameters = array(), $domain = null, $locale * * @throws InvalidArgumentException If the locale contains invalid characters */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null); + public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null); /** * Sets the current locale. diff --git a/vendor/symfony/translation/Util/ArrayConverter.php b/vendor/symfony/translation/Util/ArrayConverter.php index b98e7ce826e4a0339154397ea71d9c50c4ff842d..0276294f62d635dad0e0864f4571e709927e79d7 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 array('foo' => array('bar' => 'value')). + * For example this rray('foo.bar' => 'value') will be converted to ['foo' => ['bar' => 'value']]. * * @param array $messages Linear messages array * @@ -35,7 +35,7 @@ class ArrayConverter */ public static function expandToTree(array $messages) { - $tree = array(); + $tree = []; foreach ($messages as $id => $value) { $referenceToElement = &self::getElementByPath($tree, explode('.', $id)); @@ -69,7 +69,7 @@ private static function &getElementByPath(array &$tree, array $parts) $elem = &$elem[$part]; } - if (\is_array($elem) && \count($elem) > 0 && $parentOfElem) { + if ($elem && \is_array($elem) && $parentOfElem) { /* Process next case: * 'foo.bar': 'test1' * 'foo': 'test2' diff --git a/vendor/symfony/translation/Writer/TranslationWriter.php b/vendor/symfony/translation/Writer/TranslationWriter.php index 459f707faf9477193f5b8dc90f9b37acaa9ae8df..aad6aad3e88fe6e6fc3ee295c772bc434c51cca2 100644 --- a/vendor/symfony/translation/Writer/TranslationWriter.php +++ b/vendor/symfony/translation/Writer/TranslationWriter.php @@ -23,7 +23,7 @@ */ class TranslationWriter implements TranslationWriterInterface { - private $dumpers = array(); + private $dumpers = []; /** * Adds a dumper to the writer. @@ -67,7 +67,7 @@ public function getFormats() * * @throws InvalidArgumentException */ - public function write(MessageCatalogue $catalogue, $format, $options = array()) + public function write(MessageCatalogue $catalogue, $format, $options = []) { if (!isset($this->dumpers[$format])) { throw new InvalidArgumentException(sprintf('There is no dumper associated with format "%s".', $format)); @@ -95,7 +95,7 @@ public function write(MessageCatalogue $catalogue, $format, $options = array()) * * @deprecated since 3.4 will be removed in 4.0. Use write instead. */ - public function writeTranslations(MessageCatalogue $catalogue, $format, $options = array()) + public function writeTranslations(MessageCatalogue $catalogue, $format, $options = []) { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead.', __METHOD__), E_USER_DEPRECATED); $this->write($catalogue, $format, $options); diff --git a/vendor/symfony/translation/Writer/TranslationWriterInterface.php b/vendor/symfony/translation/Writer/TranslationWriterInterface.php index 992ab769a0d59dd34a475312df718747ce393297..b07c08e2366c7a78c7000085864e1006632d9e65 100644 --- a/vendor/symfony/translation/Writer/TranslationWriterInterface.php +++ b/vendor/symfony/translation/Writer/TranslationWriterInterface.php @@ -30,5 +30,5 @@ interface TranslationWriterInterface * * @throws InvalidArgumentException */ - public function write(MessageCatalogue $catalogue, $format, $options = array()); + public function write(MessageCatalogue $catalogue, $format, $options = []); } diff --git a/vendor/symfony/translation/phpunit.xml.dist b/vendor/symfony/translation/phpunit.xml.dist index 1fafa4691bc1d4fd36e6532ea8b7380413501acd..21d32461825ce88b5fa74a086da6465e0034fce8 100644 --- a/vendor/symfony/translation/phpunit.xml.dist +++ b/vendor/symfony/translation/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/validator/Constraint.php b/vendor/symfony/validator/Constraint.php index 70a11ef8c98c724cd6f781bad13147165a8dea4a..b1a5e0c1a2b7eda68ab14a7a6de41939d78ff77f 100644 --- a/vendor/symfony/validator/Constraint.php +++ b/vendor/symfony/validator/Constraint.php @@ -49,7 +49,7 @@ abstract class Constraint /** * Maps error codes to the names of their constants. */ - protected static $errorNames = array(); + protected static $errorNames = []; /** * Domain-specific data attached to a constraint. @@ -70,11 +70,7 @@ abstract class Constraint public static function getErrorName($errorCode) { if (!isset(static::$errorNames[$errorCode])) { - throw new InvalidArgumentException(sprintf( - 'The error code "%s" does not exist for constraint of type "%s".', - $errorCode, - \get_called_class() - )); + throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, \get_called_class())); } return static::$errorNames[$errorCode]; @@ -109,7 +105,7 @@ public static function getErrorName($errorCode) */ public function __construct($options = null) { - $invalidOptions = array(); + $invalidOptions = []; $missingOptions = array_flip((array) $this->getRequiredOptions()); $knownOptions = get_object_vars($this); @@ -124,9 +120,9 @@ public function __construct($options = null) if (\is_array($options)) { reset($options); } - if (\is_array($options) && \count($options) > 0 && \is_string(key($options))) { + if ($options && \is_array($options) && \is_string(key($options))) { foreach ($options as $option => $value) { - if (array_key_exists($option, $knownOptions)) { + if (\array_key_exists($option, $knownOptions)) { $this->$option = $value; unset($missingOptions[$option]); } else { @@ -137,12 +133,10 @@ public function __construct($options = null) $option = $this->getDefaultOption(); if (null === $option) { - throw new ConstraintDefinitionException( - sprintf('No default option is configured for constraint %s', \get_class($this)) - ); + throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint %s', \get_class($this))); } - if (array_key_exists($option, $knownOptions)) { + if (\array_key_exists($option, $knownOptions)) { $this->$option = $options; unset($missingOptions[$option]); } else { @@ -151,17 +145,11 @@ public function __construct($options = null) } if (\count($invalidOptions) > 0) { - throw new InvalidOptionsException( - sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), \get_class($this)), - $invalidOptions - ); + throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), \get_class($this)), $invalidOptions); } if (\count($missingOptions) > 0) { - throw new MissingOptionsException( - sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), \get_class($this)), - array_keys($missingOptions) - ); + throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), \get_class($this)), array_keys($missingOptions)); } } @@ -185,7 +173,7 @@ public function __set($option, $value) return; } - throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), array($option)); + throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), [$option]); } /** @@ -206,12 +194,12 @@ public function __set($option, $value) public function __get($option) { if ('groups' === $option) { - $this->groups = array(self::DEFAULT_GROUP); + $this->groups = [self::DEFAULT_GROUP]; return $this->groups; } - throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), array($option)); + throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), [$option]); } /** @@ -260,7 +248,7 @@ public function getDefaultOption() */ public function getRequiredOptions() { - return array(); + return []; } /** @@ -296,9 +284,7 @@ public function getTargets() * * @return array The properties to serialize * - * @internal This method may be replaced by an implementation of - * {@link \Serializable} in the future. Please don't use or - * overwrite it. + * @internal */ public function __sleep() { diff --git a/vendor/symfony/validator/ConstraintValidatorFactory.php b/vendor/symfony/validator/ConstraintValidatorFactory.php index 86e44e2a5580fc16cf6ca71490594df05f5eb405..45f3ca94e8e80d7d5546bf18cf685f894c911d8f 100644 --- a/vendor/symfony/validator/ConstraintValidatorFactory.php +++ b/vendor/symfony/validator/ConstraintValidatorFactory.php @@ -24,7 +24,7 @@ */ class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface { - protected $validators = array(); + protected $validators = []; public function __construct() { diff --git a/vendor/symfony/validator/ConstraintViolation.php b/vendor/symfony/validator/ConstraintViolation.php index 848c77611776b8a0bf41788cae6af2eecc718668..ae9ff89eb54cf38d30619a0587aacf1c5b449a3c 100644 --- a/vendor/symfony/validator/ConstraintViolation.php +++ b/vendor/symfony/validator/ConstraintViolation.php @@ -79,13 +79,13 @@ public function __toString() } $propertyPath = (string) $this->propertyPath; - $code = $this->code; + $code = (string) $this->code; if ('' !== $propertyPath && '[' !== $propertyPath[0] && '' !== $class) { $class .= '.'; } - if (!empty($code)) { + if ('' !== $code) { $code = ' (code '.$code.')'; } diff --git a/vendor/symfony/validator/ConstraintViolationInterface.php b/vendor/symfony/validator/ConstraintViolationInterface.php index b66b0741a56694f395e10d565236f58abb127ea5..5ac25cf9ba53a8887c6ad80ff9200ecf22285711 100644 --- a/vendor/symfony/validator/ConstraintViolationInterface.php +++ b/vendor/symfony/validator/ConstraintViolationInterface.php @@ -19,11 +19,9 @@ * element in the validation graph and the root element that was originally * passed to the validator. For example, take the following graph: * - * <pre> - * (Person)---(firstName: string) - * \ - * (address: Address)---(street: string) - * </pre> + * (Person)---(firstName: string) + * \ + * (address: Address)---(street: string) * * If the <tt>Person</tt> object is validated and validation fails for the * "firstName" property, the generated violation has the <tt>Person</tt> diff --git a/vendor/symfony/validator/ConstraintViolationList.php b/vendor/symfony/validator/ConstraintViolationList.php index c18dd2195fab906945a912d49057b4048432e6d0..c30ee57cb268bc3f6573c487dff26b9a5e5e7c17 100644 --- a/vendor/symfony/validator/ConstraintViolationList.php +++ b/vendor/symfony/validator/ConstraintViolationList.php @@ -21,14 +21,14 @@ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolation /** * @var ConstraintViolationInterface[] */ - private $violations = array(); + private $violations = []; /** * Creates a new constraint violation list. * * @param ConstraintViolationInterface[] $violations The constraint violations to add to the list */ - public function __construct(array $violations = array()) + public function __construct(array $violations = []) { foreach ($violations as $violation) { $this->add($violation); @@ -169,7 +169,7 @@ public function offsetUnset($offset) public function findByCodes($codes) { $codes = (array) $codes; - $violations = array(); + $violations = []; foreach ($this as $violation) { if (\in_array($violation->getCode(), $codes, true)) { $violations[] = $violation; diff --git a/vendor/symfony/validator/ConstraintViolationListInterface.php b/vendor/symfony/validator/ConstraintViolationListInterface.php index 0489ab500a1dc71c315b2931e0d3c94794748162..47e986f51e50a1c929c2e4d8066e03f7642e85b9 100644 --- a/vendor/symfony/validator/ConstraintViolationListInterface.php +++ b/vendor/symfony/validator/ConstraintViolationListInterface.php @@ -26,7 +26,7 @@ public function add(ConstraintViolationInterface $violation); /** * Merges an existing violation list into this list. */ - public function addAll(ConstraintViolationListInterface $otherList); + public function addAll(self $otherList); /** * Returns the violation at a given offset. diff --git a/vendor/symfony/validator/Constraints/AbstractComparison.php b/vendor/symfony/validator/Constraints/AbstractComparison.php index 0a7e2f3fb733ef103a7a3a38b303f5596a095cb9..89c2690c081cd8df83ef9b6230925b1337c3d2a9 100644 --- a/vendor/symfony/validator/Constraints/AbstractComparison.php +++ b/vendor/symfony/validator/Constraints/AbstractComparison.php @@ -33,7 +33,7 @@ abstract class AbstractComparison extends Constraint public function __construct($options = null) { if (null === $options) { - $options = array(); + $options = []; } if (\is_array($options)) { diff --git a/vendor/symfony/validator/Constraints/AbstractComparisonValidator.php b/vendor/symfony/validator/Constraints/AbstractComparisonValidator.php index fec0080fe02e9a0d029fa796ea227e6679d677cf..3c95c097e8e9ae14cb1431d2194f27dd0719a869 100644 --- a/vendor/symfony/validator/Constraints/AbstractComparisonValidator.php +++ b/vendor/symfony/validator/Constraints/AbstractComparisonValidator.php @@ -13,7 +13,7 @@ use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; use Symfony\Component\PropertyAccess\PropertyAccess; -use Symfony\Component\PropertyAccess\PropertyAccessor; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; @@ -29,7 +29,7 @@ abstract class AbstractComparisonValidator extends ConstraintValidator { private $propertyAccessor; - public function __construct(PropertyAccessor $propertyAccessor = null) + public function __construct(PropertyAccessorInterface $propertyAccessor = null) { $this->propertyAccessor = $propertyAccessor; } diff --git a/vendor/symfony/validator/Constraints/All.php b/vendor/symfony/validator/Constraints/All.php index b531a1d645af3cb6dd821b848a76063524a4833b..d3fe49525f6fa815122dfaf1fbb8353318ac5f3d 100644 --- a/vendor/symfony/validator/Constraints/All.php +++ b/vendor/symfony/validator/Constraints/All.php @@ -19,7 +19,7 @@ */ class All extends Composite { - public $constraints = array(); + public $constraints = []; public function getDefaultOption() { @@ -28,7 +28,7 @@ public function getDefaultOption() public function getRequiredOptions() { - return array('constraints'); + return ['constraints']; } protected function getCompositeOption() diff --git a/vendor/symfony/validator/Constraints/Bic.php b/vendor/symfony/validator/Constraints/Bic.php index dee5d526938e9a94f92fab7a18e76f6f60262348..5cb37b7df2b050ce832de70df119ac16dd355d67 100644 --- a/vendor/symfony/validator/Constraints/Bic.php +++ b/vendor/symfony/validator/Constraints/Bic.php @@ -27,13 +27,13 @@ class Bic extends Constraint const INVALID_COUNTRY_CODE_ERROR = '1ce76f8d-3c1f-451c-9e62-fe9c3ed486ae'; const INVALID_CASE_ERROR = '11884038-3312-4ae5-9d04-699f782130c7'; - protected static $errorNames = array( + protected static $errorNames = [ self::INVALID_LENGTH_ERROR => 'INVALID_LENGTH_ERROR', self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', self::INVALID_BANK_CODE_ERROR => 'INVALID_BANK_CODE_ERROR', self::INVALID_COUNTRY_CODE_ERROR => 'INVALID_COUNTRY_CODE_ERROR', self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR', - ); + ]; public $message = 'This is not a valid Business Identifier Code (BIC).'; } diff --git a/vendor/symfony/validator/Constraints/BicValidator.php b/vendor/symfony/validator/Constraints/BicValidator.php index 51aecc384ae789a5eca30daccd86844848238bfb..fc363461587e578abb94aa715676bab892a13d52 100644 --- a/vendor/symfony/validator/Constraints/BicValidator.php +++ b/vendor/symfony/validator/Constraints/BicValidator.php @@ -13,6 +13,7 @@ use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; /** * @author Michael Hirschler <michael.vhirsch@gmail.com> @@ -26,6 +27,10 @@ class BicValidator extends ConstraintValidator */ public function validate($value, Constraint $constraint) { + if (!$constraint instanceof Bic) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Bic'); + } + if (null === $value || '' === $value) { return; } @@ -33,7 +38,7 @@ public function validate($value, Constraint $constraint) $canonicalize = str_replace(' ', '', $value); // the bic must be either 8 or 11 characters long - if (!\in_array(\strlen($canonicalize), array(8, 11))) { + if (!\in_array(\strlen($canonicalize), [8, 11])) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(Bic::INVALID_LENGTH_ERROR) diff --git a/vendor/symfony/validator/Constraints/Blank.php b/vendor/symfony/validator/Constraints/Blank.php index 030b21f959d97ae4c7ffac37b0e53687f58d0951..4fa913c85f9b69a48b5b8b9fe4fb51a3200f9bfe 100644 --- a/vendor/symfony/validator/Constraints/Blank.php +++ b/vendor/symfony/validator/Constraints/Blank.php @@ -23,9 +23,9 @@ class Blank extends Constraint { const NOT_BLANK_ERROR = '183ad2de-533d-4796-a439-6d3c3852b549'; - protected static $errorNames = array( + protected static $errorNames = [ self::NOT_BLANK_ERROR => 'NOT_BLANK_ERROR', - ); + ]; public $message = 'This value should be blank.'; } diff --git a/vendor/symfony/validator/Constraints/Callback.php b/vendor/symfony/validator/Constraints/Callback.php index 16231105e1f22fafd43b45dd4465be262b9a749f..8bf6d68cac6c4f2bd430ef970e7d578734c9beea 100644 --- a/vendor/symfony/validator/Constraints/Callback.php +++ b/vendor/symfony/validator/Constraints/Callback.php @@ -37,7 +37,7 @@ public function __construct($options = null) } if (\is_array($options) && !isset($options['callback']) && !isset($options['groups']) && !isset($options['payload'])) { - $options = array('callback' => $options); + $options = ['callback' => $options]; } parent::__construct($options); @@ -56,6 +56,6 @@ public function getDefaultOption() */ public function getTargets() { - return array(self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT); + return [self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT]; } } diff --git a/vendor/symfony/validator/Constraints/CardScheme.php b/vendor/symfony/validator/Constraints/CardScheme.php index 40c32e879e83fbaa16a4a9f397a68b599a5dada9..4284826008da67064ea63064005a18897dd061f1 100644 --- a/vendor/symfony/validator/Constraints/CardScheme.php +++ b/vendor/symfony/validator/Constraints/CardScheme.php @@ -27,10 +27,10 @@ class CardScheme extends Constraint const NOT_NUMERIC_ERROR = 'a2ad9231-e827-485f-8a1e-ef4d9a6d5c2e'; const INVALID_FORMAT_ERROR = 'a8faedbf-1c2f-4695-8d22-55783be8efed'; - protected static $errorNames = array( + protected static $errorNames = [ self::NOT_NUMERIC_ERROR => 'NOT_NUMERIC_ERROR', self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', - ); + ]; public $message = 'Unsupported card type or invalid card number.'; public $schemes; @@ -42,6 +42,6 @@ public function getDefaultOption() public function getRequiredOptions() { - return array('schemes'); + return ['schemes']; } } diff --git a/vendor/symfony/validator/Constraints/CardSchemeValidator.php b/vendor/symfony/validator/Constraints/CardSchemeValidator.php index dae3412cd7178ea184ce63388499434207e79657..04abe81af3647d2553d3c2b5277a3d790dde1142 100644 --- a/vendor/symfony/validator/Constraints/CardSchemeValidator.php +++ b/vendor/symfony/validator/Constraints/CardSchemeValidator.php @@ -27,62 +27,62 @@ */ class CardSchemeValidator extends ConstraintValidator { - protected $schemes = array( + protected $schemes = [ // American Express card numbers start with 34 or 37 and have 15 digits. - 'AMEX' => array( + 'AMEX' => [ '/^3[47][0-9]{13}$/', - ), + ], // China UnionPay cards start with 62 and have between 16 and 19 digits. // Please note that these cards do not follow Luhn Algorithm as a checksum. - 'CHINA_UNIONPAY' => array( + 'CHINA_UNIONPAY' => [ '/^62[0-9]{14,17}$/', - ), + ], // Diners Club card numbers begin with 300 through 305, 36 or 38. All have 14 digits. // There are Diners Club cards that begin with 5 and have 16 digits. // These are a joint venture between Diners Club and MasterCard, and should be processed like a MasterCard. - 'DINERS' => array( + 'DINERS' => [ '/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/', - ), + ], // Discover card numbers begin with 6011, 622126 through 622925, 644 through 649 or 65. // All have 16 digits. - 'DISCOVER' => array( + 'DISCOVER' => [ '/^6011[0-9]{12}$/', '/^64[4-9][0-9]{13}$/', '/^65[0-9]{14}$/', '/^622(12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|91[0-9]|92[0-5])[0-9]{10}$/', - ), + ], // InstaPayment cards begin with 637 through 639 and have 16 digits. - 'INSTAPAYMENT' => array( + 'INSTAPAYMENT' => [ '/^63[7-9][0-9]{13}$/', - ), + ], // JCB cards beginning with 2131 or 1800 have 15 digits. // JCB cards beginning with 35 have 16 digits. - 'JCB' => array( + 'JCB' => [ '/^(?:2131|1800|35[0-9]{3})[0-9]{11}$/', - ), + ], // Laser cards begin with either 6304, 6706, 6709 or 6771 and have between 16 and 19 digits. - 'LASER' => array( + 'LASER' => [ '/^(6304|670[69]|6771)[0-9]{12,15}$/', - ), + ], // Maestro international cards begin with 675900..675999 and have between 12 and 19 digits. // Maestro UK cards begin with either 500000..509999 or 560000..699999 and have between 12 and 19 digits. - 'MAESTRO' => array( + 'MAESTRO' => [ '/^(6759[0-9]{2})[0-9]{6,13}$/', '/^(50[0-9]{4})[0-9]{6,13}$/', '/^5[6-9][0-9]{10,17}$/', '/^6[0-9]{11,18}$/', - ), + ], // All MasterCard numbers start with the numbers 51 through 55. All have 16 digits. // October 2016 MasterCard numbers can also start with 222100 through 272099. - 'MASTERCARD' => array( + 'MASTERCARD' => [ '/^5[1-5][0-9]{14}$/', '/^2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12})$/', - ), + ], // All Visa card numbers start with a 4 and have a length of 13, 16, or 19 digits. - 'VISA' => array( + 'VISA' => [ '/^4([0-9]{12}|[0-9]{15}|[0-9]{18})$/', - ), - ); + ], + ]; /** * Validates a creditcard belongs to a specified scheme. diff --git a/vendor/symfony/validator/Constraints/Choice.php b/vendor/symfony/validator/Constraints/Choice.php index 4b93c70e4a5f4088b5c98901d7507443eff99d50..222dca3d5d606b239e06452c12bd892cb24212c6 100644 --- a/vendor/symfony/validator/Constraints/Choice.php +++ b/vendor/symfony/validator/Constraints/Choice.php @@ -25,11 +25,11 @@ class Choice extends Constraint const TOO_FEW_ERROR = '11edd7eb-5872-4b6e-9f12-89923999fd0e'; const TOO_MANY_ERROR = '9bd98e49-211c-433f-8630-fd1c2d0f08c3'; - protected static $errorNames = array( + protected static $errorNames = [ self::NO_SUCH_CHOICE_ERROR => 'NO_SUCH_CHOICE_ERROR', self::TOO_FEW_ERROR => 'TOO_FEW_ERROR', self::TOO_MANY_ERROR => 'TOO_MANY_ERROR', - ); + ]; public $choices; public $callback; diff --git a/vendor/symfony/validator/Constraints/ChoiceValidator.php b/vendor/symfony/validator/Constraints/ChoiceValidator.php index e53b99a0d839e76d95b92f3cbe56bcce24e18a01..00577ef462518c859d2ce14f6e724077b8d1c572 100644 --- a/vendor/symfony/validator/Constraints/ChoiceValidator.php +++ b/vendor/symfony/validator/Constraints/ChoiceValidator.php @@ -47,8 +47,8 @@ public function validate($value, Constraint $constraint) } if ($constraint->callback) { - if (!\is_callable($choices = array($this->context->getObject(), $constraint->callback)) - && !\is_callable($choices = array($this->context->getClassName(), $constraint->callback)) + if (!\is_callable($choices = [$this->context->getObject(), $constraint->callback]) + && !\is_callable($choices = [$this->context->getClassName(), $constraint->callback]) && !\is_callable($choices = $constraint->callback) ) { throw new ConstraintDefinitionException('The Choice constraint expects a valid callback'); diff --git a/vendor/symfony/validator/Constraints/Collection.php b/vendor/symfony/validator/Constraints/Collection.php index 2b5679b22d07e8ba84b9ae70fef2c5effcfbc91c..21427722d949110c695ad1fefdeeb8720db6d02a 100644 --- a/vendor/symfony/validator/Constraints/Collection.php +++ b/vendor/symfony/validator/Constraints/Collection.php @@ -24,12 +24,12 @@ class Collection extends Composite const MISSING_FIELD_ERROR = '2fa2158c-2a7f-484b-98aa-975522539ff8'; const NO_SUCH_FIELD_ERROR = '7703c766-b5d5-4cef-ace7-ae0dd82304e9'; - protected static $errorNames = array( + protected static $errorNames = [ self::MISSING_FIELD_ERROR => 'MISSING_FIELD_ERROR', self::NO_SUCH_FIELD_ERROR => 'NO_SUCH_FIELD_ERROR', - ); + ]; - public $fields = array(); + public $fields = []; public $allowExtraFields = false; public $allowMissingFields = false; public $extraFieldsMessage = 'This field was not expected.'; @@ -42,8 +42,8 @@ public function __construct($options = null) { // no known options set? $options is the fields array if (\is_array($options) - && !array_intersect(array_keys($options), array('groups', 'fields', 'allowExtraFields', 'allowMissingFields', 'extraFieldsMessage', 'missingFieldsMessage'))) { - $options = array('fields' => $options); + && !array_intersect(array_keys($options), ['groups', 'fields', 'allowExtraFields', 'allowMissingFields', 'extraFieldsMessage', 'missingFieldsMessage'])) { + $options = ['fields' => $options]; } parent::__construct($options); @@ -75,7 +75,7 @@ protected function initializeNestedConstraints() public function getRequiredOptions() { - return array('fields'); + return ['fields']; } protected function getCompositeOption() diff --git a/vendor/symfony/validator/Constraints/CollectionValidator.php b/vendor/symfony/validator/Constraints/CollectionValidator.php index e3a297329d1c83511921648f755ff338b14894e2..3b67e40a5c3d4ad9d9f9fdca67514ab6c7974dec 100644 --- a/vendor/symfony/validator/Constraints/CollectionValidator.php +++ b/vendor/symfony/validator/Constraints/CollectionValidator.php @@ -50,7 +50,7 @@ public function validate($value, Constraint $constraint) foreach ($constraint->fields as $field => $fieldConstraint) { // bug fix issue #2779 - $existsInArray = \is_array($value) && array_key_exists($field, $value); + $existsInArray = \is_array($value) && \array_key_exists($field, $value); $existsInArrayAccess = $value instanceof \ArrayAccess && $value->offsetExists($field); if ($existsInArray || $existsInArrayAccess) { diff --git a/vendor/symfony/validator/Constraints/Composite.php b/vendor/symfony/validator/Constraints/Composite.php index 2f2b8d29a0e64fc40cbcc811cd9b1b0cbb6672ca..18ea5e319f7f15135f76d0d923672d244ea8982e 100644 --- a/vendor/symfony/validator/Constraints/Composite.php +++ b/vendor/symfony/validator/Constraints/Composite.php @@ -62,7 +62,7 @@ public function __construct($options = null) $nestedConstraints = $this->$compositeOption; if (!\is_array($nestedConstraints)) { - $nestedConstraints = array($nestedConstraints); + $nestedConstraints = [$nestedConstraints]; } foreach ($nestedConstraints as $constraint) { @@ -80,7 +80,7 @@ public function __construct($options = null) } if (!property_exists($this, 'groups')) { - $mergedGroups = array(); + $mergedGroups = []; foreach ($nestedConstraints as $constraint) { foreach ($constraint->groups as $group) { @@ -99,13 +99,7 @@ public function __construct($options = null) $excessGroups = array_diff($constraint->groups, $this->groups); if (\count($excessGroups) > 0) { - throw new ConstraintDefinitionException(sprintf( - 'The group(s) "%s" passed to the constraint %s '. - 'should also be passed to its containing constraint %s', - implode('", "', $excessGroups), - \get_class($constraint), - \get_class($this) - )); + throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s', implode('", "', $excessGroups), \get_class($constraint), \get_class($this))); } } else { $constraint->groups = $this->groups; diff --git a/vendor/symfony/validator/Constraints/Count.php b/vendor/symfony/validator/Constraints/Count.php index 0a54ee78db772dd4d9c4919383c399b42f2736bf..8de10edfc88007844591927ed2f70248967a8ce3 100644 --- a/vendor/symfony/validator/Constraints/Count.php +++ b/vendor/symfony/validator/Constraints/Count.php @@ -25,10 +25,10 @@ class Count extends Constraint const TOO_FEW_ERROR = 'bef8e338-6ae5-4caf-b8e2-50e7b0579e69'; const TOO_MANY_ERROR = '756b1212-697c-468d-a9ad-50dd783bb169'; - protected static $errorNames = array( + protected static $errorNames = [ self::TOO_FEW_ERROR => 'TOO_FEW_ERROR', self::TOO_MANY_ERROR => 'TOO_MANY_ERROR', - ); + ]; public $minMessage = 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.'; public $maxMessage = 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.'; @@ -39,16 +39,16 @@ class Count extends Constraint public function __construct($options = null) { if (null !== $options && !\is_array($options)) { - $options = array( + $options = [ 'min' => $options, 'max' => $options, - ); + ]; } parent::__construct($options); if (null === $this->min && null === $this->max) { - throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), array('min', 'max')); + throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), ['min', 'max']); } } } diff --git a/vendor/symfony/validator/Constraints/CountValidator.php b/vendor/symfony/validator/Constraints/CountValidator.php index 39be8aa82e9a788a92a403f7c1144c3f0816a802..01f82a346600b8e5390d35d63a5a8f1399bb05f9 100644 --- a/vendor/symfony/validator/Constraints/CountValidator.php +++ b/vendor/symfony/validator/Constraints/CountValidator.php @@ -25,6 +25,10 @@ class CountValidator extends ConstraintValidator */ public function validate($value, Constraint $constraint) { + if (!$constraint instanceof Count) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Count'); + } + if (null === $value) { return; } diff --git a/vendor/symfony/validator/Constraints/Country.php b/vendor/symfony/validator/Constraints/Country.php index 1b76570a8c5fdda480e6e4473a29322867fa1cad..7ed2e0582ed935f5638060862dafca364f65c029 100644 --- a/vendor/symfony/validator/Constraints/Country.php +++ b/vendor/symfony/validator/Constraints/Country.php @@ -23,9 +23,9 @@ class Country extends Constraint { const NO_SUCH_COUNTRY_ERROR = '8f900c12-61bd-455d-9398-996cd040f7f0'; - protected static $errorNames = array( + protected static $errorNames = [ self::NO_SUCH_COUNTRY_ERROR => 'NO_SUCH_COUNTRY_ERROR', - ); + ]; public $message = 'This value is not a valid country.'; } diff --git a/vendor/symfony/validator/Constraints/Currency.php b/vendor/symfony/validator/Constraints/Currency.php index d28f94cb66a74c036b65e5b2be6036415ae3357d..5d5ced59df9d177ebf9e8f6081bb6dd53b202880 100644 --- a/vendor/symfony/validator/Constraints/Currency.php +++ b/vendor/symfony/validator/Constraints/Currency.php @@ -24,9 +24,9 @@ class Currency extends Constraint { const NO_SUCH_CURRENCY_ERROR = '69945ac1-2db4-405f-bec7-d2772f73df52'; - protected static $errorNames = array( + protected static $errorNames = [ self::NO_SUCH_CURRENCY_ERROR => 'NO_SUCH_CURRENCY_ERROR', - ); + ]; public $message = 'This value is not a valid currency.'; } diff --git a/vendor/symfony/validator/Constraints/Date.php b/vendor/symfony/validator/Constraints/Date.php index 256341312246cb971895aed18a7c3f311cfb1b8d..530475ff7d0ac601889213f72a1deb8b3a736aa7 100644 --- a/vendor/symfony/validator/Constraints/Date.php +++ b/vendor/symfony/validator/Constraints/Date.php @@ -24,10 +24,10 @@ class Date extends Constraint const INVALID_FORMAT_ERROR = '69819696-02ac-4a99-9ff0-14e127c4d1bc'; const INVALID_DATE_ERROR = '3c184ce5-b31d-4de7-8b76-326da7b2be93'; - protected static $errorNames = array( + protected static $errorNames = [ self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', self::INVALID_DATE_ERROR => 'INVALID_DATE_ERROR', - ); + ]; public $message = 'This value is not a valid date.'; } diff --git a/vendor/symfony/validator/Constraints/DateTime.php b/vendor/symfony/validator/Constraints/DateTime.php index c65f185ae428ce4b1a65aadc437ee45b77bd0da0..f88c62e0aea510aec8026c1b9197d36c2aa0fb19 100644 --- a/vendor/symfony/validator/Constraints/DateTime.php +++ b/vendor/symfony/validator/Constraints/DateTime.php @@ -25,11 +25,11 @@ class DateTime extends Constraint const INVALID_DATE_ERROR = 'd52afa47-620d-4d99-9f08-f4d85b36e33c'; const INVALID_TIME_ERROR = '5e797c9d-74f7-4098-baa3-94390c447b27'; - protected static $errorNames = array( + protected static $errorNames = [ self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', self::INVALID_DATE_ERROR => 'INVALID_DATE_ERROR', self::INVALID_TIME_ERROR => 'INVALID_TIME_ERROR', - ); + ]; public $format = 'Y-m-d H:i:s'; public $message = 'This value is not a valid datetime.'; diff --git a/vendor/symfony/validator/Constraints/Email.php b/vendor/symfony/validator/Constraints/Email.php index a9d9ab15391fa2da7bfb9402c0daebfcb9559713..56ddd3da65ae2c2e049157a013aae4c74f058937 100644 --- a/vendor/symfony/validator/Constraints/Email.php +++ b/vendor/symfony/validator/Constraints/Email.php @@ -25,11 +25,11 @@ class Email extends Constraint const MX_CHECK_FAILED_ERROR = 'bf447c1c-0266-4e10-9c6c-573df282e413'; const HOST_CHECK_FAILED_ERROR = '7da53a8b-56f3-4288-bb3e-ee9ede4ef9a1'; - protected static $errorNames = array( + protected static $errorNames = [ self::INVALID_FORMAT_ERROR => 'STRICT_CHECK_FAILED_ERROR', self::MX_CHECK_FAILED_ERROR => 'MX_CHECK_FAILED_ERROR', self::HOST_CHECK_FAILED_ERROR => 'HOST_CHECK_FAILED_ERROR', - ); + ]; public $message = 'This value is not a valid email address.'; public $checkMX = false; diff --git a/vendor/symfony/validator/Constraints/EqualTo.php b/vendor/symfony/validator/Constraints/EqualTo.php index 4b22c6dcca3e1d3f8f92ce434d7f5c77655e3632..ccd67675e736399f89f001548385637e1c8c83de 100644 --- a/vendor/symfony/validator/Constraints/EqualTo.php +++ b/vendor/symfony/validator/Constraints/EqualTo.php @@ -22,9 +22,9 @@ class EqualTo extends AbstractComparison { const NOT_EQUAL_ERROR = '478618a7-95ba-473d-9101-cabd45e49115'; - protected static $errorNames = array( + protected static $errorNames = [ self::NOT_EQUAL_ERROR => 'NOT_EQUAL_ERROR', - ); + ]; public $message = 'This value should be equal to {{ compared_value }}.'; } diff --git a/vendor/symfony/validator/Constraints/Existence.php b/vendor/symfony/validator/Constraints/Existence.php index 5ea6ffe643eecf97450bb2da2005a58f19248b42..903cf63913cfa39092fccc3527613c48d3886508 100644 --- a/vendor/symfony/validator/Constraints/Existence.php +++ b/vendor/symfony/validator/Constraints/Existence.php @@ -16,7 +16,7 @@ */ abstract class Existence extends Composite { - public $constraints = array(); + public $constraints = []; public function getDefaultOption() { diff --git a/vendor/symfony/validator/Constraints/Expression.php b/vendor/symfony/validator/Constraints/Expression.php index 3329bd249402882f5ec3f721296e8261c8bfc207..23eea2093f56cca7491bd2b988b04131e9835968 100644 --- a/vendor/symfony/validator/Constraints/Expression.php +++ b/vendor/symfony/validator/Constraints/Expression.php @@ -24,9 +24,9 @@ class Expression extends Constraint { const EXPRESSION_FAILED_ERROR = '6b3befbc-2f01-4ddf-be21-b57898905284'; - protected static $errorNames = array( + protected static $errorNames = [ self::EXPRESSION_FAILED_ERROR => 'EXPRESSION_FAILED_ERROR', - ); + ]; public $message = 'This value is not valid.'; public $expression; @@ -44,7 +44,7 @@ public function getDefaultOption() */ public function getRequiredOptions() { - return array('expression'); + return ['expression']; } /** @@ -52,7 +52,7 @@ public function getRequiredOptions() */ public function getTargets() { - return array(self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT); + return [self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT]; } /** diff --git a/vendor/symfony/validator/Constraints/ExpressionValidator.php b/vendor/symfony/validator/Constraints/ExpressionValidator.php index ce77d9ba843a42400419bb44c27d3ba4544e30f9..a4dfadbfc03ba78ca22c12925ee711fac363ce32 100644 --- a/vendor/symfony/validator/Constraints/ExpressionValidator.php +++ b/vendor/symfony/validator/Constraints/ExpressionValidator.php @@ -39,7 +39,7 @@ public function validate($value, Constraint $constraint) throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Expression'); } - $variables = array(); + $variables = []; $variables['value'] = $value; $variables['this'] = $this->context->getObject(); diff --git a/vendor/symfony/validator/Constraints/File.php b/vendor/symfony/validator/Constraints/File.php index 1e191382abe1f5a440ffc0aed34c95d1dce629b1..5221857101af2ea9f386f6433d6fd49e3ffefc63 100644 --- a/vendor/symfony/validator/Constraints/File.php +++ b/vendor/symfony/validator/Constraints/File.php @@ -32,16 +32,16 @@ class File extends Constraint const TOO_LARGE_ERROR = 'df8637af-d466-48c6-a59d-e7126250a654'; const INVALID_MIME_TYPE_ERROR = '744f00bc-4389-4c74-92de-9a43cde55534'; - protected static $errorNames = array( + protected static $errorNames = [ self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR', self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR', self::EMPTY_ERROR => 'EMPTY_ERROR', self::TOO_LARGE_ERROR => 'TOO_LARGE_ERROR', self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR', - ); + ]; public $binaryFormat; - public $mimeTypes = array(); + public $mimeTypes = []; public $notFoundMessage = 'The file could not be found.'; public $notReadableMessage = 'The file is not readable.'; public $maxSizeMessage = 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.'; @@ -99,12 +99,12 @@ public function __isset($option) private function normalizeBinaryFormat($maxSize) { - $factors = array( + $factors = [ 'k' => 1000, 'ki' => 1 << 10, 'm' => 1000000, 'mi' => 1 << 20, - ); + ]; if (ctype_digit((string) $maxSize)) { $this->maxSize = (int) $maxSize; $this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat; diff --git a/vendor/symfony/validator/Constraints/FileValidator.php b/vendor/symfony/validator/Constraints/FileValidator.php index e59f25247e9f61dc084b9a7464ec140a8f237a39..d3e3833ab72c05c159086e0a51ef3d145cf9e2b4 100644 --- a/vendor/symfony/validator/Constraints/FileValidator.php +++ b/vendor/symfony/validator/Constraints/FileValidator.php @@ -27,13 +27,13 @@ class FileValidator extends ConstraintValidator const KIB_BYTES = 1024; const MIB_BYTES = 1048576; - private static $suffices = array( + private static $suffices = [ 1 => 'bytes', self::KB_BYTES => 'kB', self::MB_BYTES => 'MB', self::KIB_BYTES => 'KiB', self::MIB_BYTES => 'MiB', - ); + ]; /** * {@inheritdoc} @@ -57,7 +57,7 @@ public function validate($value, Constraint $constraint) $binaryFormat = $constraint->binaryFormat; } else { $limitInBytes = $iniLimitSize; - $binaryFormat = true; + $binaryFormat = null === $constraint->binaryFormat ? true : $constraint->binaryFormat; } list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); @@ -233,6 +233,6 @@ private function factorizeSizes($size, $limit, $binaryFormat) $sizeAsString = (string) round($size / $coef, 2); } - return array($sizeAsString, $limitAsString, self::$suffices[$coef]); + return [$sizeAsString, $limitAsString, self::$suffices[$coef]]; } } diff --git a/vendor/symfony/validator/Constraints/GreaterThan.php b/vendor/symfony/validator/Constraints/GreaterThan.php index c2ca2dcb82f2369521bd889630290d21fed4a85e..ba225b44b615337be566226732673fa0c3b92a59 100644 --- a/vendor/symfony/validator/Constraints/GreaterThan.php +++ b/vendor/symfony/validator/Constraints/GreaterThan.php @@ -22,9 +22,9 @@ class GreaterThan extends AbstractComparison { const TOO_LOW_ERROR = '778b7ae0-84d3-481a-9dec-35fdb64b1d78'; - protected static $errorNames = array( + protected static $errorNames = [ self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', - ); + ]; public $message = 'This value should be greater than {{ compared_value }}.'; } diff --git a/vendor/symfony/validator/Constraints/GreaterThanOrEqual.php b/vendor/symfony/validator/Constraints/GreaterThanOrEqual.php index 9b3743d07321935256bcf1241baac8e75ef06b41..2c88f3ad05fb52740f740496ef53c8800f04e2d7 100644 --- a/vendor/symfony/validator/Constraints/GreaterThanOrEqual.php +++ b/vendor/symfony/validator/Constraints/GreaterThanOrEqual.php @@ -22,9 +22,9 @@ class GreaterThanOrEqual extends AbstractComparison { const TOO_LOW_ERROR = 'ea4e51d1-3342-48bd-87f1-9e672cd90cad'; - protected static $errorNames = array( + protected static $errorNames = [ self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', - ); + ]; public $message = 'This value should be greater than or equal to {{ compared_value }}.'; } diff --git a/vendor/symfony/validator/Constraints/GroupSequence.php b/vendor/symfony/validator/Constraints/GroupSequence.php index 1f6f512811ec78178f013d4207791a22778d8020..a39d712bf4be79d6af40dc5b0cca21793fed2bb6 100644 --- a/vendor/symfony/validator/Constraints/GroupSequence.php +++ b/vendor/symfony/validator/Constraints/GroupSequence.php @@ -17,7 +17,7 @@ * When validating a group sequence, each group will only be validated if all * of the previous groups in the sequence succeeded. For example: * - * $validator->validate($address, null, new GroupSequence(array('Basic', 'Strict'))); + * $validator->validate($address, null, new GroupSequence(['Basic', 'Strict'])); * * In the first step, all constraints that belong to the group "Basic" will be * validated. If none of the constraints fail, the validator will then validate diff --git a/vendor/symfony/validator/Constraints/Iban.php b/vendor/symfony/validator/Constraints/Iban.php index bcb30655aa44b041f1ce89179331716ab18ccccc..231f8c838dd57a330cc27595b336934d550bff30 100644 --- a/vendor/symfony/validator/Constraints/Iban.php +++ b/vendor/symfony/validator/Constraints/Iban.php @@ -29,13 +29,13 @@ class Iban extends Constraint const INVALID_FORMAT_ERROR = 'c8d318f1-2ecc-41ba-b983-df70d225cf5a'; const NOT_SUPPORTED_COUNTRY_CODE_ERROR = 'e2c259f3-4b46-48e6-b72e-891658158ec8'; - protected static $errorNames = array( + protected static $errorNames = [ self::INVALID_COUNTRY_CODE_ERROR => 'INVALID_COUNTRY_CODE_ERROR', self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', self::NOT_SUPPORTED_COUNTRY_CODE_ERROR => 'NOT_SUPPORTED_COUNTRY_CODE_ERROR', - ); + ]; public $message = 'This is not a valid International Bank Account Number (IBAN).'; } diff --git a/vendor/symfony/validator/Constraints/IbanValidator.php b/vendor/symfony/validator/Constraints/IbanValidator.php index 9d8d5b863cc8661f7dfe51a1ceead68e5a6577da..3dcedb47dc1ea1637260ce8e2156e3e8d07eb12e 100644 --- a/vendor/symfony/validator/Constraints/IbanValidator.php +++ b/vendor/symfony/validator/Constraints/IbanValidator.php @@ -35,7 +35,7 @@ class IbanValidator extends ConstraintValidator * * @see https://www.swift.com/sites/default/files/resources/iban_registry.pdf */ - private static $formats = array( + private static $formats = [ 'AD' => 'AD\d{2}\d{4}\d{4}[\dA-Z]{12}', // Andorra 'AE' => 'AE\d{2}\d{3}\d{16}', // United Arab Emirates 'AL' => 'AL\d{2}\d{8}[\dA-Z]{16}', // Albania @@ -129,11 +129,12 @@ class IbanValidator extends ConstraintValidator 'TN' => 'TN59\d{2}\d{3}\d{13}\d{2}', // Tunisia 'TR' => 'TR\d{2}\d{5}[\dA-Z]{1}[\dA-Z]{16}', // Turkey 'UA' => 'UA\d{2}\d{6}[\dA-Z]{19}', // Ukraine + 'VA' => 'VA\d{2}\d{3}\d{15}', // Vatican City State 'VG' => 'VG\d{2}[A-Z]{4}\d{16}', // Virgin Islands, British 'WF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Wallis and Futuna Islands 'XK' => 'XK\d{2}\d{4}\d{10}\d{2}', // Republic of Kosovo 'YT' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Mayotte - ); + ]; /** * {@inheritdoc} @@ -180,7 +181,7 @@ public function validate($value, Constraint $constraint) } // ...have a format available - if (!array_key_exists($countryCode, self::$formats)) { + if (!\array_key_exists($countryCode, self::$formats)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(Iban::NOT_SUPPORTED_COUNTRY_CODE_ERROR) diff --git a/vendor/symfony/validator/Constraints/IdenticalTo.php b/vendor/symfony/validator/Constraints/IdenticalTo.php index a7dadff833c5a83ecfdb3364513a641db5ea5b67..6c1bc2b1d76467a25f1b96c4265afc8ef43aa7fd 100644 --- a/vendor/symfony/validator/Constraints/IdenticalTo.php +++ b/vendor/symfony/validator/Constraints/IdenticalTo.php @@ -22,9 +22,9 @@ class IdenticalTo extends AbstractComparison { const NOT_IDENTICAL_ERROR = '2a8cc50f-58a2-4536-875e-060a2ce69ed5'; - protected static $errorNames = array( + protected static $errorNames = [ self::NOT_IDENTICAL_ERROR => 'NOT_IDENTICAL_ERROR', - ); + ]; public $message = 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.'; } diff --git a/vendor/symfony/validator/Constraints/Image.php b/vendor/symfony/validator/Constraints/Image.php index c3c2c7a237a82c832d21bfa1f211d8aa72e0c9a9..21005d9ea5533a949d68dfe408aa06365c19b68b 100644 --- a/vendor/symfony/validator/Constraints/Image.php +++ b/vendor/symfony/validator/Constraints/Image.php @@ -36,7 +36,7 @@ class Image extends File // Include the mapping from the base class - protected static $errorNames = array( + protected static $errorNames = [ self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR', self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR', self::EMPTY_ERROR => 'EMPTY_ERROR', @@ -55,7 +55,7 @@ class Image extends File self::LANDSCAPE_NOT_ALLOWED_ERROR => 'LANDSCAPE_NOT_ALLOWED_ERROR', self::PORTRAIT_NOT_ALLOWED_ERROR => 'PORTRAIT_NOT_ALLOWED_ERROR', self::CORRUPTED_IMAGE_ERROR => 'CORRUPTED_IMAGE_ERROR', - ); + ]; public $mimeTypes = 'image/*'; public $minWidth; diff --git a/vendor/symfony/validator/Constraints/Ip.php b/vendor/symfony/validator/Constraints/Ip.php index f45c4cacebca01fa815df1d1f5a625ba69ddf400..aff99d4672d773b6c441ca1f47d16ea0f7690f19 100644 --- a/vendor/symfony/validator/Constraints/Ip.php +++ b/vendor/symfony/validator/Constraints/Ip.php @@ -46,7 +46,7 @@ class Ip extends Constraint const INVALID_IP_ERROR = 'b1b427ae-9f6f-41b0-aa9b-84511fbb3c5b'; - protected static $versions = array( + protected static $versions = [ self::V4, self::V6, self::ALL, @@ -62,11 +62,11 @@ class Ip extends Constraint self::V4_ONLY_PUBLIC, self::V6_ONLY_PUBLIC, self::ALL_ONLY_PUBLIC, - ); + ]; - protected static $errorNames = array( + protected static $errorNames = [ self::INVALID_IP_ERROR => 'INVALID_IP_ERROR', - ); + ]; public $version = self::V4; diff --git a/vendor/symfony/validator/Constraints/IsFalse.php b/vendor/symfony/validator/Constraints/IsFalse.php index 8332e1874f5c7cfa6987ed0779a38ddee8ab005f..d488c616dd424c19260254a623d90e166fec2f91 100644 --- a/vendor/symfony/validator/Constraints/IsFalse.php +++ b/vendor/symfony/validator/Constraints/IsFalse.php @@ -23,9 +23,9 @@ class IsFalse extends Constraint { const NOT_FALSE_ERROR = 'd53a91b0-def3-426a-83d7-269da7ab4200'; - protected static $errorNames = array( + protected static $errorNames = [ self::NOT_FALSE_ERROR => 'NOT_FALSE_ERROR', - ); + ]; public $message = 'This value should be false.'; } diff --git a/vendor/symfony/validator/Constraints/IsNull.php b/vendor/symfony/validator/Constraints/IsNull.php index fdd2930916ec857c09976fa353fd6084843a62f0..e010f9cf0696d17c6a8c3d4e4b5488fc7557af02 100644 --- a/vendor/symfony/validator/Constraints/IsNull.php +++ b/vendor/symfony/validator/Constraints/IsNull.php @@ -23,9 +23,9 @@ class IsNull extends Constraint { const NOT_NULL_ERROR = '60d2f30b-8cfa-4372-b155-9656634de120'; - protected static $errorNames = array( + protected static $errorNames = [ self::NOT_NULL_ERROR => 'NOT_NULL_ERROR', - ); + ]; public $message = 'This value should be null.'; } diff --git a/vendor/symfony/validator/Constraints/IsTrue.php b/vendor/symfony/validator/Constraints/IsTrue.php index 405a96a422d17b9d7160cb9c0274326c3909a869..84f6ce15a7c1161b2161cf795d3dbc3ca635b9ae 100644 --- a/vendor/symfony/validator/Constraints/IsTrue.php +++ b/vendor/symfony/validator/Constraints/IsTrue.php @@ -23,9 +23,9 @@ class IsTrue extends Constraint { const NOT_TRUE_ERROR = '2beabf1c-54c0-4882-a928-05249b26e23b'; - protected static $errorNames = array( + protected static $errorNames = [ self::NOT_TRUE_ERROR => 'NOT_TRUE_ERROR', - ); + ]; public $message = 'This value should be true.'; } diff --git a/vendor/symfony/validator/Constraints/Isbn.php b/vendor/symfony/validator/Constraints/Isbn.php index 615feb66416d457d5bc1538ef4362ef994952882..6629c823e1aa727898d3e888752e947d87fe7452 100644 --- a/vendor/symfony/validator/Constraints/Isbn.php +++ b/vendor/symfony/validator/Constraints/Isbn.php @@ -29,13 +29,13 @@ class Isbn extends Constraint const CHECKSUM_FAILED_ERROR = '2881c032-660f-46b6-8153-d352d9706640'; const TYPE_NOT_RECOGNIZED_ERROR = 'fa54a457-f042-441f-89c4-066ee5bdd3e1'; - protected static $errorNames = array( + protected static $errorNames = [ self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', self::TYPE_NOT_RECOGNIZED_ERROR => 'TYPE_NOT_RECOGNIZED_ERROR', - ); + ]; public $isbn10Message = 'This value is not a valid ISBN-10.'; public $isbn13Message = 'This value is not a valid ISBN-13.'; diff --git a/vendor/symfony/validator/Constraints/Issn.php b/vendor/symfony/validator/Constraints/Issn.php index a2fecdd35c386d77fa8c388616def6f36ded10c6..88d181fa63af7b8ee99373877595e072d821bf7e 100644 --- a/vendor/symfony/validator/Constraints/Issn.php +++ b/vendor/symfony/validator/Constraints/Issn.php @@ -29,14 +29,14 @@ class Issn extends Constraint const INVALID_CASE_ERROR = '7b6dd393-7523-4a6c-b84d-72b91bba5e1a'; const CHECKSUM_FAILED_ERROR = 'b0f92dbc-667c-48de-b526-ad9586d43e85'; - protected static $errorNames = array( + protected static $errorNames = [ self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', self::MISSING_HYPHEN_ERROR => 'MISSING_HYPHEN_ERROR', self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR', self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', - ); + ]; public $message = 'This value is not a valid ISSN.'; public $caseSensitive = false; diff --git a/vendor/symfony/validator/Constraints/Language.php b/vendor/symfony/validator/Constraints/Language.php index 0e676b7aabcda4b85940a5abccf8363a29184a3a..745eb2055b68dcd10b0cc7738662c60f58551509 100644 --- a/vendor/symfony/validator/Constraints/Language.php +++ b/vendor/symfony/validator/Constraints/Language.php @@ -23,9 +23,9 @@ class Language extends Constraint { const NO_SUCH_LANGUAGE_ERROR = 'ee65fec4-9a20-4202-9f39-ca558cd7bdf7'; - protected static $errorNames = array( + protected static $errorNames = [ self::NO_SUCH_LANGUAGE_ERROR => 'NO_SUCH_LANGUAGE_ERROR', - ); + ]; public $message = 'This value is not a valid language.'; } diff --git a/vendor/symfony/validator/Constraints/Length.php b/vendor/symfony/validator/Constraints/Length.php index 20a17fabca55e62777d9aeb9d865dc22f964d5b0..79aa473204eaf01bf35f3c162a61d5168b8e667e 100644 --- a/vendor/symfony/validator/Constraints/Length.php +++ b/vendor/symfony/validator/Constraints/Length.php @@ -26,11 +26,11 @@ class Length extends Constraint const TOO_LONG_ERROR = 'd94b19cc-114f-4f44-9cc4-4138e80a87b9'; const INVALID_CHARACTERS_ERROR = '35e6a710-aa2e-4719-b58e-24b35749b767'; - protected static $errorNames = array( + protected static $errorNames = [ self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', - ); + ]; public $maxMessage = 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.'; public $minMessage = 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.'; @@ -43,16 +43,16 @@ class Length extends Constraint public function __construct($options = null) { if (null !== $options && !\is_array($options)) { - $options = array( + $options = [ 'min' => $options, 'max' => $options, - ); + ]; } parent::__construct($options); if (null === $this->min && null === $this->max) { - throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), array('min', 'max')); + throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), ['min', 'max']); } } } diff --git a/vendor/symfony/validator/Constraints/LessThan.php b/vendor/symfony/validator/Constraints/LessThan.php index 1bbb50878b1a6ca0c3428af783bf50d3f7434b55..8ea07ace2e84946cd4ecc63e73cc5a98808ee5a2 100644 --- a/vendor/symfony/validator/Constraints/LessThan.php +++ b/vendor/symfony/validator/Constraints/LessThan.php @@ -22,9 +22,9 @@ class LessThan extends AbstractComparison { const TOO_HIGH_ERROR = '079d7420-2d13-460c-8756-de810eeb37d2'; - protected static $errorNames = array( + protected static $errorNames = [ self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR', - ); + ]; public $message = 'This value should be less than {{ compared_value }}.'; } diff --git a/vendor/symfony/validator/Constraints/LessThanOrEqual.php b/vendor/symfony/validator/Constraints/LessThanOrEqual.php index d118942385c57a2d41c2b60fc9435025c9df6b69..806ca4990fa02a3e03c9275504483252751c81a2 100644 --- a/vendor/symfony/validator/Constraints/LessThanOrEqual.php +++ b/vendor/symfony/validator/Constraints/LessThanOrEqual.php @@ -20,11 +20,11 @@ */ class LessThanOrEqual extends AbstractComparison { - const TOO_HIGH_ERROR = '079d7420-2d13-460c-8756-de810eeb37d2'; + const TOO_HIGH_ERROR = '30fbb013-d015-4232-8b3b-8f3be97a7e14'; - protected static $errorNames = array( + protected static $errorNames = [ self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR', - ); + ]; public $message = 'This value should be less than or equal to {{ compared_value }}.'; } diff --git a/vendor/symfony/validator/Constraints/Locale.php b/vendor/symfony/validator/Constraints/Locale.php index 5aa7070402e2ac7b2eb33dcfaf61912c45424396..759f99e1909ecfce133a2c80e63314ad0c3ed700 100644 --- a/vendor/symfony/validator/Constraints/Locale.php +++ b/vendor/symfony/validator/Constraints/Locale.php @@ -23,9 +23,9 @@ class Locale extends Constraint { const NO_SUCH_LOCALE_ERROR = 'a0af4293-1f1a-4a1c-a328-979cba6182a2'; - protected static $errorNames = array( + protected static $errorNames = [ self::NO_SUCH_LOCALE_ERROR => 'NO_SUCH_LOCALE_ERROR', - ); + ]; public $message = 'This value is not a valid locale.'; } diff --git a/vendor/symfony/validator/Constraints/Luhn.php b/vendor/symfony/validator/Constraints/Luhn.php index 67f152d29dc5398c31eb2aee98d26d02847ee504..85eebc793beabdf4434f3da30ec0b0200b161794 100644 --- a/vendor/symfony/validator/Constraints/Luhn.php +++ b/vendor/symfony/validator/Constraints/Luhn.php @@ -28,10 +28,10 @@ class Luhn extends Constraint const INVALID_CHARACTERS_ERROR = 'dfad6d23-1b74-4374-929b-5cbb56fc0d9e'; const CHECKSUM_FAILED_ERROR = '4d760774-3f50-4cd5-a6d5-b10a3299d8d3'; - protected static $errorNames = array( + protected static $errorNames = [ self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', - ); + ]; public $message = 'Invalid card number.'; } diff --git a/vendor/symfony/validator/Constraints/NotBlank.php b/vendor/symfony/validator/Constraints/NotBlank.php index e059f1028a2cb5b3f71b3c86df0234c7d7317219..7616c426c7da0e00f7c7f36038933ccbdf64f854 100644 --- a/vendor/symfony/validator/Constraints/NotBlank.php +++ b/vendor/symfony/validator/Constraints/NotBlank.php @@ -23,9 +23,9 @@ class NotBlank extends Constraint { const IS_BLANK_ERROR = 'c1051bb4-d103-4f74-8988-acbcafc7fdc3'; - protected static $errorNames = array( + protected static $errorNames = [ self::IS_BLANK_ERROR => 'IS_BLANK_ERROR', - ); + ]; public $message = 'This value should not be blank.'; } diff --git a/vendor/symfony/validator/Constraints/NotEqualTo.php b/vendor/symfony/validator/Constraints/NotEqualTo.php index 8c5abddaee4221e5ebd4e2a0156e8e0b22b576d8..a04f3a9b6c4b6527ebf9d9cbc52409497ab83a2b 100644 --- a/vendor/symfony/validator/Constraints/NotEqualTo.php +++ b/vendor/symfony/validator/Constraints/NotEqualTo.php @@ -22,9 +22,9 @@ class NotEqualTo extends AbstractComparison { const IS_EQUAL_ERROR = 'aa2e33da-25c8-4d76-8c6c-812f02ea89dd'; - protected static $errorNames = array( + protected static $errorNames = [ self::IS_EQUAL_ERROR => 'IS_EQUAL_ERROR', - ); + ]; public $message = 'This value should not be equal to {{ compared_value }}.'; } diff --git a/vendor/symfony/validator/Constraints/NotIdenticalTo.php b/vendor/symfony/validator/Constraints/NotIdenticalTo.php index 4c9c63ea61e4917b02eaa1534592198d05a6912a..972e4a103c249662dd40a287cda726bca57837ff 100644 --- a/vendor/symfony/validator/Constraints/NotIdenticalTo.php +++ b/vendor/symfony/validator/Constraints/NotIdenticalTo.php @@ -22,9 +22,9 @@ class NotIdenticalTo extends AbstractComparison { const IS_IDENTICAL_ERROR = '4aaac518-0dda-4129-a6d9-e216b9b454a0'; - protected static $errorNames = array( + protected static $errorNames = [ self::IS_IDENTICAL_ERROR => 'IS_IDENTICAL_ERROR', - ); + ]; public $message = 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.'; } diff --git a/vendor/symfony/validator/Constraints/NotNull.php b/vendor/symfony/validator/Constraints/NotNull.php index 1cfc1c80ecc0794a678ac25387498b37f1a28443..a392104d0e6627980334dac0300c84964c951447 100644 --- a/vendor/symfony/validator/Constraints/NotNull.php +++ b/vendor/symfony/validator/Constraints/NotNull.php @@ -23,9 +23,9 @@ class NotNull extends Constraint { const IS_NULL_ERROR = 'ad32d13f-c3d4-423b-909a-857b961eb720'; - protected static $errorNames = array( + protected static $errorNames = [ self::IS_NULL_ERROR => 'IS_NULL_ERROR', - ); + ]; public $message = 'This value should not be null.'; } diff --git a/vendor/symfony/validator/Constraints/Range.php b/vendor/symfony/validator/Constraints/Range.php index dcaf9db95524646c223c241c98f5647e23750ceb..65ece5d832007dd79b109e6cb25e915dd882879f 100644 --- a/vendor/symfony/validator/Constraints/Range.php +++ b/vendor/symfony/validator/Constraints/Range.php @@ -26,11 +26,11 @@ class Range extends Constraint const TOO_HIGH_ERROR = '2d28afcb-e32e-45fb-a815-01c431a86a69'; const TOO_LOW_ERROR = '76454e69-502c-46c5-9643-f447d837c4d5'; - protected static $errorNames = array( + protected static $errorNames = [ self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR', self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', - ); + ]; public $minMessage = 'This value should be {{ limit }} or more.'; public $maxMessage = 'This value should be {{ limit }} or less.'; @@ -43,7 +43,7 @@ public function __construct($options = null) parent::__construct($options); if (null === $this->min && null === $this->max) { - throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), array('min', 'max')); + throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), ['min', 'max']); } } } diff --git a/vendor/symfony/validator/Constraints/Regex.php b/vendor/symfony/validator/Constraints/Regex.php index cb122102259c4b2f870cc16a8d7f944d0933a38a..dc9e5ea8859d94b8a75829f7dcf7ebc8520cb26b 100644 --- a/vendor/symfony/validator/Constraints/Regex.php +++ b/vendor/symfony/validator/Constraints/Regex.php @@ -23,9 +23,9 @@ class Regex extends Constraint { const REGEX_FAILED_ERROR = 'de1e3db3-5ed4-4941-aae4-59f3667cc3a3'; - protected static $errorNames = array( + protected static $errorNames = [ self::REGEX_FAILED_ERROR => 'REGEX_FAILED_ERROR', - ); + ]; public $message = 'This value is not valid.'; public $pattern; @@ -45,7 +45,7 @@ public function getDefaultOption() */ public function getRequiredOptions() { - return array('pattern'); + return ['pattern']; } /** @@ -79,7 +79,7 @@ public function getHtmlPattern() // Unescape the delimiter $pattern = str_replace('\\'.$delimiter, $delimiter, substr($this->pattern, 1, -1)); - // If the pattern is inverted, we can simply wrap it in + // If the pattern is inverted, we can wrap it in // ((?!pattern).)* if (!$this->match) { return '((?!'.$pattern.').)*'; diff --git a/vendor/symfony/validator/Constraints/Time.php b/vendor/symfony/validator/Constraints/Time.php index 6bd8dbda2e2aa9504eea7be1b950b126afd2b5d0..d1a3397b240a613e24714ac9737934539f5abc64 100644 --- a/vendor/symfony/validator/Constraints/Time.php +++ b/vendor/symfony/validator/Constraints/Time.php @@ -24,10 +24,10 @@ class Time extends Constraint const INVALID_FORMAT_ERROR = '9d27b2bb-f755-4fbf-b725-39b1edbdebdf'; const INVALID_TIME_ERROR = '8532f9e1-84b2-4d67-8989-0818bc38533b'; - protected static $errorNames = array( + protected static $errorNames = [ self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', self::INVALID_TIME_ERROR => 'INVALID_TIME_ERROR', - ); + ]; public $message = 'This value is not a valid time.'; } diff --git a/vendor/symfony/validator/Constraints/Traverse.php b/vendor/symfony/validator/Constraints/Traverse.php index 0b74d98d463ecefd71fbf98c00deee5de8f80857..78d115fdbbc74c9bb504b5cbf4dc54981219d45c 100644 --- a/vendor/symfony/validator/Constraints/Traverse.php +++ b/vendor/symfony/validator/Constraints/Traverse.php @@ -25,11 +25,8 @@ class Traverse extends Constraint public function __construct($options = null) { - if (\is_array($options) && array_key_exists('groups', $options)) { - throw new ConstraintDefinitionException(sprintf( - 'The option "groups" is not supported by the constraint %s', - __CLASS__ - )); + if (\is_array($options) && \array_key_exists('groups', $options)) { + throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint %s', __CLASS__)); } parent::__construct($options); diff --git a/vendor/symfony/validator/Constraints/Type.php b/vendor/symfony/validator/Constraints/Type.php index e40b47820d6bbe861585181dc561c8e7e9d57b46..ac798bcd44247b56e4f16f5e4f9db728c5a89928 100644 --- a/vendor/symfony/validator/Constraints/Type.php +++ b/vendor/symfony/validator/Constraints/Type.php @@ -23,9 +23,9 @@ class Type extends Constraint { const INVALID_TYPE_ERROR = 'ba785a8c-82cb-4283-967c-3cf342181b40'; - protected static $errorNames = array( + protected static $errorNames = [ self::INVALID_TYPE_ERROR => 'INVALID_TYPE_ERROR', - ); + ]; public $message = 'This value should be of type {{ type }}.'; public $type; @@ -43,6 +43,6 @@ public function getDefaultOption() */ public function getRequiredOptions() { - return array('type'); + return ['type']; } } diff --git a/vendor/symfony/validator/Constraints/Url.php b/vendor/symfony/validator/Constraints/Url.php index 988dd19136da6d8a59ad3f9de190c6ba5d27cca6..1a8d18efb9db4381c84fe15322f9c09df52dd82d 100644 --- a/vendor/symfony/validator/Constraints/Url.php +++ b/vendor/symfony/validator/Constraints/Url.php @@ -37,12 +37,12 @@ class Url extends Constraint const INVALID_URL_ERROR = '57c2f299-1154-4870-89bb-ef3b1f5ad229'; - protected static $errorNames = array( + protected static $errorNames = [ self::INVALID_URL_ERROR => 'INVALID_URL_ERROR', - ); + ]; public $message = 'This value is not a valid URL.'; public $dnsMessage = 'The host could not be resolved.'; - public $protocols = array('http', 'https'); + public $protocols = ['http', 'https']; public $checkDNS = self::CHECK_DNS_TYPE_NONE; } diff --git a/vendor/symfony/validator/Constraints/UrlValidator.php b/vendor/symfony/validator/Constraints/UrlValidator.php index 3ccf4ba79b2b547cf8c35e5f00ca8cda12de3414..bdaef756bcc54cd4b72565a368d66a7f5bb5c483 100644 --- a/vendor/symfony/validator/Constraints/UrlValidator.php +++ b/vendor/symfony/validator/Constraints/UrlValidator.php @@ -79,7 +79,7 @@ public function validate($value, Constraint $constraint) @trigger_error(sprintf('Use of the boolean TRUE for the "checkDNS" option in %s is deprecated. Use Url::CHECK_DNS_TYPE_ANY instead.', Url::class), E_USER_DEPRECATED); } - if (!\in_array($constraint->checkDNS, array( + if (!\in_array($constraint->checkDNS, [ Url::CHECK_DNS_TYPE_ANY, Url::CHECK_DNS_TYPE_A, Url::CHECK_DNS_TYPE_A6, @@ -92,8 +92,8 @@ public function validate($value, Constraint $constraint) Url::CHECK_DNS_TYPE_SOA, Url::CHECK_DNS_TYPE_SRV, Url::CHECK_DNS_TYPE_TXT, - ), true)) { - throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint %s', \get_class($constraint)), array('checkDNS')); + ], true)) { + throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint %s', \get_class($constraint)), ['checkDNS']); } $host = parse_url($value, PHP_URL_HOST); diff --git a/vendor/symfony/validator/Constraints/Uuid.php b/vendor/symfony/validator/Constraints/Uuid.php index 2deecbadd61c976b7c4c035320c71ce2eb070e27..988f3c3b2dfd9c9c3811fbe8c0b84a86bbdffd06 100644 --- a/vendor/symfony/validator/Constraints/Uuid.php +++ b/vendor/symfony/validator/Constraints/Uuid.php @@ -28,14 +28,14 @@ class Uuid extends Constraint const INVALID_VERSION_ERROR = '21ba13b4-b185-4882-ac6f-d147355987eb'; const INVALID_VARIANT_ERROR = '164ef693-2b9d-46de-ad7f-836201f0c2db'; - protected static $errorNames = array( + protected static $errorNames = [ self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', self::INVALID_HYPHEN_PLACEMENT_ERROR => 'INVALID_HYPHEN_PLACEMENT_ERROR', self::INVALID_VERSION_ERROR => 'INVALID_VERSION_ERROR', self::INVALID_VARIANT_ERROR => 'INVALID_VARIANT_ERROR', - ); + ]; // Possible versions defined by RFC 4122 const V1_MAC = 1; @@ -67,11 +67,11 @@ class Uuid extends Constraint * * @var int[] */ - public $versions = array( + public $versions = [ self::V1_MAC, self::V2_DCE, self::V3_MD5, self::V4_RANDOM, self::V5_SHA1, - ); + ]; } diff --git a/vendor/symfony/validator/Constraints/UuidValidator.php b/vendor/symfony/validator/Constraints/UuidValidator.php index 38e9a0da8585ed441247c12bd91d4011154ce91b..26de4614f324f0bdbec468e5d4b1fdbbbc5eafe1 100644 --- a/vendor/symfony/validator/Constraints/UuidValidator.php +++ b/vendor/symfony/validator/Constraints/UuidValidator.php @@ -66,14 +66,14 @@ class UuidValidator extends ConstraintValidator */ public function validate($value, Constraint $constraint) { - if (null === $value || '' === $value) { - return; - } - if (!$constraint instanceof Uuid) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Uuid'); } + if (null === $value || '' === $value) { + return; + } + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedTypeException($value, 'string'); } diff --git a/vendor/symfony/validator/Constraints/ValidValidator.php b/vendor/symfony/validator/Constraints/ValidValidator.php index be5fbc12660ba7b6c1e21d48d1626f8b2681f8d2..cc10ec5204efc862ab4a5316a7781c41e7e74f79 100644 --- a/vendor/symfony/validator/Constraints/ValidValidator.php +++ b/vendor/symfony/validator/Constraints/ValidValidator.php @@ -33,6 +33,6 @@ public function validate($value, Constraint $constraint) $this->context ->getValidator() ->inContext($this->context) - ->validate($value, null, array($this->context->getGroup())); + ->validate($value, null, [$this->context->getGroup()]); } } diff --git a/vendor/symfony/validator/ContainerConstraintValidatorFactory.php b/vendor/symfony/validator/ContainerConstraintValidatorFactory.php index 43c8a0d7cb6d4f1cf2b3d1fd9f12e1797bdd2d7f..62e5530dc23c20b8aa790c80e4d445d25054a0cb 100644 --- a/vendor/symfony/validator/ContainerConstraintValidatorFactory.php +++ b/vendor/symfony/validator/ContainerConstraintValidatorFactory.php @@ -28,7 +28,7 @@ class ContainerConstraintValidatorFactory implements ConstraintValidatorFactoryI public function __construct(ContainerInterface $container) { $this->container = $container; - $this->validators = array(); + $this->validators = []; } /** @@ -46,7 +46,7 @@ public function getInstance(Constraint $constraint) $this->validators[$name] = $this->container->get($name); } else { if (!class_exists($name)) { - throw new ValidatorException(sprintf('Constraint validator "%s" does not exist or it is not enabled. Check the "validatedBy" method in your constraint class "%s".', $name, \get_class($constraint))); + throw new ValidatorException(sprintf('Constraint validator "%s" does not exist or is not enabled. Check the "validatedBy" method in your constraint class "%s".', $name, \get_class($constraint))); } $this->validators[$name] = new $name(); diff --git a/vendor/symfony/validator/Context/ExecutionContext.php b/vendor/symfony/validator/Context/ExecutionContext.php index 8118ac10ca7fe25418cf50e5a5c98acf10fc8cd3..7ca9caa80fefbc18db2007f4edfeb68fe597d128 100644 --- a/vendor/symfony/validator/Context/ExecutionContext.php +++ b/vendor/symfony/validator/Context/ExecutionContext.php @@ -110,14 +110,14 @@ class ExecutionContext implements ExecutionContextInterface * * @var array */ - private $validatedObjects = array(); + private $validatedObjects = []; /** * Stores which class constraint has been validated for which object. * * @var array */ - private $validatedConstraints = array(); + private $validatedConstraints = []; /** * Stores which objects have been initialized. @@ -179,7 +179,7 @@ public function setConstraint(Constraint $constraint) /** * {@inheritdoc} */ - public function addViolation($message, array $parameters = array()) + public function addViolation($message, array $parameters = []) { $this->violations->add(new ConstraintViolation( $this->translator->trans($message, $parameters, $this->translationDomain), @@ -197,7 +197,7 @@ public function addViolation($message, array $parameters = array()) /** * {@inheritdoc} */ - public function buildViolation($message, array $parameters = array()) + public function buildViolation($message, array $parameters = []) { return new ConstraintViolationBuilder( $this->violations, @@ -303,7 +303,7 @@ public function getPropertyPath($subPath = '') public function markGroupAsValidated($cacheKey, $groupHash) { if (!isset($this->validatedObjects[$cacheKey])) { - $this->validatedObjects[$cacheKey] = array(); + $this->validatedObjects[$cacheKey] = []; } $this->validatedObjects[$cacheKey][$groupHash] = true; diff --git a/vendor/symfony/validator/Context/ExecutionContextInterface.php b/vendor/symfony/validator/Context/ExecutionContextInterface.php index ac79ab4dc7b96e511870217572c09ab9751b27d7..2ab625b1561a1c29be8f6606cd83c39b86d7bc25 100644 --- a/vendor/symfony/validator/Context/ExecutionContextInterface.php +++ b/vendor/symfony/validator/Context/ExecutionContextInterface.php @@ -67,7 +67,7 @@ interface ExecutionContextInterface * @param string $message The error message * @param array $params The parameters substituted in the error message */ - public function addViolation($message, array $params = array()); + public function addViolation($message, array $params = []); /** * Returns a builder for adding a violation with extended information. @@ -86,7 +86,7 @@ public function addViolation($message, array $params = array()); * * @return ConstraintViolationBuilderInterface The violation builder */ - public function buildViolation($message, array $parameters = array()); + public function buildViolation($message, array $parameters = []); /** * Returns the validator. @@ -97,7 +97,7 @@ public function buildViolation($message, array $parameters = array()); * { * $validator = $this->context->getValidator(); * - * $violations = $validator->validateValue($value, new Length(array('min' => 3))); + * $violations = $validator->validate($value, new Length(['min' => 3])); * * if (count($violations) > 0) { * // ... @@ -112,7 +112,7 @@ public function getValidator(); * Returns the currently validated object. * * If the validator is currently validating a class constraint, the - * object of that class is returned. If it is a validating a property or + * object of that class is returned. If it is validating a property or * getter constraint, the object that the property/getter belongs to is * returned. * diff --git a/vendor/symfony/validator/DataCollector/ValidatorDataCollector.php b/vendor/symfony/validator/DataCollector/ValidatorDataCollector.php index f7165e5fbdae06ab1a3229b1933ebc2babf82d54..999a9968b07f5daac76eed8d1e953164a1e3110f 100644 --- a/vendor/symfony/validator/DataCollector/ValidatorDataCollector.php +++ b/vendor/symfony/validator/DataCollector/ValidatorDataCollector.php @@ -45,10 +45,10 @@ public function collect(Request $request, Response $response, \Exception $except public function reset() { - $this->data = array( - 'calls' => $this->cloneVar(array()), + $this->data = [ + 'calls' => $this->cloneVar([]), 'violations_count' => 0, - ); + ]; } /** @@ -89,9 +89,9 @@ public function getName() protected function getCasters() { - return parent::getCasters() + array( + return parent::getCasters() + [ \Exception::class => function (\Exception $e, array $a, Stub $s) { - foreach (array("\0Exception\0previous", "\0Exception\0trace") as $k) { + foreach (["\0Exception\0previous", "\0Exception\0trace"] as $k) { if (isset($a[$k])) { unset($a[$k]); ++$s->cut; @@ -101,12 +101,12 @@ protected function getCasters() return $a; }, FormInterface::class => function (FormInterface $f, array $a) { - return array( + return [ Caster::PREFIX_VIRTUAL.'name' => $f->getName(), Caster::PREFIX_VIRTUAL.'type_class' => new ClassStub(\get_class($f->getConfig()->getType()->getInnerType())), Caster::PREFIX_VIRTUAL.'data' => $f->getData(), - ); + ]; }, - ); + ]; } } diff --git a/vendor/symfony/validator/DependencyInjection/AddConstraintValidatorsPass.php b/vendor/symfony/validator/DependencyInjection/AddConstraintValidatorsPass.php index d651188985f347e71c00b7cde813e9a0aa9fc91a..9098423413879fabd08bca8294fabdd38ccc145f 100644 --- a/vendor/symfony/validator/DependencyInjection/AddConstraintValidatorsPass.php +++ b/vendor/symfony/validator/DependencyInjection/AddConstraintValidatorsPass.php @@ -37,7 +37,7 @@ public function process(ContainerBuilder $container) return; } - $validators = array(); + $validators = []; foreach ($container->findTaggedServiceIds($this->constraintValidatorTag, true) as $id => $attributes) { $definition = $container->getDefinition($id); diff --git a/vendor/symfony/validator/DependencyInjection/AddValidatorInitializersPass.php b/vendor/symfony/validator/DependencyInjection/AddValidatorInitializersPass.php index 330f578f033f44728d6a6348c429d765a692559e..bbce7c977fdad1caf742dcfd546b706bf1416e1c 100644 --- a/vendor/symfony/validator/DependencyInjection/AddValidatorInitializersPass.php +++ b/vendor/symfony/validator/DependencyInjection/AddValidatorInitializersPass.php @@ -36,11 +36,11 @@ public function process(ContainerBuilder $container) return; } - $initializers = array(); + $initializers = []; foreach ($container->findTaggedServiceIds($this->initializerTag, true) as $id => $attributes) { $initializers[] = new Reference($id); } - $container->getDefinition($this->builderService)->addMethodCall('addObjectInitializers', array($initializers)); + $container->getDefinition($this->builderService)->addMethodCall('addObjectInitializers', [$initializers]); } } diff --git a/vendor/symfony/validator/GroupSequenceProviderInterface.php b/vendor/symfony/validator/GroupSequenceProviderInterface.php index 62e8a5ed0d4f7a93ed67da2f553f92605d926ec4..5894397da4debe358ad405080f1a4ae9f64d3848 100644 --- a/vendor/symfony/validator/GroupSequenceProviderInterface.php +++ b/vendor/symfony/validator/GroupSequenceProviderInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Validator; +use Symfony\Component\Validator\Constraints\GroupSequence; + /** * Defines the interface for a group sequence provider. */ @@ -20,7 +22,7 @@ interface GroupSequenceProviderInterface * Returns which validation groups should be used for a certain state * of the object. * - * @return array An array of validation groups + * @return string[]|GroupSequence An array of validation groups */ public function getGroupSequence(); } diff --git a/vendor/symfony/validator/LICENSE b/vendor/symfony/validator/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/validator/LICENSE +++ b/vendor/symfony/validator/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/validator/Mapping/ClassMetadata.php b/vendor/symfony/validator/Mapping/ClassMetadata.php index abab941f912807188e33ed37f180768e43b4dd8d..03b0ae6d8f575faab1be6aa1549a68a34c218714 100644 --- a/vendor/symfony/validator/Mapping/ClassMetadata.php +++ b/vendor/symfony/validator/Mapping/ClassMetadata.php @@ -53,7 +53,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface * class' serialized representation. Do not access it. Use * {@link getPropertyMetadata()} instead. */ - public $members = array(); + public $members = []; /** * @var PropertyMetadata[] @@ -62,7 +62,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface * class' serialized representation. Do not access it. Use * {@link getPropertyMetadata()} instead. */ - public $properties = array(); + public $properties = []; /** * @var GetterMetadata[] @@ -71,7 +71,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface * class' serialized representation. Do not access it. Use * {@link getPropertyMetadata()} instead. */ - public $getters = array(); + public $getters = []; /** * @var array @@ -80,7 +80,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface * class' serialized representation. Do not access it. Use * {@link getGroupSequence()} instead. */ - public $groupSequence = array(); + public $groupSequence = []; /** * @var bool @@ -135,7 +135,7 @@ public function __sleep() // Don't store the cascading strategy. Classes never cascade. unset($parentProperties[array_search('cascadingStrategy', $parentProperties)]); - return array_merge($parentProperties, array( + return array_merge($parentProperties, [ 'getters', 'groupSequence', 'groupSequenceProvider', @@ -143,7 +143,7 @@ public function __sleep() 'name', 'properties', 'defaultGroup', - )); + ]); } /** @@ -180,17 +180,11 @@ public function getDefaultGroup() public function addConstraint(Constraint $constraint) { if (!\in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" cannot be put on classes.', - \get_class($constraint) - )); + throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint))); } if ($constraint instanceof Valid) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" cannot be put on classes.', - \get_class($constraint) - )); + throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint))); } if ($constraint instanceof Traverse) { @@ -377,7 +371,7 @@ public function mergeConstraints(self $source) */ public function hasPropertyMetadata($property) { - return array_key_exists($property, $this->members); + return \array_key_exists($property, $this->members); } /** @@ -386,7 +380,7 @@ public function hasPropertyMetadata($property) public function getPropertyMetadata($property) { if (!isset($this->members[$property])) { - return array(); + return []; } return $this->members[$property]; @@ -403,7 +397,7 @@ public function getConstrainedProperties() /** * Sets the default group sequence for this class. * - * @param array $groupSequence An array of group names + * @param string[]|GroupSequence $groupSequence An array of group names * * @return $this * diff --git a/vendor/symfony/validator/Mapping/ClassMetadataInterface.php b/vendor/symfony/validator/Mapping/ClassMetadataInterface.php index e48e241ab8d5f023c0bedde6242bf4dc97da4ebe..1b6f07ac8eed80221ad673c1eea6f2a1bacd8415 100644 --- a/vendor/symfony/validator/Mapping/ClassMetadataInterface.php +++ b/vendor/symfony/validator/Mapping/ClassMetadataInterface.php @@ -86,8 +86,8 @@ public function hasPropertyMetadata($property); /** * Returns all metadata instances for the given named property. * - * If your implementation does not support properties, simply throw an - * exception in this method (for example a <tt>BadMethodCallException</tt>). + * If your implementation does not support properties, throw an exception + * in this method (for example a <tt>BadMethodCallException</tt>). * * @param string $property The property name * diff --git a/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php b/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php index 9d5da256f5dd52ed1de04832eaaa6ae08669d02a..cf0d08acce7f0699ac51f91e24fb6458dec2558f 100644 --- a/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php +++ b/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php @@ -46,7 +46,7 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface * * @var ClassMetadata[] */ - protected $loadedClasses = array(); + protected $loadedClasses = []; /** * Creates a new metadata factory. diff --git a/vendor/symfony/validator/Mapping/GenericMetadata.php b/vendor/symfony/validator/Mapping/GenericMetadata.php index 21f9da133418966a427273da1e481e44732ccc8c..139d252fc06bf7859bdfc797fe7503e218b595f4 100644 --- a/vendor/symfony/validator/Mapping/GenericMetadata.php +++ b/vendor/symfony/validator/Mapping/GenericMetadata.php @@ -32,7 +32,7 @@ class GenericMetadata implements MetadataInterface * class' serialized representation. Do not access it. Use * {@link getConstraints()} and {@link findConstraints()} instead. */ - public $constraints = array(); + public $constraints = []; /** * @var array @@ -41,7 +41,7 @@ class GenericMetadata implements MetadataInterface * class' serialized representation. Do not access it. Use * {@link findConstraints()} instead. */ - public $constraintsByGroup = array(); + public $constraintsByGroup = []; /** * The strategy for cascading objects. @@ -80,12 +80,12 @@ class GenericMetadata implements MetadataInterface */ public function __sleep() { - return array( + return [ 'constraints', 'constraintsByGroup', 'cascadingStrategy', 'traversalStrategy', - ); + ]; } /** @@ -95,8 +95,8 @@ public function __clone() { $constraints = $this->constraints; - $this->constraints = array(); - $this->constraintsByGroup = array(); + $this->constraints = []; + $this->constraintsByGroup = []; foreach ($constraints as $constraint) { $this->addConstraint(clone $constraint); @@ -122,11 +122,7 @@ public function __clone() public function addConstraint(Constraint $constraint) { if ($constraint instanceof Traverse) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" can only be put on classes. Please use '. - '"Symfony\Component\Validator\Constraints\Valid" instead.', - \get_class($constraint) - )); + throw new ConstraintDefinitionException(sprintf('The constraint "%s" can only be put on classes. Please use "Symfony\Component\Validator\Constraints\Valid" instead.', \get_class($constraint))); } if ($constraint instanceof Valid && null === $constraint->groups) { @@ -193,7 +189,7 @@ public function findConstraints($group) { return isset($this->constraintsByGroup[$group]) ? $this->constraintsByGroup[$group] - : array(); + : []; } /** diff --git a/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php b/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php index 9d92de348ae5cd9b1b10c3b3e5984d1781189d29..ae2e1e04cde2ac26328a442638b9e5641143961e 100644 --- a/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php +++ b/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php @@ -32,7 +32,7 @@ abstract class AbstractLoader implements LoaderInterface */ const DEFAULT_NAMESPACE = '\\Symfony\\Component\\Validator\\Constraints\\'; - protected $namespaces = array(); + protected $namespaces = []; /** * Adds a namespace alias. diff --git a/vendor/symfony/validator/Mapping/Loader/FilesLoader.php b/vendor/symfony/validator/Mapping/Loader/FilesLoader.php index 571c7e7abb24f27ac8124941a148b24c8f4ce500..0882c3932f01bf04ac90937e842e47dd0f6824b7 100644 --- a/vendor/symfony/validator/Mapping/Loader/FilesLoader.php +++ b/vendor/symfony/validator/Mapping/Loader/FilesLoader.php @@ -41,7 +41,7 @@ public function __construct(array $paths) */ protected function getFileLoaders($paths) { - $loaders = array(); + $loaders = []; foreach ($paths as $path) { $loaders[] = $this->getFileLoaderInstance($path); diff --git a/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php b/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php index 398d81e93663387a09539660bf23729a162cbe64..cec3ea6c2d56ebde7abe526d1e9e52bb8b7f142b 100644 --- a/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php +++ b/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php @@ -72,7 +72,7 @@ public function getMappedClasses() */ protected function parseConstraints(\SimpleXMLElement $nodes) { - $constraints = array(); + $constraints = []; foreach ($nodes as $node) { if (\count($node) > 0) { @@ -83,7 +83,7 @@ protected function parseConstraints(\SimpleXMLElement $nodes) } elseif (\count($node->option) > 0) { $options = $this->parseOptions($node->option); } else { - $options = array(); + $options = []; } } elseif (\strlen((string) $node) > 0) { $options = XmlUtils::phpize(trim($node)); @@ -106,7 +106,7 @@ protected function parseConstraints(\SimpleXMLElement $nodes) */ protected function parseValues(\SimpleXMLElement $nodes) { - $values = array(); + $values = []; foreach ($nodes as $node) { if (\count($node) > 0) { @@ -115,7 +115,7 @@ protected function parseValues(\SimpleXMLElement $nodes) } elseif (\count($node->constraint) > 0) { $value = $this->parseConstraints($node->constraint); } else { - $value = array(); + $value = []; } } else { $value = trim($node); @@ -140,7 +140,7 @@ protected function parseValues(\SimpleXMLElement $nodes) */ protected function parseOptions(\SimpleXMLElement $nodes) { - $options = array(); + $options = []; foreach ($nodes as $node) { if (\count($node) > 0) { @@ -149,7 +149,7 @@ protected function parseOptions(\SimpleXMLElement $nodes) } elseif (\count($node->constraint) > 0) { $value = $this->parseConstraints($node->constraint); } else { - $value = array(); + $value = []; } } else { $value = XmlUtils::phpize($node); @@ -190,7 +190,7 @@ private function loadClassesFromXml() // state before it completes $xml = $this->parseFile($this->file); - $this->classes = array(); + $this->classes = []; foreach ($xml->namespace as $namespace) { $this->addNamespaceAlias((string) $namespace['prefix'], trim((string) $namespace)); diff --git a/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php b/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php index c1395bb2fccaa6637e589a5c7627706d413ead49..0f6166674d01c99a52922a336a0d522ee365c2bc 100644 --- a/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php +++ b/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php @@ -80,7 +80,7 @@ public function getMappedClasses() */ protected function parseNodes(array $nodes) { - $values = array(); + $values = []; foreach ($nodes as $name => $childNodes) { if (is_numeric($name) && \is_array($childNodes) && 1 === \count($childNodes)) { @@ -131,7 +131,7 @@ private function parseFile($path) // empty file if (null === $classes) { - return array(); + return []; } // not an array diff --git a/vendor/symfony/validator/Mapping/MemberMetadata.php b/vendor/symfony/validator/Mapping/MemberMetadata.php index 16044e8e5ce861996376282b50a8003aa3785a5c..11bd54d33c951944fb9915574729e2359f3018ca 100644 --- a/vendor/symfony/validator/Mapping/MemberMetadata.php +++ b/vendor/symfony/validator/Mapping/MemberMetadata.php @@ -52,7 +52,7 @@ abstract class MemberMetadata extends GenericMetadata implements PropertyMetadat /** * @var \ReflectionMethod[]|\ReflectionProperty[] */ - private $reflMember = array(); + private $reflMember = []; /** * @param string $class The name of the class this member is defined on @@ -72,10 +72,7 @@ public function __construct($class, $name, $property) public function addConstraint(Constraint $constraint) { if (!\in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint %s cannot be put on properties or getters', - \get_class($constraint) - )); + throw new ConstraintDefinitionException(sprintf('The constraint %s cannot be put on properties or getters', \get_class($constraint))); } parent::addConstraint($constraint); @@ -88,11 +85,11 @@ public function addConstraint(Constraint $constraint) */ public function __sleep() { - return array_merge(parent::__sleep(), array( + return array_merge(parent::__sleep(), [ 'class', 'name', 'property', - )); + ]); } /** diff --git a/vendor/symfony/validator/Resources/translations/validators.af.xlf b/vendor/symfony/validator/Resources/translations/validators.af.xlf index 177bb0038f5236ed6fa4756f10e46fd6624184d3..731e64aa7f2a41d5eca4a1ed6a88e79b1a755fbe 100644 --- a/vendor/symfony/validator/Resources/translations/validators.af.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.af.xlf @@ -222,6 +222,118 @@ <source>Unsupported card type or invalid card number.</source> <target>Nie-ondersteunde tipe kaart of ongeldige kredietkaart nommer.</target> </trans-unit> + <trans-unit id="59"> + <source>This is not a valid International Bank Account Number (IBAN).</source> + <target>Hierdie is nie 'n geldige Internationale Bank Rekening Nommer (IBAN) nie.</target> + </trans-unit> + <trans-unit id="60"> + <source>This value is not a valid ISBN-10.</source> + <target>Hierdie waarde is nie 'n geldige ISBN-10 nie.</target> + </trans-unit> + <trans-unit id="61"> + <source>This value is not a valid ISBN-13.</source> + <target>Hierdie waarde is nie 'n geldige ISBN-13 nie.</target> + </trans-unit> + <trans-unit id="62"> + <source>This value is neither a valid ISBN-10 nor a valid ISBN-13.</source> + <target>Hierdie waarde is nie 'n geldige ISBN-10 of ISBN-13 nie.</target> + </trans-unit> + <trans-unit id="63"> + <source>This value is not a valid ISSN.</source> + <target>Hierdie waarde is nie 'n geldige ISSN nie.</target> + </trans-unit> + <trans-unit id="64"> + <source>This value is not a valid currency.</source> + <target>Hierdie waarde is nie 'n geldige geldeenheid nie.</target> + </trans-unit> + <trans-unit id="65"> + <source>This value should be equal to {{ compared_value }}.</source> + <target>Hierdie waarde moet gelyk aan {{ compared_value }} wees.</target> + </trans-unit> + <trans-unit id="66"> + <source>This value should be greater than {{ compared_value }}.</source> + <target>Hierdie waarde moet meer as {{ compared_value }} wees.</target> + </trans-unit> + <trans-unit id="67"> + <source>This value should be greater than or equal to {{ compared_value }}.</source> + <target>Hierdie waarde moet meer of gelyk aan {{ compared_value }} wees.</target> + </trans-unit> + <trans-unit id="68"> + <source>This value should be identical to {{ compared_value_type }} {{ compared_value }}.</source> + <target>Hierdie waarde moet identies aan {{ compared_value_type }} {{ compared_value }} wees.</target> + </trans-unit> + <trans-unit id="69"> + <source>This value should be less than {{ compared_value }}.</source> + <target>Hierdie waarde moet minder as {{ compared_value }} wees.</target> + </trans-unit> + <trans-unit id="70"> + <source>This value should be less than or equal to {{ compared_value }}.</source> + <target>Hierdie waarde moet minder of gelyk aan {{ compared_value }} wees.</target> + </trans-unit> + <trans-unit id="71"> + <source>This value should not be equal to {{ compared_value }}.</source> + <target>Hierdie waarde moet nie dieselfde as {{ compared_value }} wees nie.</target> + </trans-unit> + <trans-unit id="72"> + <source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source> + <target>Hierdie waarde moet nie identies as {{ compared_value_type }} {{ compared_value }} wees nie.</target> + </trans-unit> + <trans-unit id="73"> + <source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source> + <target>Die beeld aspek is te groot ({{ ratio }}). Die maksimum toegelate aspek is {{ max_ratio }}.</target> + </trans-unit> + <trans-unit id="74"> + <source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source> + <target>Die beeld aspek is te klein ({{ ratio }}). Die minimum toegelate aspek is {{ min_ratio }}.</target> + </trans-unit> + <trans-unit id="75"> + <source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source> + <target>Die beeld is vierkantig ({{ width }}x{{ height }}px). Vierkantige beelde word nie toegelaat nie.</target> + </trans-unit> + <trans-unit id="76"> + <source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source> + <target>Die beeld is landskap georiënteerd ({{ width }}x{{ height }}px). Landskap georiënteerde beelde word nie toegelaat nie.</target> + </trans-unit> + <trans-unit id="77"> + <source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source> + <target>Die beeld dis portret georiënteerd ({{ width }}x{{ height }}px). Portret georiënteerde beelde word nie toegelaat nie.</target> + </trans-unit> + <trans-unit id="78"> + <source>An empty file is not allowed.</source> + <target>'n Leë lêer word nie toegelaat nie.</target> + </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>Die gasheer kon nie opgelos word nie.</target> + </trans-unit> + <trans-unit id="80"> + <source>This value does not match the expected {{ charset }} charset.</source> + <target>Die waarde stem nie ooreen met die verwagte {{ charset }} karakterstel nie.</target> + </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>Hierdie is nie 'n geldige Besigheids Identifikasie Kode (BIC) nie.</target> + </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>Fout</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Hierdie is nie 'n geldige UUID nie.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Hierdie waarde moet 'n veelvoud van {{ compared_value }} wees.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Hierdie Besigheids Identifikasie Kode (BIK) is nie geassosieer met IBAN {{ iban }} nie.</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Hierdie waarde moet geldige JSON wees.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.ar.xlf b/vendor/symfony/validator/Resources/translations/validators.ar.xlf index 4950e0ccd1183b3b715a167812dee1d86fcb1f03..eacd8d777ddec14ee08ed04e44402a9fb22c736e 100644 --- a/vendor/symfony/validator/Resources/translations/validators.ar.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.ar.xlf @@ -310,6 +310,26 @@ <source>This value does not match the expected {{ charset }} charset.</source> <target>هذه القيمة غير متطابقة مع صيغة التحويل {{ charset }}.</target> </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>هذه القيمة ليست رمز معرّف نشاط تجاري صالح (BIC).</target> + </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>خطأ</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>هذا ليس UUID صالح.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>هذه القيمة يجب أن تكون مضاعف ل {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>رمز المعرّف نشاط تجاري (BIC) هذا لا يرتبط مع IBAN {{ iban }}.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.bg.xlf b/vendor/symfony/validator/Resources/translations/validators.bg.xlf index dc6f95ff130faeed9bcf4034c2d0c1a69cdba91d..bd09da5d0ef0a4bb7f2e786ceda405f00f19f751 100644 --- a/vendor/symfony/validator/Resources/translations/validators.bg.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.bg.xlf @@ -318,6 +318,22 @@ <source>Error</source> <target>Грешка</target> </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Това не е валиден UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Тази стойност трябва да бъде кратно число на {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Този бизнес идентификационен код (BIC) не е свързана с IBAN {{ iban }}.</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Тази стойност трябва да е валидна JSON.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.ca.xlf b/vendor/symfony/validator/Resources/translations/validators.ca.xlf index 078a25d052d1086d6d253b0a829aa2e005e0e532..d6ae6e91bce2af8ecf9f7359a3cbfdc8ded55b64 100644 --- a/vendor/symfony/validator/Resources/translations/validators.ca.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.ca.xlf @@ -301,11 +301,35 @@ <trans-unit id="78"> <source>An empty file is not allowed.</source> <target>No està permès un fixter buit.</target> + </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>No s'ha pogut resoldre l'amfitrió.</target> + </trans-unit> + <trans-unit id="80"> + <source>This value does not match the expected {{ charset }} charset.</source> + <target>Aquest valor no coincideix amb l'esperat {{ charset }} joc de caràcters.</target> + </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>Aquest no és un codi d'identificació bancari (BIC) vàlid.</target> + </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>Error</target> </trans-unit> <trans-unit id="83"> <source>This is not a valid UUID.</source> <target>Aquest valor no és un UUID vàlid.</target> </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Aquest valor ha de ser múltiple de {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Aquest Codi d'identificació bancari (BIC) no està associat amb l'IBAN {{ iban }}.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.cy.xlf b/vendor/symfony/validator/Resources/translations/validators.cy.xlf index da7cb9aab2986d8133ef0a76cf47095ddb8c1563..752b6c2ae5143d63a313da076bd926bf2b5e250f 100644 --- a/vendor/symfony/validator/Resources/translations/validators.cy.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.cy.xlf @@ -222,6 +222,114 @@ <source>Unsupported card type or invalid card number.</source> <target>Unai ni dderbynir y math yna o gerdyn, neu nid yw rhif y cerdyn yn ddilys.</target> </trans-unit> + <trans-unit id="59"> + <source>This is not a valid International Bank Account Number (IBAN).</source> + <target>Nid yw hwn yn Rhif Cyfrif Banc Rhyngwladol (IBAN) dilys.</target> + </trans-unit> + <trans-unit id="60"> + <source>This value is not a valid ISBN-10.</source> + <target>Nid yw'r gwerth hwn yn ISBN-10 dilys.</target> + </trans-unit> + <trans-unit id="61"> + <source>This value is not a valid ISBN-13.</source> + <target>Nid yw'r gwerth hwn yn ISBN-13 dilys.</target> + </trans-unit> + <trans-unit id="62"> + <source>This value is neither a valid ISBN-10 nor a valid ISBN-13.</source> + <target>Nid yw'r gwerth hwn yn Rhif ISBN-10 dilys nac yn ISBN-13 dilys.</target> + </trans-unit> + <trans-unit id="63"> + <source>This value is not a valid ISSN.</source> + <target>Nid yw'r gwerth hwn yn ISSN dilys.</target> + </trans-unit> + <trans-unit id="64"> + <source>This value is not a valid currency.</source> + <target>Nid yw'r gwerth hwn yn arian dilys.</target> + </trans-unit> + <trans-unit id="65"> + <source>This value should be equal to {{ compared_value }}.</source> + <target>Dylai'r gwerth hwn fod yn gyfartal â {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="66"> + <source>This value should be greater than {{ compared_value }}.</source> + <target>Dylai'r gwerth hwn fod yn fwy na {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="67"> + <source>This value should be greater than or equal to {{ compared_value }}.</source> + <target>Dylai'r gwerth hwn fod yn fwy na neu'n hafal i {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="68"> + <source>This value should be identical to {{ compared_value_type }} {{ compared_value }}.</source> + <target>Dylai'r gwerth hwn fod yn union yr un fath â {{ compared_value_type }} {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="69"> + <source>This value should be less than {{ compared_value }}.</source> + <target>Dylai'r gwerth hwn fod yn llai na {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="70"> + <source>This value should be less than or equal to {{ compared_value }}.</source> + <target>Dylai'r gwerth hwn fod yn llai na neu'n hafal i {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="71"> + <source>This value should not be equal to {{ compared_value }}.</source> + <target>Ni ddylai'r gwerth hwn fod yn hafal i {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="72"> + <source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source> + <target>Ni ddylai'r gwerth hwn fod yn union yr un fath â {{ 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> + <target>Mae'r gymhareb delwedd yn rhy fawr ({{ ratio }}). Y gymhareb uchaf a ganiateir yw {{ max_ratio }}.</target> + </trans-unit> + <trans-unit id="74"> + <source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source> + <target>Mae'r gymhareb delwedd yn rhy fach ({{ ratio }}). Y gymhareb isaf a ddisgwylir yw {{ min_ratio }}.</target> + </trans-unit> + <trans-unit id="75"> + <source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source> + <target>Mae'r ddelwedd yn sgwâr ({{ width }}x{{ height }}px). Ni chaniateir delweddau sgwâr.</target> + </trans-unit> + <trans-unit id="76"> + <source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source> + <target>Mae'r ddelwedd mewn fformat tirlun ({{ width }}x{{ height }}px). Ni chaniateir delweddau mewn fformat tirlun.</target> + </trans-unit> + <trans-unit id="77"> + <source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source> + <target>Mae'r ddelwedd mewn fformat portread ({{ width }}x{{ height }}px). Ni chaniateir delweddau mewn fformat portread.</target> + </trans-unit> + <trans-unit id="78"> + <source>An empty file is not allowed.</source> + <target>Ni chaniateir ffeil wag.</target> + </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>Ni fu modd datrys y gwesteiwr.</target> + </trans-unit> + <trans-unit id="80"> + <source>This value does not match the expected {{ charset }} charset.</source> + <target>Nid yw'r gwerth hwn yn cyfateb â'r {{ charset }} set nodau ddisgwyliedig.</target> + </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>Nid yw hwn yn God Adnabod Busnes (BIC) dilys.</target> + </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>Gwall</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Nid yw hyn yn UUID dilys.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Dylai'r gwerth hwn fod yn luosrif o {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Nid yw'r Cod Adnabod Busnes (BIC) hwn yn gysylltiedig ag IBAN {{ iban }}.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.de.xlf b/vendor/symfony/validator/Resources/translations/validators.de.xlf index 3e44e1e284b8c9ac71dfbf5e3862d60668575c34..aab53e727b9e45ed903910b28668aef80ab9891f 100644 --- a/vendor/symfony/validator/Resources/translations/validators.de.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.de.xlf @@ -322,6 +322,14 @@ <source>This is not a valid UUID.</source> <target>Dies ist keine gültige UUID.</target> </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Dieser Wert sollte ein Vielfaches von {{ compared_value }} sein.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Diese internationale Bankleitzahl (BIC) ist nicht mit der IBAN {{ iban }} assoziiert.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.el.xlf b/vendor/symfony/validator/Resources/translations/validators.el.xlf index a3199bcc9d79e51c139aefdd156703b35cfc571c..3b9bbef66e5a4c7a9096c4048fb86b87786c05ee 100644 --- a/vendor/symfony/validator/Resources/translations/validators.el.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.el.xlf @@ -278,6 +278,58 @@ <source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source> <target>Αυτή η τιμή δεν πρέπει να είναι πανομοιότυπη με {{ 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> + <target>Η αναλογία πλάτους-ύψους της εικόνας είναι πολύ μεγάλη ({{ ratio }}). Μέγιστη επιτρεπτή αναλογία {{ max_ratio }}.</target> + </trans-unit> + <trans-unit id="74"> + <source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source> + <target>Η αναλογία πλάτους-ύψους της εικόνας είναι πολύ μικρή ({{ ratio }}). Ελάχιστη επιτρεπτή αναλογία {{ min_ratio }}.</target> + </trans-unit> + <trans-unit id="75"> + <source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source> + <target>Η εικόνα είναι τετράγωνη ({{ width }}x{{ height }}px). Δεν επιτρέπονται τετράγωνες εικόνες.</target> + </trans-unit> + <trans-unit id="76"> + <source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source> + <target>Η εικόνα έχει οριζόντιο προσανατολισμό ({{ width }}x{{ height }}px). Δεν επιτρέπονται εικόνες με οριζόντιο προσανατολισμό.</target> + </trans-unit> + <trans-unit id="77"> + <source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source> + <target>Η εικόνα έχει κάθετο προσανατολισμό ({{ width }}x{{ height }}px). Δεν επιτρέπονται εικόνες με κάθετο προσανατολισμό.</target> + </trans-unit> + <trans-unit id="78"> + <source>An empty file is not allowed.</source> + <target>Δεν επιτρέπεται κενό αρχείο.</target> + </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>Η διεύθυνση δεν μπόρεσε να επιλυθεί.</target> + </trans-unit> + <trans-unit id="80"> + <source>This value does not match the expected {{ charset }} charset.</source> + <target>Αυτή η τιμή δεν ταιριάζει στο αναμενόμενο {{ charset }} σύνολο χαρακτήρων.</target> + </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>Αυτός δεν έιναι ένας έγκυρος κωδικός BIC.</target> + </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>Σφάλμα</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Αυτό δεν είναι ένα έγκυρο UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Αυτή η τιμή θα έπρεπε να είναι πολλαπλάσιο του {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Αυτός ο κωδικός BIC δεν σχετίζεται με το IBAN {{ iban }}.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.en.xlf b/vendor/symfony/validator/Resources/translations/validators.en.xlf index 3d173846a54f1fd7597aa272efde9cc72841b357..465ad220d87906fa9b233865dbd7b2bc930cc302 100644 --- a/vendor/symfony/validator/Resources/translations/validators.en.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.en.xlf @@ -322,6 +322,18 @@ <source>This is not a valid UUID.</source> <target>This is not a valid UUID.</target> </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>This value should be a multiple of {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>This value should be valid JSON.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.es.xlf b/vendor/symfony/validator/Resources/translations/validators.es.xlf index 25d5b8a5d33a735d630779084af2920b176c041b..69ab34e8b29ce5201d70897187c7d4fe3722eeb0 100644 --- a/vendor/symfony/validator/Resources/translations/validators.es.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.es.xlf @@ -322,6 +322,14 @@ <source>This is not a valid UUID.</source> <target>Este valor no es un UUID válido.</target> </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Este valor debería ser múltiplo de {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <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> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.eu.xlf b/vendor/symfony/validator/Resources/translations/validators.eu.xlf index d311dedb5e62e60d88b5aab7848740d05b5a447c..ee9529e3e3ba417825843eedfbfe8f91d5021f70 100644 --- a/vendor/symfony/validator/Resources/translations/validators.eu.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.eu.xlf @@ -278,6 +278,42 @@ <source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source> <target>Balio hau ez litzateke {{ compared_value_type }} {{ compared_value }}-(r)en berbera izan behar.</target> </trans-unit> + <trans-unit id="73"> + <source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source> + <target>Irudiaren proportzioa oso handia da ({{ ratio }}). Onartutako proportzio handienda {{ max_ratio }} da.</target> + </trans-unit> + <trans-unit id="74"> + <source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source> + <target>Irudiaren proportzioa oso txikia da ({{ ratio }}). Onartutako proportzio txikiena {{ min_ratio }} da.</target> + </trans-unit> + <trans-unit id="75"> + <source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source> + <target>Irudia karratua da ({{ width }}x{{ height }}px). Karratuak diren irudiak ez dira onartzen.</target> + </trans-unit> + <trans-unit id="76"> + <source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source> + <target>Irudia horizontalki bideratua dago ({{ width }}x{{ height }}px). Horizontalki bideratutako irudiak ez dira onartzen.</target> + </trans-unit> + <trans-unit id="77"> + <source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source> + <target>Irudia bertikalki bideratua dago ({{ width }}x{{ height }}px). Bertikalki bideratutako irudiak ez dira onartzen.</target> + </trans-unit> + <trans-unit id="78"> + <source>An empty file is not allowed.</source> + <target>Hutsik dagoen fitxategia ez da onartzen.</target> + </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>Host-a ezin da ebatzi.</target> + </trans-unit> + <trans-unit id="80"> + <source>This value does not match the expected {{ charset }} charset.</source> + <target>Balio honen karaktere kodea ez da esperotakoa {{ charset }}.</target> + </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>Ez da balizko Banku Identifikazioko Kodea (BIC).</target> + </trans-unit> <trans-unit id="82"> <source>Error</source> <target>Errore</target> @@ -286,6 +322,14 @@ <source>This is not a valid UUID.</source> <target>Balio hau ez da onartutako UUID bat.</target> </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Balio honek {{ compared_value }}-ren multiploa izan beharko luke.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Banku Identifikazioko Kode hau ez dago lotuta {{ IBAN }} IBAN-rekin.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.fa.xlf b/vendor/symfony/validator/Resources/translations/validators.fa.xlf index 98b4bd66f08e8f00137427cc03223d92fbf81ce8..ff1aa7c0b1ec0d0475ad3f817c0bac47020e2093 100644 --- a/vendor/symfony/validator/Resources/translations/validators.fa.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.fa.xlf @@ -278,6 +278,58 @@ <source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source> <target>این مقدار نباید {{ 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> + <target>ابعاد {{ ratio }} عکس بیش از حد بزرگ است.حداکثر ابعاد مجاز {{ max_ratio }} است.</target> + </trans-unit> + <trans-unit id="74"> + <source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source> + <target>ابعاد {{ ratio }} عکس بیش از حد کوچک است.حداقل ابعاد مجاز {{ min_ratio }} است.</target> + </trans-unit> + <trans-unit id="75"> + <source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source> + <target>این عکس مربع width }}x{{ height }}px}} می باشد.عکس مربع مجاز نمی باشد.</target> + </trans-unit> + <trans-unit id="76"> + <source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source> + <target>این عکس افقی width }}x{{ height }}px}} می باشد.عکس افقی مجاز نمی باشد.</target> + </trans-unit> + <trans-unit id="77"> + <source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source> + <target>این عکس عمودی width }}x{{ height }}px}} می باشد.عکس عمودی مجاز نمی باشد.</target> + </trans-unit> + <trans-unit id="78"> + <source>An empty file is not allowed.</source> + <target>فایل خالی مجاز نمی باشد.</target> + </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>هاست قابل حل نیست.</target> + </trans-unit> + <trans-unit id="80"> + <source>This value does not match the expected {{ charset }} charset.</source> + <target>این مقدار مورد نظر نمی باشد. مقدار مورد نظر {{ charset }} می باشد.</target> + </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>این مقدار یک BIC درست نیست.</target> + </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>خطا</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>این مقدار یک UUID درست نیست.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>این مقدار باید چند برابر {{ compared_value }} باشد.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>این BIC با IBAN ارتباط ندارد.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.fr.xlf b/vendor/symfony/validator/Resources/translations/validators.fr.xlf index 382acb975ce664a07b4919b356bf34f595ce2c3a..7b1799d53315ce94d73ec6a04e992f11ea75e4c0 100644 --- a/vendor/symfony/validator/Resources/translations/validators.fr.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.fr.xlf @@ -322,6 +322,18 @@ <source>This is not a valid UUID.</source> <target>Ceci n'est pas un UUID valide.</target> </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Cette valeur doit être un multiple de {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Ce code d'identification d'entreprise (BIC) n'est pas associé à l'IBAN {{ iban }}.</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Cette valeur doit être un JSON valide.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.gl.xlf b/vendor/symfony/validator/Resources/translations/validators.gl.xlf index ecb7155cac892cb05ef0363278b05b3f1657bfaf..71df1d240bde7cff65fc690d02cf623c90eb7e91 100644 --- a/vendor/symfony/validator/Resources/translations/validators.gl.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.gl.xlf @@ -314,6 +314,22 @@ <source>This is not a valid Business Identifier Code (BIC).</source> <target>Non é un Código de Identificación Bancaria (BIC) válido.</target> </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>Erro</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Isto non é un UUID válido.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Este valor debería ser multiplo de {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Este Código de identificación bancaria (BIC) non está asociado co IBAN {{ iban }}.</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 126ef90332e30242c2efc6408f7ab4df2054a61e..ab033a11c3b01808cc3f5a3348f5c082119bf9ee 100644 --- a/vendor/symfony/validator/Resources/translations/validators.hr.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.hr.xlf @@ -318,6 +318,22 @@ <source>Error</source> <target>Greška</target> </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Ovo nije validan UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Ova vrijednost treba biti višekratnik od {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Poslovni identifikacijski broj (BIC) nije povezan sa IBAN brojem {{ iban }}.</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Ova vrijednost treba biti validan JSON.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.hu.xlf b/vendor/symfony/validator/Resources/translations/validators.hu.xlf index 1011d5481829bc39ce43dc58a9b82c0f1ec8c268..30c3cc399d3ef761df8bff40dfd7ca2bf94dfcd3 100644 --- a/vendor/symfony/validator/Resources/translations/validators.hu.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.hu.xlf @@ -322,6 +322,14 @@ <source>This is not a valid UUID.</source> <target>Érvénytelen egyedi azonosító (UUID).</target> </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Ennek az értéknek oszthatónak kell lennie a következővel: {{ compared_value }}</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Ez a Bankazonosító kód (BIC) nem kapcsolódik az IBAN kódhoz ({{ iban }}).</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.id.xlf b/vendor/symfony/validator/Resources/translations/validators.id.xlf index 535bdac08238c03b03b09396bc306359682580b6..bf4b85deefc351f215a7fa8299a4c5941e65a021 100644 --- a/vendor/symfony/validator/Resources/translations/validators.id.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.id.xlf @@ -318,6 +318,18 @@ <source>Error</source> <target>Galat</target> </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Ini bukan UUID yang sah.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Nilai ini harus kelipatan dari {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Business Identifier Code (BIC) ini tidak terkait dengan IBAN {{ iban }}.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.it.xlf b/vendor/symfony/validator/Resources/translations/validators.it.xlf index f19544701d6378d28199d8a91df5c42d322a3644..235d44d1bbee91e2624e6b708b17af8c1819cf46 100644 --- a/vendor/symfony/validator/Resources/translations/validators.it.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.it.xlf @@ -322,6 +322,14 @@ <source>This is not a valid UUID.</source> <target>Questo non è un UUID valido.</target> </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Questo valore dovrebbe essere un multiplo di {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Questo codice identificativo bancario (BIC) non è associato all'IBAN {{ iban }}.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.ja.xlf b/vendor/symfony/validator/Resources/translations/validators.ja.xlf index a9d6b0812bf9dabfb3af78508381defd7bb2fdba..207d4ba7ae218c810ad62b542146f936d91fcc23 100644 --- a/vendor/symfony/validator/Resources/translations/validators.ja.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.ja.xlf @@ -318,6 +318,18 @@ <source>Error</source> <target>エラー</target> </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>有効なUUIDではありません。</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>{{ compared_value }}の倍数でなければなりません。</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>このSWIFTコードはIBANコード({{ iban }})に関連付けられていません。</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.lb.xlf b/vendor/symfony/validator/Resources/translations/validators.lb.xlf index 4a06dbd45b7b53cdddc3bcac953f836d25159b85..4c3579fb58478a5371d660a6780110045e80b709 100644 --- a/vendor/symfony/validator/Resources/translations/validators.lb.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.lb.xlf @@ -318,6 +318,22 @@ <source>Error</source> <target>Feeler</target> </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Dëst ass keng gëlteg UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Dëse Wäert sollt e puer vun {{ compared_value }} sinn.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Dëse "Business Identifier Code" (BIC) ass net mat IBAN verbonnen {{ iban }}.</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Dëse Wäert sollt gëlteg JSON.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.lt.xlf b/vendor/symfony/validator/Resources/translations/validators.lt.xlf index 60641b5e68dbd8f11179bce68ced445cf5d750af..02eece5965d14be05f436d3474d75295f3c55cac 100644 --- a/vendor/symfony/validator/Resources/translations/validators.lt.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.lt.xlf @@ -302,10 +302,38 @@ <source>An empty file is not allowed.</source> <target>Failas negali būti tuščias.</target> </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>Serveris nepasiekiamas.</target> + </trans-unit> + <trans-unit id="80"> + <source>This value does not match the expected {{ charset }} charset.</source> + <target>Ši reikšmė neatitinka {{ charset }} koduotės.</target> + </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>Bendrovės Identifikavimo Kodas (BIC) nėra tinkamas.</target> + </trans-unit> <trans-unit id="82"> <source>Error</source> <target>Klaida</target> </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Ši reikšmė nėra tinkamas UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Ši reikšmė turi būti skaičiaus {{ compared_value }} kartotinis.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Šis bendrovės identifikavimo kodas (BIC) nesusijęs su IBAN {{ iban }}.</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Ši reikšmė turi būti tinkamo JSON formato.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.lv.xlf b/vendor/symfony/validator/Resources/translations/validators.lv.xlf index 2ad19cd283c1885dad1e6afe0f2c47ed0f3a18ae..4c0e192521d27a25f6769f1d0485abdac1036e16 100644 --- a/vendor/symfony/validator/Resources/translations/validators.lv.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.lv.xlf @@ -310,6 +310,30 @@ <source>This value does not match the expected {{ charset }} charset.</source> <target>Šī vērtība neatbilst sagaidāmajai rakstzīmju kopai {{ charset }}.</target> </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>Šī vērtība nav derīgs Biznesa Identifikācijas Kods (BIC).</target> + </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>Kļūda</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Šis nav derīgs UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Šai vērtībai jābūt vairākas reizes atkārtotai {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Šis Biznesa Identifikācijas Kods (BIC) neatbilst {{ iban }} konta numuram (IBAN).</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Šai vērtībai jābūt derīgam JSON.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.nb.xlf b/vendor/symfony/validator/Resources/translations/validators.nb.xlf index 250576531cfe4b7c8855649f7c5784edafdd8ffa..db534528d1d99bd3ac29dbca69fbcb49d96c916b 100644 --- a/vendor/symfony/validator/Resources/translations/validators.nb.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.nb.xlf @@ -314,6 +314,26 @@ <source>This is not a valid Business Identifier Code (BIC).</source> <target>Dette er ikke en gyldig BIC.</target> </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>Feil</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Dette er ikke en gyldig UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Verdien skal være flertall av {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Business Identifier Code (BIC) er ikke tilknyttet en IBAN {{ iban }}.</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Verdien er ikke gyldig JSON.</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 413a97eb17c6fd1b8a011db3dd583e1ece36c3a9..52815e8e721f3992172ca220f52b7d7d940055aa 100644 --- a/vendor/symfony/validator/Resources/translations/validators.nl.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.nl.xlf @@ -302,6 +302,10 @@ <source>An empty file is not allowed.</source> <target>Lege bestanden zijn niet toegestaan.</target> </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>De hostnaam kon niet worden bepaald.</target> + </trans-unit> <trans-unit id="80"> <source>This value does not match the expected {{ charset }} charset.</source> <target>Deze waarde is niet in de verwachte tekencodering {{ charset }}.</target> @@ -316,7 +320,15 @@ </trans-unit> <trans-unit id="83"> <source>This is not a valid UUID.</source> - <target>Deze waarde is geen geldige UUID waarde.</target> + <target>Dit is geen geldige UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Deze waarde zou een meervoud van {{ compared_value }} moeten zijn.</target> + </trans-unit> + <trans-unit id="85"> + <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> </body> </file> diff --git a/vendor/symfony/validator/Resources/translations/validators.no.xlf b/vendor/symfony/validator/Resources/translations/validators.no.xlf index 250576531cfe4b7c8855649f7c5784edafdd8ffa..db534528d1d99bd3ac29dbca69fbcb49d96c916b 100644 --- a/vendor/symfony/validator/Resources/translations/validators.no.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.no.xlf @@ -314,6 +314,26 @@ <source>This is not a valid Business Identifier Code (BIC).</source> <target>Dette er ikke en gyldig BIC.</target> </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>Feil</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Dette er ikke en gyldig UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Verdien skal være flertall av {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Business Identifier Code (BIC) er ikke tilknyttet en IBAN {{ iban }}.</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Verdien er ikke gyldig JSON.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.pl.xlf b/vendor/symfony/validator/Resources/translations/validators.pl.xlf index f33274e6e6ce90f92ab27c14c9954cbbbf86ebaa..888e73b1570077196c51b27f5487007af66f7c48 100644 --- a/vendor/symfony/validator/Resources/translations/validators.pl.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.pl.xlf @@ -318,6 +318,18 @@ <source>Error</source> <target>Błąd</target> </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>To nie jest poprawne UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Ta wartość powinna być wielokrotnością {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Ten kod BIC (Business Identifier Code) nie jest powiązany z międzynarodowym numerem rachunku bankowego (IBAN) {{ iban }}.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.pt.xlf b/vendor/symfony/validator/Resources/translations/validators.pt.xlf index 0561c048f512caddd2d2e111cc6087612a2f0438..e5cf660686358a46d61e06c6d535865665870696 100644 --- a/vendor/symfony/validator/Resources/translations/validators.pt.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.pt.xlf @@ -302,10 +302,34 @@ <source>An empty file is not allowed.</source> <target>Ficheiro vazio não é permitido.</target> </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>O host não pode ser resolvido.</target> + </trans-unit> + <trans-unit id="80"> + <source>This value does not match the expected {{ charset }} charset.</source> + <target>O valor não corresponde ao conjunto de caracteres {{ charset }} esperado.</target> + </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>O Código de Identificação de Empresa (BIC) não é válido.</target> + </trans-unit> <trans-unit id="82"> <source>Error</source> <target>Erro</target> </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Este valor não é um UUID válido.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Este valor deve ser um múltiplo de {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>O Código de Identificação de Empresa (BIC) não está associado ao IBAN {{ iban }}.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.pt_BR.xlf b/vendor/symfony/validator/Resources/translations/validators.pt_BR.xlf index b61706231887f27c0641a963f257aa7a30eedf19..8616edf4b90963a84d4e03cc9ea6213af5f8020b 100644 --- a/vendor/symfony/validator/Resources/translations/validators.pt_BR.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.pt_BR.xlf @@ -314,6 +314,26 @@ <source>This is not a valid Business Identifier Code (BIC).</source> <target>Este não é um Código Identificador Bancário (BIC) válido.</target> </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>Erro</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Este não é um UUID válido.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Este valor deve ser múltiplo de {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Este Código Identificador Bancário (BIC) não está associado ao IBAN {{ iban }}.</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Este valor deve ser um JSON válido.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.ru.xlf b/vendor/symfony/validator/Resources/translations/validators.ru.xlf index 11bfead5e505c54cfc80b3a0bc3e4e88e75c0d46..b77e04e8471c8f3f01bbc261e1839cd10e42cd91 100644 --- a/vendor/symfony/validator/Resources/translations/validators.ru.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.ru.xlf @@ -310,10 +310,26 @@ <source>This value does not match the expected {{ charset }} charset.</source> <target>Значение не совпадает с ожидаемой {{ charset }} кодировкой.</target> </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>Значение не соответствует формату BIC.</target> + </trans-unit> <trans-unit id="82"> <source>Error</source> <target>Ошибка</target> </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Значение не соответствует формату UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Значение должно быть кратно {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Данный BIC не связан с IBAN {{ iban }}.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.sq.xlf b/vendor/symfony/validator/Resources/translations/validators.sq.xlf index ffc8ccf2f9831daadd85ac8f5b954e7872fd9d22..569ebca47f02e0dd43e86af4f4341b1a4a324fa6 100644 --- a/vendor/symfony/validator/Resources/translations/validators.sq.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.sq.xlf @@ -24,15 +24,15 @@ </trans-unit> <trans-unit id="6"> <source>You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.</source> - <target>Duhet të zgjedhni së paku {{ limit }} alternativa.|Duhet të zgjedhni së paku {{ limit }} alternativa.</target> + <target>Duhet të zgjedhni së paku {{ limit }} alternativë.|Duhet të zgjedhni së paku {{ limit }} alternativa.</target> </trans-unit> <trans-unit id="7"> <source>You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.</source> - <target>Duhet të zgjedhni më së shumti {{ limit }} alternativa.|Duhet të zgjedhni më së shumti {{ limit }} alternativa.</target> + <target>Duhet të zgjedhni më së shumti {{ limit }} alternativë.|Duhet të zgjedhni më së shumti {{ limit }} alternativa.</target> </trans-unit> <trans-unit id="8"> <source>One or more of the given values is invalid.</source> - <target>Një apo më shumë nga vlerat e dhëna nuk janë të sakta.</target> + <target>Një apo më shumë nga vlerat e dhëna janë të pavlefshme.</target> </trans-unit> <trans-unit id="9"> <source>This field was not expected.</source> @@ -40,7 +40,7 @@ </trans-unit> <trans-unit id="10"> <source>This field is missing.</source> - <target>Kjo fushë është zhdukur.</target> + <target>Kjo fushë mungon.</target> </trans-unit> <trans-unit id="11"> <source>This value is not a valid date.</source> @@ -52,7 +52,7 @@ </trans-unit> <trans-unit id="13"> <source>This value is not a valid email address.</source> - <target>Kjo vlerë nuk është e-mail adresë e vlefshme.</target> + <target>Kjo vlerë nuk është adresë email-i e vlefshme.</target> </trans-unit> <trans-unit id="14"> <source>The file could not be found.</source> @@ -64,11 +64,11 @@ </trans-unit> <trans-unit id="16"> <source>The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.</source> - <target>File është shumë i madh ({{ size }} {{ suffix }}). Madhësia më e madhe e lejuar është {{ limit }} {{ suffix }}.</target> + <target>File është shumë i madh ({{ size }} {{ suffix }}). Madhësia maksimale e lejuar është {{ limit }} {{ suffix }}.</target> </trans-unit> <trans-unit id="17"> <source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.</source> - <target>Lloji mime i files nuk është i vlefshëm ({{ type }}). Llojet mime të lejuara janë {{ types }}.</target> + <target>Lloji mime i file-it është i pavlefshëm ({{ type }}). Llojet mime të lejuara janë {{ types }}.</target> </trans-unit> <trans-unit id="18"> <source>This value should be {{ limit }} or less.</source> @@ -76,7 +76,7 @@ </trans-unit> <trans-unit id="19"> <source>This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.</source> - <target>Kjo vlerë është shumë e gjatë. Duhet t'i ketë {{ limit }} ose më pak karaktere.|Kjo vlerë është shumë e gjatë. Duhet t'i ketë {{ limit }} ose më pak karaktere.</target> + <target>Kjo vlerë është shumë e gjatë. Duhet të përmbaj {{ limit }} karakter ose më pak.|Kjo vlerë është shumë e gjatë. Duhet të përmbaj {{ limit }} karaktere ose më pak.</target> </trans-unit> <trans-unit id="20"> <source>This value should be {{ limit }} or more.</source> @@ -84,7 +84,7 @@ </trans-unit> <trans-unit id="21"> <source>This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.</source> - <target>Kjo vlerë është shumë e shkurtër. Duhet t'i ketë {{ limit }} ose më shumë karaktere.|Kjo vlerë është shumë e shkurtër. Duhet t'i ketë {{ limit }} ose më shumë karaktere.</target> + <target>Kjo vlerë është shumë e shkurtër. Duhet të përmbaj {{ limit }} karakter ose më shumë.|Kjo vlerë është shumë e shkurtër. Duhet të përmbaj {{ limit }} karaktere ose më shumë.</target> </trans-unit> <trans-unit id="22"> <source>This value should not be blank.</source> @@ -136,7 +136,7 @@ </trans-unit> <trans-unit id="37"> <source>This is not a valid IP address.</source> - <target>Kjo vlerë nuk është IP adresë e vlefshme.</target> + <target>Kjo adresë IP nuk është e vlefshme.</target> </trans-unit> <trans-unit id="38"> <source>This value is not a valid language.</source> @@ -144,7 +144,7 @@ </trans-unit> <trans-unit id="39"> <source>This value is not a valid locale.</source> - <target>Kjo vlerë nuk është përcaktim rajonal i vlefshëm.</target> + <target>Kjo vlerë nuk është nje locale i vlefshëm.</target> </trans-unit> <trans-unit id="40"> <source>This value is not a valid country.</source> @@ -156,7 +156,7 @@ </trans-unit> <trans-unit id="42"> <source>The size of the image could not be detected.</source> - <target>Madhësia e këtij imazhi nuk mund të zbulohet.</target> + <target>Madhësia e imazhit nuk mund të zbulohet.</target> </trans-unit> <trans-unit id="43"> <source>The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.</source> @@ -180,7 +180,7 @@ </trans-unit> <trans-unit id="48"> <source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source> - <target>Kjo vlerë duhet të ketë saktësisht {{ limit }} karaktere.|Kjo vlerë duhet të ketë saktësisht {{ limit }} karaktere.</target> + <target>Kjo vlerë duhet të ketë saktësisht {{ limit }} karakter.|Kjo vlerë duhet të ketë saktësisht {{ limit }} karaktere.</target> </trans-unit> <trans-unit id="49"> <source>The file was only partially uploaded.</source> @@ -200,27 +200,135 @@ </trans-unit> <trans-unit id="53"> <source>A PHP extension caused the upload to fail.</source> - <target>Një ekstenzion i PHP-së bëri të dështojë ngarkimi i files.</target> + <target>Një ekstension i PHP-së shkaktoi dështimin e ngarkimit.</target> </trans-unit> <trans-unit id="54"> <source>This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.</source> - <target>Ky kolekcion duhet të përmbajë {{ limit }} ose më shumë elemente.|Ky kolekcion duhet të përmbajë {{ limit }} ose më shumë elemente.</target> + <target>Ky koleksion duhet të përmbajë {{ limit }} element ose më shumë.|Ky koleksion duhet të përmbajë {{ limit }} elemente ose më shumë.</target> </trans-unit> <trans-unit id="55"> <source>This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.</source> - <target>Ky kolekcion duhet të përmbajë {{ limit }} ose më shumë elemente.|Ky kolekcion duhet të përmbajë {{ limit }} ose më shumë elemente.</target> + <target>Ky koleksion duhet të përmbajë {{ limit }} element ose më pak.|Ky koleksion duhet të përmbajë {{ limit }} elemente ose më pak.</target> </trans-unit> <trans-unit id="56"> <source>This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.</source> - <target>Ky kolekcion duhet të përmbajë saktësisht {{ limit }} elemente.|Ky kolekcion duhet të përmbajë saktësisht {{ limit }} elemente.</target> + <target>Ky koleksion duhet të përmbajë saktësisht {{ limit }} element.|Ky koleksion duhet të përmbajë saktësisht {{ limit }} elemente.</target> </trans-unit> <trans-unit id="57"> <source>Invalid card number.</source> - <target>Numër kartele i pavlefshëm.</target> + <target>Numër karte i pavlefshëm.</target> </trans-unit> <trans-unit id="58"> <source>Unsupported card type or invalid card number.</source> - <target>Lloj kartele i pambështetur ose numër kartele i pavlefshëm.</target> + <target>Lloj karte i papranuar ose numër karte i pavlefshëm.</target> + </trans-unit> + <trans-unit id="59"> + <source>This is not a valid International Bank Account Number (IBAN).</source> + <target>Ky nuk është një numër i vlefshëm ndërkombëtar i llogarisë bankare (IBAN).</target> + </trans-unit> + <trans-unit id="60"> + <source>This value is not a valid ISBN-10.</source> + <target>Kjo vlerë nuk është një ISBN-10 e vlefshme.</target> + </trans-unit> + <trans-unit id="61"> + <source>This value is not a valid ISBN-13.</source> + <target>Kjo vlerë nuk është një ISBN-13 e vlefshme.</target> + </trans-unit> + <trans-unit id="62"> + <source>This value is neither a valid ISBN-10 nor a valid ISBN-13.</source> + <target>Kjo vlerë nuk është as ISBN-10 e vlefshme as ISBN-13 e vlefshme.</target> + </trans-unit> + <trans-unit id="63"> + <source>This value is not a valid ISSN.</source> + <target>Kjo vlerë nuk është një ISSN e vlefshme.</target> + </trans-unit> + <trans-unit id="64"> + <source>This value is not a valid currency.</source> + <target>Kjo vlerë nuk është një monedhë e vlefshme.</target> + </trans-unit> + <trans-unit id="65"> + <source>This value should be equal to {{ compared_value }}.</source> + <target>Kjo vlerë duhet të jetë e barabartë me {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="66"> + <source>This value should be greater than {{ compared_value }}.</source> + <target>Kjo vlerë duhet të jetë më e madhe se {{ compared_value }}. </target> + </trans-unit> + <trans-unit id="67"> + <source>This value should be greater than or equal to {{ compared_value }}.</source> + <target>Kjo vlerë duhet të jetë më e madhe ose e barabartë me {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="68"> + <source>This value should be identical to {{ compared_value_type }} {{ compared_value }}.</source> + <target>Kjo vlerë duhet të jetë identike me {{ compared_value_type }} {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="69"> + <source>This value should be less than {{ compared_value }}.</source> + <target>Kjo vlerë duhet të jetë më vogël se {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="70"> + <source>This value should be less than or equal to {{ compared_value }}.</source> + <target>Kjo vlerë duhet të jetë më e vogël ose e barabartë me {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="71"> + <source>This value should not be equal to {{ compared_value }}.</source> + <target>Kjo vlerë nuk duhet të jetë e barabartë me {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="72"> + <source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source> + <target>Kjo vlerë nuk duhet të jetë identike me {{ 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> + <target>Raporti i imazhit është shumë i madh ({{ ratio }}). Raporti maksimal i lejuar është {{ max_ratio }}.</target> + </trans-unit> + <trans-unit id="74"> + <source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source> + <target>Raporti i imazhit është shumë i vogël ({{ ratio }}). Raporti minimal pritet të jetë {{ min_ratio }}.</target> + </trans-unit> + <trans-unit id="75"> + <source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source> + <target>Imazhi është katror ({{ width }}x{{ height }}px). Imazhet katrore nuk janë të lejuara.</target> + </trans-unit> + <trans-unit id="76"> + <source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source> + <target>Imazhi është i orientuar horizontalisht ({{ width }}x{{ height }}px). Imazhet e orientuara horizontalisht nuk lejohen.</target> + </trans-unit> + <trans-unit id="77"> + <source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source> + <target>Imazhi është i orientuar vertikalisht ({{ width }}x{{ height }}px). Imazhet orientuara vertikalisht nuk lejohen.</target> + </trans-unit> + <trans-unit id="78"> + <source>An empty file is not allowed.</source> + <target>Një file i zbrazët nuk lejohet.</target> + </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>Host-i nuk mund te zbulohej.</target> + </trans-unit> + <trans-unit id="80"> + <source>This value does not match the expected {{ charset }} charset.</source> + <target>Kjo vlerë nuk përputhet me kodifikimin e karaktereve {{ charset }} që pritej.</target> + </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>Ky nuk është një Kod Identifikues i Biznesit (BIC) i vleflshem.</target> + </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>Gabim</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Ky nuk është një UUID i vlefshëm.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Kjo vlerë duhet të jetë një shumëfish i {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Ky Kod Identifikues i Biznesit (BIC) nuk është i lidhur me IBAN {{ iban }}.</target> </trans-unit> </body> </file> diff --git a/vendor/symfony/validator/Resources/translations/validators.sr_Latn.xlf b/vendor/symfony/validator/Resources/translations/validators.sr_Latn.xlf index 60c093aebf7950d2ff23913f53b0526a15047855..9ac1ad6bce29423f1b7f24c17f92f84f70f11dcc 100644 --- a/vendor/symfony/validator/Resources/translations/validators.sr_Latn.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.sr_Latn.xlf @@ -4,39 +4,39 @@ <body> <trans-unit id="1"> <source>This value should be false.</source> - <target>Vrednost treba da bude netačna.</target> + <target>Vrednost bi trebalo da bude netačna.</target> </trans-unit> <trans-unit id="2"> <source>This value should be true.</source> - <target>Vrednost treba da bude tačna.</target> + <target>Vrednost bi trebalo da bude tačna.</target> </trans-unit> <trans-unit id="3"> <source>This value should be of type {{ type }}.</source> - <target>Vrednost treba da bude tipa {{ type }}.</target> + <target>Vrednost bi trebalo da bude tipa {{ type }}.</target> </trans-unit> <trans-unit id="4"> <source>This value should be blank.</source> - <target>Vrednost treba da bude prazna.</target> + <target>Vrednost bi trebalo da bude prazna.</target> </trans-unit> <trans-unit id="5"> <source>The value you selected is not a valid choice.</source> - <target>Vrednost treba da bude jedna od ponuđenih.</target> + <target>Odabrana vrednost nije validan izbor.</target> </trans-unit> <trans-unit id="6"> <source>You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.</source> - <target>Izaberite bar {{ limit }} mogućnost.|Izaberite bar {{ limit }} mogućnosti.|Izaberite bar {{ limit }} mogućnosti.</target> + <target>Morate odabrati bar {{ limit }} mogućnost.|Morate odabrati bar {{ limit }} mogućnosti.</target> </trans-unit> <trans-unit id="7"> <source>You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.</source> - <target>Izaberite najviše {{ limit }} mogućnost.|Izaberite najviše {{ limit }} mogućnosti.|Izaberite najviše {{ limit }} mogućnosti.</target> + <target>Morate odabrati najviše {{ limit }} mogućnost.|Morate odabrati najviše {{ limit }} mogućnosti.</target> </trans-unit> <trans-unit id="8"> <source>One or more of the given values is invalid.</source> - <target>Jedna ili više vrednosti je nevalidna.</target> + <target>Jedna ili više vrednosti nisu validne.</target> </trans-unit> <trans-unit id="9"> <source>This field was not expected.</source> - <target>Ovo polje ne očekuje.</target> + <target>Ovo polje nije bilo 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>Vrednost nije validan datum-vreme.</target> + <target>Vrednost nije validno vreme.</target> </trans-unit> <trans-unit id="13"> <source>This value is not a valid email address.</source> @@ -68,39 +68,39 @@ </trans-unit> <trans-unit id="17"> <source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.</source> - <target>Mime tip datoteke nije validan ({{ type }}). Dozvoljeni mime tipovi su {{ types }}.</target> + <target>MIME tip datoteke nije validan ({{ type }}). Dozvoljeni MIME tipovi su {{ types }}.</target> </trans-unit> <trans-unit id="18"> <source>This value should be {{ limit }} or less.</source> - <target>Vrednost treba da bude {{ limit }} ili manje.</target> + <target>Vrednost bi trebalo da bude {{ limit }} ili manje.</target> </trans-unit> <trans-unit id="19"> <source>This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.</source> - <target>Vrednost je predugačka. Treba da ima {{ limit }} karakter ili manje.|Vrednost je predugačka. Treba da ima {{ limit }} karaktera ili manje.|Vrednost je predugačka. Treba da ima {{ limit }} karaktera ili manje.</target> + <target>Vrednost je predugačka. Trebalo bi da ima {{ limit }} karakter ili manje.|Vrednost je predugačka. Trebalo bi da ima {{ limit }} karaktera ili manje.</target> </trans-unit> <trans-unit id="20"> <source>This value should be {{ limit }} or more.</source> - <target>Vrednost treba da bude {{ limit }} ili više.</target> + <target>Vrednost bi trebalo da bude {{ limit }} ili više.</target> </trans-unit> <trans-unit id="21"> <source>This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.</source> - <target>Vrednost je prekratka. Treba da ima {{ limit }} karakter ili više.|Vrednost je prekratka. Treba da ima {{ limit }} karaktera ili više.|Vrednost je prekratka. Treba da ima {{ limit }} karaktera ili više.</target> + <target>Vrednost je prekratka. Trebalo bi da ima {{ limit }} karakter ili više.|Vrednost je prekratka. Trebalo bi da ima {{ limit }} karaktera ili više.</target> </trans-unit> <trans-unit id="22"> <source>This value should not be blank.</source> - <target>Vrednost ne treba da bude prazna.</target> + <target>Vrednost ne bi trebalo da bude prazna.</target> </trans-unit> <trans-unit id="23"> <source>This value should not be null.</source> - <target>Vrednost ne treba da bude null.</target> + <target>Vrednost ne bi trebalo da bude prazna.</target> </trans-unit> <trans-unit id="24"> <source>This value should be null.</source> - <target>Vrednost treba da bude null.</target> + <target>Vrednost bi trebalo da bude prazna.</target> </trans-unit> <trans-unit id="25"> <source>This value is not valid.</source> - <target>Vrednost je nevalidna.</target> + <target>Vrednost nije validna.</target> </trans-unit> <trans-unit id="26"> <source>This value is not a valid time.</source> @@ -112,7 +112,7 @@ </trans-unit> <trans-unit id="31"> <source>The two values should be equal.</source> - <target>Obe vrednosti treba da budu jednake.</target> + <target>Obe vrednosti bi trebalo da budu jednake.</target> </trans-unit> <trans-unit id="32"> <source>The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.</source> @@ -128,7 +128,7 @@ </trans-unit> <trans-unit id="35"> <source>This value should be a valid number.</source> - <target>Vrednost treba da bude validan broj.</target> + <target>Vrednost bi trebalo da bude validan broj.</target> </trans-unit> <trans-unit id="36"> <source>This file is not a valid image.</source> @@ -144,11 +144,11 @@ </trans-unit> <trans-unit id="39"> <source>This value is not a valid locale.</source> - <target>Vrednost nije validan lokal.</target> + <target>Vrednost nije validna međunarodna oznaka jezika.</target> </trans-unit> <trans-unit id="40"> <source>This value is not a valid country.</source> - <target>Vrednost nije validna zemlja.</target> + <target>Vrednost nije validna država.</target> </trans-unit> <trans-unit id="41"> <source>This value is already used.</source> @@ -160,27 +160,27 @@ </trans-unit> <trans-unit id="43"> <source>The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.</source> - <target>Širina slike je prevelika ({{ width }}px). Najeća dozvoljena širina je {{ max_width }}px.</target> + <target>Širina slike je prevelika ({{ width }} piksela). Najveća dozvoljena širina je {{ max_width }} piksela.</target> </trans-unit> <trans-unit id="44"> <source>The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.</source> - <target>Širina slike je premala ({{ width }}px). Najmanja dozvoljena širina je {{ min_width }}px.</target> + <target>Širina slike je premala ({{ width }} piksela). Najmanja dozvoljena širina je {{ min_width }} piksela.</target> </trans-unit> <trans-unit id="45"> <source>The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.</source> - <target>Visina slike je prevelika ({{ height }}px). Najeća dozvoljena visina je {{ max_height }}px.</target> + <target>Visina slike je prevelika ({{ height }} piksela). Najveća dozvoljena visina je {{ max_height }} piksela.</target> </trans-unit> <trans-unit id="46"> <source>The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.</source> - <target>Visina slike je premala ({{ height }}px). Najmanja dozvoljena visina je {{ min_height }}px.</target> + <target>Visina slike je premala ({{ height }} piksela). Najmanja dozvoljena visina je {{ min_height }} piksela.</target> </trans-unit> <trans-unit id="47"> <source>This value should be the user's current password.</source> - <target>Vrednost treba da bude trenutna korisnička lozinka.</target> + <target>Vrednost bi trebalo da bude trenutna korisnička lozinka.</target> </trans-unit> <trans-unit id="48"> <source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source> - <target>Vrednost treba da ima tačno {{ limit }} karakter.|Vrednost treba da ima tačno {{ limit }} karaktera.|Vrednost treba da ima tačno {{ limit }} karaktera.</target> + <target>Vrednost bi trebalo da ima tačno {{ limit }} karakter.|Vrednost bi trebalo da ima tačno {{ limit }} karaktera.</target> </trans-unit> <trans-unit id="49"> <source>The file was only partially uploaded.</source> @@ -204,23 +204,23 @@ </trans-unit> <trans-unit id="54"> <source>This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.</source> - <target>Ova kolekcija treba da sadrži {{ limit }} ili više elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili više elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili više elemenata.</target> + <target>Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.</target> </trans-unit> <trans-unit id="55"> <source>This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.</source> - <target>Ova kolekcija treba da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili manje elemenata.</target> + <target>Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.</target> </trans-unit> <trans-unit id="56"> <source>This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.</source> - <target>Ova kolekcija treba da sadrži tačno {{ limit }} element.|Ova kolekcija treba da sadrži tačno {{ limit }} elementa.|Ova kolekcija treba da sadrži tačno {{ limit }} elemenata.</target> + <target>Ova kolekcija bi trebalo da sadrži tačno {{ limit }} element.|Ova kolekcija bi trebalo da sadrži tačno {{ limit }} elemenata.</target> </trans-unit> <trans-unit id="57"> <source>Invalid card number.</source> - <target>Nevalidan broj kartice.</target> + <target>Broj kartice nije validan.</target> </trans-unit> <trans-unit id="58"> <source>Unsupported card type or invalid card number.</source> - <target>Nevalidan broj kartice ili tip kartice nije podržan.</target> + <target>Tip kartije nije podržan ili broj kartice nije validan.</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 vrednost treba da bude {{ compared_value }}.</target> + <target>Ova vrednost bi trebalo da bude jednaka {{ compared_value }}.</target> </trans-unit> <trans-unit id="66"> <source>This value should be greater than {{ compared_value }}.</source> - <target>Ova vrednost treba da bude veća od {{ compared_value }}.</target> + <target>Ova vrednost bi trebalo da bude 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 vrednost treba da bude veća ili jednaka {{ compared_value }}.</target> + <target>Ova vrednost bi trebalo da bude veća 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 vrednost treba da bude identična sa {{ compared_value_type }} {{ compared_value }}.</target> + <target>Ova vrednost bi trebalo da bude identična sa {{ compared_value_type }} {{ compared_value }}.</target> </trans-unit> <trans-unit id="69"> <source>This value should be less than {{ compared_value }}.</source> - <target>Ova vrednost treba da bude manja od {{ compared_value }}.</target> + <target>Ova vrednost bi trebalo da bude 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 vrednost treba da bude manja ili jednaka {{ compared_value }}.</target> + <target>Ova vrednost bi trebalo da bude manja ili jednaka {{ compared_value }}.</target> </trans-unit> <trans-unit id="71"> <source>This value should not be equal to {{ compared_value }}.</source> - <target>Ova vrednost ne treba da bude jednaka {{ compared_value }}.</target> + <target>Ova vrednost ne bi trebalo da bude jednaka {{ 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 vrednost ne treba da bude identična sa {{ compared_value_type }} {{ compared_value }}.</target> + <target>Ova vrednost ne bi trebalo da bude identična sa {{ 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> @@ -288,15 +288,51 @@ </trans-unit> <trans-unit id="75"> <source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source> - <target>Slika je kvadratna ({{ width }}x{{ height }}px). Kvadratne slike nisu dozvoljene.</target> + <target>Slika je kvadratna ({{ width }}x{{ height }} piksela). Kvadratne slike nisu dozvoljene.</target> </trans-unit> <trans-unit id="76"> <source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source> - <target>Slika je orijentacije pejzaža ({{ width }}x{{ height }}px). Pejzažna orijentacija slika nije dozvoljena.</target> + <target>Slika je pejzažno orijentisana ({{ width }}x{{ height }} piksela). Pejzažna orijentisane slike nisu dozvoljene.</target> </trans-unit> <trans-unit id="77"> <source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source> - <target>Slika je orijantacije portreta ({{ width }}x{{ height }}px). Portretna orijentacija slika nije dozvoljena.</target> + <target>Slika je portretno orijentisana ({{ width }}x{{ height }} piksela). Portretno orijentisane slike nisu dozvoljene.</target> + </trans-unit> + <trans-unit id="78"> + <source>An empty file is not allowed.</source> + <target>Prazna datoteka nije dozvoljena.</target> + </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>Nije moguće odrediti poslužitelja.</target> + </trans-unit> + <trans-unit id="80"> + <source>This value does not match the expected {{ charset }} charset.</source> + <target>Vrednost se ne poklapa sa očekivanim {{ charset }} setom karaktera.</target> + </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>Ovo nije validan BIC.</target> + </trans-unit> + <trans-unit id="82"> + <source>Error</source> + <target>Greška</target> + </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Ovo nije validan univerzalni unikatni identifikator (UUID).</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Ova vrednost bi trebalo da bude višestruko veća od {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>BIC kod nije povezan sa IBAN {{ iban }}.</target> + </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Ova vrednost bi trebalo da bude validan JSON.</target> </trans-unit> </body> </file> diff --git a/vendor/symfony/validator/Resources/translations/validators.sv.xlf b/vendor/symfony/validator/Resources/translations/validators.sv.xlf index fa043ea23a3092261f9ec7c63840e8f0942e9f26..40dd63e293ca3e30ca5956470bfb0327daeb434d 100644 --- a/vendor/symfony/validator/Resources/translations/validators.sv.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.sv.xlf @@ -52,7 +52,7 @@ </trans-unit> <trans-unit id="13"> <source>This value is not a valid email address.</source> - <target>Värdet är inte en giltig epost-adress.</target> + <target>Värdet är inte en giltig e-postadress.</target> </trans-unit> <trans-unit id="14"> <source>The file could not be found.</source> diff --git a/vendor/symfony/validator/Resources/translations/validators.tr.xlf b/vendor/symfony/validator/Resources/translations/validators.tr.xlf index 5e19e3e5a3c66acbaf4037613dc4fa694899b5c9..a23c652b176e8e0a072b5faf9363b1ca1e3b247d 100644 --- a/vendor/symfony/validator/Resources/translations/validators.tr.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.tr.xlf @@ -222,10 +222,114 @@ <source>Unsupported card type or invalid card number.</source> <target>Desteklenmeyen kart tipi veya geçersiz kart numarası.</target> </trans-unit> + <trans-unit id="59"> + <source>This is not a valid International Bank Account Number (IBAN).</source> + <target>Bu geçerli bir Uluslararası Banka Hesap Numarası (IBAN) değildir.</target> + </trans-unit> + <trans-unit id="60"> + <source>This value is not a valid ISBN-10.</source> + <target>Bu değer geçerli bir ISBN-10 değildir.</target> + </trans-unit> + <trans-unit id="61"> + <source>This value is not a valid ISBN-13.</source> + <target>Bu değer geçerli bir ISBN-13 değildir.</target> + </trans-unit> + <trans-unit id="62"> + <source>This value is neither a valid ISBN-10 nor a valid ISBN-13.</source> + <target>Bu değer geçerli bir ISBN-10 veya ISBN-13 değildir.</target> + </trans-unit> + <trans-unit id="63"> + <source>This value is not a valid ISSN.</source> + <target>Bu değer geçerli bir ISSN değildir.</target> + </trans-unit> + <trans-unit id="64"> + <source>This value is not a valid currency.</source> + <target>Bu değer geçerli bir para birimi değil.</target> + </trans-unit> + <trans-unit id="65"> + <source>This value should be equal to {{ compared_value }}.</source> + <target>Bu değer {{ compared_value }} ile eşit olmalıdır.</target> + </trans-unit> + <trans-unit id="66"> + <source>This value should be greater than {{ compared_value }}.</source> + <target>Bu değer {{ compared_value }} değerinden büyük olmalıdır.</target> + </trans-unit> + <trans-unit id="67"> + <source>This value should be greater than or equal to {{ compared_value }}.</source> + <target>Bu değer {{ compared_value }} ile eşit veya büyük olmalıdır.</target> + </trans-unit> + <trans-unit id="68"> + <source>This value should be identical to {{ compared_value_type }} {{ compared_value }}.</source> + <target>Bu değer {{ compared_value_type }} {{ compared_value }} ile aynı olmalıdır.</target> + </trans-unit> + <trans-unit id="69"> + <source>This value should be less than {{ compared_value }}.</source> + <target>Bu değer {{ compared_value }} değerinden düşük olmalıdır.</target> + </trans-unit> + <trans-unit id="70"> + <source>This value should be less than or equal to {{ compared_value }}.</source> + <target>.Bu değer {{ compared_value }} ile eşit veya düşük olmalıdır.</target> + </trans-unit> + <trans-unit id="71"> + <source>This value should not be equal to {{ compared_value }}.</source> + <target>Bu değer {{ compared_value }} ile eşit olmamalıdır.</target> + </trans-unit> + <trans-unit id="72"> + <source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source> + <target>Bu değer {{ compared_value_type }} {{ compared_value }} ile aynı olmamalıdır.</target> + </trans-unit> + <trans-unit id="73"> + <source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source> + <target>Resim oranı çok büyük ({{ ratio }}). İzin verilen maksimum oran: {{ max_ratio }}.</target> + </trans-unit> + <trans-unit id="74"> + <source>The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.</source> + <target>Resim oranı çok ufak ({{ ratio }}). Beklenen minimum oran {{ min_ratio }}.</target> + </trans-unit> + <trans-unit id="75"> + <source>The image is square ({{ width }}x{{ height }}px). Square images are not allowed.</source> + <target>Resim karesi ({{ width }}x{{ height }}px). Kare resimlerine izin verilmiyor.</target> + </trans-unit> + <trans-unit id="76"> + <source>The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.</source> + <target>Resim manzara odaklı ({{ width }}x{{ height }}px). Manzara odaklı resimlere izin verilmiyor.</target> + </trans-unit> + <trans-unit id="77"> + <source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source> + <target>Resim portre odaklı ({{ width }}x{{ height }}px). Portre odaklı resimlere izin verilmiyor.</target> + </trans-unit> + <trans-unit id="78"> + <source>An empty file is not allowed.</source> + <target>Boş bir dosyaya izin verilmiyor.</target> + </trans-unit> + <trans-unit id="79"> + <source>The host could not be resolved.</source> + <target>Sunucu çözülemedi.</target> + </trans-unit> + <trans-unit id="80"> + <source>This value does not match the expected {{ charset }} charset.</source> + <target>Bu değer beklenen {{ charset }} karakter kümesiyle eşleşmiyor.</target> + </trans-unit> + <trans-unit id="81"> + <source>This is not a valid Business Identifier Code (BIC).</source> + <target>Bu geçerli bir İşletme Tanımlayıcı Kodu (BIC) değildir.</target> + </trans-unit> <trans-unit id="82"> <source>Error</source> <target>Hata</target> </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Bu geçerli bir UUID değildir.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Bu değer {{ compare_value }} değerinin katlarından biri olmalıdır.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Bu İşletme Tanımlayıcı Kodu (BIC), IBAN {{ iban }} ile ilişkili değildir.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.uk.xlf b/vendor/symfony/validator/Resources/translations/validators.uk.xlf index 6a92801c9b47daacf44a09debfd10cb51f1d5c76..5ddc429854e54f5b6d92313168c07ea39b22083b 100644 --- a/vendor/symfony/validator/Resources/translations/validators.uk.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.uk.xlf @@ -318,6 +318,18 @@ <source>Error</source> <target>Помилка</target> </trans-unit> + <trans-unit id="83"> + <source>This is not a valid UUID.</source> + <target>Це не валідне значення UUID.</target> + </trans-unit> + <trans-unit id="84"> + <source>This value should be a multiple of {{ compared_value }}.</source> + <target>Це значення повинне бути кратним {{ compared_value }}.</target> + </trans-unit> + <trans-unit id="85"> + <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> + <target>Банківський код (BIC) не пов’язаний із міжнародним номером банківського рахунку (IBAN) {{ iban }}.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.vi.xlf b/vendor/symfony/validator/Resources/translations/validators.vi.xlf index e1833c79cb470a20f7df7d68802b5824da9d2932..750a4d91e2c6156c1812ad369dfa1bd382d79dc6 100644 --- a/vendor/symfony/validator/Resources/translations/validators.vi.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.vi.xlf @@ -40,7 +40,7 @@ </trans-unit> <trans-unit id="10"> <source>This field is missing.</source> - <target>Lĩnh vực này là mất tích.</target> + <target>Lĩnh vực này bị thiếu.</target> </trans-unit> <trans-unit id="11"> <source>This value is not a valid date.</source> @@ -132,7 +132,7 @@ </trans-unit> <trans-unit id="36"> <source>This file is not a valid image.</source> - <target>Tập tin không phải là hình ảnh.</target> + <target>Tập tin không phải là hình ảnh hợp lệ.</target> </trans-unit> <trans-unit id="37"> <source>This is not a valid IP address.</source> @@ -148,7 +148,7 @@ </trans-unit> <trans-unit id="40"> <source>This value is not a valid country.</source> - <target>Giá trị không phải là nước hợp lệ.</target> + <target>Giá trị không phải là quốc gia hợp lệ.</target> </trans-unit> <trans-unit id="41"> <source>This value is already used.</source> @@ -180,7 +180,7 @@ </trans-unit> <trans-unit id="48"> <source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source> - <target>Giá trị phải có chính xác {{ limit }} kí tự.|Giá trị phải có chính xác {{ limit }} kí tự.</target> + <target>Giá trị này phải có chính xác {{ limit }} kí tự.|Giá trị này phải có chính xác {{ limit }} kí tự.</target> </trans-unit> <trans-unit id="49"> <source>The file was only partially uploaded.</source> @@ -204,11 +204,11 @@ </trans-unit> <trans-unit id="54"> <source>This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.</source> - <target>Danh sách phải chứa {{ limit }} hoặc nhiều hơn thành phần.|Danh sách phải chứa {{ limit }} hoặc nhiều hơn thành phần.</target> + <target>Danh sách phải chứa {{ limit }} thành phần hoặc nhiều hơn.|Danh sách phải chứa {{ limit }} thành phần hoặc nhiều hơn.</target> </trans-unit> <trans-unit id="55"> <source>This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.</source> - <target>Danh sách phải chứa {{ limit }} hoặc ít hơn thành phần.|Danh sách phải chứa {{ limit }} hoặc ít hơn thành phần.</target> + <target>Danh sách phải chứa {{ limit }} thành phần hoặc ít hơn.|Danh sách phải chứa {{ limit }} thành phần hoặc ít hơn.</target> </trans-unit> <trans-unit id="56"> <source>This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.</source> @@ -240,11 +240,11 @@ </trans-unit> <trans-unit id="63"> <source>This value is not a valid ISSN.</source> - <target>Giá trị không là ISSN hợp lệ.</target> + <target>Giá trị không phải là ISSN hợp lệ.</target> </trans-unit> <trans-unit id="64"> <source>This value is not a valid currency.</source> - <target>Giá trị không phải là đơn vi tiền tệ hợp lệ.</target> + <target>Giá trị không phải là đơn vị tiền tệ hợp lệ.</target> </trans-unit> <trans-unit id="65"> <source>This value should be equal to {{ compared_value }}.</source> @@ -268,7 +268,7 @@ </trans-unit> <trans-unit id="70"> <source>This value should be less than or equal to {{ compared_value }}.</source> - <target>Giá trị không được phép nhỏ hơn hoặc bằng {{ compared_value }}.</target> + <target>Giá trị phải nhỏ hơn hoặc bằng {{ compared_value }}.</target> </trans-unit> <trans-unit id="71"> <source>This value should not be equal to {{ compared_value }}.</source> diff --git a/vendor/symfony/validator/Test/ConstraintValidatorTestCase.php b/vendor/symfony/validator/Test/ConstraintValidatorTestCase.php index 087a90a1850d7f09d12e4befa4bb08074695c323..afe1f1a582e121b07712ecb1fd700b626a0e5a7e 100644 --- a/vendor/symfony/validator/Test/ConstraintValidatorTestCase.php +++ b/vendor/symfony/validator/Test/ConstraintValidatorTestCase.php @@ -175,7 +175,7 @@ protected function expectValidateAt($i, $propertyPath, $value, $group) ->will($this->returnValue($validator)); $validator->expects($this->at(2 * $i + 1)) ->method('validate') - ->with($value, $this->logicalOr(null, array(), $this->isInstanceOf('\Symfony\Component\Validator\Constraints\Valid')), $group); + ->with($value, $this->logicalOr(null, [], $this->isInstanceOf('\Symfony\Component\Validator\Constraints\Valid')), $group); } protected function expectValidateValueAt($i, $propertyPath, $value, $constraints, $group = null) @@ -224,7 +224,7 @@ class ConstraintViolationAssertion private $assertions; private $message; - private $parameters = array(); + private $parameters = []; private $invalidValue = 'InvalidValue'; private $propertyPath = 'property.path'; private $plural; @@ -232,7 +232,7 @@ class ConstraintViolationAssertion private $constraint; private $cause; - public function __construct(ExecutionContextInterface $context, $message, Constraint $constraint = null, array $assertions = array()) + public function __construct(ExecutionContextInterface $context, $message, Constraint $constraint = null, array $assertions = []) { $this->context = $context; $this->message = $message; @@ -306,7 +306,7 @@ public function buildNextViolation($message) public function assertRaised() { - $expected = array(); + $expected = []; foreach ($this->assertions as $assertion) { $expected[] = $assertion->getViolation(); } diff --git a/vendor/symfony/validator/Tests/ConstraintTest.php b/vendor/symfony/validator/Tests/ConstraintTest.php index a05741490fddeca13ea54f06d600465ca7edc76d..87bac5b0a6e93055ea353e9303b01f4220896e17 100644 --- a/vendor/symfony/validator/Tests/ConstraintTest.php +++ b/vendor/symfony/validator/Tests/ConstraintTest.php @@ -24,10 +24,10 @@ class ConstraintTest extends TestCase { public function testSetProperties() { - $constraint = new ConstraintA(array( + $constraint = new ConstraintA([ 'property1' => 'foo', 'property2' => 'bar', - )); + ]); $this->assertEquals('foo', $constraint->property1); $this->assertEquals('bar', $constraint->property2); @@ -37,9 +37,9 @@ public function testSetNotExistingPropertyThrowsException() { $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\InvalidOptionsException'); - new ConstraintA(array( + new ConstraintA([ 'foo' => 'bar', - )); + ]); } public function testMagicPropertiesAreNotAllowed() @@ -55,10 +55,10 @@ public function testInvalidAndRequiredOptionsPassed() { $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\InvalidOptionsException'); - new ConstraintC(array( + new ConstraintC([ 'option1' => 'default', 'foo' => 'bar', - )); + ]); } public function testSetDefaultProperty() @@ -70,14 +70,14 @@ public function testSetDefaultProperty() public function testSetDefaultPropertyDoctrineStyle() { - $constraint = new ConstraintA(array('value' => 'foo')); + $constraint = new ConstraintA(['value' => 'foo']); $this->assertEquals('foo', $constraint->property2); } public function testSetDefaultPropertyDoctrineStylePlusOtherProperty() { - $constraint = new ConstraintA(array('value' => 'foo', 'property1' => 'bar')); + $constraint = new ConstraintA(['value' => 'foo', 'property1' => 'bar']); $this->assertEquals('foo', $constraint->property2); $this->assertEquals('bar', $constraint->property1); @@ -85,7 +85,7 @@ public function testSetDefaultPropertyDoctrineStylePlusOtherProperty() public function testSetDefaultPropertyDoctrineStyleWhenDefaultPropertyIsNamedValue() { - $constraint = new ConstraintWithValueAsDefault(array('value' => 'foo')); + $constraint = new ConstraintWithValueAsDefault(['value' => 'foo']); $this->assertEquals('foo', $constraint->value); $this->assertNull($constraint->property); @@ -93,7 +93,7 @@ public function testSetDefaultPropertyDoctrineStyleWhenDefaultPropertyIsNamedVal public function testDontSetDefaultPropertyIfValuePropertyExists() { - $constraint = new ConstraintWithValue(array('value' => 'foo')); + $constraint = new ConstraintWithValue(['value' => 'foo']); $this->assertEquals('foo', $constraint->value); $this->assertNull($constraint->property); @@ -115,23 +115,23 @@ public function testRequiredOptionsMustBeDefined() public function testRequiredOptionsPassed() { - $constraint = new ConstraintC(array('option1' => 'default')); + $constraint = new ConstraintC(['option1' => 'default']); $this->assertSame('default', $constraint->option1); } public function testGroupsAreConvertedToArray() { - $constraint = new ConstraintA(array('groups' => 'Foo')); + $constraint = new ConstraintA(['groups' => 'Foo']); - $this->assertEquals(array('Foo'), $constraint->groups); + $this->assertEquals(['Foo'], $constraint->groups); } public function testAddDefaultGroupAddsGroup() { - $constraint = new ConstraintA(array('groups' => 'Default')); + $constraint = new ConstraintA(['groups' => 'Default']); $constraint->addImplicitGroupName('Foo'); - $this->assertEquals(array('Default', 'Foo'), $constraint->groups); + $this->assertEquals(['Default', 'Foo'], $constraint->groups); } public function testAllowsSettingZeroRequiredPropertyValue() @@ -142,9 +142,9 @@ public function testAllowsSettingZeroRequiredPropertyValue() public function testCanCreateConstraintWithNoDefaultOptionAndEmptyArray() { - $constraint = new ConstraintB(array()); + $constraint = new ConstraintB([]); - $this->assertSame(array(Constraint::PROPERTY_CONSTRAINT, Constraint::CLASS_CONSTRAINT), $constraint->getTargets()); + $this->assertSame([Constraint::PROPERTY_CONSTRAINT, Constraint::CLASS_CONSTRAINT], $constraint->getTargets()); } public function testGetTargetsCanBeString() @@ -158,15 +158,15 @@ public function testGetTargetsCanBeArray() { $constraint = new ConstraintA(); - $this->assertEquals(array('property', 'class'), $constraint->getTargets()); + $this->assertEquals(['property', 'class'], $constraint->getTargets()); } public function testSerialize() { - $constraint = new ConstraintA(array( + $constraint = new ConstraintA([ 'property1' => 'foo', 'property2' => 'bar', - )); + ]); $restoredConstraint = unserialize(serialize($constraint)); @@ -175,33 +175,33 @@ public function testSerialize() public function testSerializeInitializesGroupsOptionToDefault() { - $constraint = new ConstraintA(array( + $constraint = new ConstraintA([ 'property1' => 'foo', 'property2' => 'bar', - )); + ]); $constraint = unserialize(serialize($constraint)); - $expected = new ConstraintA(array( + $expected = new ConstraintA([ 'property1' => 'foo', 'property2' => 'bar', 'groups' => 'Default', - )); + ]); $this->assertEquals($expected, $constraint); } public function testSerializeKeepsCustomGroups() { - $constraint = new ConstraintA(array( + $constraint = new ConstraintA([ 'property1' => 'foo', 'property2' => 'bar', 'groups' => 'MyGroup', - )); + ]); $constraint = unserialize(serialize($constraint)); - $this->assertSame(array('MyGroup'), $constraint->groups); + $this->assertSame(['MyGroup'], $constraint->groups); } /** @@ -214,11 +214,11 @@ public function testGetErrorNameForUnknownCode() public function testOptionsAsDefaultOption() { - $constraint = new ConstraintA($options = array('value1')); + $constraint = new ConstraintA($options = ['value1']); $this->assertEquals($options, $constraint->property2); - $constraint = new ConstraintA($options = array('value1', 'property1' => 'value2')); + $constraint = new ConstraintA($options = ['value1', 'property1' => 'value2']); $this->assertEquals($options, $constraint->property2); } @@ -229,12 +229,12 @@ public function testOptionsAsDefaultOption() */ public function testInvalidOptions() { - new ConstraintA(array('property2' => 'foo', 'bar', 5 => 'baz')); + new ConstraintA(['property2' => 'foo', 'bar', 5 => 'baz']); } public function testOptionsWithInvalidInternalPointer() { - $options = array('property1' => 'foo'); + $options = ['property1' => 'foo']; next($options); next($options); diff --git a/vendor/symfony/validator/Tests/ConstraintViolationListTest.php b/vendor/symfony/validator/Tests/ConstraintViolationListTest.php index f0e6afe20da3f67eccd2a2601902fe7a47ee8be1..73d81cbfad9c47ef08f1094c51fb02bf6b03a1a8 100644 --- a/vendor/symfony/validator/Tests/ConstraintViolationListTest.php +++ b/vendor/symfony/validator/Tests/ConstraintViolationListTest.php @@ -37,7 +37,7 @@ public function testInit() public function testInitWithViolations() { $violation = $this->getViolation('Error'); - $this->list = new ConstraintViolationList(array($violation)); + $this->list = new ConstraintViolationList([$violation]); $this->assertCount(1, $this->list); $this->assertSame($violation, $this->list[0]); @@ -54,11 +54,11 @@ public function testAdd() public function testAddAll() { - $violations = array( + $violations = [ 10 => $this->getViolation('Error 1'), 20 => $this->getViolation('Error 2'), 30 => $this->getViolation('Error 3'), - ); + ]; $otherList = new ConstraintViolationList($violations); $this->list->addAll($otherList); @@ -71,11 +71,11 @@ public function testAddAll() public function testIterator() { - $violations = array( + $violations = [ 10 => $this->getViolation('Error 1'), 20 => $this->getViolation('Error 2'), 30 => $this->getViolation('Error 3'), - ); + ]; $this->list = new ConstraintViolationList($violations); @@ -103,13 +103,13 @@ public function testArrayAccess() public function testToString() { - $this->list = new ConstraintViolationList(array( + $this->list = new ConstraintViolationList([ $this->getViolation('Error 1', 'Root'), $this->getViolation('Error 2', 'Root', 'foo.bar'), $this->getViolation('Error 3', 'Root', '[baz]'), $this->getViolation('Error 4', '', 'foo.bar'), $this->getViolation('Error 5', '', '[baz]'), - )); + ]); $expected = <<<'EOF' Root: @@ -133,11 +133,11 @@ public function testToString() */ public function testFindByCodes($code, $violationsCount) { - $violations = array( + $violations = [ $this->getViolation('Error', null, null, 'code1'), $this->getViolation('Error', null, null, 'code1'), $this->getViolation('Error', null, null, 'code2'), - ); + ]; $list = new ConstraintViolationList($violations); $specificErrors = $list->findByCodes($code); @@ -148,15 +148,15 @@ public function testFindByCodes($code, $violationsCount) public function findByCodesProvider() { - return array( - array('code1', 2), - array(array('code1', 'code2'), 3), - array('code3', 0), - ); + return [ + ['code1', 2], + [['code1', 'code2'], 3], + ['code3', 0], + ]; } protected function getViolation($message, $root = null, $propertyPath = null, $code = null) { - return new ConstraintViolation($message, $message, array(), $root, $propertyPath, null, null, $code); + return new ConstraintViolation($message, $message, [], $root, $propertyPath, null, null, $code); } } diff --git a/vendor/symfony/validator/Tests/ConstraintViolationTest.php b/vendor/symfony/validator/Tests/ConstraintViolationTest.php index cef4782e0f82d4382bb1c5982b73d7d116ab34bb..b43e51f27336071ce76a07b72f59e9fc7bc8e0f7 100644 --- a/vendor/symfony/validator/Tests/ConstraintViolationTest.php +++ b/vendor/symfony/validator/Tests/ConstraintViolationTest.php @@ -21,7 +21,7 @@ public function testToStringHandlesArrays() $violation = new ConstraintViolation( 'Array', '{{ value }}', - array('{{ value }}' => array(1, 2, 3)), + ['{{ value }}' => [1, 2, 3]], 'Root', 'property.path', null @@ -40,8 +40,8 @@ public function testToStringHandlesArrayRoots() $violation = new ConstraintViolation( '42 cannot be used here', 'this is the message template', - array(), - array('some_value' => 42), + [], + ['some_value' => 42], 'some_value', null ); @@ -53,4 +53,59 @@ public function testToStringHandlesArrayRoots() $this->assertSame($expected, (string) $violation); } + + public function testToStringHandlesCodes() + { + $violation = new ConstraintViolation( + '42 cannot be used here', + 'this is the message template', + [], + ['some_value' => 42], + 'some_value', + null, + null, + 0 + ); + + $expected = <<<'EOF' +Array.some_value: + 42 cannot be used here (code 0) +EOF; + + $this->assertSame($expected, (string) $violation); + } + + public function testToStringOmitsEmptyCodes() + { + $expected = <<<'EOF' +Array.some_value: + 42 cannot be used here +EOF; + + $violation = new ConstraintViolation( + '42 cannot be used here', + 'this is the message template', + [], + ['some_value' => 42], + 'some_value', + null, + null, + null + ); + + $this->assertSame($expected, (string) $violation); + + $violation = new ConstraintViolation( + '42 cannot be used here', + 'this is the message template', + [], + ['some_value' => 42], + 'some_value', + null, + null, + '' + ); + + $this->assertSame($expected, (string) $violation); + } } diff --git a/vendor/symfony/validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/vendor/symfony/validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php index 5e9f2bceafcd4a5edaec976f0a459a69d07bb849..2f27974a801abc205a07a983ac83a93787c7791d 100644 --- a/vendor/symfony/validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php +++ b/vendor/symfony/validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php @@ -73,10 +73,10 @@ protected static function addPhp5Dot5Comparisons(array $comparisons) public function provideInvalidConstraintOptions() { - return array( - array(null), - array(array()), - ); + return [ + [null], + [[]], + ]; } /** @@ -95,10 +95,10 @@ public function testThrowsConstraintExceptionIfNoValueOrPropertyPath($options) */ public function testThrowsConstraintExceptionIfBothValueAndPropertyPath() { - $this->createConstraint((array( + $this->createConstraint(([ 'value' => 'value', 'propertyPath' => 'propertyPath', - ))); + ])); } /** @@ -109,7 +109,7 @@ public function testThrowsConstraintExceptionIfBothValueAndPropertyPath() */ public function testValidComparisonToValue($dirtyValue, $comparisonValue) { - $constraint = $this->createConstraint(array('value' => $comparisonValue)); + $constraint = $this->createConstraint(['value' => $comparisonValue]); $this->validator->validate($dirtyValue, $constraint); @@ -137,7 +137,7 @@ public function provideAllValidComparisons() */ public function testValidComparisonToPropertyPath($comparedValue) { - $constraint = $this->createConstraint(array('propertyPath' => 'value')); + $constraint = $this->createConstraint(['propertyPath' => 'value']); $object = new ComparisonTest_Class(5); @@ -153,9 +153,9 @@ public function testValidComparisonToPropertyPath($comparedValue) */ public function testValidComparisonToPropertyPathOnArray($comparedValue) { - $constraint = $this->createConstraint(array('propertyPath' => '[root][value]')); + $constraint = $this->createConstraint(['propertyPath' => '[root][value]']); - $this->setObject(array('root' => array('value' => 5))); + $this->setObject(['root' => ['value' => 5]]); $this->validator->validate($comparedValue, $constraint); @@ -164,7 +164,7 @@ public function testValidComparisonToPropertyPathOnArray($comparedValue) public function testNoViolationOnNullObjectWithPropertyPath() { - $constraint = $this->createConstraint(array('propertyPath' => 'propertyPath')); + $constraint = $this->createConstraint(['propertyPath' => 'propertyPath']); $this->setObject(null); @@ -175,7 +175,7 @@ public function testNoViolationOnNullObjectWithPropertyPath() public function testInvalidValuePath() { - $constraint = $this->createConstraint(array('propertyPath' => 'foo')); + $constraint = $this->createConstraint(['propertyPath' => 'foo']); if (method_exists($this, 'expectException')) { $this->expectException(ConstraintDefinitionException::class); @@ -218,7 +218,7 @@ public function testInvalidComparisonToValue($dirtyValue, $dirtyValueAsString, $ IntlTestHelper::requireIntl($this, '57.1'); } - $constraint = $this->createConstraint(array('value' => $comparedValue)); + $constraint = $this->createConstraint(['value' => $comparedValue]); $constraint->message = 'Constraint Message'; $this->validator->validate($dirtyValue, $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/AllTest.php b/vendor/symfony/validator/Tests/Constraints/AllTest.php index 25e71a1b44dc4a5ca5fc9a873eb2824f059ccf2c..cdd72a22ebc58a80a157e2cf3c713063b5087bbf 100644 --- a/vendor/symfony/validator/Tests/Constraints/AllTest.php +++ b/vendor/symfony/validator/Tests/Constraints/AllTest.php @@ -25,9 +25,9 @@ class AllTest extends TestCase */ public function testRejectNonConstraints() { - new All(array( + new All([ 'foo', - )); + ]); } /** @@ -35,8 +35,8 @@ public function testRejectNonConstraints() */ public function testRejectValidConstraint() { - new All(array( + new All([ new Valid(), - )); + ]); } } diff --git a/vendor/symfony/validator/Tests/Constraints/AllValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/AllValidatorTest.php index 2792dc4014a7338e28477e0b853d291739ae222d..1752f47e700a5e0eeba050ad9379d8a263055b93 100644 --- a/vendor/symfony/validator/Tests/Constraints/AllValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/AllValidatorTest.php @@ -26,7 +26,7 @@ protected function createValidator() public function testNullIsValid() { - $this->validator->validate(null, new All(new Range(array('min' => 4)))); + $this->validator->validate(null, new All(new Range(['min' => 4]))); $this->assertNoViolation(); } @@ -36,7 +36,7 @@ public function testNullIsValid() */ public function testThrowsExceptionIfNotTraversable() { - $this->validator->validate('foo.barbar', new All(new Range(array('min' => 4)))); + $this->validator->validate('foo.barbar', new All(new Range(['min' => 4]))); } /** @@ -44,12 +44,12 @@ public function testThrowsExceptionIfNotTraversable() */ public function testWalkSingleConstraint($array) { - $constraint = new Range(array('min' => 4)); + $constraint = new Range(['min' => 4]); $i = 0; foreach ($array as $key => $value) { - $this->expectValidateValueAt($i++, '['.$key.']', $value, array($constraint)); + $this->expectValidateValueAt($i++, '['.$key.']', $value, [$constraint]); } $this->validator->validate($array, new All($constraint)); @@ -62,15 +62,15 @@ public function testWalkSingleConstraint($array) */ public function testWalkMultipleConstraints($array) { - $constraint1 = new Range(array('min' => 4)); + $constraint1 = new Range(['min' => 4]); $constraint2 = new NotNull(); - $constraints = array($constraint1, $constraint2); + $constraints = [$constraint1, $constraint2]; $i = 0; foreach ($array as $key => $value) { - $this->expectValidateValueAt($i++, '['.$key.']', $value, array($constraint1, $constraint2)); + $this->expectValidateValueAt($i++, '['.$key.']', $value, [$constraint1, $constraint2]); } $this->validator->validate($array, new All($constraints)); @@ -80,9 +80,9 @@ public function testWalkMultipleConstraints($array) public function getValidArguments() { - return array( - array(array(5, 6, 7)), - array(new \ArrayObject(array(5, 6, 7))), - ); + return [ + [[5, 6, 7]], + [new \ArrayObject([5, 6, 7])], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/BicValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/BicValidatorTest.php index 5d21b93ced706f80e48d0b19f34ea780a005e862..6f3d1c2b67afa81667cd8bd260d28ffba89754e4 100644 --- a/vendor/symfony/validator/Tests/Constraints/BicValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/BicValidatorTest.php @@ -49,14 +49,14 @@ public function testValidBics($bic) public function getValidBics() { // http://formvalidation.io/validators/bic/ - return array( - array('ASPKAT2LXXX'), - array('ASPKAT2L'), - array('DSBACNBXSHA'), - array('UNCRIT2B912'), - array('DABADKKK'), - array('RZOOAT2L303'), - ); + return [ + ['ASPKAT2LXXX'], + ['ASPKAT2L'], + ['DSBACNBXSHA'], + ['UNCRIT2B912'], + ['DABADKKK'], + ['RZOOAT2L303'], + ]; } /** @@ -64,9 +64,9 @@ public function getValidBics() */ public function testInvalidBics($bic, $code) { - $constraint = new Bic(array( + $constraint = new Bic([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($bic, $constraint); @@ -78,30 +78,30 @@ public function testInvalidBics($bic, $code) public function getInvalidBics() { - return array( - array('DEUTD', Bic::INVALID_LENGTH_ERROR), - array('ASPKAT2LXX', Bic::INVALID_LENGTH_ERROR), - array('ASPKAT2LX', Bic::INVALID_LENGTH_ERROR), - array('ASPKAT2LXXX1', Bic::INVALID_LENGTH_ERROR), - array('DABADKK', Bic::INVALID_LENGTH_ERROR), - array('1SBACNBXSHA', Bic::INVALID_BANK_CODE_ERROR), - array('RZ00AT2L303', Bic::INVALID_BANK_CODE_ERROR), - array('D2BACNBXSHA', Bic::INVALID_BANK_CODE_ERROR), - array('DS3ACNBXSHA', Bic::INVALID_BANK_CODE_ERROR), - array('DSB4CNBXSHA', Bic::INVALID_BANK_CODE_ERROR), - array('DEUT12HH', Bic::INVALID_COUNTRY_CODE_ERROR), - array('DSBAC6BXSHA', Bic::INVALID_COUNTRY_CODE_ERROR), - array('DSBA5NBXSHA', Bic::INVALID_COUNTRY_CODE_ERROR), + return [ + ['DEUTD', Bic::INVALID_LENGTH_ERROR], + ['ASPKAT2LXX', Bic::INVALID_LENGTH_ERROR], + ['ASPKAT2LX', Bic::INVALID_LENGTH_ERROR], + ['ASPKAT2LXXX1', Bic::INVALID_LENGTH_ERROR], + ['DABADKK', Bic::INVALID_LENGTH_ERROR], + ['1SBACNBXSHA', Bic::INVALID_BANK_CODE_ERROR], + ['RZ00AT2L303', Bic::INVALID_BANK_CODE_ERROR], + ['D2BACNBXSHA', Bic::INVALID_BANK_CODE_ERROR], + ['DS3ACNBXSHA', Bic::INVALID_BANK_CODE_ERROR], + ['DSB4CNBXSHA', Bic::INVALID_BANK_CODE_ERROR], + ['DEUT12HH', Bic::INVALID_COUNTRY_CODE_ERROR], + ['DSBAC6BXSHA', Bic::INVALID_COUNTRY_CODE_ERROR], + ['DSBA5NBXSHA', Bic::INVALID_COUNTRY_CODE_ERROR], // branch code error - array('THISSVAL1D]', Bic::INVALID_CHARACTERS_ERROR), + ['THISSVAL1D]', Bic::INVALID_CHARACTERS_ERROR], // location code error - array('DEUTDEF]', Bic::INVALID_CHARACTERS_ERROR), + ['DEUTDEF]', Bic::INVALID_CHARACTERS_ERROR], // lower case values are invalid - array('DeutAT2LXXX', Bic::INVALID_CASE_ERROR), - array('DEUTAT2lxxx', Bic::INVALID_CASE_ERROR), - ); + ['DeutAT2LXXX', Bic::INVALID_CASE_ERROR], + ['DEUTAT2lxxx', Bic::INVALID_CASE_ERROR], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/BlankValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/BlankValidatorTest.php index 94c653b105a92848d48808ea38e62f0a2017e2dc..1d138348a9e7be6b877d0fdbb2d6a874477e50d8 100644 --- a/vendor/symfony/validator/Tests/Constraints/BlankValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/BlankValidatorTest.php @@ -41,9 +41,9 @@ public function testBlankIsValid() */ public function testInvalidValues($value, $valueAsString) { - $constraint = new Blank(array( + $constraint = new Blank([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -55,11 +55,11 @@ public function testInvalidValues($value, $valueAsString) public function getInvalidValues() { - return array( - array('foobar', '"foobar"'), - array(0, '0'), - array(false, 'false'), - array(1234, '1234'), - ); + return [ + ['foobar', '"foobar"'], + [0, '0'], + [false, 'false'], + [1234, '1234'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/CallbackValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/CallbackValidatorTest.php index cb1b5c7b012c2beb963e613c426c205038bdf635..1c771c2c13aa3e9a4b3ab5dad47b866bc37be879 100644 --- a/vendor/symfony/validator/Tests/Constraints/CallbackValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/CallbackValidatorTest.php @@ -21,7 +21,7 @@ class CallbackValidatorTest_Class { public static function validateCallback($object, ExecutionContextInterface $context) { - $context->addViolation('Callback message', array('{{ value }}' => 'foobar')); + $context->addViolation('Callback message', ['{{ value }}' => 'foobar']); return false; } @@ -31,14 +31,14 @@ class CallbackValidatorTest_Object { public function validate(ExecutionContextInterface $context) { - $context->addViolation('My message', array('{{ value }}' => 'foobar')); + $context->addViolation('My message', ['{{ value }}' => 'foobar']); return false; } public static function validateStatic($object, ExecutionContextInterface $context) { - $context->addViolation('Static message', array('{{ value }}' => 'baz')); + $context->addViolation('Static message', ['{{ value }}' => 'baz']); return false; } @@ -73,7 +73,7 @@ public function testSingleMethod() public function testSingleMethodExplicitName() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array('callback' => 'validate')); + $constraint = new Callback(['callback' => 'validate']); $this->validator->validate($object, $constraint); @@ -98,7 +98,7 @@ public function testClosure() { $object = new CallbackValidatorTest_Object(); $constraint = new Callback(function ($object, ExecutionContextInterface $context) { - $context->addViolation('My message', array('{{ value }}' => 'foobar')); + $context->addViolation('My message', ['{{ value }}' => 'foobar']); return false; }); @@ -113,7 +113,7 @@ public function testClosure() public function testClosureNullObject() { $constraint = new Callback(function ($object, ExecutionContextInterface $context) { - $context->addViolation('My message', array('{{ value }}' => 'foobar')); + $context->addViolation('My message', ['{{ value }}' => 'foobar']); return false; }); @@ -128,13 +128,13 @@ public function testClosureNullObject() public function testClosureExplicitName() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( + $constraint = new Callback([ 'callback' => function ($object, ExecutionContextInterface $context) { - $context->addViolation('My message', array('{{ value }}' => 'foobar')); + $context->addViolation('My message', ['{{ value }}' => 'foobar']); return false; }, - )); + ]); $this->validator->validate($object, $constraint); @@ -146,7 +146,7 @@ public function testClosureExplicitName() public function testArrayCallable() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array(__CLASS__.'_Class', 'validateCallback')); + $constraint = new Callback([__CLASS__.'_Class', 'validateCallback']); $this->validator->validate($object, $constraint); @@ -157,7 +157,7 @@ public function testArrayCallable() public function testArrayCallableNullObject() { - $constraint = new Callback(array(__CLASS__.'_Class', 'validateCallback')); + $constraint = new Callback([__CLASS__.'_Class', 'validateCallback']); $this->validator->validate(null, $constraint); @@ -169,9 +169,9 @@ public function testArrayCallableNullObject() public function testArrayCallableExplicitName() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( - 'callback' => array(__CLASS__.'_Class', 'validateCallback'), - )); + $constraint = new Callback([ + 'callback' => [__CLASS__.'_Class', 'validateCallback'], + ]); $this->validator->validate($object, $constraint); @@ -187,7 +187,7 @@ public function testExpectValidMethods() { $object = new CallbackValidatorTest_Object(); - $this->validator->validate($object, new Callback(array('callback' => array('foobar')))); + $this->validator->validate($object, new Callback(['callback' => ['foobar']])); } /** @@ -197,13 +197,13 @@ public function testExpectValidCallbacks() { $object = new CallbackValidatorTest_Object(); - $this->validator->validate($object, new Callback(array('callback' => array('foo', 'bar')))); + $this->validator->validate($object, new Callback(['callback' => ['foo', 'bar']])); } public function testConstraintGetTargets() { - $constraint = new Callback(array()); - $targets = array(Constraint::CLASS_CONSTRAINT, Constraint::PROPERTY_CONSTRAINT); + $constraint = new Callback([]); + $targets = [Constraint::CLASS_CONSTRAINT, Constraint::PROPERTY_CONSTRAINT]; $this->assertEquals($targets, $constraint->getTargets()); } @@ -213,21 +213,21 @@ public function testNoConstructorArguments() { $constraint = new Callback(); - $this->assertSame(array(Constraint::CLASS_CONSTRAINT, Constraint::PROPERTY_CONSTRAINT), $constraint->getTargets()); + $this->assertSame([Constraint::CLASS_CONSTRAINT, Constraint::PROPERTY_CONSTRAINT], $constraint->getTargets()); } public function testAnnotationInvocationSingleValued() { - $constraint = new Callback(array('value' => 'validateStatic')); + $constraint = new Callback(['value' => 'validateStatic']); $this->assertEquals(new Callback('validateStatic'), $constraint); } public function testAnnotationInvocationMultiValued() { - $constraint = new Callback(array('value' => array(__CLASS__.'_Class', 'validateCallback'))); + $constraint = new Callback(['value' => [__CLASS__.'_Class', 'validateCallback']]); - $this->assertEquals(new Callback(array(__CLASS__.'_Class', 'validateCallback')), $constraint); + $this->assertEquals(new Callback([__CLASS__.'_Class', 'validateCallback']), $constraint); } public function testPayloadIsPassedToCallback() @@ -235,21 +235,21 @@ public function testPayloadIsPassedToCallback() $object = new \stdClass(); $payloadCopy = null; - $constraint = new Callback(array( + $constraint = new Callback([ 'callback' => function ($object, ExecutionContextInterface $constraint, $payload) use (&$payloadCopy) { $payloadCopy = $payload; }, 'payload' => 'Hello world!', - )); + ]); $this->validator->validate($object, $constraint); $this->assertEquals('Hello world!', $payloadCopy); $payloadCopy = null; - $constraint = new Callback(array( + $constraint = new Callback([ 'callback' => function ($object, ExecutionContextInterface $constraint, $payload) use (&$payloadCopy) { $payloadCopy = $payload; }, - )); + ]); $this->validator->validate($object, $constraint); $this->assertNull($payloadCopy); } diff --git a/vendor/symfony/validator/Tests/Constraints/CardSchemeValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/CardSchemeValidatorTest.php index b0280713d52850c23a09cd51c82aec55e2dc341d..5350a1d4a8a46ebeb16a7fbf83e466a2a27831c2 100644 --- a/vendor/symfony/validator/Tests/Constraints/CardSchemeValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/CardSchemeValidatorTest.php @@ -24,14 +24,14 @@ protected function createValidator() public function testNullIsValid() { - $this->validator->validate(null, new CardScheme(array('schemes' => array()))); + $this->validator->validate(null, new CardScheme(['schemes' => []])); $this->assertNoViolation(); } public function testEmptyStringIsValid() { - $this->validator->validate('', new CardScheme(array('schemes' => array()))); + $this->validator->validate('', new CardScheme(['schemes' => []])); $this->assertNoViolation(); } @@ -41,7 +41,7 @@ public function testEmptyStringIsValid() */ public function testValidNumbers($scheme, $number) { - $this->validator->validate($number, new CardScheme(array('schemes' => $scheme))); + $this->validator->validate($number, new CardScheme(['schemes' => $scheme])); $this->assertNoViolation(); } @@ -51,10 +51,10 @@ public function testValidNumbers($scheme, $number) */ public function testInvalidNumbers($scheme, $number, $code) { - $constraint = new CardScheme(array( + $constraint = new CardScheme([ 'schemes' => $scheme, 'message' => 'myMessage', - )); + ]); $this->validator->validate($number, $constraint); @@ -66,73 +66,73 @@ public function testInvalidNumbers($scheme, $number, $code) public function getValidNumbers() { - return array( - array('AMEX', '378282246310005'), - array('AMEX', '371449635398431'), - array('AMEX', '378734493671000'), - array('AMEX', '347298508610146'), - array('CHINA_UNIONPAY', '6228888888888888'), - array('CHINA_UNIONPAY', '62288888888888888'), - array('CHINA_UNIONPAY', '622888888888888888'), - array('CHINA_UNIONPAY', '6228888888888888888'), - array('DINERS', '30569309025904'), - array('DINERS', '36088894118515'), - array('DINERS', '38520000023237'), - array('DISCOVER', '6011111111111117'), - array('DISCOVER', '6011000990139424'), - array('INSTAPAYMENT', '6372476031350068'), - array('INSTAPAYMENT', '6385537775789749'), - array('INSTAPAYMENT', '6393440808445746'), - array('JCB', '3530111333300000'), - array('JCB', '3566002020360505'), - array('JCB', '213112345678901'), - array('JCB', '180012345678901'), - array('LASER', '6304678107004080'), - array('LASER', '6706440607428128629'), - array('LASER', '6771656738314582216'), - array('MAESTRO', '6759744069209'), - array('MAESTRO', '5020507657408074712'), - array('MAESTRO', '5612559223580173965'), - array('MAESTRO', '6759744069209'), - array('MAESTRO', '6594371785970435599'), - array('MASTERCARD', '5555555555554444'), - array('MASTERCARD', '5105105105105100'), - array('MASTERCARD', '2221005555554444'), - array('MASTERCARD', '2230000000000000'), - array('MASTERCARD', '2300000000000000'), - array('MASTERCARD', '2699999999999999'), - array('MASTERCARD', '2709999999999999'), - array('MASTERCARD', '2720995105105100'), - array('VISA', '4111111111111111'), - array('VISA', '4012888888881881'), - array('VISA', '4222222222222'), - array('VISA', '4917610000000000003'), - array(array('AMEX', 'VISA'), '4111111111111111'), - array(array('AMEX', 'VISA'), '378282246310005'), - array(array('JCB', 'MASTERCARD'), '5105105105105100'), - array(array('VISA', 'MASTERCARD'), '5105105105105100'), - ); + return [ + ['AMEX', '378282246310005'], + ['AMEX', '371449635398431'], + ['AMEX', '378734493671000'], + ['AMEX', '347298508610146'], + ['CHINA_UNIONPAY', '6228888888888888'], + ['CHINA_UNIONPAY', '62288888888888888'], + ['CHINA_UNIONPAY', '622888888888888888'], + ['CHINA_UNIONPAY', '6228888888888888888'], + ['DINERS', '30569309025904'], + ['DINERS', '36088894118515'], + ['DINERS', '38520000023237'], + ['DISCOVER', '6011111111111117'], + ['DISCOVER', '6011000990139424'], + ['INSTAPAYMENT', '6372476031350068'], + ['INSTAPAYMENT', '6385537775789749'], + ['INSTAPAYMENT', '6393440808445746'], + ['JCB', '3530111333300000'], + ['JCB', '3566002020360505'], + ['JCB', '213112345678901'], + ['JCB', '180012345678901'], + ['LASER', '6304678107004080'], + ['LASER', '6706440607428128629'], + ['LASER', '6771656738314582216'], + ['MAESTRO', '6759744069209'], + ['MAESTRO', '5020507657408074712'], + ['MAESTRO', '5612559223580173965'], + ['MAESTRO', '6759744069209'], + ['MAESTRO', '6594371785970435599'], + ['MASTERCARD', '5555555555554444'], + ['MASTERCARD', '5105105105105100'], + ['MASTERCARD', '2221005555554444'], + ['MASTERCARD', '2230000000000000'], + ['MASTERCARD', '2300000000000000'], + ['MASTERCARD', '2699999999999999'], + ['MASTERCARD', '2709999999999999'], + ['MASTERCARD', '2720995105105100'], + ['VISA', '4111111111111111'], + ['VISA', '4012888888881881'], + ['VISA', '4222222222222'], + ['VISA', '4917610000000000003'], + [['AMEX', 'VISA'], '4111111111111111'], + [['AMEX', 'VISA'], '378282246310005'], + [['JCB', 'MASTERCARD'], '5105105105105100'], + [['VISA', 'MASTERCARD'], '5105105105105100'], + ]; } public function getInvalidNumbers() { - return array( - array('VISA', '42424242424242424242', CardScheme::INVALID_FORMAT_ERROR), - array('AMEX', '357298508610146', CardScheme::INVALID_FORMAT_ERROR), - array('DINERS', '31569309025904', CardScheme::INVALID_FORMAT_ERROR), - array('DINERS', '37088894118515', CardScheme::INVALID_FORMAT_ERROR), - array('INSTAPAYMENT', '6313440808445746', CardScheme::INVALID_FORMAT_ERROR), - array('CHINA_UNIONPAY', '622888888888888', CardScheme::INVALID_FORMAT_ERROR), - array('CHINA_UNIONPAY', '62288888888888888888', CardScheme::INVALID_FORMAT_ERROR), - array('AMEX', '30569309025904', CardScheme::INVALID_FORMAT_ERROR), // DINERS number - array('AMEX', 'invalid', CardScheme::NOT_NUMERIC_ERROR), // A string - array('AMEX', 0, CardScheme::INVALID_FORMAT_ERROR), // a lone number - array('AMEX', '0', CardScheme::INVALID_FORMAT_ERROR), // a lone number - array('AMEX', '000000000000', CardScheme::INVALID_FORMAT_ERROR), // a lone number - array('DINERS', '3056930', CardScheme::INVALID_FORMAT_ERROR), // only first part of the number - array('DISCOVER', '1117', CardScheme::INVALID_FORMAT_ERROR), // only last 4 digits - array('MASTERCARD', '2721001234567890', CardScheme::INVALID_FORMAT_ERROR), // Not assigned yet - array('MASTERCARD', '2220991234567890', CardScheme::INVALID_FORMAT_ERROR), // Not assigned yet - ); + return [ + ['VISA', '42424242424242424242', CardScheme::INVALID_FORMAT_ERROR], + ['AMEX', '357298508610146', CardScheme::INVALID_FORMAT_ERROR], + ['DINERS', '31569309025904', CardScheme::INVALID_FORMAT_ERROR], + ['DINERS', '37088894118515', CardScheme::INVALID_FORMAT_ERROR], + ['INSTAPAYMENT', '6313440808445746', CardScheme::INVALID_FORMAT_ERROR], + ['CHINA_UNIONPAY', '622888888888888', CardScheme::INVALID_FORMAT_ERROR], + ['CHINA_UNIONPAY', '62288888888888888888', CardScheme::INVALID_FORMAT_ERROR], + ['AMEX', '30569309025904', CardScheme::INVALID_FORMAT_ERROR], // DINERS number + ['AMEX', 'invalid', CardScheme::NOT_NUMERIC_ERROR], // A string + ['AMEX', 0, CardScheme::INVALID_FORMAT_ERROR], // a lone number + ['AMEX', '0', CardScheme::INVALID_FORMAT_ERROR], // a lone number + ['AMEX', '000000000000', CardScheme::INVALID_FORMAT_ERROR], // a lone number + ['DINERS', '3056930', CardScheme::INVALID_FORMAT_ERROR], // only first part of the number + ['DISCOVER', '1117', CardScheme::INVALID_FORMAT_ERROR], // only last 4 digits + ['MASTERCARD', '2721001234567890', CardScheme::INVALID_FORMAT_ERROR], // Not assigned yet + ['MASTERCARD', '2220991234567890', CardScheme::INVALID_FORMAT_ERROR], // Not assigned yet + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/ChoiceValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/ChoiceValidatorTest.php index 01483161c9fc486117829bb8b2153dd55640188e..1f312cda170423b107ac7c06aa47e9fa0a4f4789 100644 --- a/vendor/symfony/validator/Tests/Constraints/ChoiceValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/ChoiceValidatorTest.php @@ -17,7 +17,7 @@ function choice_callback() { - return array('foo', 'bar'); + return ['foo', 'bar']; } class ChoiceValidatorTest extends ConstraintValidatorTestCase @@ -29,12 +29,12 @@ protected function createValidator() public static function staticCallback() { - return array('foo', 'bar'); + return ['foo', 'bar']; } public function objectMethodCallback() { - return array('foo', 'bar'); + return ['foo', 'bar']; } /** @@ -42,11 +42,11 @@ public function objectMethodCallback() */ public function testExpectArrayIfMultipleIsTrue() { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar'), + $constraint = new Choice([ + 'choices' => ['foo', 'bar'], 'multiple' => true, 'strict' => true, - )); + ]); $this->validator->validate('asdf', $constraint); } @@ -56,10 +56,10 @@ public function testNullIsValid() $this->validator->validate( null, new Choice( - array( - 'choices' => array('foo', 'bar'), + [ + 'choices' => ['foo', 'bar'], 'strict' => true, - ) + ] ) ); @@ -71,7 +71,7 @@ public function testNullIsValid() */ public function testChoicesOrCallbackExpected() { - $this->validator->validate('foobar', new Choice(array('strict' => true))); + $this->validator->validate('foobar', new Choice(['strict' => true])); } /** @@ -79,12 +79,12 @@ public function testChoicesOrCallbackExpected() */ public function testValidCallbackExpected() { - $this->validator->validate('foobar', new Choice(array('callback' => 'abcd', 'strict' => true))); + $this->validator->validate('foobar', new Choice(['callback' => 'abcd', 'strict' => true])); } public function testValidChoiceArray() { - $constraint = new Choice(array('choices' => array('foo', 'bar'), 'strict' => true)); + $constraint = new Choice(['choices' => ['foo', 'bar'], 'strict' => true]); $this->validator->validate('bar', $constraint); @@ -93,7 +93,7 @@ public function testValidChoiceArray() public function testValidChoiceCallbackFunction() { - $constraint = new Choice(array('callback' => __NAMESPACE__.'\choice_callback', 'strict' => true)); + $constraint = new Choice(['callback' => __NAMESPACE__.'\choice_callback', 'strict' => true]); $this->validator->validate('bar', $constraint); @@ -103,12 +103,12 @@ public function testValidChoiceCallbackFunction() public function testValidChoiceCallbackClosure() { $constraint = new Choice( - array( + [ 'strict' => true, 'callback' => function () { - return array('foo', 'bar'); + return ['foo', 'bar']; }, - ) + ] ); $this->validator->validate('bar', $constraint); @@ -118,7 +118,7 @@ public function testValidChoiceCallbackClosure() public function testValidChoiceCallbackStaticMethod() { - $constraint = new Choice(array('callback' => array(__CLASS__, 'staticCallback'), 'strict' => true)); + $constraint = new Choice(['callback' => [__CLASS__, 'staticCallback'], 'strict' => true]); $this->validator->validate('bar', $constraint); @@ -130,7 +130,7 @@ public function testValidChoiceCallbackContextMethod() // search $this for "staticCallback" $this->setObject($this); - $constraint = new Choice(array('callback' => 'staticCallback', 'strict' => true)); + $constraint = new Choice(['callback' => 'staticCallback', 'strict' => true]); $this->validator->validate('bar', $constraint); @@ -142,7 +142,7 @@ public function testValidChoiceCallbackContextObjectMethod() // search $this for "objectMethodCallback" $this->setObject($this); - $constraint = new Choice(array('callback' => 'objectMethodCallback', 'strict' => true)); + $constraint = new Choice(['callback' => 'objectMethodCallback', 'strict' => true]); $this->validator->validate('bar', $constraint); @@ -151,24 +151,24 @@ public function testValidChoiceCallbackContextObjectMethod() public function testMultipleChoices() { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar', 'baz'), + $constraint = new Choice([ + 'choices' => ['foo', 'bar', 'baz'], 'multiple' => true, 'strict' => true, - )); + ]); - $this->validator->validate(array('baz', 'bar'), $constraint); + $this->validator->validate(['baz', 'bar'], $constraint); $this->assertNoViolation(); } public function testInvalidChoice() { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar'), + $constraint = new Choice([ + 'choices' => ['foo', 'bar'], 'message' => 'myMessage', 'strict' => true, - )); + ]); $this->validator->validate('baz', $constraint); @@ -180,13 +180,13 @@ public function testInvalidChoice() public function testInvalidChoiceEmptyChoices() { - $constraint = new Choice(array( + $constraint = new Choice([ // May happen when the choices are provided dynamically, e.g. from // the DB or the model - 'choices' => array(), + 'choices' => [], 'message' => 'myMessage', 'strict' => true, - )); + ]); $this->validator->validate('baz', $constraint); @@ -198,14 +198,14 @@ public function testInvalidChoiceEmptyChoices() public function testInvalidChoiceMultiple() { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar'), + $constraint = new Choice([ + 'choices' => ['foo', 'bar'], 'multipleMessage' => 'myMessage', 'multiple' => true, 'strict' => true, - )); + ]); - $this->validator->validate(array('foo', 'baz'), $constraint); + $this->validator->validate(['foo', 'baz'], $constraint); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"baz"') @@ -216,15 +216,15 @@ public function testInvalidChoiceMultiple() public function testTooFewChoices() { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar', 'moo', 'maa'), + $constraint = new Choice([ + 'choices' => ['foo', 'bar', 'moo', 'maa'], 'multiple' => true, 'min' => 2, 'minMessage' => 'myMessage', 'strict' => true, - )); + ]); - $value = array('foo'); + $value = ['foo']; $this->setValue($value); @@ -240,15 +240,15 @@ public function testTooFewChoices() public function testTooManyChoices() { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar', 'moo', 'maa'), + $constraint = new Choice([ + 'choices' => ['foo', 'bar', 'moo', 'maa'], 'multiple' => true, 'max' => 2, 'maxMessage' => 'myMessage', 'strict' => true, - )); + ]); - $value = array('foo', 'bar', 'moo'); + $value = ['foo', 'bar', 'moo']; $this->setValue($value); @@ -267,10 +267,10 @@ public function testTooManyChoices() */ public function testNonStrict() { - $constraint = new Choice(array( - 'choices' => array(1, 2), + $constraint = new Choice([ + 'choices' => [1, 2], 'strict' => false, - )); + ]); $this->validator->validate('2', $constraint); $this->validator->validate(2, $constraint); @@ -280,10 +280,10 @@ public function testNonStrict() public function testStrictAllowsExactValue() { - $constraint = new Choice(array( - 'choices' => array(1, 2), + $constraint = new Choice([ + 'choices' => [1, 2], 'strict' => true, - )); + ]); $this->validator->validate(2, $constraint); @@ -292,11 +292,11 @@ public function testStrictAllowsExactValue() public function testStrictDisallowsDifferentType() { - $constraint = new Choice(array( - 'choices' => array(1, 2), + $constraint = new Choice([ + 'choices' => [1, 2], 'strict' => true, 'message' => 'myMessage', - )); + ]); $this->validator->validate('2', $constraint); @@ -311,27 +311,27 @@ public function testStrictDisallowsDifferentType() */ public function testNonStrictWithMultipleChoices() { - $constraint = new Choice(array( - 'choices' => array(1, 2, 3), + $constraint = new Choice([ + 'choices' => [1, 2, 3], 'multiple' => true, 'strict' => false, - )); + ]); - $this->validator->validate(array('2', 3), $constraint); + $this->validator->validate(['2', 3], $constraint); $this->assertNoViolation(); } public function testStrictWithMultipleChoices() { - $constraint = new Choice(array( - 'choices' => array(1, 2, 3), + $constraint = new Choice([ + 'choices' => [1, 2, 3], 'multiple' => true, 'strict' => true, 'multipleMessage' => 'myMessage', - )); + ]); - $this->validator->validate(array(2, '3'), $constraint); + $this->validator->validate([2, '3'], $constraint); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"3"') diff --git a/vendor/symfony/validator/Tests/Constraints/CollectionTest.php b/vendor/symfony/validator/Tests/Constraints/CollectionTest.php index b5fbf6c0b09718e98d3f8c80b2928a07902dffa9..fec935082afe47aa6b8c45d764f0f5d66a6679bd 100644 --- a/vendor/symfony/validator/Tests/Constraints/CollectionTest.php +++ b/vendor/symfony/validator/Tests/Constraints/CollectionTest.php @@ -28,9 +28,9 @@ class CollectionTest extends TestCase */ public function testRejectInvalidFieldsOption() { - new Collection(array( + new Collection([ 'fields' => 'foo', - )); + ]); } /** @@ -38,9 +38,9 @@ public function testRejectInvalidFieldsOption() */ public function testRejectNonConstraints() { - new Collection(array( + new Collection([ 'foo' => 'bar', - )); + ]); } /** @@ -48,9 +48,9 @@ public function testRejectNonConstraints() */ public function testRejectValidConstraint() { - new Collection(array( + new Collection([ 'foo' => new Valid(), - )); + ]); } /** @@ -58,9 +58,9 @@ public function testRejectValidConstraint() */ public function testRejectValidConstraintWithinOptional() { - new Collection(array( + new Collection([ 'foo' => new Optional(new Valid()), - )); + ]); } /** @@ -68,45 +68,45 @@ public function testRejectValidConstraintWithinOptional() */ public function testRejectValidConstraintWithinRequired() { - new Collection(array( + new Collection([ 'foo' => new Required(new Valid()), - )); + ]); } public function testAcceptOptionalConstraintAsOneElementArray() { - $collection1 = new Collection(array( - 'fields' => array( - 'alternate_email' => array( + $collection1 = new Collection([ + 'fields' => [ + 'alternate_email' => [ new Optional(new Email()), - ), - ), - )); + ], + ], + ]); - $collection2 = new Collection(array( - 'fields' => array( + $collection2 = new Collection([ + 'fields' => [ 'alternate_email' => new Optional(new Email()), - ), - )); + ], + ]); $this->assertEquals($collection1, $collection2); } public function testAcceptRequiredConstraintAsOneElementArray() { - $collection1 = new Collection(array( - 'fields' => array( - 'alternate_email' => array( + $collection1 = new Collection([ + 'fields' => [ + 'alternate_email' => [ new Required(new Email()), - ), - ), - )); + ], + ], + ]); - $collection2 = new Collection(array( - 'fields' => array( + $collection2 = new Collection([ + 'fields' => [ 'alternate_email' => new Required(new Email()), - ), - )); + ], + ]); $this->assertEquals($collection1, $collection2); } diff --git a/vendor/symfony/validator/Tests/Constraints/CollectionValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/CollectionValidatorTest.php index 32aa8e359e771d33bd09f0aa375c3491f3b824c4..fa2ee0985ef1a1f8cb2670bcdcbf3252776769df 100644 --- a/vendor/symfony/validator/Tests/Constraints/CollectionValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/CollectionValidatorTest.php @@ -30,24 +30,24 @@ abstract protected function prepareTestData(array $contents); public function testNullIsValid() { - $this->validator->validate(null, new Collection(array('fields' => array( - 'foo' => new Range(array('min' => 4)), - )))); + $this->validator->validate(null, new Collection(['fields' => [ + 'foo' => new Range(['min' => 4]), + ]])); $this->assertNoViolation(); } public function testFieldsAsDefaultOption() { - $constraint = new Range(array('min' => 4)); + $constraint = new Range(['min' => 4]); - $data = $this->prepareTestData(array('foo' => 'foobar')); + $data = $this->prepareTestData(['foo' => 'foobar']); - $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); + $this->expectValidateValueAt(0, '[foo]', $data['foo'], [$constraint]); - $this->validator->validate($data, new Collection(array( + $this->validator->validate($data, new Collection([ 'foo' => $constraint, - ))); + ])); $this->assertNoViolation(); } @@ -57,49 +57,49 @@ public function testFieldsAsDefaultOption() */ public function testThrowsExceptionIfNotTraversable() { - $this->validator->validate('foobar', new Collection(array('fields' => array( - 'foo' => new Range(array('min' => 4)), - )))); + $this->validator->validate('foobar', new Collection(['fields' => [ + 'foo' => new Range(['min' => 4]), + ]])); } public function testWalkSingleConstraint() { - $constraint = new Range(array('min' => 4)); + $constraint = new Range(['min' => 4]); - $array = array( + $array = [ 'foo' => 3, 'bar' => 5, - ); + ]; $i = 0; foreach ($array as $key => $value) { - $this->expectValidateValueAt($i++, '['.$key.']', $value, array($constraint)); + $this->expectValidateValueAt($i++, '['.$key.']', $value, [$constraint]); } $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate($data, new Collection([ + 'fields' => [ 'foo' => $constraint, 'bar' => $constraint, - ), - ))); + ], + ])); $this->assertNoViolation(); } public function testWalkMultipleConstraints() { - $constraints = array( - new Range(array('min' => 4)), + $constraints = [ + new Range(['min' => 4]), new NotNull(), - ); + ]; - $array = array( + $array = [ 'foo' => 3, 'bar' => 5, - ); + ]; $i = 0; @@ -109,33 +109,33 @@ public function testWalkMultipleConstraints() $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate($data, new Collection([ + 'fields' => [ 'foo' => $constraints, 'bar' => $constraints, - ), - ))); + ], + ])); $this->assertNoViolation(); } public function testExtraFieldsDisallowed() { - $constraint = new Range(array('min' => 4)); + $constraint = new Range(['min' => 4]); - $data = $this->prepareTestData(array( + $data = $this->prepareTestData([ 'foo' => 5, 'baz' => 6, - )); + ]); - $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); + $this->expectValidateValueAt(0, '[foo]', $data['foo'], [$constraint]); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate($data, new Collection([ + 'fields' => [ 'foo' => $constraint, - ), + ], 'extraFieldsMessage' => 'myMessage', - ))); + ])); $this->buildViolation('myMessage') ->setParameter('{{ field }}', '"baz"') @@ -148,56 +148,56 @@ public function testExtraFieldsDisallowed() // bug fix public function testNullNotConsideredExtraField() { - $data = $this->prepareTestData(array( + $data = $this->prepareTestData([ 'foo' => null, - )); + ]); - $constraint = new Range(array('min' => 4)); + $constraint = new Range(['min' => 4]); - $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); + $this->expectValidateValueAt(0, '[foo]', $data['foo'], [$constraint]); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate($data, new Collection([ + 'fields' => [ 'foo' => $constraint, - ), - ))); + ], + ])); $this->assertNoViolation(); } public function testExtraFieldsAllowed() { - $data = $this->prepareTestData(array( + $data = $this->prepareTestData([ 'foo' => 5, 'bar' => 6, - )); + ]); - $constraint = new Range(array('min' => 4)); + $constraint = new Range(['min' => 4]); - $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); + $this->expectValidateValueAt(0, '[foo]', $data['foo'], [$constraint]); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate($data, new Collection([ + 'fields' => [ 'foo' => $constraint, - ), + ], 'allowExtraFields' => true, - ))); + ])); $this->assertNoViolation(); } public function testMissingFieldsDisallowed() { - $data = $this->prepareTestData(array()); + $data = $this->prepareTestData([]); - $constraint = new Range(array('min' => 4)); + $constraint = new Range(['min' => 4]); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate($data, new Collection([ + 'fields' => [ 'foo' => $constraint, - ), + ], 'missingFieldsMessage' => 'myMessage', - ))); + ])); $this->buildViolation('myMessage') ->setParameter('{{ field }}', '"foo"') @@ -209,108 +209,108 @@ public function testMissingFieldsDisallowed() public function testMissingFieldsAllowed() { - $data = $this->prepareTestData(array()); + $data = $this->prepareTestData([]); - $constraint = new Range(array('min' => 4)); + $constraint = new Range(['min' => 4]); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate($data, new Collection([ + 'fields' => [ 'foo' => $constraint, - ), + ], 'allowMissingFields' => true, - ))); + ])); $this->assertNoViolation(); } public function testOptionalFieldPresent() { - $data = $this->prepareTestData(array( + $data = $this->prepareTestData([ 'foo' => null, - )); + ]); - $this->validator->validate($data, new Collection(array( + $this->validator->validate($data, new Collection([ 'foo' => new Optional(), - ))); + ])); $this->assertNoViolation(); } public function testOptionalFieldNotPresent() { - $data = $this->prepareTestData(array()); + $data = $this->prepareTestData([]); - $this->validator->validate($data, new Collection(array( + $this->validator->validate($data, new Collection([ 'foo' => new Optional(), - ))); + ])); $this->assertNoViolation(); } public function testOptionalFieldSingleConstraint() { - $array = array( + $array = [ 'foo' => 5, - ); + ]; - $constraint = new Range(array('min' => 4)); + $constraint = new Range(['min' => 4]); - $this->expectValidateValueAt(0, '[foo]', $array['foo'], array($constraint)); + $this->expectValidateValueAt(0, '[foo]', $array['foo'], [$constraint]); $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( + $this->validator->validate($data, new Collection([ 'foo' => new Optional($constraint), - ))); + ])); $this->assertNoViolation(); } public function testOptionalFieldMultipleConstraints() { - $array = array( + $array = [ 'foo' => 5, - ); + ]; - $constraints = array( + $constraints = [ new NotNull(), - new Range(array('min' => 4)), - ); + new Range(['min' => 4]), + ]; $this->expectValidateValueAt(0, '[foo]', $array['foo'], $constraints); $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( + $this->validator->validate($data, new Collection([ 'foo' => new Optional($constraints), - ))); + ])); $this->assertNoViolation(); } public function testRequiredFieldPresent() { - $data = $this->prepareTestData(array( + $data = $this->prepareTestData([ 'foo' => null, - )); + ]); - $this->validator->validate($data, new Collection(array( + $this->validator->validate($data, new Collection([ 'foo' => new Required(), - ))); + ])); $this->assertNoViolation(); } public function testRequiredFieldNotPresent() { - $data = $this->prepareTestData(array()); + $data = $this->prepareTestData([]); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate($data, new Collection([ + 'fields' => [ 'foo' => new Required(), - ), + ], 'missingFieldsMessage' => 'myMessage', - ))); + ])); $this->buildViolation('myMessage') ->setParameter('{{ field }}', '"foo"') @@ -322,63 +322,63 @@ public function testRequiredFieldNotPresent() public function testRequiredFieldSingleConstraint() { - $array = array( + $array = [ 'foo' => 5, - ); + ]; - $constraint = new Range(array('min' => 4)); + $constraint = new Range(['min' => 4]); - $this->expectValidateValueAt(0, '[foo]', $array['foo'], array($constraint)); + $this->expectValidateValueAt(0, '[foo]', $array['foo'], [$constraint]); $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( + $this->validator->validate($data, new Collection([ 'foo' => new Required($constraint), - ))); + ])); $this->assertNoViolation(); } public function testRequiredFieldMultipleConstraints() { - $array = array( + $array = [ 'foo' => 5, - ); + ]; - $constraints = array( + $constraints = [ new NotNull(), - new Range(array('min' => 4)), - ); + new Range(['min' => 4]), + ]; $this->expectValidateValueAt(0, '[foo]', $array['foo'], $constraints); $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( + $this->validator->validate($data, new Collection([ 'foo' => new Required($constraints), - ))); + ])); $this->assertNoViolation(); } public function testObjectShouldBeLeftUnchanged() { - $value = new \ArrayObject(array( + $value = new \ArrayObject([ 'foo' => 3, - )); + ]); - $constraint = new Range(array('min' => 2)); + $constraint = new Range(['min' => 2]); - $this->expectValidateValueAt(0, '[foo]', $value['foo'], array($constraint)); + $this->expectValidateValueAt(0, '[foo]', $value['foo'], [$constraint]); - $this->validator->validate($value, new Collection(array( - 'fields' => array( + $this->validator->validate($value, new Collection([ + 'fields' => [ 'foo' => $constraint, - ), - ))); + ], + ])); - $this->assertEquals(array( + $this->assertEquals([ 'foo' => 3, - ), (array) $value); + ], (array) $value); } } diff --git a/vendor/symfony/validator/Tests/Constraints/CompositeTest.php b/vendor/symfony/validator/Tests/Constraints/CompositeTest.php index df4255007c5ca66b2aff916d3fa20d2cf509554d..3070e6a22f334d9822ae2f3c6113e150620c0841 100644 --- a/vendor/symfony/validator/Tests/Constraints/CompositeTest.php +++ b/vendor/symfony/validator/Tests/Constraints/CompositeTest.php @@ -39,44 +39,44 @@ class CompositeTest extends TestCase { public function testMergeNestedGroupsIfNoExplicitParentGroup() { - $constraint = new ConcreteComposite(array( - new NotNull(array('groups' => 'Default')), - new NotBlank(array('groups' => array('Default', 'Strict'))), - )); - - $this->assertEquals(array('Default', 'Strict'), $constraint->groups); - $this->assertEquals(array('Default'), $constraint->constraints[0]->groups); - $this->assertEquals(array('Default', 'Strict'), $constraint->constraints[1]->groups); + $constraint = new ConcreteComposite([ + new NotNull(['groups' => 'Default']), + new NotBlank(['groups' => ['Default', 'Strict']]), + ]); + + $this->assertEquals(['Default', 'Strict'], $constraint->groups); + $this->assertEquals(['Default'], $constraint->constraints[0]->groups); + $this->assertEquals(['Default', 'Strict'], $constraint->constraints[1]->groups); } public function testSetImplicitNestedGroupsIfExplicitParentGroup() { - $constraint = new ConcreteComposite(array( - 'constraints' => array( + $constraint = new ConcreteComposite([ + 'constraints' => [ new NotNull(), new NotBlank(), - ), - 'groups' => array('Default', 'Strict'), - )); + ], + 'groups' => ['Default', 'Strict'], + ]); - $this->assertEquals(array('Default', 'Strict'), $constraint->groups); - $this->assertEquals(array('Default', 'Strict'), $constraint->constraints[0]->groups); - $this->assertEquals(array('Default', 'Strict'), $constraint->constraints[1]->groups); + $this->assertEquals(['Default', 'Strict'], $constraint->groups); + $this->assertEquals(['Default', 'Strict'], $constraint->constraints[0]->groups); + $this->assertEquals(['Default', 'Strict'], $constraint->constraints[1]->groups); } public function testExplicitNestedGroupsMustBeSubsetOfExplicitParentGroups() { - $constraint = new ConcreteComposite(array( - 'constraints' => array( - new NotNull(array('groups' => 'Default')), - new NotBlank(array('groups' => 'Strict')), - ), - 'groups' => array('Default', 'Strict'), - )); - - $this->assertEquals(array('Default', 'Strict'), $constraint->groups); - $this->assertEquals(array('Default'), $constraint->constraints[0]->groups); - $this->assertEquals(array('Strict'), $constraint->constraints[1]->groups); + $constraint = new ConcreteComposite([ + 'constraints' => [ + new NotNull(['groups' => 'Default']), + new NotBlank(['groups' => 'Strict']), + ], + 'groups' => ['Default', 'Strict'], + ]); + + $this->assertEquals(['Default', 'Strict'], $constraint->groups); + $this->assertEquals(['Default'], $constraint->constraints[0]->groups); + $this->assertEquals(['Strict'], $constraint->constraints[1]->groups); } /** @@ -84,26 +84,26 @@ public function testExplicitNestedGroupsMustBeSubsetOfExplicitParentGroups() */ public function testFailIfExplicitNestedGroupsNotSubsetOfExplicitParentGroups() { - new ConcreteComposite(array( - 'constraints' => array( - new NotNull(array('groups' => array('Default', 'Foobar'))), - ), - 'groups' => array('Default', 'Strict'), - )); + new ConcreteComposite([ + 'constraints' => [ + new NotNull(['groups' => ['Default', 'Foobar']]), + ], + 'groups' => ['Default', 'Strict'], + ]); } public function testImplicitGroupNamesAreForwarded() { - $constraint = new ConcreteComposite(array( - new NotNull(array('groups' => 'Default')), - new NotBlank(array('groups' => 'Strict')), - )); + $constraint = new ConcreteComposite([ + new NotNull(['groups' => 'Default']), + new NotBlank(['groups' => 'Strict']), + ]); $constraint->addImplicitGroupName('ImplicitGroup'); - $this->assertEquals(array('Default', 'Strict', 'ImplicitGroup'), $constraint->groups); - $this->assertEquals(array('Default', 'ImplicitGroup'), $constraint->constraints[0]->groups); - $this->assertEquals(array('Strict'), $constraint->constraints[1]->groups); + $this->assertEquals(['Default', 'Strict', 'ImplicitGroup'], $constraint->groups); + $this->assertEquals(['Default', 'ImplicitGroup'], $constraint->constraints[0]->groups); + $this->assertEquals(['Strict'], $constraint->constraints[1]->groups); } public function testSingleConstraintsAccepted() @@ -111,7 +111,7 @@ public function testSingleConstraintsAccepted() $nestedConstraint = new NotNull(); $constraint = new ConcreteComposite($nestedConstraint); - $this->assertEquals(array($nestedConstraint), $constraint->constraints); + $this->assertEquals([$nestedConstraint], $constraint->constraints); } /** @@ -119,10 +119,10 @@ public function testSingleConstraintsAccepted() */ public function testFailIfNoConstraint() { - new ConcreteComposite(array( - new NotNull(array('groups' => 'Default')), + new ConcreteComposite([ + new NotNull(['groups' => 'Default']), 'NotBlank', - )); + ]); } /** @@ -130,10 +130,10 @@ public function testFailIfNoConstraint() */ public function testFailIfNoConstraintObject() { - new ConcreteComposite(array( - new NotNull(array('groups' => 'Default')), + new ConcreteComposite([ + new NotNull(['groups' => 'Default']), new \ArrayObject(), - )); + ]); } /** @@ -141,8 +141,8 @@ public function testFailIfNoConstraintObject() */ public function testValidCantBeNested() { - new ConcreteComposite(array( + new ConcreteComposite([ new Valid(), - )); + ]); } } diff --git a/vendor/symfony/validator/Tests/Constraints/CountValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/CountValidatorTest.php index d23188a09821345e8cd1a8dde8eb849f15c12bc1..8416136fd4af32fed904869169a40a0919ed7fa9 100644 --- a/vendor/symfony/validator/Tests/Constraints/CountValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/CountValidatorTest.php @@ -44,29 +44,29 @@ public function testExpectsCountableType() public function getThreeOrLessElements() { - return array( - array($this->createCollection(array(1))), - array($this->createCollection(array(1, 2))), - array($this->createCollection(array(1, 2, 3))), - array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3))), - ); + return [ + [$this->createCollection([1])], + [$this->createCollection([1, 2])], + [$this->createCollection([1, 2, 3])], + [$this->createCollection(['a' => 1, 'b' => 2, 'c' => 3])], + ]; } public function getFourElements() { - return array( - array($this->createCollection(array(1, 2, 3, 4))), - array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4))), - ); + return [ + [$this->createCollection([1, 2, 3, 4])], + [$this->createCollection(['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4])], + ]; } public function getFiveOrMoreElements() { - return array( - array($this->createCollection(array(1, 2, 3, 4, 5))), - array($this->createCollection(array(1, 2, 3, 4, 5, 6))), - array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5))), - ); + return [ + [$this->createCollection([1, 2, 3, 4, 5])], + [$this->createCollection([1, 2, 3, 4, 5, 6])], + [$this->createCollection(['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5])], + ]; } /** @@ -74,7 +74,7 @@ public function getFiveOrMoreElements() */ public function testValidValuesMax($value) { - $constraint = new Count(array('max' => 3)); + $constraint = new Count(['max' => 3]); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -85,7 +85,7 @@ public function testValidValuesMax($value) */ public function testValidValuesMin($value) { - $constraint = new Count(array('min' => 5)); + $constraint = new Count(['min' => 5]); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -107,10 +107,10 @@ public function testValidValuesExact($value) */ public function testTooManyValues($value) { - $constraint = new Count(array( + $constraint = new Count([ 'max' => 4, 'maxMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -128,10 +128,10 @@ public function testTooManyValues($value) */ public function testTooFewValues($value) { - $constraint = new Count(array( + $constraint = new Count([ 'min' => 4, 'minMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -149,11 +149,11 @@ public function testTooFewValues($value) */ public function testTooManyValuesExact($value) { - $constraint = new Count(array( + $constraint = new Count([ 'min' => 4, 'max' => 4, 'exactMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -171,11 +171,11 @@ public function testTooManyValuesExact($value) */ public function testTooFewValuesExact($value) { - $constraint = new Count(array( + $constraint = new Count([ 'min' => 4, 'max' => 4, 'exactMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/CountryValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/CountryValidatorTest.php index 044a742db630a3e11513bfdb0e9664710238e825..23c528363000a9a3a538edef079b4e1aa3ab31d1 100644 --- a/vendor/symfony/validator/Tests/Constraints/CountryValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/CountryValidatorTest.php @@ -57,11 +57,11 @@ public function testValidCountries($country) public function getValidCountries() { - return array( - array('GB'), - array('AT'), - array('MY'), - ); + return [ + ['GB'], + ['AT'], + ['MY'], + ]; } /** @@ -69,9 +69,9 @@ public function getValidCountries() */ public function testInvalidCountries($country) { - $constraint = new Country(array( + $constraint = new Country([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($country, $constraint); @@ -83,10 +83,10 @@ public function testInvalidCountries($country) public function getInvalidCountries() { - return array( - array('foobar'), - array('EN'), - ); + return [ + ['foobar'], + ['EN'], + ]; } public function testValidateUsingCountrySpecificLocale() diff --git a/vendor/symfony/validator/Tests/Constraints/CurrencyValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/CurrencyValidatorTest.php index 1286ff31f89f317e5c4450104f50a5b6aebce16b..c699f851f26f557aed45f21ecf07daecaf248298 100644 --- a/vendor/symfony/validator/Tests/Constraints/CurrencyValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/CurrencyValidatorTest.php @@ -71,13 +71,13 @@ public function testValidCurrenciesWithCountrySpecificLocale($currency) public function getValidCurrencies() { - return array( - array('EUR'), - array('USD'), - array('SIT'), - array('AUD'), - array('CAD'), - ); + return [ + ['EUR'], + ['USD'], + ['SIT'], + ['AUD'], + ['CAD'], + ]; } /** @@ -85,9 +85,9 @@ public function getValidCurrencies() */ public function testInvalidCurrencies($currency) { - $constraint = new Currency(array( + $constraint = new Currency([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($currency, $constraint); @@ -99,9 +99,9 @@ public function testInvalidCurrencies($currency) public function getInvalidCurrencies() { - return array( - array('EN'), - array('foobar'), - ); + return [ + ['EN'], + ['foobar'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/DateTimeValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/DateTimeValidatorTest.php index fe553100339f838d9202197b5546642976223643..6a8fa15b42030abcab148c10edb5c318c08716a2 100644 --- a/vendor/symfony/validator/Tests/Constraints/DateTimeValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/DateTimeValidatorTest.php @@ -77,9 +77,9 @@ public function testDateTimeWithDefaultFormat() */ public function testValidDateTimes($format, $dateTime) { - $constraint = new DateTime(array( + $constraint = new DateTime([ 'format' => $format, - )); + ]); $this->validator->validate($dateTime, $constraint); @@ -88,13 +88,13 @@ public function testValidDateTimes($format, $dateTime) public function getValidDateTimes() { - return array( - array('Y-m-d H:i:s e', '1995-03-24 00:00:00 UTC'), - array('Y-m-d H:i:s', '2010-01-01 01:02:03'), - array('Y/m/d H:i', '2010/01/01 01:02'), - array('F d, Y', 'December 31, 1999'), - array('d-m-Y', '10-05-1995'), - ); + return [ + ['Y-m-d H:i:s e', '1995-03-24 00:00:00 UTC'], + ['Y-m-d H:i:s', '2010-01-01 01:02:03'], + ['Y/m/d H:i', '2010/01/01 01:02'], + ['F d, Y', 'December 31, 1999'], + ['d-m-Y', '10-05-1995'], + ]; } /** @@ -102,10 +102,10 @@ public function getValidDateTimes() */ public function testInvalidDateTimes($format, $dateTime, $code) { - $constraint = new DateTime(array( + $constraint = new DateTime([ 'message' => 'myMessage', 'format' => $format, - )); + ]); $this->validator->validate($dateTime, $constraint); @@ -117,17 +117,17 @@ public function testInvalidDateTimes($format, $dateTime, $code) public function getInvalidDateTimes() { - return array( - array('Y-m-d', 'foobar', DateTime::INVALID_FORMAT_ERROR), - array('H:i', '00:00:00', DateTime::INVALID_FORMAT_ERROR), - array('Y-m-d', '2010-01-01 00:00', DateTime::INVALID_FORMAT_ERROR), - array('Y-m-d e', '2010-01-01 TCU', DateTime::INVALID_FORMAT_ERROR), - array('Y-m-d H:i:s', '2010-13-01 00:00:00', DateTime::INVALID_DATE_ERROR), - array('Y-m-d H:i:s', '2010-04-32 00:00:00', DateTime::INVALID_DATE_ERROR), - array('Y-m-d H:i:s', '2010-02-29 00:00:00', DateTime::INVALID_DATE_ERROR), - array('Y-m-d H:i:s', '2010-01-01 24:00:00', DateTime::INVALID_TIME_ERROR), - array('Y-m-d H:i:s', '2010-01-01 00:60:00', DateTime::INVALID_TIME_ERROR), - array('Y-m-d H:i:s', '2010-01-01 00:00:60', DateTime::INVALID_TIME_ERROR), - ); + return [ + ['Y-m-d', 'foobar', DateTime::INVALID_FORMAT_ERROR], + ['H:i', '00:00:00', DateTime::INVALID_FORMAT_ERROR], + ['Y-m-d', '2010-01-01 00:00', DateTime::INVALID_FORMAT_ERROR], + ['Y-m-d e', '2010-01-01 TCU', DateTime::INVALID_FORMAT_ERROR], + ['Y-m-d H:i:s', '2010-13-01 00:00:00', DateTime::INVALID_DATE_ERROR], + ['Y-m-d H:i:s', '2010-04-32 00:00:00', DateTime::INVALID_DATE_ERROR], + ['Y-m-d H:i:s', '2010-02-29 00:00:00', DateTime::INVALID_DATE_ERROR], + ['Y-m-d H:i:s', '2010-01-01 24:00:00', DateTime::INVALID_TIME_ERROR], + ['Y-m-d H:i:s', '2010-01-01 00:60:00', DateTime::INVALID_TIME_ERROR], + ['Y-m-d H:i:s', '2010-01-01 00:00:60', DateTime::INVALID_TIME_ERROR], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/DateValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/DateValidatorTest.php index 3b2b189a5521524de8fb699f9980686974617c02..0e0114f0ae650b8dd95f24040f202bcb63b45ed7 100644 --- a/vendor/symfony/validator/Tests/Constraints/DateValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/DateValidatorTest.php @@ -70,11 +70,11 @@ public function testValidDates($date) public function getValidDates() { - return array( - array('2010-01-01'), - array('1955-12-12'), - array('2030-05-31'), - ); + return [ + ['2010-01-01'], + ['1955-12-12'], + ['2030-05-31'], + ]; } /** @@ -82,9 +82,9 @@ public function getValidDates() */ public function testInvalidDates($date, $code) { - $constraint = new Date(array( + $constraint = new Date([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($date, $constraint); @@ -96,13 +96,13 @@ public function testInvalidDates($date, $code) public function getInvalidDates() { - return array( - array('foobar', Date::INVALID_FORMAT_ERROR), - array('foobar 2010-13-01', Date::INVALID_FORMAT_ERROR), - array('2010-13-01 foobar', Date::INVALID_FORMAT_ERROR), - array('2010-13-01', Date::INVALID_DATE_ERROR), - array('2010-04-32', Date::INVALID_DATE_ERROR), - array('2010-02-29', Date::INVALID_DATE_ERROR), - ); + return [ + ['foobar', Date::INVALID_FORMAT_ERROR], + ['foobar 2010-13-01', Date::INVALID_FORMAT_ERROR], + ['2010-13-01 foobar', Date::INVALID_FORMAT_ERROR], + ['2010-13-01', Date::INVALID_DATE_ERROR], + ['2010-04-32', Date::INVALID_DATE_ERROR], + ['2010-02-29', Date::INVALID_DATE_ERROR], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/EmailValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/EmailValidatorTest.php index ff6d5c466c3641917f191a8e2a9f279b5a68f757..60cf10e4cac84be434af22bd045723860e6614ba 100644 --- a/vendor/symfony/validator/Tests/Constraints/EmailValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/EmailValidatorTest.php @@ -60,11 +60,11 @@ public function testValidEmails($email) public function getValidEmails() { - return array( - array('fabien@symfony.com'), - array('example@example.co.uk'), - array('fabien_potencier@example.fr'), - ); + return [ + ['fabien@symfony.com'], + ['example@example.co.uk'], + ['fabien_potencier@example.fr'], + ]; } /** @@ -72,9 +72,9 @@ public function getValidEmails() */ public function testInvalidEmails($email) { - $constraint = new Email(array( + $constraint = new Email([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($email, $constraint); @@ -86,17 +86,17 @@ public function testInvalidEmails($email) public function getInvalidEmails() { - return array( - array('example'), - array('example@'), - array('example@localhost'), - array('foo@example.com bar'), - ); + return [ + ['example'], + ['example@'], + ['example@localhost'], + ['foo@example.com bar'], + ]; } public function testStrict() { - $constraint = new Email(array('strict' => true)); + $constraint = new Email(['strict' => true]); $this->validator->validate('example@localhost', $constraint); @@ -108,10 +108,10 @@ public function testStrict() */ public function testStrictWithInvalidEmails($email) { - $constraint = new Email(array( + $constraint = new Email([ 'message' => 'myMessage', 'strict' => true, - )); + ]); $this->validator->validate($email, $constraint); @@ -127,55 +127,55 @@ public function testStrictWithInvalidEmails($email) */ public function getInvalidEmailsForStrictChecks() { - return array( - array('test@example.com test'), - array('user name@example.com'), - array('user name@example.com'), - array('example.@example.co.uk'), - array('example@example@example.co.uk'), - array('(test_exampel@example.fr)'), - array('example(example)example@example.co.uk'), - array('.example@localhost'), - array('ex\ample@localhost'), - array('example@local\host'), - array('example@localhost.'), - array('user name@example.com'), - array('username@ example . com'), - array('example@(fake).com'), - array('example@(fake.com'), - array('username@example,com'), - array('usern,ame@example.com'), - array('user[na]me@example.com'), - array('"""@iana.org'), - array('"\"@iana.org'), - array('"test"test@iana.org'), - array('"test""test"@iana.org'), - array('"test"."test"@iana.org'), - array('"test".test@iana.org'), - array('"test"'.\chr(0).'@iana.org'), - array('"test\"@iana.org'), - array(\chr(226).'@iana.org'), - array('test@'.\chr(226).'.org'), - array('\r\ntest@iana.org'), - array('\r\n test@iana.org'), - array('\r\n \r\ntest@iana.org'), - array('\r\n \r\ntest@iana.org'), - array('\r\n \r\n test@iana.org'), - array('test@iana.org \r\n'), - array('test@iana.org \r\n '), - array('test@iana.org \r\n \r\n'), - array('test@iana.org \r\n\r\n'), - array('test@iana.org \r\n\r\n '), - array('test@iana/icann.org'), - array('test@foo;bar.com'), - array('test;123@foobar.com'), - array('test@example..com'), - array('email.email@email."'), - array('test@email>'), - array('test@email<'), - array('test@email{'), - array(str_repeat('x', 254).'@example.com'), //email with warnings - ); + return [ + ['test@example.com test'], + ['user name@example.com'], + ['user name@example.com'], + ['example.@example.co.uk'], + ['example@example@example.co.uk'], + ['(test_exampel@example.fr)'], + ['example(example)example@example.co.uk'], + ['.example@localhost'], + ['ex\ample@localhost'], + ['example@local\host'], + ['example@localhost.'], + ['user name@example.com'], + ['username@ example . com'], + ['example@(fake).com'], + ['example@(fake.com'], + ['username@example,com'], + ['usern,ame@example.com'], + ['user[na]me@example.com'], + ['"""@iana.org'], + ['"\"@iana.org'], + ['"test"test@iana.org'], + ['"test""test"@iana.org'], + ['"test"."test"@iana.org'], + ['"test".test@iana.org'], + ['"test"'.\chr(0).'@iana.org'], + ['"test\"@iana.org'], + [\chr(226).'@iana.org'], + ['test@'.\chr(226).'.org'], + ['\r\ntest@iana.org'], + ['\r\n test@iana.org'], + ['\r\n \r\ntest@iana.org'], + ['\r\n \r\ntest@iana.org'], + ['\r\n \r\n test@iana.org'], + ['test@iana.org \r\n'], + ['test@iana.org \r\n '], + ['test@iana.org \r\n \r\n'], + ['test@iana.org \r\n\r\n'], + ['test@iana.org \r\n\r\n '], + ['test@iana/icann.org'], + ['test@foo;bar.com'], + ['test;123@foobar.com'], + ['test@example..com'], + ['email.email@email."'], + ['test@email>'], + ['test@email<'], + ['test@email{'], + [str_repeat('x', 254).'@example.com'], //email with warnings + ]; } /** @@ -184,12 +184,12 @@ public function getInvalidEmailsForStrictChecks() */ public function testDnsChecks($type, $violation) { - DnsMock::withMockedHosts(array('example.com' => array(array('type' => $violation ? false : $type)))); + DnsMock::withMockedHosts(['example.com' => [['type' => $violation ? false : $type]]]); - $constraint = new Email(array( + $constraint = new Email([ 'message' => 'myMessage', 'MX' === $type ? 'checkMX' : 'checkHost' => true, - )); + ]); $this->validator->validate('foo@example.com', $constraint); @@ -205,14 +205,14 @@ public function testDnsChecks($type, $violation) public function getDnsChecks() { - return array( - array('MX', false), - array('MX', Email::MX_CHECK_FAILED_ERROR), - array('A', false), - array('A', Email::HOST_CHECK_FAILED_ERROR), - array('AAAA', false), - array('AAAA', Email::HOST_CHECK_FAILED_ERROR), - ); + return [ + ['MX', false], + ['MX', Email::MX_CHECK_FAILED_ERROR], + ['A', false], + ['A', Email::HOST_CHECK_FAILED_ERROR], + ['AAAA', false], + ['AAAA', Email::HOST_CHECK_FAILED_ERROR], + ]; } /** @@ -220,11 +220,11 @@ public function getDnsChecks() */ public function testHostnameIsProperlyParsed() { - DnsMock::withMockedHosts(array('baz.com' => array(array('type' => 'MX')))); + DnsMock::withMockedHosts(['baz.com' => [['type' => 'MX']]]); $this->validator->validate( '"foo@bar"@baz.com', - new Email(array('checkMX' => true)) + new Email(['checkMX' => true]) ); $this->assertNoViolation(); @@ -237,10 +237,10 @@ public function testEmptyHostIsNotValid($checkType, $violation) { $this->validator->validate( 'foo@bar.fr@', - new Email(array( + new Email([ 'message' => 'myMessage', $checkType => true, - )) + ]) ); $this @@ -252,9 +252,9 @@ public function testEmptyHostIsNotValid($checkType, $violation) public function provideCheckTypes() { - return array( - array('checkMX', Email::MX_CHECK_FAILED_ERROR), - array('checkHost', Email::HOST_CHECK_FAILED_ERROR), - ); + return [ + ['checkMX', Email::MX_CHECK_FAILED_ERROR], + ['checkHost', Email::HOST_CHECK_FAILED_ERROR], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/EqualToValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/EqualToValidatorTest.php index e47de8fce2e59395363391534ef6fae5334515cc..c1eb2f93ad75416c8eefb7f3758bf1f1cf11e2c0 100644 --- a/vendor/symfony/validator/Tests/Constraints/EqualToValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/EqualToValidatorTest.php @@ -39,16 +39,16 @@ protected function getErrorCode() */ public function provideValidComparisons() { - return array( - array(3, 3), - array(3, '3'), - array('a', 'a'), - array(new \DateTime('2000-01-01'), new \DateTime('2000-01-01')), - array(new \DateTime('2000-01-01'), '2000-01-01'), - array(new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'), - array(new ComparisonTest_Class(5), new ComparisonTest_Class(5)), - array(null, 1), - ); + return [ + [3, 3], + [3, '3'], + ['a', 'a'], + [new \DateTime('2000-01-01'), new \DateTime('2000-01-01')], + [new \DateTime('2000-01-01'), '2000-01-01'], + [new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'], + [new ComparisonTest_Class(5), new ComparisonTest_Class(5)], + [null, 1], + ]; } /** @@ -56,9 +56,9 @@ public function provideValidComparisons() */ public function provideValidComparisonsToPropertyPath() { - return array( - array(5), - ); + return [ + [5], + ]; } /** @@ -66,13 +66,13 @@ public function provideValidComparisonsToPropertyPath() */ public function provideInvalidComparisons() { - return array( - array(1, '1', 2, '2', 'integer'), - array('22', '"22"', '333', '"333"', 'string'), - array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2001-01-01 UTC'), 'Jan 1, 2001, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - ); + return [ + [1, '1', 2, '2', 'integer'], + ['22', '"22"', '333', '"333"', 'string'], + [new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2001-01-01 UTC'), 'Jan 1, 2001, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/ExpressionValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/ExpressionValidatorTest.php index 07f17d648aa39ef0c4df15d47977ee3017573a19..5cffcefd527269eca08d3f8b97c61c35547477fc 100644 --- a/vendor/symfony/validator/Tests/Constraints/ExpressionValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/ExpressionValidatorTest.php @@ -26,10 +26,10 @@ protected function createValidator() public function testExpressionIsEvaluatedWithNullValue() { - $constraint = new Expression(array( + $constraint = new Expression([ 'expression' => 'false', 'message' => 'myMessage', - )); + ]); $this->validator->validate(null, $constraint); @@ -41,10 +41,10 @@ public function testExpressionIsEvaluatedWithNullValue() public function testExpressionIsEvaluatedWithEmptyStringValue() { - $constraint = new Expression(array( + $constraint = new Expression([ 'expression' => 'false', 'message' => 'myMessage', - )); + ]); $this->validator->validate('', $constraint); @@ -70,10 +70,10 @@ public function testSucceedingExpressionAtObjectLevel() public function testFailingExpressionAtObjectLevel() { - $constraint = new Expression(array( + $constraint = new Expression([ 'expression' => 'this.data == 1', 'message' => 'myMessage', - )); + ]); $object = new Entity(); $object->data = '2'; @@ -104,10 +104,10 @@ public function testSucceedingExpressionAtObjectLevelWithToString() public function testFailingExpressionAtObjectLevelWithToString() { - $constraint = new Expression(array( + $constraint = new Expression([ 'expression' => 'this.data == 1', 'message' => 'myMessage', - )); + ]); $object = new ToString(); $object->data = '2'; @@ -140,10 +140,10 @@ public function testSucceedingExpressionAtPropertyLevel() public function testFailingExpressionAtPropertyLevel() { - $constraint = new Expression(array( + $constraint = new Expression([ 'expression' => 'value == this.data', 'message' => 'myMessage', - )); + ]); $object = new Entity(); $object->data = '1'; @@ -182,10 +182,10 @@ public function testSucceedingExpressionAtNestedPropertyLevel() public function testFailingExpressionAtNestedPropertyLevel() { - $constraint = new Expression(array( + $constraint = new Expression([ 'expression' => 'value == this.data', 'message' => 'myMessage', - )); + ]); $object = new Entity(); $object->data = '1'; @@ -229,10 +229,10 @@ public function testSucceedingExpressionAtPropertyLevelWithoutRoot() */ public function testFailingExpressionAtPropertyLevelWithoutRoot() { - $constraint = new Expression(array( + $constraint = new Expression([ 'expression' => 'value == "1"', 'message' => 'myMessage', - )); + ]); $this->setRoot('2'); $this->setPropertyPath(''); @@ -249,9 +249,9 @@ public function testFailingExpressionAtPropertyLevelWithoutRoot() public function testExpressionLanguageUsage() { - $constraint = new Expression(array( + $constraint = new Expression([ 'expression' => 'false', - )); + ]); $expressionLanguage = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ExpressionLanguage')->getMock(); diff --git a/vendor/symfony/validator/Tests/Constraints/FileTest.php b/vendor/symfony/validator/Tests/Constraints/FileTest.php index b7745f44fa13a2bc19b0461e3291601c90e1fe44..d3117ed44a2458beebf2f6adaa40858816c4bc5f 100644 --- a/vendor/symfony/validator/Tests/Constraints/FileTest.php +++ b/vendor/symfony/validator/Tests/Constraints/FileTest.php @@ -22,7 +22,7 @@ class FileTest extends TestCase */ public function testMaxSize($maxSize, $bytes, $binaryFormat) { - $file = new File(array('maxSize' => $maxSize)); + $file = new File(['maxSize' => $maxSize]); $this->assertSame($bytes, $file->maxSize); $this->assertSame($binaryFormat, $file->binaryFormat); @@ -31,7 +31,7 @@ public function testMaxSize($maxSize, $bytes, $binaryFormat) public function testMagicIsset() { - $file = new File(array('maxSize' => 1)); + $file = new File(['maxSize' => 1]); $this->assertTrue($file->__isset('maxSize')); $this->assertTrue($file->__isset('groups')); @@ -56,7 +56,7 @@ public function testMaxSizeCanBeSetAfterInitialization($maxSize, $bytes, $binary */ public function testInvalidValueForMaxSizeThrowsExceptionAfterInitialization($maxSize) { - $file = new File(array('maxSize' => 1000)); + $file = new File(['maxSize' => 1000]); $file->maxSize = $maxSize; } @@ -65,7 +65,7 @@ public function testInvalidValueForMaxSizeThrowsExceptionAfterInitialization($ma */ public function testMaxSizeCannotBeSetToInvalidValueAfterInitialization($maxSize) { - $file = new File(array('maxSize' => 1000)); + $file = new File(['maxSize' => 1000]); try { $file->maxSize = $maxSize; @@ -81,35 +81,35 @@ public function testMaxSizeCannotBeSetToInvalidValueAfterInitialization($maxSize */ public function testInvalidMaxSize($maxSize) { - new File(array('maxSize' => $maxSize)); + new File(['maxSize' => $maxSize]); } public function provideValidSizes() { - return array( - array('500', 500, false), - array(12300, 12300, false), - array('1ki', 1024, true), - array('1KI', 1024, true), - array('2k', 2000, false), - array('2K', 2000, false), - array('1mi', 1048576, true), - array('1MI', 1048576, true), - array('3m', 3000000, false), - array('3M', 3000000, false), - ); + return [ + ['500', 500, false], + [12300, 12300, false], + ['1ki', 1024, true], + ['1KI', 1024, true], + ['2k', 2000, false], + ['2K', 2000, false], + ['1mi', 1048576, true], + ['1MI', 1048576, true], + ['3m', 3000000, false], + ['3M', 3000000, false], + ]; } public function provideInvalidSizes() { - return array( - array('+100'), - array('foo'), - array('1Ko'), - array('1kio'), - array('1G'), - array('1Gi'), - ); + return [ + ['+100'], + ['foo'], + ['1Ko'], + ['1kio'], + ['1G'], + ['1Gi'], + ]; } /** @@ -117,23 +117,23 @@ public function provideInvalidSizes() */ public function testBinaryFormat($maxSize, $guessedFormat, $binaryFormat) { - $file = new File(array('maxSize' => $maxSize, 'binaryFormat' => $guessedFormat)); + $file = new File(['maxSize' => $maxSize, 'binaryFormat' => $guessedFormat]); $this->assertSame($binaryFormat, $file->binaryFormat); } public function provideFormats() { - return array( - array(100, null, false), - array(100, true, true), - array(100, false, false), - array('100K', null, false), - array('100K', true, true), - array('100K', false, false), - array('100Ki', null, true), - array('100Ki', true, true), - array('100Ki', false, false), - ); + return [ + [100, null, false], + [100, true, true], + [100, false, false], + ['100K', null, false], + ['100K', true, true], + ['100K', false, false], + ['100Ki', null, true], + ['100Ki', true, true], + ['100Ki', false, false], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/FileValidatorPathTest.php b/vendor/symfony/validator/Tests/Constraints/FileValidatorPathTest.php index 11b8d4cb7987ce347d25f384c9e2ddf3e7bfd84a..dfd82f15ccf4d26dee29e5c1a53c4b5a5ecd2b75 100644 --- a/vendor/symfony/validator/Tests/Constraints/FileValidatorPathTest.php +++ b/vendor/symfony/validator/Tests/Constraints/FileValidatorPathTest.php @@ -22,9 +22,9 @@ protected function getFile($filename) public function testFileNotFound() { - $constraint = new File(array( + $constraint = new File([ 'notFoundMessage' => 'myMessage', - )); + ]); $this->validator->validate('foobar', $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php index 3db3302ac2c96581c8d1a5bc6a46fdb8fc3c34c6..b3428e77828ce8bda63dbc7f87c33a06907fb97d 100644 --- a/vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php @@ -115,44 +115,44 @@ public function provideMaxSizeExceededTests() // same unit used to specify the limit. // As of Symfony 2.5, the above logic is implemented. - return array( + return [ // limit in bytes - array(1001, 1000, '1001', '1000', 'bytes'), - array(1004, 1000, '1004', '1000', 'bytes'), - array(1005, 1000, '1.01', '1', 'kB'), + [1001, 1000, '1001', '1000', 'bytes'], + [1004, 1000, '1004', '1000', 'bytes'], + [1005, 1000, '1.01', '1', 'kB'], - array(1000001, 1000000, '1000001', '1000000', 'bytes'), - array(1004999, 1000000, '1005', '1000', 'kB'), - array(1005000, 1000000, '1.01', '1', 'MB'), + [1000001, 1000000, '1000001', '1000000', 'bytes'], + [1004999, 1000000, '1005', '1000', 'kB'], + [1005000, 1000000, '1.01', '1', 'MB'], // limit in kB - array(1001, '1k', '1001', '1000', 'bytes'), - array(1004, '1k', '1004', '1000', 'bytes'), - array(1005, '1k', '1.01', '1', 'kB'), + [1001, '1k', '1001', '1000', 'bytes'], + [1004, '1k', '1004', '1000', 'bytes'], + [1005, '1k', '1.01', '1', 'kB'], - array(1000001, '1000k', '1000001', '1000000', 'bytes'), - array(1004999, '1000k', '1005', '1000', 'kB'), - array(1005000, '1000k', '1.01', '1', 'MB'), + [1000001, '1000k', '1000001', '1000000', 'bytes'], + [1004999, '1000k', '1005', '1000', 'kB'], + [1005000, '1000k', '1.01', '1', 'MB'], // limit in MB - array(1000001, '1M', '1000001', '1000000', 'bytes'), - array(1004999, '1M', '1005', '1000', 'kB'), - array(1005000, '1M', '1.01', '1', 'MB'), + [1000001, '1M', '1000001', '1000000', 'bytes'], + [1004999, '1M', '1005', '1000', 'kB'], + [1005000, '1M', '1.01', '1', 'MB'], // limit in KiB - array(1025, '1Ki', '1025', '1024', 'bytes'), - array(1029, '1Ki', '1029', '1024', 'bytes'), - array(1030, '1Ki', '1.01', '1', 'KiB'), + [1025, '1Ki', '1025', '1024', 'bytes'], + [1029, '1Ki', '1029', '1024', 'bytes'], + [1030, '1Ki', '1.01', '1', 'KiB'], - array(1048577, '1024Ki', '1048577', '1048576', 'bytes'), - array(1053818, '1024Ki', '1029.12', '1024', 'KiB'), - array(1053819, '1024Ki', '1.01', '1', 'MiB'), + [1048577, '1024Ki', '1048577', '1048576', 'bytes'], + [1053818, '1024Ki', '1029.12', '1024', 'KiB'], + [1053819, '1024Ki', '1.01', '1', 'MiB'], // limit in MiB - array(1048577, '1Mi', '1048577', '1048576', 'bytes'), - array(1053818, '1Mi', '1029.12', '1024', 'KiB'), - array(1053819, '1Mi', '1.01', '1', 'MiB'), - ); + [1048577, '1Mi', '1048577', '1048576', 'bytes'], + [1053818, '1Mi', '1029.12', '1024', 'KiB'], + [1053819, '1Mi', '1.01', '1', 'MiB'], + ]; } /** @@ -164,10 +164,10 @@ public function testMaxSizeExceeded($bytesWritten, $limit, $sizeAsString, $limit fwrite($this->file, '0'); fclose($this->file); - $constraint = new File(array( + $constraint = new File([ 'maxSize' => $limit, 'maxSizeMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->getFile($this->path), $constraint); @@ -182,25 +182,25 @@ public function testMaxSizeExceeded($bytesWritten, $limit, $sizeAsString, $limit public function provideMaxSizeNotExceededTests() { - return array( + return [ // limit in bytes - array(1000, 1000), - array(1000000, 1000000), + [1000, 1000], + [1000000, 1000000], // limit in kB - array(1000, '1k'), - array(1000000, '1000k'), + [1000, '1k'], + [1000000, '1000k'], // limit in MB - array(1000000, '1M'), + [1000000, '1M'], // limit in KiB - array(1024, '1Ki'), - array(1048576, '1024Ki'), + [1024, '1Ki'], + [1048576, '1024Ki'], // limit in MiB - array(1048576, '1Mi'), - ); + [1048576, '1Mi'], + ]; } /** @@ -212,10 +212,10 @@ public function testMaxSizeNotExceeded($bytesWritten, $limit) fwrite($this->file, '0'); fclose($this->file); - $constraint = new File(array( + $constraint = new File([ 'maxSize' => $limit, 'maxSizeMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->getFile($this->path), $constraint); @@ -227,33 +227,33 @@ public function testMaxSizeNotExceeded($bytesWritten, $limit) */ public function testInvalidMaxSize() { - $constraint = new File(array( + $constraint = new File([ 'maxSize' => '1abc', - )); + ]); $this->validator->validate($this->path, $constraint); } public function provideBinaryFormatTests() { - return array( - array(11, 10, null, '11', '10', 'bytes'), - array(11, 10, true, '11', '10', 'bytes'), - array(11, 10, false, '11', '10', 'bytes'), + return [ + [11, 10, null, '11', '10', 'bytes'], + [11, 10, true, '11', '10', 'bytes'], + [11, 10, false, '11', '10', 'bytes'], // round(size) == 1.01kB, limit == 1kB - array(ceil(1000 * 1.01), 1000, null, '1.01', '1', 'kB'), - array(ceil(1000 * 1.01), '1k', null, '1.01', '1', 'kB'), - array(ceil(1024 * 1.01), '1Ki', null, '1.01', '1', 'KiB'), - - array(ceil(1024 * 1.01), 1024, true, '1.01', '1', 'KiB'), - array(ceil(1024 * 1.01 * 1000), '1024k', true, '1010', '1000', 'KiB'), - array(ceil(1024 * 1.01), '1Ki', true, '1.01', '1', 'KiB'), - - array(ceil(1000 * 1.01), 1000, false, '1.01', '1', 'kB'), - array(ceil(1000 * 1.01), '1k', false, '1.01', '1', 'kB'), - array(ceil(1024 * 1.01 * 10), '10Ki', false, '10.34', '10.24', 'kB'), - ); + [ceil(1000 * 1.01), 1000, null, '1.01', '1', 'kB'], + [ceil(1000 * 1.01), '1k', null, '1.01', '1', 'kB'], + [ceil(1024 * 1.01), '1Ki', null, '1.01', '1', 'KiB'], + + [ceil(1024 * 1.01), 1024, true, '1.01', '1', 'KiB'], + [ceil(1024 * 1.01 * 1000), '1024k', true, '1010', '1000', 'KiB'], + [ceil(1024 * 1.01), '1Ki', true, '1.01', '1', 'KiB'], + + [ceil(1000 * 1.01), 1000, false, '1.01', '1', 'kB'], + [ceil(1000 * 1.01), '1k', false, '1.01', '1', 'kB'], + [ceil(1024 * 1.01 * 10), '10Ki', false, '10.34', '10.24', 'kB'], + ]; } /** @@ -265,11 +265,11 @@ public function testBinaryFormat($bytesWritten, $limit, $binaryFormat, $sizeAsSt fwrite($this->file, '0'); fclose($this->file); - $constraint = new File(array( + $constraint = new File([ 'maxSize' => $limit, 'binaryFormat' => $binaryFormat, 'maxSizeMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->getFile($this->path), $constraint); @@ -286,7 +286,7 @@ public function testValidMimeType() { $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) + ->setConstructorArgs([__DIR__.'/Fixtures/foo']) ->getMock(); $file ->expects($this->once()) @@ -297,9 +297,9 @@ public function testValidMimeType() ->method('getMimeType') ->will($this->returnValue('image/jpg')); - $constraint = new File(array( - 'mimeTypes' => array('image/png', 'image/jpg'), - )); + $constraint = new File([ + 'mimeTypes' => ['image/png', 'image/jpg'], + ]); $this->validator->validate($file, $constraint); @@ -310,7 +310,7 @@ public function testValidWildcardMimeType() { $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) + ->setConstructorArgs([__DIR__.'/Fixtures/foo']) ->getMock(); $file ->expects($this->once()) @@ -321,9 +321,9 @@ public function testValidWildcardMimeType() ->method('getMimeType') ->will($this->returnValue('image/jpg')); - $constraint = new File(array( - 'mimeTypes' => array('image/*'), - )); + $constraint = new File([ + 'mimeTypes' => ['image/*'], + ]); $this->validator->validate($file, $constraint); @@ -334,7 +334,7 @@ public function testInvalidMimeType() { $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) + ->setConstructorArgs([__DIR__.'/Fixtures/foo']) ->getMock(); $file ->expects($this->once()) @@ -345,10 +345,10 @@ public function testInvalidMimeType() ->method('getMimeType') ->will($this->returnValue('application/pdf')); - $constraint = new File(array( - 'mimeTypes' => array('image/png', 'image/jpg'), + $constraint = new File([ + 'mimeTypes' => ['image/png', 'image/jpg'], 'mimeTypesMessage' => 'myMessage', - )); + ]); $this->validator->validate($file, $constraint); @@ -364,7 +364,7 @@ public function testInvalidWildcardMimeType() { $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) + ->setConstructorArgs([__DIR__.'/Fixtures/foo']) ->getMock(); $file ->expects($this->once()) @@ -375,10 +375,10 @@ public function testInvalidWildcardMimeType() ->method('getMimeType') ->will($this->returnValue('application/pdf')); - $constraint = new File(array( - 'mimeTypes' => array('image/*', 'image/jpg'), + $constraint = new File([ + 'mimeTypes' => ['image/*', 'image/jpg'], 'mimeTypesMessage' => 'myMessage', - )); + ]); $this->validator->validate($file, $constraint); @@ -394,9 +394,9 @@ public function testDisallowEmpty() { ftruncate($this->file, 0); - $constraint = new File(array( + $constraint = new File([ 'disallowEmptyMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->getFile($this->path), $constraint); @@ -409,14 +409,14 @@ public function testDisallowEmpty() /** * @dataProvider uploadedFileErrorProvider */ - public function testUploadedFileError($error, $message, array $params = array(), $maxSize = null) + public function testUploadedFileError($error, $message, array $params = [], $maxSize = null) { $file = new UploadedFile('/path/to/file', 'originalName', 'mime', 0, $error); - $constraint = new File(array( + $constraint = new File([ $message => 'myMessage', 'maxSize' => $maxSize, - )); + ]); $this->validator->validate($file, $constraint); @@ -428,41 +428,47 @@ public function testUploadedFileError($error, $message, array $params = array(), public function uploadedFileErrorProvider() { - $tests = array( - array(UPLOAD_ERR_FORM_SIZE, 'uploadFormSizeErrorMessage'), - array(UPLOAD_ERR_PARTIAL, 'uploadPartialErrorMessage'), - array(UPLOAD_ERR_NO_FILE, 'uploadNoFileErrorMessage'), - array(UPLOAD_ERR_NO_TMP_DIR, 'uploadNoTmpDirErrorMessage'), - array(UPLOAD_ERR_CANT_WRITE, 'uploadCantWriteErrorMessage'), - array(UPLOAD_ERR_EXTENSION, 'uploadExtensionErrorMessage'), - ); + $tests = [ + [UPLOAD_ERR_FORM_SIZE, 'uploadFormSizeErrorMessage'], + [UPLOAD_ERR_PARTIAL, 'uploadPartialErrorMessage'], + [UPLOAD_ERR_NO_FILE, 'uploadNoFileErrorMessage'], + [UPLOAD_ERR_NO_TMP_DIR, 'uploadNoTmpDirErrorMessage'], + [UPLOAD_ERR_CANT_WRITE, 'uploadCantWriteErrorMessage'], + [UPLOAD_ERR_EXTENSION, 'uploadExtensionErrorMessage'], + ]; if (class_exists('Symfony\Component\HttpFoundation\File\UploadedFile')) { // when no maxSize is specified on constraint, it should use the ini value - $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( + $tests[] = [UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ '{{ limit }}' => UploadedFile::getMaxFilesize() / 1048576, '{{ suffix }}' => 'MiB', - )); + ]]; // it should use the smaller limitation (maxSize option in this case) - $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( + $tests[] = [UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ '{{ limit }}' => 1, '{{ suffix }}' => 'bytes', - ), '1'); + ], '1']; + + // access FileValidator::factorizeSizes() private method to format max file size + $reflection = new \ReflectionClass(\get_class(new FileValidator())); + $method = $reflection->getMethod('factorizeSizes'); + $method->setAccessible(true); + list($sizeAsString, $limit, $suffix) = $method->invokeArgs(new FileValidator(), [0, UploadedFile::getMaxFilesize(), false]); // it correctly parses the maxSize option and not only uses simple string comparison // 1000M should be bigger than the ini value - $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( - '{{ limit }}' => UploadedFile::getMaxFilesize() / 1048576, - '{{ suffix }}' => 'MiB', - ), '1000M'); + $tests[] = [UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ + '{{ limit }}' => $limit, + '{{ suffix }}' => $suffix, + ], '1000M']; // it correctly parses the maxSize option and not only uses simple string comparison // 1000M should be bigger than the ini value - $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( + $tests[] = [UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [ '{{ limit }}' => '0.1', '{{ suffix }}' => 'MB', - ), '100K'); + ], '100K']; } return $tests; diff --git a/vendor/symfony/validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php index 22fb9b662bad7cdabac0163a97c7607ac68264ef..d8d8eab8bdeeed1a08c5605183df84f4df5e3658 100644 --- a/vendor/symfony/validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php @@ -39,19 +39,19 @@ protected function getErrorCode() */ public function provideValidComparisons() { - return array( - array(3, 2), - array(1, 1), - array(new \DateTime('2010/01/01'), new \DateTime('2000/01/01')), - array(new \DateTime('2000/01/01'), new \DateTime('2000/01/01')), - array(new \DateTime('2010/01/01'), '2000/01/01'), - array(new \DateTime('2000/01/01'), '2000/01/01'), - array(new \DateTime('2010/01/01 UTC'), '2000/01/01 UTC'), - array(new \DateTime('2000/01/01 UTC'), '2000/01/01 UTC'), - array('a', 'a'), - array('z', 'a'), - array(null, 1), - ); + return [ + [3, 2], + [1, 1], + [new \DateTime('2010/01/01'), new \DateTime('2000/01/01')], + [new \DateTime('2000/01/01'), new \DateTime('2000/01/01')], + [new \DateTime('2010/01/01'), '2000/01/01'], + [new \DateTime('2000/01/01'), '2000/01/01'], + [new \DateTime('2010/01/01 UTC'), '2000/01/01 UTC'], + [new \DateTime('2000/01/01 UTC'), '2000/01/01 UTC'], + ['a', 'a'], + ['z', 'a'], + [null, 1], + ]; } /** @@ -59,10 +59,10 @@ public function provideValidComparisons() */ public function provideValidComparisonsToPropertyPath() { - return array( - array(5), - array(6), - ); + return [ + [5], + [6], + ]; } /** @@ -70,12 +70,12 @@ public function provideValidComparisonsToPropertyPath() */ public function provideInvalidComparisons() { - return array( - array(1, '1', 2, '2', 'integer'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array('b', '"b"', 'c', '"c"', 'string'), - ); + return [ + [1, '1', 2, '2', 'integer'], + [new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'], + [new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'], + [new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'], + ['b', '"b"', 'c', '"c"', 'string'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/GreaterThanValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/GreaterThanValidatorTest.php index 08446ec8470734e5864f1e4f1c6745310badd46d..e678496c41e68198cf036ec6ccf185409e6fbcda 100644 --- a/vendor/symfony/validator/Tests/Constraints/GreaterThanValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/GreaterThanValidatorTest.php @@ -39,15 +39,15 @@ protected function getErrorCode() */ public function provideValidComparisons() { - return array( - array(2, 1), - array(new \DateTime('2005/01/01'), new \DateTime('2001/01/01')), - array(new \DateTime('2005/01/01'), '2001/01/01'), - array(new \DateTime('2005/01/01 UTC'), '2001/01/01 UTC'), - array(new ComparisonTest_Class(5), new ComparisonTest_Class(4)), - array('333', '22'), - array(null, 1), - ); + return [ + [2, 1], + [new \DateTime('2005/01/01'), new \DateTime('2001/01/01')], + [new \DateTime('2005/01/01'), '2001/01/01'], + [new \DateTime('2005/01/01 UTC'), '2001/01/01 UTC'], + [new ComparisonTest_Class(5), new ComparisonTest_Class(4)], + ['333', '22'], + [null, 1], + ]; } /** @@ -55,9 +55,9 @@ public function provideValidComparisons() */ public function provideValidComparisonsToPropertyPath() { - return array( - array(6), - ); + return [ + [6], + ]; } /** @@ -65,19 +65,19 @@ public function provideValidComparisonsToPropertyPath() */ public function provideInvalidComparisons() { - return array( - array(1, '1', 2, '2', 'integer'), - array(2, '2', 2, '2', 'integer'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2000/01/01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000/01/01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - array('22', '"22"', '333', '"333"', 'string'), - array('22', '"22"', '22', '"22"', 'string'), - ); + return [ + [1, '1', 2, '2', 'integer'], + [2, '2', 2, '2', 'integer'], + [new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'], + [new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'], + [new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2000/01/01', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'], + [new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000/01/01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'], + [new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'], + ['22', '"22"', '333', '"333"', 'string'], + ['22', '"22"', '22', '"22"', 'string'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/GroupSequenceTest.php b/vendor/symfony/validator/Tests/Constraints/GroupSequenceTest.php index 98653274a9c66c945f624aaf2857c067379435ae..7803a73cc95d1151101bd7aeb284a7f61b44eee8 100644 --- a/vendor/symfony/validator/Tests/Constraints/GroupSequenceTest.php +++ b/vendor/symfony/validator/Tests/Constraints/GroupSequenceTest.php @@ -21,15 +21,15 @@ class GroupSequenceTest extends TestCase { public function testCreate() { - $sequence = new GroupSequence(array('Group 1', 'Group 2')); + $sequence = new GroupSequence(['Group 1', 'Group 2']); - $this->assertSame(array('Group 1', 'Group 2'), $sequence->groups); + $this->assertSame(['Group 1', 'Group 2'], $sequence->groups); } public function testCreateDoctrineStyle() { - $sequence = new GroupSequence(array('value' => array('Group 1', 'Group 2'))); + $sequence = new GroupSequence(['value' => ['Group 1', 'Group 2']]); - $this->assertSame(array('Group 1', 'Group 2'), $sequence->groups); + $this->assertSame(['Group 1', 'Group 2'], $sequence->groups); } } diff --git a/vendor/symfony/validator/Tests/Constraints/IbanValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/IbanValidatorTest.php index 7f9ba339cdea92f6e19d87a65cabda239d2d9787..ba426799ca4e11ed25b1302abcbfb3496bd7244a 100644 --- a/vendor/symfony/validator/Tests/Constraints/IbanValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/IbanValidatorTest.php @@ -48,115 +48,116 @@ public function testValidIbans($iban) public function getValidIbans() { - return array( - array('CH9300762011623852957'), // Switzerland without spaces - array('CH93 0076 2011 6238 5295 7'), // Switzerland with multiple spaces + return [ + ['CH9300762011623852957'], // Switzerland without spaces + ['CH93 0076 2011 6238 5295 7'], // Switzerland with multiple spaces // Country list // http://www.rbs.co.uk/corporate/international/g0/guide-to-international-business/regulatory-information/iban/iban-example.ashx - array('AL47 2121 1009 0000 0002 3569 8741'), //Albania - array('AD12 0001 2030 2003 5910 0100'), //Andorra - array('AT61 1904 3002 3457 3201'), //Austria - array('AZ21 NABZ 0000 0000 1370 1000 1944'), //Azerbaijan - array('BH67 BMAG 0000 1299 1234 56'), //Bahrain - array('BE62 5100 0754 7061'), //Belgium - array('BA39 1290 0794 0102 8494'), //Bosnia and Herzegovina - array('BG80 BNBG 9661 1020 3456 78'), //Bulgaria - array('BY 13 NBRB 3600 900000002Z00AB00'), //Belarus - array('BY13 NBRB 3600 900000002Z00AB00'), //Belarus - array('BY22NB23324232T78YR7823HR32U'), //Belarus - array('HR12 1001 0051 8630 0016 0'), //Croatia - array('CY17 0020 0128 0000 0012 0052 7600'), //Cyprus - array('CZ65 0800 0000 1920 0014 5399'), //Czech Republic - array('DK50 0040 0440 1162 43'), //Denmark - array('EE38 2200 2210 2014 5685'), //Estonia - array('FO97 5432 0388 8999 44'), //Faroe Islands - array('FI21 1234 5600 0007 85'), //Finland - array('FR14 2004 1010 0505 0001 3M02 606'), //France - array('GE29 NB00 0000 0101 9049 17'), //Georgia - array('DE89 3704 0044 0532 0130 00'), //Germany - array('GI75 NWBK 0000 0000 7099 453'), //Gibraltar - array('GR16 0110 1250 0000 0001 2300 695'), //Greece - array('GL56 0444 9876 5432 10'), //Greenland - array('HU42 1177 3016 1111 1018 0000 0000'), //Hungary - array('IS14 0159 2600 7654 5510 7303 39'), //Iceland - array('IE29 AIBK 9311 5212 3456 78'), //Ireland - array('IL62 0108 0000 0009 9999 999'), //Israel - array('IT40 S054 2811 1010 0000 0123 456'), //Italy - array('LV80 BANK 0000 4351 9500 1'), //Latvia - array('LB62 0999 0000 0001 0019 0122 9114'), //Lebanon - array('LI21 0881 0000 2324 013A A'), //Liechtenstein - array('LT12 1000 0111 0100 1000'), //Lithuania - array('LU28 0019 4006 4475 0000'), //Luxembourg - array('MK072 5012 0000 0589 84'), //Macedonia - array('MT84 MALT 0110 0001 2345 MTLC AST0 01S'), //Malta - array('MU17 BOMM 0101 1010 3030 0200 000M UR'), //Mauritius - array('MD24 AG00 0225 1000 1310 4168'), //Moldova - array('MC93 2005 2222 1001 1223 3M44 555'), //Monaco - array('ME25 5050 0001 2345 6789 51'), //Montenegro - array('NL39 RABO 0300 0652 64'), //Netherlands - array('NO93 8601 1117 947'), //Norway - array('PK36 SCBL 0000 0011 2345 6702'), //Pakistan - array('PL60 1020 1026 0000 0422 7020 1111'), //Poland - array('PT50 0002 0123 1234 5678 9015 4'), //Portugal - array('RO49 AAAA 1B31 0075 9384 0000'), //Romania - array('SM86 U032 2509 8000 0000 0270 100'), //San Marino - array('SA03 8000 0000 6080 1016 7519'), //Saudi Arabia - array('RS35 2600 0560 1001 6113 79'), //Serbia - array('SK31 1200 0000 1987 4263 7541'), //Slovak Republic - array('SI56 1910 0000 0123 438'), //Slovenia - array('ES80 2310 0001 1800 0001 2345'), //Spain - array('SE35 5000 0000 0549 1000 0003'), //Sweden - array('CH93 0076 2011 6238 5295 7'), //Switzerland - array('TN59 1000 6035 1835 9847 8831'), //Tunisia - array('TR33 0006 1005 1978 6457 8413 26'), //Turkey - array('AE07 0331 2345 6789 0123 456'), //UAE - array('GB12 CPBK 0892 9965 0449 91'), //United Kingdom + ['AL47 2121 1009 0000 0002 3569 8741'], //Albania + ['AD12 0001 2030 2003 5910 0100'], //Andorra + ['AT61 1904 3002 3457 3201'], //Austria + ['AZ21 NABZ 0000 0000 1370 1000 1944'], //Azerbaijan + ['BH67 BMAG 0000 1299 1234 56'], //Bahrain + ['BE62 5100 0754 7061'], //Belgium + ['BA39 1290 0794 0102 8494'], //Bosnia and Herzegovina + ['BG80 BNBG 9661 1020 3456 78'], //Bulgaria + ['BY 13 NBRB 3600 900000002Z00AB00'], //Belarus + ['BY13 NBRB 3600 900000002Z00AB00'], //Belarus + ['BY22NB23324232T78YR7823HR32U'], //Belarus + ['HR12 1001 0051 8630 0016 0'], //Croatia + ['CY17 0020 0128 0000 0012 0052 7600'], //Cyprus + ['CZ65 0800 0000 1920 0014 5399'], //Czech Republic + ['DK50 0040 0440 1162 43'], //Denmark + ['EE38 2200 2210 2014 5685'], //Estonia + ['FO97 5432 0388 8999 44'], //Faroe Islands + ['FI21 1234 5600 0007 85'], //Finland + ['FR14 2004 1010 0505 0001 3M02 606'], //France + ['GE29 NB00 0000 0101 9049 17'], //Georgia + ['DE89 3704 0044 0532 0130 00'], //Germany + ['GI75 NWBK 0000 0000 7099 453'], //Gibraltar + ['GR16 0110 1250 0000 0001 2300 695'], //Greece + ['GL56 0444 9876 5432 10'], //Greenland + ['HU42 1177 3016 1111 1018 0000 0000'], //Hungary + ['IS14 0159 2600 7654 5510 7303 39'], //Iceland + ['IE29 AIBK 9311 5212 3456 78'], //Ireland + ['IL62 0108 0000 0009 9999 999'], //Israel + ['IT40 S054 2811 1010 0000 0123 456'], //Italy + ['LV80 BANK 0000 4351 9500 1'], //Latvia + ['LB62 0999 0000 0001 0019 0122 9114'], //Lebanon + ['LI21 0881 0000 2324 013A A'], //Liechtenstein + ['LT12 1000 0111 0100 1000'], //Lithuania + ['LU28 0019 4006 4475 0000'], //Luxembourg + ['MK072 5012 0000 0589 84'], //Macedonia + ['MT84 MALT 0110 0001 2345 MTLC AST0 01S'], //Malta + ['MU17 BOMM 0101 1010 3030 0200 000M UR'], //Mauritius + ['MD24 AG00 0225 1000 1310 4168'], //Moldova + ['MC93 2005 2222 1001 1223 3M44 555'], //Monaco + ['ME25 5050 0001 2345 6789 51'], //Montenegro + ['NL39 RABO 0300 0652 64'], //Netherlands + ['NO93 8601 1117 947'], //Norway + ['PK36 SCBL 0000 0011 2345 6702'], //Pakistan + ['PL60 1020 1026 0000 0422 7020 1111'], //Poland + ['PT50 0002 0123 1234 5678 9015 4'], //Portugal + ['RO49 AAAA 1B31 0075 9384 0000'], //Romania + ['SM86 U032 2509 8000 0000 0270 100'], //San Marino + ['SA03 8000 0000 6080 1016 7519'], //Saudi Arabia + ['RS35 2600 0560 1001 6113 79'], //Serbia + ['SK31 1200 0000 1987 4263 7541'], //Slovak Republic + ['SI56 1910 0000 0123 438'], //Slovenia + ['ES80 2310 0001 1800 0001 2345'], //Spain + ['SE35 5000 0000 0549 1000 0003'], //Sweden + ['CH93 0076 2011 6238 5295 7'], //Switzerland + ['TN59 1000 6035 1835 9847 8831'], //Tunisia + ['TR33 0006 1005 1978 6457 8413 26'], //Turkey + ['AE07 0331 2345 6789 0123 456'], //UAE + ['GB12 CPBK 0892 9965 0449 91'], //United Kingdom //Extended country list //http://www.nordea.com/Our+services/International+products+and+services/Cash+Management/IBAN+countries/908462.html // https://www.swift.com/sites/default/files/resources/iban_registry.pdf - array('AO06000600000100037131174'), //Angola - array('AZ21NABZ00000000137010001944'), //Azerbaijan - array('BH29BMAG1299123456BH00'), //Bahrain - array('BJ11B00610100400271101192591'), //Benin - array('BR9700360305000010009795493P1'), // Brazil - array('BR1800000000141455123924100C2'), // Brazil - array('VG96VPVG0000012345678901'), //British Virgin Islands - array('BF1030134020015400945000643'), //Burkina Faso - array('BI43201011067444'), //Burundi - array('CM2110003001000500000605306'), //Cameroon - array('CV64000300004547069110176'), //Cape Verde - array('FR7630007000110009970004942'), //Central African Republic - array('CG5230011000202151234567890'), //Congo - array('CR05015202001026284066'), //Costa Rica - array('DO28BAGR00000001212453611324'), //Dominican Republic - array('GT82TRAJ01020000001210029690'), //Guatemala - array('IR580540105180021273113007'), //Iran - array('IL620108000000099999999'), //Israel - array('CI05A00060174100178530011852'), //Ivory Coast - array('JO94CBJO0010000000000131000302'), // Jordan - array('KZ176010251000042993'), //Kazakhstan - array('KW74NBOK0000000000001000372151'), //Kuwait - array('LB30099900000001001925579115'), //Lebanon - array('MG4600005030010101914016056'), //Madagascar - array('ML03D00890170001002120000447'), //Mali - array('MR1300012000010000002037372'), //Mauritania - array('MU17BOMM0101101030300200000MUR'), //Mauritius - array('MZ59000100000011834194157'), //Mozambique - array('PS92PALS000000000400123456702'), //Palestinian Territory - array('QA58DOHB00001234567890ABCDEFG'), //Qatar - array('XK051212012345678906'), //Republic of Kosovo - array('PT50000200000163099310355'), //Sao Tome and Principe - array('SA0380000000608010167519'), //Saudi Arabia - array('SN12K00100152000025690007542'), //Senegal - array('TL380080012345678910157'), //Timor-Leste - array('TN5914207207100707129648'), //Tunisia - array('TR330006100519786457841326'), //Turkey - array('UA213223130000026007233566001'), //Ukraine - array('AE260211000000230064016'), //United Arab Emirates - ); + ['AO06000600000100037131174'], //Angola + ['AZ21NABZ00000000137010001944'], //Azerbaijan + ['BH29BMAG1299123456BH00'], //Bahrain + ['BJ11B00610100400271101192591'], //Benin + ['BR9700360305000010009795493P1'], // Brazil + ['BR1800000000141455123924100C2'], // Brazil + ['VG96VPVG0000012345678901'], //British Virgin Islands + ['BF1030134020015400945000643'], //Burkina Faso + ['BI43201011067444'], //Burundi + ['CM2110003001000500000605306'], //Cameroon + ['CV64000300004547069110176'], //Cape Verde + ['FR7630007000110009970004942'], //Central African Republic + ['CG5230011000202151234567890'], //Congo + ['CR05015202001026284066'], //Costa Rica + ['DO28BAGR00000001212453611324'], //Dominican Republic + ['GT82TRAJ01020000001210029690'], //Guatemala + ['IR580540105180021273113007'], //Iran + ['IL620108000000099999999'], //Israel + ['CI05A00060174100178530011852'], //Ivory Coast + ['JO94CBJO0010000000000131000302'], // Jordan + ['KZ176010251000042993'], //Kazakhstan + ['KW74NBOK0000000000001000372151'], //Kuwait + ['LB30099900000001001925579115'], //Lebanon + ['MG4600005030010101914016056'], //Madagascar + ['ML03D00890170001002120000447'], //Mali + ['MR1300012000010000002037372'], //Mauritania + ['MU17BOMM0101101030300200000MUR'], //Mauritius + ['MZ59000100000011834194157'], //Mozambique + ['PS92PALS000000000400123456702'], //Palestinian Territory + ['QA58DOHB00001234567890ABCDEFG'], //Qatar + ['XK051212012345678906'], //Republic of Kosovo + ['PT50000200000163099310355'], //Sao Tome and Principe + ['SA0380000000608010167519'], //Saudi Arabia + ['SN12K00100152000025690007542'], //Senegal + ['TL380080012345678910157'], //Timor-Leste + ['TN5914207207100707129648'], //Tunisia + ['TR330006100519786457841326'], //Turkey + ['UA213223130000026007233566001'], //Ukraine + ['AE260211000000230064016'], //United Arab Emirates + ['VA59001123000012345678'], //Vatican City State + ]; } /** @@ -169,112 +170,113 @@ public function testIbansWithInvalidFormat($iban) public function getIbansWithInvalidFormat() { - return array( - array('AL47 2121 1009 0000 0002 3569 874'), //Albania - array('AD12 0001 2030 2003 5910 010'), //Andorra - array('AT61 1904 3002 3457 320'), //Austria - array('AZ21 NABZ 0000 0000 1370 1000 194'), //Azerbaijan - array('AZ21 N1BZ 0000 0000 1370 1000 1944'), //Azerbaijan - array('BH67 BMAG 0000 1299 1234 5'), //Bahrain - array('BH67 B2AG 0000 1299 1234 56'), //Bahrain - array('BE62 5100 0754 7061 2'), //Belgium - array('BA39 1290 0794 0102 8494 4'), //Bosnia and Herzegovina - array('BG80 BNBG 9661 1020 3456 7'), //Bulgaria - array('BG80 B2BG 9661 1020 3456 78'), //Bulgaria - array('BY 13 NBRB 3600 900000002Z00AB001'), //Belarus - array('BY 13 NBRB 3600 900000002Z00AB0'), //Belarus - array('BYRO NBRB 3600 900000002Z00AB0'), //Belarus - array('BY 13 3600 NBRB 900000002Z00AB05'), //Belarus - array('HR12 1001 0051 8630 0016 01'), //Croatia - array('CY17 0020 0128 0000 0012 0052 7600 1'), //Cyprus - array('CZ65 0800 0000 1920 0014 5399 1'), //Czech Republic - array('DK50 0040 0440 1162 431'), //Denmark - array('EE38 2200 2210 2014 5685 1'), //Estonia - array('FO97 5432 0388 8999 441'), //Faroe Islands - array('FI21 1234 5600 0007 851'), //Finland - array('FR14 2004 1010 0505 0001 3M02 6061'), //France - array('GE29 NB00 0000 0101 9049 171'), //Georgia - array('DE89 3704 0044 0532 0130 001'), //Germany - array('GI75 NWBK 0000 0000 7099 4531'), //Gibraltar - array('GR16 0110 1250 0000 0001 2300 6951'), //Greece - array('GL56 0444 9876 5432 101'), //Greenland - array('HU42 1177 3016 1111 1018 0000 0000 1'), //Hungary - array('IS14 0159 2600 7654 5510 7303 391'), //Iceland - array('IE29 AIBK 9311 5212 3456 781'), //Ireland - array('IL62 0108 0000 0009 9999 9991'), //Israel - array('IT40 S054 2811 1010 0000 0123 4561'), //Italy - array('LV80 BANK 0000 4351 9500 11'), //Latvia - array('LB62 0999 0000 0001 0019 0122 9114 1'), //Lebanon - array('LI21 0881 0000 2324 013A A1'), //Liechtenstein - array('LT12 1000 0111 0100 1000 1'), //Lithuania - array('LU28 0019 4006 4475 0000 1'), //Luxembourg - array('MK072 5012 0000 0589 84 1'), //Macedonia - array('MT84 MALT 0110 0001 2345 MTLC AST0 01SA'), //Malta - array('MU17 BOMM 0101 1010 3030 0200 000M URA'), //Mauritius - array('MD24 AG00 0225 1000 1310 4168 1'), //Moldova - array('MC93 2005 2222 1001 1223 3M44 5551'), //Monaco - array('ME25 5050 0001 2345 6789 511'), //Montenegro - array('NL39 RABO 0300 0652 641'), //Netherlands - array('NO93 8601 1117 9471'), //Norway - array('PK36 SCBL 0000 0011 2345 6702 1'), //Pakistan - array('PL60 1020 1026 0000 0422 7020 1111 1'), //Poland - array('PT50 0002 0123 1234 5678 9015 41'), //Portugal - array('RO49 AAAA 1B31 0075 9384 0000 1'), //Romania - array('SM86 U032 2509 8000 0000 0270 1001'), //San Marino - array('SA03 8000 0000 6080 1016 7519 1'), //Saudi Arabia - array('RS35 2600 0560 1001 6113 791'), //Serbia - array('SK31 1200 0000 1987 4263 7541 1'), //Slovak Republic - array('SI56 1910 0000 0123 4381'), //Slovenia - array('ES80 2310 0001 1800 0001 2345 1'), //Spain - array('SE35 5000 0000 0549 1000 0003 1'), //Sweden - array('CH93 0076 2011 6238 5295 71'), //Switzerland - array('TN59 1000 6035 1835 9847 8831 1'), //Tunisia - array('TR33 0006 1005 1978 6457 8413 261'), //Turkey - array('AE07 0331 2345 6789 0123 4561'), //UAE - array('GB12 CPBK 0892 9965 0449 911'), //United Kingdom + return [ + ['AL47 2121 1009 0000 0002 3569 874'], //Albania + ['AD12 0001 2030 2003 5910 010'], //Andorra + ['AT61 1904 3002 3457 320'], //Austria + ['AZ21 NABZ 0000 0000 1370 1000 194'], //Azerbaijan + ['AZ21 N1BZ 0000 0000 1370 1000 1944'], //Azerbaijan + ['BH67 BMAG 0000 1299 1234 5'], //Bahrain + ['BH67 B2AG 0000 1299 1234 56'], //Bahrain + ['BE62 5100 0754 7061 2'], //Belgium + ['BA39 1290 0794 0102 8494 4'], //Bosnia and Herzegovina + ['BG80 BNBG 9661 1020 3456 7'], //Bulgaria + ['BG80 B2BG 9661 1020 3456 78'], //Bulgaria + ['BY 13 NBRB 3600 900000002Z00AB001'], //Belarus + ['BY 13 NBRB 3600 900000002Z00AB0'], //Belarus + ['BYRO NBRB 3600 900000002Z00AB0'], //Belarus + ['BY 13 3600 NBRB 900000002Z00AB05'], //Belarus + ['HR12 1001 0051 8630 0016 01'], //Croatia + ['CY17 0020 0128 0000 0012 0052 7600 1'], //Cyprus + ['CZ65 0800 0000 1920 0014 5399 1'], //Czech Republic + ['DK50 0040 0440 1162 431'], //Denmark + ['EE38 2200 2210 2014 5685 1'], //Estonia + ['FO97 5432 0388 8999 441'], //Faroe Islands + ['FI21 1234 5600 0007 851'], //Finland + ['FR14 2004 1010 0505 0001 3M02 6061'], //France + ['GE29 NB00 0000 0101 9049 171'], //Georgia + ['DE89 3704 0044 0532 0130 001'], //Germany + ['GI75 NWBK 0000 0000 7099 4531'], //Gibraltar + ['GR16 0110 1250 0000 0001 2300 6951'], //Greece + ['GL56 0444 9876 5432 101'], //Greenland + ['HU42 1177 3016 1111 1018 0000 0000 1'], //Hungary + ['IS14 0159 2600 7654 5510 7303 391'], //Iceland + ['IE29 AIBK 9311 5212 3456 781'], //Ireland + ['IL62 0108 0000 0009 9999 9991'], //Israel + ['IT40 S054 2811 1010 0000 0123 4561'], //Italy + ['LV80 BANK 0000 4351 9500 11'], //Latvia + ['LB62 0999 0000 0001 0019 0122 9114 1'], //Lebanon + ['LI21 0881 0000 2324 013A A1'], //Liechtenstein + ['LT12 1000 0111 0100 1000 1'], //Lithuania + ['LU28 0019 4006 4475 0000 1'], //Luxembourg + ['MK072 5012 0000 0589 84 1'], //Macedonia + ['MT84 MALT 0110 0001 2345 MTLC AST0 01SA'], //Malta + ['MU17 BOMM 0101 1010 3030 0200 000M URA'], //Mauritius + ['MD24 AG00 0225 1000 1310 4168 1'], //Moldova + ['MC93 2005 2222 1001 1223 3M44 5551'], //Monaco + ['ME25 5050 0001 2345 6789 511'], //Montenegro + ['NL39 RABO 0300 0652 641'], //Netherlands + ['NO93 8601 1117 9471'], //Norway + ['PK36 SCBL 0000 0011 2345 6702 1'], //Pakistan + ['PL60 1020 1026 0000 0422 7020 1111 1'], //Poland + ['PT50 0002 0123 1234 5678 9015 41'], //Portugal + ['RO49 AAAA 1B31 0075 9384 0000 1'], //Romania + ['SM86 U032 2509 8000 0000 0270 1001'], //San Marino + ['SA03 8000 0000 6080 1016 7519 1'], //Saudi Arabia + ['RS35 2600 0560 1001 6113 791'], //Serbia + ['SK31 1200 0000 1987 4263 7541 1'], //Slovak Republic + ['SI56 1910 0000 0123 4381'], //Slovenia + ['ES80 2310 0001 1800 0001 2345 1'], //Spain + ['SE35 5000 0000 0549 1000 0003 1'], //Sweden + ['CH93 0076 2011 6238 5295 71'], //Switzerland + ['TN59 1000 6035 1835 9847 8831 1'], //Tunisia + ['TR33 0006 1005 1978 6457 8413 261'], //Turkey + ['AE07 0331 2345 6789 0123 4561'], //UAE + ['GB12 CPBK 0892 9965 0449 911'], //United Kingdom //Extended country list - array('AO060006000001000371311741'), //Angola - array('AZ21NABZ000000001370100019441'), //Azerbaijan - array('BH29BMAG1299123456BH001'), //Bahrain - array('BJ11B006101004002711011925911'), //Benin - array('BR9700360305000010009795493P11'), // Brazil - array('BR1800000000141455123924100C21'), // Brazil - array('VG96VPVG00000123456789011'), //British Virgin Islands - array('BF10301340200154009450006431'), //Burkina Faso - array('BI432010110674441'), //Burundi - array('CM21100030010005000006053061'), //Cameroon - array('CV640003000045470691101761'), //Cape Verde - array('FR76300070001100099700049421'), //Central African Republic - array('CG52300110002021512345678901'), //Congo - array('CR05152020010262840661'), //Costa Rica - array('CR0515202001026284066'), //Costa Rica - array('DO28BAGR000000012124536113241'), //Dominican Republic - array('GT82TRAJ010200000012100296901'), //Guatemala - array('IR5805401051800212731130071'), //Iran - array('IL6201080000000999999991'), //Israel - array('CI05A000601741001785300118521'), //Ivory Coast - array('JO94CBJO00100000000001310003021'), // Jordan - array('KZ1760102510000429931'), //Kazakhstan - array('KW74NBOK00000000000010003721511'), //Kuwait - array('LB300999000000010019255791151'), //Lebanon - array('MG46000050300101019140160561'), //Madagascar - array('ML03D008901700010021200004471'), //Mali - array('MR13000120000100000020373721'), //Mauritania - array('MU17BOMM0101101030300200000MUR1'), //Mauritius - array('MZ590001000000118341941571'), //Mozambique - array('PS92PALS0000000004001234567021'), //Palestinian Territory - array('QA58DOHB00001234567890ABCDEFG1'), //Qatar - array('XK0512120123456789061'), //Republic of Kosovo - array('PT500002000001630993103551'), //Sao Tome and Principe - array('SA03800000006080101675191'), //Saudi Arabia - array('SN12K001001520000256900075421'), //Senegal - array('TL3800800123456789101571'), //Timor-Leste - array('TN59142072071007071296481'), //Tunisia - array('TR3300061005197864578413261'), //Turkey - array('UA21AAAA1300000260072335660012'), //Ukraine - array('AE2602110000002300640161'), //United Arab Emirates - ); + ['AO060006000001000371311741'], //Angola + ['AZ21NABZ000000001370100019441'], //Azerbaijan + ['BH29BMAG1299123456BH001'], //Bahrain + ['BJ11B006101004002711011925911'], //Benin + ['BR9700360305000010009795493P11'], // Brazil + ['BR1800000000141455123924100C21'], // Brazil + ['VG96VPVG00000123456789011'], //British Virgin Islands + ['BF10301340200154009450006431'], //Burkina Faso + ['BI432010110674441'], //Burundi + ['CM21100030010005000006053061'], //Cameroon + ['CV640003000045470691101761'], //Cape Verde + ['FR76300070001100099700049421'], //Central African Republic + ['CG52300110002021512345678901'], //Congo + ['CR05152020010262840661'], //Costa Rica + ['CR0515202001026284066'], //Costa Rica + ['DO28BAGR000000012124536113241'], //Dominican Republic + ['GT82TRAJ010200000012100296901'], //Guatemala + ['IR5805401051800212731130071'], //Iran + ['IL6201080000000999999991'], //Israel + ['CI05A000601741001785300118521'], //Ivory Coast + ['JO94CBJO00100000000001310003021'], // Jordan + ['KZ1760102510000429931'], //Kazakhstan + ['KW74NBOK00000000000010003721511'], //Kuwait + ['LB300999000000010019255791151'], //Lebanon + ['MG46000050300101019140160561'], //Madagascar + ['ML03D008901700010021200004471'], //Mali + ['MR13000120000100000020373721'], //Mauritania + ['MU17BOMM0101101030300200000MUR1'], //Mauritius + ['MZ590001000000118341941571'], //Mozambique + ['PS92PALS0000000004001234567021'], //Palestinian Territory + ['QA58DOHB00001234567890ABCDEFG1'], //Qatar + ['XK0512120123456789061'], //Republic of Kosovo + ['PT500002000001630993103551'], //Sao Tome and Principe + ['SA03800000006080101675191'], //Saudi Arabia + ['SN12K001001520000256900075421'], //Senegal + ['TL3800800123456789101571'], //Timor-Leste + ['TN59142072071007071296481'], //Tunisia + ['TR3300061005197864578413261'], //Turkey + ['UA21AAAA1300000260072335660012'], //Ukraine + ['AE2602110000002300640161'], //United Arab Emirates + ['VA590011230000123456781'], //Vatican City State + ]; } /** @@ -287,105 +289,106 @@ public function testIbansWithValidFormatButIncorrectChecksum($iban) public function getIbansWithValidFormatButIncorrectChecksum() { - return array( - array('AL47 2121 1009 0000 0002 3569 8742'), //Albania - array('AD12 0001 2030 2003 5910 0101'), //Andorra - array('AT61 1904 3002 3457 3202'), //Austria - array('AZ21 NABZ 0000 0000 1370 1000 1945'), //Azerbaijan - array('BH67 BMAG 0000 1299 1234 57'), //Bahrain - array('BE62 5100 0754 7062'), //Belgium - array('BA39 1290 0794 0102 8495'), //Bosnia and Herzegovina - array('BG80 BNBG 9661 1020 3456 79'), //Bulgaria - array('BY90 NBRB 3600 900000002Z00AB00'), //Belarus - array('HR12 1001 0051 8630 0016 1'), //Croatia - array('CY17 0020 0128 0000 0012 0052 7601'), //Cyprus - array('CZ65 0800 0000 1920 0014 5398'), //Czech Republic - array('DK50 0040 0440 1162 44'), //Denmark - array('EE38 2200 2210 2014 5684'), //Estonia - array('FO97 5432 0388 8999 43'), //Faroe Islands - array('FI21 1234 5600 0007 84'), //Finland - array('FR14 2004 1010 0505 0001 3M02 605'), //France - array('GE29 NB00 0000 0101 9049 16'), //Georgia - array('DE89 3704 0044 0532 0130 01'), //Germany - array('GI75 NWBK 0000 0000 7099 452'), //Gibraltar - array('GR16 0110 1250 0000 0001 2300 694'), //Greece - array('GL56 0444 9876 5432 11'), //Greenland - array('HU42 1177 3016 1111 1018 0000 0001'), //Hungary - array('IS14 0159 2600 7654 5510 7303 38'), //Iceland - array('IE29 AIBK 9311 5212 3456 79'), //Ireland - array('IL62 0108 0000 0009 9999 998'), //Israel - array('IT40 S054 2811 1010 0000 0123 457'), //Italy - array('LV80 BANK 0000 4351 9500 2'), //Latvia - array('LB62 0999 0000 0001 0019 0122 9115'), //Lebanon - array('LI21 0881 0000 2324 013A B'), //Liechtenstein - array('LT12 1000 0111 0100 1001'), //Lithuania - array('LU28 0019 4006 4475 0001'), //Luxembourg - array('MK072 5012 0000 0589 85'), //Macedonia - array('MT84 MALT 0110 0001 2345 MTLC AST0 01T'), //Malta - array('MU17 BOMM 0101 1010 3030 0200 000M UP'), //Mauritius - array('MD24 AG00 0225 1000 1310 4169'), //Moldova - array('MC93 2005 2222 1001 1223 3M44 554'), //Monaco - array('ME25 5050 0001 2345 6789 52'), //Montenegro - array('NL39 RABO 0300 0652 65'), //Netherlands - array('NO93 8601 1117 948'), //Norway - array('PK36 SCBL 0000 0011 2345 6703'), //Pakistan - array('PL60 1020 1026 0000 0422 7020 1112'), //Poland - array('PT50 0002 0123 1234 5678 9015 5'), //Portugal - array('RO49 AAAA 1B31 0075 9384 0001'), //Romania - array('SM86 U032 2509 8000 0000 0270 101'), //San Marino - array('SA03 8000 0000 6080 1016 7518'), //Saudi Arabia - array('RS35 2600 0560 1001 6113 78'), //Serbia - array('SK31 1200 0000 1987 4263 7542'), //Slovak Republic - array('SI56 1910 0000 0123 439'), //Slovenia - array('ES80 2310 0001 1800 0001 2346'), //Spain - array('SE35 5000 0000 0549 1000 0004'), //Sweden - array('CH93 0076 2011 6238 5295 8'), //Switzerland - array('TN59 1000 6035 1835 9847 8832'), //Tunisia - array('TR33 0006 1005 1978 6457 8413 27'), //Turkey - array('AE07 0331 2345 6789 0123 457'), //UAE - array('GB12 CPBK 0892 9965 0449 92'), //United Kingdom + return [ + ['AL47 2121 1009 0000 0002 3569 8742'], //Albania + ['AD12 0001 2030 2003 5910 0101'], //Andorra + ['AT61 1904 3002 3457 3202'], //Austria + ['AZ21 NABZ 0000 0000 1370 1000 1945'], //Azerbaijan + ['BH67 BMAG 0000 1299 1234 57'], //Bahrain + ['BE62 5100 0754 7062'], //Belgium + ['BA39 1290 0794 0102 8495'], //Bosnia and Herzegovina + ['BG80 BNBG 9661 1020 3456 79'], //Bulgaria + ['BY90 NBRB 3600 900000002Z00AB00'], //Belarus + ['HR12 1001 0051 8630 0016 1'], //Croatia + ['CY17 0020 0128 0000 0012 0052 7601'], //Cyprus + ['CZ65 0800 0000 1920 0014 5398'], //Czech Republic + ['DK50 0040 0440 1162 44'], //Denmark + ['EE38 2200 2210 2014 5684'], //Estonia + ['FO97 5432 0388 8999 43'], //Faroe Islands + ['FI21 1234 5600 0007 84'], //Finland + ['FR14 2004 1010 0505 0001 3M02 605'], //France + ['GE29 NB00 0000 0101 9049 16'], //Georgia + ['DE89 3704 0044 0532 0130 01'], //Germany + ['GI75 NWBK 0000 0000 7099 452'], //Gibraltar + ['GR16 0110 1250 0000 0001 2300 694'], //Greece + ['GL56 0444 9876 5432 11'], //Greenland + ['HU42 1177 3016 1111 1018 0000 0001'], //Hungary + ['IS14 0159 2600 7654 5510 7303 38'], //Iceland + ['IE29 AIBK 9311 5212 3456 79'], //Ireland + ['IL62 0108 0000 0009 9999 998'], //Israel + ['IT40 S054 2811 1010 0000 0123 457'], //Italy + ['LV80 BANK 0000 4351 9500 2'], //Latvia + ['LB62 0999 0000 0001 0019 0122 9115'], //Lebanon + ['LI21 0881 0000 2324 013A B'], //Liechtenstein + ['LT12 1000 0111 0100 1001'], //Lithuania + ['LU28 0019 4006 4475 0001'], //Luxembourg + ['MK072 5012 0000 0589 85'], //Macedonia + ['MT84 MALT 0110 0001 2345 MTLC AST0 01T'], //Malta + ['MU17 BOMM 0101 1010 3030 0200 000M UP'], //Mauritius + ['MD24 AG00 0225 1000 1310 4169'], //Moldova + ['MC93 2005 2222 1001 1223 3M44 554'], //Monaco + ['ME25 5050 0001 2345 6789 52'], //Montenegro + ['NL39 RABO 0300 0652 65'], //Netherlands + ['NO93 8601 1117 948'], //Norway + ['PK36 SCBL 0000 0011 2345 6703'], //Pakistan + ['PL60 1020 1026 0000 0422 7020 1112'], //Poland + ['PT50 0002 0123 1234 5678 9015 5'], //Portugal + ['RO49 AAAA 1B31 0075 9384 0001'], //Romania + ['SM86 U032 2509 8000 0000 0270 101'], //San Marino + ['SA03 8000 0000 6080 1016 7518'], //Saudi Arabia + ['RS35 2600 0560 1001 6113 78'], //Serbia + ['SK31 1200 0000 1987 4263 7542'], //Slovak Republic + ['SI56 1910 0000 0123 439'], //Slovenia + ['ES80 2310 0001 1800 0001 2346'], //Spain + ['SE35 5000 0000 0549 1000 0004'], //Sweden + ['CH93 0076 2011 6238 5295 8'], //Switzerland + ['TN59 1000 6035 1835 9847 8832'], //Tunisia + ['TR33 0006 1005 1978 6457 8413 27'], //Turkey + ['AE07 0331 2345 6789 0123 457'], //UAE + ['GB12 CPBK 0892 9965 0449 92'], //United Kingdom //Extended country list - array('AO06000600000100037131175'), //Angola - array('AZ21NABZ00000000137010001945'), //Azerbaijan - array('BH29BMAG1299123456BH01'), //Bahrain - array('BJ11B00610100400271101192592'), //Benin - array('BR9700360305000010009795493P2'), // Brazil - array('BR1800000000141455123924100C3'), // Brazil - array('VG96VPVG0000012345678902'), //British Virgin Islands - array('BF1030134020015400945000644'), //Burkina Faso - array('BI43201011067445'), //Burundi - array('CM2110003001000500000605307'), //Cameroon - array('CV64000300004547069110177'), //Cape Verde - array('FR7630007000110009970004943'), //Central African Republic - array('CG5230011000202151234567891'), //Congo - array('CR96042332432534543564'), //Costa Rica - array('DO28BAGR00000001212453611325'), //Dominican Republic - array('GT82TRAJ01020000001210029691'), //Guatemala - array('IR580540105180021273113008'), //Iran - array('IL620108000000099999998'), //Israel - array('CI05A00060174100178530011853'), //Ivory Coast - array('JO94CBJO0010000000000131000303'), // Jordan - array('KZ176010251000042994'), //Kazakhstan - array('KW74NBOK0000000000001000372152'), //Kuwait - array('LB30099900000001001925579116'), //Lebanon - array('MG4600005030010101914016057'), //Madagascar - array('ML03D00890170001002120000448'), //Mali - array('MR1300012000010000002037373'), //Mauritania - array('MU17BOMM0101101030300200000MUP'), //Mauritius - array('MZ59000100000011834194158'), //Mozambique - array('PS92PALS000000000400123456703'), //Palestinian Territory - array('QA58DOHB00001234567890ABCDEFH'), //Qatar - array('XK051212012345678907'), //Republic of Kosovo - array('PT50000200000163099310356'), //Sao Tome and Principe - array('SA0380000000608010167518'), //Saudi Arabia - array('SN12K00100152000025690007543'), //Senegal - array('TL380080012345678910158'), //Timor-Leste - array('TN5914207207100707129649'), //Tunisia - array('TR330006100519786457841327'), //Turkey - array('UA213223130000026007233566002'), //Ukraine - array('AE260211000000230064017'), //United Arab Emirates - ); + ['AO06000600000100037131175'], //Angola + ['AZ21NABZ00000000137010001945'], //Azerbaijan + ['BH29BMAG1299123456BH01'], //Bahrain + ['BJ11B00610100400271101192592'], //Benin + ['BR9700360305000010009795493P2'], // Brazil + ['BR1800000000141455123924100C3'], // Brazil + ['VG96VPVG0000012345678902'], //British Virgin Islands + ['BF1030134020015400945000644'], //Burkina Faso + ['BI43201011067445'], //Burundi + ['CM2110003001000500000605307'], //Cameroon + ['CV64000300004547069110177'], //Cape Verde + ['FR7630007000110009970004943'], //Central African Republic + ['CG5230011000202151234567891'], //Congo + ['CR96042332432534543564'], //Costa Rica + ['DO28BAGR00000001212453611325'], //Dominican Republic + ['GT82TRAJ01020000001210029691'], //Guatemala + ['IR580540105180021273113008'], //Iran + ['IL620108000000099999998'], //Israel + ['CI05A00060174100178530011853'], //Ivory Coast + ['JO94CBJO0010000000000131000303'], // Jordan + ['KZ176010251000042994'], //Kazakhstan + ['KW74NBOK0000000000001000372152'], //Kuwait + ['LB30099900000001001925579116'], //Lebanon + ['MG4600005030010101914016057'], //Madagascar + ['ML03D00890170001002120000448'], //Mali + ['MR1300012000010000002037373'], //Mauritania + ['MU17BOMM0101101030300200000MUP'], //Mauritius + ['MZ59000100000011834194158'], //Mozambique + ['PS92PALS000000000400123456703'], //Palestinian Territory + ['QA58DOHB00001234567890ABCDEFH'], //Qatar + ['XK051212012345678907'], //Republic of Kosovo + ['PT50000200000163099310356'], //Sao Tome and Principe + ['SA0380000000608010167518'], //Saudi Arabia + ['SN12K00100152000025690007543'], //Senegal + ['TL380080012345678910158'], //Timor-Leste + ['TN5914207207100707129649'], //Tunisia + ['TR330006100519786457841327'], //Turkey + ['UA213223130000026007233566002'], //Ukraine + ['AE260211000000230064017'], //United Arab Emirates + ['VA59001123000012345671'], //Vatican City State + ]; } /** @@ -398,13 +401,13 @@ public function testIbansWithUnsupportedCountryCode($countryCode) public function getUnsupportedCountryCodes() { - return array( - array('AG'), - array('AI'), - array('AQ'), - array('AS'), - array('AW'), - ); + return [ + ['AG'], + ['AI'], + ['AQ'], + ['AS'], + ['AW'], + ]; } public function testIbansWithInvalidCharacters() @@ -422,18 +425,18 @@ public function testIbansWithInvalidCountryCode($iban) public function getIbansWithInvalidCountryCode() { - return array( - array('0750447346'), - array('2X0750447346'), - array('A20750447346'), - ); + return [ + ['0750447346'], + ['2X0750447346'], + ['A20750447346'], + ]; } private function assertViolationRaised($iban, $code) { - $constraint = new Iban(array( + $constraint = new Iban([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($iban, $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/IdenticalToValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/IdenticalToValidatorTest.php index 360eccabc70250d23aee61e677093ea0b6d4048b..c96ac16a919309832c28310e739bd7611b673d3a 100644 --- a/vendor/symfony/validator/Tests/Constraints/IdenticalToValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/IdenticalToValidatorTest.php @@ -55,16 +55,16 @@ public function provideValidComparisons() $date = new \DateTime('2000-01-01'); $object = new ComparisonTest_Class(2); - $comparisons = array( - array(3, 3), - array('a', 'a'), - array($date, $date), - array($object, $object), - array(null, 1), - ); + $comparisons = [ + [3, 3], + ['a', 'a'], + [$date, $date], + [$object, $object], + [null, 1], + ]; $immutableDate = new \DateTimeImmutable('2000-01-01'); - $comparisons[] = array($immutableDate, $immutableDate); + $comparisons[] = [$immutableDate, $immutableDate]; return $comparisons; } @@ -74,9 +74,9 @@ public function provideValidComparisons() */ public function provideValidComparisonsToPropertyPath() { - return array( - array(5), - ); + return [ + [5], + ]; } /** @@ -84,13 +84,13 @@ public function provideValidComparisonsToPropertyPath() */ public function provideInvalidComparisons() { - return array( - array(1, '1', 2, '2', 'integer'), - array(2, '2', '2', '"2"', 'string'), - array('22', '"22"', '333', '"333"', 'string'), - array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', 'DateTime'), - array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('1999-01-01'), 'Jan 1, 1999, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - ); + return [ + [1, '1', 2, '2', 'integer'], + [2, '2', '2', '"2"', 'string'], + ['22', '"22"', '333', '"333"', 'string'], + [new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', 'DateTime'], + [new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('1999-01-01'), 'Jan 1, 1999, 12:00 AM', 'DateTime'], + [new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/ImageValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/ImageValidatorTest.php index 9d80f88d89dfa63d4344f9fdc17fdf2d237e3296..aa8ad4cf55dc77910fe0259adb258e68e3a975cc 100644 --- a/vendor/symfony/validator/Tests/Constraints/ImageValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/ImageValidatorTest.php @@ -74,9 +74,9 @@ public function testValidImage() public function testFileNotFound() { // Check that the logic from FileValidator still works - $constraint = new Image(array( + $constraint = new Image([ 'notFoundMessage' => 'myMessage', - )); + ]); $this->validator->validate('foobar', $constraint); @@ -88,12 +88,12 @@ public function testFileNotFound() public function testValidSize() { - $constraint = new Image(array( + $constraint = new Image([ 'minWidth' => 1, 'maxWidth' => 2, 'minHeight' => 1, 'maxHeight' => 2, - )); + ]); $this->validator->validate($this->image, $constraint); @@ -102,10 +102,10 @@ public function testValidSize() public function testWidthTooSmall() { - $constraint = new Image(array( + $constraint = new Image([ 'minWidth' => 3, 'minWidthMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->image, $constraint); @@ -118,10 +118,10 @@ public function testWidthTooSmall() public function testWidthTooBig() { - $constraint = new Image(array( + $constraint = new Image([ 'maxWidth' => 1, 'maxWidthMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->image, $constraint); @@ -134,10 +134,10 @@ public function testWidthTooBig() public function testHeightTooSmall() { - $constraint = new Image(array( + $constraint = new Image([ 'minHeight' => 3, 'minHeightMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->image, $constraint); @@ -150,10 +150,10 @@ public function testHeightTooSmall() public function testHeightTooBig() { - $constraint = new Image(array( + $constraint = new Image([ 'maxHeight' => 1, 'maxHeightMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->image, $constraint); @@ -166,10 +166,10 @@ public function testHeightTooBig() public function testPixelsTooFew() { - $constraint = new Image(array( + $constraint = new Image([ 'minPixels' => 5, 'minPixelsMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->image, $constraint); @@ -184,10 +184,10 @@ public function testPixelsTooFew() public function testPixelsTooMany() { - $constraint = new Image(array( + $constraint = new Image([ 'maxPixels' => 3, 'maxPixelsMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->image, $constraint); @@ -205,9 +205,9 @@ public function testPixelsTooMany() */ public function testInvalidMinWidth() { - $constraint = new Image(array( + $constraint = new Image([ 'minWidth' => '1abc', - )); + ]); $this->validator->validate($this->image, $constraint); } @@ -217,9 +217,9 @@ public function testInvalidMinWidth() */ public function testInvalidMaxWidth() { - $constraint = new Image(array( + $constraint = new Image([ 'maxWidth' => '1abc', - )); + ]); $this->validator->validate($this->image, $constraint); } @@ -229,9 +229,9 @@ public function testInvalidMaxWidth() */ public function testInvalidMinHeight() { - $constraint = new Image(array( + $constraint = new Image([ 'minHeight' => '1abc', - )); + ]); $this->validator->validate($this->image, $constraint); } @@ -241,9 +241,9 @@ public function testInvalidMinHeight() */ public function testInvalidMaxHeight() { - $constraint = new Image(array( + $constraint = new Image([ 'maxHeight' => '1abc', - )); + ]); $this->validator->validate($this->image, $constraint); } @@ -253,9 +253,9 @@ public function testInvalidMaxHeight() */ public function testInvalidMinPixels() { - $constraint = new Image(array( + $constraint = new Image([ 'minPixels' => '1abc', - )); + ]); $this->validator->validate($this->image, $constraint); } @@ -265,19 +265,19 @@ public function testInvalidMinPixels() */ public function testInvalidMaxPixels() { - $constraint = new Image(array( + $constraint = new Image([ 'maxPixels' => '1abc', - )); + ]); $this->validator->validate($this->image, $constraint); } public function testRatioTooSmall() { - $constraint = new Image(array( + $constraint = new Image([ 'minRatio' => 2, 'minRatioMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->image, $constraint); @@ -290,10 +290,10 @@ public function testRatioTooSmall() public function testRatioTooBig() { - $constraint = new Image(array( + $constraint = new Image([ 'maxRatio' => 0.5, 'maxRatioMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->image, $constraint); @@ -306,9 +306,9 @@ public function testRatioTooBig() public function testMaxRatioUsesTwoDecimalsOnly() { - $constraint = new Image(array( + $constraint = new Image([ 'maxRatio' => 1.33, - )); + ]); $this->validator->validate($this->image4By3, $constraint); @@ -320,9 +320,9 @@ public function testMaxRatioUsesTwoDecimalsOnly() */ public function testInvalidMinRatio() { - $constraint = new Image(array( + $constraint = new Image([ 'minRatio' => '1abc', - )); + ]); $this->validator->validate($this->image, $constraint); } @@ -332,19 +332,19 @@ public function testInvalidMinRatio() */ public function testInvalidMaxRatio() { - $constraint = new Image(array( + $constraint = new Image([ 'maxRatio' => '1abc', - )); + ]); $this->validator->validate($this->image, $constraint); } public function testSquareNotAllowed() { - $constraint = new Image(array( + $constraint = new Image([ 'allowSquare' => false, 'allowSquareMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->image, $constraint); @@ -357,10 +357,10 @@ public function testSquareNotAllowed() public function testLandscapeNotAllowed() { - $constraint = new Image(array( + $constraint = new Image([ 'allowLandscape' => false, 'allowLandscapeMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->imageLandscape, $constraint); @@ -373,10 +373,10 @@ public function testLandscapeNotAllowed() public function testPortraitNotAllowed() { - $constraint = new Image(array( + $constraint = new Image([ 'allowPortrait' => false, 'allowPortraitMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->imagePortrait, $constraint); @@ -393,10 +393,10 @@ public function testCorrupted() $this->markTestSkipped('This test require GD extension'); } - $constraint = new Image(array( + $constraint = new Image([ 'detectCorrupted' => true, 'corruptedMessage' => 'myMessage', - )); + ]); $this->validator->validate($this->image, $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/IpValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/IpValidatorTest.php index 985bd9577d2d5f4ea99d83d6e4429c9a59da298d..1ee44e7c518d653b0467496d2cddac6563bb3e66 100644 --- a/vendor/symfony/validator/Tests/Constraints/IpValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/IpValidatorTest.php @@ -49,9 +49,9 @@ public function testExpectsStringCompatibleType() */ public function testInvalidValidatorVersion() { - new Ip(array( + new Ip([ 'version' => 666, - )); + ]); } /** @@ -59,25 +59,25 @@ public function testInvalidValidatorVersion() */ public function testValidIpsV4($ip) { - $this->validator->validate($ip, new Ip(array( + $this->validator->validate($ip, new Ip([ 'version' => Ip::V4, - ))); + ])); $this->assertNoViolation(); } public function getValidIpsV4() { - return array( - array('0.0.0.0'), - array('10.0.0.0'), - array('123.45.67.178'), - array('172.16.0.0'), - array('192.168.1.0'), - array('224.0.0.1'), - array('255.255.255.255'), - array('127.0.0.0'), - ); + return [ + ['0.0.0.0'], + ['10.0.0.0'], + ['123.45.67.178'], + ['172.16.0.0'], + ['192.168.1.0'], + ['224.0.0.1'], + ['255.255.255.255'], + ['127.0.0.0'], + ]; } /** @@ -85,36 +85,36 @@ public function getValidIpsV4() */ public function testValidIpsV6($ip) { - $this->validator->validate($ip, new Ip(array( + $this->validator->validate($ip, new Ip([ 'version' => Ip::V6, - ))); + ])); $this->assertNoViolation(); } public function getValidIpsV6() { - return array( - array('2001:0db8:85a3:0000:0000:8a2e:0370:7334'), - array('2001:0DB8:85A3:0000:0000:8A2E:0370:7334'), - array('2001:0Db8:85a3:0000:0000:8A2e:0370:7334'), - array('fdfe:dcba:9876:ffff:fdc6:c46b:bb8f:7d4c'), - array('fdc6:c46b:bb8f:7d4c:fdc6:c46b:bb8f:7d4c'), - array('fdc6:c46b:bb8f:7d4c:0000:8a2e:0370:7334'), - array('fe80:0000:0000:0000:0202:b3ff:fe1e:8329'), - array('fe80:0:0:0:202:b3ff:fe1e:8329'), - array('fe80::202:b3ff:fe1e:8329'), - array('0:0:0:0:0:0:0:0'), - array('::'), - array('0::'), - array('::0'), - array('0::0'), + return [ + ['2001:0db8:85a3:0000:0000:8a2e:0370:7334'], + ['2001:0DB8:85A3:0000:0000:8A2E:0370:7334'], + ['2001:0Db8:85a3:0000:0000:8A2e:0370:7334'], + ['fdfe:dcba:9876:ffff:fdc6:c46b:bb8f:7d4c'], + ['fdc6:c46b:bb8f:7d4c:fdc6:c46b:bb8f:7d4c'], + ['fdc6:c46b:bb8f:7d4c:0000:8a2e:0370:7334'], + ['fe80:0000:0000:0000:0202:b3ff:fe1e:8329'], + ['fe80:0:0:0:202:b3ff:fe1e:8329'], + ['fe80::202:b3ff:fe1e:8329'], + ['0:0:0:0:0:0:0:0'], + ['::'], + ['0::'], + ['::0'], + ['0::0'], // IPv4 mapped to IPv6 - array('2001:0db8:85a3:0000:0000:8a2e:0.0.0.0'), - array('::0.0.0.0'), - array('::255.255.255.255'), - array('::123.45.67.178'), - ); + ['2001:0db8:85a3:0000:0000:8a2e:0.0.0.0'], + ['::0.0.0.0'], + ['::255.255.255.255'], + ['::123.45.67.178'], + ]; } /** @@ -122,9 +122,9 @@ public function getValidIpsV6() */ public function testValidIpsAll($ip) { - $this->validator->validate($ip, new Ip(array( + $this->validator->validate($ip, new Ip([ 'version' => Ip::ALL, - ))); + ])); $this->assertNoViolation(); } @@ -139,10 +139,10 @@ public function getValidIpsAll() */ public function testInvalidIpsV4($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::V4, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); @@ -154,17 +154,17 @@ public function testInvalidIpsV4($ip) public function getInvalidIpsV4() { - return array( - array('0'), - array('0.0'), - array('0.0.0'), - array('256.0.0.0'), - array('0.256.0.0'), - array('0.0.256.0'), - array('0.0.0.256'), - array('-1.0.0.0'), - array('foobar'), - ); + return [ + ['0'], + ['0.0'], + ['0.0.0'], + ['256.0.0.0'], + ['0.256.0.0'], + ['0.0.256.0'], + ['0.0.0.256'], + ['-1.0.0.0'], + ['foobar'], + ]; } /** @@ -172,10 +172,10 @@ public function getInvalidIpsV4() */ public function testInvalidPrivateIpsV4($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::V4_NO_PRIV, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); @@ -187,11 +187,11 @@ public function testInvalidPrivateIpsV4($ip) public function getInvalidPrivateIpsV4() { - return array( - array('10.0.0.0'), - array('172.16.0.0'), - array('192.168.1.0'), - ); + return [ + ['10.0.0.0'], + ['172.16.0.0'], + ['192.168.1.0'], + ]; } /** @@ -199,10 +199,10 @@ public function getInvalidPrivateIpsV4() */ public function testInvalidReservedIpsV4($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::V4_NO_RES, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); @@ -214,11 +214,11 @@ public function testInvalidReservedIpsV4($ip) public function getInvalidReservedIpsV4() { - return array( - array('0.0.0.0'), - array('240.0.0.1'), - array('255.255.255.255'), - ); + return [ + ['0.0.0.0'], + ['240.0.0.1'], + ['255.255.255.255'], + ]; } /** @@ -226,10 +226,10 @@ public function getInvalidReservedIpsV4() */ public function testInvalidPublicIpsV4($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::V4_ONLY_PUBLIC, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); @@ -249,10 +249,10 @@ public function getInvalidPublicIpsV4() */ public function testInvalidIpsV6($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::V6, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); @@ -264,21 +264,21 @@ public function testInvalidIpsV6($ip) public function getInvalidIpsV6() { - return array( - array('z001:0db8:85a3:0000:0000:8a2e:0370:7334'), - array('fe80'), - array('fe80:8329'), - array('fe80:::202:b3ff:fe1e:8329'), - array('fe80::202:b3ff::fe1e:8329'), + return [ + ['z001:0db8:85a3:0000:0000:8a2e:0370:7334'], + ['fe80'], + ['fe80:8329'], + ['fe80:::202:b3ff:fe1e:8329'], + ['fe80::202:b3ff::fe1e:8329'], // IPv4 mapped to IPv6 - array('2001:0db8:85a3:0000:0000:8a2e:0370:0.0.0.0'), - array('::0.0'), - array('::0.0.0'), - array('::256.0.0.0'), - array('::0.256.0.0'), - array('::0.0.256.0'), - array('::0.0.0.256'), - ); + ['2001:0db8:85a3:0000:0000:8a2e:0370:0.0.0.0'], + ['::0.0'], + ['::0.0.0'], + ['::256.0.0.0'], + ['::0.256.0.0'], + ['::0.0.256.0'], + ['::0.0.0.256'], + ]; } /** @@ -286,10 +286,10 @@ public function getInvalidIpsV6() */ public function testInvalidPrivateIpsV6($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::V6_NO_PRIV, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); @@ -301,11 +301,11 @@ public function testInvalidPrivateIpsV6($ip) public function getInvalidPrivateIpsV6() { - return array( - array('fdfe:dcba:9876:ffff:fdc6:c46b:bb8f:7d4c'), - array('fdc6:c46b:bb8f:7d4c:fdc6:c46b:bb8f:7d4c'), - array('fdc6:c46b:bb8f:7d4c:0000:8a2e:0370:7334'), - ); + return [ + ['fdfe:dcba:9876:ffff:fdc6:c46b:bb8f:7d4c'], + ['fdc6:c46b:bb8f:7d4c:fdc6:c46b:bb8f:7d4c'], + ['fdc6:c46b:bb8f:7d4c:0000:8a2e:0370:7334'], + ]; } /** @@ -313,10 +313,10 @@ public function getInvalidPrivateIpsV6() */ public function testInvalidReservedIpsV6($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::V6_NO_RES, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); @@ -339,10 +339,10 @@ public function getInvalidReservedIpsV6() */ public function testInvalidPublicIpsV6($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::V6_ONLY_PUBLIC, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); @@ -362,10 +362,10 @@ public function getInvalidPublicIpsV6() */ public function testInvalidIpsAll($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::ALL, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); @@ -385,10 +385,10 @@ public function getInvalidIpsAll() */ public function testInvalidPrivateIpsAll($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::ALL_NO_PRIV, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); @@ -408,10 +408,10 @@ public function getInvalidPrivateIpsAll() */ public function testInvalidReservedIpsAll($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::ALL_NO_RES, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); @@ -431,10 +431,10 @@ public function getInvalidReservedIpsAll() */ public function testInvalidPublicIpsAll($ip) { - $constraint = new Ip(array( + $constraint = new Ip([ 'version' => Ip::ALL_ONLY_PUBLIC, 'message' => 'myMessage', - )); + ]); $this->validator->validate($ip, $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/IsFalseValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/IsFalseValidatorTest.php index ab139a93fd7d307ba0e8916c332941c86fd029cd..65aecf94be599157069d2bc36f8c6ef50d1d92a8 100644 --- a/vendor/symfony/validator/Tests/Constraints/IsFalseValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/IsFalseValidatorTest.php @@ -38,9 +38,9 @@ public function testFalseIsValid() public function testTrueIsInvalid() { - $constraint = new IsFalse(array( + $constraint = new IsFalse([ 'message' => 'myMessage', - )); + ]); $this->validator->validate(true, $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/IsNullValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/IsNullValidatorTest.php index 2cc289b85739d7c07e5898c1f799377bd5d2d1b7..60f9e95f473a40d35f1dea61b6357e8f600700b0 100644 --- a/vendor/symfony/validator/Tests/Constraints/IsNullValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/IsNullValidatorTest.php @@ -34,9 +34,9 @@ public function testNullIsValid() */ public function testInvalidValues($value, $valueAsString) { - $constraint = new IsNull(array( + $constraint = new IsNull([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -48,15 +48,15 @@ public function testInvalidValues($value, $valueAsString) public function getInvalidValues() { - return array( - array(0, '0'), - array(false, 'false'), - array(true, 'true'), - array('', '""'), - array('foo bar', '"foo bar"'), - array(new \DateTime(), 'object'), - array(new \stdClass(), 'object'), - array(array(), 'array'), - ); + return [ + [0, '0'], + [false, 'false'], + [true, 'true'], + ['', '""'], + ['foo bar', '"foo bar"'], + [new \DateTime(), 'object'], + [new \stdClass(), 'object'], + [[], 'array'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/IsTrueValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/IsTrueValidatorTest.php index 821d54da29e59ff6e3c4bd5617ec4f0a2bb1fbd5..e3e0c52b93a63735aa7ad292e9fcf09ba4b7fc0d 100644 --- a/vendor/symfony/validator/Tests/Constraints/IsTrueValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/IsTrueValidatorTest.php @@ -38,9 +38,9 @@ public function testTrueIsValid() public function testFalseIsInvalid() { - $constraint = new IsTrue(array( + $constraint = new IsTrue([ 'message' => 'myMessage', - )); + ]); $this->validator->validate(false, $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/IsbnValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/IsbnValidatorTest.php index f810fc9820ae8af01dec4b7951b5293e17c4f938..3c17fd403ad0ba0168f3ec09d5b876c54df64f93 100644 --- a/vendor/symfony/validator/Tests/Constraints/IsbnValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/IsbnValidatorTest.php @@ -27,79 +27,79 @@ protected function createValidator() public function getValidIsbn10() { - return array( - array('2723442284'), - array('2723442276'), - array('2723455041'), - array('2070546810'), - array('2711858839'), - array('2756406767'), - array('2870971648'), - array('226623854X'), - array('2851806424'), - array('0321812700'), - array('0-45122-5244'), - array('0-4712-92311'), - array('0-9752298-0-X'), - ); + return [ + ['2723442284'], + ['2723442276'], + ['2723455041'], + ['2070546810'], + ['2711858839'], + ['2756406767'], + ['2870971648'], + ['226623854X'], + ['2851806424'], + ['0321812700'], + ['0-45122-5244'], + ['0-4712-92311'], + ['0-9752298-0-X'], + ]; } public function getInvalidIsbn10() { - return array( - array('27234422841', Isbn::TOO_LONG_ERROR), - array('272344228', Isbn::TOO_SHORT_ERROR), - array('0-4712-9231', Isbn::TOO_SHORT_ERROR), - array('1234567890', Isbn::CHECKSUM_FAILED_ERROR), - array('0987656789', Isbn::CHECKSUM_FAILED_ERROR), - array('7-35622-5444', Isbn::CHECKSUM_FAILED_ERROR), - array('0-4X19-92611', Isbn::CHECKSUM_FAILED_ERROR), - array('0_45122_5244', Isbn::INVALID_CHARACTERS_ERROR), - array('2870#971#648', Isbn::INVALID_CHARACTERS_ERROR), - array('0-9752298-0-x', Isbn::INVALID_CHARACTERS_ERROR), - array('1A34567890', Isbn::INVALID_CHARACTERS_ERROR), + return [ + ['27234422841', Isbn::TOO_LONG_ERROR], + ['272344228', Isbn::TOO_SHORT_ERROR], + ['0-4712-9231', Isbn::TOO_SHORT_ERROR], + ['1234567890', Isbn::CHECKSUM_FAILED_ERROR], + ['0987656789', Isbn::CHECKSUM_FAILED_ERROR], + ['7-35622-5444', Isbn::CHECKSUM_FAILED_ERROR], + ['0-4X19-92611', Isbn::CHECKSUM_FAILED_ERROR], + ['0_45122_5244', Isbn::INVALID_CHARACTERS_ERROR], + ['2870#971#648', Isbn::INVALID_CHARACTERS_ERROR], + ['0-9752298-0-x', Isbn::INVALID_CHARACTERS_ERROR], + ['1A34567890', Isbn::INVALID_CHARACTERS_ERROR], // chr(1) evaluates to 0 // 2070546810 is valid - array('2'.\chr(1).'70546810', Isbn::INVALID_CHARACTERS_ERROR), - ); + ['2'.\chr(1).'70546810', Isbn::INVALID_CHARACTERS_ERROR], + ]; } public function getValidIsbn13() { - return array( - array('978-2723442282'), - array('978-2723442275'), - array('978-2723455046'), - array('978-2070546817'), - array('978-2711858835'), - array('978-2756406763'), - array('978-2870971642'), - array('978-2266238540'), - array('978-2851806420'), - array('978-0321812704'), - array('978-0451225245'), - array('978-0471292319'), - ); + return [ + ['978-2723442282'], + ['978-2723442275'], + ['978-2723455046'], + ['978-2070546817'], + ['978-2711858835'], + ['978-2756406763'], + ['978-2870971642'], + ['978-2266238540'], + ['978-2851806420'], + ['978-0321812704'], + ['978-0451225245'], + ['978-0471292319'], + ]; } public function getInvalidIsbn13() { - return array( - array('978-27234422821', Isbn::TOO_LONG_ERROR), - array('978-272344228', Isbn::TOO_SHORT_ERROR), - array('978-2723442-82', Isbn::TOO_SHORT_ERROR), - array('978-2723442281', Isbn::CHECKSUM_FAILED_ERROR), - array('978-0321513774', Isbn::CHECKSUM_FAILED_ERROR), - array('979-0431225385', Isbn::CHECKSUM_FAILED_ERROR), - array('980-0474292319', Isbn::CHECKSUM_FAILED_ERROR), - array('0-4X19-92619812', Isbn::INVALID_CHARACTERS_ERROR), - array('978_2723442282', Isbn::INVALID_CHARACTERS_ERROR), - array('978#2723442282', Isbn::INVALID_CHARACTERS_ERROR), - array('978-272C442282', Isbn::INVALID_CHARACTERS_ERROR), + return [ + ['978-27234422821', Isbn::TOO_LONG_ERROR], + ['978-272344228', Isbn::TOO_SHORT_ERROR], + ['978-2723442-82', Isbn::TOO_SHORT_ERROR], + ['978-2723442281', Isbn::CHECKSUM_FAILED_ERROR], + ['978-0321513774', Isbn::CHECKSUM_FAILED_ERROR], + ['979-0431225385', Isbn::CHECKSUM_FAILED_ERROR], + ['980-0474292319', Isbn::CHECKSUM_FAILED_ERROR], + ['0-4X19-92619812', Isbn::INVALID_CHARACTERS_ERROR], + ['978_2723442282', Isbn::INVALID_CHARACTERS_ERROR], + ['978#2723442282', Isbn::INVALID_CHARACTERS_ERROR], + ['978-272C442282', Isbn::INVALID_CHARACTERS_ERROR], // chr(1) evaluates to 0 // 978-2070546817 is valid - array('978-2'.\chr(1).'70546817', Isbn::INVALID_CHARACTERS_ERROR), - ); + ['978-2'.\chr(1).'70546817', Isbn::INVALID_CHARACTERS_ERROR], + ]; } public function getValidIsbn() @@ -151,9 +151,9 @@ public function testExpectsStringCompatibleType() */ public function testValidIsbn10($isbn) { - $constraint = new Isbn(array( + $constraint = new Isbn([ 'type' => 'isbn10', - )); + ]); $this->validator->validate($isbn, $constraint); @@ -165,10 +165,10 @@ public function testValidIsbn10($isbn) */ public function testInvalidIsbn10($isbn, $code) { - $constraint = new Isbn(array( + $constraint = new Isbn([ 'type' => 'isbn10', 'isbn10Message' => 'myMessage', - )); + ]); $this->validator->validate($isbn, $constraint); @@ -183,7 +183,7 @@ public function testInvalidIsbn10($isbn, $code) */ public function testValidIsbn13($isbn) { - $constraint = new Isbn(array('type' => 'isbn13')); + $constraint = new Isbn(['type' => 'isbn13']); $this->validator->validate($isbn, $constraint); @@ -195,10 +195,10 @@ public function testValidIsbn13($isbn) */ public function testInvalidIsbn13($isbn, $code) { - $constraint = new Isbn(array( + $constraint = new Isbn([ 'type' => 'isbn13', 'isbn13Message' => 'myMessage', - )); + ]); $this->validator->validate($isbn, $constraint); @@ -225,9 +225,9 @@ public function testValidIsbnAny($isbn) */ public function testInvalidIsbnAnyIsbn10($isbn, $code) { - $constraint = new Isbn(array( + $constraint = new Isbn([ 'bothIsbnMessage' => 'myMessage', - )); + ]); $this->validator->validate($isbn, $constraint); @@ -247,9 +247,9 @@ public function testInvalidIsbnAnyIsbn10($isbn, $code) */ public function testInvalidIsbnAnyIsbn13($isbn, $code) { - $constraint = new Isbn(array( + $constraint = new Isbn([ 'bothIsbnMessage' => 'myMessage', - )); + ]); $this->validator->validate($isbn, $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/IssnValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/IssnValidatorTest.php index ca61ffac4c5505df1e99205b6aad57c2f4161fd9..c9ca7ade88773e2aa2a2d21eac22c55a21c49149 100644 --- a/vendor/symfony/validator/Tests/Constraints/IssnValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/IssnValidatorTest.php @@ -27,42 +27,42 @@ protected function createValidator() public function getValidLowerCasedIssn() { - return array( - array('2162-321x'), - array('2160-200x'), - array('1537-453x'), - array('1937-710x'), - array('0002-922x'), - array('1553-345x'), - array('1553-619x'), - ); + return [ + ['2162-321x'], + ['2160-200x'], + ['1537-453x'], + ['1937-710x'], + ['0002-922x'], + ['1553-345x'], + ['1553-619x'], + ]; } public function getValidNonHyphenatedIssn() { - return array( - array('2162321X'), - array('01896016'), - array('15744647'), - array('14350645'), - array('07174055'), - array('20905076'), - array('14401592'), - ); + return [ + ['2162321X'], + ['01896016'], + ['15744647'], + ['14350645'], + ['07174055'], + ['20905076'], + ['14401592'], + ]; } public function getFullValidIssn() { - return array( - array('1550-7416'), - array('1539-8560'), - array('2156-5376'), - array('1119-023X'), - array('1684-5315'), - array('1996-0786'), - array('1684-5374'), - array('1996-0794'), - ); + return [ + ['1550-7416'], + ['1539-8560'], + ['2156-5376'], + ['1119-023X'], + ['1684-5315'], + ['1996-0786'], + ['1684-5374'], + ['1996-0794'], + ]; } public function getValidIssn() @@ -76,16 +76,16 @@ public function getValidIssn() public function getInvalidIssn() { - return array( - array(0, Issn::TOO_SHORT_ERROR), - array('1539', Issn::TOO_SHORT_ERROR), - array('2156-537A', Issn::INVALID_CHARACTERS_ERROR), - array('1119-0231', Issn::CHECKSUM_FAILED_ERROR), - array('1684-5312', Issn::CHECKSUM_FAILED_ERROR), - array('1996-0783', Issn::CHECKSUM_FAILED_ERROR), - array('1684-537X', Issn::CHECKSUM_FAILED_ERROR), - array('1996-0795', Issn::CHECKSUM_FAILED_ERROR), - ); + return [ + [0, Issn::TOO_SHORT_ERROR], + ['1539', Issn::TOO_SHORT_ERROR], + ['2156-537A', Issn::INVALID_CHARACTERS_ERROR], + ['1119-0231', Issn::CHECKSUM_FAILED_ERROR], + ['1684-5312', Issn::CHECKSUM_FAILED_ERROR], + ['1996-0783', Issn::CHECKSUM_FAILED_ERROR], + ['1684-537X', Issn::CHECKSUM_FAILED_ERROR], + ['1996-0795', Issn::CHECKSUM_FAILED_ERROR], + ]; } public function testNullIsValid() @@ -120,10 +120,10 @@ public function testExpectsStringCompatibleType() */ public function testCaseSensitiveIssns($issn) { - $constraint = new Issn(array( + $constraint = new Issn([ 'caseSensitive' => true, 'message' => 'myMessage', - )); + ]); $this->validator->validate($issn, $constraint); @@ -138,10 +138,10 @@ public function testCaseSensitiveIssns($issn) */ public function testRequireHyphenIssns($issn) { - $constraint = new Issn(array( + $constraint = new Issn([ 'requireHyphen' => true, 'message' => 'myMessage', - )); + ]); $this->validator->validate($issn, $constraint); @@ -168,9 +168,9 @@ public function testValidIssn($issn) */ public function testInvalidIssn($issn, $code) { - $constraint = new Issn(array( + $constraint = new Issn([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($issn, $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/LanguageValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/LanguageValidatorTest.php index 2980f2a23319320bdd5b3539eea332a662c0e70c..247301df2e1694bfc403ae15c5c0c615dae7ca05 100644 --- a/vendor/symfony/validator/Tests/Constraints/LanguageValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/LanguageValidatorTest.php @@ -57,11 +57,11 @@ public function testValidLanguages($language) public function getValidLanguages() { - return array( - array('en'), - array('en_US'), - array('my'), - ); + return [ + ['en'], + ['en_US'], + ['my'], + ]; } /** @@ -69,9 +69,9 @@ public function getValidLanguages() */ public function testInvalidLanguages($language) { - $constraint = new Language(array( + $constraint = new Language([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($language, $constraint); @@ -83,10 +83,10 @@ public function testInvalidLanguages($language) public function getInvalidLanguages() { - return array( - array('EN'), - array('foobar'), - ); + return [ + ['EN'], + ['foobar'], + ]; } public function testValidateUsingCountrySpecificLocale() @@ -96,9 +96,9 @@ public function testValidateUsingCountrySpecificLocale() \Locale::setDefault('fr_FR'); $existingLanguage = 'en'; - $this->validator->validate($existingLanguage, new Language(array( + $this->validator->validate($existingLanguage, new Language([ 'message' => 'aMessage', - ))); + ])); $this->assertNoViolation(); } diff --git a/vendor/symfony/validator/Tests/Constraints/LengthValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/LengthValidatorTest.php index da98387ccb466669ee149f88b695681037d1f420..955d8b556453e08dd4676c55ca70cc8c57e2ad64 100644 --- a/vendor/symfony/validator/Tests/Constraints/LengthValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/LengthValidatorTest.php @@ -46,50 +46,50 @@ public function testExpectsStringCompatibleType() public function getThreeOrLessCharacters() { - return array( - array(12), - array('12'), - array('üü'), - array('éé'), - array(123), - array('123'), - array('üüü'), - array('ééé'), - ); + return [ + [12], + ['12'], + ['üü'], + ['éé'], + [123], + ['123'], + ['üüü'], + ['ééé'], + ]; } public function getFourCharacters() { - return array( - array(1234), - array('1234'), - array('üüüü'), - array('éééé'), - ); + return [ + [1234], + ['1234'], + ['üüüü'], + ['éééé'], + ]; } public function getFiveOrMoreCharacters() { - return array( - array(12345), - array('12345'), - array('üüüüü'), - array('ééééé'), - array(123456), - array('123456'), - array('üüüüüü'), - array('éééééé'), - ); + return [ + [12345], + ['12345'], + ['üüüüü'], + ['ééééé'], + [123456], + ['123456'], + ['üüüüüü'], + ['éééééé'], + ]; } public function getOneCharset() { - return array( - array('é', 'utf8', true), - array("\xE9", 'CP1252', true), - array("\xE9", 'XXX', false), - array("\xE9", 'utf8', false), - ); + return [ + ['é', 'utf8', true], + ["\xE9", 'CP1252', true], + ["\xE9", 'XXX', false], + ["\xE9", 'utf8', false], + ]; } /** @@ -97,7 +97,7 @@ public function getOneCharset() */ public function testValidValuesMin($value) { - $constraint = new Length(array('min' => 5)); + $constraint = new Length(['min' => 5]); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -108,7 +108,7 @@ public function testValidValuesMin($value) */ public function testValidValuesMax($value) { - $constraint = new Length(array('max' => 3)); + $constraint = new Length(['max' => 3]); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -130,10 +130,10 @@ public function testValidValuesExact($value) */ public function testInvalidValuesMin($value) { - $constraint = new Length(array( + $constraint = new Length([ 'min' => 4, 'minMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -151,10 +151,10 @@ public function testInvalidValuesMin($value) */ public function testInvalidValuesMax($value) { - $constraint = new Length(array( + $constraint = new Length([ 'max' => 4, 'maxMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -172,11 +172,11 @@ public function testInvalidValuesMax($value) */ public function testInvalidValuesExactLessThanFour($value) { - $constraint = new Length(array( + $constraint = new Length([ 'min' => 4, 'max' => 4, 'exactMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -194,11 +194,11 @@ public function testInvalidValuesExactLessThanFour($value) */ public function testInvalidValuesExactMoreThanFour($value) { - $constraint = new Length(array( + $constraint = new Length([ 'min' => 4, 'max' => 4, 'exactMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -216,12 +216,12 @@ public function testInvalidValuesExactMoreThanFour($value) */ public function testOneCharset($value, $charset, $isValid) { - $constraint = new Length(array( + $constraint = new Length([ 'min' => 1, 'max' => 1, 'charset' => $charset, 'charsetMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/LessThanOrEqualValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/LessThanOrEqualValidatorTest.php index f31a50e673c8fd54ddca2088c9b30eabcb87706b..b77deff6163d632b0c9635ca24299dd00d589792 100644 --- a/vendor/symfony/validator/Tests/Constraints/LessThanOrEqualValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/LessThanOrEqualValidatorTest.php @@ -39,21 +39,21 @@ protected function getErrorCode() */ public function provideValidComparisons() { - return array( - array(1, 2), - array(1, 1), - array(new \DateTime('2000-01-01'), new \DateTime('2000-01-01')), - array(new \DateTime('2000-01-01'), new \DateTime('2020-01-01')), - array(new \DateTime('2000-01-01'), '2000-01-01'), - array(new \DateTime('2000-01-01'), '2020-01-01'), - array(new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'), - array(new \DateTime('2000-01-01 UTC'), '2020-01-01 UTC'), - array(new ComparisonTest_Class(4), new ComparisonTest_Class(5)), - array(new ComparisonTest_Class(5), new ComparisonTest_Class(5)), - array('a', 'a'), - array('a', 'z'), - array(null, 1), - ); + return [ + [1, 2], + [1, 1], + [new \DateTime('2000-01-01'), new \DateTime('2000-01-01')], + [new \DateTime('2000-01-01'), new \DateTime('2020-01-01')], + [new \DateTime('2000-01-01'), '2000-01-01'], + [new \DateTime('2000-01-01'), '2020-01-01'], + [new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'], + [new \DateTime('2000-01-01 UTC'), '2020-01-01 UTC'], + [new ComparisonTest_Class(4), new ComparisonTest_Class(5)], + [new ComparisonTest_Class(5), new ComparisonTest_Class(5)], + ['a', 'a'], + ['a', 'z'], + [null, 1], + ]; } /** @@ -61,10 +61,10 @@ public function provideValidComparisons() */ public function provideValidComparisonsToPropertyPath() { - return array( - array(4), - array(5), - ); + return [ + [4], + [5], + ]; } /** @@ -72,13 +72,13 @@ public function provideValidComparisonsToPropertyPath() */ public function provideInvalidComparisons() { - return array( - array(2, '2', 1, '1', 'integer'), - array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2010-01-01 UTC'), 'Jan 1, 2010, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(4), '4', __NAMESPACE__.'\ComparisonTest_Class'), - array('c', '"c"', 'b', '"b"', 'string'), - ); + return [ + [2, '2', 1, '1', 'integer'], + [new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2010-01-01 UTC'), 'Jan 1, 2010, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new ComparisonTest_Class(5), '5', new ComparisonTest_Class(4), '4', __NAMESPACE__.'\ComparisonTest_Class'], + ['c', '"c"', 'b', '"b"', 'string'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/LessThanValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/LessThanValidatorTest.php index a5d69355d7e584f0cc211e99fd1b6d3bcccc6163..7d209ed5d4719297708a44821c4cbf1974d1e0f7 100644 --- a/vendor/symfony/validator/Tests/Constraints/LessThanValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/LessThanValidatorTest.php @@ -39,15 +39,15 @@ protected function getErrorCode() */ public function provideValidComparisons() { - return array( - array(1, 2), - array(new \DateTime('2000-01-01'), new \DateTime('2010-01-01')), - array(new \DateTime('2000-01-01'), '2010-01-01'), - array(new \DateTime('2000-01-01 UTC'), '2010-01-01 UTC'), - array(new ComparisonTest_Class(4), new ComparisonTest_Class(5)), - array('22', '333'), - array(null, 1), - ); + return [ + [1, 2], + [new \DateTime('2000-01-01'), new \DateTime('2010-01-01')], + [new \DateTime('2000-01-01'), '2010-01-01'], + [new \DateTime('2000-01-01 UTC'), '2010-01-01 UTC'], + [new ComparisonTest_Class(4), new ComparisonTest_Class(5)], + ['22', '333'], + [null, 1], + ]; } /** @@ -55,9 +55,9 @@ public function provideValidComparisons() */ public function provideValidComparisonsToPropertyPath() { - return array( - array(4), - ); + return [ + [4], + ]; } /** @@ -65,18 +65,18 @@ public function provideValidComparisonsToPropertyPath() */ public function provideInvalidComparisons() { - return array( - array(3, '3', 2, '2', 'integer'), - array(2, '2', 2, '2', 'integer'), - array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2010-01-01 UTC'), 'Jan 1, 2010, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000-01-01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - array(new ComparisonTest_Class(6), '6', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - array('333', '"333"', '22', '"22"', 'string'), - ); + return [ + [3, '3', 2, '2', 'integer'], + [2, '2', 2, '2', 'integer'], + [new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2010-01-01 UTC'), 'Jan 1, 2010, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2000-01-01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'], + [new ComparisonTest_Class(6), '6', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'], + ['333', '"333"', '22', '"22"', 'string'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/LocaleValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/LocaleValidatorTest.php index 29409e61f52f78be53bfd00330b09697125a6737..3d5123116534d75d274325f0ebcde1b14acb246d 100644 --- a/vendor/symfony/validator/Tests/Constraints/LocaleValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/LocaleValidatorTest.php @@ -56,14 +56,14 @@ public function testValidLocales($locale) public function getValidLocales() { - return array( - array('en'), - array('en_US'), - array('pt'), - array('pt_PT'), - array('zh_Hans'), - array('fil_PH'), - ); + return [ + ['en'], + ['en_US'], + ['pt'], + ['pt_PT'], + ['zh_Hans'], + ['fil_PH'], + ]; } /** @@ -71,9 +71,9 @@ public function getValidLocales() */ public function testInvalidLocales($locale) { - $constraint = new Locale(array( + $constraint = new Locale([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($locale, $constraint); @@ -85,9 +85,9 @@ public function testInvalidLocales($locale) public function getInvalidLocales() { - return array( - array('EN'), - array('foobar'), - ); + return [ + ['EN'], + ['foobar'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/LuhnValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/LuhnValidatorTest.php index 3ee04d7f46820a82008d93fccc334b790bd9ece0..02aae3adbc31749a826b2eaf9c7ae566c630e0eb 100644 --- a/vendor/symfony/validator/Tests/Constraints/LuhnValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/LuhnValidatorTest.php @@ -48,26 +48,26 @@ public function testValidNumbers($number) public function getValidNumbers() { - return array( - array('42424242424242424242'), - array('378282246310005'), - array('371449635398431'), - array('378734493671000'), - array('5610591081018250'), - array('30569309025904'), - array('38520000023237'), - array('6011111111111117'), - array('6011000990139424'), - array('3530111333300000'), - array('3566002020360505'), - array('5555555555554444'), - array('5105105105105100'), - array('4111111111111111'), - array('4012888888881881'), - array('4222222222222'), - array('5019717010103742'), - array('6331101999990016'), - ); + return [ + ['42424242424242424242'], + ['378282246310005'], + ['371449635398431'], + ['378734493671000'], + ['5610591081018250'], + ['30569309025904'], + ['38520000023237'], + ['6011111111111117'], + ['6011000990139424'], + ['3530111333300000'], + ['3566002020360505'], + ['5555555555554444'], + ['5105105105105100'], + ['4111111111111111'], + ['4012888888881881'], + ['4222222222222'], + ['5019717010103742'], + ['6331101999990016'], + ]; } /** @@ -75,9 +75,9 @@ public function getValidNumbers() */ public function testInvalidNumbers($number, $code) { - $constraint = new Luhn(array( + $constraint = new Luhn([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($number, $constraint); @@ -89,13 +89,13 @@ public function testInvalidNumbers($number, $code) public function getInvalidNumbers() { - return array( - array('1234567812345678', Luhn::CHECKSUM_FAILED_ERROR), - array('4222222222222222', Luhn::CHECKSUM_FAILED_ERROR), - array('0000000000000000', Luhn::CHECKSUM_FAILED_ERROR), - array('000000!000000000', Luhn::INVALID_CHARACTERS_ERROR), - array('42-22222222222222', Luhn::INVALID_CHARACTERS_ERROR), - ); + return [ + ['1234567812345678', Luhn::CHECKSUM_FAILED_ERROR], + ['4222222222222222', Luhn::CHECKSUM_FAILED_ERROR], + ['0000000000000000', Luhn::CHECKSUM_FAILED_ERROR], + ['000000!000000000', Luhn::INVALID_CHARACTERS_ERROR], + ['42-22222222222222', Luhn::INVALID_CHARACTERS_ERROR], + ]; } /** @@ -111,12 +111,12 @@ public function testInvalidTypes($number) public function getInvalidTypes() { - return array( - array(0), - array(123), - array(42424242424242424242), - array(378282246310005), - array(371449635398431), - ); + return [ + [0], + [123], + [42424242424242424242], + [378282246310005], + [371449635398431], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/NotBlankValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/NotBlankValidatorTest.php index fd92febf9b29b96c31975ab7f67b4217db9d3f92..f634e0c11c24861702e33231bc4a017d145f5945 100644 --- a/vendor/symfony/validator/Tests/Constraints/NotBlankValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/NotBlankValidatorTest.php @@ -34,20 +34,20 @@ public function testValidValues($value) public function getValidValues() { - return array( - array('foobar'), - array(0), - array(0.0), - array('0'), - array(1234), - ); + return [ + ['foobar'], + [0], + [0.0], + ['0'], + [1234], + ]; } public function testNullIsInvalid() { - $constraint = new NotBlank(array( + $constraint = new NotBlank([ 'message' => 'myMessage', - )); + ]); $this->validator->validate(null, $constraint); @@ -59,9 +59,9 @@ public function testNullIsInvalid() public function testBlankIsInvalid() { - $constraint = new NotBlank(array( + $constraint = new NotBlank([ 'message' => 'myMessage', - )); + ]); $this->validator->validate('', $constraint); @@ -73,9 +73,9 @@ public function testBlankIsInvalid() public function testFalseIsInvalid() { - $constraint = new NotBlank(array( + $constraint = new NotBlank([ 'message' => 'myMessage', - )); + ]); $this->validator->validate(false, $constraint); @@ -87,11 +87,11 @@ public function testFalseIsInvalid() public function testEmptyArrayIsInvalid() { - $constraint = new NotBlank(array( + $constraint = new NotBlank([ 'message' => 'myMessage', - )); + ]); - $this->validator->validate(array(), $constraint); + $this->validator->validate([], $constraint); $this->buildViolation('myMessage') ->setParameter('{{ value }}', 'array') diff --git a/vendor/symfony/validator/Tests/Constraints/NotEqualToValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/NotEqualToValidatorTest.php index e7031d4c4dfd84f8bdc03b97293b9d5dd537baa5..810f7a175f10416530a307992a0c41135a5fe6b0 100644 --- a/vendor/symfony/validator/Tests/Constraints/NotEqualToValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/NotEqualToValidatorTest.php @@ -39,15 +39,15 @@ protected function getErrorCode() */ public function provideValidComparisons() { - return array( - array(1, 2), - array('22', '333'), - array(new \DateTime('2001-01-01'), new \DateTime('2000-01-01')), - array(new \DateTime('2001-01-01'), '2000-01-01'), - array(new \DateTime('2001-01-01 UTC'), '2000-01-01 UTC'), - array(new ComparisonTest_Class(6), new ComparisonTest_Class(5)), - array(null, 1), - ); + return [ + [1, 2], + ['22', '333'], + [new \DateTime('2001-01-01'), new \DateTime('2000-01-01')], + [new \DateTime('2001-01-01'), '2000-01-01'], + [new \DateTime('2001-01-01 UTC'), '2000-01-01 UTC'], + [new ComparisonTest_Class(6), new ComparisonTest_Class(5)], + [null, 1], + ]; } /** @@ -55,9 +55,9 @@ public function provideValidComparisons() */ public function provideValidComparisonsToPropertyPath() { - return array( - array(0), - ); + return [ + [0], + ]; } /** @@ -65,14 +65,14 @@ public function provideValidComparisonsToPropertyPath() */ public function provideInvalidComparisons() { - return array( - array(3, '3', 3, '3', 'integer'), - array('2', '"2"', 2, '2', 'integer'), - array('a', '"a"', 'a', '"a"', 'string'), - array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000-01-01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - ); + return [ + [3, '3', 3, '3', 'integer'], + ['2', '"2"', 2, '2', 'integer'], + ['a', '"a"', 'a', '"a"', 'string'], + [new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new \DateTime('2000-01-01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/NotIdenticalToValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/NotIdenticalToValidatorTest.php index 907f36c0632907b8dae7fb7341d071aac13aa6c7..0cb9ec543114c9e3811441348116d22d8bb1d7af 100644 --- a/vendor/symfony/validator/Tests/Constraints/NotIdenticalToValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/NotIdenticalToValidatorTest.php @@ -39,18 +39,18 @@ protected function getErrorCode() */ public function provideValidComparisons() { - return array( - array(1, 2), - array('2', 2), - array('22', '333'), - array(new \DateTime('2001-01-01'), new \DateTime('2000-01-01')), - array(new \DateTime('2000-01-01'), new \DateTime('2000-01-01')), - array(new \DateTime('2001-01-01'), '2000-01-01'), - array(new \DateTime('2000-01-01'), '2000-01-01'), - array(new \DateTime('2001-01-01'), '2000-01-01'), - array(new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'), - array(null, 1), - ); + return [ + [1, 2], + ['2', 2], + ['22', '333'], + [new \DateTime('2001-01-01'), new \DateTime('2000-01-01')], + [new \DateTime('2000-01-01'), new \DateTime('2000-01-01')], + [new \DateTime('2001-01-01'), '2000-01-01'], + [new \DateTime('2000-01-01'), '2000-01-01'], + [new \DateTime('2001-01-01'), '2000-01-01'], + [new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'], + [null, 1], + ]; } /** @@ -58,9 +58,9 @@ public function provideValidComparisons() */ public function provideValidComparisonsToPropertyPath() { - return array( - array(0), - ); + return [ + [0], + ]; } public function provideAllInvalidComparisons() @@ -84,12 +84,12 @@ public function provideInvalidComparisons() $date = new \DateTime('2000-01-01'); $object = new ComparisonTest_Class(2); - $comparisons = array( - array(3, '3', 3, '3', 'integer'), - array('a', '"a"', 'a', '"a"', 'string'), - array($date, 'Jan 1, 2000, 12:00 AM', $date, 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array($object, '2', $object, '2', __NAMESPACE__.'\ComparisonTest_Class'), - ); + $comparisons = [ + [3, '3', 3, '3', 'integer'], + ['a', '"a"', 'a', '"a"', 'string'], + [$date, 'Jan 1, 2000, 12:00 AM', $date, 'Jan 1, 2000, 12:00 AM', 'DateTime'], + [$object, '2', $object, '2', __NAMESPACE__.'\ComparisonTest_Class'], + ]; return $comparisons; } diff --git a/vendor/symfony/validator/Tests/Constraints/NotNullValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/NotNullValidatorTest.php index feb3c2f8e787ffd3f879e785c56e4e16e3acc4b9..a726d063b993126f607d56a510e8c211daf44285 100644 --- a/vendor/symfony/validator/Tests/Constraints/NotNullValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/NotNullValidatorTest.php @@ -34,19 +34,19 @@ public function testValidValues($value) public function getValidValues() { - return array( - array(0), - array(false), - array(true), - array(''), - ); + return [ + [0], + [false], + [true], + [''], + ]; } public function testNullIsInvalid() { - $constraint = new NotNull(array( + $constraint = new NotNull([ 'message' => 'myMessage', - )); + ]); $this->validator->validate(null, $constraint); diff --git a/vendor/symfony/validator/Tests/Constraints/RangeValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/RangeValidatorTest.php index 7eb931ee92039a7ecbebc16ac7d17f96bbcd8dd0..661161d886a20e70a0d835cf8d130264ecc76a07 100644 --- a/vendor/symfony/validator/Tests/Constraints/RangeValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/RangeValidatorTest.php @@ -25,43 +25,43 @@ protected function createValidator() public function testNullIsValid() { - $this->validator->validate(null, new Range(array('min' => 10, 'max' => 20))); + $this->validator->validate(null, new Range(['min' => 10, 'max' => 20])); $this->assertNoViolation(); } public function getTenToTwenty() { - return array( - array(10.00001), - array(19.99999), - array('10.00001'), - array('19.99999'), - array(10), - array(20), - array(10.0), - array(20.0), - ); + return [ + [10.00001], + [19.99999], + ['10.00001'], + ['19.99999'], + [10], + [20], + [10.0], + [20.0], + ]; } public function getLessThanTen() { - return array( - array(9.99999, '9.99999'), - array('9.99999', '"9.99999"'), - array(5, '5'), - array(1.0, '1.0'), - ); + return [ + [9.99999, '9.99999'], + ['9.99999', '"9.99999"'], + [5, '5'], + [1.0, '1.0'], + ]; } public function getMoreThanTwenty() { - return array( - array(20.000001, '20.000001'), - array('20.000001', '"20.000001"'), - array(21, '21'), - array(30.0, '30.0'), - ); + return [ + [20.000001, '20.000001'], + ['20.000001', '"20.000001"'], + [21, '21'], + [30.0, '30.0'], + ]; } /** @@ -69,7 +69,7 @@ public function getMoreThanTwenty() */ public function testValidValuesMin($value) { - $constraint = new Range(array('min' => 10)); + $constraint = new Range(['min' => 10]); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -80,7 +80,7 @@ public function testValidValuesMin($value) */ public function testValidValuesMax($value) { - $constraint = new Range(array('max' => 20)); + $constraint = new Range(['max' => 20]); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -91,7 +91,7 @@ public function testValidValuesMax($value) */ public function testValidValuesMinMax($value) { - $constraint = new Range(array('min' => 10, 'max' => 20)); + $constraint = new Range(['min' => 10, 'max' => 20]); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -102,10 +102,10 @@ public function testValidValuesMinMax($value) */ public function testInvalidValuesMin($value, $formattedValue) { - $constraint = new Range(array( + $constraint = new Range([ 'min' => 10, 'minMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -121,10 +121,10 @@ public function testInvalidValuesMin($value, $formattedValue) */ public function testInvalidValuesMax($value, $formattedValue) { - $constraint = new Range(array( + $constraint = new Range([ 'max' => 20, 'maxMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -140,12 +140,12 @@ public function testInvalidValuesMax($value, $formattedValue) */ public function testInvalidValuesCombinedMax($value, $formattedValue) { - $constraint = new Range(array( + $constraint = new Range([ 'min' => 10, 'max' => 20, 'minMessage' => 'myMinMessage', 'maxMessage' => 'myMaxMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -161,12 +161,12 @@ public function testInvalidValuesCombinedMax($value, $formattedValue) */ public function testInvalidValuesCombinedMin($value, $formattedValue) { - $constraint = new Range(array( + $constraint = new Range([ 'min' => 10, 'max' => 20, 'minMessage' => 'myMinMessage', 'maxMessage' => 'myMaxMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -183,15 +183,15 @@ public function getTenthToTwentiethMarch2014() // the default timezone $this->setDefaultTimezone('UTC'); - $tests = array( - array(new \DateTime('March 10, 2014')), - array(new \DateTime('March 15, 2014')), - array(new \DateTime('March 20, 2014')), - ); + $tests = [ + [new \DateTime('March 10, 2014')], + [new \DateTime('March 15, 2014')], + [new \DateTime('March 20, 2014')], + ]; - $tests[] = array(new \DateTimeImmutable('March 10, 2014')); - $tests[] = array(new \DateTimeImmutable('March 15, 2014')); - $tests[] = array(new \DateTimeImmutable('March 20, 2014')); + $tests[] = [new \DateTimeImmutable('March 10, 2014')]; + $tests[] = [new \DateTimeImmutable('March 15, 2014')]; + $tests[] = [new \DateTimeImmutable('March 20, 2014')]; $this->restoreDefaultTimezone(); @@ -204,13 +204,13 @@ public function getSoonerThanTenthMarch2014() // the default timezone $this->setDefaultTimezone('UTC'); - $tests = array( - array(new \DateTime('March 20, 2013'), 'Mar 20, 2013, 12:00 AM'), - array(new \DateTime('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'), - ); + $tests = [ + [new \DateTime('March 20, 2013'), 'Mar 20, 2013, 12:00 AM'], + [new \DateTime('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'], + ]; - $tests[] = array(new \DateTimeImmutable('March 20, 2013'), 'Mar 20, 2013, 12:00 AM'); - $tests[] = array(new \DateTimeImmutable('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'); + $tests[] = [new \DateTimeImmutable('March 20, 2013'), 'Mar 20, 2013, 12:00 AM']; + $tests[] = [new \DateTimeImmutable('March 9, 2014'), 'Mar 9, 2014, 12:00 AM']; $this->restoreDefaultTimezone(); @@ -223,13 +223,13 @@ public function getLaterThanTwentiethMarch2014() // the default timezone $this->setDefaultTimezone('UTC'); - $tests = array( - array(new \DateTime('March 21, 2014'), 'Mar 21, 2014, 12:00 AM'), - array(new \DateTime('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'), - ); + $tests = [ + [new \DateTime('March 21, 2014'), 'Mar 21, 2014, 12:00 AM'], + [new \DateTime('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'], + ]; - $tests[] = array(new \DateTimeImmutable('March 21, 2014'), 'Mar 21, 2014, 12:00 AM'); - $tests[] = array(new \DateTimeImmutable('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'); + $tests[] = [new \DateTimeImmutable('March 21, 2014'), 'Mar 21, 2014, 12:00 AM']; + $tests[] = [new \DateTimeImmutable('March 9, 2015'), 'Mar 9, 2015, 12:00 AM']; $this->restoreDefaultTimezone(); @@ -241,7 +241,7 @@ public function getLaterThanTwentiethMarch2014() */ public function testValidDatesMin($value) { - $constraint = new Range(array('min' => 'March 10, 2014')); + $constraint = new Range(['min' => 'March 10, 2014']); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -252,7 +252,7 @@ public function testValidDatesMin($value) */ public function testValidDatesMax($value) { - $constraint = new Range(array('max' => 'March 20, 2014')); + $constraint = new Range(['max' => 'March 20, 2014']); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -263,7 +263,7 @@ public function testValidDatesMax($value) */ public function testValidDatesMinMax($value) { - $constraint = new Range(array('min' => 'March 10, 2014', 'max' => 'March 20, 2014')); + $constraint = new Range(['min' => 'March 10, 2014', 'max' => 'March 20, 2014']); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -278,10 +278,10 @@ public function testInvalidDatesMin($value, $dateTimeAsString) // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this, '57.1'); - $constraint = new Range(array( + $constraint = new Range([ 'min' => 'March 10, 2014', 'minMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -301,10 +301,10 @@ public function testInvalidDatesMax($value, $dateTimeAsString) // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this, '57.1'); - $constraint = new Range(array( + $constraint = new Range([ 'max' => 'March 20, 2014', 'maxMessage' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -324,12 +324,12 @@ public function testInvalidDatesCombinedMax($value, $dateTimeAsString) // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this, '57.1'); - $constraint = new Range(array( + $constraint = new Range([ 'min' => 'March 10, 2014', 'max' => 'March 20, 2014', 'minMessage' => 'myMinMessage', 'maxMessage' => 'myMaxMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -349,12 +349,12 @@ public function testInvalidDatesCombinedMin($value, $dateTimeAsString) // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this, '57.1'); - $constraint = new Range(array( + $constraint = new Range([ 'min' => 'March 10, 2014', 'max' => 'March 20, 2014', 'minMessage' => 'myMinMessage', 'maxMessage' => 'myMaxMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -367,22 +367,22 @@ public function testInvalidDatesCombinedMin($value, $dateTimeAsString) public function getInvalidValues() { - return array( - array(9.999999), - array(20.000001), - array('9.999999'), - array('20.000001'), - array(new \stdClass()), - ); + return [ + [9.999999], + [20.000001], + ['9.999999'], + ['20.000001'], + [new \stdClass()], + ]; } public function testNonNumeric() { - $this->validator->validate('abcd', new Range(array( + $this->validator->validate('abcd', new Range([ 'min' => 10, 'max' => 20, 'invalidMessage' => 'myMessage', - ))); + ])); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"abcd"') diff --git a/vendor/symfony/validator/Tests/Constraints/RegexTest.php b/vendor/symfony/validator/Tests/Constraints/RegexTest.php index 26ef1b27361adc3405afadb5d12136d40f907c81..8dc1e4af7dea8d88f39beb59a33cd677d4099d0e 100644 --- a/vendor/symfony/validator/Tests/Constraints/RegexTest.php +++ b/vendor/symfony/validator/Tests/Constraints/RegexTest.php @@ -28,37 +28,37 @@ public function testConstraintGetDefaultOption() public function provideHtmlPatterns() { - return array( + return [ // HTML5 wraps the pattern in ^(?:pattern)$ - array('/^[0-9]+$/', '[0-9]+'), - array('/[0-9]+$/', '.*[0-9]+'), - array('/^[0-9]+/', '[0-9]+.*'), - array('/[0-9]+/', '.*[0-9]+.*'), + ['/^[0-9]+$/', '[0-9]+'], + ['/[0-9]+$/', '.*[0-9]+'], + ['/^[0-9]+/', '[0-9]+.*'], + ['/[0-9]+/', '.*[0-9]+.*'], // We need a smart way to allow matching of patterns that contain // ^ and $ at various sub-clauses of an or-clause // .*(pattern).* seems to work correctly - array('/[0-9]$|[a-z]+/', '.*([0-9]$|[a-z]+).*'), - array('/[0-9]$|^[a-z]+/', '.*([0-9]$|^[a-z]+).*'), - array('/^[0-9]|[a-z]+$/', '.*(^[0-9]|[a-z]+$).*'), + ['/[0-9]$|[a-z]+/', '.*([0-9]$|[a-z]+).*'], + ['/[0-9]$|^[a-z]+/', '.*([0-9]$|^[a-z]+).*'], + ['/^[0-9]|[a-z]+$/', '.*(^[0-9]|[a-z]+$).*'], // Unescape escaped delimiters - array('/^[0-9]+\/$/', '[0-9]+/'), - array('#^[0-9]+\#$#', '[0-9]+#'), + ['/^[0-9]+\/$/', '[0-9]+/'], + ['#^[0-9]+\#$#', '[0-9]+#'], // Cannot be converted - array('/^[0-9]+$/i', null), + ['/^[0-9]+$/i', null], // Inverse matches are simple, just wrap in // ((?!pattern).)* - array('/^[0-9]+$/', '((?!^[0-9]+$).)*', false), - array('/[0-9]+$/', '((?![0-9]+$).)*', false), - array('/^[0-9]+/', '((?!^[0-9]+).)*', false), - array('/[0-9]+/', '((?![0-9]+).)*', false), - array('/[0-9]$|[a-z]+/', '((?![0-9]$|[a-z]+).)*', false), - array('/[0-9]$|^[a-z]+/', '((?![0-9]$|^[a-z]+).)*', false), - array('/^[0-9]|[a-z]+$/', '((?!^[0-9]|[a-z]+$).)*', false), - array('/^[0-9]+\/$/', '((?!^[0-9]+/$).)*', false), - array('#^[0-9]+\#$#', '((?!^[0-9]+#$).)*', false), - array('/^[0-9]+$/i', null, false), - ); + ['/^[0-9]+$/', '((?!^[0-9]+$).)*', false], + ['/[0-9]+$/', '((?![0-9]+$).)*', false], + ['/^[0-9]+/', '((?!^[0-9]+).)*', false], + ['/[0-9]+/', '((?![0-9]+).)*', false], + ['/[0-9]$|[a-z]+/', '((?![0-9]$|[a-z]+).)*', false], + ['/[0-9]$|^[a-z]+/', '((?![0-9]$|^[a-z]+).)*', false], + ['/^[0-9]|[a-z]+$/', '((?!^[0-9]|[a-z]+$).)*', false], + ['/^[0-9]+\/$/', '((?!^[0-9]+/$).)*', false], + ['#^[0-9]+\#$#', '((?!^[0-9]+#$).)*', false], + ['/^[0-9]+$/i', null, false], + ]; } /** @@ -66,10 +66,10 @@ public function provideHtmlPatterns() */ public function testGetHtmlPattern($pattern, $htmlPattern, $match = true) { - $constraint = new Regex(array( + $constraint = new Regex([ 'pattern' => $pattern, 'match' => $match, - )); + ]); $this->assertSame($pattern, $constraint->pattern); $this->assertSame($htmlPattern, $constraint->getHtmlPattern()); @@ -77,10 +77,10 @@ public function testGetHtmlPattern($pattern, $htmlPattern, $match = true) public function testGetCustomHtmlPattern() { - $constraint = new Regex(array( + $constraint = new Regex([ 'pattern' => '((?![0-9]$|[a-z]+).)*', 'htmlPattern' => 'foobar', - )); + ]); $this->assertSame('((?![0-9]$|[a-z]+).)*', $constraint->pattern); $this->assertSame('foobar', $constraint->getHtmlPattern()); diff --git a/vendor/symfony/validator/Tests/Constraints/RegexValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/RegexValidatorTest.php index 5194b0816ea39d55e5ae0d159a169745d5863019..55e739b036884b459de4fcc96811efef8b105529 100644 --- a/vendor/symfony/validator/Tests/Constraints/RegexValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/RegexValidatorTest.php @@ -24,14 +24,14 @@ protected function createValidator() public function testNullIsValid() { - $this->validator->validate(null, new Regex(array('pattern' => '/^[0-9]+$/'))); + $this->validator->validate(null, new Regex(['pattern' => '/^[0-9]+$/'])); $this->assertNoViolation(); } public function testEmptyStringIsValid() { - $this->validator->validate('', new Regex(array('pattern' => '/^[0-9]+$/'))); + $this->validator->validate('', new Regex(['pattern' => '/^[0-9]+$/'])); $this->assertNoViolation(); } @@ -41,7 +41,7 @@ public function testEmptyStringIsValid() */ public function testExpectsStringCompatibleType() { - $this->validator->validate(new \stdClass(), new Regex(array('pattern' => '/^[0-9]+$/'))); + $this->validator->validate(new \stdClass(), new Regex(['pattern' => '/^[0-9]+$/'])); } /** @@ -49,7 +49,7 @@ public function testExpectsStringCompatibleType() */ public function testValidValues($value) { - $constraint = new Regex(array('pattern' => '/^[0-9]+$/')); + $constraint = new Regex(['pattern' => '/^[0-9]+$/']); $this->validator->validate($value, $constraint); $this->assertNoViolation(); @@ -57,12 +57,12 @@ public function testValidValues($value) public function getValidValues() { - return array( - array(0), - array('0'), - array('090909'), - array(90909), - ); + return [ + [0], + ['0'], + ['090909'], + [90909], + ]; } /** @@ -70,10 +70,10 @@ public function getValidValues() */ public function testInvalidValues($value) { - $constraint = new Regex(array( + $constraint = new Regex([ 'pattern' => '/^[0-9]+$/', 'message' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -85,9 +85,9 @@ public function testInvalidValues($value) public function getInvalidValues() { - return array( - array('abcd'), - array('090foo'), - ); + return [ + ['abcd'], + ['090foo'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/TimeValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/TimeValidatorTest.php index a22251d0ee3c50f5c0b12b96b43b219e172c59b1..fe22e9673b7ca0806a8d0c8349ab06e684c65501 100644 --- a/vendor/symfony/validator/Tests/Constraints/TimeValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/TimeValidatorTest.php @@ -63,11 +63,11 @@ public function testValidTimes($time) public function getValidTimes() { - return array( - array('01:02:03'), - array('00:00:00'), - array('23:59:59'), - ); + return [ + ['01:02:03'], + ['00:00:00'], + ['23:59:59'], + ]; } /** @@ -75,9 +75,9 @@ public function getValidTimes() */ public function testInvalidTimes($time, $code) { - $constraint = new Time(array( + $constraint = new Time([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($time, $constraint); @@ -89,15 +89,15 @@ public function testInvalidTimes($time, $code) public function getInvalidTimes() { - return array( - array('foobar', Time::INVALID_FORMAT_ERROR), - array('foobar 12:34:56', Time::INVALID_FORMAT_ERROR), - array('12:34:56 foobar', Time::INVALID_FORMAT_ERROR), - array('00:00', Time::INVALID_FORMAT_ERROR), - array('24:00:00', Time::INVALID_TIME_ERROR), - array('00:60:00', Time::INVALID_TIME_ERROR), - array('00:00:60', Time::INVALID_TIME_ERROR), - ); + return [ + ['foobar', Time::INVALID_FORMAT_ERROR], + ['foobar 12:34:56', Time::INVALID_FORMAT_ERROR], + ['12:34:56 foobar', Time::INVALID_FORMAT_ERROR], + ['00:00', Time::INVALID_FORMAT_ERROR], + ['24:00:00', Time::INVALID_TIME_ERROR], + ['00:60:00', Time::INVALID_TIME_ERROR], + ['00:00:60', Time::INVALID_TIME_ERROR], + ]; } public function testDateTimeImmutableIsValid() diff --git a/vendor/symfony/validator/Tests/Constraints/TypeValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/TypeValidatorTest.php index 86ce972a466b0c486d39532d2ae4f39563fca329..17334bea7925a47b1a45336cd7c79617e95a5dbe 100644 --- a/vendor/symfony/validator/Tests/Constraints/TypeValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/TypeValidatorTest.php @@ -26,7 +26,7 @@ protected function createValidator() public function testNullIsValid() { - $constraint = new Type(array('type' => 'integer')); + $constraint = new Type(['type' => 'integer']); $this->validator->validate(null, $constraint); @@ -35,7 +35,7 @@ public function testNullIsValid() public function testEmptyIsValidIfString() { - $constraint = new Type(array('type' => 'string')); + $constraint = new Type(['type' => 'string']); $this->validator->validate('', $constraint); @@ -44,10 +44,10 @@ public function testEmptyIsValidIfString() public function testEmptyIsInvalidIfNoString() { - $constraint = new Type(array( + $constraint = new Type([ 'type' => 'integer', 'message' => 'myMessage', - )); + ]); $this->validator->validate('', $constraint); @@ -63,7 +63,7 @@ public function testEmptyIsInvalidIfNoString() */ public function testValidValues($value, $type) { - $constraint = new Type(array('type' => $type)); + $constraint = new Type(['type' => $type]); $this->validator->validate($value, $constraint); @@ -75,36 +75,36 @@ public function getValidValues() $object = new \stdClass(); $file = $this->createFile(); - return array( - array(true, 'Boolean'), - array(false, 'Boolean'), - array(true, 'boolean'), - array(false, 'boolean'), - array(true, 'bool'), - array(false, 'bool'), - array(0, 'numeric'), - array('0', 'numeric'), - array(1.5, 'numeric'), - array('1.5', 'numeric'), - array(0, 'integer'), - array(1.5, 'float'), - array('12345', 'string'), - array(array(), 'array'), - array($object, 'object'), - array($object, 'stdClass'), - array($file, 'resource'), - array('12345', 'digit'), - array('12a34', 'alnum'), - array('abcde', 'alpha'), - array("\n\r\t", 'cntrl'), - array('arf12', 'graph'), - array('abcde', 'lower'), - array('ABCDE', 'upper'), - array('arf12', 'print'), - array('*&$()', 'punct'), - array("\n\r\t", 'space'), - array('AB10BC99', 'xdigit'), - ); + return [ + [true, 'Boolean'], + [false, 'Boolean'], + [true, 'boolean'], + [false, 'boolean'], + [true, 'bool'], + [false, 'bool'], + [0, 'numeric'], + ['0', 'numeric'], + [1.5, 'numeric'], + ['1.5', 'numeric'], + [0, 'integer'], + [1.5, 'float'], + ['12345', 'string'], + [[], 'array'], + [$object, 'object'], + [$object, 'stdClass'], + [$file, 'resource'], + ['12345', 'digit'], + ['12a34', 'alnum'], + ['abcde', 'alpha'], + ["\n\r\t", 'cntrl'], + ['arf12', 'graph'], + ['abcde', 'lower'], + ['ABCDE', 'upper'], + ['arf12', 'print'], + ['*&$()', 'punct'], + ["\n\r\t", 'space'], + ['AB10BC99', 'xdigit'], + ]; } /** @@ -112,10 +112,10 @@ public function getValidValues() */ public function testInvalidValues($value, $type, $valueAsString) { - $constraint = new Type(array( + $constraint = new Type([ 'type' => $type, 'message' => 'myMessage', - )); + ]); $this->validator->validate($value, $constraint); @@ -131,36 +131,36 @@ public function getInvalidValues() $object = new \stdClass(); $file = $this->createFile(); - return array( - array('foobar', 'numeric', '"foobar"'), - array('foobar', 'boolean', '"foobar"'), - array('0', 'integer', '"0"'), - array('1.5', 'float', '"1.5"'), - array(12345, 'string', '12345'), - array($object, 'boolean', 'object'), - array($object, 'numeric', 'object'), - array($object, 'integer', 'object'), - array($object, 'float', 'object'), - array($object, 'string', 'object'), - array($object, 'resource', 'object'), - array($file, 'boolean', 'resource'), - array($file, 'numeric', 'resource'), - array($file, 'integer', 'resource'), - array($file, 'float', 'resource'), - array($file, 'string', 'resource'), - array($file, 'object', 'resource'), - array('12a34', 'digit', '"12a34"'), - array('1a#23', 'alnum', '"1a#23"'), - array('abcd1', 'alpha', '"abcd1"'), - array("\nabc", 'cntrl', "\"\nabc\""), - array("abc\n", 'graph', "\"abc\n\""), - array('abCDE', 'lower', '"abCDE"'), - array('ABcde', 'upper', '"ABcde"'), - array("\nabc", 'print', "\"\nabc\""), - array('abc&$!', 'punct', '"abc&$!"'), - array("\nabc", 'space', "\"\nabc\""), - array('AR1012', 'xdigit', '"AR1012"'), - ); + return [ + ['foobar', 'numeric', '"foobar"'], + ['foobar', 'boolean', '"foobar"'], + ['0', 'integer', '"0"'], + ['1.5', 'float', '"1.5"'], + [12345, 'string', '12345'], + [$object, 'boolean', 'object'], + [$object, 'numeric', 'object'], + [$object, 'integer', 'object'], + [$object, 'float', 'object'], + [$object, 'string', 'object'], + [$object, 'resource', 'object'], + [$file, 'boolean', 'resource'], + [$file, 'numeric', 'resource'], + [$file, 'integer', 'resource'], + [$file, 'float', 'resource'], + [$file, 'string', 'resource'], + [$file, 'object', 'resource'], + ['12a34', 'digit', '"12a34"'], + ['1a#23', 'alnum', '"1a#23"'], + ['abcd1', 'alpha', '"abcd1"'], + ["\nabc", 'cntrl', "\"\nabc\""], + ["abc\n", 'graph', "\"abc\n\""], + ['abCDE', 'lower', '"abCDE"'], + ['ABcde', 'upper', '"ABcde"'], + ["\nabc", 'print', "\"\nabc\""], + ['abc&$!', 'punct', '"abc&$!"'], + ["\nabc", 'space', "\"\nabc\""], + ['AR1012', 'xdigit', '"AR1012"'], + ]; } protected function createFile() diff --git a/vendor/symfony/validator/Tests/Constraints/UrlValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/UrlValidatorTest.php index 13cacb0f3ba56206afd7f2f82e6be0e9a336af17..bd1c9a3e09f922b0f8a05d2a3762763cafb28000 100644 --- a/vendor/symfony/validator/Tests/Constraints/UrlValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/UrlValidatorTest.php @@ -67,67 +67,67 @@ public function testValidUrls($url) public function getValidUrls() { - return array( - array('http://a.pl'), - array('http://www.google.com'), - array('http://www.google.com.'), - array('http://www.google.museum'), - array('https://google.com/'), - array('https://google.com:80/'), - array('http://www.example.coop/'), - array('http://www.test-example.com/'), - array('http://www.symfony.com/'), - array('http://symfony.fake/blog/'), - array('http://symfony.com/?'), - array('http://symfony.com/search?type=&q=url+validator'), - array('http://symfony.com/#'), - array('http://symfony.com/#?'), - array('http://www.symfony.com/doc/current/book/validation.html#supported-constraints'), - array('http://very.long.domain.name.com/'), - array('http://localhost/'), - array('http://myhost123/'), - array('http://127.0.0.1/'), - array('http://127.0.0.1:80/'), - array('http://[::1]/'), - array('http://[::1]:80/'), - array('http://[1:2:3::4:5:6:7]/'), - array('http://sãopaulo.com/'), - array('http://xn--sopaulo-xwa.com/'), - array('http://sãopaulo.com.br/'), - array('http://xn--sopaulo-xwa.com.br/'), - array('http://пример.испытание/'), - array('http://xn--e1afmkfd.xn--80akhbyknj4f/'), - array('http://مثال.إختبار/'), - array('http://xn--mgbh0fb.xn--kgbechtv/'), - array('http://例子.测试/'), - array('http://xn--fsqu00a.xn--0zwm56d/'), - array('http://例子.測試/'), - array('http://xn--fsqu00a.xn--g6w251d/'), - array('http://例え.テスト/'), - array('http://xn--r8jz45g.xn--zckzah/'), - array('http://مثال.آزمایشی/'), - array('http://xn--mgbh0fb.xn--hgbk6aj7f53bba/'), - array('http://실례.테스트/'), - array('http://xn--9n2bp8q.xn--9t4b11yi5a/'), - array('http://العربية.idn.icann.org/'), - array('http://xn--ogb.idn.icann.org/'), - array('http://xn--e1afmkfd.xn--80akhbyknj4f.xn--e1afmkfd/'), - array('http://xn--espaa-rta.xn--ca-ol-fsay5a/'), - array('http://xn--d1abbgf6aiiy.xn--p1ai/'), - array('http://☎.com/'), - array('http://username:password@symfony.com'), - array('http://user.name:password@symfony.com'), - array('http://username:pass.word@symfony.com'), - array('http://user.name:pass.word@symfony.com'), - array('http://user-name@symfony.com'), - array('http://symfony.com?'), - array('http://symfony.com?query=1'), - array('http://symfony.com/?query=1'), - array('http://symfony.com#'), - array('http://symfony.com#fragment'), - array('http://symfony.com/#fragment'), - array('http://symfony.com/#one_more%20test'), - ); + return [ + ['http://a.pl'], + ['http://www.google.com'], + ['http://www.google.com.'], + ['http://www.google.museum'], + ['https://google.com/'], + ['https://google.com:80/'], + ['http://www.example.coop/'], + ['http://www.test-example.com/'], + ['http://www.symfony.com/'], + ['http://symfony.fake/blog/'], + ['http://symfony.com/?'], + ['http://symfony.com/search?type=&q=url+validator'], + ['http://symfony.com/#'], + ['http://symfony.com/#?'], + ['http://www.symfony.com/doc/current/book/validation.html#supported-constraints'], + ['http://very.long.domain.name.com/'], + ['http://localhost/'], + ['http://myhost123/'], + ['http://127.0.0.1/'], + ['http://127.0.0.1:80/'], + ['http://[::1]/'], + ['http://[::1]:80/'], + ['http://[1:2:3::4:5:6:7]/'], + ['http://sãopaulo.com/'], + ['http://xn--sopaulo-xwa.com/'], + ['http://sãopaulo.com.br/'], + ['http://xn--sopaulo-xwa.com.br/'], + ['http://пример.испытание/'], + ['http://xn--e1afmkfd.xn--80akhbyknj4f/'], + ['http://مثال.إختبار/'], + ['http://xn--mgbh0fb.xn--kgbechtv/'], + ['http://例子.测试/'], + ['http://xn--fsqu00a.xn--0zwm56d/'], + ['http://例子.測試/'], + ['http://xn--fsqu00a.xn--g6w251d/'], + ['http://例え.テスト/'], + ['http://xn--r8jz45g.xn--zckzah/'], + ['http://مثال.آزمایشی/'], + ['http://xn--mgbh0fb.xn--hgbk6aj7f53bba/'], + ['http://실례.테스트/'], + ['http://xn--9n2bp8q.xn--9t4b11yi5a/'], + ['http://العربية.idn.icann.org/'], + ['http://xn--ogb.idn.icann.org/'], + ['http://xn--e1afmkfd.xn--80akhbyknj4f.xn--e1afmkfd/'], + ['http://xn--espaa-rta.xn--ca-ol-fsay5a/'], + ['http://xn--d1abbgf6aiiy.xn--p1ai/'], + ['http://☎.com/'], + ['http://username:password@symfony.com'], + ['http://user.name:password@symfony.com'], + ['http://username:pass.word@symfony.com'], + ['http://user.name:pass.word@symfony.com'], + ['http://user-name@symfony.com'], + ['http://symfony.com?'], + ['http://symfony.com?query=1'], + ['http://symfony.com/?query=1'], + ['http://symfony.com#'], + ['http://symfony.com#fragment'], + ['http://symfony.com/#fragment'], + ['http://symfony.com/#one_more%20test'], + ]; } /** @@ -135,9 +135,9 @@ public function getValidUrls() */ public function testInvalidUrls($url) { - $constraint = new Url(array( + $constraint = new Url([ 'message' => 'myMessage', - )); + ]); $this->validator->validate($url, $constraint); @@ -149,29 +149,29 @@ public function testInvalidUrls($url) public function getInvalidUrls() { - return array( - array('google.com'), - array('://google.com'), - array('http ://google.com'), - array('http:/google.com'), - array('http://goog_le.com'), - array('http://google.com::aa'), - array('http://google.com:aa'), - array('ftp://google.fr'), - array('faked://google.fr'), - array('http://127.0.0.1:aa/'), - array('ftp://[::1]/'), - array('http://[::1'), - array('http://hello.☎/'), - array('http://:password@symfony.com'), - array('http://:password@@symfony.com'), - array('http://username:passwordsymfony.com'), - array('http://usern@me:password@symfony.com'), - array('http://example.com/exploit.html?<script>alert(1);</script>'), - array('http://example.com/exploit.html?hel lo'), - array('http://example.com/exploit.html?not_a%hex'), - array('http://'), - ); + return [ + ['google.com'], + ['://google.com'], + ['http ://google.com'], + ['http:/google.com'], + ['http://goog_le.com'], + ['http://google.com::aa'], + ['http://google.com:aa'], + ['ftp://google.fr'], + ['faked://google.fr'], + ['http://127.0.0.1:aa/'], + ['ftp://[::1]/'], + ['http://[::1'], + ['http://hello.☎/'], + ['http://:password@symfony.com'], + ['http://:password@@symfony.com'], + ['http://username:passwordsymfony.com'], + ['http://usern@me:password@symfony.com'], + ['http://example.com/exploit.html?<script>alert(1);</script>'], + ['http://example.com/exploit.html?hel lo'], + ['http://example.com/exploit.html?not_a%hex'], + ['http://'], + ]; } /** @@ -179,9 +179,9 @@ public function getInvalidUrls() */ public function testCustomProtocolIsValid($url) { - $constraint = new Url(array( - 'protocols' => array('ftp', 'file', 'git'), - )); + $constraint = new Url([ + 'protocols' => ['ftp', 'file', 'git'], + ]); $this->validator->validate($url, $constraint); @@ -190,11 +190,11 @@ public function testCustomProtocolIsValid($url) public function getValidCustomUrls() { - return array( - array('ftp://google.com'), - array('file://127.0.0.1'), - array('git://[::1]/'), - ); + return [ + ['ftp://google.com'], + ['file://127.0.0.1'], + ['git://[::1]/'], + ]; } /** @@ -203,12 +203,12 @@ public function getValidCustomUrls() */ public function testCheckDns($violation) { - DnsMock::withMockedHosts(array('example.com' => array(array('type' => $violation ? '' : 'A')))); + DnsMock::withMockedHosts(['example.com' => [['type' => $violation ? '' : 'A']]]); - $constraint = new Url(array( + $constraint = new Url([ 'checkDNS' => 'ANY', 'dnsMessage' => 'myMessage', - )); + ]); $this->validator->validate('http://example.com', $constraint); @@ -224,7 +224,7 @@ public function testCheckDns($violation) public function getCheckDns() { - return array(array(true), array(false)); + return [[true], [false]]; } /** @@ -233,12 +233,12 @@ public function getCheckDns() */ public function testCheckDnsByType($type) { - DnsMock::withMockedHosts(array('example.com' => array(array('type' => $type)))); + DnsMock::withMockedHosts(['example.com' => [['type' => $type]]]); - $constraint = new Url(array( + $constraint = new Url([ 'checkDNS' => $type, 'dnsMessage' => 'myMessage', - )); + ]); $this->validator->validate('http://example.com', $constraint); @@ -247,20 +247,20 @@ public function testCheckDnsByType($type) public function getCheckDnsTypes() { - return array( - array('ANY'), - array('A'), - array('A6'), - array('AAAA'), - array('CNAME'), - array('MX'), - array('NAPTR'), - array('NS'), - array('PTR'), - array('SOA'), - array('SRV'), - array('TXT'), - ); + return [ + ['ANY'], + ['A'], + ['A6'], + ['AAAA'], + ['CNAME'], + ['MX'], + ['NAPTR'], + ['NS'], + ['PTR'], + ['SOA'], + ['SRV'], + ['TXT'], + ]; } /** @@ -268,12 +268,12 @@ public function getCheckDnsTypes() */ public function testCheckDnsWithBoolean() { - DnsMock::withMockedHosts(array('example.com' => array(array('type' => 'A')))); + DnsMock::withMockedHosts(['example.com' => [['type' => 'A']]]); - $constraint = new Url(array( + $constraint = new Url([ 'checkDNS' => true, 'dnsMessage' => 'myMessage', - )); + ]); $this->validator->validate('http://example.com', $constraint); @@ -286,12 +286,12 @@ public function testCheckDnsWithBoolean() */ public function testCheckDnsWithInvalidType() { - DnsMock::withMockedHosts(array('example.com' => array(array('type' => 'A')))); + DnsMock::withMockedHosts(['example.com' => [['type' => 'A']]]); - $constraint = new Url(array( + $constraint = new Url([ 'checkDNS' => 'BOGUS', 'dnsMessage' => 'myMessage', - )); + ]); $this->validator->validate('http://example.com', $constraint); } diff --git a/vendor/symfony/validator/Tests/Constraints/UuidValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/UuidValidatorTest.php index a39ec93d6cdf6b10708391a222905838e37269e8..6c379b9430fb9f8a3ef0207c3863955157f94ac1 100644 --- a/vendor/symfony/validator/Tests/Constraints/UuidValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/UuidValidatorTest.php @@ -75,14 +75,14 @@ public function testValidStrictUuids($uuid, $versions = null) public function getValidStrictUuids() { - return array( - array('216fff40-98d9-11e3-a5e2-0800200c9a66'), // Version 1 UUID in lowercase - array('216fff40-98d9-11e3-a5e2-0800200c9a66', array(Uuid::V1_MAC)), - array('216FFF40-98D9-11E3-A5E2-0800200C9A66'), // Version 1 UUID in UPPERCASE - array('456daefb-5aa6-41b5-8dbc-068b05a8b201'), // Version 4 UUID in lowercase - array('456daEFb-5AA6-41B5-8DBC-068B05A8B201'), // Version 4 UUID in mixed case - array('456daEFb-5AA6-41B5-8DBC-068B05A8B201', array(Uuid::V4_RANDOM)), - ); + return [ + ['216fff40-98d9-11e3-a5e2-0800200c9a66'], // Version 1 UUID in lowercase + ['216fff40-98d9-11e3-a5e2-0800200c9a66', [Uuid::V1_MAC]], + ['216FFF40-98D9-11E3-A5E2-0800200C9A66'], // Version 1 UUID in UPPERCASE + ['456daefb-5aa6-41b5-8dbc-068b05a8b201'], // Version 4 UUID in lowercase + ['456daEFb-5AA6-41B5-8DBC-068B05A8B201'], // Version 4 UUID in mixed case + ['456daEFb-5AA6-41B5-8DBC-068B05A8B201', [Uuid::V4_RANDOM]], + ]; } /** @@ -90,9 +90,9 @@ public function getValidStrictUuids() */ public function testInvalidStrictUuids($uuid, $code, $versions = null) { - $constraint = new Uuid(array( + $constraint = new Uuid([ 'message' => 'testMessage', - )); + ]); if (null !== $versions) { $constraint->versions = $versions; @@ -108,48 +108,48 @@ public function testInvalidStrictUuids($uuid, $code, $versions = null) public function getInvalidStrictUuids() { - return array( - array('216fff40-98d9-11e3-a5e2_0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216Gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216fff40-98d9-11e3-a5e-20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216f-ff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800-200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c-9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff40-98d9-11e3-a5e20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff4098d911e3a5e20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c9a6', Uuid::TOO_SHORT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c9a666', Uuid::TOO_LONG_ERROR), - array('216fff40-98d9-01e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-61e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-71e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-81e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-91e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-a1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-b1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-c1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-d1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-e1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-f1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR, array(Uuid::V2_DCE, Uuid::V3_MD5, Uuid::V4_RANDOM, Uuid::V5_SHA1)), - array('216fff40-98d9-21e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR, array(Uuid::V1_MAC, Uuid::V3_MD5, Uuid::V4_RANDOM, Uuid::V5_SHA1)), - array('216fff40-98d9-11e3-05e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-15e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-25e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-35e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-45e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-55e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-65e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-75e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-c5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-d5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-e5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-f5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + return [ + ['216fff40-98d9-11e3-a5e2_0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR], + ['216gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR], + ['216Gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR], + ['216fff40-98d9-11e3-a5e-20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR], + ['216f-ff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR], + ['216fff40-98d9-11e3-a5e2-0800-200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR], + ['216fff40-98d9-11e3-a5e2-0800200c-9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR], + ['216fff40-98d9-11e3-a5e20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR], + ['216fff4098d911e3a5e20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR], + ['216fff40-98d9-11e3-a5e2-0800200c9a6', Uuid::TOO_SHORT_ERROR], + ['216fff40-98d9-11e3-a5e2-0800200c9a666', Uuid::TOO_LONG_ERROR], + ['216fff40-98d9-01e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR], + ['216fff40-98d9-61e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR], + ['216fff40-98d9-71e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR], + ['216fff40-98d9-81e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR], + ['216fff40-98d9-91e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR], + ['216fff40-98d9-a1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR], + ['216fff40-98d9-b1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR], + ['216fff40-98d9-c1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR], + ['216fff40-98d9-d1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR], + ['216fff40-98d9-e1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR], + ['216fff40-98d9-f1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR], + ['216fff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR, [Uuid::V2_DCE, Uuid::V3_MD5, Uuid::V4_RANDOM, Uuid::V5_SHA1]], + ['216fff40-98d9-21e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR, [Uuid::V1_MAC, Uuid::V3_MD5, Uuid::V4_RANDOM, Uuid::V5_SHA1]], + ['216fff40-98d9-11e3-05e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], + ['216fff40-98d9-11e3-15e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], + ['216fff40-98d9-11e3-25e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], + ['216fff40-98d9-11e3-35e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], + ['216fff40-98d9-11e3-45e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], + ['216fff40-98d9-11e3-55e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], + ['216fff40-98d9-11e3-65e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], + ['216fff40-98d9-11e3-75e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], + ['216fff40-98d9-11e3-c5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], + ['216fff40-98d9-11e3-d5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], + ['216fff40-98d9-11e3-e5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], + ['216fff40-98d9-11e3-f5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR], // Non-standard UUID allowed by some other systems - array('{216fff40-98d9-11e3-a5e2-0800200c9a66}', Uuid::INVALID_CHARACTERS_ERROR), - array('[216fff40-98d9-11e3-a5e2-0800200c9a66]', Uuid::INVALID_CHARACTERS_ERROR), - ); + ['{216fff40-98d9-11e3-a5e2-0800200c9a66}', Uuid::INVALID_CHARACTERS_ERROR], + ['[216fff40-98d9-11e3-a5e2-0800200c9a66]', Uuid::INVALID_CHARACTERS_ERROR], + ]; } /** @@ -157,9 +157,9 @@ public function getInvalidStrictUuids() */ public function testValidNonStrictUuids($uuid) { - $constraint = new Uuid(array( + $constraint = new Uuid([ 'strict' => false, - )); + ]); $this->validator->validate($uuid, $constraint); @@ -168,19 +168,19 @@ public function testValidNonStrictUuids($uuid) public function getValidNonStrictUuids() { - return array( - array('216fff40-98d9-11e3-a5e2-0800200c9a66'), // Version 1 UUID in lowercase - array('216FFF40-98D9-11E3-A5E2-0800200C9A66'), // Version 1 UUID in UPPERCASE - array('456daefb-5aa6-41b5-8dbc-068b05a8b201'), // Version 4 UUID in lowercase - array('456DAEFb-5AA6-41B5-8DBC-068b05a8B201'), // Version 4 UUID in mixed case + return [ + ['216fff40-98d9-11e3-a5e2-0800200c9a66'], // Version 1 UUID in lowercase + ['216FFF40-98D9-11E3-A5E2-0800200C9A66'], // Version 1 UUID in UPPERCASE + ['456daefb-5aa6-41b5-8dbc-068b05a8b201'], // Version 4 UUID in lowercase + ['456DAEFb-5AA6-41B5-8DBC-068b05a8B201'], // Version 4 UUID in mixed case // Non-standard UUIDs allowed by some other systems - array('216f-ff40-98d9-11e3-a5e2-0800-200c-9a66'), // Non-standard dash positions (every 4 chars) - array('216fff40-98d911e3-a5e20800-200c9a66'), // Non-standard dash positions (every 8 chars) - array('216fff4098d911e3a5e20800200c9a66'), // No dashes at all - array('{216fff40-98d9-11e3-a5e2-0800200c9a66}'), // Wrapped with curly braces - array('[216fff40-98d9-11e3-a5e2-0800200c9a66]'), // Wrapped with squared braces - ); + ['216f-ff40-98d9-11e3-a5e2-0800-200c-9a66'], // Non-standard dash positions (every 4 chars) + ['216fff40-98d911e3-a5e20800-200c9a66'], // Non-standard dash positions (every 8 chars) + ['216fff4098d911e3a5e20800200c9a66'], // No dashes at all + ['{216fff40-98d9-11e3-a5e2-0800200c9a66}'], // Wrapped with curly braces + ['[216fff40-98d9-11e3-a5e2-0800200c9a66]'], // Wrapped with squared braces + ]; } /** @@ -188,10 +188,10 @@ public function getValidNonStrictUuids() */ public function testInvalidNonStrictUuids($uuid, $code) { - $constraint = new Uuid(array( + $constraint = new Uuid([ 'strict' => false, 'message' => 'myMessage', - )); + ]); $this->validator->validate($uuid, $constraint); @@ -203,14 +203,14 @@ public function testInvalidNonStrictUuids($uuid, $code) public function getInvalidNonStrictUuids() { - return array( - array('216fff40-98d9-11e3-a5e2_0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216Gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216fff40-98d9-11e3-a5e2_0800200c9a6', Uuid::INVALID_CHARACTERS_ERROR), - array('216fff40-98d9-11e3-a5e-20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c9a6', Uuid::TOO_SHORT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c9a666', Uuid::TOO_LONG_ERROR), - ); + return [ + ['216fff40-98d9-11e3-a5e2_0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR], + ['216gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR], + ['216Gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR], + ['216fff40-98d9-11e3-a5e2_0800200c9a6', Uuid::INVALID_CHARACTERS_ERROR], + ['216fff40-98d9-11e3-a5e-20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR], + ['216fff40-98d9-11e3-a5e2-0800200c9a6', Uuid::TOO_SHORT_ERROR], + ['216fff40-98d9-11e3-a5e2-0800200c9a666', Uuid::TOO_LONG_ERROR], + ]; } } diff --git a/vendor/symfony/validator/Tests/Constraints/ValidTest.php b/vendor/symfony/validator/Tests/Constraints/ValidTest.php index 9928bd82d022546eee9af6adb8586897054412b7..7245dc90adeda5a179f6359b3bcf4c23834b89ba 100644 --- a/vendor/symfony/validator/Tests/Constraints/ValidTest.php +++ b/vendor/symfony/validator/Tests/Constraints/ValidTest.php @@ -21,9 +21,9 @@ class ValidTest extends TestCase { public function testGroupsCanBeSet() { - $constraint = new Valid(array('groups' => 'foo')); + $constraint = new Valid(['groups' => 'foo']); - $this->assertSame(array('foo'), $constraint->groups); + $this->assertSame(['foo'], $constraint->groups); } public function testGroupsAreNullByDefault() diff --git a/vendor/symfony/validator/Tests/Constraints/ValidValidatorTest.php b/vendor/symfony/validator/Tests/Constraints/ValidValidatorTest.php index c4ccf1551f2a0bec915173c4c2bc1e4afc2a148a..0ec1d421378ea2244cae40df615dc1841666facb 100644 --- a/vendor/symfony/validator/Tests/Constraints/ValidValidatorTest.php +++ b/vendor/symfony/validator/Tests/Constraints/ValidValidatorTest.php @@ -14,7 +14,7 @@ public function testPropertyPathsArePassedToNestedContexts() $validatorBuilder = new ValidatorBuilder(); $validator = $validatorBuilder->enableAnnotationMapping()->getValidator(); - $violations = $validator->validate(new Foo(), null, array('nested')); + $violations = $validator->validate(new Foo(), null, ['nested']); $this->assertCount(1, $violations); $this->assertSame('fooBar.fooBarBaz.foo', $violations->get(0)->getPropertyPath()); @@ -27,7 +27,7 @@ public function testNullValues() $foo = new Foo(); $foo->fooBar = null; - $violations = $validator->validate($foo, null, array('nested')); + $violations = $validator->validate($foo, null, ['nested']); $this->assertCount(0, $violations); } diff --git a/vendor/symfony/validator/Tests/DataCollector/ValidatorDataCollectorTest.php b/vendor/symfony/validator/Tests/DataCollector/ValidatorDataCollectorTest.php index b28650c30e1da33eae51f339fc867a90b815e2d6..f32acf228bcc32a090672cdd8ed4d5e8f1bfd03c 100644 --- a/vendor/symfony/validator/Tests/DataCollector/ValidatorDataCollectorTest.php +++ b/vendor/symfony/validator/Tests/DataCollector/ValidatorDataCollectorTest.php @@ -27,10 +27,10 @@ public function testCollectsValidatorCalls() $collector = new ValidatorDataCollector($validator); - $violations = new ConstraintViolationList(array( + $violations = new ConstraintViolationList([ $this->createMock(ConstraintViolation::class), $this->createMock(ConstraintViolation::class), - )); + ]); $originalValidator->method('validate')->willReturn($violations); $validator->validate(new \stdClass()); @@ -57,10 +57,10 @@ public function testReset() $collector = new ValidatorDataCollector($validator); - $violations = new ConstraintViolationList(array( + $violations = new ConstraintViolationList([ $this->createMock(ConstraintViolation::class), $this->createMock(ConstraintViolation::class), - )); + ]); $originalValidator->method('validate')->willReturn($violations); $validator->validate(new \stdClass()); diff --git a/vendor/symfony/validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php b/vendor/symfony/validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php index c47cbcc94da9e1ca887c8a0fbe202316f65e75e2..c3224840bb2dab6092c0205475124b08f1ac4a45 100644 --- a/vendor/symfony/validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php +++ b/vendor/symfony/validator/Tests/DependencyInjection/AddConstraintValidatorsPassTest.php @@ -25,21 +25,21 @@ public function testThatConstraintValidatorServicesAreProcessed() { $container = new ContainerBuilder(); $validatorFactory = $container->register('validator.validator_factory') - ->addArgument(array()); + ->addArgument([]); $container->register('my_constraint_validator_service1', Validator1::class) - ->addTag('validator.constraint_validator', array('alias' => 'my_constraint_validator_alias1')); + ->addTag('validator.constraint_validator', ['alias' => 'my_constraint_validator_alias1']); $container->register('my_constraint_validator_service2', Validator2::class) ->addTag('validator.constraint_validator'); $addConstraintValidatorsPass = new AddConstraintValidatorsPass(); $addConstraintValidatorsPass->process($container); - $expected = (new Definition(ServiceLocator::class, array(array( + $expected = (new Definition(ServiceLocator::class, [[ Validator1::class => new ServiceClosureArgument(new Reference('my_constraint_validator_service1')), 'my_constraint_validator_alias1' => new ServiceClosureArgument(new Reference('my_constraint_validator_service1')), Validator2::class => new ServiceClosureArgument(new Reference('my_constraint_validator_service2')), - ))))->addTag('container.service_locator')->setPublic(false); + ]]))->addTag('container.service_locator')->setPublic(false); $this->assertEquals($expected, $container->getDefinition((string) $validatorFactory->getArgument(0))); } @@ -51,7 +51,7 @@ public function testAbstractConstraintValidator() { $container = new ContainerBuilder(); $container->register('validator.validator_factory') - ->addArgument(array()); + ->addArgument([]); $container->register('my_abstract_constraint_validator') ->setAbstract(true) diff --git a/vendor/symfony/validator/Tests/DependencyInjection/AddValidatorInitializersPassTest.php b/vendor/symfony/validator/Tests/DependencyInjection/AddValidatorInitializersPassTest.php index 61c13d25e75d9f7a386eef0817e2a0d7880fc5dc..8d87b635ea0b940f2e171e8c50ff74ad9cbc523e 100644 --- a/vendor/symfony/validator/Tests/DependencyInjection/AddValidatorInitializersPassTest.php +++ b/vendor/symfony/validator/Tests/DependencyInjection/AddValidatorInitializersPassTest.php @@ -31,13 +31,13 @@ public function testProcess() ; $container ->register('validator.builder') - ->addArgument(array()) + ->addArgument([]) ; (new AddValidatorInitializersPass())->process($container); $this->assertEquals( - array(array('addObjectInitializers', array(array(new Reference('initializer1'), new Reference('initializer2'))))), + [['addObjectInitializers', [[new Reference('initializer1'), new Reference('initializer2')]]]], $container->getDefinition('validator.builder')->getMethodCalls() ); } diff --git a/vendor/symfony/validator/Tests/Fixtures/ConstraintA.php b/vendor/symfony/validator/Tests/Fixtures/ConstraintA.php index 8a196dcc914ecf7dbb52fb320ee50d81ef2c0512..17ba03673d5d6f682492fe322d5c5eb930b6bcf7 100644 --- a/vendor/symfony/validator/Tests/Fixtures/ConstraintA.php +++ b/vendor/symfony/validator/Tests/Fixtures/ConstraintA.php @@ -26,6 +26,6 @@ public function getDefaultOption() public function getTargets() { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + return [self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT]; } } diff --git a/vendor/symfony/validator/Tests/Fixtures/ConstraintAValidator.php b/vendor/symfony/validator/Tests/Fixtures/ConstraintAValidator.php index 867b024c27672da15aeec1660e168bf2cceb8564..8b0d30f57142148a7b6daa0cee7fedccbfb6e649 100644 --- a/vendor/symfony/validator/Tests/Fixtures/ConstraintAValidator.php +++ b/vendor/symfony/validator/Tests/Fixtures/ConstraintAValidator.php @@ -29,7 +29,7 @@ public function initialize(ExecutionContextInterface $context) public function validate($value, Constraint $constraint) { if ('VALID' != $value) { - $this->context->addViolation('message', array('param' => 'value')); + $this->context->addViolation('message', ['param' => 'value']); return; } diff --git a/vendor/symfony/validator/Tests/Fixtures/ConstraintB.php b/vendor/symfony/validator/Tests/Fixtures/ConstraintB.php index 6258923372ed8240f4b69b7fe9cb5d2222c76f27..99d1951e5d0cedf7a43f7216756e18256abdab8a 100644 --- a/vendor/symfony/validator/Tests/Fixtures/ConstraintB.php +++ b/vendor/symfony/validator/Tests/Fixtures/ConstraintB.php @@ -18,6 +18,6 @@ class ConstraintB extends Constraint { public function getTargets() { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + return [self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT]; } } diff --git a/vendor/symfony/validator/Tests/Fixtures/ConstraintC.php b/vendor/symfony/validator/Tests/Fixtures/ConstraintC.php index b0418b8718695a46aa367183601ef3b1f30920c5..675066ef020f8f529aadbc82a53ecc14c9feabab 100644 --- a/vendor/symfony/validator/Tests/Fixtures/ConstraintC.php +++ b/vendor/symfony/validator/Tests/Fixtures/ConstraintC.php @@ -20,11 +20,11 @@ class ConstraintC extends Constraint public function getRequiredOptions() { - return array('option1'); + return ['option1']; } public function getTargets() { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + return [self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT]; } } diff --git a/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValue.php b/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValue.php index 4ebd981eef92479014fa6ec13bebb06ee813fac5..b3fbd7083cfdacca2695492b68568aa4e29063e6 100644 --- a/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValue.php +++ b/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValue.php @@ -26,6 +26,6 @@ public function getDefaultOption() public function getTargets() { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + return [self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT]; } } diff --git a/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValueAsDefault.php b/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValueAsDefault.php index a975e0787fc97eda82bcb1452b3356ab9e2b31d6..618cca74df04e99494097481823711cf2dd8efd2 100644 --- a/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValueAsDefault.php +++ b/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValueAsDefault.php @@ -26,6 +26,6 @@ public function getDefaultOption() public function getTargets() { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + return [self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT]; } } diff --git a/vendor/symfony/validator/Tests/Fixtures/CustomArrayObject.php b/vendor/symfony/validator/Tests/Fixtures/CustomArrayObject.php index feb25318eb5e5b1abf4c97d0f894fcf986d0fa75..1edf1de0811dbdcaa8db5f33054613e35a962d0a 100644 --- a/vendor/symfony/validator/Tests/Fixtures/CustomArrayObject.php +++ b/vendor/symfony/validator/Tests/Fixtures/CustomArrayObject.php @@ -21,12 +21,12 @@ class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, public function __construct(array $array = null) { - $this->array = $array ?: array(); + $this->array = $array ?: []; } public function offsetExists($offset) { - return array_key_exists($offset, $this->array); + return \array_key_exists($offset, $this->array); } public function offsetGet($offset) diff --git a/vendor/symfony/validator/Tests/Fixtures/EntityStaticCar.php b/vendor/symfony/validator/Tests/Fixtures/EntityStaticCar.php index 0b384872db597025b6dc12a2840ebc2ba58dd0c0..af90ddc7473ad0e56de58f85e446fac92e47ea17 100644 --- a/vendor/symfony/validator/Tests/Fixtures/EntityStaticCar.php +++ b/vendor/symfony/validator/Tests/Fixtures/EntityStaticCar.php @@ -18,6 +18,6 @@ class EntityStaticCar extends EntityStaticVehicle { public static function loadValidatorMetadata(ClassMetadata $metadata) { - $metadata->addPropertyConstraint('wheels', new Length(array('max' => 99))); + $metadata->addPropertyConstraint('wheels', new Length(['max' => 99])); } } diff --git a/vendor/symfony/validator/Tests/Fixtures/EntityStaticCarTurbo.php b/vendor/symfony/validator/Tests/Fixtures/EntityStaticCarTurbo.php index abf1edbdd132df65287d84ca4cbd17c77de9bbad..d559074db64584a873bf7732c6ec99b88db58287 100644 --- a/vendor/symfony/validator/Tests/Fixtures/EntityStaticCarTurbo.php +++ b/vendor/symfony/validator/Tests/Fixtures/EntityStaticCarTurbo.php @@ -18,6 +18,6 @@ class EntityStaticCarTurbo extends EntityStaticCar { public static function loadValidatorMetadata(ClassMetadata $metadata) { - $metadata->addPropertyConstraint('wheels', new Length(array('max' => 99))); + $metadata->addPropertyConstraint('wheels', new Length(['max' => 99])); } } diff --git a/vendor/symfony/validator/Tests/Fixtures/EntityStaticVehicle.php b/vendor/symfony/validator/Tests/Fixtures/EntityStaticVehicle.php index 9ce72935de5141e375c8618126a90141e9110e24..1190318fa555eda1a6c31f73ed846dc00ce3a2c9 100644 --- a/vendor/symfony/validator/Tests/Fixtures/EntityStaticVehicle.php +++ b/vendor/symfony/validator/Tests/Fixtures/EntityStaticVehicle.php @@ -20,6 +20,6 @@ class EntityStaticVehicle public static function loadValidatorMetadata(ClassMetadata $metadata) { - $metadata->addPropertyConstraint('wheels', new Length(array('max' => 99))); + $metadata->addPropertyConstraint('wheels', new Length(['max' => 99])); } } diff --git a/vendor/symfony/validator/Tests/Fixtures/FailingConstraint.php b/vendor/symfony/validator/Tests/Fixtures/FailingConstraint.php index 03019fc37ca38e82978e85216ac5b54eb9dfeafa..4ea07f7436343b9637fdcd0403f2c6f6797c618f 100644 --- a/vendor/symfony/validator/Tests/Fixtures/FailingConstraint.php +++ b/vendor/symfony/validator/Tests/Fixtures/FailingConstraint.php @@ -19,6 +19,6 @@ class FailingConstraint extends Constraint public function getTargets() { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + return [self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT]; } } diff --git a/vendor/symfony/validator/Tests/Fixtures/FailingConstraintValidator.php b/vendor/symfony/validator/Tests/Fixtures/FailingConstraintValidator.php index a019dd6f836c20fbf06c2a3ad12b620c91a3ef06..1224643851117f350b70b2aec9e89162e4aaaa80 100644 --- a/vendor/symfony/validator/Tests/Fixtures/FailingConstraintValidator.php +++ b/vendor/symfony/validator/Tests/Fixtures/FailingConstraintValidator.php @@ -18,6 +18,6 @@ class FailingConstraintValidator extends ConstraintValidator { public function validate($value, Constraint $constraint) { - $this->context->addViolation($constraint->message, array()); + $this->context->addViolation($constraint->message, []); } } diff --git a/vendor/symfony/validator/Tests/Fixtures/FakeClassMetadata.php b/vendor/symfony/validator/Tests/Fixtures/FakeClassMetadata.php index 8c76a21598c0aee2492151a6ef57ad98f61e9fd4..39f54777795cd48d5a66b348aad675f450707da8 100644 --- a/vendor/symfony/validator/Tests/Fixtures/FakeClassMetadata.php +++ b/vendor/symfony/validator/Tests/Fixtures/FakeClassMetadata.php @@ -18,7 +18,7 @@ class FakeClassMetadata extends ClassMetadata public function addCustomPropertyMetadata($propertyName, $metadata) { if (!isset($this->members[$propertyName])) { - $this->members[$propertyName] = array(); + $this->members[$propertyName] = []; } $this->members[$propertyName][] = $metadata; diff --git a/vendor/symfony/validator/Tests/Fixtures/FakeMetadataFactory.php b/vendor/symfony/validator/Tests/Fixtures/FakeMetadataFactory.php index 1b5a704d46800e482105dd4ffd38610ebb30605a..5e34929be35e6b1bc156914fc2e31451bdea4616 100644 --- a/vendor/symfony/validator/Tests/Fixtures/FakeMetadataFactory.php +++ b/vendor/symfony/validator/Tests/Fixtures/FakeMetadataFactory.php @@ -17,7 +17,7 @@ class FakeMetadataFactory implements MetadataFactoryInterface { - protected $metadatas = array(); + protected $metadatas = []; public function getMetadataFor($class) { diff --git a/vendor/symfony/validator/Tests/Fixtures/GroupSequenceProviderEntity.php b/vendor/symfony/validator/Tests/Fixtures/GroupSequenceProviderEntity.php index 2b0beaf9adf986ee2bea1073506b44693e9b6a11..77b3bf2f7b4559c61559cda8b7ef2e9f72c65d71 100644 --- a/vendor/symfony/validator/Tests/Fixtures/GroupSequenceProviderEntity.php +++ b/vendor/symfony/validator/Tests/Fixtures/GroupSequenceProviderEntity.php @@ -22,7 +22,7 @@ class GroupSequenceProviderEntity implements GroupSequenceProviderInterface public $firstName; public $lastName; - protected $sequence = array(); + protected $sequence = []; public function __construct($sequence) { diff --git a/vendor/symfony/validator/Tests/Mapping/Cache/AbstractCacheTest.php b/vendor/symfony/validator/Tests/Mapping/Cache/AbstractCacheTest.php index 6083f65e28b6ab7ff15e747f838d93e3502e80dd..4d0363fd717b44e7838140bec40efb2cfb77a0a1 100644 --- a/vendor/symfony/validator/Tests/Mapping/Cache/AbstractCacheTest.php +++ b/vendor/symfony/validator/Tests/Mapping/Cache/AbstractCacheTest.php @@ -26,7 +26,7 @@ public function testWrite() { $meta = $this->getMockBuilder(ClassMetadata::class) ->disableOriginalConstructor() - ->setMethods(array('getClassName')) + ->setMethods(['getClassName']) ->getMock(); $meta->expects($this->once()) @@ -46,7 +46,7 @@ public function testHas() { $meta = $this->getMockBuilder(ClassMetadata::class) ->disableOriginalConstructor() - ->setMethods(array('getClassName')) + ->setMethods(['getClassName']) ->getMock(); $meta->expects($this->once()) @@ -63,7 +63,7 @@ public function testRead() { $meta = $this->getMockBuilder(ClassMetadata::class) ->disableOriginalConstructor() - ->setMethods(array('getClassName')) + ->setMethods(['getClassName']) ->getMock(); $meta->expects($this->once()) diff --git a/vendor/symfony/validator/Tests/Mapping/ClassMetadataTest.php b/vendor/symfony/validator/Tests/Mapping/ClassMetadataTest.php index a3f8a8c1ec8a3ded8c2afdafe1a8131249225ef8..d33342c42557c60ea8cb6e20e60e8324f0347612 100644 --- a/vendor/symfony/validator/Tests/Mapping/ClassMetadataTest.php +++ b/vendor/symfony/validator/Tests/Mapping/ClassMetadataTest.php @@ -57,17 +57,17 @@ public function testAddPropertyConstraints() $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); $this->metadata->addPropertyConstraint('lastName', new ConstraintB()); - $this->assertEquals(array('firstName', 'lastName'), $this->metadata->getConstrainedProperties()); + $this->assertEquals(['firstName', 'lastName'], $this->metadata->getConstrainedProperties()); } public function testAddMultiplePropertyConstraints() { - $this->metadata->addPropertyConstraints('lastName', array(new ConstraintA(), new ConstraintB())); + $this->metadata->addPropertyConstraints('lastName', [new ConstraintA(), new ConstraintB()]); - $constraints = array( - new ConstraintA(array('groups' => array('Default', 'Entity'))), - new ConstraintB(array('groups' => array('Default', 'Entity'))), - ); + $constraints = [ + new ConstraintA(['groups' => ['Default', 'Entity']]), + new ConstraintB(['groups' => ['Default', 'Entity']]), + ]; $properties = $this->metadata->getPropertyMetadata('lastName'); @@ -81,10 +81,10 @@ public function testAddGetterConstraints() $this->metadata->addGetterConstraint('lastName', new ConstraintA()); $this->metadata->addGetterConstraint('lastName', new ConstraintB()); - $constraints = array( - new ConstraintA(array('groups' => array('Default', 'Entity'))), - new ConstraintB(array('groups' => array('Default', 'Entity'))), - ); + $constraints = [ + new ConstraintA(['groups' => ['Default', 'Entity']]), + new ConstraintB(['groups' => ['Default', 'Entity']]), + ]; $properties = $this->metadata->getPropertyMetadata('lastName'); @@ -95,12 +95,12 @@ public function testAddGetterConstraints() public function testAddMultipleGetterConstraints() { - $this->metadata->addGetterConstraints('lastName', array(new ConstraintA(), new ConstraintB())); + $this->metadata->addGetterConstraints('lastName', [new ConstraintA(), new ConstraintB()]); - $constraints = array( - new ConstraintA(array('groups' => array('Default', 'Entity'))), - new ConstraintB(array('groups' => array('Default', 'Entity'))), - ); + $constraints = [ + new ConstraintA(['groups' => ['Default', 'Entity']]), + new ConstraintB(['groups' => ['Default', 'Entity']]), + ]; $properties = $this->metadata->getPropertyMetadata('lastName'); @@ -117,17 +117,17 @@ public function testMergeConstraintsMergesClassConstraints() $this->metadata->mergeConstraints($parent); $this->metadata->addConstraint(new ConstraintA()); - $constraints = array( - new ConstraintA(array('groups' => array( + $constraints = [ + new ConstraintA(['groups' => [ 'Default', 'EntityParent', 'Entity', - ))), - new ConstraintA(array('groups' => array( + ]]), + new ConstraintA(['groups' => [ 'Default', 'Entity', - ))), - ); + ]]), + ]; $this->assertEquals($constraints, $this->metadata->getConstraints()); } @@ -136,46 +136,46 @@ public function testMergeConstraintsMergesMemberConstraints() { $parent = new ClassMetadata(self::PARENTCLASS); $parent->addPropertyConstraint('firstName', new ConstraintA()); - $parent->addPropertyConstraint('firstName', new ConstraintB(array('groups' => 'foo'))); + $parent->addPropertyConstraint('firstName', new ConstraintB(['groups' => 'foo'])); $this->metadata->mergeConstraints($parent); $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); - $constraintA1 = new ConstraintA(array('groups' => array( + $constraintA1 = new ConstraintA(['groups' => [ 'Default', 'EntityParent', 'Entity', - ))); - $constraintA2 = new ConstraintA(array('groups' => array( + ]]); + $constraintA2 = new ConstraintA(['groups' => [ 'Default', 'Entity', - ))); - $constraintB = new ConstraintB(array( - 'groups' => array('foo'), - )); + ]]); + $constraintB = new ConstraintB([ + 'groups' => ['foo'], + ]); - $constraints = array( + $constraints = [ $constraintA1, $constraintB, $constraintA2, - ); + ]; - $constraintsByGroup = array( - 'Default' => array( + $constraintsByGroup = [ + 'Default' => [ $constraintA1, $constraintA2, - ), - 'EntityParent' => array( + ], + 'EntityParent' => [ $constraintA1, - ), - 'Entity' => array( + ], + 'Entity' => [ $constraintA1, $constraintA2, - ), - 'foo' => array( + ], + 'foo' => [ $constraintB, - ), - ); + ], + ]; $members = $this->metadata->getPropertyMetadata('firstName'); @@ -201,19 +201,19 @@ public function testMergeConstraintsKeepsPrivateMembersSeparate() $this->metadata->mergeConstraints($parent); $this->metadata->addPropertyConstraint('internal', new ConstraintA()); - $parentConstraints = array( - new ConstraintA(array('groups' => array( + $parentConstraints = [ + new ConstraintA(['groups' => [ 'Default', 'EntityParent', 'Entity', - ))), - ); - $constraints = array( - new ConstraintA(array('groups' => array( + ]]), + ]; + $constraints = [ + new ConstraintA(['groups' => [ 'Default', 'Entity', - ))), - ); + ]]), + ]; $members = $this->metadata->getPropertyMetadata('internal'); @@ -233,8 +233,8 @@ public function testGetReflectionClass() public function testSerialize() { - $this->metadata->addConstraint(new ConstraintA(array('property1' => 'A'))); - $this->metadata->addConstraint(new ConstraintB(array('groups' => 'TestGroup'))); + $this->metadata->addConstraint(new ConstraintA(['property1' => 'A'])); + $this->metadata->addConstraint(new ConstraintB(['groups' => 'TestGroup'])); $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); $this->metadata->addGetterConstraint('lastName', new ConstraintB()); @@ -245,7 +245,7 @@ public function testSerialize() public function testGroupSequencesWorkIfContainingDefaultGroup() { - $this->metadata->setGroupSequence(array('Foo', $this->metadata->getDefaultGroup())); + $this->metadata->setGroupSequence(['Foo', $this->metadata->getDefaultGroup()]); $this->assertInstanceOf('Symfony\Component\Validator\Constraints\GroupSequence', $this->metadata->getGroupSequence()); } @@ -255,7 +255,7 @@ public function testGroupSequencesWorkIfContainingDefaultGroup() */ public function testGroupSequencesFailIfNotContainingDefaultGroup() { - $this->metadata->setGroupSequence(array('Foo', 'Bar')); + $this->metadata->setGroupSequence(['Foo', 'Bar']); } /** @@ -263,7 +263,7 @@ public function testGroupSequencesFailIfNotContainingDefaultGroup() */ public function testGroupSequencesFailIfContainingDefault() { - $this->metadata->setGroupSequence(array('Foo', $this->metadata->getDefaultGroup(), Constraint::DEFAULT_GROUP)); + $this->metadata->setGroupSequence(['Foo', $this->metadata->getDefaultGroup(), Constraint::DEFAULT_GROUP]); } /** @@ -273,7 +273,7 @@ public function testGroupSequenceFailsIfGroupSequenceProviderIsSet() { $metadata = new ClassMetadata(self::PROVIDERCLASS); $metadata->setGroupSequenceProvider(true); - $metadata->setGroupSequence(array('GroupSequenceProviderEntity', 'Foo')); + $metadata->setGroupSequence(['GroupSequenceProviderEntity', 'Foo']); } /** @@ -282,7 +282,7 @@ public function testGroupSequenceFailsIfGroupSequenceProviderIsSet() public function testGroupSequenceProviderFailsIfGroupSequenceIsSet() { $metadata = new ClassMetadata(self::PROVIDERCLASS); - $metadata->setGroupSequence(array('GroupSequenceProviderEntity', 'Foo')); + $metadata->setGroupSequence(['GroupSequenceProviderEntity', 'Foo']); $metadata->setGroupSequenceProvider(true); } diff --git a/vendor/symfony/validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php b/vendor/symfony/validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php index de6852271e17f3e1f72cefcebd1868c810965225..a7876d7f9168f9f8219ab7ad67721dfdb82e1878 100644 --- a/vendor/symfony/validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php +++ b/vendor/symfony/validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php @@ -31,10 +31,10 @@ public function testLoadClassMetadataWithInterface() $factory = new LazyLoadingMetadataFactory(new TestLoader()); $metadata = $factory->getMetadataFor(self::PARENT_CLASS); - $constraints = array( - new ConstraintA(array('groups' => array('Default', 'EntityParent'))), - new ConstraintA(array('groups' => array('Default', 'EntityInterfaceA', 'EntityParent'))), - ); + $constraints = [ + new ConstraintA(['groups' => ['Default', 'EntityParent']]), + new ConstraintA(['groups' => ['Default', 'EntityInterfaceA', 'EntityParent']]), + ]; $this->assertEquals($constraints, $metadata->getConstraints()); } @@ -44,34 +44,34 @@ public function testMergeParentConstraints() $factory = new LazyLoadingMetadataFactory(new TestLoader()); $metadata = $factory->getMetadataFor(self::CLASS_NAME); - $constraints = array( - new ConstraintA(array('groups' => array( + $constraints = [ + new ConstraintA(['groups' => [ 'Default', 'Entity', - ))), - new ConstraintA(array('groups' => array( + ]]), + new ConstraintA(['groups' => [ 'Default', 'EntityParent', 'Entity', - ))), - new ConstraintA(array('groups' => array( + ]]), + new ConstraintA(['groups' => [ 'Default', 'EntityInterfaceA', 'EntityParent', 'Entity', - ))), - new ConstraintA(array('groups' => array( + ]]), + new ConstraintA(['groups' => [ 'Default', 'EntityInterfaceB', 'Entity', - ))), - new ConstraintA(array('groups' => array( + ]]), + new ConstraintA(['groups' => [ 'Default', 'EntityParentInterface', 'EntityInterfaceB', 'Entity', - ))), - ); + ]]), + ]; $this->assertEquals($constraints, $metadata->getConstraints()); } @@ -81,21 +81,21 @@ public function testWriteMetadataToCache() $cache = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Cache\CacheInterface')->getMock(); $factory = new LazyLoadingMetadataFactory(new TestLoader(), $cache); - $parentClassConstraints = array( - new ConstraintA(array('groups' => array('Default', 'EntityParent'))), - new ConstraintA(array('groups' => array('Default', 'EntityInterfaceA', 'EntityParent'))), - ); - $interfaceAConstraints = array( - new ConstraintA(array('groups' => array('Default', 'EntityInterfaceA'))), - ); + $parentClassConstraints = [ + new ConstraintA(['groups' => ['Default', 'EntityParent']]), + new ConstraintA(['groups' => ['Default', 'EntityInterfaceA', 'EntityParent']]), + ]; + $interfaceAConstraints = [ + new ConstraintA(['groups' => ['Default', 'EntityInterfaceA']]), + ]; $cache->expects($this->never()) ->method('has'); $cache->expects($this->exactly(2)) ->method('read') ->withConsecutive( - array($this->equalTo(self::PARENT_CLASS)), - array($this->equalTo(self::INTERFACE_A_CLASS)) + [$this->equalTo(self::PARENT_CLASS)], + [$this->equalTo(self::INTERFACE_A_CLASS)] ) ->will($this->returnValue(false)); $cache->expects($this->exactly(2)) @@ -135,8 +135,8 @@ public function testReadMetadataFromCache() $cache->expects($this->exactly(2)) ->method('read') ->withConsecutive( - array(self::PARENT_CLASS), - array(self::INTERFACE_A_CLASS) + [self::PARENT_CLASS], + [self::INTERFACE_A_CLASS] ) ->willReturnCallback(function ($name) use ($metadata, $parentClass, $interfaceClass) { if ($parentClass == $name) { @@ -194,7 +194,7 @@ public function testGroupsFromParent() $reader = new \Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader(); $factory = new LazyLoadingMetadataFactory($reader); $metadata = $factory->getMetadataFor('Symfony\Component\Validator\Tests\Fixtures\EntityStaticCarTurbo'); - $groups = array(); + $groups = []; foreach ($metadata->getPropertyMetadata('wheels') as $propertyMetadata) { $constraints = $propertyMetadata->getConstraints(); diff --git a/vendor/symfony/validator/Tests/Mapping/Loader/AnnotationLoaderTest.php b/vendor/symfony/validator/Tests/Mapping/Loader/AnnotationLoaderTest.php index 783e9b27d850cad54623c9e38591c1125e15980f..e5009624296e8bfb27c2e06caa03a29118b4c132 100644 --- a/vendor/symfony/validator/Tests/Mapping/Loader/AnnotationLoaderTest.php +++ b/vendor/symfony/validator/Tests/Mapping/Loader/AnnotationLoaderTest.php @@ -52,23 +52,23 @@ public function testLoadClassMetadata() $loader->loadClassMetadata($metadata); $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $expected->setGroupSequence(array('Foo', 'Entity')); + $expected->setGroupSequence(['Foo', 'Entity']); $expected->addConstraint(new ConstraintA()); - $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); - $expected->addConstraint(new Callback(array('callback' => 'validateMe', 'payload' => 'foo'))); + $expected->addConstraint(new Callback(['Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'])); + $expected->addConstraint(new Callback(['callback' => 'validateMe', 'payload' => 'foo'])); $expected->addConstraint(new Callback('validateMeStatic')); $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); - $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); - $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => new Range(array('min' => 5)), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( + $expected->addPropertyConstraint('firstName', new Range(['min' => 3])); + $expected->addPropertyConstraint('firstName', new All([new NotNull(), new Range(['min' => 3])])); + $expected->addPropertyConstraint('firstName', new All(['constraints' => [new NotNull(), new Range(['min' => 3])]])); + $expected->addPropertyConstraint('firstName', new Collection(['fields' => [ + 'foo' => [new NotNull(), new Range(['min' => 3])], + 'bar' => new Range(['min' => 5]), + ]])); + $expected->addPropertyConstraint('firstName', new Choice([ 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); + 'choices' => ['A', 'B'], + ])); $expected->addPropertyConstraint('childA', new Valid()); $expected->addPropertyConstraint('childB', new Valid()); $expected->addGetterConstraint('lastName', new NotNull()); @@ -124,23 +124,23 @@ public function testLoadClassMetadataAndMerge() $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); $expected->mergeConstraints($expected_parent); - $expected->setGroupSequence(array('Foo', 'Entity')); + $expected->setGroupSequence(['Foo', 'Entity']); $expected->addConstraint(new ConstraintA()); - $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); - $expected->addConstraint(new Callback(array('callback' => 'validateMe', 'payload' => 'foo'))); + $expected->addConstraint(new Callback(['Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'])); + $expected->addConstraint(new Callback(['callback' => 'validateMe', 'payload' => 'foo'])); $expected->addConstraint(new Callback('validateMeStatic')); $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); - $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); - $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => new Range(array('min' => 5)), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( + $expected->addPropertyConstraint('firstName', new Range(['min' => 3])); + $expected->addPropertyConstraint('firstName', new All([new NotNull(), new Range(['min' => 3])])); + $expected->addPropertyConstraint('firstName', new All(['constraints' => [new NotNull(), new Range(['min' => 3])]])); + $expected->addPropertyConstraint('firstName', new Collection(['fields' => [ + 'foo' => [new NotNull(), new Range(['min' => 3])], + 'bar' => new Range(['min' => 5]), + ]])); + $expected->addPropertyConstraint('firstName', new Choice([ 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); + 'choices' => ['A', 'B'], + ])); $expected->addPropertyConstraint('childA', new Valid()); $expected->addPropertyConstraint('childB', new Valid()); $expected->addGetterConstraint('lastName', new NotNull()); diff --git a/vendor/symfony/validator/Tests/Mapping/Loader/FilesLoaderTest.php b/vendor/symfony/validator/Tests/Mapping/Loader/FilesLoaderTest.php index 6fee7b6ff54071cde23685ac7fa2925bb50ac2d8..2cf009fc083717ec0e6ea59885ea1efdc9f1fffd 100644 --- a/vendor/symfony/validator/Tests/Mapping/Loader/FilesLoaderTest.php +++ b/vendor/symfony/validator/Tests/Mapping/Loader/FilesLoaderTest.php @@ -34,12 +34,12 @@ public function testCallsActualFileLoaderForMetadata() public function getFilesLoader(LoaderInterface $loader) { - return $this->getMockForAbstractClass('Symfony\Component\Validator\Tests\Fixtures\FilesLoader', array(array( + return $this->getMockForAbstractClass('Symfony\Component\Validator\Tests\Fixtures\FilesLoader', [[ __DIR__.'/constraint-mapping.xml', __DIR__.'/constraint-mapping.yaml', __DIR__.'/constraint-mapping.test', __DIR__.'/constraint-mapping.txt', - ), $loader)); + ], $loader]); } public function getFileLoader() diff --git a/vendor/symfony/validator/Tests/Mapping/Loader/LoaderChainTest.php b/vendor/symfony/validator/Tests/Mapping/Loader/LoaderChainTest.php index 0d28b0a399e48e6494f86a0fda6d4a6fbf408290..f9905386c96014377a89a47771e03720cd697d54 100644 --- a/vendor/symfony/validator/Tests/Mapping/Loader/LoaderChainTest.php +++ b/vendor/symfony/validator/Tests/Mapping/Loader/LoaderChainTest.php @@ -31,10 +31,10 @@ public function testAllLoadersAreCalled() ->method('loadClassMetadata') ->with($this->equalTo($metadata)); - $chain = new LoaderChain(array( + $chain = new LoaderChain([ $loader1, $loader2, - )); + ]); $chain->loadClassMetadata($metadata); } @@ -53,10 +53,10 @@ public function testReturnsTrueIfAnyLoaderReturnedTrue() ->method('loadClassMetadata') ->will($this->returnValue(false)); - $chain = new LoaderChain(array( + $chain = new LoaderChain([ $loader1, $loader2, - )); + ]); $this->assertTrue($chain->loadClassMetadata($metadata)); } @@ -75,10 +75,10 @@ public function testReturnsFalseIfNoLoaderReturnedTrue() ->method('loadClassMetadata') ->will($this->returnValue(false)); - $chain = new LoaderChain(array( + $chain = new LoaderChain([ $loader1, $loader2, - )); + ]); $this->assertFalse($chain->loadClassMetadata($metadata)); } diff --git a/vendor/symfony/validator/Tests/Mapping/Loader/XmlFileLoaderTest.php b/vendor/symfony/validator/Tests/Mapping/Loader/XmlFileLoaderTest.php index 100e4fa062fc10a6938f2b7f27e7c78460b6d9a8..d6b20a0c8dcb986af7c5896f63ccc8e7e9b04389 100644 --- a/vendor/symfony/validator/Tests/Mapping/Loader/XmlFileLoaderTest.php +++ b/vendor/symfony/validator/Tests/Mapping/Loader/XmlFileLoaderTest.php @@ -53,26 +53,26 @@ public function testLoadClassMetadata() $loader->loadClassMetadata($metadata); $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $expected->setGroupSequence(array('Foo', 'Entity')); + $expected->setGroupSequence(['Foo', 'Entity']); $expected->addConstraint(new ConstraintA()); $expected->addConstraint(new ConstraintB()); $expected->addConstraint(new Callback('validateMe')); $expected->addConstraint(new Callback('validateMeStatic')); - $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); + $expected->addConstraint(new Callback(['Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'])); $expected->addConstraint(new Traverse(false)); $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); - $expected->addPropertyConstraint('firstName', new Choice(array('A', 'B'))); - $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); - $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => array(new Range(array('min' => 5))), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( + $expected->addPropertyConstraint('firstName', new Range(['min' => 3])); + $expected->addPropertyConstraint('firstName', new Choice(['A', 'B'])); + $expected->addPropertyConstraint('firstName', new All([new NotNull(), new Range(['min' => 3])])); + $expected->addPropertyConstraint('firstName', new All(['constraints' => [new NotNull(), new Range(['min' => 3])]])); + $expected->addPropertyConstraint('firstName', new Collection(['fields' => [ + 'foo' => [new NotNull(), new Range(['min' => 3])], + 'bar' => [new Range(['min' => 5])], + ]])); + $expected->addPropertyConstraint('firstName', new Choice([ 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); + 'choices' => ['A', 'B'], + ])); $expected->addGetterConstraint('lastName', new NotNull()); $expected->addGetterConstraint('valid', new IsTrue()); $expected->addGetterConstraint('permissions', new IsTrue()); @@ -88,7 +88,7 @@ public function testLoadClassMetadataWithNonStrings() $loader->loadClassMetadata($metadata); $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $expected->addPropertyConstraint('firstName', new Regex(array('pattern' => '/^1/', 'match' => false))); + $expected->addPropertyConstraint('firstName', new Regex(['pattern' => '/^1/', 'match' => false])); $properties = $metadata->getPropertyMetadata('firstName'); $constraints = $properties[0]->getConstraints(); diff --git a/vendor/symfony/validator/Tests/Mapping/Loader/YamlFileLoaderTest.php b/vendor/symfony/validator/Tests/Mapping/Loader/YamlFileLoaderTest.php index 9920fb0737ae9186fadbb6c12aee0f8d5d2877e3..afa50cbee6485aa0f52725701d0eb314a61cf694 100644 --- a/vendor/symfony/validator/Tests/Mapping/Loader/YamlFileLoaderTest.php +++ b/vendor/symfony/validator/Tests/Mapping/Loader/YamlFileLoaderTest.php @@ -35,7 +35,7 @@ public function testLoadClassMetadataReturnsFalseIfEmpty() $r = new \ReflectionProperty($loader, 'classes'); $r->setAccessible(true); - $this->assertSame(array(), $r->getValue($loader)); + $this->assertSame([], $r->getValue($loader)); } /** @@ -52,10 +52,10 @@ public function testInvalidYamlFiles($path) public function provideInvalidYamlFiles() { - return array( - array('nonvalid-mapping.yml'), - array('bad-format.yml'), - ); + return [ + ['nonvalid-mapping.yml'], + ['bad-format.yml'], + ]; } /** @@ -98,25 +98,25 @@ public function testLoadClassMetadata() $loader->loadClassMetadata($metadata); $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $expected->setGroupSequence(array('Foo', 'Entity')); + $expected->setGroupSequence(['Foo', 'Entity']); $expected->addConstraint(new ConstraintA()); $expected->addConstraint(new ConstraintB()); $expected->addConstraint(new Callback('validateMe')); $expected->addConstraint(new Callback('validateMeStatic')); - $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); + $expected->addConstraint(new Callback(['Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'])); $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); - $expected->addPropertyConstraint('firstName', new Choice(array('A', 'B'))); - $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); - $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => array(new Range(array('min' => 5))), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( + $expected->addPropertyConstraint('firstName', new Range(['min' => 3])); + $expected->addPropertyConstraint('firstName', new Choice(['A', 'B'])); + $expected->addPropertyConstraint('firstName', new All([new NotNull(), new Range(['min' => 3])])); + $expected->addPropertyConstraint('firstName', new All(['constraints' => [new NotNull(), new Range(['min' => 3])]])); + $expected->addPropertyConstraint('firstName', new Collection(['fields' => [ + 'foo' => [new NotNull(), new Range(['min' => 3])], + 'bar' => [new Range(['min' => 5])], + ]])); + $expected->addPropertyConstraint('firstName', new Choice([ 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); + 'choices' => ['A', 'B'], + ])); $expected->addGetterConstraint('lastName', new NotNull()); $expected->addGetterConstraint('valid', new IsTrue()); $expected->addGetterConstraint('permissions', new IsTrue()); @@ -132,7 +132,7 @@ public function testLoadClassMetadataWithConstants() $loader->loadClassMetadata($metadata); $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $expected->addPropertyConstraint('firstName', new Range(array('max' => PHP_INT_MAX))); + $expected->addPropertyConstraint('firstName', new Range(['max' => PHP_INT_MAX])); $this->assertEquals($expected, $metadata); } diff --git a/vendor/symfony/validator/Tests/Mapping/MemberMetadataTest.php b/vendor/symfony/validator/Tests/Mapping/MemberMetadataTest.php index 593f90faa66b60a4db2b8ba5c2d07088c3999575..b6983f75b5715c0368a67960d8ec239c9727db2e 100644 --- a/vendor/symfony/validator/Tests/Mapping/MemberMetadataTest.php +++ b/vendor/symfony/validator/Tests/Mapping/MemberMetadataTest.php @@ -45,8 +45,8 @@ public function testAddConstraintRequiresClassConstraints() public function testSerialize() { - $this->metadata->addConstraint(new ConstraintA(array('property1' => 'A'))); - $this->metadata->addConstraint(new ConstraintB(array('groups' => 'TestGroup'))); + $this->metadata->addConstraint(new ConstraintA(['property1' => 'A'])); + $this->metadata->addConstraint(new ConstraintB(['groups' => 'TestGroup'])); $metadata = unserialize(serialize($this->metadata)); @@ -55,7 +55,7 @@ public function testSerialize() public function testSerializeCollectionCascaded() { - $this->metadata->addConstraint(new Valid(array('traverse' => true))); + $this->metadata->addConstraint(new Valid(['traverse' => true])); $metadata = unserialize(serialize($this->metadata)); @@ -64,7 +64,7 @@ public function testSerializeCollectionCascaded() public function testSerializeCollectionNotCascaded() { - $this->metadata->addConstraint(new Valid(array('traverse' => false))); + $this->metadata->addConstraint(new Valid(['traverse' => false])); $metadata = unserialize(serialize($this->metadata)); diff --git a/vendor/symfony/validator/Tests/Util/PropertyPathTest.php b/vendor/symfony/validator/Tests/Util/PropertyPathTest.php index 235e1780d907825bbb03ca0b580b54b5ff82f998..f796463bbc32085f40b7384dac5910d71816a4bf 100644 --- a/vendor/symfony/validator/Tests/Util/PropertyPathTest.php +++ b/vendor/symfony/validator/Tests/Util/PropertyPathTest.php @@ -26,12 +26,12 @@ public function testAppend($basePath, $subPath, $expectedPath, $message) public function provideAppendPaths() { - return array( - array('foo', '', 'foo', 'It returns the basePath if subPath is empty'), - array('', 'bar', 'bar', 'It returns the subPath if basePath is empty'), - array('foo', 'bar', 'foo.bar', 'It append the subPath to the basePath'), - array('foo', '[bar]', 'foo[bar]', 'It does not include the dot separator if subPath uses the array notation'), - array('0', 'bar', '0.bar', 'Leading zeros are kept.'), - ); + return [ + ['foo', '', 'foo', 'It returns the basePath if subPath is empty'], + ['', 'bar', 'bar', 'It returns the subPath if basePath is empty'], + ['foo', 'bar', 'foo.bar', 'It append the subPath to the basePath'], + ['foo', '[bar]', 'foo[bar]', 'It does not include the dot separator if subPath uses the array notation'], + ['0', 'bar', '0.bar', 'Leading zeros are kept.'], + ]; } } diff --git a/vendor/symfony/validator/Tests/Validator/AbstractTest.php b/vendor/symfony/validator/Tests/Validator/AbstractTest.php index 6587dae139550671125f7653c1eed16068421d8d..1df64de4d99c6e59269b5248bdbe6cc8e1b12d20 100644 --- a/vendor/symfony/validator/Tests/Validator/AbstractTest.php +++ b/vendor/symfony/validator/Tests/Validator/AbstractTest.php @@ -41,7 +41,7 @@ abstract class AbstractTest extends AbstractValidatorTest /** * @return ValidatorInterface */ - abstract protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()); + abstract protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = []); protected function setUp() { @@ -74,7 +74,7 @@ public function testValidateConstraintWithoutGroup() public function testValidateWithEmptyArrayAsConstraint() { - $violations = $this->validator->validate('value', array()); + $violations = $this->validator->validate('value', []); $this->assertCount(0, $violations); } @@ -89,20 +89,20 @@ public function testGroupSequenceAbortsAfterFailedGroup() $context->addViolation('Message 2'); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => function () {}, 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( + ])); + $this->metadata->addConstraint(new Callback([ 'callback' => $callback1, 'groups' => 'Group 2', - ))); - $this->metadata->addConstraint(new Callback(array( + ])); + $this->metadata->addConstraint(new Callback([ 'callback' => $callback2, 'groups' => 'Group 3', - ))); + ])); - $sequence = new GroupSequence(array('Group 1', 'Group 2', 'Group 3')); + $sequence = new GroupSequence(['Group 1', 'Group 2', 'Group 3']); $violations = $this->validator->validate($entity, new Valid(), $sequence); /* @var ConstraintViolationInterface[] $violations */ @@ -123,16 +123,16 @@ public function testGroupSequenceIncludesReferences() }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback1, 'groups' => 'Group 1', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( + ])); + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback2, 'groups' => 'Group 2', - ))); + ])); - $sequence = new GroupSequence(array('Group 1', 'Entity')); + $sequence = new GroupSequence(['Group 1', 'Entity']); $violations = $this->validator->validate($entity, new Valid(), $sequence); /* @var ConstraintViolationInterface[] $violations */ @@ -157,7 +157,7 @@ public function testValidateInSeparateContext() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('', $violations[0]->getPropertyPath()); // The root is different as we're in a new context @@ -180,17 +180,17 @@ public function testValidateInSeparateContext() $this->assertSame($entity->reference, $context->getValue()); $this->assertSame($entity->reference, $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback1, 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( + ])); + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback2, 'groups' => 'Group', - ))); + ])); $violations = $this->validator->validate($entity, new Valid(), 'Group'); @@ -236,17 +236,17 @@ public function testValidateInContext() $this->assertSame($entity->reference, $context->getValue()); $this->assertSame($entity->reference, $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback1, 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( + ])); + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback2, 'groups' => 'Group', - ))); + ])); $violations = $this->validator->validate($entity, new Valid(), 'Group'); @@ -254,7 +254,7 @@ public function testValidateInContext() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('subpath', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); @@ -278,7 +278,7 @@ public function testValidateArrayInContext() ->getValidator() ->inContext($context) ->atPath('subpath') - ->validate(array('key' => $value->reference)) + ->validate(['key' => $value->reference]) ; // context changes shouldn't leak out of the validate() call @@ -299,17 +299,17 @@ public function testValidateArrayInContext() $this->assertSame($entity->reference, $context->getValue()); $this->assertSame($entity->reference, $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback1, 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( + ])); + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback2, 'groups' => 'Group', - ))); + ])); $violations = $this->validator->validate($entity, new Valid(), 'Group'); @@ -317,7 +317,7 @@ public function testValidateArrayInContext() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('subpath[key]', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); @@ -328,7 +328,7 @@ public function testValidateArrayInContext() public function testTraverseTraversableByDefault() { $entity = new Entity(); - $traversable = new \ArrayIterator(array('key' => $entity)); + $traversable = new \ArrayIterator(['key' => $entity]); $callback = function ($value, ExecutionContextInterface $context) use ($entity, $traversable) { $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); @@ -340,14 +340,14 @@ public function testTraverseTraversableByDefault() $this->assertSame($entity, $context->getValue()); $this->assertSame($entity, $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; $this->metadataFactory->addMetadata(new ClassMetadata('ArrayIterator')); - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($traversable, new Valid(), 'Group'); @@ -355,7 +355,7 @@ public function testTraverseTraversableByDefault() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('[key]', $violations[0]->getPropertyPath()); $this->assertSame($traversable, $violations[0]->getRoot()); $this->assertSame($entity, $violations[0]->getInvalidValue()); @@ -366,7 +366,7 @@ public function testTraverseTraversableByDefault() public function testTraversalEnabledOnClass() { $entity = new Entity(); - $traversable = new \ArrayIterator(array('key' => $entity)); + $traversable = new \ArrayIterator(['key' => $entity]); $callback = function ($value, ExecutionContextInterface $context) { $context->addViolation('Message'); @@ -376,10 +376,10 @@ public function testTraversalEnabledOnClass() $traversableMetadata->addConstraint(new Traverse(true)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($traversable, new Valid(), 'Group'); @@ -390,7 +390,7 @@ public function testTraversalEnabledOnClass() public function testTraversalDisabledOnClass() { $entity = new Entity(); - $traversable = new \ArrayIterator(array('key' => $entity)); + $traversable = new \ArrayIterator(['key' => $entity]); $callback = function ($value, ExecutionContextInterface $context) { $this->fail('Should not be called'); @@ -400,10 +400,10 @@ public function testTraversalDisabledOnClass() $traversableMetadata->addConstraint(new Traverse(false)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($traversable, new Valid(), 'Group'); @@ -426,7 +426,7 @@ public function testExpectTraversableIfTraversalEnabledOnClass() public function testReferenceTraversalDisabledOnClass() { $entity = new Entity(); - $entity->reference = new \ArrayIterator(array('key' => new Reference())); + $entity->reference = new \ArrayIterator(['key' => new Reference()]); $callback = function ($value, ExecutionContextInterface $context) { $this->fail('Should not be called'); @@ -436,10 +436,10 @@ public function testReferenceTraversalDisabledOnClass() $traversableMetadata->addConstraint(new Traverse(false)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback(array( + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $this->metadata->addPropertyConstraint('reference', new Valid()); $violations = $this->validate($entity, new Valid(), 'Group'); @@ -451,7 +451,7 @@ public function testReferenceTraversalDisabledOnClass() public function testReferenceTraversalEnabledOnReferenceDisabledOnClass() { $entity = new Entity(); - $entity->reference = new \ArrayIterator(array('key' => new Reference())); + $entity->reference = new \ArrayIterator(['key' => new Reference()]); $callback = function ($value, ExecutionContextInterface $context) { $this->fail('Should not be called'); @@ -461,13 +461,13 @@ public function testReferenceTraversalEnabledOnReferenceDisabledOnClass() $traversableMetadata->addConstraint(new Traverse(false)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback(array( + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('reference', new Valid(array( + ])); + $this->metadata->addPropertyConstraint('reference', new Valid([ 'traverse' => true, - ))); + ])); $violations = $this->validate($entity, new Valid(), 'Group'); @@ -478,7 +478,7 @@ public function testReferenceTraversalEnabledOnReferenceDisabledOnClass() public function testReferenceTraversalDisabledOnReferenceEnabledOnClass() { $entity = new Entity(); - $entity->reference = new \ArrayIterator(array('key' => new Reference())); + $entity->reference = new \ArrayIterator(['key' => new Reference()]); $callback = function ($value, ExecutionContextInterface $context) { $this->fail('Should not be called'); @@ -488,13 +488,13 @@ public function testReferenceTraversalDisabledOnReferenceEnabledOnClass() $traversableMetadata->addConstraint(new Traverse(true)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback(array( + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('reference', new Valid(array( + ])); + $this->metadata->addPropertyConstraint('reference', new Valid([ 'traverse' => false, - ))); + ])); $violations = $this->validate($entity, new Valid(), 'Group'); @@ -523,7 +523,7 @@ public function testAddCustomizedViolation() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame('Invalid value', $violations[0]->getInvalidValue()); @@ -539,12 +539,12 @@ public function testNoDuplicateValidationIfClassConstraintInMultipleGroups() $context->addViolation('Message'); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, - 'groups' => array('Group 1', 'Group 2'), - ))); + 'groups' => ['Group 1', 'Group 2'], + ])); - $violations = $this->validator->validate($entity, new Valid(), array('Group 1', 'Group 2')); + $violations = $this->validator->validate($entity, new Valid(), ['Group 1', 'Group 2']); /* @var ConstraintViolationInterface[] $violations */ $this->assertCount(1, $violations); @@ -558,12 +558,12 @@ public function testNoDuplicateValidationIfPropertyConstraintInMultipleGroups() $context->addViolation('Message'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback(array( + $this->metadata->addPropertyConstraint('firstName', new Callback([ 'callback' => $callback, - 'groups' => array('Group 1', 'Group 2'), - ))); + 'groups' => ['Group 1', 'Group 2'], + ])); - $violations = $this->validator->validate($entity, new Valid(), array('Group 1', 'Group 2')); + $violations = $this->validator->validate($entity, new Valid(), ['Group 1', 'Group 2']); /* @var ConstraintViolationInterface[] $violations */ $this->assertCount(1, $violations); @@ -582,7 +582,7 @@ public function testAccessCurrentObject() $called = false; $entity = new Entity(); $entity->firstName = 'Bernhard'; - $entity->data = array('firstName' => 'Bernhard'); + $entity->data = ['firstName' => 'Bernhard']; $callback = function ($value, ExecutionContextInterface $context) use ($entity, &$called) { $called = true; @@ -591,7 +591,7 @@ public function testAccessCurrentObject() $this->metadata->addConstraint(new Callback($callback)); $this->metadata->addPropertyConstraint('firstName', new Callback($callback)); - $this->metadata->addPropertyConstraint('data', new Collection(array('firstName' => new Expression('value == this.firstName')))); + $this->metadata->addPropertyConstraint('data', new Collection(['firstName' => new Expression('value == this.firstName')])); $this->validator->validate($entity); @@ -618,10 +618,10 @@ public function testInitializeObjectsOnFirstValidation() ->method('initialize') ->with($entity); - $this->validator = $this->createValidator($this->metadataFactory, array( + $this->validator = $this->createValidator($this->metadataFactory, [ $initializer1, $initializer2, - )); + ]); // prepare constraint which // * checks that "initialized" is set to true @@ -656,15 +656,15 @@ public function testPassConstraintToViolation() public function testCollectionConstraitViolationHasCorrectContext() { - $data = array( + $data = [ 'foo' => 'fooValue', - ); + ]; // Missing field must not be the first in the collection validation - $constraint = new Collection(array( + $constraint = new Collection([ 'foo' => new NotNull(), 'bar' => new NotNull(), - )); + ]); $violations = $this->validate($data, $constraint); @@ -680,11 +680,11 @@ public function testNestedObjectIsNotValidatedIfGroupInValidConstraintIsNotValid $reference->value = ''; $entity->childA = $reference; - $this->metadata->addPropertyConstraint('firstName', new NotBlank(array('groups' => 'group1'))); - $this->metadata->addPropertyConstraint('childA', new Valid(array('groups' => 'group1'))); + $this->metadata->addPropertyConstraint('firstName', new NotBlank(['groups' => 'group1'])); + $this->metadata->addPropertyConstraint('childA', new Valid(['groups' => 'group1'])); $this->referenceMetadata->addPropertyConstraint('value', new NotBlank()); - $violations = $this->validator->validate($entity, null, array()); + $violations = $this->validator->validate($entity, null, []); $this->assertCount(0, $violations); } @@ -697,11 +697,11 @@ public function testNestedObjectIsValidatedIfGroupInValidConstraintIsValidated() $reference->value = ''; $entity->childA = $reference; - $this->metadata->addPropertyConstraint('firstName', new NotBlank(array('groups' => 'group1'))); - $this->metadata->addPropertyConstraint('childA', new Valid(array('groups' => 'group1'))); - $this->referenceMetadata->addPropertyConstraint('value', new NotBlank(array('groups' => 'group1'))); + $this->metadata->addPropertyConstraint('firstName', new NotBlank(['groups' => 'group1'])); + $this->metadata->addPropertyConstraint('childA', new Valid(['groups' => 'group1'])); + $this->referenceMetadata->addPropertyConstraint('value', new NotBlank(['groups' => 'group1'])); - $violations = $this->validator->validate($entity, null, array('Default', 'group1')); + $violations = $this->validator->validate($entity, null, ['Default', 'group1']); $this->assertCount(2, $violations); } diff --git a/vendor/symfony/validator/Tests/Validator/AbstractValidatorTest.php b/vendor/symfony/validator/Tests/Validator/AbstractValidatorTest.php index 7d303ce8a54355a9cee0123ac821bf4e01f4379b..ecfc10feb643ac93551d552c34bc56858c894844 100644 --- a/vendor/symfony/validator/Tests/Validator/AbstractValidatorTest.php +++ b/vendor/symfony/validator/Tests/Validator/AbstractValidatorTest.php @@ -80,13 +80,13 @@ public function testValidate() $this->assertSame('Bernhard', $context->getValue()); $this->assertSame('Bernhard', $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $constraint = new Callback(array( + $constraint = new Callback([ 'callback' => $callback, 'groups' => 'Group', - )); + ]); $violations = $this->validate('Bernhard', $constraint, 'Group'); @@ -94,7 +94,7 @@ public function testValidate() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('', $violations[0]->getPropertyPath()); $this->assertSame('Bernhard', $violations[0]->getRoot()); $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); @@ -116,13 +116,13 @@ public function testClassConstraint() $this->assertSame($entity, $context->getValue()); $this->assertSame($entity, $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($entity, null, 'Group'); @@ -130,7 +130,7 @@ public function testClassConstraint() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame($entity, $violations[0]->getInvalidValue()); @@ -155,13 +155,13 @@ public function testPropertyConstraint() $this->assertSame('Bernhard', $context->getValue()); $this->assertSame('Bernhard', $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addPropertyConstraint('firstName', new Callback(array( + $this->metadata->addPropertyConstraint('firstName', new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($entity, null, 'Group'); @@ -169,7 +169,7 @@ public function testPropertyConstraint() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('firstName', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); @@ -194,13 +194,13 @@ public function testGetterConstraint() $this->assertSame('Schussek', $context->getValue()); $this->assertSame('Schussek', $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addGetterConstraint('lastName', new Callback(array( + $this->metadata->addGetterConstraint('lastName', new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($entity, null, 'Group'); @@ -208,7 +208,7 @@ public function testGetterConstraint() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('lastName', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame('Schussek', $violations[0]->getInvalidValue()); @@ -219,7 +219,7 @@ public function testGetterConstraint() public function testArray() { $entity = new Entity(); - $array = array('key' => $entity); + $array = ['key' => $entity]; $callback = function ($value, ExecutionContextInterface $context) use ($entity, $array) { $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); @@ -231,13 +231,13 @@ public function testArray() $this->assertSame($entity, $context->getValue()); $this->assertSame($entity, $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($array, null, 'Group'); @@ -245,7 +245,7 @@ public function testArray() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('[key]', $violations[0]->getPropertyPath()); $this->assertSame($array, $violations[0]->getRoot()); $this->assertSame($entity, $violations[0]->getInvalidValue()); @@ -256,7 +256,7 @@ public function testArray() public function testRecursiveArray() { $entity = new Entity(); - $array = array(2 => array('key' => $entity)); + $array = [2 => ['key' => $entity]]; $callback = function ($value, ExecutionContextInterface $context) use ($entity, $array) { $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); @@ -268,13 +268,13 @@ public function testRecursiveArray() $this->assertSame($entity, $context->getValue()); $this->assertSame($entity, $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($array, null, 'Group'); @@ -282,7 +282,7 @@ public function testRecursiveArray() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('[2][key]', $violations[0]->getPropertyPath()); $this->assertSame($array, $violations[0]->getRoot()); $this->assertSame($entity, $violations[0]->getInvalidValue()); @@ -293,7 +293,7 @@ public function testRecursiveArray() public function testTraversable() { $entity = new Entity(); - $traversable = new \ArrayIterator(array('key' => $entity)); + $traversable = new \ArrayIterator(['key' => $entity]); $callback = function ($value, ExecutionContextInterface $context) use ($entity, $traversable) { $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); @@ -305,13 +305,13 @@ public function testTraversable() $this->assertSame($entity, $context->getValue()); $this->assertSame($entity, $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($traversable, null, 'Group'); @@ -319,7 +319,7 @@ public function testTraversable() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('[key]', $violations[0]->getPropertyPath()); $this->assertSame($traversable, $violations[0]->getRoot()); $this->assertSame($entity, $violations[0]->getInvalidValue()); @@ -330,9 +330,9 @@ public function testTraversable() public function testRecursiveTraversable() { $entity = new Entity(); - $traversable = new \ArrayIterator(array( - 2 => new \ArrayIterator(array('key' => $entity)), - )); + $traversable = new \ArrayIterator([ + 2 => new \ArrayIterator(['key' => $entity]), + ]); $callback = function ($value, ExecutionContextInterface $context) use ($entity, $traversable) { $this->assertSame($this::ENTITY_CLASS, $context->getClassName()); @@ -344,13 +344,13 @@ public function testRecursiveTraversable() $this->assertSame($entity, $context->getValue()); $this->assertSame($entity, $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($traversable, null, 'Group'); @@ -358,7 +358,7 @@ public function testRecursiveTraversable() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('[2][key]', $violations[0]->getPropertyPath()); $this->assertSame($traversable, $violations[0]->getRoot()); $this->assertSame($entity, $violations[0]->getInvalidValue()); @@ -381,14 +381,14 @@ public function testReferenceClassConstraint() $this->assertSame($entity->reference, $context->getValue()); $this->assertSame($entity->reference, $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($entity, null, 'Group'); @@ -396,7 +396,7 @@ public function testReferenceClassConstraint() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('reference', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); @@ -422,14 +422,14 @@ public function testReferencePropertyConstraint() $this->assertSame('Foobar', $context->getValue()); $this->assertSame('Foobar', $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addPropertyConstraint('value', new Callback(array( + $this->referenceMetadata->addPropertyConstraint('value', new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($entity, null, 'Group'); @@ -437,7 +437,7 @@ public function testReferencePropertyConstraint() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('reference.value', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame('Foobar', $violations[0]->getInvalidValue()); @@ -463,14 +463,14 @@ public function testReferenceGetterConstraint() $this->assertSame('Bamboo', $context->getValue()); $this->assertSame('Bamboo', $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addPropertyConstraint('privateValue', new Callback(array( + $this->referenceMetadata->addPropertyConstraint('privateValue', new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($entity, null, 'Group'); @@ -478,7 +478,7 @@ public function testReferenceGetterConstraint() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('reference.privateValue', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame('Bamboo', $violations[0]->getInvalidValue()); @@ -515,7 +515,7 @@ public function testFailOnScalarReferences() public function testArrayReference() { $entity = new Entity(); - $entity->reference = array('key' => new Reference()); + $entity->reference = ['key' => new Reference()]; $callback = function ($value, ExecutionContextInterface $context) use ($entity) { $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); @@ -527,14 +527,14 @@ public function testArrayReference() $this->assertSame($entity->reference['key'], $context->getValue()); $this->assertSame($entity->reference['key'], $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($entity, null, 'Group'); @@ -542,7 +542,7 @@ public function testArrayReference() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('reference[key]', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame($entity->reference['key'], $violations[0]->getInvalidValue()); @@ -554,7 +554,7 @@ public function testArrayReference() public function testRecursiveArrayReference() { $entity = new Entity(); - $entity->reference = array(2 => array('key' => new Reference())); + $entity->reference = [2 => ['key' => new Reference()]]; $callback = function ($value, ExecutionContextInterface $context) use ($entity) { $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); @@ -566,14 +566,14 @@ public function testRecursiveArrayReference() $this->assertSame($entity->reference[2]['key'], $context->getValue()); $this->assertSame($entity->reference[2]['key'], $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($entity, null, 'Group'); @@ -581,7 +581,7 @@ public function testRecursiveArrayReference() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('reference[2][key]', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame($entity->reference[2]['key'], $violations[0]->getInvalidValue()); @@ -592,15 +592,15 @@ public function testRecursiveArrayReference() public function testArrayTraversalCannotBeDisabled() { $entity = new Entity(); - $entity->reference = array('key' => new Reference()); + $entity->reference = ['key' => new Reference()]; $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addPropertyConstraint('reference', new Valid(array( + $this->metadata->addPropertyConstraint('reference', new Valid([ 'traverse' => false, - ))); + ])); $this->referenceMetadata->addConstraint(new Callback($callback)); $violations = $this->validate($entity); @@ -612,15 +612,15 @@ public function testArrayTraversalCannotBeDisabled() public function testRecursiveArrayTraversalCannotBeDisabled() { $entity = new Entity(); - $entity->reference = array(2 => array('key' => new Reference())); + $entity->reference = [2 => ['key' => new Reference()]]; $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addPropertyConstraint('reference', new Valid(array( + $this->metadata->addPropertyConstraint('reference', new Valid([ 'traverse' => false, - ))); + ])); $this->referenceMetadata->addConstraint(new Callback($callback)); $violations = $this->validate($entity); @@ -632,7 +632,7 @@ public function testRecursiveArrayTraversalCannotBeDisabled() public function testIgnoreScalarsDuringArrayTraversal() { $entity = new Entity(); - $entity->reference = array('string', 1234); + $entity->reference = ['string', 1234]; $this->metadata->addPropertyConstraint('reference', new Valid()); @@ -645,7 +645,7 @@ public function testIgnoreScalarsDuringArrayTraversal() public function testIgnoreNullDuringArrayTraversal() { $entity = new Entity(); - $entity->reference = array(null); + $entity->reference = [null]; $this->metadata->addPropertyConstraint('reference', new Valid()); @@ -658,7 +658,7 @@ public function testIgnoreNullDuringArrayTraversal() public function testTraversableReference() { $entity = new Entity(); - $entity->reference = new \ArrayIterator(array('key' => new Reference())); + $entity->reference = new \ArrayIterator(['key' => new Reference()]); $callback = function ($value, ExecutionContextInterface $context) use ($entity) { $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); @@ -670,14 +670,14 @@ public function testTraversableReference() $this->assertSame($entity->reference['key'], $context->getValue()); $this->assertSame($entity->reference['key'], $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($entity, null, 'Group'); @@ -685,7 +685,7 @@ public function testTraversableReference() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('reference[key]', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame($entity->reference['key'], $violations[0]->getInvalidValue()); @@ -696,16 +696,16 @@ public function testTraversableReference() public function testDisableTraversableTraversal() { $entity = new Entity(); - $entity->reference = new \ArrayIterator(array('key' => new Reference())); + $entity->reference = new \ArrayIterator(['key' => new Reference()]); $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; $this->metadataFactory->addMetadata(new ClassMetadata('ArrayIterator')); - $this->metadata->addPropertyConstraint('reference', new Valid(array( + $this->metadata->addPropertyConstraint('reference', new Valid([ 'traverse' => false, - ))); + ])); $this->referenceMetadata->addConstraint(new Callback($callback)); $violations = $this->validate($entity); @@ -722,9 +722,9 @@ public function testMetadataMustExistIfTraversalIsDisabled() $entity = new Entity(); $entity->reference = new \ArrayIterator(); - $this->metadata->addPropertyConstraint('reference', new Valid(array( + $this->metadata->addPropertyConstraint('reference', new Valid([ 'traverse' => false, - ))); + ])); $this->validate($entity); } @@ -732,9 +732,9 @@ public function testMetadataMustExistIfTraversalIsDisabled() public function testEnableRecursiveTraversableTraversal() { $entity = new Entity(); - $entity->reference = new \ArrayIterator(array( - 2 => new \ArrayIterator(array('key' => new Reference())), - )); + $entity->reference = new \ArrayIterator([ + 2 => new \ArrayIterator(['key' => new Reference()]), + ]); $callback = function ($value, ExecutionContextInterface $context) use ($entity) { $this->assertSame($this::REFERENCE_CLASS, $context->getClassName()); @@ -746,16 +746,16 @@ public function testEnableRecursiveTraversableTraversal() $this->assertSame($entity->reference[2]['key'], $context->getValue()); $this->assertSame($entity->reference[2]['key'], $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; - $this->metadata->addPropertyConstraint('reference', new Valid(array( + $this->metadata->addPropertyConstraint('reference', new Valid([ 'traverse' => true, - ))); - $this->referenceMetadata->addConstraint(new Callback(array( + ])); + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group', - ))); + ])); $violations = $this->validate($entity, null, 'Group'); @@ -763,7 +763,7 @@ public function testEnableRecursiveTraversableTraversal() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('reference[2][key]', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame($entity->reference[2]['key'], $violations[0]->getInvalidValue()); @@ -789,21 +789,21 @@ public function testValidateProperty() $this->assertSame('Bernhard', $context->getValue()); $this->assertSame('Bernhard', $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; $callback2 = function ($value, ExecutionContextInterface $context) { $context->addViolation('Other violation'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback(array( + $this->metadata->addPropertyConstraint('firstName', new Callback([ 'callback' => $callback1, 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('lastName', new Callback(array( + ])); + $this->metadata->addPropertyConstraint('lastName', new Callback([ 'callback' => $callback2, 'groups' => 'Group', - ))); + ])); $violations = $this->validateProperty($entity, 'firstName', 'Group'); @@ -811,7 +811,7 @@ public function testValidateProperty() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('firstName', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); @@ -847,21 +847,21 @@ public function testValidatePropertyValue() $this->assertSame('Bernhard', $context->getValue()); $this->assertSame('Bernhard', $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; $callback2 = function ($value, ExecutionContextInterface $context) { $context->addViolation('Other violation'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback(array( + $this->metadata->addPropertyConstraint('firstName', new Callback([ 'callback' => $callback1, 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('lastName', new Callback(array( + ])); + $this->metadata->addPropertyConstraint('lastName', new Callback([ 'callback' => $callback2, 'groups' => 'Group', - ))); + ])); $violations = $this->validatePropertyValue( $entity, @@ -874,7 +874,7 @@ public function testValidatePropertyValue() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('firstName', $violations[0]->getPropertyPath()); $this->assertSame($entity, $violations[0]->getRoot()); $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); @@ -896,21 +896,21 @@ public function testValidatePropertyValueWithClassName() $this->assertSame('Bernhard', $context->getValue()); $this->assertSame('Bernhard', $value); - $context->addViolation('Message %param%', array('%param%' => 'value')); + $context->addViolation('Message %param%', ['%param%' => 'value']); }; $callback2 = function ($value, ExecutionContextInterface $context) { $context->addViolation('Other violation'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback(array( + $this->metadata->addPropertyConstraint('firstName', new Callback([ 'callback' => $callback1, 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('lastName', new Callback(array( + ])); + $this->metadata->addPropertyConstraint('lastName', new Callback([ 'callback' => $callback2, 'groups' => 'Group', - ))); + ])); $violations = $this->validatePropertyValue( self::ENTITY_CLASS, @@ -923,7 +923,7 @@ public function testValidatePropertyValueWithClassName() $this->assertCount(1, $violations); $this->assertSame('Message value', $violations[0]->getMessage()); $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame(['%param%' => 'value'], $violations[0]->getParameters()); $this->assertSame('', $violations[0]->getPropertyPath()); $this->assertSame('Bernhard', $violations[0]->getRoot()); $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); @@ -990,14 +990,14 @@ public function testValidateSingleGroup() $context->addViolation('Message'); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( + ])); + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group 2', - ))); + ])); $violations = $this->validate($entity, null, 'Group 2'); @@ -1013,16 +1013,16 @@ public function testValidateMultipleGroups() $context->addViolation('Message'); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( + ])); + $this->metadata->addConstraint(new Callback([ 'callback' => $callback, 'groups' => 'Group 2', - ))); + ])); - $violations = $this->validate($entity, null, array('Group 1', 'Group 2')); + $violations = $this->validate($entity, null, ['Group 1', 'Group 2']); /* @var ConstraintViolationInterface[] $violations */ $this->assertCount(2, $violations); @@ -1039,20 +1039,20 @@ public function testReplaceDefaultGroupByGroupSequenceObject() $context->addViolation('Violation in Group 3'); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => function () {}, 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( + ])); + $this->metadata->addConstraint(new Callback([ 'callback' => $callback1, 'groups' => 'Group 2', - ))); - $this->metadata->addConstraint(new Callback(array( + ])); + $this->metadata->addConstraint(new Callback([ 'callback' => $callback2, 'groups' => 'Group 3', - ))); + ])); - $sequence = new GroupSequence(array('Group 1', 'Group 2', 'Group 3', 'Entity')); + $sequence = new GroupSequence(['Group 1', 'Group 2', 'Group 3', 'Entity']); $this->metadata->setGroupSequence($sequence); $violations = $this->validate($entity, null, 'Default'); @@ -1073,20 +1073,20 @@ public function testReplaceDefaultGroupByGroupSequenceArray() $context->addViolation('Violation in Group 3'); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => function () {}, 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( + ])); + $this->metadata->addConstraint(new Callback([ 'callback' => $callback1, 'groups' => 'Group 2', - ))); - $this->metadata->addConstraint(new Callback(array( + ])); + $this->metadata->addConstraint(new Callback([ 'callback' => $callback2, 'groups' => 'Group 3', - ))); + ])); - $sequence = array('Group 1', 'Group 2', 'Group 3', 'Entity'); + $sequence = ['Group 1', 'Group 2', 'Group 3', 'Entity']; $this->metadata->setGroupSequence($sequence); $violations = $this->validate($entity, null, 'Default'); @@ -1109,16 +1109,16 @@ public function testPropagateDefaultGroupToReferenceWhenReplacingDefaultGroup() }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback1, 'groups' => 'Default', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( + ])); + $this->referenceMetadata->addConstraint(new Callback([ 'callback' => $callback2, 'groups' => 'Group 1', - ))); + ])); - $sequence = new GroupSequence(array('Group 1', 'Entity')); + $sequence = new GroupSequence(['Group 1', 'Entity']); $this->metadata->setGroupSequence($sequence); $violations = $this->validate($entity, null, 'Default'); @@ -1139,16 +1139,16 @@ public function testValidateCustomGroupWhenDefaultGroupWasReplaced() $context->addViolation('Violation in group sequence'); }; - $this->metadata->addConstraint(new Callback(array( + $this->metadata->addConstraint(new Callback([ 'callback' => $callback1, 'groups' => 'Other Group', - ))); - $this->metadata->addConstraint(new Callback(array( + ])); + $this->metadata->addConstraint(new Callback([ 'callback' => $callback2, 'groups' => 'Group 1', - ))); + ])); - $sequence = new GroupSequence(array('Group 1', 'Entity')); + $sequence = new GroupSequence(['Group 1', 'Entity']); $this->metadata->setGroupSequence($sequence); $violations = $this->validate($entity, null, 'Other Group'); @@ -1173,18 +1173,18 @@ public function testReplaceDefaultGroup($sequence, array $assertViolations) }; $metadata = new ClassMetadata(\get_class($entity)); - $metadata->addConstraint(new Callback(array( + $metadata->addConstraint(new Callback([ 'callback' => function () {}, 'groups' => 'Group 1', - ))); - $metadata->addConstraint(new Callback(array( + ])); + $metadata->addConstraint(new Callback([ 'callback' => $callback1, 'groups' => 'Group 2', - ))); - $metadata->addConstraint(new Callback(array( + ])); + $metadata->addConstraint(new Callback([ 'callback' => $callback2, 'groups' => 'Group 3', - ))); + ])); $metadata->setGroupSequenceProvider(true); $this->metadataFactory->addMetadata($metadata); @@ -1200,33 +1200,33 @@ public function testReplaceDefaultGroup($sequence, array $assertViolations) public function getTestReplaceDefaultGroup() { - return array( - array( - 'sequence' => new GroupSequence(array('Group 1', 'Group 2', 'Group 3', 'Entity')), - 'assertViolations' => array( + return [ + [ + 'sequence' => new GroupSequence(['Group 1', 'Group 2', 'Group 3', 'Entity']), + 'assertViolations' => [ 'Violation in Group 2', - ), - ), - array( - 'sequence' => array('Group 1', 'Group 2', 'Group 3', 'Entity'), - 'assertViolations' => array( + ], + ], + [ + 'sequence' => ['Group 1', 'Group 2', 'Group 3', 'Entity'], + 'assertViolations' => [ 'Violation in Group 2', - ), - ), - array( - 'sequence' => new GroupSequence(array('Group 1', array('Group 2', 'Group 3'), 'Entity')), - 'assertViolations' => array( + ], + ], + [ + 'sequence' => new GroupSequence(['Group 1', ['Group 2', 'Group 3'], 'Entity']), + 'assertViolations' => [ 'Violation in Group 2', 'Violation in Group 3', - ), - ), - array( - 'sequence' => array('Group 1', array('Group 2', 'Group 3'), 'Entity'), - 'assertViolations' => array( + ], + ], + [ + 'sequence' => ['Group 1', ['Group 2', 'Group 3'], 'Entity'], + 'assertViolations' => [ 'Violation in Group 2', 'Violation in Group 3', - ), - ), - ); + ], + ], + ]; } } diff --git a/vendor/symfony/validator/Tests/Validator/RecursiveValidatorTest.php b/vendor/symfony/validator/Tests/Validator/RecursiveValidatorTest.php index 9e0afe06390beb60127e28b43986e3bebb377f39..8109b6b9bfd4df980b1b0d79d76aa2e33b14f928 100644 --- a/vendor/symfony/validator/Tests/Validator/RecursiveValidatorTest.php +++ b/vendor/symfony/validator/Tests/Validator/RecursiveValidatorTest.php @@ -12,6 +12,10 @@ namespace Symfony\Component\Validator\Tests\Validator; use Symfony\Component\Translation\IdentityTranslator; +use Symfony\Component\Validator\Constraints\All; +use Symfony\Component\Validator\Constraints\Collection; +use Symfony\Component\Validator\Constraints\Length; +use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\ConstraintValidatorFactory; use Symfony\Component\Validator\Context\ExecutionContextFactory; use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; @@ -22,7 +26,7 @@ class RecursiveValidatorTest extends AbstractTest { - protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()) + protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = []) { $translator = new IdentityTranslator(); $translator->setLocale('en'); @@ -40,26 +44,26 @@ public function testEmptyGroupsArrayDoesNotTriggerDeprecation() $childB = new ChildB(); $childA->name = false; $childB->name = 'fake'; - $entity->childA = array($childA); - $entity->childB = array($childB); + $entity->childA = [$childA]; + $entity->childB = [$childB]; $validatorContext = $this->getMockBuilder('Symfony\Component\Validator\Validator\ContextualValidatorInterface')->getMock(); $validatorContext ->expects($this->once()) ->method('validate') - ->with($entity, null, array()) + ->with($entity, null, []) ->willReturnSelf(); $validator = $this ->getMockBuilder('Symfony\Component\Validator\Validator\RecursiveValidator') ->disableOriginalConstructor() - ->setMethods(array('startContext')) + ->setMethods(['startContext']) ->getMock(); $validator ->expects($this->once()) ->method('startContext') ->willReturn($validatorContext); - $validator->validate($entity, null, array()); + $validator->validate($entity, null, []); } public function testRelationBetweenChildAAndChildB() @@ -73,26 +77,60 @@ public function testRelationBetweenChildAAndChildB() $childA->name = false; $childB->name = 'fake'; - $entity->childA = array($childA); - $entity->childB = array($childB); + $entity->childA = [$childA]; + $entity->childB = [$childB]; $validatorContext = $this->getMockBuilder('Symfony\Component\Validator\Validator\ContextualValidatorInterface')->getMock(); $validatorContext ->expects($this->once()) ->method('validate') - ->with($entity, null, array()) + ->with($entity, null, []) ->willReturnSelf(); $validator = $this ->getMockBuilder('Symfony\Component\Validator\Validator\RecursiveValidator') ->disableOriginalConstructor() - ->setMethods(array('startContext')) + ->setMethods(['startContext']) ->getMock(); $validator ->expects($this->once()) ->method('startContext') ->willReturn($validatorContext); - $validator->validate($entity, null, array()); + $validator->validate($entity, null, []); + } + + public function testCollectionConstraintValidateAllGroupsForNestedConstraints() + { + $this->metadata->addPropertyConstraint('data', new Collection(['fields' => [ + 'one' => [new NotBlank(['groups' => 'one']), new Length(['min' => 2, 'groups' => 'two'])], + 'two' => [new NotBlank(['groups' => 'two'])], + ]])); + + $entity = new Entity(); + $entity->data = ['one' => 't', 'two' => '']; + + $violations = $this->validator->validate($entity, null, ['one', 'two']); + + $this->assertCount(2, $violations); + $this->assertInstanceOf(Length::class, $violations->get(0)->getConstraint()); + $this->assertInstanceOf(NotBlank::class, $violations->get(1)->getConstraint()); + } + + public function testAllConstraintValidateAllGroupsForNestedConstraints() + { + $this->metadata->addPropertyConstraint('data', new All(['constraints' => [ + new NotBlank(['groups' => 'one']), + new Length(['min' => 2, 'groups' => 'two']), + ]])); + + $entity = new Entity(); + $entity->data = ['one' => 't', 'two' => '']; + + $violations = $this->validator->validate($entity, null, ['one', 'two']); + + $this->assertCount(2, $violations); + $this->assertInstanceOf(NotBlank::class, $violations->get(0)->getConstraint()); + $this->assertInstanceOf(Length::class, $violations->get(1)->getConstraint()); } } diff --git a/vendor/symfony/validator/Tests/Validator/TraceableValidatorTest.php b/vendor/symfony/validator/Tests/Validator/TraceableValidatorTest.php index b2eef769ecf3c0176fc16b02ede66cf4b707d680..b80efed27e7b726b329199380326d74156f36984 100644 --- a/vendor/symfony/validator/Tests/Validator/TraceableValidatorTest.php +++ b/vendor/symfony/validator/Tests/Validator/TraceableValidatorTest.php @@ -15,7 +15,6 @@ use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\ConstraintViolationList; -use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Mapping\MetadataInterface; use Symfony\Component\Validator\Validator\ContextualValidatorInterface; @@ -27,17 +26,17 @@ class TraceableValidatorTest extends TestCase public function testValidate() { $originalValidator = $this->createMock(ValidatorInterface::class); - $violations = new ConstraintViolationList(array( + $violations = new ConstraintViolationList([ $this->createMock(ConstraintViolation::class), $this->createMock(ConstraintViolation::class), - )); + ]); $originalValidator->expects($this->exactly(2))->method('validate')->willReturn($violations); $validator = new TraceableValidator($originalValidator); $object = new \stdClass(); - $constraints = array($this->createMock(Constraint::class)); - $groups = array('Default', 'Create'); + $constraints = [$this->createMock(Constraint::class)]; + $groups = ['Default', 'Create']; $validator->validate($object, $constraints, $groups); $line = __LINE__ - 1; @@ -50,17 +49,17 @@ public function testValidate() $this->assertSame(iterator_to_array($violations), $callData['violations']); - $this->assertSame(array( + $this->assertSame([ 'value' => $object, 'constraints' => $constraints, 'groups' => $groups, - ), $callData['context']); + ], $callData['context']); - $this->assertEquals(array( + $this->assertEquals([ 'name' => 'TraceableValidatorTest.php', 'file' => __FILE__, 'line' => $line, - ), $callData['caller']); + ], $callData['caller']); $validator->validate($object, $constraints, $groups); $collectedData = $validator->getCollectedData(); @@ -87,13 +86,13 @@ public function testForwardsToOriginalValidator() $expects('startContext')->willReturn($expected = $this->createMock(ContextualValidatorInterface::class)); $this->assertSame($expected, $validator->startContext(), 'returns original validator startContext() result'); - $expects('validate')->willReturn($expected = $this->createMock(ConstraintViolationListInterface::class)); + $expects('validate')->willReturn($expected = new ConstraintViolationList()); $this->assertSame($expected, $validator->validate('value'), 'returns original validator validate() result'); - $expects('validateProperty')->willReturn($expected = $this->createMock(ConstraintViolationListInterface::class)); + $expects('validateProperty')->willReturn($expected = new ConstraintViolationList()); $this->assertSame($expected, $validator->validateProperty(new \stdClass(), 'property'), 'returns original validator validateProperty() result'); - $expects('validatePropertyValue')->willReturn($expected = $this->createMock(ConstraintViolationListInterface::class)); + $expects('validatePropertyValue')->willReturn($expected = new ConstraintViolationList()); $this->assertSame($expected, $validator->validatePropertyValue(new \stdClass(), 'property', 'value'), 'returns original validator validatePropertyValue() result'); } diff --git a/vendor/symfony/validator/Tests/ValidatorBuilderTest.php b/vendor/symfony/validator/Tests/ValidatorBuilderTest.php index 77d586412b76b7b1573d543c8ccd0f5c18dd4e26..16d81697e658509815031fa305a2d524eb4bb9fc 100644 --- a/vendor/symfony/validator/Tests/ValidatorBuilderTest.php +++ b/vendor/symfony/validator/Tests/ValidatorBuilderTest.php @@ -41,7 +41,7 @@ public function testAddObjectInitializer() public function testAddObjectInitializers() { - $this->assertSame($this->builder, $this->builder->addObjectInitializers(array())); + $this->assertSame($this->builder, $this->builder->addObjectInitializers([])); } public function testAddXmlMapping() @@ -51,7 +51,7 @@ public function testAddXmlMapping() public function testAddXmlMappings() { - $this->assertSame($this->builder, $this->builder->addXmlMappings(array())); + $this->assertSame($this->builder, $this->builder->addXmlMappings([])); } public function testAddYamlMapping() @@ -61,7 +61,7 @@ public function testAddYamlMapping() public function testAddYamlMappings() { - $this->assertSame($this->builder, $this->builder->addYamlMappings(array())); + $this->assertSame($this->builder, $this->builder->addYamlMappings([])); } public function testAddMethodMapping() @@ -71,7 +71,7 @@ public function testAddMethodMapping() public function testAddMethodMappings() { - $this->assertSame($this->builder, $this->builder->addMethodMappings(array())); + $this->assertSame($this->builder, $this->builder->addMethodMappings([])); } public function testEnableAnnotationMapping() diff --git a/vendor/symfony/validator/Validator/ContextualValidatorInterface.php b/vendor/symfony/validator/Validator/ContextualValidatorInterface.php index 1cc96c834e6f69cd101b15bdb2aa3cf3e8b0576f..c8b545b54b4a66f37436f5ea362c137489c0fe0f 100644 --- a/vendor/symfony/validator/Validator/ContextualValidatorInterface.php +++ b/vendor/symfony/validator/Validator/ContextualValidatorInterface.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\GroupSequence; use Symfony\Component\Validator\ConstraintViolationListInterface; /** @@ -39,12 +40,9 @@ public function atPath($path); * If no constraint is passed, the constraint * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. * - * @param mixed $value The value to validate - * @param Constraint|Constraint[] $constraints The constraint(s) to validate - * against - * @param array|null $groups The validation groups to - * validate. If none is given, - * "Default" is assumed + * @param mixed $value The value to validate + * @param Constraint|Constraint[] $constraints The constraint(s) to validate against + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return $this */ @@ -54,10 +52,9 @@ public function validate($value, $constraints = null, $groups = null); * Validates a property of an object against the constraints specified * for this property. * - * @param object $object The object - * @param string $propertyName The name of the validated property - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed + * @param object $object The object + * @param string $propertyName The name of the validated property + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return $this */ @@ -67,12 +64,10 @@ public function validateProperty($object, $propertyName, $groups = null); * Validates a value against the constraints specified for an object's * property. * - * @param object|string $objectOrClass The object or its class name - * @param string $propertyName The name of the property - * @param mixed $value The value to validate against the - * property's constraints - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed + * @param object|string $objectOrClass The object or its class name + * @param string $propertyName The name of the property + * @param mixed $value The value to validate against the property's constraints + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return $this */ diff --git a/vendor/symfony/validator/Validator/RecursiveContextualValidator.php b/vendor/symfony/validator/Validator/RecursiveContextualValidator.php index eb1835c88a44198586344b960dc2e4724fb4b7fc..50253c50e1bb4941799988d31c45b39bef9ef247 100644 --- a/vendor/symfony/validator/Validator/RecursiveContextualValidator.php +++ b/vendor/symfony/validator/Validator/RecursiveContextualValidator.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Composite; use Symfony\Component\Validator\Constraints\GroupSequence; use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; use Symfony\Component\Validator\Context\ExecutionContext; @@ -56,11 +57,11 @@ class RecursiveContextualValidator implements ContextualValidatorInterface * constraint validators * @param ObjectInitializerInterface[] $objectInitializers The object initializers */ - public function __construct(ExecutionContextInterface $context, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $objectInitializers = array()) + public function __construct(ExecutionContextInterface $context, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $objectInitializers = []) { $this->context = $context; $this->defaultPropertyPath = $context->getPropertyPath(); - $this->defaultGroups = array($context->getGroup() ?: Constraint::DEFAULT_GROUP); + $this->defaultGroups = [$context->getGroup() ?: Constraint::DEFAULT_GROUP]; $this->metadataFactory = $metadataFactory; $this->validatorFactory = $validatorFactory; $this->objectInitializers = $objectInitializers; @@ -100,7 +101,7 @@ public function validate($value, $constraints = null, $groups = null) // You can pass a single constraint or an array of constraints // Make sure to deal with an array in the rest of the code if (!\is_array($constraints)) { - $constraints = array($constraints); + $constraints = [$constraints]; } $metadata = new GenericMetadata(); @@ -161,11 +162,7 @@ public function validate($value, $constraints = null, $groups = null) return $this; } - throw new RuntimeException(sprintf( - 'Cannot validate values of type "%s" automatically. Please '. - 'provide a constraint.', - \gettype($value) - )); + throw new RuntimeException(sprintf('Cannot validate values of type "%s" automatically. Please provide a constraint.', \gettype($value))); } /** @@ -176,12 +173,7 @@ public function validateProperty($object, $propertyName, $groups = null) $classMetadata = $this->metadataFactory->getMetadataFor($object); if (!$classMetadata instanceof ClassMetadataInterface) { - throw new ValidatorException(sprintf( - 'The metadata factory should return instances of '. - '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata) - )); + throw new ValidatorException(sprintf('The metadata factory should return instances of "\Symfony\Component\Validator\Mapping\ClassMetadataInterface", got: "%s".', \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata))); } $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); @@ -225,12 +217,7 @@ public function validatePropertyValue($objectOrClass, $propertyName, $value, $gr $classMetadata = $this->metadataFactory->getMetadataFor($objectOrClass); if (!$classMetadata instanceof ClassMetadataInterface) { - throw new ValidatorException(sprintf( - 'The metadata factory should return instances of '. - '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata) - )); + throw new ValidatorException(sprintf('The metadata factory should return instances of "\Symfony\Component\Validator\Mapping\ClassMetadataInterface", got: "%s".', \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata))); } $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); @@ -286,9 +273,9 @@ public function getViolations() /** * Normalizes the given group or list of groups to an array. * - * @param mixed $groups The groups to normalize + * @param string|GroupSequence|(string|GroupSequence)[] $groups The groups to normalize * - * @return array A group array + * @return (string|GroupSequence)[] A group array */ protected function normalizeGroups($groups) { @@ -296,7 +283,7 @@ protected function normalizeGroups($groups) return $groups; } - return array($groups); + return [$groups]; } /** @@ -309,7 +296,7 @@ protected function normalizeGroups($groups) * * @param object $object The object to cascade * @param string $propertyPath The current property path - * @param string[] $groups The validated groups + * @param (string|GroupSequence)[] $groups The validated groups * @param int $traversalStrategy The strategy for traversing the * cascaded object * @param ExecutionContextInterface $context The current execution context @@ -328,12 +315,7 @@ private function validateObject($object, $propertyPath, array $groups, $traversa $classMetadata = $this->metadataFactory->getMetadataFor($object); if (!$classMetadata instanceof ClassMetadataInterface) { - throw new UnsupportedMetadataException(sprintf( - 'The metadata factory should return instances of '. - '"Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata) - )); + throw new UnsupportedMetadataException(sprintf('The metadata factory should return instances of "Symfony\Component\Validator\Mapping\ClassMetadataInterface", got: "%s".', \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata))); } $this->validateClassNode( @@ -376,7 +358,7 @@ private function validateObject($object, $propertyPath, array $groups, $traversa * * @param iterable $collection The collection * @param string $propertyPath The current property path - * @param string[] $groups The validated groups + * @param (string|GroupSequence)[] $groups The validated groups * @param ExecutionContextInterface $context The current execution context * * @see ClassNode @@ -443,7 +425,7 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups, * the object * @param string $propertyPath The property path leading * to the object - * @param string[] $groups The groups in which the + * @param (string|GroupSequence)[] $groups The groups in which the * object should be validated * @param string[]|null $cascadedGroups The groups in which * cascaded objects should @@ -555,12 +537,7 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m // returns two metadata objects, not just one foreach ($metadata->getPropertyMetadata($propertyName) as $propertyMetadata) { if (!$propertyMetadata instanceof PropertyMetadataInterface) { - throw new UnsupportedMetadataException(sprintf( - 'The property metadata instances should implement '. - '"Symfony\Component\Validator\Mapping\PropertyMetadataInterface", '. - 'got: "%s".', - \is_object($propertyMetadata) ? \get_class($propertyMetadata) : \gettype($propertyMetadata) - )); + throw new UnsupportedMetadataException(sprintf('The property metadata instances should implement "Symfony\Component\Validator\Mapping\PropertyMetadataInterface", got: "%s".', \is_object($propertyMetadata) ? \get_class($propertyMetadata) : \gettype($propertyMetadata))); } $propertyValue = $propertyMetadata->getPropertyValue($object); @@ -597,11 +574,7 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m // If TRAVERSE, fail if we have no Traversable if (!$object instanceof \Traversable) { - throw new ConstraintDefinitionException(sprintf( - 'Traversal was enabled for "%s", but this class '. - 'does not implement "\Traversable".', - \get_class($object) - )); + throw new ConstraintDefinitionException(sprintf('Traversal was enabled for "%s", but this class does not implement "\Traversable".', \get_class($object))); } $this->validateEachObjectIn( @@ -636,7 +609,7 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m * value * @param string $propertyPath The property path leading * to the value - * @param string[] $groups The groups in which the + * @param (string|GroupSequence)[] $groups The groups in which the * value should be validated * @param string[]|null $cascadedGroups The groups in which * cascaded objects should @@ -758,7 +731,7 @@ private function validateGenericNode($value, $object, $cacheKey, MetadataInterfa private function stepThroughGroupSequence($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, $traversalStrategy, GroupSequence $groupSequence, $cascadedGroup, ExecutionContextInterface $context) { $violationCount = \count($context->getViolations()); - $cascadedGroups = $cascadedGroup ? array($cascadedGroup) : null; + $cascadedGroups = $cascadedGroup ? [$cascadedGroup] : null; foreach ($groupSequence->groups as $groupInSequence) { $groups = (array) $groupInSequence; @@ -815,6 +788,10 @@ private function validateInGroup($value, $cacheKey, MetadataInterface $metadata, if (null !== $cacheKey) { $constraintHash = spl_object_hash($constraint); + if ($constraint instanceof Composite) { + $constraintHash .= $group; + } + if ($context->isConstraintValidated($cacheKey, $constraintHash)) { continue; } diff --git a/vendor/symfony/validator/Validator/RecursiveValidator.php b/vendor/symfony/validator/Validator/RecursiveValidator.php index 33c2ec9e4798f90d94b6c7484c28578cd86f79ec..a258fd4a77d7167c78b5ef63324af8526b62f39a 100644 --- a/vendor/symfony/validator/Validator/RecursiveValidator.php +++ b/vendor/symfony/validator/Validator/RecursiveValidator.php @@ -41,7 +41,7 @@ class RecursiveValidator implements ValidatorInterface * constraint validators * @param ObjectInitializerInterface[] $objectInitializers The object initializers */ - public function __construct(ExecutionContextFactoryInterface $contextFactory, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $objectInitializers = array()) + public function __construct(ExecutionContextFactoryInterface $contextFactory, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $objectInitializers = []) { $this->contextFactory = $contextFactory; $this->metadataFactory = $metadataFactory; diff --git a/vendor/symfony/validator/Validator/TraceableValidator.php b/vendor/symfony/validator/Validator/TraceableValidator.php index 96134e276746898a9b2740a93e5025daf80913c4..f1b514d61f07a428af899a99432b3efb17e16bf2 100644 --- a/vendor/symfony/validator/Validator/TraceableValidator.php +++ b/vendor/symfony/validator/Validator/TraceableValidator.php @@ -21,7 +21,7 @@ class TraceableValidator implements ValidatorInterface { private $validator; - private $collectedData = array(); + private $collectedData = []; public function __construct(ValidatorInterface $validator) { @@ -38,7 +38,7 @@ public function getCollectedData() public function reset() { - $this->collectedData = array(); + $this->collectedData = []; } /** @@ -92,11 +92,11 @@ public function validate($value, $constraints = null, $groups = null) $name = str_replace('\\', '/', $file); $name = substr($name, strrpos($name, '/') + 1); - $this->collectedData[] = array( + $this->collectedData[] = [ 'caller' => compact('name', 'file', 'line'), 'context' => compact('value', 'constraints', 'groups'), 'violations' => iterator_to_array($violations), - ); + ]; return $violations; } diff --git a/vendor/symfony/validator/Validator/ValidatorInterface.php b/vendor/symfony/validator/Validator/ValidatorInterface.php index 5bac2e88987f633ba362416a347621c257561668..78157465ab5ce6a48bf357172cc066eb6a48a7a7 100644 --- a/vendor/symfony/validator/Validator/ValidatorInterface.php +++ b/vendor/symfony/validator/Validator/ValidatorInterface.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\GroupSequence; use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; @@ -29,12 +30,9 @@ interface ValidatorInterface extends MetadataFactoryInterface * If no constraint is passed, the constraint * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. * - * @param mixed $value The value to validate - * @param Constraint|Constraint[] $constraints The constraint(s) to validate - * against - * @param array|null $groups The validation groups to - * validate. If none is given, - * "Default" is assumed + * @param mixed $value The value to validate + * @param Constraint|Constraint[] $constraints The constraint(s) to validate against + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return ConstraintViolationListInterface A list of constraint violations * If the list is empty, validation @@ -46,10 +44,9 @@ public function validate($value, $constraints = null, $groups = null); * Validates a property of an object against the constraints specified * for this property. * - * @param object $object The object - * @param string $propertyName The name of the validated property - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed + * @param object $object The object + * @param string $propertyName The name of the validated property + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return ConstraintViolationListInterface A list of constraint violations * If the list is empty, validation @@ -61,12 +58,10 @@ public function validateProperty($object, $propertyName, $groups = null); * Validates a value against the constraints specified for an object's * property. * - * @param object|string $objectOrClass The object or its class name - * @param string $propertyName The name of the property - * @param mixed $value The value to validate against the - * property's constraints - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed + * @param object|string $objectOrClass The object or its class name + * @param string $propertyName The name of the property + * @param mixed $value The value to validate against the property's constraints + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return ConstraintViolationListInterface A list of constraint violations * If the list is empty, validation diff --git a/vendor/symfony/validator/ValidatorBuilder.php b/vendor/symfony/validator/ValidatorBuilder.php index 11c5052f3b001d51f426649fb033225853236943..d9cb6b8b3b9d1a9f353d70ca08e1d12a107a1474 100644 --- a/vendor/symfony/validator/ValidatorBuilder.php +++ b/vendor/symfony/validator/ValidatorBuilder.php @@ -37,10 +37,10 @@ */ class ValidatorBuilder implements ValidatorBuilderInterface { - private $initializers = array(); - private $xmlMappings = array(); - private $yamlMappings = array(); - private $methodMappings = array(); + private $initializers = []; + private $xmlMappings = []; + private $yamlMappings = []; + private $methodMappings = []; /** * @var Reader|null @@ -68,7 +68,7 @@ class ValidatorBuilder implements ValidatorBuilderInterface private $translator; /** - * @var null|string + * @var string|null */ private $translationDomain; @@ -271,7 +271,7 @@ public function setTranslationDomain($translationDomain) */ public function getLoaders() { - $loaders = array(); + $loaders = []; foreach ($this->xmlMappings as $xmlMapping) { $loaders[] = new XmlFileLoader($xmlMapping); diff --git a/vendor/symfony/validator/phpunit.xml.dist b/vendor/symfony/validator/phpunit.xml.dist index 0e82129d79d8ea18166ea514d533082bf1bbf814..5d07c4e64803d0bff24d88ee46324e2b44d65d97 100644 --- a/vendor/symfony/validator/phpunit.xml.dist +++ b/vendor/symfony/validator/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/symfony/yaml/CHANGELOG.md b/vendor/symfony/yaml/CHANGELOG.md index 1b07b239cd6e59f570ff060a87c43c014415e87e..fd41c9dd221e289c6cf0507901bc9afff3f174cb 100644 --- a/vendor/symfony/yaml/CHANGELOG.md +++ b/vendor/symfony/yaml/CHANGELOG.md @@ -113,7 +113,7 @@ CHANGELOG * Added support for customizing the dumped YAML string through an optional bit field: ```php - Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT); + Yaml::dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT); ``` 3.0.0 diff --git a/vendor/symfony/yaml/Command/LintCommand.php b/vendor/symfony/yaml/Command/LintCommand.php index 36e7e8b97ce18920666fd6cf485551e36ca541f7..cc19a5658101d2c4f8942f5bf4bcca765eb3fb99 100644 --- a/vendor/symfony/yaml/Command/LintCommand.php +++ b/vendor/symfony/yaml/Command/LintCommand.php @@ -91,14 +91,14 @@ protected function execute(InputInterface $input, OutputInterface $output) throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); } - return $this->display($io, array($this->validate($stdin, $flags))); + return $this->display($io, [$this->validate($stdin, $flags)]); } if (!$this->isReadable($filename)) { throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); } - $filesInfo = array(); + $filesInfo = []; foreach ($this->getFiles($filename) as $file) { $filesInfo[] = $this->validate(file_get_contents($file), $flags, $file); } @@ -119,12 +119,12 @@ private function validate($content, $flags, $file = null) try { $this->getParser()->parse($content, Yaml::PARSE_CONSTANT | $flags); } catch (ParseException $e) { - return array('file' => $file, 'line' => $e->getParsedLine(), 'valid' => false, 'message' => $e->getMessage()); + return ['file' => $file, 'line' => $e->getParsedLine(), 'valid' => false, 'message' => $e->getMessage()]; } finally { restore_error_handler(); } - return array('file' => $file, 'valid' => true); + return ['file' => $file, 'valid' => true]; } private function display(SymfonyStyle $io, array $files) @@ -188,7 +188,7 @@ private function getFiles($fileOrDirectory) } foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) { - if (!\in_array($file->getExtension(), array('yml', 'yaml'))) { + if (!\in_array($file->getExtension(), ['yml', 'yaml'])) { continue; } diff --git a/vendor/symfony/yaml/Escaper.php b/vendor/symfony/yaml/Escaper.php index 2b1321f64cb2c758941349ab069211251cf0d63f..4d3ce244c2adac3f1c085df505be9f61b7053c32 100644 --- a/vendor/symfony/yaml/Escaper.php +++ b/vendor/symfony/yaml/Escaper.php @@ -28,20 +28,20 @@ class Escaper // first to ensure proper escaping because str_replace operates iteratively // on the input arrays. This ordering of the characters avoids the use of strtr, // which performs more slowly. - private static $escapees = array('\\', '\\\\', '\\"', '"', + private static $escapees = ['\\', '\\\\', '\\"', '"', "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", - ); - private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', + ]; + private static $escaped = ['\\\\', '\\"', '\\\\', '\\"', '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', '\\N', '\\_', '\\L', '\\P', - ); + ]; /** * Determines if a PHP value would require double quoting in YAML. @@ -78,7 +78,7 @@ public static function requiresSingleQuoting($value) { // Determines if a PHP value is entirely composed of a value that would // require single quoting in YAML. - if (\in_array(strtolower($value), array('null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'))) { + if (\in_array(strtolower($value), ['null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'])) { return true; } diff --git a/vendor/symfony/yaml/Inline.php b/vendor/symfony/yaml/Inline.php index 0aa7e9f41a5694c4d60e974a6a0f7fc0b20bae61..5d71a1f30f08ce679d4da46d974ee8cd0601b28d 100644 --- a/vendor/symfony/yaml/Inline.php +++ b/vendor/symfony/yaml/Inline.php @@ -63,7 +63,7 @@ public static function initialize($flags, $parsedLineNumber = null, $parsedFilen * * @throws ParseException */ - public static function parse($value, $flags = 0, $references = array()) + public static function parse($value, $flags = 0, $references = []) { if (\is_bool($flags)) { @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED); @@ -93,7 +93,7 @@ public static function parse($value, $flags = 0, $references = array()) if (\func_num_args() >= 5) { $references = func_get_arg(4); } else { - $references = array(); + $references = []; } } @@ -110,35 +110,37 @@ public static function parse($value, $flags = 0, $references = array()) mb_internal_encoding('ASCII'); } - $i = 0; - $tag = self::parseTag($value, $i, $flags); - switch ($value[$i]) { - case '[': - $result = self::parseSequence($value, $flags, $i, $references); - ++$i; - break; - case '{': - $result = self::parseMapping($value, $flags, $i, $references); - ++$i; - break; - default: - $result = self::parseScalar($value, $flags, null, $i, null === $tag, $references); - } + try { + $i = 0; + $tag = self::parseTag($value, $i, $flags); + switch ($value[$i]) { + case '[': + $result = self::parseSequence($value, $flags, $i, $references); + ++$i; + break; + case '{': + $result = self::parseMapping($value, $flags, $i, $references); + ++$i; + break; + default: + $result = self::parseScalar($value, $flags, null, $i, null === $tag, $references); + } - if (null !== $tag) { - return new TaggedValue($tag, $result); - } + if (null !== $tag) { + return new TaggedValue($tag, $result); + } - // some comments are allowed at the end - if (preg_replace('/\s+#.*$/A', '', substr($value, $i))) { - throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } + // some comments are allowed at the end + if (preg_replace('/\s+#.*$/A', '', substr($value, $i))) { + throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } - if (isset($mbEncoding)) { - mb_internal_encoding($mbEncoding); + return $result; + } finally { + if (isset($mbEncoding)) { + mb_internal_encoding($mbEncoding); + } } - - return $result; } /** @@ -283,7 +285,7 @@ private static function dumpArray($value, $flags) { // array if (($value || Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE & $flags) && !self::isHash($value)) { - $output = array(); + $output = []; foreach ($value as $val) { $output[] = self::dump($val, $flags); } @@ -292,7 +294,7 @@ private static function dumpArray($value, $flags) } // hash - $output = array(); + $output = []; foreach ($value as $key => $val) { $output[] = sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags)); } @@ -316,16 +318,16 @@ private static function dumpArray($value, $flags) * * @internal */ - public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i = 0, $evaluate = true, $references = array(), $legacyOmittedKeySupport = false) + public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i = 0, $evaluate = true, $references = [], $legacyOmittedKeySupport = false) { - if (\in_array($scalar[$i], array('"', "'"))) { + if (\in_array($scalar[$i], ['"', "'"])) { // quoted scalar $output = self::parseQuotedScalar($scalar, $i); if (null !== $delimiters) { $tmp = ltrim(substr($scalar, $i), ' '); if ('' === $tmp) { - throw new ParseException(sprintf('Unexpected end of line, expected one of "%s".', implode($delimiters)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + throw new ParseException(sprintf('Unexpected end of line, expected one of "%s".', implode('', $delimiters)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); } if (!\in_array($tmp[0], $delimiters)) { throw new ParseException(sprintf('Unexpected characters (%s).', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); @@ -407,9 +409,9 @@ private static function parseQuotedScalar($scalar, &$i) * * @throws ParseException When malformed inline YAML string is parsed */ - private static function parseSequence($sequence, $flags, &$i = 0, $references = array()) + private static function parseSequence($sequence, $flags, &$i = 0, $references = []) { - $output = array(); + $output = []; $len = \strlen($sequence); ++$i; @@ -435,8 +437,8 @@ private static function parseSequence($sequence, $flags, &$i = 0, $references = $value = self::parseMapping($sequence, $flags, $i, $references); break; default: - $isQuoted = \in_array($sequence[$i], array('"', "'")); - $value = self::parseScalar($sequence, $flags, array(',', ']'), $i, null === $tag, $references); + $isQuoted = \in_array($sequence[$i], ['"', "'"]); + $value = self::parseScalar($sequence, $flags, [',', ']'], $i, null === $tag, $references); // the value can be an array if a reference has been resolved to an array var if (\is_string($value) && !$isQuoted && false !== strpos($value, ': ')) { @@ -476,9 +478,9 @@ private static function parseSequence($sequence, $flags, &$i = 0, $references = * * @throws ParseException When malformed inline YAML string is parsed */ - private static function parseMapping($mapping, $flags, &$i = 0, $references = array()) + private static function parseMapping($mapping, $flags, &$i = 0, $references = []) { - $output = array(); + $output = []; $len = \strlen($mapping); ++$i; $allowOverwrite = false; @@ -499,8 +501,8 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar } // key - $isKeyQuoted = \in_array($mapping[$i], array('"', "'"), true); - $key = self::parseScalar($mapping, $flags, array(':', ' '), $i, false, array(), true); + $isKeyQuoted = \in_array($mapping[$i], ['"', "'"], true); + $key = self::parseScalar($mapping, $flags, [':', ' '], $i, false, [], true); if (':' !== $key && false === $i = strpos($mapping, ':', $i)) { break; @@ -518,7 +520,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar } } - if (':' !== $key && !$isKeyQuoted && (!isset($mapping[$i + 1]) || !\in_array($mapping[$i + 1], array(' ', ',', '[', ']', '{', '}'), true))) { + if (':' !== $key && !$isKeyQuoted && (!isset($mapping[$i + 1]) || !\in_array($mapping[$i + 1], [' ', ',', '[', ']', '{', '}'], true))) { @trigger_error(self::getDeprecationMessage('Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since Symfony 3.2 and will throw a ParseException in 4.0.'), E_USER_DEPRECATED); } @@ -576,7 +578,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar } break; default: - $value = self::parseScalar($mapping, $flags, array(',', '}'), $i, null === $tag, $references); + $value = self::parseScalar($mapping, $flags, [',', '}'], $i, null === $tag, $references); // Spec: Keys MUST be unique; first one wins. // Parser cannot abort this mapping earlier, since lines // are processed sequentially. @@ -614,7 +616,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar * * @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved */ - private static function evaluateScalar($scalar, $flags, $references = array()) + private static function evaluateScalar($scalar, $flags, $references = []) { $scalar = trim($scalar); $scalarLower = strtolower($scalar); @@ -631,7 +633,7 @@ private static function evaluateScalar($scalar, $flags, $references = array()) throw new ParseException('A reference must contain at least one character.', self::$parsedLineNumber + 1, $value, self::$parsedFilename); } - if (!array_key_exists($value, $references)) { + if (!\array_key_exists($value, $references)) { throw new ParseException(sprintf('Reference "%s" does not exist.', $value), self::$parsedLineNumber + 1, $value, self::$parsedFilename); } @@ -764,7 +766,7 @@ private static function evaluateScalar($scalar, $flags, $references = array()) @trigger_error(self::getDeprecationMessage('Using the comma as a group separator for floats is deprecated since Symfony 3.2 and will be removed in 4.0.'), E_USER_DEPRECATED); } - return (float) str_replace(array(',', '_'), '', $scalar); + return (float) str_replace([',', '_'], '', $scalar); case Parser::preg_match(self::getTimestampRegex(), $scalar): if (Yaml::PARSE_DATETIME & $flags) { // When no timezone is provided in the parsed date, YAML spec says we must assume UTC. @@ -788,7 +790,7 @@ private static function evaluateScalar($scalar, $flags, $references = array()) * @param int &$i * @param int $flags * - * @return null|string + * @return string|null */ private static function parseTag($value, &$i, $flags) { @@ -803,7 +805,7 @@ private static function parseTag($value, &$i, $flags) $nextOffset += strspn($value, ' ', $nextOffset); // Is followed by a scalar - if ((!isset($value[$nextOffset]) || !\in_array($value[$nextOffset], array('[', '{'), true)) && 'tagged' !== $tag) { + if ((!isset($value[$nextOffset]) || !\in_array($value[$nextOffset], ['[', '{'], true)) && 'tagged' !== $tag) { // Manage non-whitelisted scalars in {@link self::evaluateScalar()} return; } diff --git a/vendor/symfony/yaml/LICENSE b/vendor/symfony/yaml/LICENSE index 21d7fb9e2f29b50caca3a76f0647e94e2cc8ddc1..a677f43763ca467472898351b328aee41e2edd7c 100644 --- a/vendor/symfony/yaml/LICENSE +++ b/vendor/symfony/yaml/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2018 Fabien Potencier +Copyright (c) 2004-2019 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/yaml/Parser.php b/vendor/symfony/yaml/Parser.php index 284af1f9f932b1b37e283fb95caa3a773c6ec534..cc094085c62b93ffae86fb42b7988558535112f7 100644 --- a/vendor/symfony/yaml/Parser.php +++ b/vendor/symfony/yaml/Parser.php @@ -29,12 +29,13 @@ class Parser private $filename; private $offset = 0; private $totalNumberOfLines; - private $lines = array(); + private $lines = []; private $currentLineNb = -1; private $currentLine = ''; - private $refs = array(); - private $skippedLineNumbers = array(); - private $locallySkippedLineNumbers = array(); + private $refs = []; + private $skippedLineNumbers = []; + private $locallySkippedLineNumbers = []; + private $refsBeingParsed = []; public function __construct() { @@ -126,7 +127,7 @@ public function parse($value, $flags = 0) throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename); } - $this->refs = array(); + $this->refs = []; $mbEncoding = null; $e = null; @@ -147,11 +148,11 @@ public function parse($value, $flags = 0) mb_internal_encoding($mbEncoding); } - $this->lines = array(); + $this->lines = []; $this->currentLine = ''; - $this->refs = array(); - $this->skippedLineNumbers = array(); - $this->locallySkippedLineNumbers = array(); + $this->refs = []; + $this->skippedLineNumbers = []; + $this->locallySkippedLineNumbers = []; if (null !== $e) { throw $e; @@ -166,7 +167,7 @@ private function doParse($value, $flags) $this->currentLine = ''; $value = $this->cleanup($value); $this->lines = explode("\n", $value); - $this->locallySkippedLineNumbers = array(); + $this->locallySkippedLineNumbers = []; if (null === $this->totalNumberOfLines) { $this->totalNumberOfLines = \count($this->lines); @@ -176,7 +177,7 @@ private function doParse($value, $flags) return null; } - $data = array(); + $data = []; $context = null; $allowOverwrite = false; @@ -212,6 +213,7 @@ private function doParse($value, $flags) if (isset($values['value']) && self::preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#u', $values['value'], $matches)) { $isRef = $matches['ref']; + $this->refsBeingParsed[] = $isRef; $values['value'] = $matches['value']; } @@ -244,10 +246,11 @@ private function doParse($value, $flags) } if ($isRef) { $this->refs[$isRef] = end($data); + array_pop($this->refsBeingParsed); } } elseif ( self::preg_match('#^(?P<key>(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|(?:!?!php/const:)?[^ \'"\[\{!].*?)) *\:(\s++(?P<value>.+))?$#u', rtrim($this->currentLine), $values) - && (false === strpos($values['key'], ' #') || \in_array($values['key'][0], array('"', "'"))) + && (false === strpos($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"])) ) { if ($context && 'sequence' == $context) { throw new ParseException('You cannot define a mapping item when in a sequence', $this->currentLineNb + 1, $this->currentLine, $this->filename); @@ -286,7 +289,11 @@ private function doParse($value, $flags) $allowOverwrite = true; if (isset($values['value'][0]) && '*' === $values['value'][0]) { $refName = substr(rtrim($values['value']), 1); - if (!array_key_exists($refName, $this->refs)) { + if (!\array_key_exists($refName, $this->refs)) { + if (false !== $pos = array_search($refName, $this->refsBeingParsed, true)) { + throw new ParseException(sprintf('Circular reference [%s, %s] detected for reference "%s".', implode(', ', \array_slice($this->refsBeingParsed, $pos)), $refName, $refName), $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + throw new ParseException(sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); } @@ -340,6 +347,7 @@ private function doParse($value, $flags) } } elseif ('<<' !== $key && isset($values['value']) && self::preg_match('#^&(?P<ref>[^ ]++) *+(?P<value>.*)#u', $values['value'], $matches)) { $isRef = $matches['ref']; + $this->refsBeingParsed[] = $isRef; $values['value'] = $matches['value']; } @@ -395,6 +403,7 @@ private function doParse($value, $flags) } if ($isRef) { $this->refs[$isRef] = $data[$key]; + array_pop($this->refsBeingParsed); } } else { // multiple documents are not supported @@ -500,6 +509,7 @@ private function parseBlock($offset, $yaml, $flags) $parser->totalNumberOfLines = $this->totalNumberOfLines; $parser->skippedLineNumbers = $skippedLineNumbers; $parser->refs = &$this->refs; + $parser->refsBeingParsed = $this->refsBeingParsed; return $parser->doParse($yaml, $flags); } @@ -549,11 +559,6 @@ private function getCurrentLineIndentation() private function getNextEmbedBlock($indentation = null, $inSequence = false) { $oldLineIndentation = $this->getCurrentLineIndentation(); - $blockScalarIndentations = array(); - - if ($this->isBlockScalarHeader()) { - $blockScalarIndentations[] = $oldLineIndentation; - } if (!$this->moveToNextLine()) { return; @@ -591,7 +596,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false) $newIndent = $indentation; } - $data = array(); + $data = []; if ($this->getCurrentLineIndentation() >= $newIndent) { $data[] = substr($this->currentLine, $newIndent); } elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { @@ -612,30 +617,9 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false) $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem(); - if (empty($blockScalarIndentations) && $this->isBlockScalarHeader()) { - $blockScalarIndentations[] = $this->getCurrentLineIndentation(); - } - - $previousLineIndentation = $this->getCurrentLineIndentation(); - while ($this->moveToNextLine()) { $indent = $this->getCurrentLineIndentation(); - // terminate all block scalars that are more indented than the current line - if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && '' !== trim($this->currentLine)) { - foreach ($blockScalarIndentations as $key => $blockScalarIndentation) { - if ($blockScalarIndentation >= $indent) { - unset($blockScalarIndentations[$key]); - } - } - } - - if (empty($blockScalarIndentations) && !$this->isCurrentLineComment() && $this->isBlockScalarHeader()) { - $blockScalarIndentations[] = $indent; - } - - $previousLineIndentation = $indent; - if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) { $this->moveToPreviousLine(); break; @@ -714,7 +698,11 @@ private function parseValue($value, $flags, $context) $value = substr($value, 1); } - if (!array_key_exists($value, $this->refs)) { + if (!\array_key_exists($value, $this->refs)) { + if (false !== $pos = array_search($value, $this->refsBeingParsed, true)) { + throw new ParseException(sprintf('Circular reference [%s, %s] detected for reference "%s".', implode(', ', \array_slice($this->refsBeingParsed, $pos)), $value, $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); } @@ -747,7 +735,7 @@ private function parseValue($value, $flags, $context) return Inline::parse($value, $flags, $this->refs); } - $lines = array(); + $lines = []; while ($this->moveToNextLine()) { // unquoted strings end before the first unindented line @@ -812,7 +800,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) } $isCurrentLineBlank = $this->isCurrentLineBlank(); - $blockLines = array(); + $blockLines = []; // leading blank lines are consumed before determining indentation while ($notEOF && $isCurrentLineBlank) { @@ -984,7 +972,7 @@ private function isCurrentLineLastLineInDocument() */ private function cleanup($value) { - $value = str_replace(array("\r\n", "\r"), "\n", $value); + $value = str_replace(["\r\n", "\r"], "\n", $value); // strip YAML header $count = 0; @@ -1054,16 +1042,6 @@ private function isStringUnIndentedCollectionItem() return '-' === rtrim($this->currentLine) || 0 === strpos($this->currentLine, '- '); } - /** - * Tests whether or not the current line is the header of a block scalar. - * - * @return bool - */ - private function isBlockScalarHeader() - { - return (bool) self::preg_match('~'.self::BLOCK_SCALAR_HEADER_PATTERN.'$~', $this->currentLine); - } - /** * A local wrapper for `preg_match` which will throw a ParseException if there * is an internal error in the PCRE engine. diff --git a/vendor/symfony/yaml/Tests/Command/LintCommandTest.php b/vendor/symfony/yaml/Tests/Command/LintCommandTest.php index a5baf234ef3dfa05258814ad2d43daf6e42bfb26..2bf0286b6e38b09bfbe96ed4f03d0860be9f250f 100644 --- a/vendor/symfony/yaml/Tests/Command/LintCommandTest.php +++ b/vendor/symfony/yaml/Tests/Command/LintCommandTest.php @@ -31,7 +31,7 @@ public function testLintCorrectFile() $tester = $this->createCommandTester(); $filename = $this->createFile('foo: bar'); - $ret = $tester->execute(array('filename' => $filename), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false)); + $ret = $tester->execute(['filename' => $filename], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]); $this->assertEquals(0, $ret, 'Returns 0 in case of success'); $this->assertRegExp('/^\/\/ OK in /', trim($tester->getDisplay())); @@ -45,7 +45,7 @@ public function testLintIncorrectFile() $tester = $this->createCommandTester(); $filename = $this->createFile($incorrectContent); - $ret = $tester->execute(array('filename' => $filename), array('decorated' => false)); + $ret = $tester->execute(['filename' => $filename], ['decorated' => false]); $this->assertEquals(1, $ret, 'Returns 1 in case of error'); $this->assertContains('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay())); @@ -56,7 +56,7 @@ public function testConstantAsKey() $yaml = <<<YAML !php/const 'Symfony\Component\Yaml\Tests\Command\Foo::TEST': bar YAML; - $ret = $this->createCommandTester()->execute(array('filename' => $this->createFile($yaml)), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false)); + $ret = $this->createCommandTester()->execute(['filename' => $this->createFile($yaml)], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]); $this->assertSame(0, $ret, 'lint:yaml exits with code 0 in case of success'); } @@ -65,7 +65,7 @@ public function testCustomTags() $yaml = <<<YAML foo: !my_tag {foo: bar} YAML; - $ret = $this->createCommandTester()->execute(array('filename' => $this->createFile($yaml), '--parse-tags' => true), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false)); + $ret = $this->createCommandTester()->execute(['filename' => $this->createFile($yaml), '--parse-tags' => true], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]); $this->assertSame(0, $ret, 'lint:yaml exits with code 0 in case of success'); } @@ -74,7 +74,7 @@ public function testCustomTagsError() $yaml = <<<YAML foo: !my_tag {foo: bar} YAML; - $ret = $this->createCommandTester()->execute(array('filename' => $this->createFile($yaml)), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false)); + $ret = $this->createCommandTester()->execute(['filename' => $this->createFile($yaml)], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]); $this->assertSame(1, $ret, 'lint:yaml exits with code 1 in case of error'); } @@ -87,7 +87,7 @@ public function testLintFileNotReadable() $filename = $this->createFile(''); unlink($filename); - $ret = $tester->execute(array('filename' => $filename), array('decorated' => false)); + $ret = $tester->execute(['filename' => $filename], ['decorated' => false]); } /** @@ -117,7 +117,7 @@ protected function createCommandTester() protected function setUp() { - $this->files = array(); + $this->files = []; @mkdir(sys_get_temp_dir().'/framework-yml-lint-test'); } diff --git a/vendor/symfony/yaml/Tests/DumperTest.php b/vendor/symfony/yaml/Tests/DumperTest.php index d84a14089be7f9a0f3952a232ed3211973f96259..e7a763ab96922fa457cd97cd3fdc9fc374a83611 100644 --- a/vendor/symfony/yaml/Tests/DumperTest.php +++ b/vendor/symfony/yaml/Tests/DumperTest.php @@ -22,20 +22,20 @@ class DumperTest extends TestCase protected $dumper; protected $path; - protected $array = array( + protected $array = [ '' => 'bar', 'foo' => '#bar', - 'foo\'bar' => array(), - 'bar' => array(1, 'foo'), - 'foobar' => array( + 'foo\'bar' => [], + 'bar' => [1, 'foo'], + 'foobar' => [ 'foo' => 'bar', - 'bar' => array(1, 'foo'), - 'foobar' => array( + 'bar' => [1, 'foo'], + 'foobar' => [ 'foo' => 'bar', - 'bar' => array(1, 'foo'), - ), - ), - ); + 'bar' => [1, 'foo'], + ], + ], + ]; protected function setUp() { @@ -208,7 +208,7 @@ public function testInlineLevel() public function testObjectSupportEnabled() { - $dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_OBJECT); + $dump = $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_OBJECT); $this->assertEquals('{ foo: !php/object \'O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}\', bar: 1 }', $dump, '->dump() is able to dump objects'); } @@ -218,14 +218,14 @@ public function testObjectSupportEnabled() */ public function testObjectSupportEnabledPassingTrue() { - $dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, true); + $dump = $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, false, true); $this->assertEquals('{ foo: !php/object \'O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}\', bar: 1 }', $dump, '->dump() is able to dump objects'); } public function testObjectSupportDisabledButNoExceptions() { - $dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1)); + $dump = $this->dumper->dump(['foo' => new A(), 'bar' => 1]); $this->assertEquals('{ foo: null, bar: 1 }', $dump, '->dump() does not dump objects when disabled'); } @@ -235,7 +235,7 @@ public function testObjectSupportDisabledButNoExceptions() */ public function testObjectSupportDisabledWithExceptions() { - $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE); + $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE); } /** @@ -244,18 +244,18 @@ public function testObjectSupportDisabledWithExceptions() */ public function testObjectSupportDisabledWithExceptionsPassingTrue() { - $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, true); + $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, true); } public function testEmptyArray() { - $dump = $this->dumper->dump(array()); + $dump = $this->dumper->dump([]); $this->assertEquals('{ }', $dump); - $dump = $this->dumper->dump(array(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); + $dump = $this->dumper->dump([], 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); $this->assertEquals('[]', $dump); - $dump = $this->dumper->dump(array(), 9, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); + $dump = $this->dumper->dump([], 9, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE); $this->assertEquals('[]', $dump); $dump = $this->dumper->dump(new \ArrayObject(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE | Yaml::DUMP_OBJECT_AS_MAP); @@ -275,27 +275,27 @@ public function testEscapedEscapeSequencesInQuotedScalar($input, $expected) public function getEscapeSequences() { - return array( - 'empty string' => array('', "''"), - 'null' => array("\x0", '"\\0"'), - 'bell' => array("\x7", '"\\a"'), - 'backspace' => array("\x8", '"\\b"'), - 'horizontal-tab' => array("\t", '"\\t"'), - 'line-feed' => array("\n", '"\\n"'), - 'vertical-tab' => array("\v", '"\\v"'), - 'form-feed' => array("\xC", '"\\f"'), - 'carriage-return' => array("\r", '"\\r"'), - 'escape' => array("\x1B", '"\\e"'), - 'space' => array(' ', "' '"), - 'double-quote' => array('"', "'\"'"), - 'slash' => array('/', '/'), - 'backslash' => array('\\', '\\'), - 'next-line' => array("\xC2\x85", '"\\N"'), - 'non-breaking-space' => array("\xc2\xa0", '"\\_"'), - 'line-separator' => array("\xE2\x80\xA8", '"\\L"'), - 'paragraph-separator' => array("\xE2\x80\xA9", '"\\P"'), - 'colon' => array(':', "':'"), - ); + return [ + 'empty string' => ['', "''"], + 'null' => ["\x0", '"\\0"'], + 'bell' => ["\x7", '"\\a"'], + 'backspace' => ["\x8", '"\\b"'], + 'horizontal-tab' => ["\t", '"\\t"'], + 'line-feed' => ["\n", '"\\n"'], + 'vertical-tab' => ["\v", '"\\v"'], + 'form-feed' => ["\xC", '"\\f"'], + 'carriage-return' => ["\r", '"\\r"'], + 'escape' => ["\x1B", '"\\e"'], + 'space' => [' ', "' '"], + 'double-quote' => ['"', "'\"'"], + 'slash' => ['/', '/'], + 'backslash' => ['\\', '\\'], + 'next-line' => ["\xC2\x85", '"\\N"'], + 'non-breaking-space' => ["\xc2\xa0", '"\\_"'], + 'line-separator' => ["\xE2\x80\xA8", '"\\L"'], + 'paragraph-separator' => ["\xE2\x80\xA9", '"\\P"'], + 'colon' => [':', "':'"], + ]; } public function testBinaryDataIsDumpedBase64Encoded() @@ -303,7 +303,7 @@ public function testBinaryDataIsDumpedBase64Encoded() $binaryData = file_get_contents(__DIR__.'/Fixtures/arrow.gif'); $expected = '{ data: !!binary '.base64_encode($binaryData).' }'; - $this->assertSame($expected, $this->dumper->dump(array('data' => $binaryData))); + $this->assertSame($expected, $this->dumper->dump(['data' => $binaryData])); } public function testNonUtf8DataIsDumpedBase64Encoded() @@ -324,18 +324,18 @@ public function testDumpObjectAsMap($object, $expected) public function objectAsMapProvider() { - $tests = array(); + $tests = []; $bar = new \stdClass(); $bar->class = 'classBar'; - $bar->args = array('bar'); + $bar->args = ['bar']; $zar = new \stdClass(); $foo = new \stdClass(); $foo->bar = $bar; $foo->zar = $zar; $object = new \stdClass(); $object->foo = $foo; - $tests['stdClass'] = array($object, $object); + $tests['stdClass'] = [$object, $object]; $arrayObject = new \ArrayObject(); $arrayObject['foo'] = 'bar'; @@ -343,19 +343,19 @@ public function objectAsMapProvider() $parsedArrayObject = new \stdClass(); $parsedArrayObject->foo = 'bar'; $parsedArrayObject->baz = 'foobar'; - $tests['ArrayObject'] = array($arrayObject, $parsedArrayObject); + $tests['ArrayObject'] = [$arrayObject, $parsedArrayObject]; $a = new A(); - $tests['arbitrary-object'] = array($a, null); + $tests['arbitrary-object'] = [$a, null]; return $tests; } public function testDumpingArrayObjectInstancesRespectsInlineLevel() { - $deep = new \ArrayObject(array('deep1' => 'd', 'deep2' => 'e')); - $inner = new \ArrayObject(array('inner1' => 'b', 'inner2' => 'c', 'inner3' => $deep)); - $outer = new \ArrayObject(array('outer1' => 'a', 'outer2' => $inner)); + $deep = new \ArrayObject(['deep1' => 'd', 'deep2' => 'e']); + $inner = new \ArrayObject(['inner1' => 'b', 'inner2' => 'c', 'inner3' => $deep]); + $outer = new \ArrayObject(['outer1' => 'a', 'outer2' => $inner]); $yaml = $this->dumper->dump($outer, 2, 0, Yaml::DUMP_OBJECT_AS_MAP); @@ -372,9 +372,9 @@ public function testDumpingArrayObjectInstancesRespectsInlineLevel() public function testDumpingArrayObjectInstancesWithNumericKeysInlined() { - $deep = new \ArrayObject(array('d', 'e')); - $inner = new \ArrayObject(array('b', 'c', $deep)); - $outer = new \ArrayObject(array('a', $inner)); + $deep = new \ArrayObject(['d', 'e']); + $inner = new \ArrayObject(['b', 'c', $deep]); + $outer = new \ArrayObject(['a', $inner]); $yaml = $this->dumper->dump($outer, 0, 0, Yaml::DUMP_OBJECT_AS_MAP); $expected = <<<YAML @@ -385,9 +385,9 @@ public function testDumpingArrayObjectInstancesWithNumericKeysInlined() public function testDumpingArrayObjectInstancesWithNumericKeysRespectsInlineLevel() { - $deep = new \ArrayObject(array('d', 'e')); - $inner = new \ArrayObject(array('b', 'c', $deep)); - $outer = new \ArrayObject(array('a', $inner)); + $deep = new \ArrayObject(['d', 'e']); + $inner = new \ArrayObject(['b', 'c', $deep]); + $outer = new \ArrayObject(['a', $inner]); $yaml = $this->dumper->dump($outer, 2, 0, Yaml::DUMP_OBJECT_AS_MAP); $expected = <<<YAML 0: a @@ -440,34 +440,34 @@ public function testDumpingStdClassInstancesRespectsInlineLevel() public function testDumpMultiLineStringAsScalarBlock() { - $data = array( - 'data' => array( + $data = [ + 'data' => [ 'single_line' => 'foo bar baz', 'multi_line' => "foo\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz", 'multi_line_with_carriage_return' => "foo\nbar\r\nbaz", - 'nested_inlined_multi_line_string' => array( + 'nested_inlined_multi_line_string' => [ 'inlined_multi_line' => "foo\nbar\r\nempty line:\n\nbaz", - ), - ), - ); + ], + ], + ]; $this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); } public function testDumpMultiLineStringAsScalarBlockWhenFirstLineHasLeadingSpace() { - $data = array( - 'data' => array( + $data = [ + 'data' => [ 'multi_line' => " the first line has leading spaces\nThe second line does not.", - ), - ); + ], + ]; $this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); } public function testCarriageReturnIsMaintainedWhenDumpingAsMultiLineLiteralBlock() { - $this->assertSame("- \"a\\r\\nb\\nc\"\n", $this->dumper->dump(array("a\r\nb\nc"), 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); + $this->assertSame("- \"a\\r\\nb\\nc\"\n", $this->dumper->dump(["a\r\nb\nc"], 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); } /** diff --git a/vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml b/vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml index 5f9c94275b7d21afa263db2c857cf6e243e374ae..81b4129aa33e2ff9fc0076f4db2c40db150103b2 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml @@ -14,7 +14,7 @@ yaml: | - Oren - *showell php: | - array('Steve', 'Clark', 'Brian', 'Oren', 'Steve') + ['Steve', 'Clark', 'Brian', 'Oren', 'Steve'] --- test: Alias of a Mapping @@ -28,4 +28,4 @@ yaml: | - banana - *hello php: | - array(array('Meat'=>'pork', 'Starch'=>'potato'), 'banana', array('Meat'=>'pork', 'Starch'=>'potato')) + [['Meat'=>'pork', 'Starch'=>'potato'], 'banana', ['Meat'=>'pork', 'Starch'=>'potato']] diff --git a/vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml b/vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml index dfd93021d18cee7d51b8fc1f0c551e2712c1b63a..1a08d8ea9fddf2ee86fedf8b188207d3aa4e6e44 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml @@ -9,7 +9,7 @@ yaml: | - banana - carrot php: | - array('apple', 'banana', 'carrot') + ['apple', 'banana', 'carrot'] --- test: Sequence With Item Being Null In The Middle brief: | @@ -21,7 +21,7 @@ yaml: | - - carrot php: | - array('apple', null, 'carrot') + ['apple', null, 'carrot'] --- test: Sequence With Last Item Being Null brief: | @@ -33,7 +33,7 @@ yaml: | - banana - php: | - array('apple', 'banana', null) + ['apple', 'banana', null] --- test: Nested Sequences brief: | @@ -46,7 +46,7 @@ yaml: | - bar - baz php: | - array(array('foo', 'bar', 'baz')) + [['foo', 'bar', 'baz']] --- test: Mixed Sequences brief: | @@ -61,7 +61,7 @@ yaml: | - banana - carrot php: | - array('apple', array('foo', 'bar', 'x123'), 'banana', 'carrot') + ['apple', ['foo', 'bar', 'x123'], 'banana', 'carrot'] --- test: Deeply Nested Sequences brief: | @@ -74,7 +74,7 @@ yaml: | - uno - dos php: | - array(array(array('uno', 'dos'))) + [[['uno', 'dos']]] --- test: Simple Mapping brief: | @@ -87,7 +87,7 @@ yaml: | foo: whatever bar: stuff php: | - array('foo' => 'whatever', 'bar' => 'stuff') + ['foo' => 'whatever', 'bar' => 'stuff'] --- test: Sequence in a Mapping brief: | @@ -98,7 +98,7 @@ yaml: | - uno - dos php: | - array('foo' => 'whatever', 'bar' => array('uno', 'dos')) + ['foo' => 'whatever', 'bar' => ['uno', 'dos']] --- test: Nested Mappings brief: | @@ -110,14 +110,14 @@ yaml: | name: steve sport: baseball php: | - array( + [ 'foo' => 'whatever', - 'bar' => array( + 'bar' => [ 'fruit' => 'apple', 'name' => 'steve', 'sport' => 'baseball' - ) - ) + ] + ] --- test: Mixed Mapping brief: | @@ -136,22 +136,22 @@ yaml: | perl: papers ruby: scissorses php: | - array( + [ 'foo' => 'whatever', - 'bar' => array( - array( + 'bar' => [ + [ 'fruit' => 'apple', 'name' => 'steve', 'sport' => 'baseball' - ), + ], 'more', - array( + [ 'python' => 'rocks', 'perl' => 'papers', 'ruby' => 'scissorses' - ) - ) - ) + ] + ] + ] --- test: Mapping-in-Sequence Shortcut todo: true @@ -163,7 +163,7 @@ yaml: | - work on YAML.py: - work on Store php: | - array(array('work on YAML.py' => array('work on Store'))) + [['work on YAML.py' => ['work on Store']]] --- test: Sequence-in-Mapping Shortcut todo: true @@ -177,7 +177,7 @@ yaml: | - '%.sourceforge.net' - '%.freepan.org' php: | - array('allow' => array('localhost', '%.sourceforge.net', '%.freepan.org')) + ['allow' => ['localhost', '%.sourceforge.net', '%.freepan.org']] --- todo: true test: Merge key @@ -192,11 +192,11 @@ yaml: | <<: age: 38 php: | - array( + [ 'mapping' => - array( + [ 'name' => 'Joe', 'job' => 'Accountant', 'age' => 38 - ) - ) + ] + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml b/vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml index f7ca469b40793389ef841852b3889e25ade296b1..1f3a2e544fa9ba6acc5d1c261120b6ef0d74511b 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml @@ -5,7 +5,7 @@ brief: | yaml: | foo: bar php: | - array('foo' => 'bar') + ['foo' => 'bar'] --- test: Multi Element Mapping brief: | @@ -15,11 +15,11 @@ yaml: | white: walls blue: berries php: | - array( + [ 'red' => 'baron', 'white' => 'walls', 'blue' => 'berries', - ) + ] --- test: Values aligned brief: | @@ -30,11 +30,11 @@ yaml: | white: walls blue: berries php: | - array( + [ 'red' => 'baron', 'white' => 'walls', 'blue' => 'berries', - ) + ] --- test: Colons aligned brief: | @@ -44,8 +44,8 @@ yaml: | white : walls blue : berries php: | - array( + [ 'red' => 'baron', 'white' => 'walls', 'blue' => 'berries', - ) + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml b/vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml index d98810256ec213734803275c99ca56d881f32f78..67cb47adb5b6d9f4d2aef4eb199ffdffbe98a32a 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml @@ -49,7 +49,7 @@ yaml: | foo: 1 bar: 2 php: | - array('foo' => 1, 'bar' => 2) + ['foo' => 1, 'bar' => 2] documents: 1 --- @@ -63,7 +63,7 @@ yaml: | foo: | --- php: | - array('foo' => "---\n") + ['foo' => "---\n"] --- test: Multiple Document Separators in Block @@ -79,7 +79,7 @@ yaml: | bar: | fooness php: | - array( + [ 'foo' => "---\nfoo: bar\n---\nyo: baz\n", 'bar' => "fooness\n" - ) + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml b/vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml index e8506fcb66bb31afdced90f8a1277c8828cfab9a..e8697f93157b9630bf02e1cc54821cf82486c7a8 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml @@ -22,4 +22,4 @@ yaml: | firstline: 1 secondline: 2 php: | - array('foo' => null, 'firstline' => 1, 'secondline' => 2) + ['foo' => null, 'firstline' => 1, 'secondline' => 2] diff --git a/vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml b/vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml index 03090e4abc40e0fb6e43d66cd6a1b90dabd8e0db..cc562cd9d164989581cb182ca92b220e3cd15a32 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml @@ -8,7 +8,7 @@ brief: > yaml: | seq: [ a, b, c ] php: | - array('seq' => array('a', 'b', 'c')) + ['seq' => ['a', 'b', 'c']] --- test: Simple Inline Hash brief: > @@ -21,7 +21,7 @@ brief: > yaml: | hash: { name: Steve, foo: bar } php: | - array('hash' => array('name' => 'Steve', 'foo' => 'bar')) + ['hash' => ['name' => 'Steve', 'foo' => 'bar']] --- test: Multi-line Inline Collections todo: true @@ -38,15 +38,15 @@ yaml: | Python: python.org, Perl: use.perl.org } php: | - array( - 'languages' => array('Ruby', 'Perl', 'Python'), - 'websites' => array( + [ + 'languages' => ['Ruby', 'Perl', 'Python'], + 'websites' => [ 'YAML' => 'yaml.org', 'Ruby' => 'ruby-lang.org', 'Python' => 'python.org', 'Perl' => 'use.perl.org' - ) - ) + ] + ] --- test: Commas in Values (not in the spec!) todo: true @@ -57,4 +57,4 @@ brief: > yaml: | attendances: [ 45,123, 70,000, 17,222 ] php: | - array('attendances' => array(45123, 70000, 17222)) + ['attendances' => [45123, 70000, 17222]] diff --git a/vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml b/vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml index a14735a55a507dd9068dad58c29338cb1eddc1b8..2895202a2aca3ecc21993a0ef013dd0dbdde601c 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml @@ -12,7 +12,7 @@ yaml: | Foo Bar php: | - array('this' => "Foo\nBar\n") + ['this' => "Foo\nBar\n"] --- test: The '+' indicator brief: > @@ -28,11 +28,11 @@ yaml: | dummy: value php: | - array( + [ 'normal' => "extra new lines not kept\n", 'preserving' => "extra new lines are kept\n\n\n", 'dummy' => 'value' - ) + ] --- test: Three trailing newlines in literals brief: > @@ -64,14 +64,14 @@ yaml: | same as "kept" above: "This has four newlines.\n\n\n\n" php: | - array( + [ 'clipped' => "This has one newline.\n", 'same as "clipped" above' => "This has one newline.\n", 'stripped' => 'This has no newline.', 'same as "stripped" above' => 'This has no newline.', 'kept' => "This has four newlines.\n\n\n\n", 'same as "kept" above' => "This has four newlines.\n\n\n\n" - ) + ] --- test: Extra trailing newlines with spaces todo: true @@ -95,8 +95,8 @@ yaml: | php: | - array('this' => "Foo\n\n \n", - 'kept' => "Foo\n\n \n" ) + ['this' => "Foo\n\n \n", + 'kept' => "Foo\n\n \n"] --- test: Folded Block in a Sequence @@ -115,12 +115,12 @@ yaml: | hmm - dog php: | - array( + [ 'apple', 'banana', "can't you see the beauty of yaml? hmm\n", 'dog' - ) + ] --- test: Folded Block as a Mapping Value brief: > @@ -135,10 +135,10 @@ yaml: | by a knee injury. source: espn php: | - array( + [ 'quote' => "Mark McGwire's year was crippled by a knee injury.\n", 'source' => 'espn' - ) + ] --- test: Three trailing newlines in folded blocks brief: > @@ -166,11 +166,11 @@ yaml: | same as "kept" above: "This has four newlines.\n\n\n\n" php: | - array( + [ 'clipped' => "This has one newline.\n", 'same as "clipped" above' => "This has one newline.\n", 'stripped' => 'This has no newline.', 'same as "stripped" above' => 'This has no newline.', 'kept' => "This has four newlines.\n\n\n\n", 'same as "kept" above' => "This has four newlines.\n\n\n\n" - ) + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml b/vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml index 9a5300f2eff6aa56bd0fd914ad86ecd709207a74..ea8e36ed089ef4dc33b88baf3ea6b2b73358acb1 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml @@ -6,7 +6,7 @@ brief: > yaml: | empty: [] php: | - array('empty' => array()) + ['empty' => []] --- test: Empty Mapping brief: > @@ -15,19 +15,19 @@ brief: > yaml: | empty: {} php: | - array('empty' => array()) + ['empty' => []] --- test: Empty Sequence as Entire Document yaml: | [] php: | - array() + [] --- test: Empty Mapping as Entire Document yaml: | {} php: | - array() + [] --- test: Null as Document yaml: | diff --git a/vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml b/vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml index 3f93c982bff2f1f5a804bfe7ed0ff80598978146..4ecd828f0107ac1823e9788dd579c15ebd043118 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml @@ -6,7 +6,7 @@ yaml: | - Sammy Sosa - Ken Griffey php: | - array('Mark McGwire', 'Sammy Sosa', 'Ken Griffey') + ['Mark McGwire', 'Sammy Sosa', 'Ken Griffey'] --- test: Mapping of scalars to scalars spec: 2.2 @@ -15,7 +15,7 @@ yaml: | avg: 0.278 rbi: 147 php: | - array('hr' => 65, 'avg' => 0.278, 'rbi' => 147) + ['hr' => 65, 'avg' => 0.278, 'rbi' => 147] --- test: Mapping of scalars to sequences spec: 2.3 @@ -29,13 +29,13 @@ yaml: | - Chicago Cubs - Atlanta Braves php: | - array('american' => - array( 'Boston Red Sox', 'Detroit Tigers', - 'New York Yankees' ), + ['american' => + ['Boston Red Sox', 'Detroit Tigers', + 'New York Yankees'], 'national' => - array( 'New York Mets', 'Chicago Cubs', - 'Atlanta Braves' ) - ) + ['New York Mets', 'Chicago Cubs', + 'Atlanta Braves'] + ] --- test: Sequence of mappings spec: 2.4 @@ -49,10 +49,10 @@ yaml: | hr: 63 avg: 0.288 php: | - array( - array('name' => 'Mark McGwire', 'hr' => 65, 'avg' => 0.278), - array('name' => 'Sammy Sosa', 'hr' => 63, 'avg' => 0.288) - ) + [ + ['name' => 'Mark McGwire', 'hr' => 65, 'avg' => 0.278], + ['name' => 'Sammy Sosa', 'hr' => 63, 'avg' => 0.288] + ] --- test: Legacy A5 todo: true @@ -134,11 +134,11 @@ yaml: | - [ Mark McGwire , 65 , 0.278 ] - [ Sammy Sosa , 63 , 0.288 ] php: | - array( - array( 'name', 'hr', 'avg' ), - array( 'Mark McGwire', 65, 0.278 ), - array( 'Sammy Sosa', 63, 0.288 ) - ) + [ + [ 'name', 'hr', 'avg' ], + [ 'Mark McGwire', 65, 0.278 ], + [ 'Sammy Sosa', 63, 0.288 ] + ] --- test: Mapping of mappings todo: true @@ -150,12 +150,12 @@ yaml: | avg: 0.288 } php: | - array( + [ 'Mark McGwire' => - array( 'hr' => 65, 'avg' => 0.278 ), + [ 'hr' => 65, 'avg' => 0.278 ], 'Sammy Sosa' => - array( 'hr' => 63, 'avg' => 0.288 ) - ) + [ 'hr' => 63, 'avg' => 0.288 ] + ] --- test: Two documents in a stream each with a leading comment todo: true @@ -208,10 +208,10 @@ yaml: | - Sammy Sosa - Ken Griffey php: | - array( - 'hr' => array( 'Mark McGwire', 'Sammy Sosa' ), - 'rbi' => array( 'Sammy Sosa', 'Ken Griffey' ) - ) + [ + 'hr' => [ 'Mark McGwire', 'Sammy Sosa' ], + 'rbi' => [ 'Sammy Sosa', 'Ken Griffey' ] + ] --- test: Node for Sammy Sosa appears twice in this document spec: 2.10 @@ -225,12 +225,12 @@ yaml: | - *SS # Subsequent occurrence - Ken Griffey php: | - array( + [ 'hr' => - array('Mark McGwire', 'Sammy Sosa'), + ['Mark McGwire', 'Sammy Sosa'], 'rbi' => - array('Sammy Sosa', 'Ken Griffey') - ) + ['Sammy Sosa', 'Ken Griffey'] + ] --- test: Mapping between sequences todo: true @@ -297,20 +297,20 @@ yaml: | - item : Big Shoes quantity: 1 php: | - array ( - array ( + [ + [ 'item' => 'Super Hoop', 'quantity' => 1, - ), - array ( + ], + [ 'item' => 'Basketball', 'quantity' => 4, - ), - array ( + ], + [ 'item' => 'Big Shoes', 'quantity' => 1, - ) - ) + ] + ] perl: | [ { item => 'Super Hoop', quantity => 1 }, @@ -462,11 +462,11 @@ yaml: | 65 Home Runs 0.278 Batting Average php: | - array( + [ 'name' => 'Mark McGwire', 'accomplishment' => "Mark set a major league home run record in 1998.\n", 'stats' => "65 Home Runs\n0.278 Batting Average\n" - ) + ] --- test: Quoted scalars todo: true @@ -512,11 +512,11 @@ yaml: | octal: 014 hexadecimal: 0xC php: | - array( + [ 'canonical' => 12345, 'octal' => 014, 'hexadecimal' => 0xC - ) + ] --- test: Decimal Integer deprecated: true @@ -524,9 +524,9 @@ spec: 2.19 yaml: | decimal: +12,345 php: | - array( + [ 'decimal' => 12345.0, - ) + ] --- # FIX: spec shows parens around -inf and NaN test: Floating point @@ -538,13 +538,13 @@ yaml: | not a number: .NaN float as whole number: !!float 1 php: | - array( + [ 'canonical' => 1230.15, 'exponential' => 1230.15, 'negative infinity' => log(0), 'not a number' => -log(0), 'float as whole number' => (float) 1 - ) + ] --- test: Fixed Floating point deprecated: true @@ -552,9 +552,9 @@ spec: 2.20 yaml: | fixed: 1,230.15 php: | - array( + [ 'fixed' => 1230.15, - ) + ] --- test: Timestamps todo: true @@ -565,12 +565,12 @@ yaml: | spaced: 2001-12-14 21:59:43.10 -05:00 date: 2002-12-14 # Time is noon UTC php: | - array( + [ 'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ), 'iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ), 'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ), 'date' => Date.new( 2002, 12, 14 ) - ) + ] --- test: legacy Timestamps test todo: true @@ -581,12 +581,12 @@ yaml: | spaced: 2001-12-14 21:59:43.00 -05:00 date: 2002-12-14 php: | - array( + [ 'canonical' => Time::utc( 2001, 12, 15, 2, 59, 43, 0 ), 'iso8601' => YAML::mktime( 2001, 2, 28, 21, 59, 43, 0, "-05:00" ), 'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0, "-05:00" ), 'date' => Date.new( 2002, 12, 14 ) - ) + ] --- test: Various explicit families todo: true @@ -754,20 +754,20 @@ yaml: | Backup contact is Nancy Billsmer @ 338-4338. php: | - array( + [ 'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001), 'bill-to' => - array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) ) + [ 'given' => 'Chris', 'family' => 'Dumars', 'address' => [ 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ] ] , 'ship-to' => - array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) ) + [ 'given' => 'Chris', 'family' => 'Dumars', 'address' => [ 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ] ] , 'product' => - array( - array( 'sku' => 'BL394D', 'quantity' => 4, 'description' => 'Basketball', 'price' => 450.00 ), - array( 'sku' => 'BL4438H', 'quantity' => 1, 'description' => 'Super Hoop', 'price' => 2392.00 ) - ), + [ + [ 'sku' => 'BL394D', 'quantity' => 4, 'description' => 'Basketball', 'price' => 450.00 ], + [ 'sku' => 'BL4438H', 'quantity' => 1, 'description' => 'Super Hoop', 'price' => 2392.00 ] + ], 'tax' => 251.42, 'total' => 4443.52, 'comments' => "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.\n" - ) + ] --- test: Log file todo: true @@ -826,9 +826,9 @@ yaml: | # These are three throwaway comment # lines (the first line is empty). php: | - array( + [ 'this' => "contains three lines of text.\nThe third one starts with a\n# character. This isn't a comment.\n" - ) + ] --- test: Document with a single value todo: true @@ -878,11 +878,11 @@ yaml: | date : 2001-01-23 total : 4443.52 php: | - array( + [ 'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001), 'total' => 4443.52 - ) + ] --- test: Single-line documents todo: true @@ -934,7 +934,7 @@ yaml: | also int: ! "12" string: !!str 12 php: | - array( 'integer' => 12, 'also int' => 12, 'string' => '12' ) + [ 'integer' => 12, 'also int' => 12, 'string' => '12' ] --- test: Private types todo: true @@ -966,7 +966,7 @@ yaml: | # The URI is 'tag:yaml.org,2002:str' - !!str a Unicode string php: | - array( 'a Unicode string' ) + [ 'a Unicode string' ] --- test: Type family under perl.yaml.org todo: true @@ -1039,9 +1039,9 @@ yaml: | repeated use of this value. alias : *A001 php: | - array( 'anchor' => 'This scalar has an anchor.', + [ 'anchor' => 'This scalar has an anchor.', 'override' => "The alias node below is a repeated use of this value.\n", - 'alias' => "The alias node below is a repeated use of this value.\n" ) + 'alias' => "The alias node below is a repeated use of this value.\n"] --- test: Flow and block formatting todo: true @@ -1152,12 +1152,12 @@ yaml: | redundant: |2 This value is indented 2 spaces. php: | - array( + [ 'leading spaces' => " This value starts with four spaces.\n", 'leading line break' => "\nThis value starts with a line break.\n", 'leading comment indicator' => "# first line starts with a\n# character.\n", 'redundant' => "This value is indented 2 spaces.\n" - ) + ] --- test: Chomping and keep modifiers yaml: | @@ -1176,14 +1176,14 @@ yaml: | same as "kept" above: "This has two newlines.\n\n" php: | - array( + [ 'clipped' => "This has one newline.\n", 'same as "clipped" above' => "This has one newline.\n", 'stripped' => 'This has no newline.', 'same as "stripped" above' => 'This has no newline.', 'kept' => "This has two newlines.\n\n", 'same as "kept" above' => "This has two newlines.\n\n" - ) + ] --- test: Literal combinations todo: true @@ -1221,7 +1221,7 @@ yaml: | both are equal to: " This has no newline." php: | - array( + [ 'empty' => '', 'literal' => "The \\ ' \" characters may be\nfreely used. Leading white\n space " + "is significant.\n\nLine breaks are significant.\nThus this value contains one\n" + @@ -1232,7 +1232,7 @@ php: | 'indented and chomped' => ' This has no newline.', 'also written as' => ' This has no newline.', 'both are equal to' => ' This has no newline.' - ) + [ --- test: Folded combinations todo: true @@ -1288,7 +1288,7 @@ yaml: | # Explicit comments may follow # but must be less indented. php: | - array( + [ 'empty' => '', 'one paragraph' => 'Line feeds are converted to spaces, so this value'. " contains no line breaks except for the final one.\n", @@ -1300,7 +1300,7 @@ php: | 'above is equal to' => "This is a folded paragraph followed by a list:\n". " * first entry\n * second entry\nFollowed by another folded paragraph, ". "another list:\n\n * first entry\n\n * second entry\n\nAnd a final folded paragraph.\n" - ) + ] --- test: Single quotes todo: true @@ -1315,13 +1315,13 @@ yaml: | line break' is same as: "this contains six spaces\nand one line break" php: | - array( + [ 'empty' => '', 'second' => '! : \\ etc. can be used freely.', 'third' => "a single quote ' must be escaped.", 'span' => "this contains six spaces\nand one line break", 'is same as' => "this contains six spaces\nand one line break" - ) + ] --- test: Double quotes todo: true @@ -1335,14 +1335,14 @@ yaml: | spaces" is equal to: "this contains four spaces" php: | - array( + [ 'empty' => '', 'second' => '! : etc. can be used freely.', 'third' => 'a " or a \\ must be escaped.', 'fourth' => "this value ends with an LF.\n", 'span' => "this contains four spaces", 'is equal to' => "this contains four spaces" - ) + ] --- test: Unquoted strings todo: true @@ -1371,7 +1371,7 @@ yaml: | note: { one-line keys: but multi-line values } php: | - array( + [ 'first' => 'There is no unquoted empty string.', 'second' => 12, 'third' => '12', @@ -1379,7 +1379,7 @@ php: | 'indicators' => "this has no comments. #:foo and bar# are both text.", 'flow' => [ 'can span lines', 'like this' ], 'note' => { 'one-line keys' => 'but multi-line values' } - ) + ] --- test: Spanning sequences todo: true @@ -1393,11 +1393,11 @@ yaml: | - one - two php: | - array( + [ 'flow' => [ 'one', 'two' ], 'spanning' => [ 'one', 'two' ], 'block' => [ 'one', 'two' ] - ) + ] --- test: Flow mappings yaml: | @@ -1408,10 +1408,10 @@ yaml: | one: 1 two: 2 php: | - array( - 'flow' => array( 'one' => 1, 'two' => 2 ), - 'block' => array( 'one' => 1, 'two' => 2 ) - ) + [ + 'flow' => [ 'one' => 1, 'two' => 2 ], + 'block' => [ 'one' => 1, 'two' => 2 ] + ] --- test: Representations of 12 todo: true @@ -1433,7 +1433,7 @@ yaml: | - foo/bar - /a.*b/ php: | - array( 12, '12', '12', '12', '12', '/foo/bar', 'd:/foo/bar', 'foo/bar', '/a.*b/' ) + [ 12, '12', '12', '12', '12', '/foo/bar', 'd:/foo/bar', 'foo/bar', '/a.*b/' ] --- test: "Null" todo: true @@ -1455,12 +1455,12 @@ yaml: | only two with values. php: | - array ( + [ 'canonical' => null, 'english' => null, - 'sparse' => array( null, '2nd entry', null, '4th entry', null ]), + 'sparse' => [ null, '2nd entry', null, '4th entry', null ]], 'four' => 'This mapping has five keys, only two with values.' - ) + ] --- test: Omap todo: true @@ -1525,29 +1525,29 @@ yaml: | octal: 014 hexadecimal: 0xC php: | - array( + [ 'canonical' => 12345, 'octal' => 12, 'hexadecimal' => 12 - ) + ] --- test: Decimal deprecated: true yaml: | decimal: +12,345 php: | - array( + [ 'decimal' => 12345.0, - ) + ] --- test: Fixed Float deprecated: true yaml: | fixed: 1,230.15 php: | - array( + [ 'fixed' => 1230.15, - ) + ] --- test: Float yaml: | @@ -1556,12 +1556,12 @@ yaml: | negative infinity: -.inf not a number: .NaN php: | - array( + [ 'canonical' => 1230.15, 'exponential' => 1230.15, 'negative infinity' => log(0), 'not a number' => -log(0) - ) + ] --- test: Timestamp todo: true @@ -1571,12 +1571,12 @@ yaml: | space separated: 2001-12-14 21:59:43.10 -05:00 date (noon UTC): 2002-12-14 ruby: | - array( + [ 'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ), 'valid iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ), 'space separated' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ), 'date (noon UTC)' => Date.new( 2002, 12, 14 ) - ) + ] --- test: Binary todo: true diff --git a/vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml b/vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml index dea0be010b58c353d3296fdfd72d2fa43a51d8a8..e96b553623f2c8285cbbf917c1f08e56dcb04c77 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml @@ -25,14 +25,14 @@ yaml: | - No, I mean, "And what about Yaml?" - Oh, oh yeah. Uh.. Yaml for Ruby. php: | - array( + [ "What's Yaml?", "It's for writing data structures in plain text.", "And?", "And what? That's not good enough for you?", "No, I mean, \"And what about Yaml?\"", "Oh, oh yeah. Uh.. Yaml for Ruby." - ) + ] --- test: Indicators in Strings brief: > @@ -43,11 +43,11 @@ yaml: | same for the pound sign: here we have it#in a string the comma can, honestly, be used in most cases: [ but not in, inline collections ] php: | - array( + [ 'the colon followed by space is an indicator' => 'but is a string:right here', 'same for the pound sign' => 'here we have it#in a string', - 'the comma can, honestly, be used in most cases' => array('but not in', 'inline collections') - ) + 'the comma can, honestly, be used in most cases' => ['but not in', 'inline collections'] + ] --- test: Forcing Strings brief: > @@ -57,10 +57,10 @@ yaml: | date string: !!str 2001-08-01 number string: !!str 192 php: | - array( + [ 'date string' => '2001-08-01', 'number string' => '192' - ) + ] --- test: Single-quoted Strings brief: > @@ -75,12 +75,12 @@ yaml: | why do i hate them?: 'it''s very hard to explain' entities: '£ me' php: | - array( + [ 'all my favorite symbols' => '#:!/%.)', 'a few i hate' => '&(*', 'why do i hate them?' => 'it\'s very hard to explain', 'entities' => '£ me' - ) + ] --- test: Double-quoted Strings brief: > @@ -90,9 +90,9 @@ brief: > yaml: | i know where i want my line breaks: "one here\nand another here\n" php: | - array( + [ 'i know where i want my line breaks' => "one here\nand another here\n" - ) + ] --- test: Multi-line Quoted Strings todo: true @@ -106,10 +106,10 @@ yaml: | let it go on and on to other lines until i end it with a quote." php: | - array('i want a long string' => "so i'm going to ". + ['i want a long string' => "so i'm going to ". "let it go on and on to other lines ". "until i end it with a quote." - ) + ] --- test: Plain scalars @@ -128,7 +128,7 @@ yaml: | - This would impair my skiing ability somewhat for the duration, as can be imagined. php: | - array( + [ "My little toe is broken in two places;", "I'm crazy to have skied this way;", "I'm not the craziest he's seen, since there was always ". @@ -139,7 +139,7 @@ php: | "He's going to put my foot in plaster for a month;", "This would impair my skiing ability somewhat for the duration, ". "as can be imagined." - ) + ] --- test: 'Null' brief: > @@ -149,11 +149,11 @@ yaml: | hosted by: Bob and David date of next season: ~ php: | - array( + [ 'name' => 'Mr. Show', 'hosted by' => 'Bob and David', 'date of next season' => null - ) + ] --- test: Boolean brief: > @@ -162,10 +162,10 @@ yaml: | Is Gus a Liar?: true Do I rely on Gus for Sustenance?: false php: | - array( + [ 'Is Gus a Liar?' => true, 'Do I rely on Gus for Sustenance?' => false - ) + ] --- test: Integers dump_skip: true @@ -177,10 +177,10 @@ yaml: | zero: 0 simple: 12 php: | - array( + [ 'zero' => 0, 'simple' => 12, - ) + ] --- test: Positive Big Integer deprecated: true @@ -192,9 +192,9 @@ brief: > yaml: | one-thousand: 1,000 php: | - array( + [ 'one-thousand' => 1000.0, - ) + ] --- test: Negative Big Integer deprecated: true @@ -206,9 +206,9 @@ brief: > yaml: | negative one-thousand: -1,000 php: | - array( + [ 'negative one-thousand' => -1000.0 - ) + ] --- test: Floats dump_skip: true @@ -220,10 +220,10 @@ yaml: | a simple float: 2.00 scientific notation: 1.00009e+3 php: | - array( + [ 'a simple float' => 2.0, 'scientific notation' => 1000.09 - ) + ] --- test: Larger Float dump_skip: true @@ -235,9 +235,9 @@ brief: > yaml: | larger float: 1,000.09 php: | - array( + [ 'larger float' => 1000.09, - ) + ] --- test: Time todo: true @@ -250,10 +250,10 @@ yaml: | iso8601: 2001-12-14t21:59:43.10-05:00 space separated: 2001-12-14 21:59:43.10 -05:00 php: | - array( + [ 'iso8601' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ), 'space separated' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ) - ) + ] --- test: Date todo: true diff --git a/vendor/symfony/yaml/Tests/Fixtures/booleanMappingKeys.yml b/vendor/symfony/yaml/Tests/Fixtures/booleanMappingKeys.yml index 26799e8e7bff2c89f3595dc7a2ec9319dcde3514..88287f1b9f6a74155ccb485225b0f4a0a059c1d9 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/booleanMappingKeys.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/booleanMappingKeys.yml @@ -5,7 +5,7 @@ yaml: | true: true false: false php: | - array( + [ 'true' => true, 'false' => false, - ) + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml b/vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml index cc0356d36aecbacd3c5f889c22c985ae5ad14a75..87d352db118da3ef8764115dea215239488b388d 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml @@ -142,14 +142,14 @@ test: Double quotes with a line feed yaml: | { double: "some value\n \"some quoted string\" and 'some single quotes one'" } php: | - array( + [ 'double' => "some value\n \"some quoted string\" and 'some single quotes one'" - ) + ] --- test: Backslashes yaml: | { single: 'foo\Var', no-quotes: foo\Var, double: "foo\\Var" } php: | - array( + [ 'single' => 'foo\Var', 'no-quotes' => 'foo\Var', 'double' => 'foo\Var' - ) + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/legacyBooleanMappingKeys.yml b/vendor/symfony/yaml/Tests/Fixtures/legacyBooleanMappingKeys.yml index 5e8d091707d513508cbe08bdebaf378203c1c6d8..db950165e364fbe793e3694e39564785c140c8af 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/legacyBooleanMappingKeys.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/legacyBooleanMappingKeys.yml @@ -5,10 +5,10 @@ yaml: | true: true false: false php: | - array( + [ 1 => true, 0 => false, - ) + ] --- test: Boolean yaml: | @@ -16,8 +16,8 @@ yaml: | logical: true answer: false php: | - array( + [ false => 'used as key', 'logical' => true, 'answer' => false - ) + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/legacyNullMappingKey.yml b/vendor/symfony/yaml/Tests/Fixtures/legacyNullMappingKey.yml index 551a6205e137d5e4be670c424b0715a7fd68fcb3..14f93c2d1b6cebc1d58515e98be7f0960bdd4616 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/legacyNullMappingKey.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/legacyNullMappingKey.yml @@ -4,6 +4,6 @@ spec: 2.21 yaml: | null: ~ php: | - array( + [ '' => null, - ) + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/nullMappingKey.yml b/vendor/symfony/yaml/Tests/Fixtures/nullMappingKey.yml index 7dcadc729968c0a464373eeeebc858f190558518..cd90f7b4cbf6b55c97b0e4ce868ba07b91df42f4 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/nullMappingKey.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/nullMappingKey.yml @@ -4,6 +4,6 @@ spec: 2.21 yaml: | null: ~ php: | - array( + [ 'null' => null, - ) + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/numericMappingKeys.yml b/vendor/symfony/yaml/Tests/Fixtures/numericMappingKeys.yml index 9cfb7713a5c2ed98ad2bb77eff3a2b478c0b2fc9..246447e4d44afbee407e0f54f952ab5ebc58bf67 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/numericMappingKeys.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/numericMappingKeys.yml @@ -6,7 +6,7 @@ yaml: | 1: foo 0: bar php: | - array(1 => 'foo', 0 => 'bar') + [1 => 'foo', 0 => 'bar'] --- test: Integers as Map Keys brief: > @@ -16,8 +16,8 @@ yaml: | 2: two 3: three php: | - array( + [ 1 => 'one', 2 => 'two', 3 => 'three' - ) + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/sfComments.yml b/vendor/symfony/yaml/Tests/Fixtures/sfComments.yml index b72a9b6996565eaba0a725b596e64d526c542986..af3ab38597a956029dffda5d4babab3531dbc765 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/sfComments.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/sfComments.yml @@ -11,7 +11,7 @@ yaml: | ex6: foo#foo # comment here ex7: foo # ignore me # and me php: | - array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo', 'ex5' => 'foo', 'ex6' => 'foo#foo', 'ex7' => 'foo') + ['ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo', 'ex5' => 'foo', 'ex6' => 'foo#foo', 'ex7' => 'foo'] --- test: Comments in the middle brief: > @@ -24,7 +24,7 @@ yaml: | # some comment # some comment php: | - array('foo' => array('bar' => 'foo')) + ['foo' => ['bar' => 'foo']] --- test: Comments on a hash line brief: > @@ -33,7 +33,7 @@ yaml: | foo: # a comment foo: bar # a comment php: | - array('foo' => array('foo' => 'bar')) + ['foo' => ['foo' => 'bar']] --- test: 'Value starting with a #' brief: > @@ -41,7 +41,7 @@ brief: > yaml: | foo: '#bar' php: | - array('foo' => '#bar') + ['foo' => '#bar'] --- test: Document starting with a comment and a separator brief: > @@ -51,7 +51,7 @@ yaml: | --- foo: bar # a comment php: | - array('foo' => 'bar') + ['foo' => 'bar'] --- test: Comment containing a colon on a hash line brief: > @@ -65,7 +65,7 @@ brief: > 'Hash key containing a #' yaml: 'foo#bar: baz' php: | - array('foo#bar' => 'baz') + ['foo#bar' => 'baz'] --- test: 'Hash key ending with a space and a #' brief: > @@ -73,4 +73,4 @@ brief: > yaml: | 'foo #': baz php: | - array('foo #' => 'baz') + ['foo #' => 'baz'] diff --git a/vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml b/vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml index 1339d23a6305c8471b52556bb120cf4d35f58c93..8cadae2c1a0a15dae95186ecb9498f9aec5a313b 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml @@ -13,22 +13,22 @@ yaml: | nick: Biggies quantity: 1 php: | - array ( - array ( + [ + [ 'item' => 'Super Hoop', - ), - array ( + ], + [ 'item' => 'Basketball', 'quantity' => 1, - ), - array ( - 'item' => array( + ], + [ + 'item' => [ 'name' => 'Big Shoes', 'nick' => 'Biggies' - ), + ], 'quantity' => 1 - ) - ) + ] + ] --- test: Compact notation combined with inline notation brief: | @@ -39,18 +39,18 @@ yaml: | - { item: Super Hoop, quantity: 1 } - [ Basketball, Big Shoes ] php: | - array ( - 'items' => array ( - array ( + [ + 'items' => [ + [ 'item' => 'Super Hoop', 'quantity' => 1, - ), - array ( + ], + [ 'Basketball', 'Big Shoes' - ) - ) - ) + ] + ] + ] --- %YAML:1.0 test: Compact notation brief: | @@ -66,22 +66,22 @@ yaml: | nick: Biggies quantity: 1 php: | - array ( - array ( + [ + [ 'item' => 'Super Hoop', - ), - array ( + ], + [ 'item' => 'Basketball', 'quantity' => 1, - ), - array ( - 'item' => array( + ], + [ + 'item' => [ 'name' => 'Big Shoes', 'nick' => 'Biggies' - ), + ], 'quantity' => 1 - ) - ) + ] + ] --- test: Compact notation combined with inline notation brief: | @@ -92,18 +92,18 @@ yaml: | - { item: Super Hoop, quantity: 1 } - [ Basketball, Big Shoes ] php: | - array ( - 'items' => array ( - array ( + [ + 'items' => [ + [ 'item' => 'Super Hoop', 'quantity' => 1, - ), - array ( + ], + [ 'Basketball', 'Big Shoes' - ) - ) - ) + ] + ] + ] --- %YAML:1.0 test: Compact notation brief: | @@ -119,22 +119,22 @@ yaml: | nick: Biggies quantity: 1 php: | - array ( - array ( + [ + [ 'item' => 'Super Hoop', - ), - array ( + ], + [ 'item' => 'Basketball', 'quantity' => 1, - ), - array ( - 'item' => array( + ], + [ + 'item' => [ 'name' => 'Big Shoes', 'nick' => 'Biggies' - ), + ], 'quantity' => 1 - ) - ) + ] + ] --- test: Compact notation combined with inline notation brief: | @@ -145,15 +145,15 @@ yaml: | - { item: Super Hoop, quantity: 1 } - [ Basketball, Big Shoes ] php: | - array ( - 'items' => array ( - array ( + [ + 'items' => [ + [ 'item' => 'Super Hoop', 'quantity' => 1, - ), - array ( + ], + [ 'Basketball', 'Big Shoes' - ) - ) - ) + ] + ] + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml b/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml index 83264cfab819074c2f3620a769985cb1fef610ea..af787ae435c25c3f73742ffd588ab14cafe8d536 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml @@ -46,16 +46,16 @@ yaml: | head_inline: &head_inline { <<: [ *foo , *dong , *foo2 ] } recursive_inline: { <<: *head_inline, c: { <<: *foo2 } } php: | - array( - 'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'), - 'bar' => array('a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'), - 'bar_inline' => array('a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'e' => 'notnull', 'x' => 'Oren'), - 'foo2' => array('a' => 'Ballmer'), - 'ding' => array('fi', 'fei', 'fo', 'fam'), - 'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'), - 'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'), - 'taz' => array('a' => 'Steve', 'w' => array('p' => 1234)), - 'nested' => array('a' => 'Steve', 'w' => array('p' => 12345), 'd' => 'Doug', 'z' => array('p' => 12345)), - 'head_inline' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'), - 'recursive_inline' => array('a' => 'Steve', 'b' => 'Clark', 'c' => array('a' => 'Ballmer'), 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'), - ) + [ + 'foo' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'], + 'bar' => ['a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => ['foo' => 'bar', 'bar' => 'foo'], 'x' => 'Oren'], + 'bar_inline' => ['a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => ['foo' => 'bar', 'bar' => 'foo'], 'e' => 'notnull', 'x' => 'Oren'], + 'foo2' => ['a' => 'Ballmer'], + 'ding' => ['fi', 'fei', 'fo', 'fam'], + 'check' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'], + 'head' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'], + 'taz' => ['a' => 'Steve', 'w' => ['p' => 1234]], + 'nested' => ['a' => 'Steve', 'w' => ['p' => 12345], 'd' => 'Doug', 'z' => ['p' => 12345]], + 'head_inline' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'], + 'recursive_inline' => ['a' => 'Steve', 'b' => 'Clark', 'c' => ['a' => 'Ballmer'], 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'], + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml b/vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml index ee124b2446eb9ba04b63fb6c2c68708f4b04822f..144615f2a802ddc978b0c5c07ca2683ed5653388 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml @@ -8,4 +8,4 @@ yaml: | ex3: 'foo # bar' # comment ex4: foo # comment php: | - array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo') + ['ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo'] diff --git a/vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml b/vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml index 7c60baec97ceee4114afe432b67a1eec4346e700..c8326fdb2067bbcb54245c9419bf940381afecbe 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml @@ -5,7 +5,7 @@ brief: > yaml: | foo: '| bar' php: | - array('foo' => '| bar') + ['foo' => '| bar'] --- test: A key can be a quoted string brief: > @@ -19,15 +19,15 @@ yaml: | "foo4: ": bar foo5: { "foo \" bar: ": bar, 'foo '' bar: ': bar } php: | - array( + [ 'foo1' => 'bar', 'foo2' => 'bar', 'foo " bar' => 'bar', 'foo \' bar' => 'bar', 'foo3: ' => 'bar', 'foo4: ' => 'bar', - 'foo5' => array( + 'foo5' => [ 'foo " bar: ' => 'bar', 'foo \' bar: ' => 'bar', - ), - ) + ], + ] diff --git a/vendor/symfony/yaml/Tests/Fixtures/sfTests.yml b/vendor/symfony/yaml/Tests/Fixtures/sfTests.yml index 2a0b9c8741ccd5e6925cf3fcff266a0e8810e4c1..2ea417a7289bfd81706a77f004c83ee4662ba917 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/sfTests.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/sfTests.yml @@ -5,19 +5,19 @@ brief: > yaml: | stripped_title: { name: "foo bar", help: "bar foo" } php: | - array('stripped_title' => array('name' => 'foo bar', 'help' => 'bar foo')) + ['stripped_title' => ['name' => 'foo bar', 'help' => 'bar foo']] --- test: Empty sequence yaml: | foo: [ ] php: | - array('foo' => array()) + ['foo' => []] --- test: Empty value yaml: | foo: php: | - array('foo' => null) + ['foo' => null] --- test: Inline string parsing brief: > @@ -25,7 +25,7 @@ brief: > yaml: | test: ['complex: string', 'another [string]'] php: | - array('test' => array('complex: string', 'another [string]')) + ['test' => ['complex: string', 'another [string]']] --- test: Boolean brief: > @@ -40,7 +40,7 @@ yaml: | - 'null' - '~' php: | - array( + [ false, true, null, @@ -49,7 +49,7 @@ php: | 'true', 'null', '~', - ) + ] --- test: Empty lines in literal blocks brief: > @@ -63,7 +63,7 @@ yaml: | bar php: | - array('foo' => array('bar' => "foo\n\n\n \nbar\n")) + ['foo' => ['bar' => "foo\n\n\n \nbar\n"]] --- test: Empty lines in folded blocks brief: > @@ -77,7 +77,7 @@ yaml: | bar php: | - array('foo' => array('bar' => "\nfoo\n\nbar\n")) + ['foo' => ['bar' => "\nfoo\n\nbar\n"]] --- test: IP addresses brief: > @@ -85,7 +85,7 @@ brief: > yaml: | foo: 10.0.0.2 php: | - array('foo' => '10.0.0.2') + ['foo' => '10.0.0.2'] --- test: A sequence with an embedded mapping brief: > @@ -94,28 +94,28 @@ yaml: | - foo - bar: { bar: foo } php: | - array('foo', array('bar' => array('bar' => 'foo'))) + ['foo', ['bar' => ['bar' => 'foo']]] --- test: Octal brief: as in spec example 2.19, octal value is converted yaml: | foo: 0123 php: | - array('foo' => 83) + ['foo' => 83] --- test: Octal strings brief: Octal notation in a string must remain a string yaml: | foo: "0123" php: | - array('foo' => '0123') + ['foo' => '0123'] --- test: Octal strings brief: Octal notation in a string must remain a string yaml: | foo: '0123' php: | - array('foo' => '0123') + ['foo' => '0123'] --- test: Octal strings brief: Octal notation in a string must remain a string @@ -123,18 +123,18 @@ yaml: | foo: | 0123 php: | - array('foo' => "0123\n") + ['foo' => "0123\n"] --- test: Document as a simple hash brief: Document as a simple hash yaml: | { foo: bar } php: | - array('foo' => 'bar') + ['foo' => 'bar'] --- test: Document as a simple array brief: Document as a simple array yaml: | [ foo, bar ] php: | - array('foo', 'bar') + ['foo', 'bar'] diff --git a/vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml b/vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml index 0c96108e9911088ff0c4c1f601b813d04d08df08..c85952df47f3a0d3a90f56891c473bf82e9b912a 100644 --- a/vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml +++ b/vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml @@ -8,7 +8,7 @@ yaml: | - item2 - item3 php: | - array('collection' => array('item1', 'item2', 'item3')) + ['collection' => ['item1', 'item2', 'item3']] --- test: Nested unindented collection (two levels) brief: > @@ -20,7 +20,7 @@ yaml: | - b - c php: | - array('collection' => array('key' => array('a', 'b', 'c'))) + ['collection' => ['key' => ['a', 'b', 'c']]] --- test: Nested unindented collection (three levels) brief: > @@ -33,7 +33,7 @@ yaml: | - two - three php: | - array('collection' => array('key' => array('subkey' => array('one', 'two', 'three')))) + ['collection' => ['key' => ['subkey' => ['one', 'two', 'three']]]] --- test: Key/value after unindented collection (1) brief: > @@ -46,7 +46,7 @@ yaml: | - c foo: bar php: | - array('collection' => array('key' => array('a', 'b', 'c')), 'foo' => 'bar') + ['collection' => ['key' => ['a', 'b', 'c']], 'foo' => 'bar'] --- test: Key/value after unindented collection (at the same level) brief: > @@ -59,7 +59,7 @@ yaml: | - c foo: bar php: | - array('collection' => array('key' => array('a', 'b', 'c'), 'foo' => 'bar')) + ['collection' => ['key' => ['a', 'b', 'c'], 'foo' => 'bar']] --- test: Shortcut Key after unindented collection brief: > @@ -69,7 +69,7 @@ yaml: | - key: foo foo: bar php: | - array('collection' => array(array('key' => 'foo', 'foo' => 'bar'))) + ['collection' => [['key' => 'foo', 'foo' => 'bar']]] --- test: Shortcut Key after unindented collection with custom spaces brief: > @@ -79,4 +79,4 @@ yaml: | - key: foo foo: bar php: | - array('collection' => array(array('key' => 'foo', 'foo' => 'bar'))) + ['collection' => [['key' => 'foo', 'foo' => 'bar']]] diff --git a/vendor/symfony/yaml/Tests/InlineTest.php b/vendor/symfony/yaml/Tests/InlineTest.php index f2c4ab6084702e7d370097fa3af6341291862714..950c702300ebeea88a55d72c60bdb8777e27bae3 100644 --- a/vendor/symfony/yaml/Tests/InlineTest.php +++ b/vendor/symfony/yaml/Tests/InlineTest.php @@ -53,13 +53,13 @@ public function testParsePhpConstants($yaml, $value) public function getTestsForParsePhpConstants() { - return array( - array('!php/const Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT), - array('!php/const PHP_INT_MAX', PHP_INT_MAX), - array('[!php/const PHP_INT_MAX]', array(PHP_INT_MAX)), - array('{ foo: !php/const PHP_INT_MAX }', array('foo' => PHP_INT_MAX)), - array('!php/const NULL', null), - ); + return [ + ['!php/const Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT], + ['!php/const PHP_INT_MAX', PHP_INT_MAX], + ['[!php/const PHP_INT_MAX]', [PHP_INT_MAX]], + ['{ foo: !php/const PHP_INT_MAX }', ['foo' => PHP_INT_MAX]], + ['!php/const NULL', null], + ]; } /** @@ -92,13 +92,13 @@ public function testDeprecatedConstantTag($yaml, $expectedValue) public function getTestsForParseLegacyPhpConstants() { - return array( - array('!php/const:Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT), - array('!php/const:PHP_INT_MAX', PHP_INT_MAX), - array('[!php/const:PHP_INT_MAX]', array(PHP_INT_MAX)), - array('{ foo: !php/const:PHP_INT_MAX }', array('foo' => PHP_INT_MAX)), - array('!php/const:NULL', null), - ); + return [ + ['!php/const:Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT], + ['!php/const:PHP_INT_MAX', PHP_INT_MAX], + ['[!php/const:PHP_INT_MAX]', [PHP_INT_MAX]], + ['{ foo: !php/const:PHP_INT_MAX }', ['foo' => PHP_INT_MAX]], + ['!php/const:NULL', null], + ]; } /** @@ -130,7 +130,7 @@ public function testDumpNumericValueWithLocale() } try { - $requiredLocales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'); + $requiredLocales = ['fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252']; if (false === setlocale(LC_NUMERIC, $requiredLocales)) { $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $requiredLocales)); } @@ -232,7 +232,7 @@ public function testParseScalarWithCorrectlyQuotedStringShouldReturnString() */ public function testParseReferences($yaml, $expected) { - $this->assertSame($expected, Inline::parse($yaml, 0, array('var' => 'var-value'))); + $this->assertSame($expected, Inline::parse($yaml, 0, ['var' => 'var-value'])); } /** @@ -241,31 +241,31 @@ public function testParseReferences($yaml, $expected) */ public function testParseReferencesAsFifthArgument($yaml, $expected) { - $this->assertSame($expected, Inline::parse($yaml, false, false, false, array('var' => 'var-value'))); + $this->assertSame($expected, Inline::parse($yaml, false, false, false, ['var' => 'var-value'])); } public function getDataForParseReferences() { - return array( - 'scalar' => array('*var', 'var-value'), - 'list' => array('[ *var ]', array('var-value')), - 'list-in-list' => array('[[ *var ]]', array(array('var-value'))), - 'map-in-list' => array('[ { key: *var } ]', array(array('key' => 'var-value'))), - 'embedded-mapping-in-list' => array('[ key: *var ]', array(array('key' => 'var-value'))), - 'map' => array('{ key: *var }', array('key' => 'var-value')), - 'list-in-map' => array('{ key: [*var] }', array('key' => array('var-value'))), - 'map-in-map' => array('{ foo: { bar: *var } }', array('foo' => array('bar' => 'var-value'))), - ); + return [ + 'scalar' => ['*var', 'var-value'], + 'list' => ['[ *var ]', ['var-value']], + 'list-in-list' => ['[[ *var ]]', [['var-value']]], + 'map-in-list' => ['[ { key: *var } ]', [['key' => 'var-value']]], + 'embedded-mapping-in-list' => ['[ key: *var ]', [['key' => 'var-value']]], + 'map' => ['{ key: *var }', ['key' => 'var-value']], + 'list-in-map' => ['{ key: [*var] }', ['key' => ['var-value']]], + 'map-in-map' => ['{ foo: { bar: *var } }', ['foo' => ['bar' => 'var-value']]], + ]; } public function testParseMapReferenceInSequence() { - $foo = array( + $foo = [ 'a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', - ); - $this->assertSame(array($foo), Inline::parse('[*foo]', 0, array('foo' => $foo))); + ]; + $this->assertSame([$foo], Inline::parse('[*foo]', 0, ['foo' => $foo])); } /** @@ -273,12 +273,12 @@ public function testParseMapReferenceInSequence() */ public function testParseMapReferenceInSequenceAsFifthArgument() { - $foo = array( + $foo = [ 'a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', - ); - $this->assertSame(array($foo), Inline::parse('[*foo]', false, false, false, array('foo' => $foo))); + ]; + $this->assertSame([$foo], Inline::parse('[*foo]', false, false, false, ['foo' => $foo])); } /** @@ -316,7 +316,7 @@ public function testParseUnquotedScalarStartingWithReservedIndicator($indicator) public function getReservedIndicators() { - return array(array('@'), array('`')); + return [['@'], ['`']]; } /** @@ -336,7 +336,7 @@ public function testParseUnquotedScalarStartingWithScalarIndicator($indicator) public function getScalarIndicators() { - return array(array('|'), array('>')); + return [['|'], ['>']]; } /** @@ -359,240 +359,240 @@ public function testIsHash($array, $expected) public function getDataForIsHash() { - return array( - array(array(), false), - array(array(1, 2, 3), false), - array(array(2 => 1, 1 => 2, 0 => 3), true), - array(array('foo' => 1, 'bar' => 2), true), - ); + return [ + [[], false], + [[1, 2, 3], false], + [[2 => 1, 1 => 2, 0 => 3], true], + [['foo' => 1, 'bar' => 2], true], + ]; } public function getTestsForParse() { - return array( - array('', ''), - array('null', null), - array('false', false), - array('true', true), - array('12', 12), - array('-12', -12), - array('1_2', 12), - array('_12', '_12'), - array('12_', 12), - array('"quoted string"', 'quoted string'), - array("'quoted string'", 'quoted string'), - array('12.30e+02', 12.30e+02), - array('123.45_67', 123.4567), - array('0x4D2', 0x4D2), - array('0x_4_D_2_', 0x4D2), - array('02333', 02333), - array('0_2_3_3_3', 02333), - array('.Inf', -log(0)), - array('-.Inf', log(0)), - array("'686e444'", '686e444'), - array('686e444', 646e444), - array('123456789123456789123456789123456789', '123456789123456789123456789123456789'), - array('"foo\r\nbar"', "foo\r\nbar"), - array("'foo#bar'", 'foo#bar'), - array("'foo # bar'", 'foo # bar'), - array("'#cfcfcf'", '#cfcfcf'), - array('::form_base.html.twig', '::form_base.html.twig'), + return [ + ['', ''], + ['null', null], + ['false', false], + ['true', true], + ['12', 12], + ['-12', -12], + ['1_2', 12], + ['_12', '_12'], + ['12_', 12], + ['"quoted string"', 'quoted string'], + ["'quoted string'", 'quoted string'], + ['12.30e+02', 12.30e+02], + ['123.45_67', 123.4567], + ['0x4D2', 0x4D2], + ['0x_4_D_2_', 0x4D2], + ['02333', 02333], + ['0_2_3_3_3', 02333], + ['.Inf', -log(0)], + ['-.Inf', log(0)], + ["'686e444'", '686e444'], + ['686e444', 646e444], + ['123456789123456789123456789123456789', '123456789123456789123456789123456789'], + ['"foo\r\nbar"', "foo\r\nbar"], + ["'foo#bar'", 'foo#bar'], + ["'foo # bar'", 'foo # bar'], + ["'#cfcfcf'", '#cfcfcf'], + ['::form_base.html.twig', '::form_base.html.twig'], // Pre-YAML-1.2 booleans - array("'y'", 'y'), - array("'n'", 'n'), - array("'yes'", 'yes'), - array("'no'", 'no'), - array("'on'", 'on'), - array("'off'", 'off'), - - array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)), - array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)), - array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)), - array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)), - array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)), - - array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''), - array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''), + ["'y'", 'y'], + ["'n'", 'n'], + ["'yes'", 'yes'], + ["'no'", 'no'], + ["'on'", 'on'], + ["'off'", 'off'], + + ['2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)], + ['2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)], + ['2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)], + ['1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)], + ['1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)], + + ['"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''], + ["'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''], // sequences // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon - array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)), - array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)), - array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')), + ['[foo, http://urls.are/no/mappings, false, null, 12]', ['foo', 'http://urls.are/no/mappings', false, null, 12]], + ['[ foo , bar , false , null , 12 ]', ['foo', 'bar', false, null, 12]], + ['[\'foo,bar\', \'foo bar\']', ['foo,bar', 'foo bar']], // mappings - array('{foo: bar,bar: foo,"false": false, "null": null,integer: 12}', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)), - array('{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)), - array('{foo: \'bar\', bar: \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')), - array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')), - array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', array('foo\'' => 'bar', 'bar"' => 'foo: bar')), - array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', array('foo: ' => 'bar', 'bar: ' => 'foo: bar')), - array('{"foo:bar": "baz"}', array('foo:bar' => 'baz')), - array('{"foo":"bar"}', array('foo' => 'bar')), + ['{foo: bar,bar: foo,"false": false, "null": null,integer: 12}', ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12]], + ['{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12]], + ['{foo: \'bar\', bar: \'foo: bar\'}', ['foo' => 'bar', 'bar' => 'foo: bar']], + ['{\'foo\': \'bar\', "bar": \'foo: bar\'}', ['foo' => 'bar', 'bar' => 'foo: bar']], + ['{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', ['foo\'' => 'bar', 'bar"' => 'foo: bar']], + ['{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', ['foo: ' => 'bar', 'bar: ' => 'foo: bar']], + ['{"foo:bar": "baz"}', ['foo:bar' => 'baz']], + ['{"foo":"bar"}', ['foo' => 'bar']], // nested sequences and mappings - array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))), - array('[foo, {bar: foo}]', array('foo', array('bar' => 'foo'))), - array('{ foo: {bar: foo} }', array('foo' => array('bar' => 'foo'))), - array('{ foo: [bar, foo] }', array('foo' => array('bar', 'foo'))), - array('{ foo:{bar: foo} }', array('foo' => array('bar' => 'foo'))), - array('{ foo:[bar, foo] }', array('foo' => array('bar', 'foo'))), + ['[foo, [bar, foo]]', ['foo', ['bar', 'foo']]], + ['[foo, {bar: foo}]', ['foo', ['bar' => 'foo']]], + ['{ foo: {bar: foo} }', ['foo' => ['bar' => 'foo']]], + ['{ foo: [bar, foo] }', ['foo' => ['bar', 'foo']]], + ['{ foo:{bar: foo} }', ['foo' => ['bar' => 'foo']]], + ['{ foo:[bar, foo] }', ['foo' => ['bar', 'foo']]], - array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))), + ['[ foo, [ bar, foo ] ]', ['foo', ['bar', 'foo']]], - array('[{ foo: {bar: foo} }]', array(array('foo' => array('bar' => 'foo')))), + ['[{ foo: {bar: foo} }]', [['foo' => ['bar' => 'foo']]]], - array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))), + ['[foo, [bar, [foo, [bar, foo]], foo]]', ['foo', ['bar', ['foo', ['bar', 'foo']], 'foo']]], - array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))), + ['[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', ['foo', ['bar' => 'foo', 'foo' => ['foo', ['bar' => 'foo']]], ['foo', ['bar' => 'foo']]]], - array('[foo, bar: { foo: bar }]', array('foo', '1' => array('bar' => array('foo' => 'bar')))), - array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')), - ); + ['[foo, bar: { foo: bar }]', ['foo', '1' => ['bar' => ['foo' => 'bar']]]], + ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], true, '@service_container']], + ]; } public function getTestsForParseWithMapObjects() { - return array( - array('', ''), - array('null', null), - array('false', false), - array('true', true), - array('12', 12), - array('-12', -12), - array('"quoted string"', 'quoted string'), - array("'quoted string'", 'quoted string'), - array('12.30e+02', 12.30e+02), - array('0x4D2', 0x4D2), - array('02333', 02333), - array('.Inf', -log(0)), - array('-.Inf', log(0)), - array("'686e444'", '686e444'), - array('686e444', 646e444), - array('123456789123456789123456789123456789', '123456789123456789123456789123456789'), - array('"foo\r\nbar"', "foo\r\nbar"), - array("'foo#bar'", 'foo#bar'), - array("'foo # bar'", 'foo # bar'), - array("'#cfcfcf'", '#cfcfcf'), - array('::form_base.html.twig', '::form_base.html.twig'), - - array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)), - array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)), - array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)), - array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)), - array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)), - - array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''), - array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''), + return [ + ['', ''], + ['null', null], + ['false', false], + ['true', true], + ['12', 12], + ['-12', -12], + ['"quoted string"', 'quoted string'], + ["'quoted string'", 'quoted string'], + ['12.30e+02', 12.30e+02], + ['0x4D2', 0x4D2], + ['02333', 02333], + ['.Inf', -log(0)], + ['-.Inf', log(0)], + ["'686e444'", '686e444'], + ['686e444', 646e444], + ['123456789123456789123456789123456789', '123456789123456789123456789123456789'], + ['"foo\r\nbar"', "foo\r\nbar"], + ["'foo#bar'", 'foo#bar'], + ["'foo # bar'", 'foo # bar'], + ["'#cfcfcf'", '#cfcfcf'], + ['::form_base.html.twig', '::form_base.html.twig'], + + ['2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)], + ['2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)], + ['2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)], + ['1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)], + ['1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)], + + ['"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''], + ["'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''], // sequences // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon - array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)), - array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)), - array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')), + ['[foo, http://urls.are/no/mappings, false, null, 12]', ['foo', 'http://urls.are/no/mappings', false, null, 12]], + ['[ foo , bar , false , null , 12 ]', ['foo', 'bar', false, null, 12]], + ['[\'foo,bar\', \'foo bar\']', ['foo,bar', 'foo bar']], // mappings - array('{foo: bar,bar: foo,"false": false,"null": null,integer: 12}', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), Yaml::PARSE_OBJECT_FOR_MAP), - array('{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), Yaml::PARSE_OBJECT_FOR_MAP), - array('{foo: \'bar\', bar: \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')), - array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')), - array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) array('foo\'' => 'bar', 'bar"' => 'foo: bar')), - array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) array('foo: ' => 'bar', 'bar: ' => 'foo: bar')), - array('{"foo:bar": "baz"}', (object) array('foo:bar' => 'baz')), - array('{"foo":"bar"}', (object) array('foo' => 'bar')), + ['{foo: bar,bar: foo,"false": false,"null": null,integer: 12}', (object) ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12], Yaml::PARSE_OBJECT_FOR_MAP], + ['{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', (object) ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12], Yaml::PARSE_OBJECT_FOR_MAP], + ['{foo: \'bar\', bar: \'foo: bar\'}', (object) ['foo' => 'bar', 'bar' => 'foo: bar']], + ['{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) ['foo' => 'bar', 'bar' => 'foo: bar']], + ['{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) ['foo\'' => 'bar', 'bar"' => 'foo: bar']], + ['{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) ['foo: ' => 'bar', 'bar: ' => 'foo: bar']], + ['{"foo:bar": "baz"}', (object) ['foo:bar' => 'baz']], + ['{"foo":"bar"}', (object) ['foo' => 'bar']], // nested sequences and mappings - array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))), - array('[foo, {bar: foo}]', array('foo', (object) array('bar' => 'foo'))), - array('{ foo: {bar: foo} }', (object) array('foo' => (object) array('bar' => 'foo'))), - array('{ foo: [bar, foo] }', (object) array('foo' => array('bar', 'foo'))), + ['[foo, [bar, foo]]', ['foo', ['bar', 'foo']]], + ['[foo, {bar: foo}]', ['foo', (object) ['bar' => 'foo']]], + ['{ foo: {bar: foo} }', (object) ['foo' => (object) ['bar' => 'foo']]], + ['{ foo: [bar, foo] }', (object) ['foo' => ['bar', 'foo']]], - array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))), + ['[ foo, [ bar, foo ] ]', ['foo', ['bar', 'foo']]], - array('[{ foo: {bar: foo} }]', array((object) array('foo' => (object) array('bar' => 'foo')))), + ['[{ foo: {bar: foo} }]', [(object) ['foo' => (object) ['bar' => 'foo']]]], - array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))), + ['[foo, [bar, [foo, [bar, foo]], foo]]', ['foo', ['bar', ['foo', ['bar', 'foo']], 'foo']]], - array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', (object) array('bar' => 'foo', 'foo' => array('foo', (object) array('bar' => 'foo'))), array('foo', (object) array('bar' => 'foo')))), + ['[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', ['foo', (object) ['bar' => 'foo', 'foo' => ['foo', (object) ['bar' => 'foo']]], ['foo', (object) ['bar' => 'foo']]]], - array('[foo, bar: { foo: bar }]', array('foo', '1' => (object) array('bar' => (object) array('foo' => 'bar')))), - array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', (object) array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')), + ['[foo, bar: { foo: bar }]', ['foo', '1' => (object) ['bar' => (object) ['foo' => 'bar']]]], + ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', (object) ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], true, '@service_container']], - array('{}', new \stdClass()), - array('{ foo : bar, bar : {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())), - array('{ foo : [], bar : {} }', (object) array('foo' => array(), 'bar' => new \stdClass())), - array('{foo: \'bar\', bar: {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())), - array('{\'foo\': \'bar\', "bar": {}}', (object) array('foo' => 'bar', 'bar' => new \stdClass())), - array('{\'foo\': \'bar\', "bar": \'{}\'}', (object) array('foo' => 'bar', 'bar' => '{}')), + ['{}', new \stdClass()], + ['{ foo : bar, bar : {} }', (object) ['foo' => 'bar', 'bar' => new \stdClass()]], + ['{ foo : [], bar : {} }', (object) ['foo' => [], 'bar' => new \stdClass()]], + ['{foo: \'bar\', bar: {} }', (object) ['foo' => 'bar', 'bar' => new \stdClass()]], + ['{\'foo\': \'bar\', "bar": {}}', (object) ['foo' => 'bar', 'bar' => new \stdClass()]], + ['{\'foo\': \'bar\', "bar": \'{}\'}', (object) ['foo' => 'bar', 'bar' => '{}']], - array('[foo, [{}, {}]]', array('foo', array(new \stdClass(), new \stdClass()))), - array('[foo, [[], {}]]', array('foo', array(array(), new \stdClass()))), - array('[foo, [[{}, {}], {}]]', array('foo', array(array(new \stdClass(), new \stdClass()), new \stdClass()))), - array('[foo, {bar: {}}]', array('foo', '1' => (object) array('bar' => new \stdClass()))), - ); + ['[foo, [{}, {}]]', ['foo', [new \stdClass(), new \stdClass()]]], + ['[foo, [[], {}]]', ['foo', [[], new \stdClass()]]], + ['[foo, [[{}, {}], {}]]', ['foo', [[new \stdClass(), new \stdClass()], new \stdClass()]]], + ['[foo, {bar: {}}]', ['foo', '1' => (object) ['bar' => new \stdClass()]]], + ]; } public function getTestsForDump() { - return array( - array('null', null), - array('false', false), - array('true', true), - array('12', 12), - array("'1_2'", '1_2'), - array('_12', '_12'), - array("'12_'", '12_'), - array("'quoted string'", 'quoted string'), - array('!!float 1230', 12.30e+02), - array('1234', 0x4D2), - array('1243', 02333), - array("'0x_4_D_2_'", '0x_4_D_2_'), - array("'0_2_3_3_3'", '0_2_3_3_3'), - array('.Inf', -log(0)), - array('-.Inf', log(0)), - array("'686e444'", '686e444'), - array('"foo\r\nbar"', "foo\r\nbar"), - array("'foo#bar'", 'foo#bar'), - array("'foo # bar'", 'foo # bar'), - array("'#cfcfcf'", '#cfcfcf'), - - array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''), - - array("'-dash'", '-dash'), - array("'-'", '-'), + return [ + ['null', null], + ['false', false], + ['true', true], + ['12', 12], + ["'1_2'", '1_2'], + ['_12', '_12'], + ["'12_'", '12_'], + ["'quoted string'", 'quoted string'], + ['!!float 1230', 12.30e+02], + ['1234', 0x4D2], + ['1243', 02333], + ["'0x_4_D_2_'", '0x_4_D_2_'], + ["'0_2_3_3_3'", '0_2_3_3_3'], + ['.Inf', -log(0)], + ['-.Inf', log(0)], + ["'686e444'", '686e444'], + ['"foo\r\nbar"', "foo\r\nbar"], + ["'foo#bar'", 'foo#bar'], + ["'foo # bar'", 'foo # bar'], + ["'#cfcfcf'", '#cfcfcf'], + + ["'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''], + + ["'-dash'", '-dash'], + ["'-'", '-'], // Pre-YAML-1.2 booleans - array("'y'", 'y'), - array("'n'", 'n'), - array("'yes'", 'yes'), - array("'no'", 'no'), - array("'on'", 'on'), - array("'off'", 'off'), + ["'y'", 'y'], + ["'n'", 'n'], + ["'yes'", 'yes'], + ["'no'", 'no'], + ["'on'", 'on'], + ["'off'", 'off'], // sequences - array('[foo, bar, false, null, 12]', array('foo', 'bar', false, null, 12)), - array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')), + ['[foo, bar, false, null, 12]', ['foo', 'bar', false, null, 12]], + ['[\'foo,bar\', \'foo bar\']', ['foo,bar', 'foo bar']], // mappings - array('{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)), - array('{ foo: bar, bar: \'foo: bar\' }', array('foo' => 'bar', 'bar' => 'foo: bar')), + ['{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12]], + ['{ foo: bar, bar: \'foo: bar\' }', ['foo' => 'bar', 'bar' => 'foo: bar']], // nested sequences and mappings - array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))), + ['[foo, [bar, foo]]', ['foo', ['bar', 'foo']]], - array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))), + ['[foo, [bar, [foo, [bar, foo]], foo]]', ['foo', ['bar', ['foo', ['bar', 'foo']], 'foo']]], - array('{ foo: { bar: foo } }', array('foo' => array('bar' => 'foo'))), + ['{ foo: { bar: foo } }', ['foo' => ['bar' => 'foo']]], - array('[foo, { bar: foo }]', array('foo', array('bar' => 'foo'))), + ['[foo, { bar: foo }]', ['foo', ['bar' => 'foo']]], - array('[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))), + ['[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', ['foo', ['bar' => 'foo', 'foo' => ['foo', ['bar' => 'foo']]], ['foo', ['bar' => 'foo']]]], - array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')), + ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], true, '@service_container']], - array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))), - ); + ['{ foo: { bar: { 1: 2, baz: 3 } } }', ['foo' => ['bar' => [1 => 2, 'baz' => 3]]]], + ]; } /** @@ -625,12 +625,12 @@ public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $ public function getTimestampTests() { - return array( - 'canonical' => array('2001-12-15T02:59:43.1Z', 2001, 12, 15, 2, 59, 43.1, '+0000'), - 'ISO-8601' => array('2001-12-15t21:59:43.10-05:00', 2001, 12, 16, 2, 59, 43.1, '-0500'), - 'spaced' => array('2001-12-15 21:59:43.10 -5', 2001, 12, 16, 2, 59, 43.1, '-0500'), - 'date' => array('2001-12-15', 2001, 12, 15, 0, 0, 0, '+0000'), - ); + return [ + 'canonical' => ['2001-12-15T02:59:43.1Z', 2001, 12, 15, 2, 59, 43.1, '+0000'], + 'ISO-8601' => ['2001-12-15t21:59:43.10-05:00', 2001, 12, 16, 2, 59, 43.1, '-0500'], + 'spaced' => ['2001-12-15 21:59:43.10 -5', 2001, 12, 16, 2, 59, 43.1, '-0500'], + 'date' => ['2001-12-15', 2001, 12, 15, 0, 0, 0, '+0000'], + ]; } /** @@ -647,7 +647,7 @@ public function testParseNestedTimestampListAsDateTimeObject($yaml, $year, $mont $expected->setTime($hour, $minute, $second); } - $expectedNested = array('nested' => array($expected)); + $expectedNested = ['nested' => [$expected]]; $yamlNested = "{nested: [$yaml]}"; $this->assertEquals($expectedNested, Inline::parse($yamlNested, Yaml::PARSE_DATETIME)); @@ -663,13 +663,13 @@ public function testDumpDateTime($dateTime, $expected) public function getDateTimeDumpTests() { - $tests = array(); + $tests = []; $dateTime = new \DateTime('2001-12-15 21:59:43', new \DateTimeZone('UTC')); - $tests['date-time-utc'] = array($dateTime, '2001-12-15T21:59:43+00:00'); + $tests['date-time-utc'] = [$dateTime, '2001-12-15T21:59:43+00:00']; $dateTime = new \DateTimeImmutable('2001-07-15 21:59:43', new \DateTimeZone('Europe/Berlin')); - $tests['immutable-date-time-europe-berlin'] = array($dateTime, '2001-07-15T21:59:43+02:00'); + $tests['immutable-date-time-europe-berlin'] = [$dateTime, '2001-07-15T21:59:43+02:00']; return $tests; } @@ -684,11 +684,11 @@ public function testParseBinaryData($data) public function getBinaryData() { - return array( - 'enclosed with double quotes' => array('!!binary "SGVsbG8gd29ybGQ="'), - 'enclosed with single quotes' => array("!!binary 'SGVsbG8gd29ybGQ='"), - 'containing spaces' => array('!!binary "SGVs bG8gd 29ybGQ="'), - ); + return [ + 'enclosed with double quotes' => ['!!binary "SGVsbG8gd29ybGQ="'], + 'enclosed with single quotes' => ["!!binary 'SGVsbG8gd29ybGQ='"], + 'containing spaces' => ['!!binary "SGVs bG8gd 29ybGQ="'], + ]; } /** @@ -708,12 +708,12 @@ public function testParseInvalidBinaryData($data, $expectedMessage) public function getInvalidBinaryData() { - return array( - 'length not a multiple of four' => array('!!binary "SGVsbG8d29ybGQ="', '/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/'), - 'invalid characters' => array('!!binary "SGVsbG8#d29ybGQ="', '/The base64 encoded data \(.*\) contains invalid characters/'), - 'too many equals characters' => array('!!binary "SGVsbG8gd29yb==="', '/The base64 encoded data \(.*\) contains invalid characters/'), - 'misplaced equals character' => array('!!binary "SGVsbG8gd29ybG=Q"', '/The base64 encoded data \(.*\) contains invalid characters/'), - ); + return [ + 'length not a multiple of four' => ['!!binary "SGVsbG8d29ybGQ="', '/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/'], + 'invalid characters' => ['!!binary "SGVsbG8#d29ybGQ="', '/The base64 encoded data \(.*\) contains invalid characters/'], + 'too many equals characters' => ['!!binary "SGVsbG8gd29yb==="', '/The base64 encoded data \(.*\) contains invalid characters/'], + 'misplaced equals character' => ['!!binary "SGVsbG8gd29ybG=Q"', '/The base64 encoded data \(.*\) contains invalid characters/'], + ]; } /** @@ -729,7 +729,7 @@ public function testVeryLongQuotedStrings() { $longStringWithQuotes = str_repeat("x\r\n\\\"x\"x", 1000); - $yamlString = Inline::dump(array('longStringWithQuotes' => $longStringWithQuotes)); + $yamlString = Inline::dump(['longStringWithQuotes' => $longStringWithQuotes]); $arrayFromYaml = Inline::parse($yamlString); $this->assertEquals($longStringWithQuotes, $arrayFromYaml['longStringWithQuotes']); @@ -741,7 +741,7 @@ public function testVeryLongQuotedStrings() */ public function testOmittedMappingKeyIsParsedAsColon() { - $this->assertSame(array(':' => 'foo'), Inline::parse('{: foo}')); + $this->assertSame([':' => 'foo'], Inline::parse('{: foo}')); } /** @@ -754,15 +754,15 @@ public function testParseMissingMappingValueAsNull($yaml, $expected) public function getTestsForNullValues() { - return array( - 'null before closing curly brace' => array('{foo:}', array('foo' => null)), - 'null before comma' => array('{foo:, bar: baz}', array('foo' => null, 'bar' => 'baz')), - ); + return [ + 'null before closing curly brace' => ['{foo:}', ['foo' => null]], + 'null before comma' => ['{foo:, bar: baz}', ['foo' => null, 'bar' => 'baz']], + ]; } public function testTheEmptyStringIsAValidMappingKey() { - $this->assertSame(array('' => 'foo'), Inline::parse('{ "": foo }')); + $this->assertSame(['' => 'foo'], Inline::parse('{ "": foo }')); } /** @@ -788,12 +788,12 @@ public function testExplicitStringCastingOfMappingKeys($yaml, $expected) public function getNotPhpCompatibleMappingKeyData() { - return array( - 'boolean-true' => array('{true: "foo"}', array('true' => 'foo')), - 'boolean-false' => array('{false: "foo"}', array('false' => 'foo')), - 'null' => array('{null: "foo"}', array('null' => 'foo')), - 'float' => array('{0.25: "foo"}', array('0.25' => 'foo')), - ); + return [ + 'boolean-true' => ['{true: "foo"}', ['true' => 'foo']], + 'boolean-false' => ['{false: "foo"}', ['false' => 'foo']], + 'null' => ['{null: "foo"}', ['null' => 'foo']], + 'float' => ['{0.25: "foo"}', ['0.25' => 'foo']], + ]; } /** @@ -802,7 +802,7 @@ public function getNotPhpCompatibleMappingKeyData() */ public function testDeprecatedStrTag() { - $this->assertSame(array('foo' => 'bar'), Inline::parse('{ foo: !str bar }')); + $this->assertSame(['foo' => 'bar'], Inline::parse('{ foo: !str bar }')); } /** diff --git a/vendor/symfony/yaml/Tests/ParserTest.php b/vendor/symfony/yaml/Tests/ParserTest.php index c9aff59fcb87685a6bd9a731acd063d85609f8a8..0f25732ab4420614d5b79a2ad65783bd96855c05 100644 --- a/vendor/symfony/yaml/Tests/ParserTest.php +++ b/vendor/symfony/yaml/Tests/ParserTest.php @@ -39,7 +39,7 @@ protected function tearDown() */ public function testSpecifications($expected, $yaml, $comment, $deprecated) { - $deprecations = array(); + $deprecations = []; if ($deprecated) { set_error_handler(function ($type, $msg) use (&$deprecations) { @@ -104,12 +104,12 @@ public function getLegacyNonStringMappingKeysData() public function testTabsInYaml() { // test tabs in YAML - $yamls = array( + $yamls = [ "foo:\n bar", "foo:\n bar", "foo:\n bar", "foo:\n bar", - ); + ]; foreach ($yamls as $yaml) { try { @@ -136,7 +136,7 @@ public function testEndOfTheDocumentMarker() public function getBlockChompingTests() { - $tests = array(); + $tests = []; $yaml = <<<'EOF' foo: |- @@ -147,11 +147,11 @@ public function getBlockChompingTests() two EOF; - $expected = array( + $expected = [ 'foo' => "one\ntwo", 'bar' => "one\ntwo", - ); - $tests['Literal block chomping strip with single trailing newline'] = array($expected, $yaml); + ]; + $tests['Literal block chomping strip with single trailing newline'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: |- @@ -164,19 +164,19 @@ public function getBlockChompingTests() EOF; - $expected = array( + $expected = [ 'foo' => "one\ntwo", 'bar' => "one\ntwo", - ); - $tests['Literal block chomping strip with multiple trailing newlines'] = array($expected, $yaml); + ]; + $tests['Literal block chomping strip with multiple trailing newlines'] = [$expected, $yaml]; $yaml = <<<'EOF' {} EOF; - $expected = array(); - $tests['Literal block chomping strip with multiple trailing newlines after a 1-liner'] = array($expected, $yaml); + $expected = []; + $tests['Literal block chomping strip with multiple trailing newlines after a 1-liner'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: |- @@ -186,11 +186,11 @@ public function getBlockChompingTests() one two EOF; - $expected = array( + $expected = [ 'foo' => "one\ntwo", 'bar' => "one\ntwo", - ); - $tests['Literal block chomping strip without trailing newline'] = array($expected, $yaml); + ]; + $tests['Literal block chomping strip without trailing newline'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: | @@ -201,11 +201,11 @@ public function getBlockChompingTests() two EOF; - $expected = array( + $expected = [ 'foo' => "one\ntwo\n", 'bar' => "one\ntwo\n", - ); - $tests['Literal block chomping clip with single trailing newline'] = array($expected, $yaml); + ]; + $tests['Literal block chomping clip with single trailing newline'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: | @@ -218,11 +218,11 @@ public function getBlockChompingTests() EOF; - $expected = array( + $expected = [ 'foo' => "one\ntwo\n", 'bar' => "one\ntwo\n", - ); - $tests['Literal block chomping clip with multiple trailing newlines'] = array($expected, $yaml); + ]; + $tests['Literal block chomping clip with multiple trailing newlines'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: @@ -231,14 +231,14 @@ public function getBlockChompingTests() two EOF; - $expected = array( - 'foo' => array( - array( + $expected = [ + 'foo' => [ + [ 'bar' => "one\n\ntwo", - ), - ), - ); - $tests['Literal block chomping clip with embedded blank line inside unindented collection'] = array($expected, $yaml); + ], + ], + ]; + $tests['Literal block chomping clip with embedded blank line inside unindented collection'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: | @@ -248,11 +248,11 @@ public function getBlockChompingTests() one two EOF; - $expected = array( + $expected = [ 'foo' => "one\ntwo\n", 'bar' => "one\ntwo", - ); - $tests['Literal block chomping clip without trailing newline'] = array($expected, $yaml); + ]; + $tests['Literal block chomping clip without trailing newline'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: |+ @@ -263,11 +263,11 @@ public function getBlockChompingTests() two EOF; - $expected = array( + $expected = [ 'foo' => "one\ntwo\n", 'bar' => "one\ntwo\n", - ); - $tests['Literal block chomping keep with single trailing newline'] = array($expected, $yaml); + ]; + $tests['Literal block chomping keep with single trailing newline'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: |+ @@ -280,11 +280,11 @@ public function getBlockChompingTests() EOF; - $expected = array( + $expected = [ 'foo' => "one\ntwo\n\n", 'bar' => "one\ntwo\n\n", - ); - $tests['Literal block chomping keep with multiple trailing newlines'] = array($expected, $yaml); + ]; + $tests['Literal block chomping keep with multiple trailing newlines'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: |+ @@ -294,11 +294,11 @@ public function getBlockChompingTests() one two EOF; - $expected = array( + $expected = [ 'foo' => "one\ntwo\n", 'bar' => "one\ntwo", - ); - $tests['Literal block chomping keep without trailing newline'] = array($expected, $yaml); + ]; + $tests['Literal block chomping keep without trailing newline'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: >- @@ -309,11 +309,11 @@ public function getBlockChompingTests() two EOF; - $expected = array( + $expected = [ 'foo' => 'one two', 'bar' => 'one two', - ); - $tests['Folded block chomping strip with single trailing newline'] = array($expected, $yaml); + ]; + $tests['Folded block chomping strip with single trailing newline'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: >- @@ -326,11 +326,11 @@ public function getBlockChompingTests() EOF; - $expected = array( + $expected = [ 'foo' => 'one two', 'bar' => 'one two', - ); - $tests['Folded block chomping strip with multiple trailing newlines'] = array($expected, $yaml); + ]; + $tests['Folded block chomping strip with multiple trailing newlines'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: >- @@ -340,11 +340,11 @@ public function getBlockChompingTests() one two EOF; - $expected = array( + $expected = [ 'foo' => 'one two', 'bar' => 'one two', - ); - $tests['Folded block chomping strip without trailing newline'] = array($expected, $yaml); + ]; + $tests['Folded block chomping strip without trailing newline'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: > @@ -355,11 +355,11 @@ public function getBlockChompingTests() two EOF; - $expected = array( + $expected = [ 'foo' => "one two\n", 'bar' => "one two\n", - ); - $tests['Folded block chomping clip with single trailing newline'] = array($expected, $yaml); + ]; + $tests['Folded block chomping clip with single trailing newline'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: > @@ -372,11 +372,11 @@ public function getBlockChompingTests() EOF; - $expected = array( + $expected = [ 'foo' => "one two\n", 'bar' => "one two\n", - ); - $tests['Folded block chomping clip with multiple trailing newlines'] = array($expected, $yaml); + ]; + $tests['Folded block chomping clip with multiple trailing newlines'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: > @@ -386,11 +386,11 @@ public function getBlockChompingTests() one two EOF; - $expected = array( + $expected = [ 'foo' => "one two\n", 'bar' => 'one two', - ); - $tests['Folded block chomping clip without trailing newline'] = array($expected, $yaml); + ]; + $tests['Folded block chomping clip without trailing newline'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: >+ @@ -401,11 +401,11 @@ public function getBlockChompingTests() two EOF; - $expected = array( + $expected = [ 'foo' => "one two\n", 'bar' => "one two\n", - ); - $tests['Folded block chomping keep with single trailing newline'] = array($expected, $yaml); + ]; + $tests['Folded block chomping keep with single trailing newline'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: >+ @@ -418,11 +418,11 @@ public function getBlockChompingTests() EOF; - $expected = array( + $expected = [ 'foo' => "one two\n\n", 'bar' => "one two\n\n", - ); - $tests['Folded block chomping keep with multiple trailing newlines'] = array($expected, $yaml); + ]; + $tests['Folded block chomping keep with multiple trailing newlines'] = [$expected, $yaml]; $yaml = <<<'EOF' foo: >+ @@ -432,11 +432,11 @@ public function getBlockChompingTests() one two EOF; - $expected = array( + $expected = [ 'foo' => "one two\n", 'bar' => 'one two', - ); - $tests['Folded block chomping keep without trailing newline'] = array($expected, $yaml); + ]; + $tests['Folded block chomping keep without trailing newline'] = [$expected, $yaml]; return $tests; } @@ -463,9 +463,9 @@ public function testBlockLiteralWithLeadingNewlines() bar EOF; - $expected = array( + $expected = [ 'foo' => "\n\nbar", - ); + ]; $this->assertSame($expected, $this->parser->parse($yaml)); } @@ -476,7 +476,7 @@ public function testObjectSupportEnabled() foo: !php/object O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";} bar: 1 EOF; - $this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, Yaml::PARSE_OBJECT), '->parse() is able to parse objects'); + $this->assertEquals(['foo' => new B(), 'bar' => 1], $this->parser->parse($input, Yaml::PARSE_OBJECT), '->parse() is able to parse objects'); } /** @@ -488,7 +488,7 @@ public function testObjectSupportEnabledPassingTrue() foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";} bar: 1 EOF; - $this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, false, true), '->parse() is able to parse objects'); + $this->assertEquals(['foo' => new B(), 'bar' => 1], $this->parser->parse($input, false, true), '->parse() is able to parse objects'); } /** @@ -497,25 +497,25 @@ public function testObjectSupportEnabledPassingTrue() */ public function testObjectSupportEnabledWithDeprecatedTag($yaml) { - $this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($yaml, Yaml::PARSE_OBJECT), '->parse() is able to parse objects'); + $this->assertEquals(['foo' => new B(), 'bar' => 1], $this->parser->parse($yaml, Yaml::PARSE_OBJECT), '->parse() is able to parse objects'); } public function deprecatedObjectValueProvider() { - return array( - array( + return [ + [ <<<YAML foo: !!php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";} bar: 1 YAML - ), - array( + ], + [ <<<YAML foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";} bar: 1 YAML - ), - ); + ], + ]; } /** @@ -523,7 +523,7 @@ public function deprecatedObjectValueProvider() */ public function testObjectSupportDisabledButNoExceptions($input) { - $this->assertEquals(array('foo' => null, 'bar' => 1), $this->parser->parse($input), '->parse() does not parse objects'); + $this->assertEquals(['foo' => null, 'bar' => 1], $this->parser->parse($input), '->parse() does not parse objects'); } /** @@ -547,7 +547,7 @@ public function testObjectForMapEnabledWithMappingUsingBooleanToggles($yaml, $ex public function getObjectForMapTests() { - $tests = array(); + $tests = []; $yaml = <<<'EOF' foo: @@ -555,20 +555,20 @@ public function getObjectForMapTests() EOF; $expected = new \stdClass(); $expected->foo = new \stdClass(); - $expected->foo->fiz = array('cat'); - $tests['mapping'] = array($yaml, $expected); + $expected->foo->fiz = ['cat']; + $tests['mapping'] = [$yaml, $expected]; $yaml = '{ "foo": "bar", "fiz": "cat" }'; $expected = new \stdClass(); $expected->foo = 'bar'; $expected->fiz = 'cat'; - $tests['inline-mapping'] = array($yaml, $expected); + $tests['inline-mapping'] = [$yaml, $expected]; $yaml = "foo: bar\nbaz: foobar"; $expected = new \stdClass(); $expected->foo = 'bar'; $expected->baz = 'foobar'; - $tests['object-for-map-is-applied-after-parsing'] = array($yaml, $expected); + $tests['object-for-map-is-applied-after-parsing'] = [$yaml, $expected]; $yaml = <<<'EOT' array: @@ -576,12 +576,12 @@ public function getObjectForMapTests() - key: two EOT; $expected = new \stdClass(); - $expected->array = array(); + $expected->array = []; $expected->array[0] = new \stdClass(); $expected->array[0]->key = 'one'; $expected->array[1] = new \stdClass(); $expected->array[1]->key = 'two'; - $tests['nest-map-and-sequence'] = array($yaml, $expected); + $tests['nest-map-and-sequence'] = [$yaml, $expected]; $yaml = <<<'YAML' map: @@ -592,7 +592,7 @@ public function getObjectForMapTests() $expected->map = new \stdClass(); $expected->map->{1} = 'one'; $expected->map->{2} = 'two'; - $tests['numeric-keys'] = array($yaml, $expected); + $tests['numeric-keys'] = [$yaml, $expected]; $yaml = <<<'YAML' map: @@ -603,7 +603,7 @@ public function getObjectForMapTests() $expected->map = new \stdClass(); $expected->map->{0} = 'one'; $expected->map->{1} = 'two'; - $tests['zero-indexed-numeric-keys'] = array($yaml, $expected); + $tests['zero-indexed-numeric-keys'] = [$yaml, $expected]; return $tests; } @@ -621,9 +621,9 @@ public function testCanParseContentWithTrailingSpaces() { $yaml = "items: \n foo: bar"; - $expected = array( - 'items' => array('foo' => 'bar'), - ); + $expected = [ + 'items' => ['foo' => 'bar'], + ]; $this->assertSame($expected, $this->parser->parse($yaml)); } @@ -649,10 +649,10 @@ public function invalidDumpedObjectProvider() bar: 1 EOF; - return array( - 'yaml-tag' => array($yamlTag), - 'local-tag' => array($localTag), - ); + return [ + 'yaml-tag' => [$yamlTag], + 'local-tag' => [$localTag], + ]; } /** @@ -660,11 +660,11 @@ public function invalidDumpedObjectProvider() */ public function testNonUtf8Exception() { - $yamls = array( + $yamls = [ iconv('UTF-8', 'ISO-8859-1', "foo: 'äöüß'"), iconv('UTF-8', 'ISO-8859-15', "euro: '€'"), iconv('UTF-8', 'CP1252', "cp1252: '©ÉÇáñ'"), - ); + ]; foreach ($yamls as $yaml) { try { @@ -755,19 +755,19 @@ public function testSequenceInMappingStartedBySingleDashLine() - foo d: e EOT; - $expected = array( - 'a' => array( - array( - 'b' => array( - array( + $expected = [ + 'a' => [ + [ + 'b' => [ + [ 'bar' => 'baz', - ), - ), - ), + ], + ], + ], 'foo', - ), + ], 'd' => 'e', - ); + ]; $this->assertSame($expected, $this->parser->parse($yaml)); } @@ -781,12 +781,12 @@ public function testSequenceFollowedByCommentEmbeddedInMapping() # comment d: e EOT; - $expected = array( - 'a' => array( - 'b' => array('c'), + $expected = [ + 'a' => [ + 'b' => ['c'], 'd' => 'e', - ), - ); + ], + ]; $this->assertSame($expected, $this->parser->parse($yaml)); } @@ -802,25 +802,25 @@ public function testNonStringFollowedByCommentEmbeddedInMapping() 1.1 # another comment EOT; - $expected = array( - 'a' => array( - 'b' => array(), + $expected = [ + 'a' => [ + 'b' => [], 'd' => 1.1, - ), - ); + ], + ]; $this->assertSame($expected, $this->parser->parse($yaml)); } public function getParseExceptionNotAffectedMultiLineStringLastResortParsing() { - $tests = array(); + $tests = []; $yaml = <<<'EOT' a b: EOT; - $tests['parse error on first line'] = array($yaml); + $tests['parse error on first line'] = [$yaml]; $yaml = <<<'EOT' a @@ -828,12 +828,12 @@ public function getParseExceptionNotAffectedMultiLineStringLastResortParsing() b c: EOT; - $tests['parse error due to inconsistent indentation'] = array($yaml); + $tests['parse error due to inconsistent indentation'] = [$yaml]; $yaml = <<<'EOT' & * ! | > ' " % @ ` #, { asd a;sdasd }-@^qw3 EOT; - $tests['symfony/symfony/issues/22967#issuecomment-322067742'] = array($yaml); + $tests['symfony/symfony/issues/22967#issuecomment-322067742'] = [$yaml]; return $tests; } @@ -855,9 +855,9 @@ public function testMultiLineStringLastResortParsing() true yes you can EOT; - $expected = array( + $expected = [ 'test' => 'You can have things that don\'t look like strings here true yes you can', - ); + ]; $this->assertSame($expected, $this->parser->parse($yaml)); @@ -866,9 +866,9 @@ public function testMultiLineStringLastResortParsing() b c EOT; - $expected = array( + $expected = [ 'a' => 'b c', - ); + ]; $this->assertSame($expected, $this->parser->parse($yaml)); } @@ -922,11 +922,11 @@ public function testMappingDuplicateKeyBlock() child: duplicate child: duplicate EOD; - $expected = array( - 'parent' => array( + $expected = [ + 'parent' => [ 'child' => 'first', - ), - ); + ], + ]; $this->assertSame($expected, Yaml::parse($input)); } @@ -939,11 +939,11 @@ public function testMappingDuplicateKeyFlow() parent: { child: first, child: duplicate } parent: { child: duplicate, child: duplicate } EOD; - $expected = array( - 'parent' => array( + $expected = [ + 'parent' => [ 'child' => 'first', - ), - ); + ], + ]; $this->assertSame($expected, Yaml::parse($input)); } @@ -960,30 +960,30 @@ public function testParseExceptionOnDuplicate($input, $duplicateKey, $lineNumber public function getParseExceptionOnDuplicateData() { - $tests = array(); + $tests = []; $yaml = <<<EOD parent: { child: first, child: duplicate } EOD; - $tests[] = array($yaml, 'child', 1); + $tests[] = [$yaml, 'child', 1]; $yaml = <<<EOD parent: child: first, child: duplicate EOD; - $tests[] = array($yaml, 'child', 3); + $tests[] = [$yaml, 'child', 3]; $yaml = <<<EOD parent: { child: foo } parent: { child: bar } EOD; - $tests[] = array($yaml, 'parent', 2); + $tests[] = [$yaml, 'parent', 2]; $yaml = <<<EOD parent: { child_mapping: { value: bar}, child_mapping: { value: bar} } EOD; - $tests[] = array($yaml, 'child_mapping', 1); + $tests[] = [$yaml, 'child_mapping', 1]; $yaml = <<<EOD parent: @@ -992,12 +992,12 @@ public function getParseExceptionOnDuplicateData() child_mapping: value: bar EOD; - $tests[] = array($yaml, 'child_mapping', 4); + $tests[] = [$yaml, 'child_mapping', 4]; $yaml = <<<EOD parent: { child_sequence: ['key1', 'key2', 'key3'], child_sequence: ['key1', 'key2', 'key3'] } EOD; - $tests[] = array($yaml, 'child_sequence', 1); + $tests[] = [$yaml, 'child_sequence', 1]; $yaml = <<<EOD parent: @@ -1010,7 +1010,7 @@ public function getParseExceptionOnDuplicateData() - key2 - key3 EOD; - $tests[] = array($yaml, 'child_sequence', 6); + $tests[] = [$yaml, 'child_sequence', 6]; return $tests; } @@ -1021,21 +1021,21 @@ public function testEmptyValue() hash: EOF; - $this->assertEquals(array('hash' => null), Yaml::parse($input)); + $this->assertEquals(['hash' => null], Yaml::parse($input)); } public function testCommentAtTheRootIndent() { - $this->assertEquals(array( - 'services' => array( - 'app.foo_service' => array( + $this->assertEquals([ + 'services' => [ + 'app.foo_service' => [ 'class' => 'Foo', - ), - 'app/bar_service' => array( + ], + 'app/bar_service' => [ 'class' => 'Bar', - ), - ), - ), Yaml::parse(<<<'EOF' + ], + ], + ], Yaml::parse(<<<'EOF' # comment 1 services: # comment 2 @@ -1052,7 +1052,7 @@ class: Bar public function testStringBlockWithComments() { - $this->assertEquals(array('content' => <<<'EOT' + $this->assertEquals(['content' => <<<'EOT' # comment 1 header @@ -1063,7 +1063,7 @@ public function testStringBlockWithComments() footer # comment3 EOT - ), Yaml::parse(<<<'EOF' + ], Yaml::parse(<<<'EOF' content: | # comment 1 header @@ -1080,7 +1080,7 @@ public function testStringBlockWithComments() public function testFoldedStringBlockWithComments() { - $this->assertEquals(array(array('content' => <<<'EOT' + $this->assertEquals([['content' => <<<'EOT' # comment 1 header @@ -1091,7 +1091,7 @@ public function testFoldedStringBlockWithComments() footer # comment3 EOT - )), Yaml::parse(<<<'EOF' + ]], Yaml::parse(<<<'EOF' - content: | # comment 1 @@ -1109,7 +1109,7 @@ public function testFoldedStringBlockWithComments() public function testNestedFoldedStringBlockWithComments() { - $this->assertEquals(array(array( + $this->assertEquals([[ 'title' => 'some title', 'content' => <<<'EOT' # comment 1 @@ -1122,7 +1122,7 @@ public function testNestedFoldedStringBlockWithComments() footer # comment3 EOT - )), Yaml::parse(<<<'EOF' + ]], Yaml::parse(<<<'EOF' - title: some title content: | @@ -1141,17 +1141,17 @@ public function testNestedFoldedStringBlockWithComments() public function testReferenceResolvingInInlineStrings() { - $this->assertEquals(array( + $this->assertEquals([ 'var' => 'var-value', 'scalar' => 'var-value', - 'list' => array('var-value'), - 'list_in_list' => array(array('var-value')), - 'map_in_list' => array(array('key' => 'var-value')), - 'embedded_mapping' => array(array('key' => 'var-value')), - 'map' => array('key' => 'var-value'), - 'list_in_map' => array('key' => array('var-value')), - 'map_in_map' => array('foo' => array('bar' => 'var-value')), - ), Yaml::parse(<<<'EOF' + 'list' => ['var-value'], + 'list_in_list' => [['var-value']], + 'map_in_list' => [['key' => 'var-value']], + 'embedded_mapping' => [['key' => 'var-value']], + 'map' => ['key' => 'var-value'], + 'list_in_map' => ['key' => ['var-value']], + 'map_in_map' => ['foo' => ['bar' => 'var-value']], + ], Yaml::parse(<<<'EOF' var: &var var-value scalar: *var list: [ *var ] @@ -1173,7 +1173,7 @@ public function testYamlDirective() foo: 1 bar: 2 EOF; - $this->assertEquals(array('foo' => 1, 'bar' => 2), $this->parser->parse($yaml)); + $this->assertEquals(['foo' => 1, 'bar' => 2], $this->parser->parse($yaml)); } /** @@ -1188,12 +1188,12 @@ public function testFloatKeys() 1.3: "baz" EOF; - $expected = array( - 'foo' => array( + $expected = [ + 'foo' => [ '1.2' => 'bar', '1.3' => 'baz', - ), - ); + ], + ]; $this->assertEquals($expected, $this->parser->parse($yaml)); } @@ -1209,10 +1209,10 @@ public function testBooleanKeys() false: bar EOF; - $expected = array( + $expected = [ 1 => 'foo', 0 => 'bar', - ); + ]; $this->assertEquals($expected, $this->parser->parse($yaml)); } @@ -1230,14 +1230,14 @@ public function testExplicitStringCasting() '~': 'null' EOF; - $expected = array( + $expected = [ '1.2' => 'bar', '1.3' => 'baz', 'true' => 'foo', 'false' => 'bar', 'null' => 'null', '~' => 'null', - ); + ]; $this->assertEquals($expected, $this->parser->parse($yaml)); } @@ -1262,7 +1262,7 @@ public function testColonInMappingValueExceptionNotTriggeredByColonInComment() bar: foobar # Note: a comment after a colon EOT; - $this->assertSame(array('foo' => array('bar' => 'foobar')), $this->parser->parse($yaml)); + $this->assertSame(['foo' => ['bar' => 'foobar']], $this->parser->parse($yaml)); } /** @@ -1275,7 +1275,7 @@ public function testCommentLikeStringsAreNotStrippedInBlockScalars($yaml, $expec public function getCommentLikeStringInScalarBlockData() { - $tests = array(); + $tests = []; $yaml = <<<'EOT' pages: @@ -1292,9 +1292,9 @@ public function getCommentLikeStringInScalarBlockData() footer # comment3 EOT; - $expected = array( - 'pages' => array( - array( + $expected = [ + 'pages' => [ + [ 'title' => 'some title', 'content' => <<<'EOT' # comment 1 @@ -1308,10 +1308,10 @@ public function getCommentLikeStringInScalarBlockData() footer # comment3 EOT , - ), - ), - ); - $tests[] = array($yaml, $expected); + ], + ], + ]; + $tests[] = [$yaml, $expected]; $yaml = <<<'EOT' test: | @@ -1328,7 +1328,7 @@ public function getCommentLikeStringInScalarBlockData() # bar baz EOT; - $expected = array( + $expected = [ 'test' => <<<'EOT' foo # bar @@ -1336,8 +1336,8 @@ public function getCommentLikeStringInScalarBlockData() EOT , - 'collection' => array( - array( + 'collection' => [ + [ 'one' => <<<'EOT' foo # bar @@ -1345,18 +1345,18 @@ public function getCommentLikeStringInScalarBlockData() EOT , - ), - array( + ], + [ 'two' => <<<'EOT' foo # bar baz EOT , - ), - ), - ); - $tests[] = array($yaml, $expected); + ], + ], + ]; + $tests[] = [$yaml, $expected]; $yaml = <<<'EOT' foo: @@ -1368,17 +1368,17 @@ public function getCommentLikeStringInScalarBlockData() # comment foobar: ~ EOT; - $expected = array( - 'foo' => array( - 'bar' => array( + $expected = [ + 'foo' => [ + 'bar' => [ 'scalar-block' => "line1 line2>\n", - ), - 'baz' => array( + ], + 'baz' => [ 'foobar' => null, - ), - ), - ); - $tests[] = array($yaml, $expected); + ], + ], + ]; + $tests[] = [$yaml, $expected]; $yaml = <<<'EOT' a: @@ -1388,13 +1388,13 @@ public function getCommentLikeStringInScalarBlockData() # second row d: hello EOT; - $expected = array( - 'a' => array( + $expected = [ + 'a' => [ 'b' => 'hello', 'd' => 'hello', - ), - ); - $tests[] = array($yaml, $expected); + ], + ]; + $tests[] = [$yaml, $expected]; return $tests; } @@ -1412,13 +1412,13 @@ public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks() EOT; $this->assertSame( - array( + [ 'test' => <<<'EOT' <h2>A heading</h2> <ul> <li>a list</li> <li>may be a good example</li> </ul> EOT , - ), + ], $this->parser->parse($yaml) ); } @@ -1436,7 +1436,7 @@ public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks() EOT; $this->assertSame( - array( + [ 'test' => <<<'EOT' <h2>A heading</h2> <ul> @@ -1445,7 +1445,7 @@ public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks() </ul> EOT , - ), + ], $this->parser->parse($yaml) ); } @@ -1455,28 +1455,28 @@ public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks() */ public function testParseBinaryData($data) { - $this->assertSame(array('data' => 'Hello world'), $this->parser->parse($data)); + $this->assertSame(['data' => 'Hello world'], $this->parser->parse($data)); } public function getBinaryData() { - return array( - 'enclosed with double quotes' => array('data: !!binary "SGVsbG8gd29ybGQ="'), - 'enclosed with single quotes' => array("data: !!binary 'SGVsbG8gd29ybGQ='"), - 'containing spaces' => array('data: !!binary "SGVs bG8gd 29ybGQ="'), - 'in block scalar' => array( + return [ + 'enclosed with double quotes' => ['data: !!binary "SGVsbG8gd29ybGQ="'], + 'enclosed with single quotes' => ["data: !!binary 'SGVsbG8gd29ybGQ='"], + 'containing spaces' => ['data: !!binary "SGVs bG8gd 29ybGQ="'], + 'in block scalar' => [ <<<'EOT' data: !!binary | SGVsbG8gd29ybGQ= EOT - ), - 'containing spaces in block scalar' => array( + ], + 'containing spaces in block scalar' => [ <<<'EOT' data: !!binary | SGVs bG8gd 29ybGQ= EOT - ), - ); + ], + ]; } /** @@ -1496,44 +1496,44 @@ public function testParseInvalidBinaryData($data, $expectedMessage) public function getInvalidBinaryData() { - return array( - 'length not a multiple of four' => array('data: !!binary "SGVsbG8d29ybGQ="', '/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/'), - 'invalid characters' => array('!!binary "SGVsbG8#d29ybGQ="', '/The base64 encoded data \(.*\) contains invalid characters/'), - 'too many equals characters' => array('data: !!binary "SGVsbG8gd29yb==="', '/The base64 encoded data \(.*\) contains invalid characters/'), - 'misplaced equals character' => array('data: !!binary "SGVsbG8gd29ybG=Q"', '/The base64 encoded data \(.*\) contains invalid characters/'), - 'length not a multiple of four in block scalar' => array( + return [ + 'length not a multiple of four' => ['data: !!binary "SGVsbG8d29ybGQ="', '/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/'], + 'invalid characters' => ['!!binary "SGVsbG8#d29ybGQ="', '/The base64 encoded data \(.*\) contains invalid characters/'], + 'too many equals characters' => ['data: !!binary "SGVsbG8gd29yb==="', '/The base64 encoded data \(.*\) contains invalid characters/'], + 'misplaced equals character' => ['data: !!binary "SGVsbG8gd29ybG=Q"', '/The base64 encoded data \(.*\) contains invalid characters/'], + 'length not a multiple of four in block scalar' => [ <<<'EOT' data: !!binary | SGVsbG8d29ybGQ= EOT , '/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/', - ), - 'invalid characters in block scalar' => array( + ], + 'invalid characters in block scalar' => [ <<<'EOT' data: !!binary | SGVsbG8#d29ybGQ= EOT , '/The base64 encoded data \(.*\) contains invalid characters/', - ), - 'too many equals characters in block scalar' => array( + ], + 'too many equals characters in block scalar' => [ <<<'EOT' data: !!binary | SGVsbG8gd29yb=== EOT , '/The base64 encoded data \(.*\) contains invalid characters/', - ), - 'misplaced equals character in block scalar' => array( + ], + 'misplaced equals character in block scalar' => [ <<<'EOT' data: !!binary | SGVsbG8gd29ybG=Q EOT , '/The base64 encoded data \(.*\) contains invalid characters/', - ), - ); + ], + ]; } public function testParseDateAsMappingValue() @@ -1546,7 +1546,7 @@ public function testParseDateAsMappingValue() $expectedDate->setDate(2002, 12, 14); $expectedDate->setTime(0, 0, 0); - $this->assertEquals(array('date' => $expectedDate), $this->parser->parse($yaml, Yaml::PARSE_DATETIME)); + $this->assertEquals(['date' => $expectedDate], $this->parser->parse($yaml, Yaml::PARSE_DATETIME)); } /** @@ -1568,8 +1568,8 @@ public function testParserThrowsExceptionWithCorrectLineNumber($lineNumber, $yam public function parserThrowsExceptionWithCorrectLineNumberProvider() { - return array( - array( + return [ + [ 4, <<<'YAML' foo: @@ -1577,8 +1577,8 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider() # bar bar: "123", YAML - ), - array( + ], + [ 5, <<<'YAML' foo: @@ -1587,8 +1587,8 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider() # bar bar: "123", YAML - ), - array( + ], + [ 8, <<<'YAML' foo: @@ -1600,8 +1600,8 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider() # bar bar: "123", YAML - ), - array( + ], + [ 10, <<<'YAML' foo: @@ -1615,8 +1615,8 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider() # bar bar: "123", YAML - ), - ); + ], + ]; } public function testParseMultiLineQuotedString() @@ -1629,7 +1629,7 @@ public function testParseMultiLineQuotedString() bar: baz EOT; - $this->assertSame(array('foo' => 'bar baz foobar foo', 'bar' => 'baz'), $this->parser->parse($yaml)); + $this->assertSame(['foo' => 'bar baz foobar foo', 'bar' => 'baz'], $this->parser->parse($yaml)); } public function testMultiLineQuotedStringWithTrailingBackslash() @@ -1640,7 +1640,7 @@ public function testMultiLineQuotedStringWithTrailingBackslash() bar" YAML; - $this->assertSame(array('foobar' => 'foobar'), $this->parser->parse($yaml)); + $this->assertSame(['foobar' => 'foobar'], $this->parser->parse($yaml)); } public function testCommentCharactersInMultiLineQuotedStrings() @@ -1651,12 +1651,12 @@ public function testCommentCharactersInMultiLineQuotedStrings() #bar' bar: baz YAML; - $expected = array( - 'foo' => array( + $expected = [ + 'foo' => [ 'foobar' => 'foo #bar', 'bar' => 'baz', - ), - ); + ], + ]; $this->assertSame($expected, $this->parser->parse($yaml)); } @@ -1668,9 +1668,9 @@ public function testBlankLinesInQuotedMultiLineString() bar' YAML; - $expected = array( + $expected = [ 'foobar' => "foo\nbar", - ); + ]; $this->assertSame($expected, $this->parser->parse($yaml)); } @@ -1685,7 +1685,7 @@ public function testParseMultiLineUnquotedString() bar: baz EOT; - $this->assertSame(array('foo' => 'bar baz foobar foo', 'bar' => 'baz'), $this->parser->parse($yaml)); + $this->assertSame(['foo' => 'bar baz foobar foo', 'bar' => 'baz'], $this->parser->parse($yaml)); } public function testParseMultiLineString() @@ -1703,7 +1703,7 @@ public function testParseMultiLineMappingValue($yaml, $expected, $parseError) public function multiLineDataProvider() { - $tests = array(); + $tests = []; $yaml = <<<'EOF' foo: @@ -1713,15 +1713,15 @@ public function multiLineDataProvider() two three EOF; - $expected = array( - 'foo' => array( - array( + $expected = [ + 'foo' => [ + [ 'bar' => "one\ntwo three", - ), - ), - ); + ], + ], + ]; - $tests[] = array($yaml, $expected, false); + $tests[] = [$yaml, $expected, false]; $yaml = <<<'EOF' bar @@ -1729,7 +1729,7 @@ public function multiLineDataProvider() EOF; $expected = 'bar "foo"'; - $tests[] = array($yaml, $expected, false); + $tests[] = [$yaml, $expected, false]; $yaml = <<<'EOF' bar @@ -1737,7 +1737,7 @@ public function multiLineDataProvider() EOF; $expected = 'bar "foo'; - $tests[] = array($yaml, $expected, false); + $tests[] = [$yaml, $expected, false]; $yaml = <<<'EOF' bar @@ -1746,7 +1746,7 @@ public function multiLineDataProvider() EOF; $expected = "bar\n'foo'"; - $tests[] = array($yaml, $expected, false); + $tests[] = [$yaml, $expected, false]; $yaml = <<<'EOF' bar @@ -1755,14 +1755,14 @@ public function multiLineDataProvider() EOF; $expected = "bar\nfoo'"; - $tests[] = array($yaml, $expected, false); + $tests[] = [$yaml, $expected, false]; return $tests; } public function testTaggedInlineMapping() { - $this->assertEquals(new TaggedValue('foo', array('foo' => 'bar')), $this->parser->parse('!foo {foo: bar}', Yaml::PARSE_CUSTOM_TAGS)); + $this->assertEquals(new TaggedValue('foo', ['foo' => 'bar']), $this->parser->parse('!foo {foo: bar}', Yaml::PARSE_CUSTOM_TAGS)); } /** @@ -1775,32 +1775,32 @@ public function testCustomTagSupport($expected, $yaml) public function taggedValuesProvider() { - return array( - 'sequences' => array( - array(new TaggedValue('foo', array('yaml')), new TaggedValue('quz', array('bar'))), + return [ + 'sequences' => [ + [new TaggedValue('foo', ['yaml']), new TaggedValue('quz', ['bar'])], <<<YAML - !foo - yaml - !quz [bar] YAML - ), - 'mappings' => array( - new TaggedValue('foo', array('foo' => new TaggedValue('quz', array('bar')), 'quz' => new TaggedValue('foo', array('quz' => 'bar')))), + ], + 'mappings' => [ + new TaggedValue('foo', ['foo' => new TaggedValue('quz', ['bar']), 'quz' => new TaggedValue('foo', ['quz' => 'bar'])]), <<<YAML !foo foo: !quz [bar] quz: !foo quz: bar YAML - ), - 'inline' => array( - array(new TaggedValue('foo', array('foo', 'bar')), new TaggedValue('quz', array('foo' => 'bar', 'quz' => new TaggedValue('bar', array('one' => 'bar'))))), + ], + 'inline' => [ + [new TaggedValue('foo', ['foo', 'bar']), new TaggedValue('quz', ['foo' => 'bar', 'quz' => new TaggedValue('bar', ['one' => 'bar'])])], <<<YAML - !foo [foo, bar] - !quz {foo: bar, quz: !bar {one: bar}} YAML - ), - ); + ], + ]; } /** @@ -1895,7 +1895,7 @@ private function loadTestsFromFixtureFiles($testsFile) { $parser = new Parser(); - $tests = array(); + $tests = []; $files = $parser->parseFile(__DIR__.'/Fixtures/'.$testsFile); foreach ($files as $file) { $yamls = file_get_contents(__DIR__.'/Fixtures/'.$file.'.yml'); @@ -1912,7 +1912,7 @@ private function loadTestsFromFixtureFiles($testsFile) } else { eval('$expected = '.trim($test['php']).';'); - $tests[] = array(var_export($expected, true), $test['yaml'], $test['test'], isset($test['deprecated']) ? $test['deprecated'] : false); + $tests[] = [var_export($expected, true), $test['yaml'], $test['test'], isset($test['deprecated']) ? $test['deprecated'] : false]; } } } @@ -1923,7 +1923,7 @@ private function loadTestsFromFixtureFiles($testsFile) public function testCanParseVeryLongValue() { $longStringWithSpaces = str_repeat('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ', 20000); - $trickyVal = array('x' => $longStringWithSpaces); + $trickyVal = ['x' => $longStringWithSpaces]; $yamlString = Yaml::dump($trickyVal); $arrayFromYaml = $this->parser->parse($yamlString); @@ -1961,16 +1961,16 @@ public function testPhpConstantTagMappingKey() - !php/const 'Symfony\Component\Yaml\Tests\B::BAR' to: !php/const 'Symfony\Component\Yaml\Tests\B::BAZ' YAML; - $expected = array( - 'transitions' => array( - 'foo' => array( - 'from' => array( + $expected = [ + 'transitions' => [ + 'foo' => [ + 'from' => [ 'bar', - ), + ], 'to' => 'baz', - ), - ), - ); + ], + ], + ]; $this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT)); } @@ -1990,16 +1990,16 @@ public function testDeprecatedPhpConstantTagMappingKey() - !php/const:Symfony\Component\Yaml\Tests\B::BAR to: !php/const:Symfony\Component\Yaml\Tests\B::BAZ YAML; - $expected = array( - 'transitions' => array( - 'foo' => array( - 'from' => array( + $expected = [ + 'transitions' => [ + 'foo' => [ + 'from' => [ 'bar', - ), + ], 'to' => 'baz', - ), - ), - ); + ], + ], + ]; $this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT)); } @@ -2017,16 +2017,16 @@ public function testPhpConstantTagMappingKeyWithKeysCastToStrings() - !php/const 'Symfony\Component\Yaml\Tests\B::BAR' to: !php/const 'Symfony\Component\Yaml\Tests\B::BAZ' YAML; - $expected = array( - 'transitions' => array( - 'foo' => array( - 'from' => array( + $expected = [ + 'transitions' => [ + 'foo' => [ + 'from' => [ 'bar', - ), + ], 'to' => 'baz', - ), - ), - ); + ], + ], + ]; $this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT | Yaml::PARSE_KEYS_AS_STRINGS)); } @@ -2047,23 +2047,23 @@ public function testMergeKeysWhenMappingsAreParsedAsObjects() bar: ~ <<: [*FOO, *BAR] YAML; - $expected = (object) array( - 'foo' => (object) array( + $expected = (object) [ + 'foo' => (object) [ 'bar' => 1, - ), - 'bar' => (object) array( + ], + 'bar' => (object) [ 'baz' => 2, 'bar' => 1, - ), - 'baz' => (object) array( + ], + 'baz' => (object) [ 'baz_foo' => 3, 'baz_bar' => 4, - ), - 'foobar' => (object) array( + ], + 'foobar' => (object) [ 'bar' => null, 'baz' => 2, - ), - ); + ], + ]; $this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP)); } @@ -2099,6 +2099,10 @@ public function testParsingNotReadableFilesThrowsException() $this->markTestSkipped('chmod is not supported on Windows'); } + if (!getenv('USER') || 'root' === getenv('USER')) { + $this->markTestSkipped('This test will fail if run under superuser'); + } + $file = __DIR__.'/Fixtures/not_readable.yml'; chmod($file, 0200); @@ -2117,18 +2121,18 @@ public function testParseReferencesOnMergeKeys() d: quux <<: *quux YAML; - $expected = array( - 'mergekeyrefdef' => array( + $expected = [ + 'mergekeyrefdef' => [ 'a' => 'foo', 'b' => 'bar', 'c' => 'baz', - ), - 'mergekeyderef' => array( + ], + 'mergekeyderef' => [ 'd' => 'quux', 'b' => 'bar', 'c' => 'baz', - ), - ); + ], + ]; $this->assertSame($expected, $this->parser->parse($yaml)); } @@ -2145,18 +2149,18 @@ public function testParseReferencesOnMergeKeysWithMappingsParsedAsObjects() d: quux <<: *quux YAML; - $expected = (object) array( - 'mergekeyrefdef' => (object) array( + $expected = (object) [ + 'mergekeyrefdef' => (object) [ 'a' => 'foo', 'b' => 'bar', 'c' => 'baz', - ), - 'mergekeyderef' => (object) array( + ], + 'mergekeyderef' => (object) [ 'd' => 'quux', 'b' => 'bar', 'c' => 'baz', - ), - ); + ], + ]; $this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP)); } @@ -2173,6 +2177,48 @@ public function testEvalRefException() $this->parser->parse($yaml); } + /** + * @dataProvider circularReferenceProvider + * @expectedException \Symfony\Component\Yaml\Exception\ParseException + * @expectedExceptionMessage Circular reference [foo, bar, foo] detected + */ + public function testDetectCircularReferences($yaml) + { + $this->parser->parse($yaml, Yaml::PARSE_CUSTOM_TAGS); + } + + public function circularReferenceProvider() + { + $tests = []; + + $yaml = <<<YAML +foo: + - &foo + - &bar + bar: foobar + baz: *foo +YAML; + $tests['sequence'] = [$yaml]; + + $yaml = <<<YAML +foo: &foo + bar: &bar + foobar: baz + baz: *foo +YAML; + $tests['mapping'] = [$yaml]; + + $yaml = <<<YAML +foo: &foo + bar: &bar + foobar: baz + <<: *foo +YAML; + $tests['mapping with merge key'] = [$yaml]; + + return $tests; + } + /** * @dataProvider indentedMappingData */ @@ -2183,7 +2229,7 @@ public function testParseIndentedMappings($yaml, $expected) public function indentedMappingData() { - $tests = array(); + $tests = []; $yaml = <<<YAML foo: @@ -2191,15 +2237,15 @@ public function indentedMappingData() # A comment baz: "foobaz" YAML; - $expected = array( - 'foo' => array( - array( + $expected = [ + 'foo' => [ + [ 'bar' => 'foobar', 'baz' => 'foobaz', - ), - ), - ); - $tests['comment line is first line in indented block'] = array($yaml, $expected); + ], + ], + ]; + $tests['comment line is first line in indented block'] = [$yaml, $expected]; $yaml = <<<YAML foo: @@ -2207,42 +2253,42 @@ public function indentedMappingData() # comment baz: [1, 2, 3] YAML; - $expected = array( - 'foo' => array( - array( - 'bar' => array( - 'baz' => array(1, 2, 3), - ), - ), - ), - ); - $tests['mapping value on new line starting with a comment line'] = array($yaml, $expected); + $expected = [ + 'foo' => [ + [ + 'bar' => [ + 'baz' => [1, 2, 3], + ], + ], + ], + ]; + $tests['mapping value on new line starting with a comment line'] = [$yaml, $expected]; $yaml = <<<YAML foo: - bar: foobar YAML; - $expected = array( - 'foo' => array( - array( + $expected = [ + 'foo' => [ + [ 'bar' => 'foobar', - ), - ), - ); - $tests['mapping in sequence starting on a new line'] = array($yaml, $expected); + ], + ], + ]; + $tests['mapping in sequence starting on a new line'] = [$yaml, $expected]; $yaml = <<<YAML foo: bar: baz YAML; - $expected = array( - 'foo' => array( + $expected = [ + 'foo' => [ 'bar' => 'baz', - ), - ); - $tests['blank line at the beginning of an indented mapping value'] = array($yaml, $expected); + ], + ]; + $tests['blank line at the beginning of an indented mapping value'] = [$yaml, $expected]; return $tests; } diff --git a/vendor/symfony/yaml/Tests/YamlTest.php b/vendor/symfony/yaml/Tests/YamlTest.php index 3f6c2525f755cfbd0fb8c78ea50b1f7138d99ca7..5a792c51160a1322f92f84133b248adf41c16769 100644 --- a/vendor/symfony/yaml/Tests/YamlTest.php +++ b/vendor/symfony/yaml/Tests/YamlTest.php @@ -18,7 +18,7 @@ class YamlTest extends TestCase { public function testParseAndDump() { - $data = array('lorem' => 'ipsum', 'dolor' => 'sit'); + $data = ['lorem' => 'ipsum', 'dolor' => 'sit']; $yml = Yaml::dump($data); $parsed = Yaml::parse($yml); $this->assertEquals($data, $parsed); @@ -30,7 +30,7 @@ public function testParseAndDump() */ public function testZeroIndentationThrowsException() { - Yaml::dump(array('lorem' => 'ipsum', 'dolor' => 'sit'), 2, 0); + Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, 0); } /** @@ -39,6 +39,6 @@ public function testZeroIndentationThrowsException() */ public function testNegativeIndentationThrowsException() { - Yaml::dump(array('lorem' => 'ipsum', 'dolor' => 'sit'), 2, -4); + Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, -4); } } diff --git a/vendor/symfony/yaml/Yaml.php b/vendor/symfony/yaml/Yaml.php index 97abd6600786bea92e41c7428f84d5d906b3ab01..17db7659c1f669268d5c623bdc7b3627df9b8aca 100644 --- a/vendor/symfony/yaml/Yaml.php +++ b/vendor/symfony/yaml/Yaml.php @@ -42,11 +42,10 @@ class Yaml /** * Parses a YAML file into a PHP value. * - * Usage: - * <code> - * $array = Yaml::parseFile('config.yml'); - * print_r($array); - * </code> + * Usage: + * + * $array = Yaml::parseFile('config.yml'); + * print_r($array); * * @param string $filename The path to the YAML file to be parsed * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior diff --git a/vendor/symfony/yaml/phpunit.xml.dist b/vendor/symfony/yaml/phpunit.xml.dist index 7c732f8a783589c353d62a5b930f3f60e59d0f90..b5d4d914f8a4e1decbd9923767f99f37a91983ca 100644 --- a/vendor/symfony/yaml/phpunit.xml.dist +++ b/vendor/symfony/yaml/phpunit.xml.dist @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" diff --git a/vendor/twig/twig/.php_cs.dist b/vendor/twig/twig/.php_cs.dist index d249ffbe46ad5be6f874d5096468743c1a6deaea..1b31c0a3dc77579156af206c683931c3e10a03be 100644 --- a/vendor/twig/twig/.php_cs.dist +++ b/vendor/twig/twig/.php_cs.dist @@ -1,16 +1,18 @@ <?php return PhpCsFixer\Config::create() - ->setRules(array( + ->setRules([ '@Symfony' => true, '@Symfony:risky' => true, - 'array_syntax' => array('syntax' => 'long'), - 'php_unit_fqcn_annotation' => false, + 'array_syntax' => ['syntax' => 'short'], + 'php_unit_fqcn_annotation' => true, 'no_unreachable_default_argument_value' => false, - 'braces' => array('allow_single_line_closure' => true), + 'braces' => ['allow_single_line_closure' => true], 'heredoc_to_nowdoc' => false, - 'dir_constant' => false, - )) + 'ordered_imports' => true, + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], + 'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'all'], + ]) ->setRiskyAllowed(true) ->setFinder(PhpCsFixer\Finder::create()->in(__DIR__)) ; diff --git a/vendor/twig/twig/.travis.yml b/vendor/twig/twig/.travis.yml index d70399ca1cdf458c49025d3245859eff1eaf444c..f917348ca95b1614adcf19ac1dd8429568a46a17 100644 --- a/vendor/twig/twig/.travis.yml +++ b/vendor/twig/twig/.travis.yml @@ -14,7 +14,7 @@ php: - 7.0 - 7.1 - 7.2 - - nightly + - 7.3 env: - TWIG_EXT=no @@ -30,22 +30,11 @@ before_script: - if [ "$TWIG_EXT" == "yes" ]; then sh -c "cd ext/twig && phpize && ./configure --enable-twig && make && make install"; fi - if [ "$TWIG_EXT" == "yes" ]; then echo "extension=twig.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi -script: | - if [[ $TRAVIS_PHP_VERSION = 7.* || $TRAVIS_PHP_VERSION = nightly ]]; then - SYMFONY_PHPUNIT_VERSION=6.1 ./vendor/bin/simple-phpunit - else - ./vendor/bin/simple-phpunit - fi +script: ./vendor/bin/simple-phpunit matrix: fast_finish: true include: - - php: 5.3 - dist: precise - env: TWIG_EXT=yes - - php: 5.3 - dist: precise - env: TWIG_EXT=no - php: 5.4 env: TWIG_EXT=yes - php: 5.5 diff --git a/vendor/twig/twig/CHANGELOG b/vendor/twig/twig/CHANGELOG index e270288952ab820c37f630261aadb632e2448d92..2c563cf95c010914f45f91fdc576d5fced46dcce 100644 --- a/vendor/twig/twig/CHANGELOG +++ b/vendor/twig/twig/CHANGELOG @@ -1,3 +1,58 @@ +* 1.38.2 (2019-03-12) + + * added TemplateWrapper::getTemplateName() + +* 1.38.1 (2019-03-12) + + * fixed class aliases + +* 1.38.0 (2019-03-12) + + * fixed sandbox security issue (under some circumstances, calling the + __toString() method on an object was possible even if not allowed by the + security policy) + * fixed batch filter clobbers array keys when fill parameter is used + * added preserveKeys support for the batch filter + * fixed "embed" support when used from "template_from_string" + * added the possibility to pass a TemplateWrapper to Twig\Environment::load() + * improved the performance of the sandbox + * added a spaceless filter + * added max value to the "random" function + * made namespace classes the default classes (PSR-0 ones are aliases now) + * removed duplicated directory separator in FilesystemLoader + * added Twig\Loader\ChainLoader::getLoaders() + * changed internal code to use the namespaced classes as much as possible + +* 1.37.1 (2019-01-14) + + * fixed regression (key exists check for non ArrayObject objects) + * fixed logic in TemplateWrapper + +* 1.37.0 (2019-01-14) + + * fixed ArrayObject access with a null value + * fixed embedded templates starting with a BOM + * fixed using a Twig_TemplateWrapper instance as an argument to extends + * switched generated code to use the PHP short array notation + * dropped PHP 5.3 support + * fixed float representation in compiled templates + * added a second argument to the join filter (last separator configuration) + +* 1.36.0 (2018-12-16) + + * made sure twig_include returns a string + * fixed multi-byte UFT-8 in escape('html_attr') + * added the "deprecated" tag + * added support for dynamically named tests + * fixed GlobalsInterface extended class + * fixed filesystem loader throwing an exception instead of returning false + +* 1.35.4 (2018-07-13) + + * ensured that syntax errors are triggered with the right line + * added the Symfony ctype polyfill as a dependency + * "js" filter now produces valid JSON + * 1.35.3 (2018-03-20) * fixed block names unicity diff --git a/vendor/twig/twig/LICENSE b/vendor/twig/twig/LICENSE index e401cb971e519002538317bb781d02e28f2a273a..d06ced2a39c59b2112fb5524ddde48234fc7cee4 100644 --- a/vendor/twig/twig/LICENSE +++ b/vendor/twig/twig/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009-2018 by the Twig Team. +Copyright (c) 2009-2019 by the Twig Team. Some rights reserved. diff --git a/vendor/twig/twig/README.rst b/vendor/twig/twig/README.rst index 81737b0b2c2b6981325e762a43518c56dc0ca3e8..f33ea336d86366f61f6941a0120e3515f01e7bb1 100644 --- a/vendor/twig/twig/README.rst +++ b/vendor/twig/twig/README.rst @@ -12,4 +12,4 @@ More Information Read the `documentation`_ for more information. -.. _documentation: http://twig.sensiolabs.org/documentation +.. _documentation: https://twig.symfony.com/documentation diff --git a/vendor/twig/twig/composer.json b/vendor/twig/twig/composer.json index 7dab3034e9f0db3c894334e000db715ec98f13d5..7eae2f0759995696410e87c0b676afedb1fbfdac 100644 --- a/vendor/twig/twig/composer.json +++ b/vendor/twig/twig/composer.json @@ -3,7 +3,7 @@ "type": "library", "description": "Twig, the flexible, fast, and secure template language for PHP", "keywords": ["templating"], - "homepage": "http://twig.sensiolabs.org", + "homepage": "https://twig.symfony.com", "license": "BSD-3-Clause", "authors": [ { @@ -14,7 +14,7 @@ }, { "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", + "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" }, { @@ -23,14 +23,12 @@ "role": "Project Founder" } ], - "support": { - "forum": "https://groups.google.com/forum/#!forum/twig-users" - }, "require": { - "php": ">=5.3.3" + "php": ">=5.4.0", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { - "symfony/phpunit-bridge": "^3.3", + "symfony/phpunit-bridge": "^3.4.19|^4.1.8", "symfony/debug": "^2.7", "psr/container": "^1.0" }, @@ -44,7 +42,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.35-dev" + "dev-master": "1.38-dev" } } } diff --git a/vendor/twig/twig/doc/advanced.rst b/vendor/twig/twig/doc/advanced.rst index fadc947bb0d0d1d21609772c55e0d798eb93e7eb..9cf9ca6c1ec227e2a1e90ad9ff85b75dd17dcab4 100644 --- a/vendor/twig/twig/doc/advanced.rst +++ b/vendor/twig/twig/doc/advanced.rst @@ -114,7 +114,7 @@ Globals A global variable is like any other template variable, except that it's available in all templates and macros:: - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); $twig->addGlobal('text', new Text()); You can then use the ``text`` variable anywhere in a template: @@ -129,29 +129,29 @@ Filters Creating a filter is as simple as associating a name with a PHP callable:: // an anonymous function - $filter = new Twig_SimpleFilter('rot13', function ($string) { + $filter = new \Twig\TwigFilter('rot13', function ($string) { return str_rot13($string); }); // or a simple PHP function - $filter = new Twig_SimpleFilter('rot13', 'str_rot13'); + $filter = new \Twig\TwigFilter('rot13', 'str_rot13'); // or a class static method - $filter = new Twig_SimpleFilter('rot13', array('SomeClass', 'rot13Filter')); - $filter = new Twig_SimpleFilter('rot13', 'SomeClass::rot13Filter'); + $filter = new \Twig\TwigFilter('rot13', ['SomeClass', 'rot13Filter']); + $filter = new \Twig\TwigFilter('rot13', 'SomeClass::rot13Filter'); // or a class method - $filter = new Twig_SimpleFilter('rot13', array($this, 'rot13Filter')); + $filter = new \Twig\TwigFilter('rot13', [$this, 'rot13Filter']); // the one below needs a runtime implementation (see below for more information) - $filter = new Twig_SimpleFilter('rot13', array('SomeClass', 'rot13Filter')); + $filter = new \Twig\TwigFilter('rot13', ['SomeClass', 'rot13Filter']); -The first argument passed to the ``Twig_SimpleFilter`` constructor is the name +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:: - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); $twig->addFilter($filter); And here is how to use it in a template: @@ -178,10 +178,10 @@ is compiled to something like the following:: <?php echo strtolower('TWIG') ?> <?php echo twig_date_format_filter($now, 'd/m/Y') ?> -The ``Twig_SimpleFilter`` class takes an array of options as its last +The ``\Twig\TwigFilter`` class takes an array of options as its last argument:: - $filter = new Twig_SimpleFilter('rot13', 'str_rot13', $options); + $filter = new \Twig\TwigFilter('rot13', 'str_rot13', $options); Environment-aware Filters ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -190,12 +190,12 @@ If you want to access the current environment instance in your filter, set the ``needs_environment`` option to ``true``; Twig will pass the current environment as the first argument to the filter call:: - $filter = new Twig_SimpleFilter('rot13', function (Twig_Environment $env, $string) { + $filter = new \Twig\TwigFilter('rot13', function (Twig_Environment $env, $string) { // get the current charset for instance $charset = $env->getCharset(); return str_rot13($string); - }, array('needs_environment' => true)); + }, ['needs_environment' => true]); Context-aware Filters ~~~~~~~~~~~~~~~~~~~~~ @@ -205,13 +205,13 @@ If you want to access the current context in your filter, set the the first argument to the filter call (or the second one if ``needs_environment`` is also set to ``true``):: - $filter = new Twig_SimpleFilter('rot13', function ($context, $string) { + $filter = new \Twig\TwigFilter('rot13', function ($context, $string) { // ... - }, array('needs_context' => true)); + }, ['needs_context' => true]); - $filter = new Twig_SimpleFilter('rot13', function (Twig_Environment $env, $context, $string) { + $filter = new \Twig\TwigFilter('rot13', function (Twig_Environment $env, $context, $string) { // ... - }, array('needs_context' => true, 'needs_environment' => true)); + }, ['needs_context' => true, 'needs_environment' => true]); Automatic Escaping ~~~~~~~~~~~~~~~~~~ @@ -221,14 +221,14 @@ before printing. If your filter acts as an escaper (or explicitly outputs HTML or JavaScript code), you will want the raw output to be printed. In such a case, set the ``is_safe`` option:: - $filter = new Twig_SimpleFilter('nl2br', 'nl2br', array('is_safe' => array('html'))); + $filter = new \Twig\TwigFilter('nl2br', 'nl2br', ['is_safe' => ['html']]); Some filters may need to work on input that is already escaped or safe, for example when adding (safe) HTML tags to originally unsafe output. In such a case, set the ``pre_escape`` option to escape the input data before it is run through your filter:: - $filter = new Twig_SimpleFilter('somefilter', 'somefilter', array('pre_escape' => 'html', 'is_safe' => array('html'))); + $filter = new \Twig\TwigFilter('somefilter', 'somefilter', ['pre_escape' => 'html', 'is_safe' => ['html']]); Variadic Filters ~~~~~~~~~~~~~~~~ @@ -240,12 +240,13 @@ When a filter should accept an arbitrary number of arguments, set the ``is_variadic`` option to ``true``; Twig will pass the extra arguments as the last argument to the filter call as an array:: - $filter = new Twig_SimpleFilter('thumbnail', function ($file, array $options = array()) { + $filter = new \Twig\TwigFilter('thumbnail', function ($file, array $options = []) { // ... - }, array('is_variadic' => true)); + }, ['is_variadic' => true]); -Be warned that named arguments passed to a variadic filter cannot be checked -for validity as they will automatically end up in the option array. +Be warned that :ref:`named arguments <named-arguments>` passed to a variadic +filter cannot be checked for validity as they will automatically end up in the +option array. Dynamic Filters ~~~~~~~~~~~~~~~ @@ -253,7 +254,7 @@ Dynamic Filters A filter name containing the special ``*`` character is a dynamic filter as the ``*`` can be any string:: - $filter = new Twig_SimpleFilter('*_path', function ($name, $arguments) { + $filter = new \Twig\TwigFilter('*_path', function ($name, $arguments) { // ... }); @@ -264,7 +265,7 @@ The following filters will be matched by the above defined dynamic filter: A dynamic filter can define more than one dynamic parts:: - $filter = new Twig_SimpleFilter('*_path_*', function ($name, $suffix, $arguments) { + $filter = new \Twig\TwigFilter('*_path_*', function ($name, $suffix, $arguments) { // ... }); @@ -283,9 +284,9 @@ You can mark a filter as being deprecated by setting the ``deprecated`` option to ``true``. You can also give an alternative filter that replaces the deprecated one when that makes sense:: - $filter = new Twig_SimpleFilter('obsolete', function () { + $filter = new \Twig\TwigFilter('obsolete', function () { // ... - }, array('deprecated' => true, 'alternative' => 'new_one')); + }, ['deprecated' => true, 'alternative' => 'new_one']); When a filter is deprecated, Twig emits a deprecation notice when compiling a template using it. See :ref:`deprecation-notices` for more information. @@ -294,10 +295,10 @@ Functions --------- Functions are defined in the exact same way as filters, but you need to create -an instance of ``Twig_SimpleFunction``:: +an instance of ``\Twig\TwigFunction``:: - $twig = new Twig_Environment($loader); - $function = new Twig_SimpleFunction('function_name', function () { + $twig = new \Twig\Environment($loader); + $function = new \Twig\TwigFunction('function_name', function () { // ... }); $twig->addFunction($function); @@ -309,10 +310,10 @@ Tests ----- Tests are defined in the exact same way as filters and functions, but you need -to create an instance of ``Twig_SimpleTest``:: +to create an instance of ``\Twig\TwigTest``:: - $twig = new Twig_Environment($loader); - $test = new Twig_SimpleTest('test_name', function () { + $twig = new \Twig\Environment($loader); + $test = new \Twig\TwigTest('test_name', function () { // ... }); $twig->addTest($test); @@ -321,8 +322,8 @@ Tests allow you to create custom application specific logic for evaluating boolean conditions. As a simple example, let's create a Twig test that checks if objects are 'red':: - $twig = new Twig_Environment($loader); - $test = new Twig_SimpleTest('red', function ($value) { + $twig = new \Twig\Environment($loader); + $test = new \Twig\TwigTest('red', function ($value) { if (isset($value->color) && $value->color == 'red') { return true; } @@ -339,16 +340,16 @@ 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. This is used by many of the tests built into Twig:: - $twig = new Twig_Environment($loader); - $test = new Twig_SimpleTest( + $twig = new \Twig\Environment($loader); + $test = new \Twig\TwigTest( 'odd', null, - array('node_class' => 'Twig_Node_Expression_Test_Odd')); + ['node_class' => '\Twig\Node\Expression\Test\OddTest']); $twig->addTest($test); - class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test + class Twig_Node_Expression_Test_Odd extends \Twig\Node\Expression\TestExpression { - public function compile(Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler ->raw('(') @@ -371,17 +372,58 @@ The ``node`` sub-node will contain an expression of ``my_value``. Node-based tests also have access to the ``arguments`` node. This node will contain the various other arguments that have been provided to your test. +.. versionadded:: 1.36 + Dynamic tests support was added in Twig 1.36. + If you want to pass a variable number of positional or named arguments to the -test, set the ``is_variadic`` option to ``true``. Tests also support dynamic -name feature as filters and functions. +test, set the ``is_variadic`` option to ``true``. Tests support dynamic +names (see dynamic filters and functions for the syntax). Tags ---- One of the most exciting features of a template engine like Twig is the -possibility to define new language constructs. This is also the most complex +possibility to define new **language constructs**. This is also the most complex feature as you need to understand how Twig's internals work. +Most of the time though, a tag is not needed: + +* If your tag generates some output, use a **function** instead. + +* If your tag modifies some content and returns it, use a **filter** instead. + + 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 + + {{ '**markdown** text'|markdown }} + + If you want use this filter on large amounts of text, wrap it with the + :doc:`filter <tags/filter>` tag: + + .. code-block:: jinja + + {% filter markdown %} + Title + ===== + + Much better than creating a tag as you can **compose** filters. + {% endfilter %} + +* 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 + :doc:`filter <tags/do>` tag. + + 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 + + {% 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: @@ -412,9 +454,9 @@ Registering a new tag ~~~~~~~~~~~~~~~~~~~~~ Adding a tag is as simple as calling the ``addTokenParser`` method on the -``Twig_Environment`` instance:: +``\Twig\Environment`` instance:: - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); $twig->addTokenParser(new Project_Set_TokenParser()); Defining a Token Parser @@ -422,17 +464,17 @@ Defining a Token Parser Now, let's see the actual code of this class:: - class Project_Set_TokenParser extends Twig_TokenParser + class Project_Set_TokenParser extends \Twig\TokenParser\AbstractTokenParser { - public function parse(Twig_Token $token) + public function parse(\Twig\Token $token) { $parser = $this->parser; $stream = $parser->getStream(); - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - $stream->expect(Twig_Token::OPERATOR_TYPE, '='); + $name = $stream->expect(\Twig\Token::NAME_TYPE)->getValue(); + $stream->expect(\Twig\Token::OPERATOR_TYPE, '='); $value = $parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); return new Project_Set_Node($name, $value, $token->getLine(), $this->getTag()); } @@ -446,7 +488,7 @@ Now, let's see the actual code of this class:: The ``getTag()`` method must return the tag we want to parse, here ``set``. The ``parse()`` method is invoked whenever the parser encounters a ``set`` -tag. It should return a ``Twig_Node`` instance that represents the node (the +tag. It should return a ``\Twig\Node\Node`` instance that represents the node (the ``Project_Set_Node`` calls creating is explained in the next section). The parsing process is simplified thanks to a bunch of methods you can call @@ -479,14 +521,14 @@ Defining a Node The ``Project_Set_Node`` class itself is rather simple:: - class Project_Set_Node extends Twig_Node + class Project_Set_Node extends \Twig\Node\Node { - public function __construct($name, Twig_Node_Expression $value, $line, $tag = null) + public function __construct($name, \Twig\Node\Expression\AbstractExpression $value, $line, $tag = null) { - parent::__construct(array('value' => $value), array('name' => $name), $line, $tag); + parent::__construct(['value' => $value], ['name' => $name], $line, $tag); } - public function compile(Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler ->addDebugInfo($this) @@ -510,15 +552,15 @@ developer generate beautiful and readable PHP code: * ``string()``: Writes a quoted string. * ``repr()``: Writes a PHP representation of a given value (see - ``Twig_Node_For`` for a usage example). + ``\Twig\Node\ForNode`` for a usage example). * ``addDebugInfo()``: Adds the line of the original template file related to the current node as a comment. -* ``indent()``: Indents the generated code (see ``Twig_Node_Block`` for a +* ``indent()``: Indents the generated code (see ``\Twig\Node\BlockNode`` for a usage example). -* ``outdent()``: Outdents the generated code (see ``Twig_Node_Block`` for a +* ``outdent()``: Outdents the generated code (see ``\Twig\Node\BlockNode`` for a usage example). .. _creating_extensions: @@ -543,7 +585,7 @@ to host all the specific tags and filters you want to add to Twig. .. note:: Before writing your own extensions, have a look at the Twig official - extension repository: http://github.com/twigphp/Twig-extensions. + extension repository: https://github.com/twigphp/Twig-extensions. An extension is a class that implements the following interface:: @@ -554,9 +596,9 @@ An extension is a class that implements the following interface:: * * This is where you can load some file that contains filter functions for instance. * - * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead + * @deprecated since 1.23 (to be removed in 2.0), implement \Twig\Extension\InitRuntimeInterface instead */ - function initRuntime(Twig_Environment $environment); + function initRuntime(\Twig\Environment $environment); /** * Returns the token parser instances to add to the existing list. @@ -568,28 +610,28 @@ An extension is a class that implements the following interface:: /** * Returns the node visitor instances to add to the existing list. * - * @return Twig_NodeVisitorInterface[] + * @return \Twig\NodeVisitor\NodeVisitorInterface[] */ function getNodeVisitors(); /** * Returns a list of filters to add to the existing list. * - * @return Twig_SimpleFilter[] + * @return \Twig\TwigFilter[] */ function getFilters(); /** * Returns a list of tests to add to the existing list. * - * @return Twig_SimpleTest[] + * @return \Twig\TwigTest[] */ function getTests(); /** * Returns a list of functions to add to the existing list. * - * @return Twig_SimpleFunction[] + * @return \Twig\TwigFunction[] */ function getFunctions(); @@ -605,7 +647,7 @@ An extension is a class that implements the following interface:: * * @return array An array of global variables * - * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_GlobalsInterface instead + * @deprecated since 1.23 (to be removed in 2.0), implement \Twig\Extension\GlobalsInterface instead */ function getGlobals(); @@ -620,10 +662,10 @@ An extension is a class that implements the following interface:: } To keep your extension class clean and lean, inherit from the built-in -``Twig_Extension`` class instead of implementing the interface as it provides +``\Twig\Extension\AbstractExtension`` class instead of implementing the interface as it provides empty implementations for all methods: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { } @@ -641,7 +683,7 @@ 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:: - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); $twig->addExtension(new Project_Twig_Extension()); .. tip:: @@ -654,13 +696,13 @@ Globals Global variables can be registered in an extension via the ``getGlobals()`` method:: - class Project_Twig_Extension extends Twig_Extension implements Twig_Extension_GlobalsInterface + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension implements \Twig\Extension\GlobalsInterface { public function getGlobals() { - return array( + return [ 'text' => new Text(), - ); + ]; } // ... @@ -672,13 +714,13 @@ Functions Functions can be registered in an extension via the ``getFunctions()`` method:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getFunctions() { - return array( - new Twig_SimpleFunction('lipsum', 'generate_lipsum'), - ); + return [ + new \Twig\TwigFunction('lipsum', 'generate_lipsum'), + ]; } // ... @@ -691,13 +733,13 @@ To add a filter to an extension, you need to override the ``getFilters()`` method. This method must return an array of filters to add to the Twig environment:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getFilters() { - return array( - new Twig_SimpleFilter('rot13', 'str_rot13'), - ); + return [ + new \Twig\TwigFilter('rot13', 'str_rot13'), + ]; } // ... @@ -710,11 +752,11 @@ Adding a tag in an extension can be done by overriding the ``getTokenParsers()`` method. This method must return an array of tags to add to the Twig environment:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getTokenParsers() { - return array(new Project_Set_TokenParser()); + return [new Project_Set_TokenParser()]; } // ... @@ -730,19 +772,19 @@ Operators The ``getOperators()`` methods lets you add new operators. Here is how to add ``!``, ``||``, and ``&&`` operators:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getOperators() { - return array( - array( - '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), - ), - array( - '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - ), - ); + return [ + [ + '!' => ['precedence' => 50, 'class' => '\Twig\Node\Expression\Unary\NotUnary'], + ], + [ + '||' => ['precedence' => 10, 'class' => '\Twig\Node\Expression\Binary\OrBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT], + '&&' => ['precedence' => 15, 'class' => '\Twig\Node\Expression\Binary\AndBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT], + ], + ]; } // ... @@ -753,13 +795,13 @@ Tests The ``getTests()`` method lets you add new test functions:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getTests() { - return array( - new Twig_SimpleTest('even', 'twig_test_even'), - ); + return [ + new \Twig\TwigTest('even', 'twig_test_even'), + ]; } // ... @@ -782,7 +824,7 @@ any valid PHP callable: The simplest way to use methods is to define them on the extension itself:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { private $rot13Provider; @@ -793,9 +835,9 @@ The simplest way to use methods is to define them on the extension itself:: public function getFunctions() { - return array( - new Twig_SimpleFunction('rot13', array($this, 'rot13')), - ); + return [ + new \Twig\TwigFunction('rot13', [$this, 'rot13']), + ]; } public function rot13($value) @@ -809,11 +851,11 @@ depend on runtime dependencies even if they are not needed (think for instance as a dependency that connects to a database engine). As of Twig 1.26, you can easily decouple the extension definitions from their -runtime implementations by registering a ``Twig_RuntimeLoaderInterface`` +runtime implementations by registering a ``\Twig\RuntimeLoader\RuntimeLoaderInterface`` instance on the environment that knows how to instantiate such runtime classes (runtime classes must be autoload-able):: - class RuntimeLoader implements Twig_RuntimeLoaderInterface + class RuntimeLoader implements \Twig\RuntimeLoader\RuntimeLoaderInterface { public function load($class) { @@ -833,7 +875,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_ContainerRuntimeLoader``) that works on PHP 5.3+. + (``\Twig\RuntimeLoader\ContainerRuntimeLoader``) that works on PHP 5.3+. It is now possible to move the runtime logic to a new ``Project_Twig_RuntimeExtension`` class and use it directly in the extension:: @@ -853,15 +895,15 @@ It is now possible to move the runtime logic to a new } } - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getFunctions() { - return array( - new Twig_SimpleFunction('rot13', array('Project_Twig_RuntimeExtension', 'rot13')), + return [ + new \Twig\TwigFunction('rot13', ['Project_Twig_RuntimeExtension', 'rot13']), // or - new Twig_SimpleFunction('rot13', 'Project_Twig_RuntimeExtension::rot13'), - ); + new \Twig\TwigFunction('rot13', 'Project_Twig_RuntimeExtension::rot13'), + ]; } } @@ -872,13 +914,13 @@ To overload an already defined filter, test, operator, global variable, or function, re-define it in an extension and register it **as late as possible** (order matters):: - class MyCoreExtension extends Twig_Extension + class MyCoreExtension extends \Twig\Extension\AbstractExtension { public function getFilters() { - return array( - new Twig_SimpleFilter('date', array($this, 'dateFilter')), - ); + return [ + new \Twig\TwigFilter('date', [$this, 'dateFilter']), + ]; } public function dateFilter($timestamp, $format = 'F j, Y H:i') @@ -887,16 +929,16 @@ possible** (order matters):: } } - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); $twig->addExtension(new MyCoreExtension()); Here, we have overloaded the built-in ``date`` filter with a custom one. -If you do the same on the ``Twig_Environment`` itself, beware that it takes +If you do the same on the ``\Twig\Environment`` itself, beware that it takes precedence over any other registered extensions:: - $twig = new Twig_Environment($loader); - $twig->addFilter(new Twig_SimpleFilter('date', function ($timestamp, $format = 'F j, Y H:i') { + $twig = new \Twig\Environment($loader); + $twig->addFilter(new \Twig\TwigFilter('date', function ($timestamp, $format = 'F j, Y H:i') { // do something different from the built-in date filter })); // the date filter will come from the above registration, not @@ -931,14 +973,14 @@ following file structure in your test directory:: The ``IntegrationTest.php`` file should look like this:: - class Project_Tests_IntegrationTest extends Twig_Test_IntegrationTestCase + class Project_Tests_IntegrationTest extends \Twig\Test\IntegrationTestCase { public function getExtensions() { - return array( + return [ new Project_Twig_Extension1(), new Project_Twig_Extension2(), - ); + ]; } public function getFixturesDir() @@ -954,9 +996,9 @@ Node Tests ~~~~~~~~~~ Testing the node visitors can be complex, so extend your test cases from -``Twig_Test_NodeTestCase``. Examples can be found in the Twig repository +``\Twig\Test\NodeTestCase``. Examples can be found in the Twig repository `tests/Twig/Node`_ directory. -.. _`rot13`: http://www.php.net/manual/en/function.str-rot13.php +.. _`rot13`: https://secure.php.net/manual/en/function.str-rot13.php .. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Fixtures .. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Node diff --git a/vendor/twig/twig/doc/advanced_legacy.rst b/vendor/twig/twig/doc/advanced_legacy.rst index 33e9f45a4cc3f12bf470dc6c1abf1520b0342394..5e4f01b3cd95265f580c47241e34228e396f361b 100644 --- a/vendor/twig/twig/doc/advanced_legacy.rst +++ b/vendor/twig/twig/doc/advanced_legacy.rst @@ -115,7 +115,7 @@ Globals A global variable is like any other template variable, except that it's available in all templates and macros:: - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); $twig->addGlobal('text', new Text()); You can then use the ``text`` variable anywhere in a template: @@ -176,9 +176,9 @@ expected output: {# should displays Gjvt #} Adding a filter is as simple as calling the ``addFilter()`` method on the -``Twig_Environment`` instance:: +``\Twig\Environment`` instance:: - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); $twig->addFilter('rot13', new Twig_Filter_Function('str_rot13')); The second argument of ``addFilter()`` is an instance of ``Twig_Filter``. @@ -227,12 +227,12 @@ The ``Twig_Filter`` classes take options as their last argument. For instance, if you want access to the current environment instance in your filter, set the ``needs_environment`` option to ``true``:: - $filter = new Twig_Filter_Function('str_rot13', array('needs_environment' => true)); + $filter = new Twig_Filter_Function('str_rot13', ['needs_environment' => true]); Twig will then pass the current environment as the first argument to the filter call:: - function twig_compute_rot13(Twig_Environment $env, $string) + function twig_compute_rot13(\Twig\Environment $env, $string) { // get the current charset for instance $charset = $env->getCharset(); @@ -248,14 +248,14 @@ before printing. If your filter acts as an escaper (or explicitly outputs HTML or JavaScript code), you will want the raw output to be printed. In such a case, set the ``is_safe`` option:: - $filter = new Twig_Filter_Function('nl2br', array('is_safe' => array('html'))); + $filter = new Twig_Filter_Function('nl2br', ['is_safe' => ['html']]); Some filters may need to work on input that is already escaped or safe, for example when adding (safe) HTML tags to originally unsafe output. In such a case, set the ``pre_escape`` option to escape the input data before it is run through your filter:: - $filter = new Twig_Filter_Function('somefilter', array('pre_escape' => 'html', 'is_safe' => array('html'))); + $filter = new Twig_Filter_Function('somefilter', ['pre_escape' => 'html', 'is_safe' => ['html']]); Dynamic Filters ~~~~~~~~~~~~~~~ @@ -311,15 +311,15 @@ compilation, the generated PHP code is roughly equivalent to: <?php echo constant('DATE_W3C') ?> Adding a function is similar to adding a filter. This can be done by calling the -``addFunction()`` method on the ``Twig_Environment`` instance:: +``addFunction()`` method on the ``\Twig\Environment`` instance:: - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); $twig->addFunction('functionName', new Twig_Function_Function('someFunction')); You can also expose extension methods as functions in your templates:: - // $this is an object that implements Twig_ExtensionInterface. - $twig = new Twig_Environment($loader); + // $this is an object that implements \Twig\Extension\ExtensionInterface. + $twig = new \Twig\Environment($loader); $twig->addFunction('otherFunction', new Twig_Function_Method($this, 'someMethod')); Functions also support ``needs_environment`` and ``is_safe`` parameters. @@ -395,9 +395,9 @@ Registering a new tag ~~~~~~~~~~~~~~~~~~~~~ Adding a tag is as simple as calling the ``addTokenParser`` method on the -``Twig_Environment`` instance:: +``\Twig\Environment`` instance:: - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); $twig->addTokenParser(new Project_Set_TokenParser()); Defining a Token Parser @@ -405,16 +405,16 @@ Defining a Token Parser Now, let's see the actual code of this class:: - class Project_Set_TokenParser extends Twig_TokenParser + class Project_Set_TokenParser extends \Twig\TokenParser\AbstractTokenParser { - public function parse(Twig_Token $token) + public function parse(\Twig\Token $token) { $lineno = $token->getLine(); - $name = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(); - $this->parser->getStream()->expect(Twig_Token::OPERATOR_TYPE, '='); + $name = $this->parser->getStream()->expect(\Twig\Token::NAME_TYPE)->getValue(); + $this->parser->getStream()->expect(\Twig\Token::OPERATOR_TYPE, '='); $value = $this->parser->getExpressionParser()->parseExpression(); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $this->parser->getStream()->expect(\Twig\Token::BLOCK_END_TYPE); return new Project_Set_Node($name, $value, $lineno, $this->getTag()); } @@ -428,7 +428,7 @@ Now, let's see the actual code of this class:: The ``getTag()`` method must return the tag we want to parse, here ``set``. The ``parse()`` method is invoked whenever the parser encounters a ``set`` -tag. It should return a ``Twig_Node`` instance that represents the node (the +tag. It should return a ``\Twig\Node\Node`` instance that represents the node (the ``Project_Set_Node`` calls creating is explained in the next section). The parsing process is simplified thanks to a bunch of methods you can call @@ -461,14 +461,14 @@ Defining a Node The ``Project_Set_Node`` class itself is rather simple:: - class Project_Set_Node extends Twig_Node + class Project_Set_Node extends \Twig\Node\Node { - public function __construct($name, Twig_Node_Expression $value, $lineno, $tag = null) + public function __construct($name, \Twig\Node\Expression\AbstractExpression $value, $lineno, $tag = null) { - parent::__construct(array('value' => $value), array('name' => $name), $lineno, $tag); + parent::__construct(['value' => $value], ['name' => $name], $lineno, $tag); } - public function compile(Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler ->addDebugInfo($this) @@ -492,15 +492,15 @@ developer generate beautiful and readable PHP code: * ``string()``: Writes a quoted string. * ``repr()``: Writes a PHP representation of a given value (see - ``Twig_Node_For`` for a usage example). + ``\Twig\Node\ForNode`` for a usage example). * ``addDebugInfo()``: Adds the line of the original template file related to the current node as a comment. -* ``indent()``: Indents the generated code (see ``Twig_Node_Block`` for a +* ``indent()``: Indents the generated code (see ``\Twig\Node\BlockNode`` for a usage example). -* ``outdent()``: Outdents the generated code (see ``Twig_Node_Block`` for a +* ``outdent()``: Outdents the generated code (see ``\Twig\Node\BlockNode`` for a usage example). .. _creating_extensions: @@ -529,7 +529,7 @@ to host all the specific tags and filters you want to add to Twig. .. note:: Before writing your own extensions, have a look at the Twig official - extension repository: http://github.com/twigphp/Twig-extensions. + extension repository: https://github.com/twigphp/Twig-extensions. An extension is a class that implements the following interface:: @@ -540,7 +540,7 @@ An extension is a class that implements the following interface:: * * This is where you can load some file that contains filter functions for instance. */ - function initRuntime(Twig_Environment $environment); + function initRuntime(\Twig\Environment $environment); /** * Returns the token parser instances to add to the existing list. @@ -552,28 +552,28 @@ An extension is a class that implements the following interface:: /** * Returns the node visitor instances to add to the existing list. * - * @return Twig_NodeVisitorInterface[] + * @return \Twig\NodeVisitor\NodeVisitorInterface[] */ function getNodeVisitors(); /** * Returns a list of filters to add to the existing list. * - * @return Twig_SimpleFilter[] + * @return \Twig\TwigFilter[] */ function getFilters(); /** * Returns a list of tests to add to the existing list. * - * @return Twig_SimpleTest[] + * @return \Twig\TwigTest[] */ function getTests(); /** * Returns a list of functions to add to the existing list. * - * @return Twig_SimpleFunction[] + * @return \Twig\TwigFunction[] */ function getFunctions(); @@ -600,16 +600,16 @@ An extension is a class that implements the following interface:: } To keep your extension class clean and lean, it can inherit from the built-in -``Twig_Extension`` class instead of implementing the whole interface. That +``\Twig\Extension\AbstractExtension`` class instead of implementing the whole interface. That way, you just need to implement the ``getName()`` method as the -``Twig_Extension`` provides empty implementations for all other methods. +``\Twig\Extension\AbstractExtension`` provides empty implementations for all other methods. The ``getName()`` method must return a unique identifier for your extension. Now, with this information in mind, let's create the most basic extension possible:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getName() { @@ -628,7 +628,7 @@ 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:: - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); $twig->addExtension(new Project_Twig_Extension()); Of course, you need to first load the extension file by either using @@ -644,13 +644,13 @@ Globals Global variables can be registered in an extension via the ``getGlobals()`` method:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getGlobals() { - return array( + return [ 'text' => new Text(), - ); + ]; } // ... @@ -662,13 +662,13 @@ Functions Functions can be registered in an extension via the ``getFunctions()`` method:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getFunctions() { - return array( + return [ 'lipsum' => new Twig_Function_Function('generate_lipsum'), - ); + ]; } // ... @@ -681,13 +681,13 @@ To add a filter to an extension, you need to override the ``getFilters()`` method. This method must return an array of filters to add to the Twig environment:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getFilters() { - return array( + return [ 'rot13' => new Twig_Filter_Function('str_rot13'), - ); + ]; } // ... @@ -705,13 +705,13 @@ $twig->addFilter('rot13', new Twig_Filter_Function('Project_Twig_Extension::rot1 You can also use ``Twig_Filter_Method`` instead of ``Twig_Filter_Function`` when defining a filter to use a method:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getFilters() { - return array( + return [ 'rot13' => new Twig_Filter_Method($this, 'rot13Filter'), - ); + ]; } public function rot13Filter($string) @@ -737,14 +737,14 @@ If some default core filters do not suit your needs, you can easily override them by creating your own extension. Just use the same names as the one you want to override:: - class MyCoreExtension extends Twig_Extension + class MyCoreExtension extends \Twig\Extension\AbstractExtension { public function getFilters() { - return array( + return [ 'date' => new Twig_Filter_Method($this, 'dateFilter'), // ... - ); + ]; } public function dateFilter($timestamp, $format = 'F j, Y H:i') @@ -762,7 +762,7 @@ Here, we override the ``date`` filter with a custom one. Using this extension is as simple as registering the ``MyCoreExtension`` extension by calling the ``addExtension()`` method on the environment instance:: - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); $twig->addExtension(new MyCoreExtension()); Tags @@ -772,11 +772,11 @@ Adding a tag in an extension can be done by overriding the ``getTokenParsers()`` method. This method must return an array of tags to add to the Twig environment:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getTokenParsers() { - return array(new Project_Set_TokenParser()); + return [new Project_Set_TokenParser()]; } // ... @@ -792,19 +792,19 @@ Operators The ``getOperators()`` methods allows to add new operators. Here is how to add ``!``, ``||``, and ``&&`` operators:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getOperators() { - return array( - array( - '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), + return [ + [ + '!' => ['precedence' => 50, 'class' => '\Twig\Node\Expression\Unary\NotUnary'], ), - array( - '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - ), - ); + [ + '||' => ['precedence' => 10, 'class' => '\Twig\Node\Expression\Binary\OrBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT], + '&&' => ['precedence' => 15, 'class' => '\Twig\Node\Expression\Binary\AndBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT], + ], + ]; } // ... @@ -815,13 +815,13 @@ Tests The ``getTests()`` methods allows to add new test functions:: - class Project_Twig_Extension extends Twig_Extension + class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { public function getTests() { - return array( + return [ 'even' => new Twig_Test_Function('twig_test_even'), - ); + ]; } // ... @@ -853,14 +853,14 @@ following file structure in your test directory:: The ``IntegrationTest.php`` file should look like this:: - class Project_Tests_IntegrationTest extends Twig_Test_IntegrationTestCase + class Project_Tests_IntegrationTest extends \Twig\Test\IntegrationTestCase { public function getExtensions() { - return array( + return [ new Project_Twig_Extension1(), new Project_Twig_Extension2(), - ); + ]; } public function getFixturesDir() @@ -876,10 +876,10 @@ Node Tests ~~~~~~~~~~ Testing the node visitors can be complex, so extend your test cases from -``Twig_Test_NodeTestCase``. Examples can be found in the Twig repository +``\Twig\Test\NodeTestCase``. Examples can be found in the Twig repository `tests/Twig/Node`_ directory. -.. _`spl_autoload_register()`: http://www.php.net/spl_autoload_register -.. _`rot13`: http://www.php.net/manual/en/function.str-rot13.php +.. _`spl_autoload_register()`: https://secure.php.net/spl_autoload_register +.. _`rot13`: https://secure.php.net/manual/en/function.str-rot13.php .. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Fixtures .. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Node diff --git a/vendor/twig/twig/doc/api.rst b/vendor/twig/twig/doc/api.rst index 8be2b8af8ecb85c59d9cbb15aeceaa42c3262663..69710e3d1078cd830a8eaeb8949f56379acee0c2 100644 --- a/vendor/twig/twig/doc/api.rst +++ b/vendor/twig/twig/doc/api.rst @@ -9,11 +9,11 @@ Basics ------ Twig uses a central object called the **environment** (of class -``Twig_Environment``). Instances of this class are used to store the +``\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. -Most applications will create one ``Twig_Environment`` object on application +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. @@ -24,10 +24,10 @@ looks roughly like this:: require_once '/path/to/lib/Twig/Autoloader.php'; Twig_Autoloader::register(); - $loader = new Twig_Loader_Filesystem('/path/to/templates'); - $twig = new Twig_Environment($loader, array( + $loader = new \Twig\Loader\FilesystemLoader('/path/to/templates'); + $twig = new \Twig\Environment($loader, [ '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 @@ -47,18 +47,18 @@ Rendering Templates ------------------- To load a template from a Twig environment, call the ``load()`` method which -returns a ``Twig_TemplateWrapper`` instance:: +returns a ``\Twig\TemplateWrapper`` instance:: $template = $twig->load('index.html'); .. note:: Before Twig 1.28, you should use ``loadTemplate()`` instead which returns a - ``Twig_Template`` instance. + ``\Twig\Template`` instance. To render the template with some variables, call the ``render()`` method:: - echo $template->render(array('the' => 'variables', 'go' => 'here')); + echo $template->render(['the' => 'variables', 'go' => 'here']); .. note:: @@ -66,7 +66,7 @@ To render the template with some variables, call the ``render()`` method:: You can also load and render the template in one fell swoop:: - echo $twig->render('index.html', array('the' => 'variables', 'go' => 'here')); + echo $twig->render('index.html', ['the' => 'variables', 'go' => 'here']); .. versionadded:: 1.28 The possibility to render blocks from the API was added in Twig 1.28. @@ -74,17 +74,17 @@ You can also load and render the template in one fell swoop:: If a template defines blocks, they can be rendered individually via the ``renderBlock()`` call:: - echo $template->renderBlock('block_name', array('the' => 'variables', 'go' => 'here')); + echo $template->renderBlock('block_name', ['the' => 'variables', 'go' => 'here']); .. _environment_options: Environment Options ------------------- -When creating a new ``Twig_Environment`` instance, you can pass an array of +When creating a new ``\Twig\Environment`` instance, you can pass an array of options as the constructor second argument:: - $twig = new Twig_Environment($loader, array('debug' => true)); + $twig = new \Twig\Environment($loader, ['debug' => true]); The following options are available: @@ -98,7 +98,7 @@ The following options are available: The charset used by the templates. -* ``base_template_class`` *string* (defaults to ``Twig_Template``) +* ``base_template_class`` *string* (defaults to ``\Twig\Template``) The base template class to use for generated templates. @@ -158,7 +158,7 @@ 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 +See the ``cache`` and ``auto_reload`` options of ``\Twig\Environment`` above for more information. Built-in Loaders @@ -166,8 +166,8 @@ Built-in Loaders Here is a list of the built-in loaders Twig provides: -``Twig_Loader_Filesystem`` -.......................... +``\Twig\Loader\FilesystemLoader`` +................................. .. versionadded:: 1.10 The ``prependPath()`` and support for namespaces were added in Twig 1.10. @@ -175,15 +175,15 @@ Here is a list of the built-in loaders Twig provides: .. versionadded:: 1.27 Relative paths support was added in Twig 1.27. -``Twig_Loader_Filesystem`` loads templates from the file system. This loader +``\Twig\Loader\FilesystemLoader`` loads templates from the file system. This loader can find templates in folders on the file system and is the preferred way to load them:: - $loader = new Twig_Loader_Filesystem($templateDir); + $loader = new \Twig\Loader\FilesystemLoader($templateDir); It can also look for templates in an array of directories:: - $loader = new Twig_Loader_Filesystem(array($templateDir1, $templateDir2)); + $loader = new \Twig\Loader\FilesystemLoader([$templateDir1, $templateDir2]); With such a configuration, Twig will first look for templates in ``$templateDir1`` and if they do not exist, it will fallback to look for them @@ -207,32 +207,32 @@ methods act on the "main" namespace):: Namespaced templates can be accessed via the special ``@namespace_name/template_path`` notation:: - $twig->render('@admin/index.html', array()); + $twig->render('@admin/index.html', []); -``Twig_Loader_Filesystem`` support absolute and relative paths. Using relative +``\Twig\Loader\FilesystemLoader`` support absolute and relative paths. Using relative paths is preferred as it makes the cache keys independent of the project root directory (for instance, it allows warming the cache from a build server where the directory might be different from the one used on production servers):: - $loader = new Twig_Loader_Filesystem('templates', getcwd().'/..'); + $loader = new \Twig\Loader\FilesystemLoader('templates', getcwd().'/..'); .. note:: When not passing the root path as a second argument, Twig uses ``getcwd()`` for relative paths. -``Twig_Loader_Array`` -..................... +``\Twig\Loader\ArrayLoader`` +............................ -``Twig_Loader_Array`` loads a template from a PHP array. It's passed an array +``\Twig\Loader\ArrayLoader`` loads a template from a PHP array. It's passed an array of strings bound to template names:: - $loader = new Twig_Loader_Array(array( + $loader = new \Twig\Loader\ArrayLoader([ 'index.html' => 'Hello {{ name }}!', - )); - $twig = new Twig_Environment($loader); + ]); + $twig = new \Twig\Environment($loader); - echo $twig->render('index.html', array('name' => 'Fabien')); + echo $twig->render('index.html', ['name' => 'Fabien']); This loader is very useful for unit testing. It can also be used for small projects where storing all templates in a single PHP file might make sense. @@ -245,30 +245,30 @@ projects where storing all templates in a single PHP file might make sense. 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_Chain`` -..................... +``\Twig\Loader\ChainLoader`` +............................ -``Twig_Loader_Chain`` delegates the loading of templates to other loaders:: +``\Twig\Loader\ChainLoader`` delegates the loading of templates to other loaders:: - $loader1 = new Twig_Loader_Array(array( + $loader1 = new \Twig\Loader\ArrayLoader([ 'base.html' => '{% block content %}{% endblock %}', - )); - $loader2 = new Twig_Loader_Array(array( + ]); + $loader2 = new \Twig\Loader\ArrayLoader([ 'index.html' => '{% extends "base.html" %}{% block content %}Hello {{ name }}{% endblock %}', 'base.html' => 'Will never be loaded', - )); + ]); - $loader = new Twig_Loader_Chain(array($loader1, $loader2)); + $loader = new \Twig\Loader\ChainLoader([$loader1, $loader2]); - $twig = new Twig_Environment($loader); + $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_Chain`` accepts any loader that implements -``Twig_LoaderInterface``. +``\Twig\Loader\ChainLoader`` accepts any loader that implements +``\Twig\Loader\LoaderInterface``. .. note:: @@ -277,7 +277,7 @@ template from the above example, Twig will load it with ``$loader2`` but the Create your own Loader ~~~~~~~~~~~~~~~~~~~~~~ -All loaders implement the ``Twig_LoaderInterface``:: +All loaders implement the ``\Twig\Loader\LoaderInterface``:: interface Twig_LoaderInterface { @@ -288,7 +288,7 @@ All loaders implement the ``Twig_LoaderInterface``:: * * @return string The template source code * - * @deprecated since 1.27 (to be removed in 2.0), implement Twig_SourceContextLoaderInterface + * @deprecated since 1.27 (to be removed in 2.0), implement \Twig\Loader\SourceContextLoaderInterface */ function getSource($name); @@ -316,11 +316,11 @@ is still fresh, given the last modification time, or ``false`` otherwise. .. note:: As of Twig 1.27, you should also implement - ``Twig_SourceContextLoaderInterface`` to avoid deprecation notices. + ``\Twig\Loader\SourceContextLoaderInterface`` to avoid deprecation notices. .. tip:: - As of Twig 1.11.0, you can also implement ``Twig_ExistsLoaderInterface`` + As of Twig 1.11.0, you can also implement ``\Twig\Loader\ExistsLoaderInterface`` to make your loader faster when used with the chain loader. Using Extensions @@ -329,7 +329,7 @@ Using Extensions Twig extensions are packages that add new features to Twig. Using an extension is as simple as using the ``addExtension()`` method:: - $twig->addExtension(new Twig_Extension_Sandbox()); + $twig->addExtension(new \Twig\Extension\SandboxExtension()); Twig comes bundled with the following extensions: @@ -378,7 +378,7 @@ tag, ``autoescape``, and a filter, ``raw``. When creating the escaper extension, you can switch on or off the global output escaping strategy:: - $escaper = new Twig_Extension_Escaper('html'); + $escaper = new \Twig\Extension\EscaperExtension('html'); $twig->addExtension($escaper); If set to ``html``, all variables in templates are escaped (using the ``html`` @@ -473,29 +473,29 @@ Sandbox Extension The ``sandbox`` extension can be used to evaluate untrusted code. Access to unsafe attributes and methods is prohibited. The sandbox security is managed by a policy instance. By default, Twig comes with one policy class: -``Twig_Sandbox_SecurityPolicy``. This class allows you to white-list some +``\Twig\Sandbox\SecurityPolicy``. This class allows you to white-list some tags, filters, properties, and methods:: - $tags = array('if'); - $filters = array('upper'); - $methods = array( - 'Article' => array('getTitle', 'getBody'), - ); - $properties = array( - 'Article' => array('title', 'body'), - ); - $functions = array('range'); - $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); + $tags = ['if']; + $filters = ['upper']; + $methods = [ + 'Article' => ['getTitle', 'getBody'], + ]; + $properties = [ + 'Article' => ['title', 'body'], + ]; + $functions = ['range']; + $policy = new \Twig\Sandbox\SecurityPolicy($tags, $filters, $methods, $properties, $functions); With the previous configuration, the security policy will only allow usage of the ``if`` tag, and the ``upper`` filter. Moreover, the templates will only be able to call the ``getTitle()`` and ``getBody()`` methods on ``Article`` objects, and the ``title`` and ``body`` public properties. Everything else -won't be allowed and will generate a ``Twig_Sandbox_SecurityError`` exception. +won't be allowed and will generate a ``\Twig\Sandbox\SecurityError`` exception. The policy object is the first argument of the sandbox constructor:: - $sandbox = new Twig_Extension_Sandbox($policy); + $sandbox = new \Twig\Extension\SandboxExtension($policy); $twig->addExtension($sandbox); By default, the sandbox mode is disabled and should be enabled when including @@ -510,7 +510,7 @@ untrusted template code by using the ``sandbox`` tag: You can sandbox all templates by passing ``true`` as the second argument of the extension constructor:: - $sandbox = new Twig_Extension_Sandbox($policy, true); + $sandbox = new \Twig\Extension\SandboxExtension($policy, true); Profiler Extension ~~~~~~~~~~~~~~~~~~ @@ -521,10 +521,10 @@ Profiler Extension The ``profiler`` extension enables a profiler for Twig templates; it should only be used on your development machines as it adds some overhead:: - $profile = new Twig_Profiler_Profile(); - $twig->addExtension(new Twig_Extension_Profiler($profile)); + $profile = new \Twig\Profiler\Profile(); + $twig->addExtension(new \Twig\Extension\ProfilerExtension($profile)); - $dumper = new Twig_Profiler_Dumper_Text(); + $dumper = new \Twig\Profiler\Dumper\TextDumper(); echo $dumper->dump($profile); A profile contains information about time and memory consumption for template, @@ -533,7 +533,7 @@ block, and macro executions. You can also dump the data in a `Blackfire.io <https://blackfire.io/>`_ compatible format:: - $dumper = new Twig_Profiler_Dumper_Blackfire(); + $dumper = new \Twig\Profiler\Dumper\BlackfireDumper(); file_put_contents('/path/to/profile.prof', $dumper->dump($profile)); Upload the profile to visualize it (create a `free account @@ -548,27 +548,27 @@ Optimizer Extension The ``optimizer`` extension optimizes the node tree before compilation:: - $twig->addExtension(new Twig_Extension_Optimizer()); + $twig->addExtension(new \Twig\Extension\OptimizerExtension()); By default, all optimizations are turned on. You can select the ones you want to enable by passing them to the constructor:: - $optimizer = new Twig_Extension_Optimizer(Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR); + $optimizer = new \Twig\Extension\OptimizerExtension(\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_FOR); $twig->addExtension($optimizer); Twig supports the following optimizations: -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_ALL``, enables all optimizations +* ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_ALL``, enables all optimizations (this is the default value). -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_NONE``, disables all optimizations. +* ``\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_Optimizer::OPTIMIZE_FOR``, optimizes the ``for`` tag by +* ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_FOR``, optimizes the ``for`` tag by removing the ``loop`` variable creation whenever possible. -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_RAW_FILTER``, removes the ``raw`` +* ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_RAW_FILTER``, removes the ``raw`` filter whenever possible. -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_VAR_ACCESS``, simplifies the creation +* ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_VAR_ACCESS``, simplifies the creation and access of variables in the compiled templates whenever possible. Exceptions @@ -576,15 +576,15 @@ Exceptions Twig can throw exceptions: -* ``Twig_Error``: The base exception for all errors. +* ``\Twig\Error\Error``: The base exception for all errors. -* ``Twig_Error_Syntax``: Thrown to tell the user that there is a problem with +* ``\Twig\Error\SyntaxError``: Thrown to tell the user that there is a problem with the template syntax. -* ``Twig_Error_Runtime``: Thrown when an error occurs at runtime (when a filter +* ``\Twig\Error\RuntimeError``: Thrown when an error occurs at runtime (when a filter does not exist for instance). -* ``Twig_Error_Loader``: Thrown when an error occurs during template loading. +* ``\Twig\Error\LoaderError``: Thrown when an error occurs during template loading. -* ``Twig_Sandbox_SecurityError``: Thrown when an unallowed tag, filter, or +* ``\Twig\Sandbox\SecurityError``: Thrown when an unallowed tag, filter, or method is called in a sandboxed template. diff --git a/vendor/twig/twig/doc/deprecated.rst b/vendor/twig/twig/doc/deprecated.rst index 8b25cc4104e4426413af089303cf7a43137f51e1..135b85bb70370fde5b4a032d24293c1dfc4dd09c 100644 --- a/vendor/twig/twig/doc/deprecated.rst +++ b/vendor/twig/twig/doc/deprecated.rst @@ -27,29 +27,29 @@ Token Parsers * ``Twig_TokenParserBrokerInterface`` * ``Twig_TokenParserBroker`` -* As of Twig 1.27, ``Twig_Parser::getFilename()`` is deprecated. From a token +* As of Twig 1.27, ``\Twig\Parser::getFilename()`` is deprecated. From a token parser, use ``$this->parser->getStream()->getSourceContext()->getPath()`` instead. -* As of Twig 1.27, ``Twig_Parser::getEnvironment()`` is deprecated. +* As of Twig 1.27, ``\Twig\Parser::getEnvironment()`` is deprecated. Extensions ---------- * As of Twig 1.x, the ability to remove an extension is deprecated and the - ``Twig_Environment::removeExtension()`` method will be removed in 2.0. + ``\Twig\Environment::removeExtension()`` method will be removed in 2.0. -* As of Twig 1.23, the ``Twig_ExtensionInterface::initRuntime()`` method is +* As of Twig 1.23, the ``\Twig\Extension\ExtensionInterface::initRuntime()`` method is deprecated. You have two options to avoid the deprecation notice: if you implement this method to store the environment for your custom filters, functions, or tests, use the ``needs_environment`` option instead; if you have more complex needs, explicitly implement - ``Twig_Extension_InitRuntimeInterface`` (not recommended). + ``\Twig\Extension\InitRuntimeInterface`` (not recommended). -* As of Twig 1.23, the ``Twig_ExtensionInterface::getGlobals()`` method is - deprecated. Implement ``Twig_Extension_GlobalsInterface`` to avoid +* As of Twig 1.23, the ``\Twig\Extension\ExtensionInterface::getGlobals()`` method is + deprecated. Implement ``\Twig\Extension\GlobalsInterface`` to avoid deprecation notices. -* As of Twig 1.26, the ``Twig_ExtensionInterface::getName()`` method is +* As of Twig 1.26, the ``\Twig\Extension\ExtensionInterface::getName()`` method is deprecated and it is not used internally anymore. PEAR @@ -61,7 +61,7 @@ provided anymore. Use Composer instead. Filters ------- -* As of Twig 1.x, use ``Twig_SimpleFilter`` to add a filter. The following +* As of Twig 1.x, use ``\Twig\TwigFilter`` to add a filter. The following classes and interfaces will be removed in 2.0: * ``Twig_FilterInterface`` @@ -71,14 +71,14 @@ Filters * ``Twig_Filter_Method`` * ``Twig_Filter_Node`` -* As of Twig 2.x, the ``Twig_SimpleFilter`` class is deprecated and will be +* As of Twig 2.x, the ``\Twig\TwigFilter`` class is deprecated and will be removed in Twig 3.x (use ``Twig_Filter`` instead). In Twig 2.x, - ``Twig_SimpleFilter`` is just an alias for ``Twig_Filter``. + ``\Twig\TwigFilter`` is just an alias for ``Twig_Filter``. Functions --------- -* As of Twig 1.x, use ``Twig_SimpleFunction`` to add a function. The following +* As of Twig 1.x, use ``\Twig\TwigFunction`` to add a function. The following classes and interfaces will be removed in 2.0: * ``Twig_FunctionInterface`` @@ -88,14 +88,14 @@ Functions * ``Twig_Function_Method`` * ``Twig_Function_Node`` -* As of Twig 2.x, the ``Twig_SimpleFunction`` class is deprecated and will be +* As of Twig 2.x, the ``\Twig\TwigFunction`` class is deprecated and will be removed in Twig 3.x (use ``Twig_Function`` instead). In Twig 2.x, - ``Twig_SimpleFunction`` is just an alias for ``Twig_Function``. + ``\Twig\TwigFunction`` is just an alias for ``Twig_Function``. Tests ----- -* As of Twig 1.x, use ``Twig_SimpleTest`` to add a test. The following classes +* As of Twig 1.x, use ``\Twig\TwigTest`` to add a test. The following classes and interfaces will be removed in 2.0: * ``Twig_TestInterface`` @@ -105,9 +105,9 @@ Tests * ``Twig_Test_Method`` * ``Twig_Test_Node`` -* As of Twig 2.x, the ``Twig_SimpleTest`` class is deprecated and will be +* As of Twig 2.x, the ``\Twig\TwigTest`` class is deprecated and will be removed in Twig 3.x (use ``Twig_Test`` instead). In Twig 2.x, - ``Twig_SimpleTest`` is just an alias for ``Twig_Test``. + ``\Twig\TwigTest`` is just an alias for ``Twig_Test``. * The ``sameas`` and ``divisibleby`` tests are deprecated in favor of ``same as`` and ``divisible by`` respectively. @@ -124,16 +124,16 @@ Nodes * As of Twig 1.x, ``Node::toXml()`` is deprecated and will be removed in Twig 2.0. -* As of Twig 1.26, ``Node::$nodes`` should only contains ``Twig_Node`` +* As of Twig 1.26, ``Node::$nodes`` should only contains ``\Twig\Node\Node`` instances, storing a ``null`` value is deprecated and won't be possible in Twig 2.x. -* As of Twig 1.27, the ``filename`` attribute on ``Twig_Node_Module`` is +* As of Twig 1.27, the ``filename`` attribute on ``\Twig\Node\ModuleNode`` is deprecated. Use ``getName()`` instead. -* As of Twig 1.27, the ``Twig_Node::getFilename()/Twig_Node::getLine()`` +* As of Twig 1.27, the ``\Twig\Node\Node::getFilename()/\Twig\Node\Node::getLine()`` methods are deprecated, use - ``Twig_Node::getTemplateName()/Twig_Node::getTemplateLine()`` instead. + ``\Twig\Node\Node::getTemplateName()/\Twig\Node\Node::getTemplateLine()`` instead. Interfaces ---------- @@ -141,40 +141,40 @@ Interfaces * As of Twig 2.x, the following interfaces are deprecated and empty (they will be removed in Twig 3.0): -* ``Twig_CompilerInterface`` (use ``Twig_Compiler`` instead) -* ``Twig_LexerInterface`` (use ``Twig_Lexer`` instead) -* ``Twig_NodeInterface`` (use ``Twig_Node`` instead) -* ``Twig_ParserInterface`` (use ``Twig_Parser`` instead) -* ``Twig_ExistsLoaderInterface`` (merged with ``Twig_LoaderInterface``) -* ``Twig_SourceContextLoaderInterface`` (merged with ``Twig_LoaderInterface``) -* ``Twig_TemplateInterface`` (use ``Twig_Template`` instead, and use - those constants Twig_Template::ANY_CALL, Twig_Template::ARRAY_CALL, - Twig_Template::METHOD_CALL) +* ``Twig_CompilerInterface`` (use ``\Twig\Compiler`` instead) +* ``Twig_LexerInterface`` (use ``\Twig\Lexer`` instead) +* ``Twig_NodeInterface`` (use ``\Twig\Node\Node`` instead) +* ``Twig_ParserInterface`` (use ``\Twig\Parser`` instead) +* ``\Twig\Loader\ExistsLoaderInterface`` (merged with ``\Twig\Loader\LoaderInterface``) +* ``\Twig\Loader\SourceContextLoaderInterface`` (merged with ``\Twig\Loader\LoaderInterface``) +* ``Twig_TemplateInterface`` (use ``\Twig\Template`` instead, and use + those constants \Twig\Template::ANY_CALL, \Twig\Template::ARRAY_CALL, + \Twig\Template::METHOD_CALL) Compiler -------- -* As of Twig 1.26, the ``Twig_Compiler::getFilename()`` has been deprecated. +* As of Twig 1.26, the ``\Twig\Compiler::getFilename()`` has been deprecated. You should not use it anyway as its values is not reliable. -* As of Twig 1.27, the ``Twig_Compiler::addIndentation()`` has been deprecated. - Use ``Twig_Compiler::write('')`` instead. +* As of Twig 1.27, the ``\Twig\Compiler::addIndentation()`` has been deprecated. + Use ``\Twig\Compiler::write('')`` instead. Loaders ------- * As of Twig 1.x, ``Twig_Loader_String`` is deprecated and will be removed in - 2.0. You can render a string via ``Twig_Environment::createTemplate()``. + 2.0. You can render a string via ``\Twig\Environment::createTemplate()``. -* As of Twig 1.27, ``Twig_LoaderInterface::getSource()`` is deprecated. - Implement ``Twig_SourceContextLoaderInterface`` instead and use +* As of Twig 1.27, ``\Twig\Loader\LoaderInterface::getSource()`` is deprecated. + Implement ``\Twig\Loader\SourceContextLoaderInterface`` instead and use ``getSourceContext()``. Node Visitors ------------- * Because of the removal of ``Twig_NodeInterface`` in 2.0, you need to extend - ``Twig_BaseNodeVisitor`` instead of implementing ``Twig_NodeVisitorInterface`` + ``\Twig\NodeVisitor\AbstractNodeVisitor`` instead of implementing ``\Twig\NodeVisitor\NodeVisitorInterface`` directly to make your node visitors compatible with both Twig 1.x and 2.x. Globals @@ -185,40 +185,40 @@ Globals changing the value of an already registered global is possible). * As of Twig 1.x, using the ``_self`` global variable to get access to the - current ``Twig_Template`` instance is deprecated; most usages only need the + current ``\Twig\Template`` instance is deprecated; most usages only need the current template name, which will continue to work in Twig 2.0. In Twig 2.0, ``_self`` returns the current template name instead of the current - ``Twig_Template`` instance. If you are using ``{{ _self.templateName }}``, + ``\Twig\Template`` instance. If you are using ``{{ _self.templateName }}``, just replace it with ``{{ _self }}``. Miscellaneous ------------- -* As of Twig 1.x, ``Twig_Environment::clearTemplateCache()``, - ``Twig_Environment::writeCacheFile()``, - ``Twig_Environment::clearCacheFiles()``, - ``Twig_Environment::getCacheFilename()``, - ``Twig_Environment::getTemplateClassPrefix()``, - ``Twig_Environment::getLexer()``, ``Twig_Environment::getParser()``, and - ``Twig_Environment::getCompiler()`` are deprecated and will be removed in 2.0. +* As of Twig 1.x, ``\Twig\Environment::clearTemplateCache()``, + ``\Twig\Environment::writeCacheFile()``, + ``\Twig\Environment::clearCacheFiles()``, + ``\Twig\Environment::getCacheFilename()``, + ``\Twig\Environment::getTemplateClassPrefix()``, + ``\Twig\Environment::getLexer()``, ``\Twig\Environment::getParser()``, and + ``\Twig\Environment::getCompiler()`` are deprecated and will be removed in 2.0. -* As of Twig 1.x, ``Twig_Template::getEnvironment()`` and +* As of Twig 1.x, ``\Twig\Template::getEnvironment()`` and ``Twig_TemplateInterface::getEnvironment()`` are deprecated and will be removed in 2.0. * As of Twig 1.21, setting the environment option ``autoescape`` to ``true`` is deprecated and will be removed in 2.0. Use ``"html"`` instead. -* As of Twig 1.27, ``Twig_Error::getTemplateFile()`` and - ``Twig_Error::setTemplateFile()`` are deprecated. Use - ``Twig_Error::getTemplateName()`` and ``Twig_Error::setTemplateName()`` +* As of Twig 1.27, ``\Twig\Error\Error::getTemplateFile()`` and + ``\Twig\Error\Error::setTemplateFile()`` are deprecated. Use + ``\Twig\Error\Error::getTemplateName()`` and ``\Twig\Error\Error::setTemplateName()`` instead. -* As of Twig 1.27, ``Twig_Template::getSource()`` is deprecated. Use - ``Twig_Template::getSourceContext()`` instead. +* As of Twig 1.27, ``\Twig\Template::getSource()`` is deprecated. Use + ``\Twig\Template::getSourceContext()`` instead. -* As of Twig 1.27, ``Twig_Parser::addHandler()`` and - ``Twig_Parser::addNodeVisitor()`` are deprecated and will be removed in 2.0. +* As of Twig 1.27, ``\Twig\Parser::addHandler()`` and + ``\Twig\Parser::addNodeVisitor()`` are deprecated and will be removed in 2.0. * As of Twig 1.29, some classes are marked as being final via the `@final` annotation. Those classes will be marked as final in 2.0. diff --git a/vendor/twig/twig/doc/filters/abs.rst b/vendor/twig/twig/doc/filters/abs.rst index 22fa59d0369fc3cbb0edbf199e22af245da4c01c..5c13f49d26319bdb7f0fe57e83bc28b87c1c4a43 100644 --- a/vendor/twig/twig/doc/filters/abs.rst +++ b/vendor/twig/twig/doc/filters/abs.rst @@ -15,4 +15,4 @@ The ``abs`` filter returns the absolute value. Internally, Twig uses the PHP `abs`_ function. -.. _`abs`: http://php.net/abs +.. _`abs`: https://secure.php.net/abs diff --git a/vendor/twig/twig/doc/filters/convert_encoding.rst b/vendor/twig/twig/doc/filters/convert_encoding.rst index f4ebe5807d96c648e037c0780f08559134ac402a..43bf0311854b1ea1158a0e2e78d0ed8b6cab6e5d 100644 --- a/vendor/twig/twig/doc/filters/convert_encoding.rst +++ b/vendor/twig/twig/doc/filters/convert_encoding.rst @@ -24,5 +24,5 @@ Arguments * ``to``: The output charset * ``from``: The input charset -.. _`iconv`: http://php.net/iconv -.. _`mbstring`: http://php.net/mbstring +.. _`iconv`: https://secure.php.net/iconv +.. _`mbstring`: https://secure.php.net/mbstring diff --git a/vendor/twig/twig/doc/filters/date.rst b/vendor/twig/twig/doc/filters/date.rst index 99a17ab75a6dc75b947b2563f666f6307936b470..5f4f202d88631655c82e0346873336e4834589a8 100644 --- a/vendor/twig/twig/doc/filters/date.rst +++ b/vendor/twig/twig/doc/filters/date.rst @@ -53,8 +53,8 @@ dates and the second one is the default format for date intervals: .. code-block:: php - $twig = new Twig_Environment($loader); - $twig->getExtension('Twig_Extension_Core')->setDateFormat('d/m/Y', '%d days'); + $twig = new \Twig\Environment($loader); + $twig->getExtension('\Twig\Extension\CoreExtension')->setDateFormat('d/m/Y', '%d days'); // before Twig 1.26 $twig->getExtension('core')->setDateFormat('d/m/Y', '%d days'); @@ -81,8 +81,8 @@ The default timezone can also be set globally by calling ``setTimezone()``: .. code-block:: php - $twig = new Twig_Environment($loader); - $twig->getExtension('Twig_Extension_Core')->setTimezone('Europe/Paris'); + $twig = new \Twig\Environment($loader); + $twig->getExtension('\Twig\Extension\CoreExtension')->setTimezone('Europe/Paris'); // before Twig 1.26 $twig->getExtension('core')->setTimezone('Europe/Paris'); @@ -93,8 +93,8 @@ Arguments * ``format``: The date format * ``timezone``: The date timezone -.. _`strtotime`: http://www.php.net/strtotime -.. _`DateTime`: http://www.php.net/DateTime -.. _`DateInterval`: http://www.php.net/DateInterval -.. _`date`: http://www.php.net/date -.. _`DateInterval::format`: http://www.php.net/DateInterval.format +.. _`strtotime`: https://secure.php.net/strtotime +.. _`DateTime`: https://secure.php.net/DateTime +.. _`DateInterval`: https://secure.php.net/DateInterval +.. _`date`: https://secure.php.net/date +.. _`DateInterval::format`: https://secure.php.net/DateInterval.format diff --git a/vendor/twig/twig/doc/filters/date_modify.rst b/vendor/twig/twig/doc/filters/date_modify.rst index add40b56b01c607d9685d1bb07758dcf3a838293..8a41dd07a727b8bbf0e3e3498265cc9be99f8bbb 100644 --- a/vendor/twig/twig/doc/filters/date_modify.rst +++ b/vendor/twig/twig/doc/filters/date_modify.rst @@ -19,5 +19,5 @@ Arguments * ``modifier``: The modifier -.. _`strtotime`: http://www.php.net/strtotime -.. _`DateTime`: http://www.php.net/DateTime +.. _`strtotime`: https://secure.php.net/strtotime +.. _`DateTime`: https://secure.php.net/DateTime diff --git a/vendor/twig/twig/doc/filters/escape.rst b/vendor/twig/twig/doc/filters/escape.rst index 21491343b6b8893a0b03ce11a9892edbb0c69d93..1a41d0985f3ffbf66fa90a583be7ec1dfd2b4c00 100644 --- a/vendor/twig/twig/doc/filters/escape.rst +++ b/vendor/twig/twig/doc/filters/escape.rst @@ -96,8 +96,8 @@ used in the ``escape`` call) and the second one must be a valid PHP callable: .. code-block:: php - $twig = new Twig_Environment($loader); - $twig->getExtension('Twig_Extension_Core')->setEscaper('csv', 'csv_escaper'); + $twig = new \Twig\Environment($loader); + $twig->getExtension('\Twig\Extension\CoreExtension')->setEscaper('csv', 'csv_escaper'); // before Twig 1.26 $twig->getExtension('core')->setEscaper('csv', 'csv_escaper'); @@ -116,4 +116,4 @@ Arguments * ``strategy``: The escaping strategy * ``charset``: The string charset -.. _`htmlspecialchars`: http://php.net/htmlspecialchars +.. _`htmlspecialchars`: https://secure.php.net/htmlspecialchars diff --git a/vendor/twig/twig/doc/filters/first.rst b/vendor/twig/twig/doc/filters/first.rst index 674c1f9ed1215c5821ab7d47869fa821e77267d7..da2c2eebb0527edbcb66646162c4ec89f8960300 100644 --- a/vendor/twig/twig/doc/filters/first.rst +++ b/vendor/twig/twig/doc/filters/first.rst @@ -22,4 +22,4 @@ a string: It also works with objects implementing the `Traversable`_ interface. -.. _`Traversable`: http://php.net/manual/en/class.traversable.php +.. _`Traversable`: https://secure.php.net/manual/en/class.traversable.php diff --git a/vendor/twig/twig/doc/filters/format.rst b/vendor/twig/twig/doc/filters/format.rst index f8effd9a94081c65683b9348fc4b21c5f63a92b7..c600edb5e766b70ac2e781359ccbea59a1166573 100644 --- a/vendor/twig/twig/doc/filters/format.rst +++ b/vendor/twig/twig/doc/filters/format.rst @@ -11,6 +11,6 @@ The ``format`` filter formats a given string by replacing the placeholders {# outputs I like foo and bar if the foo parameter equals to the foo string. #} -.. _`sprintf`: http://www.php.net/sprintf +.. _`sprintf`: https://secure.php.net/sprintf .. seealso:: :doc:`replace<replace>` diff --git a/vendor/twig/twig/doc/filters/join.rst b/vendor/twig/twig/doc/filters/join.rst index 2fab94528ad099c8bef98b8b46c4b85ecd9b64f0..9f169706c1b22291260eb82c947c9970b0180c6f 100644 --- a/vendor/twig/twig/doc/filters/join.rst +++ b/vendor/twig/twig/doc/filters/join.rst @@ -1,6 +1,9 @@ ``join`` ======== +.. versionadded:: 1.37 and 2.6.1 + The ``and`` argument was added in Twig 1.37 and 2.6.1. + The ``join`` filter returns a string which is the concatenation of the items of a sequence: @@ -16,8 +19,17 @@ define it with the optional first parameter: {{ [1, 2, 3]|join('|') }} {# outputs 1|2|3 #} + +A second parameter can also be provided that will be the separator used between +the last two items of the sequence: + +.. code-block:: jinja + {{ [1, 2, 3]|join(', ', ' and ') }} + {# outputs 1, 2 and 3 #} + Arguments --------- * ``glue``: The separator +* ``and``: The separator for the last pair of input items diff --git a/vendor/twig/twig/doc/filters/json_encode.rst b/vendor/twig/twig/doc/filters/json_encode.rst index a39bb476eaec35a7fd4ae32eb34a7641158b3c21..f02a7a89acff7b598fe4dc4faccd97681081697e 100644 --- a/vendor/twig/twig/doc/filters/json_encode.rst +++ b/vendor/twig/twig/doc/filters/json_encode.rst @@ -14,8 +14,10 @@ The ``json_encode`` filter returns the JSON representation of a value: Arguments --------- -* ``options``: A bitmask of `json_encode options`_ (``{{ - data|json_encode(constant('JSON_PRETTY_PRINT')) }}``) +* ``options``: A bitmask of `json_encode options`_: ``{{ + data|json_encode(constant('JSON_PRETTY_PRINT')) }}``. + Combine constants using :ref:`bitwise operators<template_logic>`: + ``{{ data|json_encode(constant('JSON_PRETTY_PRINT') b-or constant('JSON_HEX_QUOT') }}`` -.. _`json_encode`: http://php.net/json_encode -.. _`json_encode options`: http://www.php.net/manual/en/json.constants.php +.. _`json_encode`: https://secure.php.net/json_encode +.. _`json_encode options`: https://secure.php.net/manual/en/json.constants.php diff --git a/vendor/twig/twig/doc/filters/last.rst b/vendor/twig/twig/doc/filters/last.rst index 345b6573d73173d136628cfb68f50f4619c0d532..c59ba3fbabcb92da1cd70fb53b23fbdf9ca22f3c 100644 --- a/vendor/twig/twig/doc/filters/last.rst +++ b/vendor/twig/twig/doc/filters/last.rst @@ -22,4 +22,4 @@ a string: It also works with objects implementing the `Traversable`_ interface. -.. _`Traversable`: http://php.net/manual/en/class.traversable.php +.. _`Traversable`: https://secure.php.net/manual/en/class.traversable.php diff --git a/vendor/twig/twig/doc/filters/merge.rst b/vendor/twig/twig/doc/filters/merge.rst index 88780dd6ff63c5f461a316e84862d842e4016353..b0571f09daa208bef98bb93087ebe6130525939e 100644 --- a/vendor/twig/twig/doc/filters/merge.rst +++ b/vendor/twig/twig/doc/filters/merge.rst @@ -45,4 +45,4 @@ overridden. Internally, Twig uses the PHP `array_merge`_ function. It supports Traversable objects by transforming those to arrays. -.. _`array_merge`: http://php.net/array_merge +.. _`array_merge`: https://secure.php.net/array_merge diff --git a/vendor/twig/twig/doc/filters/number_format.rst b/vendor/twig/twig/doc/filters/number_format.rst index f9d6705e72b5425534b4d14bb402f6fcd106cc7a..a5d71ee5ea7fd0e62a75e345bc7f96e8a7ac2c96 100644 --- a/vendor/twig/twig/doc/filters/number_format.rst +++ b/vendor/twig/twig/doc/filters/number_format.rst @@ -37,8 +37,8 @@ These defaults can be easily changed through the core extension: .. code-block:: php - $twig = new Twig_Environment($loader); - $twig->getExtension('Twig_Extension_Core')->setNumberFormat(3, '.', ','); + $twig = new \Twig\Environment($loader); + $twig->getExtension('\Twig\Extension\CoreExtension')->setNumberFormat(3, '.', ','); // before Twig 1.26 $twig->getExtension('core')->setNumberFormat(3, '.', ','); @@ -53,4 +53,4 @@ Arguments * ``decimal_point``: The character(s) to use for the decimal point * ``thousand_sep``: The character(s) to use for the thousands separator -.. _`number_format`: http://php.net/number_format +.. _`number_format`: https://secure.php.net/number_format diff --git a/vendor/twig/twig/doc/filters/reverse.rst b/vendor/twig/twig/doc/filters/reverse.rst index 76fd2c1abd8a4dc07885cc0f640911e3d57adfc3..8e1d967aa480f1f355615161da1a1fafc6490596 100644 --- a/vendor/twig/twig/doc/filters/reverse.rst +++ b/vendor/twig/twig/doc/filters/reverse.rst @@ -44,4 +44,4 @@ Arguments * ``preserve_keys``: Preserve keys when reversing a mapping or a sequence. -.. _`Traversable`: http://php.net/Traversable +.. _`Traversable`: https://secure.php.net/Traversable diff --git a/vendor/twig/twig/doc/filters/slice.rst b/vendor/twig/twig/doc/filters/slice.rst index 70bf139e633d671374c6f2b814b28d4fb3f30d62..defe7a03c89c139e2400eab7d08a95edfe2a0b28 100644 --- a/vendor/twig/twig/doc/filters/slice.rst +++ b/vendor/twig/twig/doc/filters/slice.rst @@ -65,7 +65,7 @@ Arguments * ``length``: The size of the slice * ``preserve_keys``: Whether to preserve key or not (when the input is an array) -.. _`Traversable`: http://php.net/manual/en/class.traversable.php -.. _`array_slice`: http://php.net/array_slice -.. _`mb_substr` : http://php.net/mb-substr -.. _`substr`: http://php.net/substr +.. _`Traversable`: https://secure.php.net/manual/en/class.traversable.php +.. _`array_slice`: https://secure.php.net/array_slice +.. _`mb_substr` : https://secure.php.net/mb-substr +.. _`substr`: https://secure.php.net/substr diff --git a/vendor/twig/twig/doc/filters/sort.rst b/vendor/twig/twig/doc/filters/sort.rst index 350207f8e02b5155c17beda11609570e84d18998..02f9bdfb8fde137a70b2a5d904fd22f80e30012e 100644 --- a/vendor/twig/twig/doc/filters/sort.rst +++ b/vendor/twig/twig/doc/filters/sort.rst @@ -15,4 +15,4 @@ The ``sort`` filter sorts an array: association. It supports Traversable objects by transforming those to arrays. -.. _`asort`: http://php.net/asort +.. _`asort`: https://secure.php.net/asort diff --git a/vendor/twig/twig/doc/filters/spaceless.rst b/vendor/twig/twig/doc/filters/spaceless.rst new file mode 100644 index 0000000000000000000000000000000000000000..5a88e87cc8eaa3106c4746ab214e006fe01bb937 --- /dev/null +++ b/vendor/twig/twig/doc/filters/spaceless.rst @@ -0,0 +1,60 @@ +``spaceless`` +============= + +.. versionadded:: 1.38 + + The ``spaceless`` filter was added in Twig 1.38. + +Use the ``spaceless`` filter to remove whitespace *between HTML tags*, not +whitespace within HTML tags or whitespace in plain text: + +.. code-block:: jinja + + {{ + "<div> + <strong>foo</strong> + </div> + "|spaceless }} + + {# 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: + +.. code-block:: jinja + + {% filter spaceless %} + <div> + <strong>foo</strong> + </div> + {% endfilter %} + + {# output will be <div><strong>foo</strong></div> #} + +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. + +.. caution:: + + As the filter uses a regular expression behind the scenes, its performance + is directly related to the text size you are working on (remember that + filters are executed at runtime). + +.. tip:: + + If you want to optimize the size of the generated HTML content, gzip + compress the output instead. + +.. tip:: + + If you want to create a tag that actually removes all extra whitespace in + an HTML string, be warned that this is not as easy as it seems to be + (think of ``textarea`` or ``pre`` tags for instance). Using a third-party + library like Tidy is probably a better idea. + +.. tip:: + + For more information on whitespace control, read the + :ref:`dedicated section <templates-whitespace-control>` of the documentation and learn how + you can also use the whitespace control modifier on your tags. diff --git a/vendor/twig/twig/doc/filters/split.rst b/vendor/twig/twig/doc/filters/split.rst index bbc6d798f28688b5638a9e1576529631002526fe..c69dbe1f6ab7d0e0a3323e2bf1c3aa72feefc976 100644 --- a/vendor/twig/twig/doc/filters/split.rst +++ b/vendor/twig/twig/doc/filters/split.rst @@ -14,13 +14,13 @@ of strings: You can also pass a ``limit`` argument: - * If ``limit`` is positive, the returned array will contain a maximum of - limit elements with the last element containing the rest of string; +* If ``limit`` is positive, the returned array will contain a maximum of + limit elements with the last element containing the rest of string; - * If ``limit`` is negative, all components except the last -limit are - returned; +* If ``limit`` is negative, all components except the last -limit are + returned; - * If ``limit`` is zero, then this is treated as 1. +* If ``limit`` is zero, then this is treated as 1. .. code-block:: jinja @@ -49,5 +49,5 @@ Arguments * ``delimiter``: The delimiter * ``limit``: The limit argument -.. _`explode`: http://php.net/explode -.. _`str_split`: http://php.net/str_split +.. _`explode`: https://secure.php.net/explode +.. _`str_split`: https://secure.php.net/str_split diff --git a/vendor/twig/twig/doc/filters/striptags.rst b/vendor/twig/twig/doc/filters/striptags.rst index 82953b7b65b35974b50fcc576d8b0b329eee7f2e..87e0fbf802ccdefc03debf79567758309e4865ba 100644 --- a/vendor/twig/twig/doc/filters/striptags.rst +++ b/vendor/twig/twig/doc/filters/striptags.rst @@ -26,4 +26,4 @@ Arguments * ``allowable_tags``: Tags which should not be stripped -.. _`strip_tags`: http://php.net/strip_tags +.. _`strip_tags`: https://secure.php.net/strip_tags diff --git a/vendor/twig/twig/doc/filters/trim.rst b/vendor/twig/twig/doc/filters/trim.rst index b598363c272b890ec166874cd01f3886dc973ec5..dfaf4cff4bf74a02329c69524d0df1f8de1c7b59 100644 --- a/vendor/twig/twig/doc/filters/trim.rst +++ b/vendor/twig/twig/doc/filters/trim.rst @@ -40,6 +40,6 @@ Arguments * ``side``: The default is to strip from the left and the right (`both`) sides, but `left` and `right` will strip from either the left side or right side only -.. _`trim`: http://php.net/trim -.. _`ltrim`: http://php.net/ltrim -.. _`rtrim`: http://php.net/rtrim +.. _`trim`: https://secure.php.net/trim +.. _`ltrim`: https://secure.php.net/ltrim +.. _`rtrim`: https://secure.php.net/rtrim diff --git a/vendor/twig/twig/doc/filters/url_encode.rst b/vendor/twig/twig/doc/filters/url_encode.rst index 5944e59cd5bb7c9dc205e0db8db87f61837e6e44..4012e5511a586bb3a8f638b67877b36dd169273c 100644 --- a/vendor/twig/twig/doc/filters/url_encode.rst +++ b/vendor/twig/twig/doc/filters/url_encode.rst @@ -29,6 +29,6 @@ or an array as query string: that as of Twig 1.16.0, ``urlencode`` **always** uses ``rawurlencode`` (the ``raw`` argument was removed.) -.. _`urlencode`: http://php.net/urlencode -.. _`rawurlencode`: http://php.net/rawurlencode -.. _`http_build_query`: http://php.net/http_build_query +.. _`urlencode`: https://secure.php.net/urlencode +.. _`rawurlencode`: https://secure.php.net/rawurlencode +.. _`http_build_query`: https://secure.php.net/http_build_query diff --git a/vendor/twig/twig/doc/functions/date.rst b/vendor/twig/twig/doc/functions/date.rst index 158dd6a65452630316d66753fb1d52afe51caf60..704ccaba6f1e4476d4da3a31ab6fd0385560521a 100644 --- a/vendor/twig/twig/doc/functions/date.rst +++ b/vendor/twig/twig/doc/functions/date.rst @@ -40,8 +40,8 @@ If no argument is passed, the function returns the current date: .. code-block:: php - $twig = new Twig_Environment($loader); - $twig->getExtension('Twig_Extension_Core')->setTimezone('Europe/Paris'); + $twig = new \Twig\Environment($loader); + $twig->getExtension('\Twig\Extension\CoreExtension')->setTimezone('Europe/Paris'); // before Twig 1.26 $twig->getExtension('core')->setTimezone('Europe/Paris'); @@ -52,4 +52,4 @@ Arguments * ``date``: The date * ``timezone``: The timezone -.. _`date and time formats`: http://php.net/manual/en/datetime.formats.php +.. _`date and time formats`: https://secure.php.net/manual/en/datetime.formats.php diff --git a/vendor/twig/twig/doc/functions/dump.rst b/vendor/twig/twig/doc/functions/dump.rst index a231f089e25a880c76c02bc631634ddb9e65024e..89fc96918e194eaf9b5c6664a3f6fe09ad19f16c 100644 --- a/vendor/twig/twig/doc/functions/dump.rst +++ b/vendor/twig/twig/doc/functions/dump.rst @@ -15,14 +15,14 @@ introspecting its variables: .. note:: The ``dump`` function is not available by default. You must add the - ``Twig_Extension_Debug`` extension explicitly when creating your Twig + ``\Twig\Extension\DebugExtension`` extension explicitly when creating your Twig environment:: - $twig = new Twig_Environment($loader, array( + $twig = new \Twig\Environment($loader, [ 'debug' => true, // ... - )); - $twig->addExtension(new Twig_Extension_Debug()); + ]); + $twig->addExtension(new \Twig\Extension\DebugExtension()); Even when enabled, the ``dump`` function won't display anything if the ``debug`` option on the environment is not enabled (to avoid leaking debug @@ -65,5 +65,5 @@ Arguments * ``context``: The context to dump -.. _`XDebug`: http://xdebug.org/docs/display -.. _`var_dump`: http://php.net/var_dump +.. _`XDebug`: https://xdebug.org/docs/display +.. _`var_dump`: https://secure.php.net/var_dump diff --git a/vendor/twig/twig/doc/functions/include.rst b/vendor/twig/twig/doc/functions/include.rst index 2f88ed77608129d40f61df15a216bcfc1f935547..d7fbc5955d6c1dfdd023ce9a4935d7a3ee02654d 100644 --- a/vendor/twig/twig/doc/functions/include.rst +++ b/vendor/twig/twig/doc/functions/include.rst @@ -37,8 +37,8 @@ You can disable access to the context by setting ``with_context`` to {# no variables will be accessible #} {{ include('template.html', with_context = false) }} -And if the expression evaluates to a ``Twig_Template`` or a -``Twig_TemplateWrapper`` instance, Twig will use it directly:: +And if the expression evaluates to a ``\Twig\Template`` or a +``\Twig\TemplateWrapper`` instance, Twig will use it directly:: // {{ include(template) }} @@ -48,7 +48,7 @@ And if the expression evaluates to a ``Twig_Template`` or a // as of Twig 1.28 $template = $twig->load('some_template.twig'); - $twig->display('template.twig', array('template' => $template)); + $twig->display('template.twig', ['template' => $template]); When you set the ``ignore_missing`` flag, Twig will return an empty string if the template does not exist: diff --git a/vendor/twig/twig/doc/functions/random.rst b/vendor/twig/twig/doc/functions/random.rst index 168e74f8f7dcd63b6874119a7a089c309b423879..324371cec548213b45e34e96c6baefed0e9c74cb 100644 --- a/vendor/twig/twig/doc/functions/random.rst +++ b/vendor/twig/twig/doc/functions/random.rst @@ -7,12 +7,17 @@ .. versionadded:: 1.6 String and integer handling was added in Twig 1.6. +.. versionadded:: 1.38 + The "max" argument was added in Twig 1.38. + The ``random`` function returns a random value depending on the supplied parameter type: * a random item from a sequence; * a random character from a string; * a random integer between 0 and the integer parameter (inclusive). +* 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 @@ -20,10 +25,12 @@ parameter type: {{ random('ABC') }} {# example output: C #} {{ random() }} {# example output: 15386094 (works as the native PHP mt_rand function) #} {{ random(5) }} {# example output: 3 #} + {{ random(50, 100) }} {# example output: 63 #} Arguments --------- * ``values``: The values +* ``max``: The max value when values is an integer -.. _`mt_rand`: http://php.net/mt_rand +.. _`mt_rand`: https://secure.php.net/mt_rand diff --git a/vendor/twig/twig/doc/functions/range.rst b/vendor/twig/twig/doc/functions/range.rst index 5c9db08928dd62e601feaad47d6e2bf14dcc1a85..38d282460fcf977b9e2f7b9de1aec2b79ea1dd7f 100644 --- a/vendor/twig/twig/doc/functions/range.rst +++ b/vendor/twig/twig/doc/functions/range.rst @@ -55,4 +55,4 @@ Arguments * ``high``: The highest possible value of the sequence. * ``step``: The increment between elements of the sequence. -.. _`range`: http://php.net/range +.. _`range`: https://secure.php.net/range diff --git a/vendor/twig/twig/doc/functions/template_from_string.rst b/vendor/twig/twig/doc/functions/template_from_string.rst index ce6a60dc0b8d7b5f6f7ce50fba91fda95200908c..db7db805b10e281ceec1127f90d5df4337634f0f 100644 --- a/vendor/twig/twig/doc/functions/template_from_string.rst +++ b/vendor/twig/twig/doc/functions/template_from_string.rst @@ -14,11 +14,11 @@ The ``template_from_string`` function loads a template from a string: .. note:: The ``template_from_string`` function is not available by default. You - must add the ``Twig_Extension_StringLoader`` extension explicitly when + must add the ``\Twig\Extension\StringLoaderExtension`` extension explicitly when creating your Twig environment:: - $twig = new Twig_Environment(...); - $twig->addExtension(new Twig_Extension_StringLoader()); + $twig = new \Twig\Environment(...); + $twig->addExtension(new \Twig\Extension\StringLoaderExtension()); .. note:: diff --git a/vendor/twig/twig/doc/installation.rst b/vendor/twig/twig/doc/installation.rst index afdcf16593b23ea37e050dd4b34a8a3be7679e47..d0889a9b09655d322f5a06cdef7f1be9518fbc80 100644 --- a/vendor/twig/twig/doc/installation.rst +++ b/vendor/twig/twig/doc/installation.rst @@ -55,6 +55,7 @@ Installing the C extension 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**. Twig comes with a C extension that enhances the performance of the Twig runtime engine; install it like any other PHP extensions: @@ -108,9 +109,9 @@ Finally, enable the extension in your ``php.ini`` configuration file: 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. +``\Twig\Template::getAttribute()`` method. .. _`download page`: https://github.com/twigphp/Twig/tags .. _`Composer`: https://getcomposer.org/download/ .. _`PHP documentation`: https://wiki.php.net/internals/windows/stepbystepbuild -.. _`Zend Server FAQ`: http://www.zend.com/en/products/server/faq#faqD6 +.. _`Zend Server FAQ`: https://www.zend.com/en/products/server/faq#faqD6 diff --git a/vendor/twig/twig/doc/internals.rst b/vendor/twig/twig/doc/internals.rst index fec65e00ea6aa340d404acc7972564749413da2c..f0b4f34ea2dcf3a58a88b1d1468a7afb6785fbba 100644 --- a/vendor/twig/twig/doc/internals.rst +++ b/vendor/twig/twig/doc/internals.rst @@ -27,27 +27,27 @@ The Lexer --------- The lexer tokenizes a template source code into a token stream (each token is -an instance of ``Twig_Token``, and the stream is an instance of -``Twig_TokenStream``). The default lexer recognizes 13 different token types: - -* ``Twig_Token::BLOCK_START_TYPE``, ``Twig_Token::BLOCK_END_TYPE``: Delimiters for blocks (``{% %}``) -* ``Twig_Token::VAR_START_TYPE``, ``Twig_Token::VAR_END_TYPE``: Delimiters for variables (``{{ }}``) -* ``Twig_Token::TEXT_TYPE``: A text outside an expression; -* ``Twig_Token::NAME_TYPE``: A name in an expression; -* ``Twig_Token::NUMBER_TYPE``: A number in an expression; -* ``Twig_Token::STRING_TYPE``: A string in an expression; -* ``Twig_Token::OPERATOR_TYPE``: An operator; -* ``Twig_Token::PUNCTUATION_TYPE``: A punctuation sign; -* ``Twig_Token::INTERPOLATION_START_TYPE``, ``Twig_Token::INTERPOLATION_END_TYPE`` (as of Twig 1.5): Delimiters for string interpolation; -* ``Twig_Token::EOF_TYPE``: Ends of template. +an instance of ``\Twig\Token``, and the stream is an instance of +``\Twig\TokenStream``). The default lexer recognizes 13 different token types: + +* ``\Twig\Token::BLOCK_START_TYPE``, ``\Twig\Token::BLOCK_END_TYPE``: Delimiters for blocks (``{% %}``) +* ``\Twig\Token::VAR_START_TYPE``, ``\Twig\Token::VAR_END_TYPE``: Delimiters for variables (``{{ }}``) +* ``\Twig\Token::TEXT_TYPE``: A text outside an expression; +* ``\Twig\Token::NAME_TYPE``: A name in an expression; +* ``\Twig\Token::NUMBER_TYPE``: A number in an expression; +* ``\Twig\Token::STRING_TYPE``: A string in an expression; +* ``\Twig\Token::OPERATOR_TYPE``: An operator; +* ``\Twig\Token::PUNCTUATION_TYPE``: A punctuation sign; +* ``\Twig\Token::INTERPOLATION_START_TYPE``, ``\Twig\Token::INTERPOLATION_END_TYPE`` (as of Twig 1.5): Delimiters for string interpolation; +* ``\Twig\Token::EOF_TYPE``: Ends of template. You can manually convert a source code into a token stream by calling the ``tokenize()`` method of an environment:: - $stream = $twig->tokenize(new Twig_Source($source, $identifier)); + $stream = $twig->tokenize(new \Twig\Source($source, $identifier)); .. versionadded:: 1.27 - ``Twig_Source`` was introduced in version 1.27, pass the source and the + ``\Twig\Source`` was introduced in version 1.27, pass the source and the identifier directly on previous versions. As the stream has a ``__toString()`` method, you can have a textual @@ -67,7 +67,7 @@ Here is the output for the ``Hello {{ name }}`` template: .. note:: - The default lexer (``Twig_Lexer``) can be changed by calling + The default lexer (``\Twig\Lexer``) can be changed by calling the ``setLexer()`` method:: $twig->setLexer($lexer); @@ -76,7 +76,7 @@ The Parser ---------- The parser converts the token stream into an AST (Abstract Syntax Tree), or a -node tree (an instance of ``Twig_Node_Module``). The core extension defines +node tree (an instance of ``\Twig\Node\ModuleNode``). The core extension defines the basic nodes like: ``for``, ``if``, ... and the expression nodes. You can manually convert a token stream into a node tree by calling the @@ -92,16 +92,16 @@ Here is the output for the ``Hello {{ name }}`` template: .. code-block:: text - Twig_Node_Module( - Twig_Node_Text(Hello ) - Twig_Node_Print( - Twig_Node_Expression_Name(name) + \Twig\Node\ModuleNode( + \Twig\Node\TextNode(Hello ) + \Twig\Node\PrintNode( + \Twig\Node\Expression\NameExpression(name) ) ) .. note:: - The default parser (``Twig_TokenParser``) can be changed by calling the + The default parser (``\Twig\TokenParser\AbstractTokenParser``) can be changed by calling the ``setParser()`` method:: $twig->setParser($parser); @@ -122,9 +122,9 @@ The generated template for a ``Hello {{ name }}`` template reads as follows using):: /* Hello {{ name }} */ - class __TwigTemplate_1121b6f109fe93ebe8c6e22e3712bceb extends Twig_Template + class __TwigTemplate_1121b6f109fe93ebe8c6e22e3712bceb extends \Twig\Template { - protected function doDisplay(array $context, array $blocks = array()) + protected function doDisplay(array $context, array $blocks = []) { // line 1 echo "Hello "; @@ -136,7 +136,7 @@ using):: .. note:: - The default compiler (``Twig_Compiler``) can be changed by calling the + The default compiler (``\Twig\Compiler``) can be changed by calling the ``setCompiler()`` method:: $twig->setCompiler($compiler); diff --git a/vendor/twig/twig/doc/intro.rst b/vendor/twig/twig/doc/intro.rst index d631430f7bff6c2f8412fd57e5eb47a81265cd8c..4407ea0c6466cbe2d7d60f0418065abdb9e32699 100644 --- a/vendor/twig/twig/doc/intro.rst +++ b/vendor/twig/twig/doc/intro.rst @@ -55,15 +55,15 @@ This section gives you a brief introduction to the PHP API for Twig. require_once '/path/to/vendor/autoload.php'; - $loader = new Twig_Loader_Array(array( + $loader = new \Twig\Loader\ArrayLoader([ 'index' => 'Hello {{ name }}!', - )); - $twig = new Twig_Environment($loader); + ]); + $twig = new \Twig\Environment($loader); - echo $twig->render('index', array('name' => 'Fabien')); + echo $twig->render('index', ['name' => 'Fabien']); -Twig uses a loader (``Twig_Loader_Array``) to locate templates, and an -environment (``Twig_Environment``) to store the configuration. +Twig uses a loader (``\Twig\Loader\ArrayLoader``) to locate templates, and an +environment (``\Twig\Environment``) to store the configuration. The ``render()`` method loads the template passed as a first argument and renders it with the variables passed as a second argument. @@ -71,12 +71,12 @@ renders it with the variables passed as a second argument. As templates are generally stored on the filesystem, Twig also comes with a filesystem loader:: - $loader = new Twig_Loader_Filesystem('/path/to/templates'); - $twig = new Twig_Environment($loader, array( + $loader = new \Twig\Loader\FilesystemLoader('/path/to/templates'); + $twig = new \Twig\Environment($loader, [ 'cache' => '/path/to/compilation_cache', - )); + ]); - echo $twig->render('index.html', array('name' => 'Fabien')); + echo $twig->render('index.html', ['name' => 'Fabien']); .. tip:: diff --git a/vendor/twig/twig/doc/recipes.rst b/vendor/twig/twig/doc/recipes.rst index b3ba7f4d7bc60cfb382e1a19d7377d12d6a016c5..93db2c6641bbf01fa497c74d32cc9493b3ea6af3 100644 --- a/vendor/twig/twig/doc/recipes.rst +++ b/vendor/twig/twig/doc/recipes.rst @@ -20,7 +20,7 @@ run a script along the lines of the following:: $twig = create_your_twig_env(); - $deprecations = new Twig_Util_DeprecationCollector($twig); + $deprecations = new \Twig\Util\DeprecationCollector($twig); print_r($deprecations->collectDir(__DIR__.'/templates')); @@ -32,13 +32,13 @@ catches deprecation notices, and return them. If your templates are not stored on the filesystem, use the ``collect()`` method instead. ``collect()`` takes a ``Traversable`` which must return template names as keys and template contents as values (as done by - ``Twig_Util_TemplateDirIterator``). + ``\Twig\Util\TemplateDirIterator``). However, this code won't find all deprecations (like using deprecated some Twig classes). To catch all notices, register a custom error handler like the one below:: - $deprecations = array(); + $deprecations = []; set_error_handler(function ($type, $msg) use (&$deprecations) { if (E_USER_DEPRECATED === $type) { $deprecations[] = $msg; @@ -150,7 +150,7 @@ parent's full, unambiguous template path in the extends tag: .. note:: This recipe was inspired by the following Django wiki page: - http://code.djangoproject.com/wiki/ExtendingTemplates + https://code.djangoproject.com/wiki/ExtendingTemplates Customizing the Syntax ---------------------- @@ -161,39 +161,39 @@ syntax. But for specific projects, it can make sense to change the defaults. To change the block delimiters, you need to create your own lexer object:: - $twig = new Twig_Environment(); + $twig = new \Twig\Environment(); - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array('{#', '#}'), - 'tag_block' => array('{%', '%}'), - 'tag_variable' => array('{{', '}}'), - 'interpolation' => array('#{', '}'), - )); + $lexer = new \Twig\Lexer($twig, [ + 'tag_comment' => ['{#', '#}'], + 'tag_block' => ['{%', '%}'], + 'tag_variable' => ['{{', '}}'], + 'interpolation' => ['#{', '}'], + ]); $twig->setLexer($lexer); Here are some configuration example that simulates some other template engines syntax:: // Ruby erb syntax - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array('<%#', '%>'), - 'tag_block' => array('<%', '%>'), - 'tag_variable' => array('<%=', '%>'), - )); + $lexer = new \Twig\Lexer($twig, [ + 'tag_comment' => ['<%#', '%>'], + 'tag_block' => ['<%', '%>'], + 'tag_variable' => ['<%=', '%>'], + ]); // SGML Comment Syntax - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array('<!--#', '-->'), - 'tag_block' => array('<!--', '-->'), - 'tag_variable' => array('${', '}'), - )); + $lexer = new \Twig\Lexer($twig, [ + 'tag_comment' => ['<!--#', '-->'], + 'tag_block' => ['<!--', '-->'], + 'tag_variable' => ['${', '}'], + ]); // Smarty like - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array('{*', '*}'), - 'tag_block' => array('{', '}'), - 'tag_variable' => array('{$', '}'), - )); + $lexer = new \Twig\Lexer($twig, [ + 'tag_comment' => ['{*', '*}'], + 'tag_block' => ['{', '}'], + 'tag_variable' => ['{$', '}'], + ]); Using dynamic Object Properties ------------------------------- @@ -233,12 +233,12 @@ Sometimes, when using nested loops, you need to access the parent context. The parent context is always accessible via the ``loop.parent`` variable. For instance, if you have the following template data:: - $data = array( - 'topics' => array( - 'topic1' => array('Message 1 of topic 1', 'Message 2 of topic 1'), - 'topic2' => array('Message 1 of topic 2', 'Message 2 of topic 2'), - ), - ); + $data = [ + 'topics' => [ + 'topic1' => ['Message 1 of topic 1', 'Message 2 of topic 1'], + 'topic2' => ['Message 1 of topic 2', 'Message 2 of topic 2'], + ], + ]; And the following template to display all messages in all topics: @@ -270,7 +270,7 @@ Defining undefined Functions and Filters on the Fly --------------------------------------------------- When a function (or a filter) is not defined, Twig defaults to throw a -``Twig_Error_Syntax`` exception. However, it can also call a `callback`_ (any +``\Twig\Error\SyntaxError`` exception. However, it can also call a `callback`_ (any valid PHP callable) which should return a function (or a filter). For filters, register callbacks with ``registerUndefinedFilterCallback()``. @@ -280,7 +280,7 @@ For functions, use ``registerUndefinedFunctionCallback()``:: // don't try this at home as it's not secure at all! $twig->registerUndefinedFunctionCallback(function ($name) { if (function_exists($name)) { - return new Twig_SimpleFunction($name, $name); + return new \Twig\TwigFunction($name, $name); } return false; @@ -306,10 +306,10 @@ saving it. If the template code is stored in a `$template` variable, here is how you can do it:: try { - $twig->parse($twig->tokenize(new Twig_Source($template))); + $twig->parse($twig->tokenize(new \Twig\Source($template))); // the $template is valid - } catch (Twig_Error_Syntax $e) { + } catch (\Twig\Error\SyntaxError $e) { // $template contains one or more syntax errors } @@ -318,16 +318,16 @@ If you iterate over a set of files, you can pass the filename to the foreach ($files as $file) { try { - $twig->parse($twig->tokenize(new Twig_Source($template, $file->getFilename(), $file))); + $twig->parse($twig->tokenize(new \Twig\Source($template, $file->getFilename(), $file))); // the $template is valid - } catch (Twig_Error_Syntax $e) { + } catch (\Twig\Error\SyntaxError $e) { // $template contains one or more syntax errors } } .. versionadded:: 1.27 - ``Twig_Source`` was introduced in version 1.27, pass the source and the + ``\Twig\Source`` was introduced in version 1.27, pass the source and the identifier directly on previous versions. .. note:: @@ -345,16 +345,16 @@ cache won't update the cache. To get around this, force Twig to invalidate the bytecode cache:: - $twig = new Twig_Environment($loader, array( - 'cache' => new Twig_Cache_Filesystem('/some/cache/path', Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION), + $twig = new \Twig\Environment($loader, [ + 'cache' => new \Twig\Cache\FilesystemCache('/some/cache/path', \Twig\Cache\FilesystemCache::FORCE_BYTECODE_INVALIDATION), // ... - )); + ]); .. note:: - Before Twig 1.22, you should extend ``Twig_Environment`` instead:: + Before Twig 1.22, you should extend ``\Twig\Environment`` instead:: - class OpCacheAwareTwigEnvironment extends Twig_Environment + class OpCacheAwareTwigEnvironment extends \Twig\Environment { protected function writeCacheFile($file, $content) { @@ -372,19 +372,19 @@ To get around this, force Twig to invalidate the bytecode cache:: Reusing a stateful Node Visitor ------------------------------- -When attaching a visitor to a ``Twig_Environment`` instance, Twig uses it to +When attaching a visitor to a ``\Twig\Environment`` instance, Twig uses it to visit *all* templates it compiles. If you need to keep some state information around, you probably want to reset it when visiting a new template. This can be easily achieved with the following code:: - protected $someTemplateState = array(); + protected $someTemplateState = []; - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) + public function enterNode(Twig_NodeInterface $node, \Twig\Environment $env) { - if ($node instanceof Twig_Node_Module) { + if ($node instanceof \Twig\Node\ModuleNode) { // reset the state as we are entering a new template - $this->someTemplateState = array(); + $this->someTemplateState = []; } // ... @@ -409,15 +409,15 @@ First, let's create a temporary in-memory SQLite3 database to work with:: {% block content %}Hello {{ name }}{% endblock %} '; $now = time(); - $dbh->exec("INSERT INTO templates (name, source, last_modified) VALUES ('base.twig', '$base', $now)"); - $dbh->exec("INSERT INTO templates (name, source, last_modified) VALUES ('index.twig', '$index', $now)"); + $dbh->prepare('INSERT INTO templates (name, source, last_modified) VALUES (?, ?, ?)')->execute(['base.twig', $base, $now]); + $dbh->prepare('INSERT INTO templates (name, source, last_modified) VALUES (?, ?, ?)')->execute(['index.twig', $index, $now]); We have created a simple ``templates`` table that hosts two templates: ``base.twig`` and ``index.twig``. Now, let's define a loader able to use this database:: - class DatabaseTwigLoader implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface + class DatabaseTwigLoader implements \Twig\Loader\LoaderInterface, \Twig\Loader\ExistsLoaderInterface, \Twig\Loader\SourceContextLoaderInterface { protected $dbh; @@ -429,23 +429,23 @@ Now, let's define a loader able to use this database:: public function getSource($name) { if (false === $source = $this->getValue('source', $name)) { - throw new Twig_Error_Loader(sprintf('Template "%s" does not exist.', $name)); + throw new \Twig\Error\LoaderError(sprintf('Template "%s" does not exist.', $name)); } return $source; } - // Twig_SourceContextLoaderInterface as of Twig 1.27 + // \Twig\Loader\SourceContextLoaderInterface as of Twig 1.27 public function getSourceContext($name) { if (false === $source = $this->getValue('source', $name)) { - throw new Twig_Error_Loader(sprintf('Template "%s" does not exist.', $name)); + throw new \Twig\Error\LoaderError(sprintf('Template "%s" does not exist.', $name)); } - return new Twig_Source($source, $name); + return new \Twig\Source($source, $name); } - // Twig_ExistsLoaderInterface as of Twig 1.11 + // \Twig\Loader\ExistsLoaderInterface as of Twig 1.11 public function exists($name) { return $name === $this->getValue('name', $name); @@ -468,7 +468,7 @@ Now, let's define a loader able to use this database:: protected function getValue($column, $name) { $sth = $this->dbh->prepare('SELECT '.$column.' FROM templates WHERE name = :name'); - $sth->execute(array(':name' => (string) $name)); + $sth->execute([':name' => (string) $name]); return $sth->fetchColumn(); } @@ -477,9 +477,9 @@ Now, let's define a loader able to use this database:: Finally, here is an example on how you can use it:: $loader = new DatabaseTwigLoader($dbh); - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); - echo $twig->render('index.twig', array('name' => 'Fabien')); + echo $twig->render('index.twig', ['name' => 'Fabien']); Using different Template Sources -------------------------------- @@ -487,7 +487,7 @@ Using different Template Sources This recipe is the continuation of the previous one. Even if you store the contributed templates in a database, you might want to keep the original/base templates on the filesystem. When templates can be loaded from different -sources, you need to use the ``Twig_Loader_Chain`` loader. +sources, you need to use the ``\Twig\Loader\ChainLoader`` loader. As you can see in the previous recipe, we reference the template in the exact same way as we would have done it with a regular filesystem loader. This is @@ -496,14 +496,14 @@ filesystem, or any other loader for that matter: the template name should be a logical name, and not the path from the filesystem:: $loader1 = new DatabaseTwigLoader($dbh); - $loader2 = new Twig_Loader_Array(array( + $loader2 = new \Twig\Loader\ArrayLoader([ 'base.twig' => '{% block content %}{% endblock %}', - )); - $loader = new Twig_Loader_Chain(array($loader1, $loader2)); + ]); + $loader = new \Twig\Loader\ChainLoader([$loader1, $loader2]); - $twig = new Twig_Environment($loader); + $twig = new \Twig\Environment($loader); - echo $twig->render('index.twig', array('name' => 'Fabien')); + echo $twig->render('index.twig', ['name' => 'Fabien']); Now that the ``base.twig`` templates is defined in an array loader, you can remove it from the database, and everything else will still work as before. @@ -513,17 +513,17 @@ Loading a Template from a String 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_StringLoader`` extension): +``\Twig\Extension\StringLoaderExtension`` extension): .. code-block:: jinja {{ include(template_from_string("Hello {{ name }}")) }} From PHP, it's also possible to load a template stored in a string via -``Twig_Environment::createTemplate()`` (available as of Twig 1.18):: +``\Twig\Environment::createTemplate()`` (available as of Twig 1.18):: $template = $twig->createTemplate('hello {{ name }}'); - echo $template->render(array('name' => 'Fabien')); + echo $template->render(['name' => 'Fabien']); .. note:: @@ -561,8 +561,8 @@ include in your templates: .. code-block:: php - $env->setLexer(new Twig_Lexer($env, array( - 'tag_variable' => array('{[', ']}'), - ))); + $env->setLexer(new \Twig\Lexer($env, [ + 'tag_variable' => ['{[', ']}'], + ])); -.. _callback: http://www.php.net/manual/en/function.is-callable.php +.. _callback: https://secure.php.net/manual/en/function.is-callable.php diff --git a/vendor/twig/twig/doc/tags/deprecated.rst b/vendor/twig/twig/doc/tags/deprecated.rst new file mode 100644 index 0000000000000000000000000000000000000000..f36743f0852b711be18b104ba6a829ddbbb39ac3 --- /dev/null +++ b/vendor/twig/twig/doc/tags/deprecated.rst @@ -0,0 +1,30 @@ +``deprecated`` +============== + +.. versionadded:: 1.36 and 2.6 + The ``deprecated`` tag was added in Twig 1.36 and 2.6. + +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 + + {# base.twig #} + {% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %} + {% extends 'layout.twig' %} + +Also you can deprecate a block in the following way: + +.. code-block:: jinja + + {% block hey %} + {% deprecated 'The "hey" block is deprecated, use "greet" instead.' %} + {{ block('greet') }} + {% endblock %} + + {% block greet %} + Hey you! + {% endblock %} + +Note that by default, the deprecation notices are silenced and never displayed nor logged. +See :ref:`deprecation-notices` to learn how to handle them. diff --git a/vendor/twig/twig/doc/tags/embed.rst b/vendor/twig/twig/doc/tags/embed.rst index 66fc21b5fa7ab226146e761ac3e9c75352e91125..8bca936cf4e8ead39a0414bbca1964892671f723 100644 --- a/vendor/twig/twig/doc/tags/embed.rst +++ b/vendor/twig/twig/doc/tags/embed.rst @@ -88,26 +88,26 @@ two boxes side by side: Without the ``embed`` tag, you have two ways to design your templates: - * Create two "intermediate" base templates that extend the master layout - template: one with vertically stacked boxes to be used by the "foo" and - "bar" pages and another one with side-by-side boxes for the "boom" and - "baz" pages. +* Create two "intermediate" base templates that extend the master layout + template: one with vertically stacked boxes to be used by the "foo" and + "bar" pages and another one with side-by-side boxes for the "boom" and + "baz" pages. - * Embed the markup for the top/bottom and left/right boxes into each page - template directly. +* Embed the markup for the top/bottom and left/right boxes into each page + template directly. These two solutions do not scale well because they each have a major drawback: - * The first solution may indeed work for this simplified example. But imagine - we add a sidebar, which may again contain different, recurring structures - of content. Now we would need to create intermediate base templates for - all occurring combinations of content structure and sidebar structure... - and so on. +* The first solution may indeed work for this simplified example. But imagine + we add a sidebar, which may again contain different, recurring structures + of content. Now we would need to create intermediate base templates for + all occurring combinations of content structure and sidebar structure... + and so on. - * The second solution involves duplication of common code with all its negative - consequences: any change involves finding and editing all affected copies - of the structure, correctness has to be verified for each copy, copies may - go out of sync by careless modifications etc. +* The second solution involves duplication of common code with all its negative + consequences: any change involves finding and editing all affected copies + of the structure, correctness has to be verified for each copy, copies may + go out of sync by careless modifications etc. In such a situation, the ``embed`` tag comes in handy. The common layout code can live in a single base template, and the two different content structures, diff --git a/vendor/twig/twig/doc/tags/extends.rst b/vendor/twig/twig/doc/tags/extends.rst index 8bf29c4f9019d910abb756415b1cd7c4bc66edb9..290616720128cd156d73f0feab4106e98e9a4386 100644 --- a/vendor/twig/twig/doc/tags/extends.rst +++ b/vendor/twig/twig/doc/tags/extends.rst @@ -153,7 +153,7 @@ Twig supports dynamic inheritance by using a variable as the base template: {% extends some_var %} -If the variable evaluates to a ``Twig_Template`` or a ``Twig_TemplateWrapper`` +If the variable evaluates to a ``\Twig\Template`` or a ``\Twig\TemplateWrapper`` instance, Twig will use it as the parent template:: // {% extends layout %} @@ -164,7 +164,7 @@ instance, Twig will use it as the parent template:: // as of Twig 1.28 $layout = $twig->load('some_layout_template.twig'); - $twig->display('template.twig', array('layout' => $layout)); + $twig->display('template.twig', ['layout' => $layout]); .. versionadded:: 1.2 The possibility to pass an array of templates has been added in Twig 1.2. diff --git a/vendor/twig/twig/doc/tags/filter.rst b/vendor/twig/twig/doc/tags/filter.rst index 82ca5c62f0f8532453ca5f44a1cd1647fe6e6f75..90d7b472ec7e8f2749e65cf1c3a9a825bbe752d1 100644 --- a/vendor/twig/twig/doc/tags/filter.rst +++ b/vendor/twig/twig/doc/tags/filter.rst @@ -10,11 +10,11 @@ data. Just wrap the code in the special ``filter`` section: This text becomes uppercase {% endfilter %} -You can also chain filters: +You can also chain filters and pass arguments to them: .. code-block:: jinja - {% filter lower|escape %} + {% filter lower|escape('html') %} <strong>SOME TEXT</strong> {% endfilter %} diff --git a/vendor/twig/twig/doc/tags/flush.rst b/vendor/twig/twig/doc/tags/flush.rst index 55ef593a9216e13432512f6938e032c5a8bf074b..7fed6150f75850df1d7d979d28a5de51886fca7c 100644 --- a/vendor/twig/twig/doc/tags/flush.rst +++ b/vendor/twig/twig/doc/tags/flush.rst @@ -14,4 +14,4 @@ The ``flush`` tag tells Twig to flush the output buffer: Internally, Twig uses the PHP `flush`_ function. -.. _`flush`: http://php.net/flush +.. _`flush`: https://secure.php.net/flush diff --git a/vendor/twig/twig/doc/tags/if.rst b/vendor/twig/twig/doc/tags/if.rst index 12edf980df2ff756a56ab131ecbd26f687c0f8b9..225246e902a7778c5a4a2897f5e41872a5ee3292 100644 --- a/vendor/twig/twig/doc/tags/if.rst +++ b/vendor/twig/twig/doc/tags/if.rst @@ -50,12 +50,12 @@ use more complex ``expressions`` there too: .. code-block:: jinja - {% if kenny.sick %} - Kenny is sick. - {% elseif kenny.dead %} - You killed Kenny! You bastard!!! + {% if product.stock > 10 %} + Available + {% elseif product.stock > 0 %} + Only {{ product.stock }} left! {% else %} - Kenny looks okay --- so far + Sold-out! {% endif %} .. note:: @@ -68,7 +68,10 @@ use more complex ``expressions`` there too: ====================== ==================== empty string false numeric zero false + NAN (Not A Number) true + INF (Infinity) true whitespace-only string true + string "0" or '0' false empty array false null false non-empty array true diff --git a/vendor/twig/twig/doc/tags/include.rst b/vendor/twig/twig/doc/tags/include.rst index 24ff24db69d6779698700911c6bb7acc7345dbfb..2200c87a6a823f9e529f4bf89ec953665d4a4add 100644 --- a/vendor/twig/twig/doc/tags/include.rst +++ b/vendor/twig/twig/doc/tags/include.rst @@ -2,7 +2,7 @@ =========== The ``include`` statement includes a template and returns the rendered content -of that file into the current namespace: +of that file: .. code-block:: jinja @@ -10,6 +10,30 @@ of that file into the current namespace: Body {% include 'footer.html' %} +.. note:: + + As of Twig 1.12, it is recommended to use the + :doc:`include<../functions/include>` function instead as it provides the + same features with a bit more flexibility: + + * The ``include`` function is semantically more "correct" (including a + template outputs its rendered contents in the current scope; a tag should + not display anything); + + * The rendered template can be more easily stored in a variable when using + the ``include`` function: + + .. code-block:: jinja + + {% set content %}{% include 'template.html' %}{% endset %} + + {# vs #} + + {% set content = include('template.html') %} + + * The ``include`` function does not impose any specific order for + arguments thanks to :ref:`named arguments <named-arguments>`. + Included templates have access to the variables of the active context. If you are using the filesystem loader, the templates are looked for in the @@ -50,8 +74,8 @@ The template name can be any valid Twig expression: {% include some_var %} {% include ajax ? 'ajax.html' : 'not_ajax.html' %} -And if the expression evaluates to a ``Twig_Template`` or a -``Twig_TemplateWrapper`` instance, Twig will use it directly:: +And if the expression evaluates to a ``\Twig\Template`` or a +``\Twig\TemplateWrapper`` instance, Twig will use it directly:: // {% include template %} @@ -61,7 +85,7 @@ And if the expression evaluates to a ``Twig_Template`` or a // as of Twig 1.28 $template = $twig->load('some_template.twig'); - $twig->display('template.twig', array('template' => $template)); + $twig->display('template.twig', ['template' => $template]); .. versionadded:: 1.2 The ``ignore missing`` feature has been added in Twig 1.2. diff --git a/vendor/twig/twig/doc/tags/index.rst b/vendor/twig/twig/doc/tags/index.rst index dbe2459e30408af0df0eb983b6d3956b224839fb..373cf6e656542961fd57c28c0b6714f5d8e215e0 100644 --- a/vendor/twig/twig/doc/tags/index.rst +++ b/vendor/twig/twig/doc/tags/index.rst @@ -23,3 +23,4 @@ Tags use verbatim with + deprecated diff --git a/vendor/twig/twig/doc/tags/macro.rst b/vendor/twig/twig/doc/tags/macro.rst index a8aa76fd92339eb8b8450207a2c91439f40f5b54..7894a64f1a94b2086ffe4cffa90cc6c3cc0fa469 100644 --- a/vendor/twig/twig/doc/tags/macro.rst +++ b/vendor/twig/twig/doc/tags/macro.rst @@ -1,6 +1,11 @@ ``macro`` ========= +.. versionadded:: 1.12 + + The possibility to define default values for arguments in the macro + signature was added in Twig 1.12. + Macros are comparable with functions in regular programming languages. They are useful to put often used HTML idioms into reusable elements to not repeat yourself. @@ -9,14 +14,25 @@ Here is a small example of a macro that renders a form element: .. code-block:: jinja - {% macro input(name, value, type, size) %} - <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" /> + {% macro input(name, value, type = "text", size = 20) %} + <input type="{{ type }}" name="{{ name }}" value="{{ value|e }}" size="{{ size }}" /> {% endmacro %} -Macros differ from native PHP functions in a few ways: +Each argument can have a default value (here ``text`` is the default value for +``type`` if not provided in the call). -* Default argument values are defined by using the ``default`` filter in the - macro body; +.. note:: + + Before Twig 1.12, defining default argument values was done via the + ``default`` filter in the macro body: + + .. code-block:: jinja + + {% macro input(name, value, type, size) %} + <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" /> + {% endmacro %} + +Macros differ from native PHP functions in a few ways: * Arguments of a macro are always optional. diff --git a/vendor/twig/twig/doc/tags/set.rst b/vendor/twig/twig/doc/tags/set.rst index 3eba239a9a773ae33e2f0efb0c4666f37d1904f1..3a95b6e07842577e4a22650868499b097f2d3b0c 100644 --- a/vendor/twig/twig/doc/tags/set.rst +++ b/vendor/twig/twig/doc/tags/set.rst @@ -18,7 +18,7 @@ any other ones: {# displays bar #} {{ foo }} -The assigned value can be any valid :ref:`Twig expressions +The assigned value can be any valid :ref:`Twig expression <twig-expressions>`: .. code-block:: jinja diff --git a/vendor/twig/twig/doc/tags/spaceless.rst b/vendor/twig/twig/doc/tags/spaceless.rst index b39cb27efe676b136f89cf1c3c1bf19b8c74516e..14858243fa8ca61a6bff075f090aea44b3eadbbc 100644 --- a/vendor/twig/twig/doc/tags/spaceless.rst +++ b/vendor/twig/twig/doc/tags/spaceless.rst @@ -1,6 +1,10 @@ ``spaceless`` ============= +.. tip:: + + As of Twig 1.38, use the :doc:`spaceless <../filters/spaceless>` filter instead. + Use the ``spaceless`` tag to remove whitespace *between HTML tags*, not whitespace within HTML tags or whitespace in plain text: diff --git a/vendor/twig/twig/doc/templates.rst b/vendor/twig/twig/doc/templates.rst index 3d60779a09b2df75051f06aa29651fa6841ec681..91db45aa56a02a889f60a2769fcbb75d416a128c 100644 --- a/vendor/twig/twig/doc/templates.rst +++ b/vendor/twig/twig/doc/templates.rst @@ -196,6 +196,8 @@ progression of integers: Go to the :doc:`functions<functions/index>` page to learn more about the built-in functions. +.. _named-arguments: + Named Arguments --------------- @@ -313,8 +315,8 @@ will be available in the included template too: The included template ``render_box.html`` is able to access the ``box`` variable. -The filename of the template depends on the template loader. For instance, the -``Twig_Loader_Filesystem`` allows you to access other templates by giving the +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 @@ -555,11 +557,12 @@ even if you're not working with PHP you should feel comfortable with it. .. note:: - The operator precedence is as follows, with the lowest-precedence - operators listed first: ``b-and``, ``b-xor``, ``b-or``, ``or``, ``and``, - ``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``, ``matches``, - ``starts with``, ``ends with``, ``..``, ``+``, ``-``, ``~``, ``*``, ``/``, - ``//``, ``%``, ``is``, ``**``, ``|``, ``[]``, and ``.``: + The operator precedence is as follows, with the lowest-precedence operators + listed first: ``?:`` (ternary operator), ``b-and``, ``b-xor``, ``b-or``, + ``or``, ``and``, ``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``, + ``matches``, ``starts with``, ``ends with``, ``..``, ``+``, ``-``, ``~``, + ``*``, ``/``, ``//``, ``%``, ``is`` (tests), ``**``, ``??``, ``|`` + (filters), ``[]``, and ``.``. .. code-block:: jinja @@ -659,6 +662,8 @@ but exists for completeness' sake. The following operators are supported: * ``**``: Raises the left operand to the power of the right operand. ``{{ 2 ** 3 }}`` would return ``8``. +.. _template_logic: + Logic ~~~~~ @@ -674,7 +679,7 @@ You can combine multiple expressions with the following operators: .. note:: - Twig also support bitwise operators (``b-and``, ``b-xor``, and ``b-or``). + Twig also supports bitwise operators (``b-and``, ``b-xor``, and ``b-or``). .. note:: @@ -898,12 +903,12 @@ Extension<creating_extensions>` chapter. .. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig .. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin .. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language -.. _`extension repository`: http://github.com/twigphp/Twig-extensions +.. _`extension repository`: https://github.com/twigphp/Twig-extensions .. _`Twig syntax mode`: https://github.com/bobthecow/Twig-HTML.mode .. _`other Twig syntax mode`: https://github.com/muxx/Twig-HTML.mode .. _`Notepad++ Twig Highlighter`: https://github.com/Banane9/notepadplusplus-twig .. _`web-mode.el`: http://web-mode.org/ -.. _`regular expressions`: http://php.net/manual/en/pcre.pattern.php +.. _`regular expressions`: https://secure.php.net/manual/en/pcre.pattern.php .. _`PHP-twig for atom`: https://github.com/reesef/php-twig -.. _`TwigFiddle`: http://twigfiddle.com/ +.. _`TwigFiddle`: https://twigfiddle.com/ .. _`Twig pack`: https://marketplace.visualstudio.com/items?itemName=bajdzis.vscode-twig-pack diff --git a/vendor/twig/twig/ext/twig/php_twig.h b/vendor/twig/twig/ext/twig/php_twig.h index 6a32b017b19f0936371ea2a438d123df231a3072..efbe2da2c9d1c7da85c322658a719d4b6858c05e 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.35.3" +#define PHP_TWIG_VERSION "1.38.2" #include "php.h" diff --git a/vendor/twig/twig/ext/twig/twig.c b/vendor/twig/twig/ext/twig/twig.c index b81d8ce3c33764a86f1fb21cecc2894756d9ce7f..171ed10bb8a57181dfb8a15d48bbd439514e8770 100644 --- a/vendor/twig/twig/ext/twig/twig.c +++ b/vendor/twig/twig/ext/twig/twig.c @@ -733,7 +733,7 @@ PHP_FUNCTION(twig_template_get_attributes) /* // array - if (Twig_Template::METHOD_CALL !== $type) { + if (\Twig\Template::METHOD_CALL !== $type) { $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item; if ((is_array($object) && array_key_exists($arrayItem, $object)) @@ -771,7 +771,7 @@ PHP_FUNCTION(twig_template_get_attributes) return; } /* - if (Twig_Template::ARRAY_CALL === $type) { + if (\Twig\Template::ARRAY_CALL === $type) { if ($isDefinedTest) { return false; } @@ -799,7 +799,7 @@ PHP_FUNCTION(twig_template_get_attributes) } else { $message = sprintf('Key "%s" for array with keys "%s" does not exist', $arrayItem, implode(', ', array_keys($object))); } - } elseif (Twig_Template::ARRAY_CALL === $type) { + } elseif (\Twig\Template::ARRAY_CALL === $type) { if (null === $object) { $message = sprintf('Impossible to access a key ("%s") on a null variable', $item); } else { @@ -810,7 +810,7 @@ PHP_FUNCTION(twig_template_get_attributes) } else { $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s")', $item, gettype($object), $object); } - throw new Twig_Error_Runtime($message, -1, $this->getTemplateName()); + throw new \Twig\Error\RuntimeError($message, -1, $this->getTemplateName()); } } */ @@ -876,7 +876,7 @@ PHP_FUNCTION(twig_template_get_attributes) $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object); } - throw new Twig_Error_Runtime($message, -1, $this->getTemplateName()); + throw new \Twig\Error\RuntimeError($message, -1, $this->getTemplateName()); } */ if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { @@ -916,14 +916,14 @@ PHP_FUNCTION(twig_template_get_attributes) /* // object property - if (Twig_Template::METHOD_CALL !== $type && !$object instanceof Twig_Template) { + if (\Twig\Template::METHOD_CALL !== $type && !$object instanceof \Twig\Template) { if (isset($object->$item) || array_key_exists((string) $item, $object)) { if ($isDefinedTest) { return true; } - if ($this->env->hasExtension('Twig_Extension_Sandbox')) { - $this->env->getExtension('Twig_Extension_Sandbox')->checkPropertyAllowed($object, $item); + if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) { + $this->env->getExtension('\Twig\Extension\SandboxExtension')->checkPropertyAllowed($object, $item); } return $object->$item; @@ -958,8 +958,8 @@ PHP_FUNCTION(twig_template_get_attributes) // object method if (!isset(self::$cache[$class]['methods'])) { if ($object instanceof self) { - $ref = new ReflectionClass($class); - $methods = array(); + $ref = new \ReflectionClass($class); + $methods = []; foreach ($ref->getMethods(ReflectionMethod::IS_PUBLIC) as $refMethod) { $methodName = strtolower($refMethod->name); @@ -1029,7 +1029,7 @@ PHP_FUNCTION(twig_template_get_attributes) return null; } - throw new Twig_Error_Runtime(sprintf('Method "%s" for object "%s" does not exist.', $item, get_class($object)), -1, $this->getTemplateName()); + throw new \Twig\Error\RuntimeError(sprintf('Method "%s" for object "%s" does not exist.', $item, get_class($object)), -1, $this->getTemplateName()); } if ($isDefinedTest) { @@ -1061,8 +1061,8 @@ PHP_FUNCTION(twig_template_get_attributes) RETURN_TRUE; } /* - if ($this->env->hasExtension('Twig_Extension_Sandbox')) { - $this->env->getExtension('Twig_Extension_Sandbox')->checkMethodAllowed($object, $method); + if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) { + $this->env->getExtension('\Twig\Extension\SandboxExtension')->checkMethodAllowed($object, $method); } */ MAKE_STD_ZVAL(zmethod); @@ -1081,8 +1081,8 @@ PHP_FUNCTION(twig_template_get_attributes) // Some objects throw exceptions when they have __call, and the method we try // to call is not supported. If ignoreStrictCheck is true, we should return null. try { - $ret = call_user_func_array(array($object, $method), $arguments); - } catch (BadMethodCallException $e) { + $ret = call_user_func_array([$object, $method], $arguments); + } catch (\BadMethodCallException $e) { if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) { return null; } @@ -1117,7 +1117,7 @@ PHP_FUNCTION(twig_template_get_attributes) } @trigger_error($message, E_USER_DEPRECATED); - return $ret === '' ? '' : new Twig_Markup($ret, $this->env->getCharset()); + return $ret === '' ? '' : new \Twig\Markup($ret, $this->env->getCharset()); } return $ret; diff --git a/vendor/twig/twig/lib/Twig/Autoloader.php b/vendor/twig/twig/lib/Twig/Autoloader.php index 212af5445693aae29e8436f4a9d9661e043e0bed..633d7a582eb6e72f0b2406fe2fb4caa54633cb4b 100644 --- a/vendor/twig/twig/lib/Twig/Autoloader.php +++ b/vendor/twig/twig/lib/Twig/Autoloader.php @@ -29,11 +29,7 @@ public static function register($prepend = false) { @trigger_error('Using Twig_Autoloader is deprecated since version 1.21. Use Composer instead.', E_USER_DEPRECATED); - if (PHP_VERSION_ID < 50300) { - spl_autoload_register(array(__CLASS__, 'autoload')); - } else { - spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend); - } + spl_autoload_register([__CLASS__, 'autoload'], true, $prepend); } /** @@ -47,7 +43,7 @@ public static function autoload($class) return; } - if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) { + if (is_file($file = __DIR__.'/../'.str_replace(['_', "\0"], ['/', ''], $class).'.php')) { require $file; } } diff --git a/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php b/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php index d8ef02fb281cb314e3930bbf0f185d184e1458ad..fe99b25889b38b496656c083181609619d7ba9d0 100644 --- a/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php +++ b/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php @@ -1,54 +1,11 @@ <?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\NodeVisitor\AbstractNodeVisitor; -/** - * Twig_BaseNodeVisitor can be used to make node visitors compatible with Twig 1.x and 2.x. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -abstract class Twig_BaseNodeVisitor implements Twig_NodeVisitorInterface -{ - final public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) - { - if (!$node instanceof Twig_Node) { - throw new LogicException('Twig_BaseNodeVisitor only supports Twig_Node instances.'); - } - - return $this->doEnterNode($node, $env); - } +class_exists('Twig\NodeVisitor\AbstractNodeVisitor'); - final public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) +if (\false) { + class Twig_BaseNodeVisitor extends AbstractNodeVisitor { - if (!$node instanceof Twig_Node) { - throw new LogicException('Twig_BaseNodeVisitor only supports Twig_Node instances.'); - } - - return $this->doLeaveNode($node, $env); } - - /** - * Called before child nodes are visited. - * - * @return Twig_Node The modified node - */ - abstract protected function doEnterNode(Twig_Node $node, Twig_Environment $env); - - /** - * Called after child nodes are visited. - * - * @return Twig_Node|false The modified node or false if the node must be removed - */ - abstract protected function doLeaveNode(Twig_Node $node, Twig_Environment $env); } - -class_alias('Twig_BaseNodeVisitor', 'Twig\NodeVisitor\AbstractNodeVisitor', false); -class_exists('Twig_Environment'); -class_exists('Twig_Node'); diff --git a/vendor/twig/twig/lib/Twig/Cache/Filesystem.php b/vendor/twig/twig/lib/Twig/Cache/Filesystem.php index 65976282b46c2f11cdb6a31563907a22cfaafaab..ce957583e0f3cbdb6468f61faebebc6d00a3bc45 100644 --- a/vendor/twig/twig/lib/Twig/Cache/Filesystem.php +++ b/vendor/twig/twig/lib/Twig/Cache/Filesystem.php @@ -1,93 +1,11 @@ <?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\Cache\FilesystemCache; -/** - * Implements a cache on the filesystem. - * - * @author Andrew Tch <andrew@noop.lv> - */ -class Twig_Cache_Filesystem implements Twig_CacheInterface -{ - const FORCE_BYTECODE_INVALIDATION = 1; +class_exists('Twig\Cache\FilesystemCache'); - private $directory; - private $options; - - /** - * @param $directory string The root cache directory - * @param $options int A set of options - */ - public function __construct($directory, $options = 0) - { - $this->directory = rtrim($directory, '\/').'/'; - $this->options = $options; - } - - public function generateKey($name, $className) - { - $hash = hash('sha256', $className); - - return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php'; - } - - public function load($key) - { - if (file_exists($key)) { - @include_once $key; - } - } - - public function write($key, $content) - { - $dir = dirname($key); - if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true)) { - if (PHP_VERSION_ID >= 50300) { - clearstatcache(true, $dir); - } - if (!is_dir($dir)) { - throw new RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir)); - } - } - } elseif (!is_writable($dir)) { - throw new RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir)); - } - - $tmpFile = tempnam($dir, basename($key)); - if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $key)) { - @chmod($key, 0666 & ~umask()); - - if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) { - // Compile cached file into bytecode cache - if (function_exists('opcache_invalidate')) { - opcache_invalidate($key, true); - } elseif (function_exists('apc_compile_file')) { - apc_compile_file($key); - } - } - - return; - } - - throw new RuntimeException(sprintf('Failed to write cache file "%s".', $key)); - } - - public function getTimestamp($key) +if (\false) { + class Twig_Cache_Filesystem extends FilesystemCache { - if (!file_exists($key)) { - return 0; - } - - return (int) @filemtime($key); } } - -class_alias('Twig_Cache_Filesystem', 'Twig\Cache\FilesystemCache', false); diff --git a/vendor/twig/twig/lib/Twig/Cache/Null.php b/vendor/twig/twig/lib/Twig/Cache/Null.php index 69d1d2f98a4e3722445b81a551c6f4e1ff9f52bc..5cfa40ec2946c7ade3d4e77f5ba6de48962fb4a8 100644 --- a/vendor/twig/twig/lib/Twig/Cache/Null.php +++ b/vendor/twig/twig/lib/Twig/Cache/Null.php @@ -1,40 +1,11 @@ <?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\Cache\NullCache; -/** - * Implements a no-cache strategy. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Cache_Null implements Twig_CacheInterface -{ - public function generateKey($name, $className) - { - return ''; - } - - public function write($key, $content) - { - } +class_exists('Twig\Cache\NullCache'); - public function load($key) +if (\false) { + class Twig_Cache_Null extends NullCache { } - - public function getTimestamp($key) - { - return 0; - } } - -class_alias('Twig_Cache_Null', 'Twig\Cache\NullCache', false); diff --git a/vendor/twig/twig/lib/Twig/CacheInterface.php b/vendor/twig/twig/lib/Twig/CacheInterface.php index 776808bfe33ffd6269eb6f24abd72ecc963b328d..5d251dbd3c99b07aa7ea49d3e559bf6b37f3b1d0 100644 --- a/vendor/twig/twig/lib/Twig/CacheInterface.php +++ b/vendor/twig/twig/lib/Twig/CacheInterface.php @@ -1,58 +1,11 @@ <?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\Cache\CacheInterface; -/** - * Interface implemented by cache classes. - * - * It is highly recommended to always store templates on the filesystem to - * benefit from the PHP opcode cache. This interface is mostly useful if you - * need to implement a custom strategy for storing templates on the filesystem. - * - * @author Andrew Tch <andrew@noop.lv> - */ -interface Twig_CacheInterface -{ - /** - * Generates a cache key for the given template class name. - * - * @param string $name The template name - * @param string $className The template class name - * - * @return string - */ - public function generateKey($name, $className); +class_exists('Twig\Cache\CacheInterface'); - /** - * Writes the compiled template to cache. - * - * @param string $key The cache key - * @param string $content The template representation as a PHP class - */ - public function write($key, $content); - - /** - * Loads a template from the cache. - * - * @param string $key The cache key - */ - public function load($key); - - /** - * Returns the modification timestamp of a key. - * - * @param string $key The cache key - * - * @return int - */ - public function getTimestamp($key); +if (\false) { + class Twig_CacheInterface extends CacheInterface + { + } } - -class_alias('Twig_CacheInterface', 'Twig\Cache\CacheInterface', false); diff --git a/vendor/twig/twig/lib/Twig/Compiler.php b/vendor/twig/twig/lib/Twig/Compiler.php index 803eb89625059c988478de96de952a161a34f226..8d3811d2b84407ef906df5a96070a9bf09350460 100644 --- a/vendor/twig/twig/lib/Twig/Compiler.php +++ b/vendor/twig/twig/lib/Twig/Compiler.php @@ -1,286 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Compiler; -/** - * Compiles a node to PHP code. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Compiler implements Twig_CompilerInterface -{ - protected $lastLine; - protected $source; - protected $indentation; - protected $env; - protected $debugInfo = array(); - protected $sourceOffset; - protected $sourceLine; - protected $filename; - private $varNameSalt = 0; +class_exists('Twig\Compiler'); - public function __construct(Twig_Environment $env) +if (\false) { + class Twig_Compiler extends Compiler { - $this->env = $env; - } - - /** - * @deprecated since 1.25 (to be removed in 2.0) - */ - public function getFilename() - { - @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); - - return $this->filename; - } - - /** - * Returns the environment instance related to this compiler. - * - * @return Twig_Environment - */ - public function getEnvironment() - { - return $this->env; - } - - /** - * Gets the current PHP code after compilation. - * - * @return string The PHP code - */ - public function getSource() - { - return $this->source; - } - - /** - * Compiles a node. - * - * @param Twig_NodeInterface $node The node to compile - * @param int $indentation The current indentation - * - * @return $this - */ - public function compile(Twig_NodeInterface $node, $indentation = 0) - { - $this->lastLine = null; - $this->source = ''; - $this->debugInfo = array(); - $this->sourceOffset = 0; - // source code starts at 1 (as we then increment it when we encounter new lines) - $this->sourceLine = 1; - $this->indentation = $indentation; - $this->varNameSalt = 0; - - if ($node instanceof Twig_Node_Module) { - // to be removed in 2.0 - $this->filename = $node->getTemplateName(); - } - - $node->compile($this); - - return $this; - } - - public function subcompile(Twig_NodeInterface $node, $raw = true) - { - if (false === $raw) { - $this->source .= str_repeat(' ', $this->indentation * 4); - } - - $node->compile($this); - - return $this; - } - - /** - * Adds a raw string to the compiled code. - * - * @param string $string The string - * - * @return $this - */ - public function raw($string) - { - $this->source .= $string; - - return $this; - } - - /** - * Writes a string to the compiled code by adding indentation. - * - * @return $this - */ - public function write() - { - $strings = func_get_args(); - foreach ($strings as $string) { - $this->source .= str_repeat(' ', $this->indentation * 4).$string; - } - - return $this; - } - - /** - * Appends an indentation to the current PHP code after compilation. - * - * @return $this - * - * @deprecated since 1.27 (to be removed in 2.0). - */ - public function addIndentation() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use write(\'\') instead.', E_USER_DEPRECATED); - - $this->source .= str_repeat(' ', $this->indentation * 4); - - return $this; - } - - /** - * Adds a quoted string to the compiled code. - * - * @param string $value The string - * - * @return $this - */ - public function string($value) - { - $this->source .= sprintf('"%s"', addcslashes($value, "\0\t\"\$\\")); - - return $this; - } - - /** - * Returns a PHP representation of a given value. - * - * @param mixed $value The value to convert - * - * @return $this - */ - public function repr($value) - { - if (is_int($value) || is_float($value)) { - if (false !== $locale = setlocale(LC_NUMERIC, '0')) { - setlocale(LC_NUMERIC, 'C'); - } - - $this->raw($value); - - if (false !== $locale) { - setlocale(LC_NUMERIC, $locale); - } - } elseif (null === $value) { - $this->raw('null'); - } elseif (is_bool($value)) { - $this->raw($value ? 'true' : 'false'); - } elseif (is_array($value)) { - $this->raw('array('); - $first = true; - foreach ($value as $key => $v) { - if (!$first) { - $this->raw(', '); - } - $first = false; - $this->repr($key); - $this->raw(' => '); - $this->repr($v); - } - $this->raw(')'); - } else { - $this->string($value); - } - - return $this; - } - - /** - * Adds debugging information. - * - * @return $this - */ - public function addDebugInfo(Twig_NodeInterface $node) - { - if ($node->getTemplateLine() != $this->lastLine) { - $this->write(sprintf("// line %d\n", $node->getTemplateLine())); - - // when mbstring.func_overload is set to 2 - // mb_substr_count() replaces substr_count() - // but they have different signatures! - if (((int) ini_get('mbstring.func_overload')) & 2) { - @trigger_error('Support for having "mbstring.func_overload" different from 0 is deprecated version 1.29 and will be removed in 2.0.', E_USER_DEPRECATED); - - // this is much slower than the "right" version - $this->sourceLine += mb_substr_count(mb_substr($this->source, $this->sourceOffset), "\n"); - } else { - $this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset); - } - $this->sourceOffset = strlen($this->source); - $this->debugInfo[$this->sourceLine] = $node->getTemplateLine(); - - $this->lastLine = $node->getTemplateLine(); - } - - return $this; - } - - public function getDebugInfo() - { - ksort($this->debugInfo); - - return $this->debugInfo; - } - - /** - * Indents the generated code. - * - * @param int $step The number of indentation to add - * - * @return $this - */ - public function indent($step = 1) - { - $this->indentation += $step; - - return $this; - } - - /** - * Outdents the generated code. - * - * @param int $step The number of indentation to remove - * - * @return $this - * - * @throws LogicException When trying to outdent too much so the indentation would become negative - */ - public function outdent($step = 1) - { - // can't outdent by more steps than the current indentation level - if ($this->indentation < $step) { - throw new LogicException('Unable to call outdent() as the indentation would become negative.'); - } - - $this->indentation -= $step; - - return $this; - } - - public function getVarName() - { - return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->varNameSalt++)); } } - -class_alias('Twig_Compiler', 'Twig\Compiler', false); -class_exists('Twig_Node'); diff --git a/vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php b/vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php index 814ab58bc35e158ce08891e28355688ece046186..b1f32f68233e2141a1d33f34a675d2507b59b6c2 100644 --- a/vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php +++ b/vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php @@ -1,39 +1,11 @@ <?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\RuntimeLoader\ContainerRuntimeLoader; -use Psr\Container\ContainerInterface; +class_exists('Twig\RuntimeLoader\ContainerRuntimeLoader'); -/** - * Lazily loads Twig runtime implementations from a PSR-11 container. - * - * Note that the runtime services MUST use their class names as identifiers. - * - * @author Fabien Potencier <fabien@symfony.com> - * @author Robin Chalas <robin.chalas@gmail.com> - */ -class Twig_ContainerRuntimeLoader implements Twig_RuntimeLoaderInterface -{ - private $container; - - public function __construct(ContainerInterface $container) +if (\false) { + class Twig_ContainerRuntimeLoader extends ContainerRuntimeLoader { - $this->container = $container; - } - - public function load($class) - { - if ($this->container->has($class)) { - return $this->container->get($class); - } } } - -class_alias('Twig_ContainerRuntimeLoader', 'Twig\RuntimeLoader\ContainerRuntimeLoader', false); diff --git a/vendor/twig/twig/lib/Twig/Environment.php b/vendor/twig/twig/lib/Twig/Environment.php index e4e8abdb0fce3aca6b9365f9c7322f44a3f9ec8e..8c056366ead28eae47432c0fcb747bdf485bac43 100644 --- a/vendor/twig/twig/lib/Twig/Environment.php +++ b/vendor/twig/twig/lib/Twig/Environment.php @@ -1,1604 +1,11 @@ <?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\Environment; -/** - * Stores the Twig configuration. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Environment -{ - const VERSION = '1.35.3'; - const VERSION_ID = 13503; - const MAJOR_VERSION = 1; - const MINOR_VERSION = 35; - const RELEASE_VERSION = 3; - const EXTRA_VERSION = ''; +class_exists('Twig\Environment'); - protected $charset; - protected $loader; - protected $debug; - protected $autoReload; - protected $cache; - protected $lexer; - protected $parser; - protected $compiler; - protected $baseTemplateClass; - protected $extensions; - protected $parsers; - protected $visitors; - protected $filters; - protected $tests; - protected $functions; - protected $globals; - protected $runtimeInitialized = false; - protected $extensionInitialized = false; - protected $loadedTemplates; - protected $strictVariables; - protected $unaryOperators; - protected $binaryOperators; - protected $templateClassPrefix = '__TwigTemplate_'; - protected $functionCallbacks = array(); - protected $filterCallbacks = array(); - protected $staging; - - private $originalCache; - private $bcWriteCacheFile = false; - private $bcGetCacheFilename = false; - private $lastModifiedExtension = 0; - private $extensionsByClass = array(); - private $runtimeLoaders = array(); - private $runtimes = array(); - private $optionsHash; - private $loading = array(); - - /** - * Constructor. - * - * Available options: - * - * * debug: When set to true, it automatically set "auto_reload" to true as - * well (default to false). - * - * * charset: The charset used by the templates (default to UTF-8). - * - * * base_template_class: The base template class to use for generated - * templates (default to Twig_Template). - * - * * cache: An absolute path where to store the compiled templates, - * a Twig_Cache_Interface implementation, - * or false to disable compilation cache (default). - * - * * auto_reload: Whether to reload the template if the original source changed. - * If you don't provide the auto_reload option, it will be - * determined automatically based on the debug value. - * - * * strict_variables: Whether to ignore invalid variables in templates - * (default to false). - * - * * autoescape: Whether to enable auto-escaping (default to html): - * * false: disable auto-escaping - * * true: equivalent to html - * * html, js: set the autoescaping to one of the supported strategies - * * name: set the autoescaping strategy based on the template name extension - * * PHP callback: a PHP callback that returns an escaping strategy based on the template "name" - * - * * optimizations: A flag that indicates which optimizations to apply - * (default to -1 which means that all optimizations are enabled; - * set it to 0 to disable). - * - * @param Twig_LoaderInterface $loader - * @param array $options An array of options - */ - public function __construct(Twig_LoaderInterface $loader = null, $options = array()) - { - if (null !== $loader) { - $this->setLoader($loader); - } else { - @trigger_error('Not passing a Twig_LoaderInterface as the first constructor argument of Twig_Environment is deprecated since version 1.21.', E_USER_DEPRECATED); - } - - $options = array_merge(array( - 'debug' => false, - 'charset' => 'UTF-8', - 'base_template_class' => 'Twig_Template', - 'strict_variables' => false, - 'autoescape' => 'html', - 'cache' => false, - 'auto_reload' => null, - 'optimizations' => -1, - ), $options); - - $this->debug = (bool) $options['debug']; - $this->charset = strtoupper($options['charset']); - $this->baseTemplateClass = $options['base_template_class']; - $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; - $this->strictVariables = (bool) $options['strict_variables']; - $this->setCache($options['cache']); - - $this->addExtension(new Twig_Extension_Core()); - $this->addExtension(new Twig_Extension_Escaper($options['autoescape'])); - $this->addExtension(new Twig_Extension_Optimizer($options['optimizations'])); - $this->staging = new Twig_Extension_Staging(); - - // For BC - if (is_string($this->originalCache)) { - $r = new ReflectionMethod($this, 'writeCacheFile'); - if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error('The Twig_Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED); - - $this->bcWriteCacheFile = true; - } - - $r = new ReflectionMethod($this, 'getCacheFilename'); - if (__CLASS__ !== $r->getDeclaringClass()->getName()) { - @trigger_error('The Twig_Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED); - - $this->bcGetCacheFilename = true; - } - } - } - - /** - * Gets the base template class for compiled templates. - * - * @return string The base template class name - */ - public function getBaseTemplateClass() - { - return $this->baseTemplateClass; - } - - /** - * Sets the base template class for compiled templates. - * - * @param string $class The base template class name - */ - public function setBaseTemplateClass($class) - { - $this->baseTemplateClass = $class; - $this->updateOptionsHash(); - } - - /** - * Enables debugging mode. - */ - public function enableDebug() - { - $this->debug = true; - $this->updateOptionsHash(); - } - - /** - * Disables debugging mode. - */ - public function disableDebug() - { - $this->debug = false; - $this->updateOptionsHash(); - } - - /** - * Checks if debug mode is enabled. - * - * @return bool true if debug mode is enabled, false otherwise - */ - public function isDebug() - { - return $this->debug; - } - - /** - * Enables the auto_reload option. - */ - public function enableAutoReload() - { - $this->autoReload = true; - } - - /** - * Disables the auto_reload option. - */ - public function disableAutoReload() - { - $this->autoReload = false; - } - - /** - * Checks if the auto_reload option is enabled. - * - * @return bool true if auto_reload is enabled, false otherwise - */ - public function isAutoReload() - { - return $this->autoReload; - } - - /** - * Enables the strict_variables option. - */ - public function enableStrictVariables() - { - $this->strictVariables = true; - $this->updateOptionsHash(); - } - - /** - * Disables the strict_variables option. - */ - public function disableStrictVariables() - { - $this->strictVariables = false; - $this->updateOptionsHash(); - } - - /** - * Checks if the strict_variables option is enabled. - * - * @return bool true if strict_variables is enabled, false otherwise - */ - public function isStrictVariables() - { - return $this->strictVariables; - } - - /** - * Gets the current cache implementation. - * - * @param bool $original Whether to return the original cache option or the real cache instance - * - * @return Twig_CacheInterface|string|false A Twig_CacheInterface implementation, - * an absolute path to the compiled templates, - * or false to disable cache - */ - public function getCache($original = true) +if (\false) { + class Twig_Environment extends Environment { - return $original ? $this->originalCache : $this->cache; - } - - /** - * Sets the current cache implementation. - * - * @param Twig_CacheInterface|string|false $cache A Twig_CacheInterface implementation, - * an absolute path to the compiled templates, - * or false to disable cache - */ - public function setCache($cache) - { - if (is_string($cache)) { - $this->originalCache = $cache; - $this->cache = new Twig_Cache_Filesystem($cache); - } elseif (false === $cache) { - $this->originalCache = $cache; - $this->cache = new Twig_Cache_Null(); - } elseif (null === $cache) { - @trigger_error('Using "null" as the cache strategy is deprecated since version 1.23 and will be removed in Twig 2.0.', E_USER_DEPRECATED); - $this->originalCache = false; - $this->cache = new Twig_Cache_Null(); - } elseif ($cache instanceof Twig_CacheInterface) { - $this->originalCache = $this->cache = $cache; - } else { - throw new LogicException(sprintf('Cache can only be a string, false, or a Twig_CacheInterface implementation.')); - } - } - - /** - * Gets the cache filename for a given template. - * - * @param string $name The template name - * - * @return string|false The cache file name or false when caching is disabled - * - * @deprecated since 1.22 (to be removed in 2.0) - */ - public function getCacheFilename($name) - { - @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - - $key = $this->cache->generateKey($name, $this->getTemplateClass($name)); - - return !$key ? false : $key; - } - - /** - * Gets the template class associated with the given string. - * - * The generated template class is based on the following parameters: - * - * * The cache key for the given template; - * * The currently enabled extensions; - * * Whether the Twig C extension is available or not; - * * PHP version; - * * Twig version; - * * Options with what environment was created. - * - * @param string $name The name for which to calculate the template class name - * @param int|null $index The index if it is an embedded template - * - * @return string The template class name - */ - public function getTemplateClass($name, $index = null) - { - $key = $this->getLoader()->getCacheKey($name).$this->optionsHash; - - return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '_'.$index); - } - - /** - * Gets the template class prefix. - * - * @return string The template class prefix - * - * @deprecated since 1.22 (to be removed in 2.0) - */ - public function getTemplateClassPrefix() - { - @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - - return $this->templateClassPrefix; - } - - /** - * Renders a template. - * - * @param string $name The template name - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered template - * - * @throws Twig_Error_Loader When the template cannot be found - * @throws Twig_Error_Syntax When an error occurred during compilation - * @throws Twig_Error_Runtime When an error occurred during rendering - */ - public function render($name, array $context = array()) - { - return $this->loadTemplate($name)->render($context); - } - - /** - * Displays a template. - * - * @param string $name The template name - * @param array $context An array of parameters to pass to the template - * - * @throws Twig_Error_Loader When the template cannot be found - * @throws Twig_Error_Syntax When an error occurred during compilation - * @throws Twig_Error_Runtime When an error occurred during rendering - */ - public function display($name, array $context = array()) - { - $this->loadTemplate($name)->display($context); - } - - /** - * Loads a template. - * - * @param string|Twig_TemplateWrapper|Twig_Template $name The template name - * - * @throws Twig_Error_Loader When the template cannot be found - * @throws Twig_Error_Runtime When a previously generated cache is corrupted - * @throws Twig_Error_Syntax When an error occurred during compilation - * - * @return Twig_TemplateWrapper - */ - public function load($name) - { - if ($name instanceof Twig_TemplateWrapper) { - return $name; - } - - if ($name instanceof Twig_Template) { - return new Twig_TemplateWrapper($this, $name); - } - - return new Twig_TemplateWrapper($this, $this->loadTemplate($name)); - } - - /** - * Loads a template internal representation. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The template name - * @param int $index The index if it is an embedded template - * - * @return Twig_TemplateInterface A template instance representing the given template name - * - * @throws Twig_Error_Loader When the template cannot be found - * @throws Twig_Error_Runtime When a previously generated cache is corrupted - * @throws Twig_Error_Syntax When an error occurred during compilation - * - * @internal - */ - public function loadTemplate($name, $index = null) - { - $cls = $mainCls = $this->getTemplateClass($name); - if (null !== $index) { - $cls .= '_'.$index; - } - - if (isset($this->loadedTemplates[$cls])) { - return $this->loadedTemplates[$cls]; - } - - if (!class_exists($cls, false)) { - if ($this->bcGetCacheFilename) { - $key = $this->getCacheFilename($name); - } else { - $key = $this->cache->generateKey($name, $mainCls); - } - - if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) { - $this->cache->load($key); - } - - if (!class_exists($cls, false)) { - $loader = $this->getLoader(); - if (!$loader instanceof Twig_SourceContextLoaderInterface) { - $source = new Twig_Source($loader->getSource($name), $name); - } else { - $source = $loader->getSourceContext($name); - } - - $content = $this->compileSource($source); - - if ($this->bcWriteCacheFile) { - $this->writeCacheFile($key, $content); - } else { - $this->cache->write($key, $content); - $this->cache->load($key); - } - - if (!class_exists($mainCls, false)) { - /* Last line of defense if either $this->bcWriteCacheFile was used, - * $this->cache is implemented as a no-op or we have a race condition - * where the cache was cleared between the above calls to write to and load from - * the cache. - */ - eval('?>'.$content); - } - } - - if (!class_exists($cls, false)) { - throw new Twig_Error_Runtime(sprintf('Failed to load Twig template "%s", index "%s": cache is corrupted.', $name, $index), -1, $source); - } - } - - if (!$this->runtimeInitialized) { - $this->initRuntime(); - } - - if (isset($this->loading[$cls])) { - throw new Twig_Error_Runtime(sprintf('Circular reference detected for Twig template "%s", path: %s.', $name, implode(' -> ', array_merge($this->loading, array($name))))); - } - - $this->loading[$cls] = $name; - - try { - $this->loadedTemplates[$cls] = new $cls($this); - unset($this->loading[$cls]); - } catch (\Exception $e) { - unset($this->loading[$cls]); - - throw $e; - } - - return $this->loadedTemplates[$cls]; - } - - /** - * Creates a template from source. - * - * This method should not be used as a generic way to load templates. - * - * @param string $template The template name - * - * @return Twig_Template A template instance representing the given template name - * - * @throws Twig_Error_Loader When the template cannot be found - * @throws Twig_Error_Syntax When an error occurred during compilation - */ - public function createTemplate($template) - { - $name = sprintf('__string_template__%s', hash('sha256', $template, false)); - - $loader = new Twig_Loader_Chain(array( - new Twig_Loader_Array(array($name => $template)), - $current = $this->getLoader(), - )); - - $this->setLoader($loader); - try { - $template = $this->loadTemplate($name); - } catch (Exception $e) { - $this->setLoader($current); - - throw $e; - } catch (Throwable $e) { - $this->setLoader($current); - - throw $e; - } - $this->setLoader($current); - - return $template; - } - - /** - * Returns true if the template is still fresh. - * - * Besides checking the loader for freshness information, - * this method also checks if the enabled extensions have - * not changed. - * - * @param string $name The template name - * @param int $time The last modification time of the cached template - * - * @return bool true if the template is fresh, false otherwise - */ - public function isTemplateFresh($name, $time) - { - if (0 === $this->lastModifiedExtension) { - foreach ($this->extensions as $extension) { - $r = new ReflectionObject($extension); - if (file_exists($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModifiedExtension) { - $this->lastModifiedExtension = $extensionTime; - } - } - } - - return $this->lastModifiedExtension <= $time && $this->getLoader()->isFresh($name, $time); - } - - /** - * Tries to load a template consecutively from an array. - * - * Similar to loadTemplate() but it also accepts instances of Twig_Template and - * Twig_TemplateWrapper, and an array of templates where each is tried to be loaded. - * - * @param string|Twig_Template|Twig_TemplateWrapper|array $names A template or an array of templates to try consecutively - * - * @return Twig_Template|Twig_TemplateWrapper - * - * @throws Twig_Error_Loader When none of the templates can be found - * @throws Twig_Error_Syntax When an error occurred during compilation - */ - public function resolveTemplate($names) - { - if (!is_array($names)) { - $names = array($names); - } - - foreach ($names as $name) { - if ($name instanceof Twig_Template) { - return $name; - } - - if ($name instanceof Twig_TemplateWrapper) { - return $name; - } - - try { - return $this->loadTemplate($name); - } catch (Twig_Error_Loader $e) { - } - } - - if (1 === count($names)) { - throw $e; - } - - throw new Twig_Error_Loader(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names))); - } - - /** - * Clears the internal template cache. - * - * @deprecated since 1.18.3 (to be removed in 2.0) - */ - public function clearTemplateCache() - { - @trigger_error(sprintf('The %s method is deprecated since version 1.18.3 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - - $this->loadedTemplates = array(); - } - - /** - * Clears the template cache files on the filesystem. - * - * @deprecated since 1.22 (to be removed in 2.0) - */ - public function clearCacheFiles() - { - @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - - if (is_string($this->originalCache)) { - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->originalCache), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if ($file->isFile()) { - @unlink($file->getPathname()); - } - } - } - } - - /** - * Gets the Lexer instance. - * - * @return Twig_LexerInterface - * - * @deprecated since 1.25 (to be removed in 2.0) - */ - public function getLexer() - { - @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); - - if (null === $this->lexer) { - $this->lexer = new Twig_Lexer($this); - } - - return $this->lexer; - } - - public function setLexer(Twig_LexerInterface $lexer) - { - $this->lexer = $lexer; - } - - /** - * Tokenizes a source code. - * - * @param string|Twig_Source $source The template source code - * @param string $name The template name (deprecated) - * - * @return Twig_TokenStream - * - * @throws Twig_Error_Syntax When the code is syntactically wrong - */ - public function tokenize($source, $name = null) - { - if (!$source instanceof Twig_Source) { - @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED); - $source = new Twig_Source($source, $name); - } - - if (null === $this->lexer) { - $this->lexer = new Twig_Lexer($this); - } - - return $this->lexer->tokenize($source); - } - - /** - * Gets the Parser instance. - * - * @return Twig_ParserInterface - * - * @deprecated since 1.25 (to be removed in 2.0) - */ - public function getParser() - { - @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); - - if (null === $this->parser) { - $this->parser = new Twig_Parser($this); - } - - return $this->parser; - } - - public function setParser(Twig_ParserInterface $parser) - { - $this->parser = $parser; - } - - /** - * Converts a token stream to a node tree. - * - * @return Twig_Node_Module - * - * @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong - */ - public function parse(Twig_TokenStream $stream) - { - if (null === $this->parser) { - $this->parser = new Twig_Parser($this); - } - - return $this->parser->parse($stream); - } - - /** - * Gets the Compiler instance. - * - * @return Twig_CompilerInterface - * - * @deprecated since 1.25 (to be removed in 2.0) - */ - public function getCompiler() - { - @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); - - if (null === $this->compiler) { - $this->compiler = new Twig_Compiler($this); - } - - return $this->compiler; - } - - public function setCompiler(Twig_CompilerInterface $compiler) - { - $this->compiler = $compiler; - } - - /** - * Compiles a node and returns the PHP code. - * - * @return string The compiled PHP source code - */ - public function compile(Twig_NodeInterface $node) - { - if (null === $this->compiler) { - $this->compiler = new Twig_Compiler($this); - } - - return $this->compiler->compile($node)->getSource(); - } - - /** - * Compiles a template source code. - * - * @param string|Twig_Source $source The template source code - * @param string $name The template name (deprecated) - * - * @return string The compiled PHP source code - * - * @throws Twig_Error_Syntax When there was an error during tokenizing, parsing or compiling - */ - public function compileSource($source, $name = null) - { - if (!$source instanceof Twig_Source) { - @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED); - $source = new Twig_Source($source, $name); - } - - try { - return $this->compile($this->parse($this->tokenize($source))); - } catch (Twig_Error $e) { - $e->setSourceContext($source); - throw $e; - } catch (Exception $e) { - throw new Twig_Error_Syntax(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e); - } - } - - public function setLoader(Twig_LoaderInterface $loader) - { - if (!$loader instanceof Twig_SourceContextLoaderInterface && 0 !== strpos(get_class($loader), 'Mock_')) { - @trigger_error(sprintf('Twig loader "%s" should implement Twig_SourceContextLoaderInterface since version 1.27.', get_class($loader)), E_USER_DEPRECATED); - } - - $this->loader = $loader; - } - - /** - * Gets the Loader instance. - * - * @return Twig_LoaderInterface - */ - public function getLoader() - { - if (null === $this->loader) { - throw new LogicException('You must set a loader first.'); - } - - return $this->loader; - } - - /** - * Sets the default template charset. - * - * @param string $charset The default charset - */ - public function setCharset($charset) - { - $this->charset = strtoupper($charset); - } - - /** - * Gets the default template charset. - * - * @return string The default charset - */ - public function getCharset() - { - return $this->charset; - } - - /** - * Initializes the runtime environment. - * - * @deprecated since 1.23 (to be removed in 2.0) - */ - public function initRuntime() - { - $this->runtimeInitialized = true; - - foreach ($this->getExtensions() as $name => $extension) { - if (!$extension instanceof Twig_Extension_InitRuntimeInterface) { - $m = new ReflectionMethod($extension, 'initRuntime'); - - if ('Twig_Extension' !== $m->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Defining the initRuntime() method in the "%s" extension is deprecated since version 1.23. Use the `needs_environment` option to get the Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig_Extension_InitRuntimeInterface if needed (not recommended).', $name), E_USER_DEPRECATED); - } - } - - $extension->initRuntime($this); - } - } - - /** - * Returns true if the given extension is registered. - * - * @param string $class The extension class name - * - * @return bool Whether the extension is registered or not - */ - public function hasExtension($class) - { - $class = ltrim($class, '\\'); - if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { - // For BC/FC with namespaced aliases - $class = new ReflectionClass($class); - $class = $class->name; - } - - if (isset($this->extensions[$class])) { - if ($class !== get_class($this->extensions[$class])) { - @trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED); - } - - return true; - } - - return isset($this->extensionsByClass[$class]); - } - - /** - * Adds a runtime loader. - */ - public function addRuntimeLoader(Twig_RuntimeLoaderInterface $loader) - { - $this->runtimeLoaders[] = $loader; - } - - /** - * Gets an extension by class name. - * - * @param string $class The extension class name - * - * @return Twig_ExtensionInterface - */ - public function getExtension($class) - { - $class = ltrim($class, '\\'); - if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { - // For BC/FC with namespaced aliases - $class = new ReflectionClass($class); - $class = $class->name; - } - - if (isset($this->extensions[$class])) { - if ($class !== get_class($this->extensions[$class])) { - @trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED); - } - - return $this->extensions[$class]; - } - - if (!isset($this->extensionsByClass[$class])) { - throw new Twig_Error_Runtime(sprintf('The "%s" extension is not enabled.', $class)); - } - - return $this->extensionsByClass[$class]; - } - - /** - * Returns the runtime implementation of a Twig element (filter/function/test). - * - * @param string $class A runtime class name - * - * @return object The runtime implementation - * - * @throws Twig_Error_Runtime When the template cannot be found - */ - public function getRuntime($class) - { - if (isset($this->runtimes[$class])) { - return $this->runtimes[$class]; - } - - foreach ($this->runtimeLoaders as $loader) { - if (null !== $runtime = $loader->load($class)) { - return $this->runtimes[$class] = $runtime; - } - } - - throw new Twig_Error_Runtime(sprintf('Unable to load the "%s" runtime.', $class)); - } - - public function addExtension(Twig_ExtensionInterface $extension) - { - if ($this->extensionInitialized) { - throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName())); - } - - $class = get_class($extension); - if ($class !== $extension->getName()) { - if (isset($this->extensions[$extension->getName()])) { - unset($this->extensions[$extension->getName()], $this->extensionsByClass[$class]); - @trigger_error(sprintf('The possibility to register the same extension twice ("%s") is deprecated since version 1.23 and will be removed in Twig 2.0. Use proper PHP inheritance instead.', $extension->getName()), E_USER_DEPRECATED); - } - } - - $this->lastModifiedExtension = 0; - $this->extensionsByClass[$class] = $extension; - $this->extensions[$extension->getName()] = $extension; - $this->updateOptionsHash(); - } - - /** - * Removes an extension by name. - * - * This method is deprecated and you should not use it. - * - * @param string $name The extension name - * - * @deprecated since 1.12 (to be removed in 2.0) - */ - public function removeExtension($name) - { - @trigger_error(sprintf('The %s method is deprecated since version 1.12 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - - if ($this->extensionInitialized) { - throw new LogicException(sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name)); - } - - $class = ltrim($name, '\\'); - if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { - // For BC/FC with namespaced aliases - $class = new ReflectionClass($class); - $class = $class->name; - } - - if (isset($this->extensions[$class])) { - if ($class !== get_class($this->extensions[$class])) { - @trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED); - } - - unset($this->extensions[$class]); - } - - unset($this->extensions[$class]); - $this->updateOptionsHash(); - } - - /** - * Registers an array of extensions. - * - * @param array $extensions An array of extensions - */ - public function setExtensions(array $extensions) - { - foreach ($extensions as $extension) { - $this->addExtension($extension); - } - } - - /** - * Returns all registered extensions. - * - * @return Twig_ExtensionInterface[] An array of extensions (keys are for internal usage only and should not be relied on) - */ - public function getExtensions() - { - return $this->extensions; - } - - public function addTokenParser(Twig_TokenParserInterface $parser) - { - if ($this->extensionInitialized) { - throw new LogicException('Unable to add a token parser as extensions have already been initialized.'); - } - - $this->staging->addTokenParser($parser); - } - - /** - * Gets the registered Token Parsers. - * - * @return Twig_TokenParserBrokerInterface - * - * @internal - */ - public function getTokenParsers() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->parsers; - } - - /** - * Gets registered tags. - * - * Be warned that this method cannot return tags defined by Twig_TokenParserBrokerInterface classes. - * - * @return Twig_TokenParserInterface[] - * - * @internal - */ - public function getTags() - { - $tags = array(); - foreach ($this->getTokenParsers()->getParsers() as $parser) { - if ($parser instanceof Twig_TokenParserInterface) { - $tags[$parser->getTag()] = $parser; - } - } - - return $tags; - } - - public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) - { - if ($this->extensionInitialized) { - throw new LogicException('Unable to add a node visitor as extensions have already been initialized.'); - } - - $this->staging->addNodeVisitor($visitor); - } - - /** - * Gets the registered Node Visitors. - * - * @return Twig_NodeVisitorInterface[] - * - * @internal - */ - public function getNodeVisitors() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->visitors; - } - - /** - * Registers a Filter. - * - * @param string|Twig_SimpleFilter $name The filter name or a Twig_SimpleFilter instance - * @param Twig_FilterInterface|Twig_SimpleFilter $filter - */ - public function addFilter($name, $filter = null) - { - if (!$name instanceof Twig_SimpleFilter && !($filter instanceof Twig_SimpleFilter || $filter instanceof Twig_FilterInterface)) { - throw new LogicException('A filter must be an instance of Twig_FilterInterface or Twig_SimpleFilter.'); - } - - if ($name instanceof Twig_SimpleFilter) { - $filter = $name; - $name = $filter->getName(); - } else { - @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFilter" instead when defining filter "%s".', __METHOD__, $name), E_USER_DEPRECATED); - } - - if ($this->extensionInitialized) { - throw new LogicException(sprintf('Unable to add filter "%s" as extensions have already been initialized.', $name)); - } - - $this->staging->addFilter($name, $filter); - } - - /** - * Get a filter by name. - * - * Subclasses may override this method and load filters differently; - * so no list of filters is available. - * - * @param string $name The filter name - * - * @return Twig_Filter|false A Twig_Filter instance or false if the filter does not exist - * - * @internal - */ - public function getFilter($name) - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - if (isset($this->filters[$name])) { - return $this->filters[$name]; - } - - foreach ($this->filters as $pattern => $filter) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count) { - if (preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $filter->setArguments($matches); - - return $filter; - } - } - } - - foreach ($this->filterCallbacks as $callback) { - if (false !== $filter = call_user_func($callback, $name)) { - return $filter; - } - } - - return false; - } - - public function registerUndefinedFilterCallback($callable) - { - $this->filterCallbacks[] = $callable; - } - - /** - * Gets the registered Filters. - * - * Be warned that this method cannot return filters defined with registerUndefinedFilterCallback. - * - * @return Twig_FilterInterface[] - * - * @see registerUndefinedFilterCallback - * - * @internal - */ - public function getFilters() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->filters; - } - - /** - * Registers a Test. - * - * @param string|Twig_SimpleTest $name The test name or a Twig_SimpleTest instance - * @param Twig_TestInterface|Twig_SimpleTest $test A Twig_TestInterface instance or a Twig_SimpleTest instance - */ - public function addTest($name, $test = null) - { - if (!$name instanceof Twig_SimpleTest && !($test instanceof Twig_SimpleTest || $test instanceof Twig_TestInterface)) { - throw new LogicException('A test must be an instance of Twig_TestInterface or Twig_SimpleTest.'); - } - - if ($name instanceof Twig_SimpleTest) { - $test = $name; - $name = $test->getName(); - } else { - @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleTest" instead when defining test "%s".', __METHOD__, $name), E_USER_DEPRECATED); - } - - if ($this->extensionInitialized) { - throw new LogicException(sprintf('Unable to add test "%s" as extensions have already been initialized.', $name)); - } - - $this->staging->addTest($name, $test); - } - - /** - * Gets the registered Tests. - * - * @return Twig_TestInterface[] - * - * @internal - */ - public function getTests() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->tests; - } - - /** - * Gets a test by name. - * - * @param string $name The test name - * - * @return Twig_Test|false A Twig_Test instance or false if the test does not exist - * - * @internal - */ - public function getTest($name) - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - if (isset($this->tests[$name])) { - return $this->tests[$name]; - } - - return false; - } - - /** - * Registers a Function. - * - * @param string|Twig_SimpleFunction $name The function name or a Twig_SimpleFunction instance - * @param Twig_FunctionInterface|Twig_SimpleFunction $function - */ - public function addFunction($name, $function = null) - { - if (!$name instanceof Twig_SimpleFunction && !($function instanceof Twig_SimpleFunction || $function instanceof Twig_FunctionInterface)) { - throw new LogicException('A function must be an instance of Twig_FunctionInterface or Twig_SimpleFunction.'); - } - - if ($name instanceof Twig_SimpleFunction) { - $function = $name; - $name = $function->getName(); - } else { - @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFunction" instead when defining function "%s".', __METHOD__, $name), E_USER_DEPRECATED); - } - - if ($this->extensionInitialized) { - throw new LogicException(sprintf('Unable to add function "%s" as extensions have already been initialized.', $name)); - } - - $this->staging->addFunction($name, $function); - } - - /** - * Get a function by name. - * - * Subclasses may override this method and load functions differently; - * so no list of functions is available. - * - * @param string $name function name - * - * @return Twig_Function|false A Twig_Function instance or false if the function does not exist - * - * @internal - */ - public function getFunction($name) - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - if (isset($this->functions[$name])) { - return $this->functions[$name]; - } - - foreach ($this->functions as $pattern => $function) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count) { - if (preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $function->setArguments($matches); - - return $function; - } - } - } - - foreach ($this->functionCallbacks as $callback) { - if (false !== $function = call_user_func($callback, $name)) { - return $function; - } - } - - return false; - } - - public function registerUndefinedFunctionCallback($callable) - { - $this->functionCallbacks[] = $callable; - } - - /** - * Gets registered functions. - * - * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback. - * - * @return Twig_FunctionInterface[] - * - * @see registerUndefinedFunctionCallback - * - * @internal - */ - public function getFunctions() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->functions; - } - - /** - * Registers a Global. - * - * New globals can be added before compiling or rendering a template; - * but after, you can only update existing globals. - * - * @param string $name The global name - * @param mixed $value The global value - */ - public function addGlobal($name, $value) - { - if ($this->extensionInitialized || $this->runtimeInitialized) { - if (null === $this->globals) { - $this->globals = $this->initGlobals(); - } - - if (!array_key_exists($name, $this->globals)) { - // The deprecation notice must be turned into the following exception in Twig 2.0 - @trigger_error(sprintf('Registering global variable "%s" at runtime or when the extensions have already been initialized is deprecated since version 1.21.', $name), E_USER_DEPRECATED); - //throw new LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name)); - } - } - - if ($this->extensionInitialized || $this->runtimeInitialized) { - // update the value - $this->globals[$name] = $value; - } else { - $this->staging->addGlobal($name, $value); - } - } - - /** - * Gets the registered Globals. - * - * @return array An array of globals - * - * @internal - */ - public function getGlobals() - { - if (!$this->runtimeInitialized && !$this->extensionInitialized) { - return $this->initGlobals(); - } - - if (null === $this->globals) { - $this->globals = $this->initGlobals(); - } - - return $this->globals; - } - - /** - * Merges a context with the defined globals. - * - * @param array $context An array representing the context - * - * @return array The context merged with the globals - */ - public function mergeGlobals(array $context) - { - // we don't use array_merge as the context being generally - // bigger than globals, this code is faster. - foreach ($this->getGlobals() as $key => $value) { - if (!array_key_exists($key, $context)) { - $context[$key] = $value; - } - } - - return $context; - } - - /** - * Gets the registered unary Operators. - * - * @return array An array of unary operators - * - * @internal - */ - public function getUnaryOperators() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->unaryOperators; - } - - /** - * Gets the registered binary Operators. - * - * @return array An array of binary operators - * - * @internal - */ - public function getBinaryOperators() - { - if (!$this->extensionInitialized) { - $this->initExtensions(); - } - - return $this->binaryOperators; - } - - /** - * @deprecated since 1.23 (to be removed in 2.0) - */ - public function computeAlternatives($name, $items) - { - @trigger_error(sprintf('The %s method is deprecated since version 1.23 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); - - return Twig_Error_Syntax::computeAlternatives($name, $items); - } - - /** - * @internal - */ - protected function initGlobals() - { - $globals = array(); - foreach ($this->extensions as $name => $extension) { - if (!$extension instanceof Twig_Extension_GlobalsInterface) { - $m = new ReflectionMethod($extension, 'getGlobals'); - - if ('Twig_Extension' !== $m->getDeclaringClass()->getName()) { - @trigger_error(sprintf('Defining the getGlobals() method in the "%s" extension without explicitly implementing Twig_Extension_GlobalsInterface is deprecated since version 1.23.', $name), E_USER_DEPRECATED); - } - } - - $extGlob = $extension->getGlobals(); - if (!is_array($extGlob)) { - throw new UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', get_class($extension))); - } - - $globals[] = $extGlob; - } - - $globals[] = $this->staging->getGlobals(); - - return call_user_func_array('array_merge', $globals); - } - - /** - * @internal - */ - protected function initExtensions() - { - if ($this->extensionInitialized) { - return; - } - - $this->parsers = new Twig_TokenParserBroker(array(), array(), false); - $this->filters = array(); - $this->functions = array(); - $this->tests = array(); - $this->visitors = array(); - $this->unaryOperators = array(); - $this->binaryOperators = array(); - - foreach ($this->extensions as $extension) { - $this->initExtension($extension); - } - $this->initExtension($this->staging); - // Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception - $this->extensionInitialized = true; - } - - /** - * @internal - */ - protected function initExtension(Twig_ExtensionInterface $extension) - { - // filters - foreach ($extension->getFilters() as $name => $filter) { - if ($filter instanceof Twig_SimpleFilter) { - $name = $filter->getName(); - } else { - @trigger_error(sprintf('Using an instance of "%s" for filter "%s" is deprecated since version 1.21. Use Twig_SimpleFilter instead.', get_class($filter), $name), E_USER_DEPRECATED); - } - - $this->filters[$name] = $filter; - } - - // functions - foreach ($extension->getFunctions() as $name => $function) { - if ($function instanceof Twig_SimpleFunction) { - $name = $function->getName(); - } else { - @trigger_error(sprintf('Using an instance of "%s" for function "%s" is deprecated since version 1.21. Use Twig_SimpleFunction instead.', get_class($function), $name), E_USER_DEPRECATED); - } - - $this->functions[$name] = $function; - } - - // tests - foreach ($extension->getTests() as $name => $test) { - if ($test instanceof Twig_SimpleTest) { - $name = $test->getName(); - } else { - @trigger_error(sprintf('Using an instance of "%s" for test "%s" is deprecated since version 1.21. Use Twig_SimpleTest instead.', get_class($test), $name), E_USER_DEPRECATED); - } - - $this->tests[$name] = $test; - } - - // token parsers - foreach ($extension->getTokenParsers() as $parser) { - if ($parser instanceof Twig_TokenParserInterface) { - $this->parsers->addTokenParser($parser); - } elseif ($parser instanceof Twig_TokenParserBrokerInterface) { - @trigger_error('Registering a Twig_TokenParserBrokerInterface instance is deprecated since version 1.21.', E_USER_DEPRECATED); - - $this->parsers->addTokenParserBroker($parser); - } else { - throw new LogicException('getTokenParsers() must return an array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances.'); - } - } - - // node visitors - foreach ($extension->getNodeVisitors() as $visitor) { - $this->visitors[] = $visitor; - } - - // operators - if ($operators = $extension->getOperators()) { - if (!is_array($operators)) { - throw new InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', get_class($extension), is_object($operators) ? get_class($operators) : gettype($operators).(is_resource($operators) ? '' : '#'.$operators))); - } - - if (2 !== count($operators)) { - throw new InvalidArgumentException(sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', get_class($extension), count($operators))); - } - - $this->unaryOperators = array_merge($this->unaryOperators, $operators[0]); - $this->binaryOperators = array_merge($this->binaryOperators, $operators[1]); - } - } - - /** - * @deprecated since 1.22 (to be removed in 2.0) - */ - protected function writeCacheFile($file, $content) - { - $this->cache->write($file, $content); - } - - private function updateOptionsHash() - { - $hashParts = array_merge( - array_keys($this->extensions), - array( - (int) function_exists('twig_template_get_attributes'), - PHP_MAJOR_VERSION, - PHP_MINOR_VERSION, - self::VERSION, - (int) $this->debug, - $this->baseTemplateClass, - (int) $this->strictVariables, - ) - ); - $this->optionsHash = implode(':', $hashParts); } } - -class_alias('Twig_Environment', 'Twig\Environment', false); diff --git a/vendor/twig/twig/lib/Twig/Error.php b/vendor/twig/twig/lib/Twig/Error.php index 787e0d0955658aee0581acbf1eb1120b0b7c56de..887490ce69d3c00ed093cd6860d12714c29465d2 100644 --- a/vendor/twig/twig/lib/Twig/Error.php +++ b/vendor/twig/twig/lib/Twig/Error.php @@ -1,363 +1,11 @@ <?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\Error\Error; -/** - * Twig base exception. - * - * This exception class and its children must only be used when - * an error occurs during the loading of a template, when a syntax error - * is detected in a template, or when rendering a template. Other - * errors must use regular PHP exception classes (like when the template - * cache directory is not writable for instance). - * - * To help debugging template issues, this class tracks the original template - * name and line where the error occurred. - * - * Whenever possible, you must set these information (original template name - * and line number) yourself by passing them to the constructor. If some or all - * these information are not available from where you throw the exception, then - * this class will guess them automatically (when the line number is set to -1 - * and/or the name is set to null). As this is a costly operation, this - * can be disabled by passing false for both the name and the line number - * when creating a new instance of this class. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Error extends Exception -{ - protected $lineno; - // to be renamed to name in 2.0 - protected $filename; - protected $rawMessage; - protected $previous; +class_exists('Twig\Error\Error'); - private $sourcePath; - private $sourceCode; - - /** - * 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 Twig_Source|string|null $source The source context where the error occurred - * @param Exception $previous The previous exception - */ - public function __construct($message, $lineno = -1, $source = null, Exception $previous = null) - { - if (null === $source) { - $name = null; - } elseif (!$source instanceof Twig_Source) { - // for compat with the Twig C ext., passing the template name as string is accepted - $name = $source; - } else { - $name = $source->getName(); - $this->sourceCode = $source->getCode(); - $this->sourcePath = $source->getPath(); - } - if (PHP_VERSION_ID < 50300) { - $this->previous = $previous; - parent::__construct(''); - } else { - parent::__construct('', 0, $previous); - } - - $this->lineno = $lineno; - $this->filename = $name; - - if (-1 === $lineno || null === $name || null === $this->sourcePath) { - $this->guessTemplateInfo(); - } - - $this->rawMessage = $message; - - $this->updateRepr(); - } - - /** - * Gets the raw message. - * - * @return string The raw message - */ - public function getRawMessage() - { - return $this->rawMessage; - } - - /** - * Gets the logical name where the error occurred. - * - * @return string The name - * - * @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead. - */ - public function getTemplateFile() - { - @trigger_error(sprintf('The "%s" method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); - - return $this->filename; - } - - /** - * Sets the logical name where the error occurred. - * - * @param string $name The name - * - * @deprecated since 1.27 (to be removed in 2.0). Use setSourceContext() instead. - */ - public function setTemplateFile($name) - { - @trigger_error(sprintf('The "%s" method is deprecated since version 1.27 and will be removed in 2.0. Use setSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); - - $this->filename = $name; - - $this->updateRepr(); - } - - /** - * Gets the logical name where the error occurred. - * - * @return string The name - * - * @deprecated since 1.29 (to be removed in 2.0). Use getSourceContext() instead. - */ - public function getTemplateName() - { - @trigger_error(sprintf('The "%s" method is deprecated since version 1.29 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); - - return $this->filename; - } - - /** - * Sets the logical name where the error occurred. - * - * @param string $name The name - * - * @deprecated since 1.29 (to be removed in 2.0). Use setSourceContext() instead. - */ - public function setTemplateName($name) - { - @trigger_error(sprintf('The "%s" method is deprecated since version 1.29 and will be removed in 2.0. Use setSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); - - $this->filename = $name; - $this->sourceCode = $this->sourcePath = null; - - $this->updateRepr(); - } - - /** - * Gets the template line where the error occurred. - * - * @return int The template line - */ - public function getTemplateLine() - { - return $this->lineno; - } - - /** - * Sets the template line where the error occurred. - * - * @param int $lineno The template line - */ - public function setTemplateLine($lineno) - { - $this->lineno = $lineno; - - $this->updateRepr(); - } - - /** - * Gets the source context of the Twig template where the error occurred. - * - * @return Twig_Source|null - */ - public function getSourceContext() - { - return $this->filename ? new Twig_Source($this->sourceCode, $this->filename, $this->sourcePath) : null; - } - - /** - * Sets the source context of the Twig template where the error occurred. - */ - public function setSourceContext(Twig_Source $source = null) - { - if (null === $source) { - $this->sourceCode = $this->filename = $this->sourcePath = null; - } else { - $this->sourceCode = $source->getCode(); - $this->filename = $source->getName(); - $this->sourcePath = $source->getPath(); - } - - $this->updateRepr(); - } - - public function guess() - { - $this->guessTemplateInfo(); - $this->updateRepr(); - } - - /** - * For PHP < 5.3.0, provides access to the getPrevious() method. - * - * @param string $method The method name - * @param array $arguments The parameters to be passed to the method - * - * @return Exception The previous exception or null - * - * @throws BadMethodCallException - */ - public function __call($method, $arguments) - { - if ('getprevious' == strtolower($method)) { - return $this->previous; - } - - throw new BadMethodCallException(sprintf('Method "Twig_Error::%s()" does not exist.', $method)); - } - - public function appendMessage($rawMessage) - { - $this->rawMessage .= $rawMessage; - $this->updateRepr(); - } - - /** - * @internal - */ - protected function updateRepr() - { - $this->message = $this->rawMessage; - - if ($this->sourcePath && $this->lineno > 0) { - $this->file = $this->sourcePath; - $this->line = $this->lineno; - - return; - } - - $dot = false; - if ('.' === substr($this->message, -1)) { - $this->message = substr($this->message, 0, -1); - $dot = true; - } - - $questionMark = false; - if ('?' === substr($this->message, -1)) { - $this->message = substr($this->message, 0, -1); - $questionMark = true; - } - - if ($this->filename) { - if (is_string($this->filename) || (is_object($this->filename) && method_exists($this->filename, '__toString'))) { - $name = sprintf('"%s"', $this->filename); - } else { - $name = json_encode($this->filename); - } - $this->message .= sprintf(' in %s', $name); - } - - if ($this->lineno && $this->lineno >= 0) { - $this->message .= sprintf(' at line %d', $this->lineno); - } - - if ($dot) { - $this->message .= '.'; - } - - if ($questionMark) { - $this->message .= '?'; - } - } - - /** - * @internal - */ - protected function guessTemplateInfo() +if (\false) { + class Twig_Error extends Error { - $template = null; - $templateClass = null; - - if (PHP_VERSION_ID >= 50306) { - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT); - } else { - $backtrace = debug_backtrace(); - } - - foreach ($backtrace as $trace) { - if (isset($trace['object']) && $trace['object'] instanceof Twig_Template && 'Twig_Template' !== get_class($trace['object'])) { - $currentClass = get_class($trace['object']); - $isEmbedContainer = 0 === strpos($templateClass, $currentClass); - if (null === $this->filename || ($this->filename == $trace['object']->getTemplateName() && !$isEmbedContainer)) { - $template = $trace['object']; - $templateClass = get_class($trace['object']); - } - } - } - - // update template name - if (null !== $template && null === $this->filename) { - $this->filename = $template->getTemplateName(); - } - - // update template path if any - if (null !== $template && null === $this->sourcePath) { - $src = $template->getSourceContext(); - $this->sourceCode = $src->getCode(); - $this->sourcePath = $src->getPath(); - } - - if (null === $template || $this->lineno > -1) { - return; - } - - $r = new ReflectionObject($template); - $file = $r->getFileName(); - - $exceptions = array($e = $this); - while (($e instanceof self || method_exists($e, 'getPrevious')) && $e = $e->getPrevious()) { - $exceptions[] = $e; - } - - while ($e = array_pop($exceptions)) { - $traces = $e->getTrace(); - array_unshift($traces, array('file' => $e->getFile(), 'line' => $e->getLine())); - - while ($trace = array_shift($traces)) { - if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) { - continue; - } - - foreach ($template->getDebugInfo() as $codeLine => $templateLine) { - if ($codeLine <= $trace['line']) { - // update template line - $this->lineno = $templateLine; - - return; - } - } - } - } } } - -class_alias('Twig_Error', 'Twig\Error\Error', false); -class_exists('Twig_Source'); diff --git a/vendor/twig/twig/lib/Twig/Error/Loader.php b/vendor/twig/twig/lib/Twig/Error/Loader.php index df566dd78be2c389d65417a32c77d9eb47480da5..8caca6fd110dcb8eda3042cf9c663fe680402597 100644 --- a/vendor/twig/twig/lib/Twig/Error/Loader.php +++ b/vendor/twig/twig/lib/Twig/Error/Loader.php @@ -1,40 +1,11 @@ <?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\Error\LoaderError; -/** - * Exception thrown when an error occurs during template loading. - * - * Automatic template information guessing is always turned off as - * if a template cannot be loaded, there is nothing to guess. - * However, when a template is loaded from another one, then, we need - * to find the current context and this is automatically done by - * Twig_Template::displayWithErrorHandling(). - * - * This strategy makes Twig_Environment::resolveTemplate() much faster. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Error_Loader extends Twig_Error -{ - public function __construct($message, $lineno = -1, $source = null, Exception $previous = null) +class_exists('Twig\Error\LoaderError'); + +if (\false) { + class Twig_Error_Loader extends LoaderError { - if (PHP_VERSION_ID < 50300) { - $this->previous = $previous; - Exception::__construct(''); - } else { - Exception::__construct('', 0, $previous); - } - $this->appendMessage($message); - $this->setTemplateLine(false); } } - -class_alias('Twig_Error_Loader', 'Twig\Error\LoaderError', false); diff --git a/vendor/twig/twig/lib/Twig/Error/Runtime.php b/vendor/twig/twig/lib/Twig/Error/Runtime.php index 3b24ad3a4c6a3018702090032b573d3e79f84847..d45133b897ea15d36bb5ec92666fc990ffcb1773 100644 --- a/vendor/twig/twig/lib/Twig/Error/Runtime.php +++ b/vendor/twig/twig/lib/Twig/Error/Runtime.php @@ -1,22 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Error\RuntimeError; -/** - * Exception thrown when an error occurs at runtime. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Error_Runtime extends Twig_Error -{ -} +class_exists('Twig\Error\RuntimeError'); -class_alias('Twig_Error_Runtime', 'Twig\Error\RuntimeError', false); +if (\false) { + class Twig_Error_Runtime extends RuntimeError + { + } +} diff --git a/vendor/twig/twig/lib/Twig/Error/Syntax.php b/vendor/twig/twig/lib/Twig/Error/Syntax.php index 9d09f2179301af2b048a0fdb79730e69bf12b0cb..f5920c6237d3e097258d5660f44c2125767c913d 100644 --- a/vendor/twig/twig/lib/Twig/Error/Syntax.php +++ b/vendor/twig/twig/lib/Twig/Error/Syntax.php @@ -1,55 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Error\SyntaxError; -/** - * Exception thrown when a syntax error occurs during lexing or parsing of a template. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Error_Syntax extends Twig_Error -{ - /** - * Tweaks the error message to include suggestions. - * - * @param string $name The original name of the item that does not exist - * @param array $items An array of possible items - */ - public function addSuggestions($name, array $items) - { - if (!$alternatives = self::computeAlternatives($name, $items)) { - return; - } - - $this->appendMessage(sprintf(' Did you mean "%s"?', implode('", "', $alternatives))); - } +class_exists('Twig\Error\SyntaxError'); - /** - * @internal - * - * To be merged with the addSuggestions() method in 2.0. - */ - public static function computeAlternatives($name, $items) +if (\false) { + class Twig_Error_Syntax extends SyntaxError { - $alternatives = array(); - foreach ($items as $item) { - $lev = levenshtein($name, $item); - if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { - $alternatives[$item] = $lev; - } - } - asort($alternatives); - - return array_keys($alternatives); } } - -class_alias('Twig_Error_Syntax', 'Twig\Error\SyntaxError', false); diff --git a/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php b/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php index 968cb21a4cd8fc2cf44d23c0f8a858e383bd231c..3acbf65baa55557242137a2b24707c6531b03a75 100644 --- a/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php +++ b/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php @@ -1,31 +1,11 @@ <?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\Loader\ExistsLoaderInterface; -/** - * Adds an exists() method for loaders. - * - * @author Florin Patan <florinpatan@gmail.com> - * - * @deprecated since 1.12 (to be removed in 3.0) - */ -interface Twig_ExistsLoaderInterface -{ - /** - * Check if we have the source code of a template, given its name. - * - * @param string $name The name of the template to check if we can load - * - * @return bool If the template source code is handled by this loader or not - */ - public function exists($name); -} +class_exists('Twig\Loader\ExistsLoaderInterface'); -class_alias('Twig_ExistsLoaderInterface', 'Twig\Loader\ExistsLoaderInterface', false); +if (\false) { + class Twig_ExistsLoaderInterface extends ExistsLoaderInterface + { + } +} diff --git a/vendor/twig/twig/lib/Twig/ExpressionParser.php b/vendor/twig/twig/lib/Twig/ExpressionParser.php index 2b84f3f2f836d47c87c8ba380301d87d51db4fd0..687404d6c841e205dd6193d5e424f2a4910398f9 100644 --- a/vendor/twig/twig/lib/Twig/ExpressionParser.php +++ b/vendor/twig/twig/lib/Twig/ExpressionParser.php @@ -1,744 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\ExpressionParser; -/** - * Parses expressions. - * - * This parser implements a "Precedence climbing" algorithm. - * - * @see http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm - * @see http://en.wikipedia.org/wiki/Operator-precedence_parser - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @internal - */ -class Twig_ExpressionParser -{ - const OPERATOR_LEFT = 1; - const OPERATOR_RIGHT = 2; +class_exists('Twig\ExpressionParser'); - protected $parser; - protected $unaryOperators; - protected $binaryOperators; - - private $env; - - public function __construct(Twig_Parser $parser, $env = null) - { - $this->parser = $parser; - - if ($env instanceof Twig_Environment) { - $this->env = $env; - $this->unaryOperators = $env->getUnaryOperators(); - $this->binaryOperators = $env->getBinaryOperators(); - } else { - @trigger_error('Passing the operators as constructor arguments to '.__METHOD__.' is deprecated since version 1.27. Pass the environment instead.', E_USER_DEPRECATED); - - $this->env = $parser->getEnvironment(); - $this->unaryOperators = func_get_arg(1); - $this->binaryOperators = func_get_arg(2); - } - } - - public function parseExpression($precedence = 0) - { - $expr = $this->getPrimary(); - $token = $this->parser->getCurrentToken(); - while ($this->isBinary($token) && $this->binaryOperators[$token->getValue()]['precedence'] >= $precedence) { - $op = $this->binaryOperators[$token->getValue()]; - $this->parser->getStream()->next(); - - if ('is not' === $token->getValue()) { - $expr = $this->parseNotTestExpression($expr); - } elseif ('is' === $token->getValue()) { - $expr = $this->parseTestExpression($expr); - } elseif (isset($op['callable'])) { - $expr = call_user_func($op['callable'], $this->parser, $expr); - } else { - $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']); - $class = $op['class']; - $expr = new $class($expr, $expr1, $token->getLine()); - } - - $token = $this->parser->getCurrentToken(); - } - - if (0 === $precedence) { - return $this->parseConditionalExpression($expr); - } - - return $expr; - } - - protected function getPrimary() - { - $token = $this->parser->getCurrentToken(); - - if ($this->isUnary($token)) { - $operator = $this->unaryOperators[$token->getValue()]; - $this->parser->getStream()->next(); - $expr = $this->parseExpression($operator['precedence']); - $class = $operator['class']; - - return $this->parsePostfixExpression(new $class($expr, $token->getLine())); - } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $this->parser->getStream()->next(); - $expr = $this->parseExpression(); - $this->parser->getStream()->expect(Twig_Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed'); - - return $this->parsePostfixExpression($expr); - } - - return $this->parsePrimaryExpression(); - } - - protected function parseConditionalExpression($expr) - { - while ($this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, '?')) { - if (!$this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) { - $expr2 = $this->parseExpression(); - if ($this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) { - $expr3 = $this->parseExpression(); - } else { - $expr3 = new Twig_Node_Expression_Constant('', $this->parser->getCurrentToken()->getLine()); - } - } else { - $expr2 = $expr; - $expr3 = $this->parseExpression(); - } - - $expr = new Twig_Node_Expression_Conditional($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine()); - } - - return $expr; - } - - protected function isUnary(Twig_Token $token) - { - return $token->test(Twig_Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->getValue()]); - } - - protected function isBinary(Twig_Token $token) - { - return $token->test(Twig_Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]); - } - - public function parsePrimaryExpression() - { - $token = $this->parser->getCurrentToken(); - switch ($token->getType()) { - case Twig_Token::NAME_TYPE: - $this->parser->getStream()->next(); - switch ($token->getValue()) { - case 'true': - case 'TRUE': - $node = new Twig_Node_Expression_Constant(true, $token->getLine()); - break; - - case 'false': - case 'FALSE': - $node = new Twig_Node_Expression_Constant(false, $token->getLine()); - break; - - case 'none': - case 'NONE': - case 'null': - case 'NULL': - $node = new Twig_Node_Expression_Constant(null, $token->getLine()); - break; - - default: - if ('(' === $this->parser->getCurrentToken()->getValue()) { - $node = $this->getFunctionNode($token->getValue(), $token->getLine()); - } else { - $node = new Twig_Node_Expression_Name($token->getValue(), $token->getLine()); - } - } - break; - - case Twig_Token::NUMBER_TYPE: - $this->parser->getStream()->next(); - $node = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - break; - - case Twig_Token::STRING_TYPE: - case Twig_Token::INTERPOLATION_START_TYPE: - $node = $this->parseStringExpression(); - break; - - case Twig_Token::OPERATOR_TYPE: - if (preg_match(Twig_Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) { - // in this context, string operators are variable names - $this->parser->getStream()->next(); - $node = new Twig_Node_Expression_Name($token->getValue(), $token->getLine()); - break; - } elseif (isset($this->unaryOperators[$token->getValue()])) { - $class = $this->unaryOperators[$token->getValue()]['class']; - - $ref = new ReflectionClass($class); - $negClass = 'Twig_Node_Expression_Unary_Neg'; - $posClass = 'Twig_Node_Expression_Unary_Pos'; - if (!(in_array($ref->getName(), array($negClass, $posClass)) || $ref->isSubclassOf($negClass) || $ref->isSubclassOf($posClass))) { - throw new Twig_Error_Syntax(sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); - } - - $this->parser->getStream()->next(); - $expr = $this->parsePrimaryExpression(); - - $node = new $class($expr, $token->getLine()); - break; - } - - // no break - default: - if ($token->test(Twig_Token::PUNCTUATION_TYPE, '[')) { - $node = $this->parseArrayExpression(); - } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '{')) { - $node = $this->parseHashExpression(); - } elseif ($token->test(Twig_Token::OPERATOR_TYPE, '=') && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) { - throw new Twig_Error_Syntax(sprintf('Unexpected operator of value "%s". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead.', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); - } else { - throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); - } - } - - return $this->parsePostfixExpression($node); - } - - public function parseStringExpression() - { - $stream = $this->parser->getStream(); - - $nodes = array(); - // a string cannot be followed by another string in a single expression - $nextCanBeString = true; - while (true) { - if ($nextCanBeString && $token = $stream->nextIf(Twig_Token::STRING_TYPE)) { - $nodes[] = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - $nextCanBeString = false; - } elseif ($stream->nextIf(Twig_Token::INTERPOLATION_START_TYPE)) { - $nodes[] = $this->parseExpression(); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $nextCanBeString = true; - } else { - break; - } - } - - $expr = array_shift($nodes); - foreach ($nodes as $node) { - $expr = new Twig_Node_Expression_Binary_Concat($expr, $node, $node->getTemplateLine()); - } - - return $expr; - } - - public function parseArrayExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '[', 'An array element was expected'); - - $node = new Twig_Node_Expression_Array(array(), $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) { - if (!$first) { - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma'); - - // trailing ,? - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) { - break; - } - } - $first = false; - - $node->addElement($this->parseExpression()); - } - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed'); - - return $node; - } - - public function parseHashExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '{', 'A hash element was expected'); - - $node = new Twig_Node_Expression_Array(array(), $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, '}')) { - if (!$first) { - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma'); - - // trailing ,? - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '}')) { - break; - } - } - $first = false; - - // a hash key can be: - // - // * a number -- 12 - // * a string -- 'a' - // * a name, which is equivalent to a string -- a - // * an expression, which must be enclosed in parentheses -- (1 + 2) - if (($token = $stream->nextIf(Twig_Token::STRING_TYPE)) || ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) || $token = $stream->nextIf(Twig_Token::NUMBER_TYPE)) { - $key = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - } elseif ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $key = $this->parseExpression(); - } else { - $current = $stream->getCurrent(); - - throw new Twig_Error_Syntax(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext()); - } - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); - $value = $this->parseExpression(); - - $node->addElement($value, $key); - } - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed'); - - return $node; - } - - public function parsePostfixExpression($node) +if (\false) { + class Twig_ExpressionParser extends ExpressionParser { - while (true) { - $token = $this->parser->getCurrentToken(); - if (Twig_Token::PUNCTUATION_TYPE == $token->getType()) { - if ('.' == $token->getValue() || '[' == $token->getValue()) { - $node = $this->parseSubscriptExpression($node); - } elseif ('|' == $token->getValue()) { - $node = $this->parseFilterExpression($node); - } else { - break; - } - } else { - break; - } - } - - return $node; - } - - public function getFunctionNode($name, $line) - { - switch ($name) { - case 'parent': - $this->parseArguments(); - if (!count($this->parser->getBlockStack())) { - throw new Twig_Error_Syntax('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext()); - } - - if (!$this->parser->getParent() && !$this->parser->hasTraits()) { - throw new Twig_Error_Syntax('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext()); - } - - return new Twig_Node_Expression_Parent($this->parser->peekBlockStack(), $line); - case 'block': - $args = $this->parseArguments(); - if (count($args) < 1) { - throw new Twig_Error_Syntax('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext()); - } - - return new Twig_Node_Expression_BlockReference($args->getNode(0), count($args) > 1 ? $args->getNode(1) : null, $line); - case 'attribute': - $args = $this->parseArguments(); - if (count($args) < 2) { - throw new Twig_Error_Syntax('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext()); - } - - return new Twig_Node_Expression_GetAttr($args->getNode(0), $args->getNode(1), count($args) > 2 ? $args->getNode(2) : null, Twig_Template::ANY_CALL, $line); - default: - if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) { - $arguments = new Twig_Node_Expression_Array(array(), $line); - foreach ($this->parseArguments() as $n) { - $arguments->addElement($n); - } - - $node = new Twig_Node_Expression_MethodCall($alias['node'], $alias['name'], $arguments, $line); - $node->setAttribute('safe', true); - - return $node; - } - - $args = $this->parseArguments(true); - $class = $this->getFunctionNodeClass($name, $line); - - return new $class($name, $args, $line); - } - } - - public function parseSubscriptExpression($node) - { - $stream = $this->parser->getStream(); - $token = $stream->next(); - $lineno = $token->getLine(); - $arguments = new Twig_Node_Expression_Array(array(), $lineno); - $type = Twig_Template::ANY_CALL; - if ('.' == $token->getValue()) { - $token = $stream->next(); - if ( - Twig_Token::NAME_TYPE == $token->getType() - || - Twig_Token::NUMBER_TYPE == $token->getType() - || - (Twig_Token::OPERATOR_TYPE == $token->getType() && preg_match(Twig_Lexer::REGEX_NAME, $token->getValue())) - ) { - $arg = new Twig_Node_Expression_Constant($token->getValue(), $lineno); - - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $type = Twig_Template::METHOD_CALL; - foreach ($this->parseArguments() as $n) { - $arguments->addElement($n); - } - } - } else { - throw new Twig_Error_Syntax('Expected name or number.', $lineno, $stream->getSourceContext()); - } - - if ($node instanceof Twig_Node_Expression_Name && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { - if (!$arg instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax(sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $stream->getSourceContext()); - } - - $name = $arg->getAttribute('value'); - - if ($this->parser->isReservedMacroName($name)) { - throw new Twig_Error_Syntax(sprintf('"%s" cannot be called as macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext()); - } - - $node = new Twig_Node_Expression_MethodCall($node, 'get'.$name, $arguments, $lineno); - $node->setAttribute('safe', true); - - return $node; - } - } else { - $type = Twig_Template::ARRAY_CALL; - - // slice? - $slice = false; - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ':')) { - $slice = true; - $arg = new Twig_Node_Expression_Constant(0, $token->getLine()); - } else { - $arg = $this->parseExpression(); - } - - if ($stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) { - $slice = true; - } - - if ($slice) { - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) { - $length = new Twig_Node_Expression_Constant(null, $token->getLine()); - } else { - $length = $this->parseExpression(); - } - - $class = $this->getFilterNodeClass('slice', $token->getLine()); - $arguments = new Twig_Node(array($arg, $length)); - $filter = new $class($node, new Twig_Node_Expression_Constant('slice', $token->getLine()), $arguments, $token->getLine()); - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']'); - - return $filter; - } - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']'); - } - - return new Twig_Node_Expression_GetAttr($node, $arg, $arguments, $type, $lineno); - } - - public function parseFilterExpression($node) - { - $this->parser->getStream()->next(); - - return $this->parseFilterExpressionRaw($node); - } - - public function parseFilterExpressionRaw($node, $tag = null) - { - while (true) { - $token = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE); - - $name = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $arguments = new Twig_Node(); - } else { - $arguments = $this->parseArguments(true); - } - - $class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine()); - - $node = new $class($node, $name, $arguments, $token->getLine(), $tag); - - if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '|')) { - break; - } - - $this->parser->getStream()->next(); - } - - return $node; - } - - /** - * Parses arguments. - * - * @param bool $namedArguments Whether to allow named arguments or not - * @param bool $definition Whether we are parsing arguments for a function definition - * - * @return Twig_Node - * - * @throws Twig_Error_Syntax - */ - public function parseArguments($namedArguments = false, $definition = false) - { - $args = array(); - $stream = $this->parser->getStream(); - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); - while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ')')) { - if (!empty($args)) { - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma'); - } - - if ($definition) { - $token = $stream->expect(Twig_Token::NAME_TYPE, null, 'An argument must be a name'); - $value = new Twig_Node_Expression_Name($token->getValue(), $this->parser->getCurrentToken()->getLine()); - } else { - $value = $this->parseExpression(); - } - - $name = null; - if ($namedArguments && $token = $stream->nextIf(Twig_Token::OPERATOR_TYPE, '=')) { - if (!$value instanceof Twig_Node_Expression_Name) { - throw new Twig_Error_Syntax(sprintf('A parameter name must be a string, "%s" given.', get_class($value)), $token->getLine(), $stream->getSourceContext()); - } - $name = $value->getAttribute('name'); - - if ($definition) { - $value = $this->parsePrimaryExpression(); - - if (!$this->checkConstantExpression($value)) { - throw new Twig_Error_Syntax(sprintf('A default value for an argument must be a constant (a boolean, a string, a number, or an array).'), $token->getLine(), $stream->getSourceContext()); - } - } else { - $value = $this->parseExpression(); - } - } - - if ($definition) { - if (null === $name) { - $name = $value->getAttribute('name'); - $value = new Twig_Node_Expression_Constant(null, $this->parser->getCurrentToken()->getLine()); - } - $args[$name] = $value; - } else { - if (null === $name) { - $args[] = $value; - } else { - $args[$name] = $value; - } - } - } - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis'); - - return new Twig_Node($args); - } - - public function parseAssignmentExpression() - { - $stream = $this->parser->getStream(); - $targets = array(); - while (true) { - $token = $stream->expect(Twig_Token::NAME_TYPE, null, 'Only variables can be assigned to'); - $value = $token->getValue(); - if (in_array(strtolower($value), array('true', 'false', 'none', 'null'))) { - throw new Twig_Error_Syntax(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext()); - } - $targets[] = new Twig_Node_Expression_AssignName($value, $token->getLine()); - - if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - } - - return new Twig_Node($targets); - } - - public function parseMultitargetExpression() - { - $targets = array(); - while (true) { - $targets[] = $this->parseExpression(); - if (!$this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - } - - return new Twig_Node($targets); - } - - private function parseNotTestExpression(Twig_NodeInterface $node) - { - return new Twig_Node_Expression_Unary_Not($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine()); - } - - private function parseTestExpression(Twig_NodeInterface $node) - { - $stream = $this->parser->getStream(); - list($name, $test) = $this->getTest($node->getTemplateLine()); - - $class = $this->getTestNodeClass($test); - $arguments = null; - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $arguments = $this->parser->getExpressionParser()->parseArguments(true); - } - - return new $class($node, $name, $arguments, $this->parser->getCurrentToken()->getLine()); - } - - private function getTest($line) - { - $stream = $this->parser->getStream(); - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - - if ($test = $this->env->getTest($name)) { - return array($name, $test); - } - - if ($stream->test(Twig_Token::NAME_TYPE)) { - // try 2-words tests - $name = $name.' '.$this->parser->getCurrentToken()->getValue(); - - if ($test = $this->env->getTest($name)) { - $stream->next(); - - return array($name, $test); - } - } - - $e = new Twig_Error_Syntax(sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getTests())); - - throw $e; - } - - private function getTestNodeClass($test) - { - if ($test instanceof Twig_SimpleTest && $test->isDeprecated()) { - $stream = $this->parser->getStream(); - $message = sprintf('Twig Test "%s" is deprecated', $test->getName()); - if (!is_bool($test->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $test->getDeprecatedVersion()); - } - if ($test->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $test->getAlternative()); - } - $src = $stream->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $stream->getCurrent()->getLine()); - - @trigger_error($message, E_USER_DEPRECATED); - } - - if ($test instanceof Twig_SimpleTest) { - return $test->getNodeClass(); - } - - return $test instanceof Twig_Test_Node ? $test->getClass() : 'Twig_Node_Expression_Test'; - } - - protected function getFunctionNodeClass($name, $line) - { - if (false === $function = $this->env->getFunction($name)) { - $e = new Twig_Error_Syntax(sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getFunctions())); - - throw $e; - } - - if ($function instanceof Twig_SimpleFunction && $function->isDeprecated()) { - $message = sprintf('Twig Function "%s" is deprecated', $function->getName()); - if (!is_bool($function->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $function->getDeprecatedVersion()); - } - if ($function->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $function->getAlternative()); - } - $src = $this->parser->getStream()->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line); - - @trigger_error($message, E_USER_DEPRECATED); - } - - if ($function instanceof Twig_SimpleFunction) { - return $function->getNodeClass(); - } - - return $function instanceof Twig_Function_Node ? $function->getClass() : 'Twig_Node_Expression_Function'; - } - - protected function getFilterNodeClass($name, $line) - { - if (false === $filter = $this->env->getFilter($name)) { - $e = new Twig_Error_Syntax(sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getFilters())); - - throw $e; - } - - if ($filter instanceof Twig_SimpleFilter && $filter->isDeprecated()) { - $message = sprintf('Twig Filter "%s" is deprecated', $filter->getName()); - if (!is_bool($filter->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $filter->getDeprecatedVersion()); - } - if ($filter->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $filter->getAlternative()); - } - $src = $this->parser->getStream()->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line); - - @trigger_error($message, E_USER_DEPRECATED); - } - - if ($filter instanceof Twig_SimpleFilter) { - return $filter->getNodeClass(); - } - - return $filter instanceof Twig_Filter_Node ? $filter->getClass() : 'Twig_Node_Expression_Filter'; - } - - // checks that the node only contains "constant" elements - protected function checkConstantExpression(Twig_NodeInterface $node) - { - if (!($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array - || $node instanceof Twig_Node_Expression_Unary_Neg || $node instanceof Twig_Node_Expression_Unary_Pos - )) { - return false; - } - - foreach ($node as $n) { - if (!$this->checkConstantExpression($n)) { - return false; - } - } - - return true; } } - -class_alias('Twig_ExpressionParser', 'Twig\ExpressionParser', false); diff --git a/vendor/twig/twig/lib/Twig/Extension.php b/vendor/twig/twig/lib/Twig/Extension.php index 38084495fa4f99bb435f42a65c05d6154bea5604..1cc8216a5e783827fd00d91e2be3cf2a4b8da8c8 100644 --- a/vendor/twig/twig/lib/Twig/Extension.php +++ b/vendor/twig/twig/lib/Twig/Extension.php @@ -1,69 +1,11 @@ <?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\Extension\AbstractExtension; -abstract class Twig_Extension implements Twig_ExtensionInterface -{ - /** - * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead - */ - public function initRuntime(Twig_Environment $environment) - { - } - - public function getTokenParsers() - { - return array(); - } - - public function getNodeVisitors() - { - return array(); - } - - public function getFilters() - { - return array(); - } - - public function getTests() - { - return array(); - } - - public function getFunctions() - { - return array(); - } - - public function getOperators() - { - return array(); - } - - /** - * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_GlobalsInterface instead - */ - public function getGlobals() - { - return array(); - } +class_exists('Twig\Extension\AbstractExtension'); - /** - * @deprecated since 1.26 (to be removed in 2.0), not used anymore internally - */ - public function getName() +if (\false) { + class Twig_Extension extends AbstractExtension { - return get_class($this); } } - -class_alias('Twig_Extension', 'Twig\Extension\AbstractExtension', false); -class_exists('Twig_Environment'); diff --git a/vendor/twig/twig/lib/Twig/Extension/Core.php b/vendor/twig/twig/lib/Twig/Extension/Core.php index 6e5569a28f646b4c3a896f27f0d17c1d9b18bd31..fb5a75476745ea0b7fa889d38db2c08504507d65 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Core.php +++ b/vendor/twig/twig/lib/Twig/Extension/Core.php @@ -1,1628 +1,11 @@ <?php -if (!defined('ENT_SUBSTITUTE')) { - define('ENT_SUBSTITUTE', 8); -} - -/* - * 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. - */ - -/** - * @final - */ -class Twig_Extension_Core extends Twig_Extension -{ - protected $dateFormats = array('F j, Y H:i', '%d days'); - protected $numberFormat = array(0, '.', ','); - protected $timezone = null; - protected $escapers = array(); - - /** - * Defines a new escaper to be used via the escape filter. - * - * @param string $strategy The strategy name that should be used as a strategy in the escape call - * @param callable $callable A valid PHP callable - */ - public function setEscaper($strategy, $callable) - { - $this->escapers[$strategy] = $callable; - } - - /** - * Gets all defined escapers. - * - * @return array An array of escapers - */ - public function getEscapers() - { - return $this->escapers; - } - - /** - * Sets the default format to be used by the date filter. - * - * @param string $format The default date format string - * @param string $dateIntervalFormat The default date interval format string - */ - public function setDateFormat($format = null, $dateIntervalFormat = null) - { - if (null !== $format) { - $this->dateFormats[0] = $format; - } - - if (null !== $dateIntervalFormat) { - $this->dateFormats[1] = $dateIntervalFormat; - } - } - - /** - * Gets the default format to be used by the date filter. - * - * @return array The default date format string and the default date interval format string - */ - public function getDateFormat() - { - return $this->dateFormats; - } - - /** - * Sets the default timezone to be used by the date filter. - * - * @param DateTimeZone|string $timezone The default timezone string or a DateTimeZone object - */ - public function setTimezone($timezone) - { - $this->timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone); - } - - /** - * Gets the default timezone to be used by the date filter. - * - * @return DateTimeZone The default timezone currently in use - */ - public function getTimezone() - { - if (null === $this->timezone) { - $this->timezone = new DateTimeZone(date_default_timezone_get()); - } - - return $this->timezone; - } - - /** - * Sets the default format to be used by the number_format filter. - * - * @param int $decimal the number of decimal places to use - * @param string $decimalPoint the character(s) to use for the decimal point - * @param string $thousandSep the character(s) to use for the thousands separator - */ - public function setNumberFormat($decimal, $decimalPoint, $thousandSep) - { - $this->numberFormat = array($decimal, $decimalPoint, $thousandSep); - } - - /** - * Get the default format used by the number_format filter. - * - * @return array The arguments for number_format() - */ - public function getNumberFormat() - { - return $this->numberFormat; - } - - public function getTokenParsers() - { - return array( - new Twig_TokenParser_For(), - new Twig_TokenParser_If(), - new Twig_TokenParser_Extends(), - new Twig_TokenParser_Include(), - new Twig_TokenParser_Block(), - new Twig_TokenParser_Use(), - new Twig_TokenParser_Filter(), - new Twig_TokenParser_Macro(), - new Twig_TokenParser_Import(), - new Twig_TokenParser_From(), - new Twig_TokenParser_Set(), - new Twig_TokenParser_Spaceless(), - new Twig_TokenParser_Flush(), - new Twig_TokenParser_Do(), - new Twig_TokenParser_Embed(), - new Twig_TokenParser_With(), - ); - } - - public function getFilters() - { - $filters = array( - // formatting filters - new Twig_SimpleFilter('date', 'twig_date_format_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('date_modify', 'twig_date_modify_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('format', 'sprintf'), - new Twig_SimpleFilter('replace', 'twig_replace_filter'), - new Twig_SimpleFilter('number_format', 'twig_number_format_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('abs', 'abs'), - new Twig_SimpleFilter('round', 'twig_round'), - - // encoding - new Twig_SimpleFilter('url_encode', 'twig_urlencode_filter'), - new Twig_SimpleFilter('json_encode', 'twig_jsonencode_filter'), - new Twig_SimpleFilter('convert_encoding', 'twig_convert_encoding'), - - // string filters - new Twig_SimpleFilter('title', 'twig_title_string_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('capitalize', 'twig_capitalize_string_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('upper', 'strtoupper'), - new Twig_SimpleFilter('lower', 'strtolower'), - new Twig_SimpleFilter('striptags', 'strip_tags'), - new Twig_SimpleFilter('trim', 'twig_trim_filter'), - new Twig_SimpleFilter('nl2br', 'nl2br', array('pre_escape' => 'html', 'is_safe' => array('html'))), - - // array helpers - new Twig_SimpleFilter('join', 'twig_join_filter'), - new Twig_SimpleFilter('split', 'twig_split_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('sort', 'twig_sort_filter'), - new Twig_SimpleFilter('merge', 'twig_array_merge'), - new Twig_SimpleFilter('batch', 'twig_array_batch'), - - // string/array filters - new Twig_SimpleFilter('reverse', 'twig_reverse_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('length', 'twig_length_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('slice', 'twig_slice', array('needs_environment' => true)), - new Twig_SimpleFilter('first', 'twig_first', array('needs_environment' => true)), - new Twig_SimpleFilter('last', 'twig_last', array('needs_environment' => true)), - - // iteration and runtime - new Twig_SimpleFilter('default', '_twig_default_filter', array('node_class' => 'Twig_Node_Expression_Filter_Default')), - new Twig_SimpleFilter('keys', 'twig_get_array_keys_filter'), - - // escaping - new Twig_SimpleFilter('escape', 'twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')), - new Twig_SimpleFilter('e', 'twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')), - ); - - if (function_exists('mb_get_info')) { - $filters[] = new Twig_SimpleFilter('upper', 'twig_upper_filter', array('needs_environment' => true)); - $filters[] = new Twig_SimpleFilter('lower', 'twig_lower_filter', array('needs_environment' => true)); - } - - return $filters; - } - - public function getFunctions() - { - return array( - new Twig_SimpleFunction('max', 'max'), - new Twig_SimpleFunction('min', 'min'), - new Twig_SimpleFunction('range', 'range'), - new Twig_SimpleFunction('constant', 'twig_constant'), - new Twig_SimpleFunction('cycle', 'twig_cycle'), - new Twig_SimpleFunction('random', 'twig_random', array('needs_environment' => true)), - new Twig_SimpleFunction('date', 'twig_date_converter', array('needs_environment' => true)), - new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))), - new Twig_SimpleFunction('source', 'twig_source', array('needs_environment' => true, 'is_safe' => array('all'))), - ); - } - - public function getTests() - { - return array( - new Twig_SimpleTest('even', null, array('node_class' => 'Twig_Node_Expression_Test_Even')), - new Twig_SimpleTest('odd', null, array('node_class' => 'Twig_Node_Expression_Test_Odd')), - new Twig_SimpleTest('defined', null, array('node_class' => 'Twig_Node_Expression_Test_Defined')), - new Twig_SimpleTest('sameas', null, array('node_class' => 'Twig_Node_Expression_Test_Sameas', 'deprecated' => '1.21', 'alternative' => 'same as')), - new Twig_SimpleTest('same as', null, array('node_class' => 'Twig_Node_Expression_Test_Sameas')), - new Twig_SimpleTest('none', null, array('node_class' => 'Twig_Node_Expression_Test_Null')), - new Twig_SimpleTest('null', null, array('node_class' => 'Twig_Node_Expression_Test_Null')), - new Twig_SimpleTest('divisibleby', null, array('node_class' => 'Twig_Node_Expression_Test_Divisibleby', 'deprecated' => '1.21', 'alternative' => 'divisible by')), - new Twig_SimpleTest('divisible by', null, array('node_class' => 'Twig_Node_Expression_Test_Divisibleby')), - new Twig_SimpleTest('constant', null, array('node_class' => 'Twig_Node_Expression_Test_Constant')), - new Twig_SimpleTest('empty', 'twig_test_empty'), - new Twig_SimpleTest('iterable', 'twig_test_iterable'), - ); - } - - public function getOperators() - { - return array( - array( - 'not' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), - '-' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Neg'), - '+' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Pos'), - ), - array( - 'or' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'and' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-or' => array('precedence' => 16, 'class' => 'Twig_Node_Expression_Binary_BitwiseOr', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-xor' => array('precedence' => 17, 'class' => 'Twig_Node_Expression_Binary_BitwiseXor', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-and' => array('precedence' => 18, 'class' => 'Twig_Node_Expression_Binary_BitwiseAnd', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '==' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '!=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '<' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '>=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '<=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'not in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotIn', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_In', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'matches' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Matches', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'starts with' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_StartsWith', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'ends with' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_EndsWith', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '..' => array('precedence' => 25, 'class' => 'Twig_Node_Expression_Binary_Range', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '+' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Add', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '-' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Sub', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '~' => array('precedence' => 40, 'class' => 'Twig_Node_Expression_Binary_Concat', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '*' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mul', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '/' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Div', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '//' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_FloorDiv', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '%' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'is' => array('precedence' => 100, 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'is not' => array('precedence' => 100, 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '**' => array('precedence' => 200, 'class' => 'Twig_Node_Expression_Binary_Power', 'associativity' => Twig_ExpressionParser::OPERATOR_RIGHT), - '??' => array('precedence' => 300, 'class' => 'Twig_Node_Expression_NullCoalesce', 'associativity' => Twig_ExpressionParser::OPERATOR_RIGHT), - ), - ); - } - - public function getName() - { - return 'core'; - } -} - -/** - * Cycles over a value. - * - * @param ArrayAccess|array $values - * @param int $position The cycle position - * - * @return string The next value in the cycle - */ -function twig_cycle($values, $position) -{ - if (!is_array($values) && !$values instanceof ArrayAccess) { - return $values; - } - - return $values[$position % count($values)]; -} - -/** - * Returns a random value depending on the supplied parameter type: - * - a random item from a Traversable or array - * - a random character from a string - * - a random integer between 0 and the integer parameter. - * - * @param Twig_Environment $env - * @param Traversable|array|int|float|string $values The values to pick a random item from - * - * @throws Twig_Error_Runtime when $values is an empty array (does not apply to an empty string which is returned as is) - * - * @return mixed A random value from the given sequence - */ -function twig_random(Twig_Environment $env, $values = null) -{ - if (null === $values) { - return mt_rand(); - } - - if (is_int($values) || is_float($values)) { - return $values < 0 ? mt_rand($values, 0) : mt_rand(0, $values); - } - - if ($values instanceof Traversable) { - $values = iterator_to_array($values); - } elseif (is_string($values)) { - if ('' === $values) { - return ''; - } - if (null !== $charset = $env->getCharset()) { - if ('UTF-8' !== $charset) { - $values = twig_convert_encoding($values, 'UTF-8', $charset); - } - - // unicode version of str_split() - // split at all positions, but not after the start and not before the end - $values = preg_split('/(?<!^)(?!$)/u', $values); - - if ('UTF-8' !== $charset) { - foreach ($values as $i => $value) { - $values[$i] = twig_convert_encoding($value, $charset, 'UTF-8'); - } - } - } else { - return $values[mt_rand(0, strlen($values) - 1)]; - } - } - - if (!is_array($values)) { - return $values; - } - - if (0 === count($values)) { - throw new Twig_Error_Runtime('The random function cannot pick from an empty array.'); - } - - return $values[array_rand($values, 1)]; -} - -/** - * Converts a date to the given format. - * - * <pre> - * {{ post.published_at|date("m/d/Y") }} - * </pre> - * - * @param Twig_Environment $env - * @param DateTime|DateTimeInterface|DateInterval|string $date A date - * @param string|null $format The target format, null to use the default - * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged - * - * @return string The formatted date - */ -function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $timezone = null) -{ - if (null === $format) { - $formats = $env->getExtension('Twig_Extension_Core')->getDateFormat(); - $format = $date instanceof DateInterval ? $formats[1] : $formats[0]; - } - - if ($date instanceof DateInterval) { - return $date->format($format); - } - - return twig_date_converter($env, $date, $timezone)->format($format); -} - -/** - * Returns a new date object modified. - * - * <pre> - * {{ post.published_at|date_modify("-1day")|date("m/d/Y") }} - * </pre> - * - * @param Twig_Environment $env - * @param DateTime|string $date A date - * @param string $modifier A modifier string - * - * @return DateTime A new date object - */ -function twig_date_modify_filter(Twig_Environment $env, $date, $modifier) -{ - $date = twig_date_converter($env, $date, false); - $resultDate = $date->modify($modifier); - - // This is a hack to ensure PHP 5.2 support and support for DateTimeImmutable - // DateTime::modify does not return the modified DateTime object < 5.3.0 - // and DateTimeImmutable does not modify $date. - return null === $resultDate ? $date : $resultDate; -} - -/** - * Converts an input to a DateTime instance. - * - * <pre> - * {% if date(user.created_at) < date('+2days') %} - * {# do something #} - * {% endif %} - * </pre> - * - * @param Twig_Environment $env - * @param DateTime|DateTimeInterface|string|null $date A date - * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged - * - * @return DateTime A DateTime instance - */ -function twig_date_converter(Twig_Environment $env, $date = null, $timezone = null) -{ - // determine the timezone - if (false !== $timezone) { - if (null === $timezone) { - $timezone = $env->getExtension('Twig_Extension_Core')->getTimezone(); - } elseif (!$timezone instanceof DateTimeZone) { - $timezone = new DateTimeZone($timezone); - } - } - - // immutable dates - if ($date instanceof DateTimeImmutable) { - return false !== $timezone ? $date->setTimezone($timezone) : $date; - } - - if ($date instanceof DateTime || $date instanceof DateTimeInterface) { - $date = clone $date; - if (false !== $timezone) { - $date->setTimezone($timezone); - } - - return $date; - } - - if (null === $date || 'now' === $date) { - return new DateTime($date, false !== $timezone ? $timezone : $env->getExtension('Twig_Extension_Core')->getTimezone()); - } - - $asString = (string) $date; - if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) { - $date = new DateTime('@'.$date); - } else { - $date = new DateTime($date, $env->getExtension('Twig_Extension_Core')->getTimezone()); - } - - if (false !== $timezone) { - $date->setTimezone($timezone); - } - - return $date; -} - -/** - * Replaces strings within a string. - * - * @param string $str String to replace in - * @param array|Traversable $from Replace values - * @param string|null $to Replace to, deprecated (@see http://php.net/manual/en/function.strtr.php) - * - * @return string - */ -function twig_replace_filter($str, $from, $to = null) -{ - if ($from instanceof Traversable) { - $from = iterator_to_array($from); - } elseif (is_string($from) && is_string($to)) { - @trigger_error('Using "replace" with character by character replacement is deprecated since version 1.22 and will be removed in Twig 2.0', E_USER_DEPRECATED); - - return strtr($str, $from, $to); - } elseif (!is_array($from)) { - throw new Twig_Error_Runtime(sprintf('The "replace" filter expects an array or "Traversable" as replace values, got "%s".', is_object($from) ? get_class($from) : gettype($from))); - } - - return strtr($str, $from); -} - -/** - * Rounds a number. - * - * @param int|float $value The value to round - * @param int|float $precision The rounding precision - * @param string $method The method to use for rounding - * - * @return int|float The rounded number - */ -function twig_round($value, $precision = 0, $method = 'common') -{ - if ('common' == $method) { - return round($value, $precision); - } - - if ('ceil' != $method && 'floor' != $method) { - throw new Twig_Error_Runtime('The round filter only supports the "common", "ceil", and "floor" methods.'); - } - - return $method($value * pow(10, $precision)) / pow(10, $precision); -} - -/** - * Number format filter. - * - * All of the formatting options can be left null, in that case the defaults will - * be used. Supplying any of the parameters will override the defaults set in the - * environment object. - * - * @param Twig_Environment $env - * @param mixed $number A float/int/string of the number to format - * @param int $decimal the number of decimal points to display - * @param string $decimalPoint the character(s) to use for the decimal point - * @param string $thousandSep the character(s) to use for the thousands separator - * - * @return string The formatted number - */ -function twig_number_format_filter(Twig_Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) -{ - $defaults = $env->getExtension('Twig_Extension_Core')->getNumberFormat(); - if (null === $decimal) { - $decimal = $defaults[0]; - } - - if (null === $decimalPoint) { - $decimalPoint = $defaults[1]; - } - - if (null === $thousandSep) { - $thousandSep = $defaults[2]; - } - - return number_format((float) $number, $decimal, $decimalPoint, $thousandSep); -} - -/** - * URL encodes (RFC 3986) a string as a path segment or an array as a query string. - * - * @param string|array $url A URL or an array of query parameters - * - * @return string The URL encoded value - */ -function twig_urlencode_filter($url) -{ - if (is_array($url)) { - if (defined('PHP_QUERY_RFC3986')) { - return http_build_query($url, '', '&', PHP_QUERY_RFC3986); - } - - return http_build_query($url, '', '&'); - } - - return rawurlencode($url); -} - -if (PHP_VERSION_ID < 50300) { - /** - * JSON encodes a variable. - * - * @param mixed $value the value to encode - * @param int $options Not used on PHP 5.2.x - * - * @return mixed The JSON encoded value - */ - function twig_jsonencode_filter($value, $options = 0) - { - if ($value instanceof Twig_Markup) { - $value = (string) $value; - } elseif (is_array($value)) { - array_walk_recursive($value, '_twig_markup2string'); - } - - return json_encode($value); - } -} else { - /** - * JSON encodes a variable. - * - * @param mixed $value the value to encode - * @param int $options Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT - * - * @return mixed The JSON encoded value - */ - function twig_jsonencode_filter($value, $options = 0) - { - if ($value instanceof Twig_Markup) { - $value = (string) $value; - } elseif (is_array($value)) { - array_walk_recursive($value, '_twig_markup2string'); - } - - return json_encode($value, $options); - } -} - -function _twig_markup2string(&$value) -{ - if ($value instanceof Twig_Markup) { - $value = (string) $value; - } -} - -/** - * Merges an array with another one. - * - * <pre> - * {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} - * - * {% set items = items|merge({ 'peugeot': 'car' }) %} - * - * {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #} - * </pre> - * - * @param array|Traversable $arr1 An array - * @param array|Traversable $arr2 An array - * - * @return array The merged array - */ -function twig_array_merge($arr1, $arr2) -{ - if ($arr1 instanceof Traversable) { - $arr1 = iterator_to_array($arr1); - } elseif (!is_array($arr1)) { - throw new Twig_Error_Runtime(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', gettype($arr1))); - } - - if ($arr2 instanceof Traversable) { - $arr2 = iterator_to_array($arr2); - } elseif (!is_array($arr2)) { - throw new Twig_Error_Runtime(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', gettype($arr2))); - } - - return array_merge($arr1, $arr2); -} - -/** - * Slices a variable. - * - * @param Twig_Environment $env - * @param mixed $item A variable - * @param int $start Start of the slice - * @param int $length Size of the slice - * @param bool $preserveKeys Whether to preserve key or not (when the input is an array) - * - * @return mixed The sliced variable - */ -function twig_slice(Twig_Environment $env, $item, $start, $length = null, $preserveKeys = false) -{ - if ($item instanceof Traversable) { - while ($item instanceof IteratorAggregate) { - $item = $item->getIterator(); - } - - if ($start >= 0 && $length >= 0 && $item instanceof Iterator) { - try { - return iterator_to_array(new LimitIterator($item, $start, null === $length ? -1 : $length), $preserveKeys); - } catch (OutOfBoundsException $exception) { - return array(); - } - } - - $item = iterator_to_array($item, $preserveKeys); - } - - if (is_array($item)) { - return array_slice($item, $start, $length, $preserveKeys); - } - - $item = (string) $item; - - if (function_exists('mb_get_info') && null !== $charset = $env->getCharset()) { - return (string) mb_substr($item, $start, null === $length ? mb_strlen($item, $charset) - $start : $length, $charset); - } - - return (string) (null === $length ? substr($item, $start) : substr($item, $start, $length)); -} - -/** - * Returns the first element of the item. - * - * @param Twig_Environment $env - * @param mixed $item A variable - * - * @return mixed The first element of the item - */ -function twig_first(Twig_Environment $env, $item) -{ - $elements = twig_slice($env, $item, 0, 1, false); - - return is_string($elements) ? $elements : current($elements); -} - -/** - * Returns the last element of the item. - * - * @param Twig_Environment $env - * @param mixed $item A variable - * - * @return mixed The last element of the item - */ -function twig_last(Twig_Environment $env, $item) -{ - $elements = twig_slice($env, $item, -1, 1, false); - - return is_string($elements) ? $elements : current($elements); -} - -/** - * Joins the values to a string. - * - * The separator between elements is an empty string per default, you can define it with the optional parameter. - * - * <pre> - * {{ [1, 2, 3]|join('|') }} - * {# returns 1|2|3 #} - * - * {{ [1, 2, 3]|join }} - * {# returns 123 #} - * </pre> - * - * @param array $value An array - * @param string $glue The separator - * - * @return string The concatenated string - */ -function twig_join_filter($value, $glue = '') -{ - if ($value instanceof Traversable) { - $value = iterator_to_array($value, false); - } - - return implode($glue, (array) $value); -} - -/** - * Splits the string into an array. - * - * <pre> - * {{ "one,two,three"|split(',') }} - * {# returns [one, two, three] #} - * - * {{ "one,two,three,four,five"|split(',', 3) }} - * {# returns [one, two, "three,four,five"] #} - * - * {{ "123"|split('') }} - * {# returns [1, 2, 3] #} - * - * {{ "aabbcc"|split('', 2) }} - * {# returns [aa, bb, cc] #} - * </pre> - * - * @param Twig_Environment $env - * @param string $value A string - * @param string $delimiter The delimiter - * @param int $limit The limit - * - * @return array The split string as an array - */ -function twig_split_filter(Twig_Environment $env, $value, $delimiter, $limit = null) -{ - if (!empty($delimiter)) { - return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); - } - - if (!function_exists('mb_get_info') || null === $charset = $env->getCharset()) { - return str_split($value, null === $limit ? 1 : $limit); - } - - if ($limit <= 1) { - return preg_split('/(?<!^)(?!$)/u', $value); - } - - $length = mb_strlen($value, $charset); - if ($length < $limit) { - return array($value); - } - - $r = array(); - for ($i = 0; $i < $length; $i += $limit) { - $r[] = mb_substr($value, $i, $limit, $charset); - } - - return $r; -} - -// The '_default' filter is used internally to avoid using the ternary operator -// which costs a lot for big contexts (before PHP 5.4). So, on average, -// a function call is cheaper. -/** - * @internal - */ -function _twig_default_filter($value, $default = '') -{ - if (twig_test_empty($value)) { - return $default; - } - - return $value; -} - -/** - * Returns the keys for the given array. - * - * It is useful when you want to iterate over the keys of an array: - * - * <pre> - * {% for key in array|keys %} - * {# ... #} - * {% endfor %} - * </pre> - * - * @param array $array An array - * - * @return array The keys - */ -function twig_get_array_keys_filter($array) -{ - if ($array instanceof Traversable) { - while ($array instanceof IteratorAggregate) { - $array = $array->getIterator(); - } - - if ($array instanceof Iterator) { - $keys = array(); - $array->rewind(); - while ($array->valid()) { - $keys[] = $array->key(); - $array->next(); - } - - return $keys; - } - - $keys = array(); - foreach ($array as $key => $item) { - $keys[] = $key; - } - - return $keys; - } - - if (!is_array($array)) { - return array(); - } - - return array_keys($array); -} - -/** - * Reverses a variable. - * - * @param Twig_Environment $env - * @param array|Traversable|string $item An array, a Traversable instance, or a string - * @param bool $preserveKeys Whether to preserve key or not - * - * @return mixed The reversed input - */ -function twig_reverse_filter(Twig_Environment $env, $item, $preserveKeys = false) -{ - if ($item instanceof Traversable) { - return array_reverse(iterator_to_array($item), $preserveKeys); - } - - if (is_array($item)) { - return array_reverse($item, $preserveKeys); - } - - if (null !== $charset = $env->getCharset()) { - $string = (string) $item; - - if ('UTF-8' !== $charset) { - $item = twig_convert_encoding($string, 'UTF-8', $charset); - } - - preg_match_all('/./us', $item, $matches); - - $string = implode('', array_reverse($matches[0])); - - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; - } - - return strrev((string) $item); -} - -/** - * Sorts an array. - * - * @param array|Traversable $array - * - * @return array - */ -function twig_sort_filter($array) -{ - if ($array instanceof Traversable) { - $array = iterator_to_array($array); - } elseif (!is_array($array)) { - throw new Twig_Error_Runtime(sprintf('The sort filter only works with arrays or "Traversable", got "%s".', gettype($array))); - } - - asort($array); - - return $array; -} - -/** - * @internal - */ -function twig_in_filter($value, $compare) -{ - 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))) { - return '' === $value || false !== strpos($compare, (string) $value); - } elseif ($compare instanceof Traversable) { - if (is_object($value) || is_resource($value)) { - foreach ($compare as $item) { - if ($item === $value) { - return true; - } - } - } else { - foreach ($compare as $item) { - if ($item == $value) { - return true; - } - } - } - - return false; - } - - return false; -} - -/** - * Returns a trimmed string. - * - * @return string - * - * @throws Twig_Error_Runtime When an invalid trimming side is used (not a string or not 'left', 'right', or 'both') - */ -function twig_trim_filter($string, $characterMask = null, $side = 'both') -{ - if (null === $characterMask) { - $characterMask = " \t\n\r\0\x0B"; - } - - switch ($side) { - case 'both': - return trim($string, $characterMask); - case 'left': - return ltrim($string, $characterMask); - case 'right': - return rtrim($string, $characterMask); - default: - throw new Twig_Error_Runtime('Trimming side must be "left", "right" or "both".'); - } -} - -/** - * Escapes a string. - * - * @param Twig_Environment $env - * @param mixed $string The value to be escaped - * @param string $strategy The escaping strategy - * @param string $charset The charset - * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) - * - * @return string - */ -function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false) -{ - if ($autoescape && $string instanceof Twig_Markup) { - return $string; - } - - if (!is_string($string)) { - if (is_object($string) && method_exists($string, '__toString')) { - $string = (string) $string; - } elseif (in_array($strategy, array('html', 'js', 'css', 'html_attr', 'url'))) { - return $string; - } - } - - if (null === $charset) { - $charset = $env->getCharset(); - } - - switch ($strategy) { - case 'html': - // see http://php.net/htmlspecialchars - - // Using a static variable to avoid initializing the array - // each time the function is called. Moving the declaration on the - // top of the function slow downs other escaping strategies. - static $htmlspecialcharsCharsets = array( - 'ISO-8859-1' => true, 'ISO8859-1' => true, - 'ISO-8859-15' => true, 'ISO8859-15' => true, - 'utf-8' => true, 'UTF-8' => true, - 'CP866' => true, 'IBM866' => true, '866' => true, - 'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true, - '1251' => true, - 'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true, - 'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true, - 'BIG5' => true, '950' => true, - 'GB2312' => true, '936' => true, - 'BIG5-HKSCS' => true, - 'SHIFT_JIS' => true, 'SJIS' => true, '932' => true, - 'EUC-JP' => true, 'EUCJP' => true, - 'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true, - ); - - if (isset($htmlspecialcharsCharsets[$charset])) { - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); - } - - if (isset($htmlspecialcharsCharsets[strtoupper($charset)])) { - // cache the lowercase variant for future iterations - $htmlspecialcharsCharsets[$charset] = true; - - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); - } - - $string = twig_convert_encoding($string, 'UTF-8', $charset); - $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); - - return twig_convert_encoding($string, $charset, 'UTF-8'); - - case 'js': - // escape all non-alphanumeric characters - // into their \xHH or \uHHHH representations - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } - - if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) { - throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', '_twig_escape_js_callback', $string); - - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; +use Twig\Extension\CoreExtension; - case 'css': - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } +class_exists('Twig\Extension\CoreExtension'); - if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) { - throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', '_twig_escape_css_callback', $string); - - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; - - case 'html_attr': - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, 'UTF-8', $charset); - } - - if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) { - throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', '_twig_escape_html_attr_callback', $string); - - if ('UTF-8' !== $charset) { - $string = twig_convert_encoding($string, $charset, 'UTF-8'); - } - - return $string; - - case 'url': - if (PHP_VERSION_ID < 50300) { - return str_replace('%7E', '~', rawurlencode($string)); - } - - return rawurlencode($string); - - default: - static $escapers; - - if (null === $escapers) { - $escapers = $env->getExtension('Twig_Extension_Core')->getEscapers(); - } - - if (isset($escapers[$strategy])) { - return call_user_func($escapers[$strategy], $env, $string, $charset); - } - - $validStrategies = implode(', ', array_merge(array('html', 'js', 'url', 'css', 'html_attr'), array_keys($escapers))); - - throw new Twig_Error_Runtime(sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies)); - } -} - -/** - * @internal - */ -function twig_escape_filter_is_safe(Twig_Node $filterArgs) -{ - foreach ($filterArgs as $arg) { - if ($arg instanceof Twig_Node_Expression_Constant) { - return array($arg->getAttribute('value')); - } - - return array(); - } - - return array('html'); -} - -if (function_exists('mb_convert_encoding')) { - function twig_convert_encoding($string, $to, $from) +if (\false) { + class Twig_Extension_Core extends CoreExtension { - return mb_convert_encoding($string, $to, $from); } -} elseif (function_exists('iconv')) { - function twig_convert_encoding($string, $to, $from) - { - return iconv($from, $to, $string); - } -} else { - function twig_convert_encoding($string, $to, $from) - { - throw new Twig_Error_Runtime('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).'); - } -} - -function _twig_escape_js_callback($matches) -{ - $char = $matches[0]; - - // \xHH - if (!isset($char[1])) { - return '\\x'.strtoupper(substr('00'.bin2hex($char), -2)); - } - - // \uHHHH - $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); - $char = strtoupper(bin2hex($char)); - - if (4 >= strlen($char)) { - return sprintf('\u%04s', $char); - } - - return sprintf('\u%04s\u%04s', substr($char, 0, -4), substr($char, -4)); } - -function _twig_escape_css_callback($matches) -{ - $char = $matches[0]; - - // \xHH - if (!isset($char[1])) { - $hex = ltrim(strtoupper(bin2hex($char)), '0'); - if (0 === strlen($hex)) { - $hex = '0'; - } - - return '\\'.$hex.' '; - } - - // \uHHHH - $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); - - return '\\'.ltrim(strtoupper(bin2hex($char)), '0').' '; -} - -/** - * This function is adapted from code coming from Zend Framework. - * - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -function _twig_escape_html_attr_callback($matches) -{ - /* - * While HTML supports far more named entities, the lowest common denominator - * has become HTML5's XML Serialisation which is restricted to the those named - * entities that XML supports. Using HTML entities would result in this error: - * XML Parsing Error: undefined entity - */ - static $entityMap = array( - 34 => 'quot', /* quotation mark */ - 38 => 'amp', /* ampersand */ - 60 => 'lt', /* less-than sign */ - 62 => 'gt', /* greater-than sign */ - ); - - $chr = $matches[0]; - $ord = ord($chr); - - /* - * The following replaces characters undefined in HTML with the - * hex entity for the Unicode replacement character. - */ - if (($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr) || ($ord >= 0x7f && $ord <= 0x9f)) { - return '�'; - } - - /* - * Check if the current character to escape has a name entity we should - * replace it with while grabbing the hex value of the character. - */ - if (1 == strlen($chr)) { - $hex = strtoupper(substr('00'.bin2hex($chr), -2)); - } else { - $chr = twig_convert_encoding($chr, 'UTF-16BE', 'UTF-8'); - $hex = strtoupper(substr('0000'.bin2hex($chr), -4)); - } - - $int = hexdec($hex); - if (array_key_exists($int, $entityMap)) { - return sprintf('&%s;', $entityMap[$int]); - } - - /* - * Per OWASP recommendations, we'll use hex entities for any other - * characters where a named entity does not exist. - */ - return sprintf('&#x%s;', $hex); -} - -// add multibyte extensions if possible -if (function_exists('mb_get_info')) { - /** - * Returns the length of a variable. - * - * @param Twig_Environment $env - * @param mixed $thing A variable - * - * @return int The length of the value - */ - function twig_length_filter(Twig_Environment $env, $thing) - { - if (null === $thing) { - return 0; - } - - if (is_scalar($thing)) { - return mb_strlen($thing, $env->getCharset()); - } - - if ($thing instanceof \SimpleXMLElement) { - return count($thing); - } - - if (is_object($thing) && method_exists($thing, '__toString') && !$thing instanceof \Countable) { - return mb_strlen((string) $thing, $env->getCharset()); - } - - if ($thing instanceof \Countable || is_array($thing)) { - return count($thing); - } - - if ($thing instanceof \IteratorAggregate) { - return iterator_count($thing); - } - - return 1; - } - - /** - * Converts a string to uppercase. - * - * @param Twig_Environment $env - * @param string $string A string - * - * @return string The uppercased string - */ - function twig_upper_filter(Twig_Environment $env, $string) - { - if (null !== $charset = $env->getCharset()) { - return mb_strtoupper($string, $charset); - } - - return strtoupper($string); - } - - /** - * Converts a string to lowercase. - * - * @param Twig_Environment $env - * @param string $string A string - * - * @return string The lowercased string - */ - function twig_lower_filter(Twig_Environment $env, $string) - { - if (null !== $charset = $env->getCharset()) { - return mb_strtolower($string, $charset); - } - - return strtolower($string); - } - - /** - * Returns a titlecased string. - * - * @param Twig_Environment $env - * @param string $string A string - * - * @return string The titlecased string - */ - function twig_title_string_filter(Twig_Environment $env, $string) - { - if (null !== $charset = $env->getCharset()) { - return mb_convert_case($string, MB_CASE_TITLE, $charset); - } - - return ucwords(strtolower($string)); - } - - /** - * Returns a capitalized string. - * - * @param Twig_Environment $env - * @param string $string A string - * - * @return string The capitalized string - */ - function twig_capitalize_string_filter(Twig_Environment $env, $string) - { - if (null !== $charset = $env->getCharset()) { - return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset).mb_strtolower(mb_substr($string, 1, mb_strlen($string, $charset), $charset), $charset); - } - - return ucfirst(strtolower($string)); - } -} -// and byte fallback -else { - /** - * Returns the length of a variable. - * - * @param Twig_Environment $env - * @param mixed $thing A variable - * - * @return int The length of the value - */ - function twig_length_filter(Twig_Environment $env, $thing) - { - if (null === $thing) { - return 0; - } - - if (is_scalar($thing)) { - return strlen($thing); - } - - if ($thing instanceof \SimpleXMLElement) { - return count($thing); - } - - if (is_object($thing) && method_exists($thing, '__toString') && !$thing instanceof \Countable) { - return strlen((string) $thing); - } - - if ($thing instanceof \Countable || is_array($thing)) { - return count($thing); - } - - if ($thing instanceof \IteratorAggregate) { - return iterator_count($thing); - } - - return 1; - } - - /** - * Returns a titlecased string. - * - * @param Twig_Environment $env - * @param string $string A string - * - * @return string The titlecased string - */ - function twig_title_string_filter(Twig_Environment $env, $string) - { - return ucwords(strtolower($string)); - } - - /** - * Returns a capitalized string. - * - * @param Twig_Environment $env - * @param string $string A string - * - * @return string The capitalized string - */ - function twig_capitalize_string_filter(Twig_Environment $env, $string) - { - return ucfirst(strtolower($string)); - } -} - -/** - * @internal - */ -function twig_ensure_traversable($seq) -{ - if ($seq instanceof Traversable || is_array($seq)) { - return $seq; - } - - return array(); -} - -/** - * Checks if a variable is empty. - * - * <pre> - * {# evaluates to true if the foo variable is null, false, or the empty string #} - * {% if foo is empty %} - * {# ... #} - * {% endif %} - * </pre> - * - * @param mixed $value A variable - * - * @return bool true if the value is empty, false otherwise - */ -function twig_test_empty($value) -{ - if ($value instanceof Countable) { - return 0 == count($value); - } - - if (is_object($value) && method_exists($value, '__toString')) { - return '' === (string) $value; - } - - return '' === $value || false === $value || null === $value || array() === $value; -} - -/** - * Checks if a variable is traversable. - * - * <pre> - * {# evaluates to true if the foo variable is an array or a traversable object #} - * {% if foo is iterable %} - * {# ... #} - * {% endif %} - * </pre> - * - * @param mixed $value A variable - * - * @return bool true if the value is traversable - */ -function twig_test_iterable($value) -{ - return $value instanceof Traversable || is_array($value); -} - -/** - * Renders a template. - * - * @param Twig_Environment $env - * @param array $context - * @param string|array $template The template to render or an array of templates to try consecutively - * @param array $variables The variables to pass to the template - * @param bool $withContext - * @param bool $ignoreMissing Whether to ignore missing templates or not - * @param bool $sandboxed Whether to sandbox the template or not - * - * @return string The rendered template - */ -function twig_include(Twig_Environment $env, $context, $template, $variables = array(), $withContext = true, $ignoreMissing = false, $sandboxed = false) -{ - $alreadySandboxed = false; - $sandbox = null; - if ($withContext) { - $variables = array_merge($context, $variables); - } - - if ($isSandboxed = $sandboxed && $env->hasExtension('Twig_Extension_Sandbox')) { - $sandbox = $env->getExtension('Twig_Extension_Sandbox'); - if (!$alreadySandboxed = $sandbox->isSandboxed()) { - $sandbox->enableSandbox(); - } - } - - $result = null; - try { - $result = $env->resolveTemplate($template)->render($variables); - } catch (Twig_Error_Loader $e) { - if (!$ignoreMissing) { - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - throw $e; - } - } catch (Throwable $e) { - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - throw $e; - } catch (Exception $e) { - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - throw $e; - } - - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - return $result; -} - -/** - * Returns a template content without rendering it. - * - * @param Twig_Environment $env - * @param string $name The template name - * @param bool $ignoreMissing Whether to ignore missing templates or not - * - * @return string The template source - */ -function twig_source(Twig_Environment $env, $name, $ignoreMissing = false) -{ - $loader = $env->getLoader(); - try { - if (!$loader instanceof Twig_SourceContextLoaderInterface) { - return $loader->getSource($name); - } else { - return $loader->getSourceContext($name)->getCode(); - } - } catch (Twig_Error_Loader $e) { - if (!$ignoreMissing) { - throw $e; - } - } -} - -/** - * Provides the ability to get constants from instances as well as class/global constants. - * - * @param string $constant The name of the constant - * @param null|object $object The object to get the constant from - * - * @return string - */ -function twig_constant($constant, $object = null) -{ - if (null !== $object) { - $constant = get_class($object).'::'.$constant; - } - - return constant($constant); -} - -/** - * Checks if a constant exists. - * - * @param string $constant The name of the constant - * @param null|object $object The object to get the constant from - * - * @return bool - */ -function twig_constant_is_defined($constant, $object = null) -{ - if (null !== $object) { - $constant = get_class($object).'::'.$constant; - } - - return defined($constant); -} - -/** - * Batches item. - * - * @param array $items An array of items - * @param int $size The size of the batch - * @param mixed $fill A value used to fill missing items - * - * @return array - */ -function twig_array_batch($items, $size, $fill = null) -{ - if ($items instanceof Traversable) { - $items = iterator_to_array($items, false); - } - - $size = ceil($size); - - $result = array_chunk($items, $size, true); - - if (null !== $fill && !empty($result)) { - $last = count($result) - 1; - if ($fillCount = $size - count($result[$last])) { - $result[$last] = array_merge( - $result[$last], - array_fill(0, $fillCount, $fill) - ); - } - } - - return $result; -} - -class_alias('Twig_Extension_Core', 'Twig\Extension\CoreExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/Debug.php b/vendor/twig/twig/lib/Twig/Extension/Debug.php index d0cd1962be0d902002257b18c538c18360841eb4..bbb44fe5c60af88b4eefb1f9c0879d81098e6bdc 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Debug.php +++ b/vendor/twig/twig/lib/Twig/Extension/Debug.php @@ -1,67 +1,11 @@ <?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\Extension\DebugExtension; -/** - * @final - */ -class Twig_Extension_Debug extends Twig_Extension -{ - public function getFunctions() - { - // dump is safe if var_dump is overridden by xdebug - $isDumpOutputHtmlSafe = extension_loaded('xdebug') - // false means that it was not set (and the default is on) or it explicitly enabled - && (false === ini_get('xdebug.overload_var_dump') || ini_get('xdebug.overload_var_dump')) - // false means that it was not set (and the default is on) or it explicitly enabled - // xdebug.overload_var_dump produces HTML only when html_errors is also enabled - && (false === ini_get('html_errors') || ini_get('html_errors')) - || 'cli' === PHP_SAPI - ; - - return array( - new Twig_SimpleFunction('dump', 'twig_var_dump', array('is_safe' => $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)), - ); - } +class_exists('Twig\Extension\DebugExtension'); - public function getName() +if (\false) { + class Twig_Extension_Debug extends DebugExtension { - return 'debug'; - } -} - -function twig_var_dump(Twig_Environment $env, $context) -{ - if (!$env->isDebug()) { - return; } - - ob_start(); - - $count = func_num_args(); - if (2 === $count) { - $vars = array(); - foreach ($context as $key => $value) { - if (!$value instanceof Twig_Template) { - $vars[$key] = $value; - } - } - - var_dump($vars); - } else { - for ($i = 2; $i < $count; ++$i) { - var_dump(func_get_arg($i)); - } - } - - return ob_get_clean(); } - -class_alias('Twig_Extension_Debug', 'Twig\Extension\DebugExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/Escaper.php b/vendor/twig/twig/lib/Twig/Extension/Escaper.php index 46c2d84b6843c78b097f5b25219e5986f758d248..8d15df427974499990ac1f40e8ab041872ee06b4 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Escaper.php +++ b/vendor/twig/twig/lib/Twig/Extension/Escaper.php @@ -1,112 +1,11 @@ <?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\Extension\EscaperExtension; -/** - * @final - */ -class Twig_Extension_Escaper extends Twig_Extension -{ - protected $defaultStrategy; +class_exists('Twig\Extension\EscaperExtension'); - /** - * @param string|false|callable $defaultStrategy An escaping strategy - * - * @see setDefaultStrategy() - */ - public function __construct($defaultStrategy = 'html') +if (\false) { + class Twig_Extension_Escaper extends EscaperExtension { - $this->setDefaultStrategy($defaultStrategy); - } - - public function getTokenParsers() - { - return array(new Twig_TokenParser_AutoEscape()); - } - - public function getNodeVisitors() - { - return array(new Twig_NodeVisitor_Escaper()); - } - - public function getFilters() - { - return array( - new Twig_SimpleFilter('raw', 'twig_raw_filter', array('is_safe' => array('all'))), - ); - } - - /** - * Sets the default strategy to use when not defined by the user. - * - * The strategy can be a valid PHP callback that takes the template - * name as an argument and returns the strategy to use. - * - * @param string|false|callable $defaultStrategy An escaping strategy - */ - public function setDefaultStrategy($defaultStrategy) - { - // for BC - if (true === $defaultStrategy) { - @trigger_error('Using "true" as the default strategy is deprecated since version 1.21. Use "html" instead.', E_USER_DEPRECATED); - - $defaultStrategy = 'html'; - } - - if ('filename' === $defaultStrategy) { - @trigger_error('Using "filename" as the default strategy is deprecated since version 1.27. Use "name" instead.', E_USER_DEPRECATED); - - $defaultStrategy = 'name'; - } - - if ('name' === $defaultStrategy) { - $defaultStrategy = array('Twig_FileExtensionEscapingStrategy', 'guess'); - } - - $this->defaultStrategy = $defaultStrategy; - } - - /** - * Gets the default strategy to use when not defined by the user. - * - * @param string $name The template name - * - * @return string|false The default strategy to use for the template - */ - public function getDefaultStrategy($name) - { - // disable string callables to avoid calling a function named html or js, - // or any other upcoming escaping strategy - if (!is_string($this->defaultStrategy) && false !== $this->defaultStrategy) { - return call_user_func($this->defaultStrategy, $name); - } - - return $this->defaultStrategy; - } - - public function getName() - { - return 'escaper'; } } - -/** - * Marks a variable as being safe. - * - * @param string $string A PHP variable - * - * @return string - */ -function twig_raw_filter($string) -{ - return $string; -} - -class_alias('Twig_Extension_Escaper', 'Twig\Extension\EscaperExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php b/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php index 922cd2c9338215451bbf16fa205f3d0f9c172821..9bfcca4ede8e7e053caa29d38eb573c73c5e9249 100644 --- a/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php +++ b/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php @@ -1,24 +1,11 @@ <?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\Extension\GlobalsInterface; -/** - * Enables usage of the deprecated Twig_Extension::getGlobals() method. - * - * Explicitly implement this interface if you really need to implement the - * deprecated getGlobals() method in your extensions. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -interface Twig_Extension_GlobalsInterface -{ -} +class_exists('Twig\Extension\GlobalsInterface'); -class_alias('Twig_Extension_GlobalsInterface', 'Twig\Extension\GlobalsInterface', false); +if (\false) { + class Twig_Extension_GlobalsInterface extends GlobalsInterface + { + } +} diff --git a/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php b/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php index 1549862f4dd7ca92d29520a8a56812b91ad5a47c..6fbf1ba5bf8cd1119c5a1ac09792c8ee76fa3e7f 100644 --- a/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php +++ b/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php @@ -1,24 +1,11 @@ <?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\Extension\InitRuntimeInterface; -/** - * Enables usage of the deprecated Twig_Extension::initRuntime() method. - * - * Explicitly implement this interface if you really need to implement the - * deprecated initRuntime() method in your extensions. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -interface Twig_Extension_InitRuntimeInterface -{ -} +class_exists('Twig\Extension\InitRuntimeInterface'); -class_alias('Twig_Extension_InitRuntimeInterface', 'Twig\Extension\InitRuntimeInterface', false); +if (\false) { + class Twig_Extension_InitRuntimeInterface extends InitRuntimeInterface + { + } +} diff --git a/vendor/twig/twig/lib/Twig/Extension/Optimizer.php b/vendor/twig/twig/lib/Twig/Extension/Optimizer.php index 6c62e3efceaa3da2b1626e0eedf77200ba50576e..14802deb1bcfb79981c8718b44dbf5439516dd31 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Optimizer.php +++ b/vendor/twig/twig/lib/Twig/Extension/Optimizer.php @@ -1,35 +1,11 @@ <?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\Extension\OptimizerExtension; -/** - * @final - */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; +class_exists('Twig\Extension\OptimizerExtension'); - public function __construct($optimizers = -1) +if (\false) { + class Twig_Extension_Optimizer extends OptimizerExtension { - $this->optimizers = $optimizers; - } - - public function getNodeVisitors() - { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); - } - - public function getName() - { - return 'optimizer'; } } - -class_alias('Twig_Extension_Optimizer', 'Twig\Extension\OptimizerExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/Profiler.php b/vendor/twig/twig/lib/Twig/Extension/Profiler.php index fcfc002ba5c7a4114ff86efb6b68850fe23223a9..086b34f63d3a08826ceac5401f43446b7f833d43 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Profiler.php +++ b/vendor/twig/twig/lib/Twig/Extension/Profiler.php @@ -1,49 +1,11 @@ <?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\Extension\ProfilerExtension; -class Twig_Extension_Profiler extends Twig_Extension -{ - private $actives = array(); +class_exists('Twig\Extension\ProfilerExtension'); - public function __construct(Twig_Profiler_Profile $profile) +if (\false) { + class Twig_Extension_Profiler extends ProfilerExtension { - $this->actives[] = $profile; - } - - public function enter(Twig_Profiler_Profile $profile) - { - $this->actives[0]->addProfile($profile); - array_unshift($this->actives, $profile); - } - - public function leave(Twig_Profiler_Profile $profile) - { - $profile->leave(); - array_shift($this->actives); - - if (1 === count($this->actives)) { - $this->actives[0]->leave(); - } - } - - public function getNodeVisitors() - { - return array(new Twig_Profiler_NodeVisitor_Profiler(get_class($this))); - } - - public function getName() - { - return 'profiler'; } } - -class_alias('Twig_Extension_Profiler', 'Twig\Extension\ProfilerExtension', false); -class_exists('Twig_Profiler_Profile'); diff --git a/vendor/twig/twig/lib/Twig/Extension/Sandbox.php b/vendor/twig/twig/lib/Twig/Extension/Sandbox.php index 5cb80a717e7efeb86a36975bcd2430c9dd770939..2b8a1514f0bdc1f2988c73fa62404f8a4b6d4d7a 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Sandbox.php +++ b/vendor/twig/twig/lib/Twig/Extension/Sandbox.php @@ -1,103 +1,11 @@ <?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\Extension\SandboxExtension; -/** - * @final - */ -class Twig_Extension_Sandbox extends Twig_Extension -{ - protected $sandboxedGlobally; - protected $sandboxed; - protected $policy; +class_exists('Twig\Extension\SandboxExtension'); - public function __construct(Twig_Sandbox_SecurityPolicyInterface $policy, $sandboxed = false) +if (\false) { + class Twig_Extension_Sandbox extends SandboxExtension { - $this->policy = $policy; - $this->sandboxedGlobally = $sandboxed; - } - - public function getTokenParsers() - { - return array(new Twig_TokenParser_Sandbox()); - } - - public function getNodeVisitors() - { - return array(new Twig_NodeVisitor_Sandbox()); - } - - public function enableSandbox() - { - $this->sandboxed = true; - } - - public function disableSandbox() - { - $this->sandboxed = false; - } - - public function isSandboxed() - { - return $this->sandboxedGlobally || $this->sandboxed; - } - - public function isSandboxedGlobally() - { - return $this->sandboxedGlobally; - } - - public function setSecurityPolicy(Twig_Sandbox_SecurityPolicyInterface $policy) - { - $this->policy = $policy; - } - - public function getSecurityPolicy() - { - return $this->policy; - } - - public function checkSecurity($tags, $filters, $functions) - { - if ($this->isSandboxed()) { - $this->policy->checkSecurity($tags, $filters, $functions); - } - } - - public function checkMethodAllowed($obj, $method) - { - if ($this->isSandboxed()) { - $this->policy->checkMethodAllowed($obj, $method); - } - } - - public function checkPropertyAllowed($obj, $method) - { - if ($this->isSandboxed()) { - $this->policy->checkPropertyAllowed($obj, $method); - } - } - - public function ensureToStringAllowed($obj) - { - if ($this->isSandboxed() && is_object($obj)) { - $this->policy->checkMethodAllowed($obj, '__toString'); - } - - return $obj; - } - - public function getName() - { - return 'sandbox'; } } - -class_alias('Twig_Extension_Sandbox', 'Twig\Extension\SandboxExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/Staging.php b/vendor/twig/twig/lib/Twig/Extension/Staging.php index d3a0f9c946daf0800a1e6f892c5e4136d23f9804..7681b4985ae9bc6305dc50aebe2375ede471eb28 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Staging.php +++ b/vendor/twig/twig/lib/Twig/Extension/Staging.php @@ -1,112 +1,11 @@ <?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\Extension\StagingExtension; -/** - * Internal class. - * - * This class is used by Twig_Environment as a staging area and must not be used directly. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @internal - */ -class Twig_Extension_Staging extends Twig_Extension -{ - protected $functions = array(); - protected $filters = array(); - protected $visitors = array(); - protected $tokenParsers = array(); - protected $globals = array(); - protected $tests = array(); +class_exists('Twig\Extension\StagingExtension'); - public function addFunction($name, $function) +if (\false) { + class Twig_Extension_Staging extends StagingExtension { - if (isset($this->functions[$name])) { - @trigger_error(sprintf('Overriding function "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED); - } - - $this->functions[$name] = $function; - } - - public function getFunctions() - { - return $this->functions; - } - - public function addFilter($name, $filter) - { - if (isset($this->filters[$name])) { - @trigger_error(sprintf('Overriding filter "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED); - } - - $this->filters[$name] = $filter; - } - - public function getFilters() - { - return $this->filters; - } - - public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) - { - $this->visitors[] = $visitor; - } - - public function getNodeVisitors() - { - return $this->visitors; - } - - public function addTokenParser(Twig_TokenParserInterface $parser) - { - if (isset($this->tokenParsers[$parser->getTag()])) { - @trigger_error(sprintf('Overriding tag "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $parser->getTag()), E_USER_DEPRECATED); - } - - $this->tokenParsers[$parser->getTag()] = $parser; - } - - public function getTokenParsers() - { - return $this->tokenParsers; - } - - public function addGlobal($name, $value) - { - $this->globals[$name] = $value; - } - - public function getGlobals() - { - return $this->globals; - } - - public function addTest($name, $test) - { - if (isset($this->tests[$name])) { - @trigger_error(sprintf('Overriding test "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED); - } - - $this->tests[$name] = $test; - } - - public function getTests() - { - return $this->tests; - } - - public function getName() - { - return 'staging'; } } - -class_alias('Twig_Extension_Staging', 'Twig\Extension\StagingExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/StringLoader.php b/vendor/twig/twig/lib/Twig/Extension/StringLoader.php index 2ce3c9924935661d73253d58e631506a39726acb..5ce2407e067edec6d020978511b7498348fbb0ea 100644 --- a/vendor/twig/twig/lib/Twig/Extension/StringLoader.php +++ b/vendor/twig/twig/lib/Twig/Extension/StringLoader.php @@ -1,47 +1,11 @@ <?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\Extension\StringLoaderExtension; -/** - * @final - */ -class Twig_Extension_StringLoader extends Twig_Extension -{ - public function getFunctions() - { - return array( - new Twig_SimpleFunction('template_from_string', 'twig_template_from_string', array('needs_environment' => true)), - ); - } +class_exists('Twig\Extension\StringLoaderExtension'); - public function getName() +if (\false) { + class Twig_Extension_StringLoader extends StringLoaderExtension { - return 'string_loader'; } } - -/** - * Loads a template from a string. - * - * <pre> - * {{ include(template_from_string("Hello {{ name }}")) }} - * </pre> - * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $template A template as a string or object implementing __toString() - * - * @return Twig_Template - */ -function twig_template_from_string(Twig_Environment $env, $template) -{ - return $env->createTemplate((string) $template); -} - -class_alias('Twig_Extension_StringLoader', 'Twig\Extension\StringLoaderExtension', false); diff --git a/vendor/twig/twig/lib/Twig/ExtensionInterface.php b/vendor/twig/twig/lib/Twig/ExtensionInterface.php index 946df500a8c3307cd0b248fe4266fc349b74340c..3ef2ed58688fe75208cb81a71bf8061f9e9304c8 100644 --- a/vendor/twig/twig/lib/Twig/ExtensionInterface.php +++ b/vendor/twig/twig/lib/Twig/ExtensionInterface.php @@ -1,90 +1,11 @@ <?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\Extension\ExtensionInterface; -/** - * Interface implemented by extension classes. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -interface Twig_ExtensionInterface -{ - /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead - */ - public function initRuntime(Twig_Environment $environment); +class_exists('Twig\Extension\ExtensionInterface'); - /** - * Returns the token parser instances to add to the existing list. - * - * @return Twig_TokenParserInterface[] - */ - public function getTokenParsers(); - - /** - * Returns the node visitor instances to add to the existing list. - * - * @return Twig_NodeVisitorInterface[] - */ - public function getNodeVisitors(); - - /** - * Returns a list of filters to add to the existing list. - * - * @return Twig_SimpleFilter[] - */ - public function getFilters(); - - /** - * Returns a list of tests to add to the existing list. - * - * @return Twig_SimpleTest[] - */ - public function getTests(); - - /** - * Returns a list of functions to add to the existing list. - * - * @return Twig_SimpleFunction[] - */ - public function getFunctions(); - - /** - * Returns a list of operators to add to the existing list. - * - * @return array<array> First array of unary operators, second array of binary operators - */ - public function getOperators(); - - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - * - * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_GlobalsInterface instead - */ - public function getGlobals(); - - /** - * Returns the name of the extension. - * - * @return string The extension name - * - * @deprecated since 1.26 (to be removed in 2.0), not used anymore internally - */ - public function getName(); +if (\false) { + class Twig_ExtensionInterface extends ExtensionInterface + { + } } - -class_alias('Twig_ExtensionInterface', 'Twig\Extension\ExtensionInterface', false); -class_exists('Twig_Environment'); diff --git a/vendor/twig/twig/lib/Twig/FactoryRuntimeLoader.php b/vendor/twig/twig/lib/Twig/FactoryRuntimeLoader.php index 2cdaded1d24d18e7385850c16473684b32acf288..6834439db4e88d1483043ef2e65e3a83a54c608b 100644 --- a/vendor/twig/twig/lib/Twig/FactoryRuntimeLoader.php +++ b/vendor/twig/twig/lib/Twig/FactoryRuntimeLoader.php @@ -1,39 +1,11 @@ <?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\RuntimeLoader\FactoryRuntimeLoader; -/** - * Lazy loads the runtime implementations for a Twig element. - * - * @author Robin Chalas <robin.chalas@gmail.com> - */ -class Twig_FactoryRuntimeLoader implements Twig_RuntimeLoaderInterface -{ - private $map; +class_exists('Twig\RuntimeLoader\FactoryRuntimeLoader'); - /** - * @param array $map An array where keys are class names and values factory callables - */ - public function __construct($map = array()) +if (\false) { + class Twig_FactoryRuntimeLoader extends FactoryRuntimeLoader { - $this->map = $map; - } - - public function load($class) - { - if (isset($this->map[$class])) { - $runtimeFactory = $this->map[$class]; - - return $runtimeFactory(); - } } } - -class_alias('Twig_FactoryRuntimeLoader', 'Twig\RuntimeLoader\FactoryRuntimeLoader', false); diff --git a/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php b/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php index 8f8cd2ee5395f6f883f979be2c86a29438d7bd3c..99c2656ff7935925599f3e32c9f991dc5d2d048b 100644 --- a/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php +++ b/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php @@ -1,60 +1,11 @@ <?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\FileExtensionEscapingStrategy; -/** - * Default autoescaping strategy based on file names. - * - * This strategy sets the HTML as the default autoescaping strategy, - * but changes it based on the template name. - * - * Note that there is no runtime performance impact as the - * default autoescaping strategy is set at compilation time. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_FileExtensionEscapingStrategy -{ - /** - * Guesses the best autoescaping strategy based on the file name. - * - * @param string $name The template name - * - * @return string|false The escaping strategy name to use or false to disable - */ - public static function guess($name) - { - if (in_array(substr($name, -1), array('/', '\\'))) { - return 'html'; // return html for directories - } - - if ('.twig' === substr($name, -5)) { - $name = substr($name, 0, -5); - } - - $extension = pathinfo($name, PATHINFO_EXTENSION); - - switch ($extension) { - case 'js': - return 'js'; +class_exists('Twig\FileExtensionEscapingStrategy'); - case 'css': - return 'css'; - - case 'txt': - return false; - - default: - return 'html'; - } +if (\false) { + class Twig_FileExtensionEscapingStrategy extends FileExtensionEscapingStrategy + { } } - -class_alias('Twig_FileExtensionEscapingStrategy', 'Twig\FileExtensionEscapingStrategy', false); diff --git a/vendor/twig/twig/lib/Twig/Filter.php b/vendor/twig/twig/lib/Twig/Filter.php index 893d75d103fc6e7e3a1161d88c7dd32e2645645b..da4191e31f4c62a5baa73e3ddd84fd825fdfa321 100644 --- a/vendor/twig/twig/lib/Twig/Filter.php +++ b/vendor/twig/twig/lib/Twig/Filter.php @@ -9,12 +9,14 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Filter class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED); +use Twig\Node\Node; + +@trigger_error('The Twig_Filter class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFilter instead.', E_USER_DEPRECATED); /** * Represents a template filter. * - * Use Twig_SimpleFilter instead. + * Use \Twig\TwigFilter instead. * * @author Fabien Potencier <fabien@symfony.com> * @@ -23,17 +25,17 @@ abstract class Twig_Filter implements Twig_FilterInterface, Twig_FilterCallableInterface { protected $options; - protected $arguments = array(); + protected $arguments = []; - public function __construct(array $options = array()) + public function __construct(array $options = []) { - $this->options = array_merge(array( + $this->options = array_merge([ 'needs_environment' => false, 'needs_context' => false, 'pre_escape' => null, 'preserves_safety' => null, 'callable' => null, - ), $options); + ], $options); } public function setArguments($arguments) @@ -56,14 +58,14 @@ public function needsContext() return $this->options['needs_context']; } - public function getSafe(Twig_Node $filterArgs) + public function getSafe(Node $filterArgs) { if (isset($this->options['is_safe'])) { return $this->options['is_safe']; } if (isset($this->options['is_safe_callback'])) { - return call_user_func($this->options['is_safe_callback'], $filterArgs); + return \call_user_func($this->options['is_safe_callback'], $filterArgs); } } diff --git a/vendor/twig/twig/lib/Twig/Filter/Function.php b/vendor/twig/twig/lib/Twig/Filter/Function.php index 71b16554e04f7a97bc548898e800106c90d0a76e..011d4ccf4600b99c1d18c1cedc466d9f5f0f34e1 100644 --- a/vendor/twig/twig/lib/Twig/Filter/Function.php +++ b/vendor/twig/twig/lib/Twig/Filter/Function.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Filter_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED); +@trigger_error('The Twig_Filter_Function class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFilter instead.', E_USER_DEPRECATED); /** * Represents a function template filter. * - * Use Twig_SimpleFilter instead. + * Use \Twig\TwigFilter instead. * * @author Fabien Potencier <fabien@symfony.com> * @@ -24,7 +24,7 @@ class Twig_Filter_Function extends Twig_Filter { protected $function; - public function __construct($function, array $options = array()) + public function __construct($function, array $options = []) { $options['callable'] = $function; diff --git a/vendor/twig/twig/lib/Twig/Filter/Method.php b/vendor/twig/twig/lib/Twig/Filter/Method.php index 1b75676c59f61dcb8a2266b6a1e1d97e82ccfb7b..5cd06282248ee53ee0706dce2b4b1d9496974241 100644 --- a/vendor/twig/twig/lib/Twig/Filter/Method.php +++ b/vendor/twig/twig/lib/Twig/Filter/Method.php @@ -9,12 +9,14 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Filter_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED); +use Twig\Extension\ExtensionInterface; + +@trigger_error('The Twig_Filter_Method class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFilter instead.', E_USER_DEPRECATED); /** * Represents a method template filter. * - * Use Twig_SimpleFilter instead. + * Use \Twig\TwigFilter instead. * * @author Fabien Potencier <fabien@symfony.com> * @@ -25,9 +27,9 @@ class Twig_Filter_Method extends Twig_Filter protected $extension; protected $method; - public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) + public function __construct(ExtensionInterface $extension, $method, array $options = []) { - $options['callable'] = array($extension, $method); + $options['callable'] = [$extension, $method]; parent::__construct($options); @@ -37,6 +39,6 @@ public function __construct(Twig_ExtensionInterface $extension, $method, array $ public function compile() { - return sprintf('$this->env->getExtension(\'%s\')->%s', get_class($this->extension), $this->method); + return sprintf('$this->env->getExtension(\'%s\')->%s', \get_class($this->extension), $this->method); } } diff --git a/vendor/twig/twig/lib/Twig/Filter/Node.php b/vendor/twig/twig/lib/Twig/Filter/Node.php index 3e6b12eff2ae03e849ae1ac1babfef2a6e338634..8bb2899c52e965b8e59025fa20af928499256689 100644 --- a/vendor/twig/twig/lib/Twig/Filter/Node.php +++ b/vendor/twig/twig/lib/Twig/Filter/Node.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Filter_Node class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED); +@trigger_error('The Twig_Filter_Node class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFilter instead.', E_USER_DEPRECATED); /** * Represents a template filter as a node. * - * Use Twig_SimpleFilter instead. + * Use \Twig\TwigFilter instead. * * @author Fabien Potencier <fabien@symfony.com> * @@ -24,7 +24,7 @@ class Twig_Filter_Node extends Twig_Filter { protected $class; - public function __construct($class, array $options = array()) + public function __construct($class, array $options = []) { parent::__construct($options); diff --git a/vendor/twig/twig/lib/Twig/FilterCallableInterface.php b/vendor/twig/twig/lib/Twig/FilterCallableInterface.php index 21b028c4eaa337ae749e535ba22f32c623cad06f..091ca97454e5f78e37963832679931c947d543b2 100644 --- a/vendor/twig/twig/lib/Twig/FilterCallableInterface.php +++ b/vendor/twig/twig/lib/Twig/FilterCallableInterface.php @@ -12,7 +12,7 @@ /** * Represents a callable template filter. * - * Use Twig_SimpleFilter instead. + * Use \Twig\TwigFilter instead. * * @author Fabien Potencier <fabien@symfony.com> * diff --git a/vendor/twig/twig/lib/Twig/FilterInterface.php b/vendor/twig/twig/lib/Twig/FilterInterface.php index 9d7e9ab6ac19fd7c44e7ddb61a8e3b6a0572a5bf..9b85f9760d6184bb2145d9c88f53f7445068189f 100644 --- a/vendor/twig/twig/lib/Twig/FilterInterface.php +++ b/vendor/twig/twig/lib/Twig/FilterInterface.php @@ -9,10 +9,12 @@ * file that was distributed with this source code. */ +use Twig\Node\Node; + /** * Represents a template filter. * - * Use Twig_SimpleFilter instead. + * Use \Twig\TwigFilter instead. * * @author Fabien Potencier <fabien@symfony.com> * @@ -31,7 +33,7 @@ public function needsEnvironment(); public function needsContext(); - public function getSafe(Twig_Node $filterArgs); + public function getSafe(Node $filterArgs); public function getPreservesSafety(); diff --git a/vendor/twig/twig/lib/Twig/Function.php b/vendor/twig/twig/lib/Twig/Function.php index 9dc16e90820c1a2fa3a31c383bc94c693f9e5a7e..6646e746f5be67ca7ea5f49c6e0998c35146333b 100644 --- a/vendor/twig/twig/lib/Twig/Function.php +++ b/vendor/twig/twig/lib/Twig/Function.php @@ -9,12 +9,14 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.', E_USER_DEPRECATED); +use Twig\Node\Node; + +@trigger_error('The Twig_Function class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFunction instead.', E_USER_DEPRECATED); /** * Represents a template function. * - * Use Twig_SimpleFunction instead. + * Use \Twig\TwigFunction instead. * * @author Fabien Potencier <fabien@symfony.com> * @@ -23,15 +25,15 @@ abstract class Twig_Function implements Twig_FunctionInterface, Twig_FunctionCallableInterface { protected $options; - protected $arguments = array(); + protected $arguments = []; - public function __construct(array $options = array()) + public function __construct(array $options = []) { - $this->options = array_merge(array( + $this->options = array_merge([ 'needs_environment' => false, 'needs_context' => false, 'callable' => null, - ), $options); + ], $options); } public function setArguments($arguments) @@ -54,17 +56,17 @@ public function needsContext() return $this->options['needs_context']; } - public function getSafe(Twig_Node $functionArgs) + public function getSafe(Node $functionArgs) { if (isset($this->options['is_safe'])) { return $this->options['is_safe']; } if (isset($this->options['is_safe_callback'])) { - return call_user_func($this->options['is_safe_callback'], $functionArgs); + return \call_user_func($this->options['is_safe_callback'], $functionArgs); } - return array(); + return []; } public function getCallable() diff --git a/vendor/twig/twig/lib/Twig/Function/Function.php b/vendor/twig/twig/lib/Twig/Function/Function.php index 97c0eb77f74a524cde278e12825c03b2588324a9..605d8d335ede7d08a928fe13fb52cd5a1c0794ea 100644 --- a/vendor/twig/twig/lib/Twig/Function/Function.php +++ b/vendor/twig/twig/lib/Twig/Function/Function.php @@ -10,12 +10,12 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Function_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.', E_USER_DEPRECATED); +@trigger_error('The Twig_Function_Function class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFunction instead.', E_USER_DEPRECATED); /** * Represents a function template function. * - * Use Twig_SimpleFunction instead. + * Use \Twig\TwigFunction instead. * * @author Arnaud Le Blanc <arnaud.lb@gmail.com> * @@ -25,7 +25,7 @@ class Twig_Function_Function extends Twig_Function { protected $function; - public function __construct($function, array $options = array()) + public function __construct($function, array $options = []) { $options['callable'] = $function; diff --git a/vendor/twig/twig/lib/Twig/Function/Method.php b/vendor/twig/twig/lib/Twig/Function/Method.php index 4299e11815e28b2060ad3feae9ea953049a3920f..9e472c5d1058f811bc9eac75cf992f0a5fd3bfd0 100644 --- a/vendor/twig/twig/lib/Twig/Function/Method.php +++ b/vendor/twig/twig/lib/Twig/Function/Method.php @@ -10,12 +10,14 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Function_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.', E_USER_DEPRECATED); +use Twig\Extension\ExtensionInterface; + +@trigger_error('The Twig_Function_Method class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFunction instead.', E_USER_DEPRECATED); /** * Represents a method template function. * - * Use Twig_SimpleFunction instead. + * Use \Twig\TwigFunction instead. * * @author Arnaud Le Blanc <arnaud.lb@gmail.com> * @@ -26,9 +28,9 @@ class Twig_Function_Method extends Twig_Function protected $extension; protected $method; - public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) + public function __construct(ExtensionInterface $extension, $method, array $options = []) { - $options['callable'] = array($extension, $method); + $options['callable'] = [$extension, $method]; parent::__construct($options); @@ -38,6 +40,6 @@ public function __construct(Twig_ExtensionInterface $extension, $method, array $ public function compile() { - return sprintf('$this->env->getExtension(\'%s\')->%s', get_class($this->extension), $this->method); + return sprintf('$this->env->getExtension(\'%s\')->%s', \get_class($this->extension), $this->method); } } diff --git a/vendor/twig/twig/lib/Twig/Function/Node.php b/vendor/twig/twig/lib/Twig/Function/Node.php index 0adc5d93755c8892a213b3b44cd45fd0db0e6391..8148ec32d7b571f052a0f3d1047bcf60981a31f8 100644 --- a/vendor/twig/twig/lib/Twig/Function/Node.php +++ b/vendor/twig/twig/lib/Twig/Function/Node.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Function_Node class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.', E_USER_DEPRECATED); +@trigger_error('The Twig_Function_Node class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFunction instead.', E_USER_DEPRECATED); /** * Represents a template function as a node. * - * Use Twig_SimpleFunction instead. + * Use \Twig\TwigFunction instead. * * @author Fabien Potencier <fabien@symfony.com> * @@ -24,7 +24,7 @@ class Twig_Function_Node extends Twig_Function { protected $class; - public function __construct($class, array $options = array()) + public function __construct($class, array $options = []) { parent::__construct($options); diff --git a/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php b/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php index d23d69173dab693e75c8a5941d909a056d34f172..abc83ea4ae9322a057f1275716de0a8534737fd7 100644 --- a/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php +++ b/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php @@ -12,7 +12,7 @@ /** * Represents a callable template function. * - * Use Twig_SimpleFunction instead. + * Use \Twig\TwigFunction instead. * * @author Fabien Potencier <fabien@symfony.com> * diff --git a/vendor/twig/twig/lib/Twig/FunctionInterface.php b/vendor/twig/twig/lib/Twig/FunctionInterface.php index 00d4f95c7ce1f53651e38baa3b334a77579ca275..915d6cc3a43d95c1498e34b1dbd3bb9e1a2d332b 100644 --- a/vendor/twig/twig/lib/Twig/FunctionInterface.php +++ b/vendor/twig/twig/lib/Twig/FunctionInterface.php @@ -10,10 +10,12 @@ * file that was distributed with this source code. */ +use Twig\Node\Node; + /** * Represents a template function. * - * Use Twig_SimpleFunction instead. + * Use \Twig\TwigFunction instead. * * @author Arnaud Le Blanc <arnaud.lb@gmail.com> * @@ -32,7 +34,7 @@ public function needsEnvironment(); public function needsContext(); - public function getSafe(Twig_Node $filterArgs); + public function getSafe(Node $filterArgs); public function setArguments($arguments); diff --git a/vendor/twig/twig/lib/Twig/Lexer.php b/vendor/twig/twig/lib/Twig/Lexer.php index 41211eb28b6c8ac006d4119efef78703e913d8f2..00d74cc47aabcd9430d4fa423a4805dbc302b9fb 100644 --- a/vendor/twig/twig/lib/Twig/Lexer.php +++ b/vendor/twig/twig/lib/Twig/Lexer.php @@ -1,427 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Lexer; -/** - * Lexes a template string. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Lexer implements Twig_LexerInterface -{ - protected $tokens; - protected $code; - protected $cursor; - protected $lineno; - protected $end; - protected $state; - protected $states; - protected $brackets; - protected $env; - // to be renamed to $name in 2.0 (where it is private) - protected $filename; - protected $options; - protected $regexes; - protected $position; - protected $positions; - protected $currentVarBlockLine; +class_exists('Twig\Lexer'); - private $source; - - const STATE_DATA = 0; - const STATE_BLOCK = 1; - const STATE_VAR = 2; - const STATE_STRING = 3; - const STATE_INTERPOLATION = 4; - - const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'; - const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?/A'; - const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As'; - const REGEX_DQ_STRING_DELIM = '/"/A'; - const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As'; - const PUNCTUATION = '()[]{}?:.,|'; - - public function __construct(Twig_Environment $env, array $options = array()) - { - $this->env = $env; - - $this->options = array_merge(array( - 'tag_comment' => array('{#', '#}'), - 'tag_block' => array('{%', '%}'), - 'tag_variable' => array('{{', '}}'), - 'whitespace_trim' => '-', - 'interpolation' => array('#{', '}'), - ), $options); - - $this->regexes = array( - 'lex_var' => '/\s*'.preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_variable'][1], '/').'/A', - 'lex_block' => '/\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')\n?/A', - 'lex_raw_data' => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s*(?:end%s)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s', - 'operator' => $this->getOperatorRegex(), - 'lex_comment' => '/(?:'.preg_quote($this->options['whitespace_trim'], '/').preg_quote($this->options['tag_comment'][1], '/').'\s*|'.preg_quote($this->options['tag_comment'][1], '/').')\n?/s', - 'lex_block_raw' => '/\s*(raw|verbatim)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\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', - 'lex_tokens_start' => '/('.preg_quote($this->options['tag_variable'][0], '/').'|'.preg_quote($this->options['tag_block'][0], '/').'|'.preg_quote($this->options['tag_comment'][0], '/').')('.preg_quote($this->options['whitespace_trim'], '/').')?/s', - 'interpolation_start' => '/'.preg_quote($this->options['interpolation'][0], '/').'\s*/A', - 'interpolation_end' => '/\s*'.preg_quote($this->options['interpolation'][1], '/').'/A', - ); - } - - public function tokenize($code, $name = null) - { - if (!$code instanceof Twig_Source) { - @trigger_error(sprintf('Passing a string as the $code argument of %s() is deprecated since version 1.27 and will be removed in 2.0. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED); - $this->source = new Twig_Source($code, $name); - } else { - $this->source = $code; - } - - if (((int) ini_get('mbstring.func_overload')) & 2) { - @trigger_error('Support for having "mbstring.func_overload" different from 0 is deprecated version 1.29 and will be removed in 2.0.', E_USER_DEPRECATED); - } - - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } else { - $mbEncoding = null; - } - - $this->code = str_replace(array("\r\n", "\r"), "\n", $this->source->getCode()); - $this->filename = $this->source->getName(); - $this->cursor = 0; - $this->lineno = 1; - $this->end = strlen($this->code); - $this->tokens = array(); - $this->state = self::STATE_DATA; - $this->states = array(); - $this->brackets = array(); - $this->position = -1; - - // find all token starts in one go - preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, PREG_OFFSET_CAPTURE); - $this->positions = $matches; - - while ($this->cursor < $this->end) { - // dispatch to the lexing functions depending - // on the current state - switch ($this->state) { - case self::STATE_DATA: - $this->lexData(); - break; - - case self::STATE_BLOCK: - $this->lexBlock(); - break; - - case self::STATE_VAR: - $this->lexVar(); - break; - - case self::STATE_STRING: - $this->lexString(); - break; - - case self::STATE_INTERPOLATION: - $this->lexInterpolation(); - break; - } - } - - $this->pushToken(Twig_Token::EOF_TYPE); - - if (!empty($this->brackets)) { - list($expect, $lineno) = array_pop($this->brackets); - throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - - if ($mbEncoding) { - mb_internal_encoding($mbEncoding); - } - - return new Twig_TokenStream($this->tokens, $this->source); - } - - protected function lexData() - { - // if no matches are left we return the rest of the template as simple text token - if ($this->position == count($this->positions[0]) - 1) { - $this->pushToken(Twig_Token::TEXT_TYPE, substr($this->code, $this->cursor)); - $this->cursor = $this->end; - - return; - } - - // Find the first token after the current cursor - $position = $this->positions[0][++$this->position]; - while ($position[1] < $this->cursor) { - if ($this->position == count($this->positions[0]) - 1) { - return; - } - $position = $this->positions[0][++$this->position]; - } - - // push the template text first - $text = $textContent = substr($this->code, $this->cursor, $position[1] - $this->cursor); - if (isset($this->positions[2][$this->position][0])) { - $text = rtrim($text); - } - $this->pushToken(Twig_Token::TEXT_TYPE, $text); - $this->moveCursor($textContent.$position[0]); - - switch ($this->positions[1][$this->position][0]) { - case $this->options['tag_comment'][0]: - $this->lexComment(); - break; - - case $this->options['tag_block'][0]: - // raw data? - if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, null, $this->cursor)) { - $this->moveCursor($match[0]); - $this->lexRawData($match[1]); - // {% line \d+ %} - } elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, null, $this->cursor)) { - $this->moveCursor($match[0]); - $this->lineno = (int) $match[1]; - } else { - $this->pushToken(Twig_Token::BLOCK_START_TYPE); - $this->pushState(self::STATE_BLOCK); - $this->currentVarBlockLine = $this->lineno; - } - break; - - case $this->options['tag_variable'][0]: - $this->pushToken(Twig_Token::VAR_START_TYPE); - $this->pushState(self::STATE_VAR); - $this->currentVarBlockLine = $this->lineno; - break; - } - } - - protected function lexBlock() - { - if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::BLOCK_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - protected function lexVar() - { - if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::VAR_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - protected function lexExpression() - { - // whitespace - if (preg_match('/\s+/A', $this->code, $match, null, $this->cursor)) { - $this->moveCursor($match[0]); - - if ($this->cursor >= $this->end) { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', self::STATE_BLOCK === $this->state ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source); - } - } - - // operators - if (preg_match($this->regexes['operator'], $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::OPERATOR_TYPE, preg_replace('/\s+/', ' ', $match[0])); - $this->moveCursor($match[0]); - } - // names - elseif (preg_match(self::REGEX_NAME, $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::NAME_TYPE, $match[0]); - $this->moveCursor($match[0]); - } - // numbers - elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, null, $this->cursor)) { - $number = (float) $match[0]; // floats - if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { - $number = (int) $match[0]; // integers lower than the maximum - } - $this->pushToken(Twig_Token::NUMBER_TYPE, $number); - $this->moveCursor($match[0]); - } - // punctuation - elseif (false !== strpos(self::PUNCTUATION, $this->code[$this->cursor])) { - // opening bracket - if (false !== strpos('([{', $this->code[$this->cursor])) { - $this->brackets[] = array($this->code[$this->cursor], $this->lineno); - } - // closing bracket - elseif (false !== strpos(')]}', $this->code[$this->cursor])) { - if (empty($this->brackets)) { - throw new Twig_Error_Syntax(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - - list($expect, $lineno) = array_pop($this->brackets); - if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - } - - $this->pushToken(Twig_Token::PUNCTUATION_TYPE, $this->code[$this->cursor]); - ++$this->cursor; - } - // strings - elseif (preg_match(self::REGEX_STRING, $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1))); - $this->moveCursor($match[0]); - } - // opening double quoted string - elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { - $this->brackets[] = array('"', $this->lineno); - $this->pushState(self::STATE_STRING); - $this->moveCursor($match[0]); - } - // unlexable - else { - throw new Twig_Error_Syntax(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - } - - protected function lexRawData($tag) - { - if ('raw' === $tag) { - @trigger_error(sprintf('Twig Tag "raw" is deprecated since version 1.21. Use "verbatim" instead in %s at line %d.', $this->filename, $this->lineno), E_USER_DEPRECATED); - } - - if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s" block.', $tag), $this->lineno, $this->source); - } - - $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); - $this->moveCursor($text.$match[0][0]); - - if (false !== strpos($match[1][0], $this->options['whitespace_trim'])) { - $text = rtrim($text); - } - - $this->pushToken(Twig_Token::TEXT_TYPE, $text); - } - - protected function lexComment() - { - if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new Twig_Error_Syntax('Unclosed comment.', $this->lineno, $this->source); - } - - $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]); - } - - protected function lexString() - { - if (preg_match($this->regexes['interpolation_start'], $this->code, $match, null, $this->cursor)) { - $this->brackets[] = array($this->options['interpolation'][0], $this->lineno); - $this->pushToken(Twig_Token::INTERPOLATION_START_TYPE); - $this->moveCursor($match[0]); - $this->pushState(self::STATE_INTERPOLATION); - } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, null, $this->cursor) && strlen($match[0]) > 0) { - $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[0])); - $this->moveCursor($match[0]); - } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { - list($expect, $lineno) = array_pop($this->brackets); - if ('"' != $this->code[$this->cursor]) { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - - $this->popState(); - ++$this->cursor; - } else { - // unlexable - throw new Twig_Error_Syntax(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - } - - protected function lexInterpolation() - { - $bracket = end($this->brackets); - if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, null, $this->cursor)) { - array_pop($this->brackets); - $this->pushToken(Twig_Token::INTERPOLATION_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - protected function pushToken($type, $value = '') - { - // do not push empty text tokens - if (Twig_Token::TEXT_TYPE === $type && '' === $value) { - return; - } - - $this->tokens[] = new Twig_Token($type, $value, $this->lineno); - } - - protected function moveCursor($text) +if (\false) { + class Twig_Lexer extends Lexer { - $this->cursor += strlen($text); - $this->lineno += substr_count($text, "\n"); - } - - protected function getOperatorRegex() - { - $operators = array_merge( - array('='), - array_keys($this->env->getUnaryOperators()), - array_keys($this->env->getBinaryOperators()) - ); - - $operators = array_combine($operators, array_map('strlen', $operators)); - arsort($operators); - - $regex = array(); - foreach ($operators as $operator => $length) { - // an operator that ends with a character must be followed by - // a whitespace or a parenthesis - if (ctype_alpha($operator[$length - 1])) { - $r = preg_quote($operator, '/').'(?=[\s()])'; - } else { - $r = preg_quote($operator, '/'); - } - - // an operator with a space can be any amount of whitespaces - $r = preg_replace('/\s+/', '\s+', $r); - - $regex[] = $r; - } - - return '/'.implode('|', $regex).'/A'; - } - - protected function pushState($state) - { - $this->states[] = $this->state; - $this->state = $state; - } - - protected function popState() - { - if (0 === count($this->states)) { - throw new Exception('Cannot pop state without a previous state.'); - } - - $this->state = array_pop($this->states); } } - -class_alias('Twig_Lexer', 'Twig\Lexer', false); diff --git a/vendor/twig/twig/lib/Twig/LexerInterface.php b/vendor/twig/twig/lib/Twig/LexerInterface.php index c10bbfec4a02e0d70610fd51265938e020dddb30..cc04f68413e208d867ab3d64d1c5043e12d21260 100644 --- a/vendor/twig/twig/lib/Twig/LexerInterface.php +++ b/vendor/twig/twig/lib/Twig/LexerInterface.php @@ -9,6 +9,10 @@ * file that was distributed with this source code. */ +use Twig\Error\SyntaxError; +use Twig\Source; +use Twig\TokenStream; + /** * Interface implemented by lexer classes. * @@ -21,12 +25,12 @@ interface Twig_LexerInterface /** * Tokenizes a source code. * - * @param string|Twig_Source $code The source code - * @param string $name A unique identifier for the source code + * @param string|Source $code The source code + * @param string $name A unique identifier for the source code * - * @return Twig_TokenStream + * @return TokenStream * - * @throws Twig_Error_Syntax When the code is syntactically wrong + * @throws SyntaxError When the code is syntactically wrong */ public function tokenize($code, $name = null); } diff --git a/vendor/twig/twig/lib/Twig/Loader/Array.php b/vendor/twig/twig/lib/Twig/Loader/Array.php index 0aac76900fc5bcc40094dee6b1515d642637fafa..13f915c95f4f4ca733ef172a5cc16ba3d558a04e 100644 --- a/vendor/twig/twig/lib/Twig/Loader/Array.php +++ b/vendor/twig/twig/lib/Twig/Loader/Array.php @@ -1,97 +1,11 @@ <?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\Loader\ArrayLoader; -/** - * Loads a template from an array. - * - * When using this loader 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. - * - * This loader should only be used for unit testing. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface -{ - protected $templates = array(); +class_exists('Twig\Loader\ArrayLoader'); - /** - * @param array $templates An array of templates (keys are the names, and values are the source code) - */ - public function __construct(array $templates = array()) +if (\false) { + class Twig_Loader_Array extends ArrayLoader { - $this->templates = $templates; - } - - /** - * Adds or overrides a template. - * - * @param string $name The template name - * @param string $template The template source - */ - public function setTemplate($name, $template) - { - $this->templates[(string) $name] = $template; - } - - 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); - - $name = (string) $name; - if (!isset($this->templates[$name])) { - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); - } - - return $this->templates[$name]; - } - - public function getSourceContext($name) - { - $name = (string) $name; - if (!isset($this->templates[$name])) { - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); - } - - return new Twig_Source($this->templates[$name], $name); - } - - public function exists($name) - { - return isset($this->templates[(string) $name]); - } - - public function getCacheKey($name) - { - $name = (string) $name; - if (!isset($this->templates[$name])) { - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); - } - - return $name.':'.$this->templates[$name]; - } - - public function isFresh($name, $time) - { - $name = (string) $name; - if (!isset($this->templates[$name])) { - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); - } - - return true; } } - -class_alias('Twig_Loader_Array', 'Twig\Loader\ArrayLoader', false); diff --git a/vendor/twig/twig/lib/Twig/Loader/Chain.php b/vendor/twig/twig/lib/Twig/Loader/Chain.php index 59a337969e5995a2ac75e65b4f4d33722bc80e63..885b37a7fe82d5b9cc950593539b24f8eb670261 100644 --- a/vendor/twig/twig/lib/Twig/Loader/Chain.php +++ b/vendor/twig/twig/lib/Twig/Loader/Chain.php @@ -1,151 +1,11 @@ <?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\Loader\ChainLoader; -/** - * Loads templates from other loaders. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface -{ - private $hasSourceCache = array(); - protected $loaders = array(); +class_exists('Twig\Loader\ChainLoader'); - /** - * @param Twig_LoaderInterface[] $loaders - */ - public function __construct(array $loaders = array()) +if (\false) { + class Twig_Loader_Chain extends ChainLoader { - foreach ($loaders as $loader) { - $this->addLoader($loader); - } - } - - public function addLoader(Twig_LoaderInterface $loader) - { - $this->loaders[] = $loader; - $this->hasSourceCache = array(); - } - - 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); - - $exceptions = array(); - foreach ($this->loaders as $loader) { - if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) { - continue; - } - - try { - return $loader->getSource($name); - } catch (Twig_Error_Loader $e) { - $exceptions[] = $e->getMessage(); - } - } - - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); - } - - public function getSourceContext($name) - { - $exceptions = array(); - foreach ($this->loaders as $loader) { - if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) { - continue; - } - - try { - if ($loader instanceof Twig_SourceContextLoaderInterface) { - return $loader->getSourceContext($name); - } - - return new Twig_Source($loader->getSource($name), $name); - } catch (Twig_Error_Loader $e) { - $exceptions[] = $e->getMessage(); - } - } - - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); - } - - public function exists($name) - { - $name = (string) $name; - - if (isset($this->hasSourceCache[$name])) { - return $this->hasSourceCache[$name]; - } - - foreach ($this->loaders as $loader) { - if ($loader instanceof Twig_ExistsLoaderInterface) { - if ($loader->exists($name)) { - return $this->hasSourceCache[$name] = true; - } - - continue; - } - - try { - if ($loader instanceof Twig_SourceContextLoaderInterface) { - $loader->getSourceContext($name); - } else { - $loader->getSource($name); - } - - return $this->hasSourceCache[$name] = true; - } catch (Twig_Error_Loader $e) { - } - } - - return $this->hasSourceCache[$name] = false; - } - - public function getCacheKey($name) - { - $exceptions = array(); - foreach ($this->loaders as $loader) { - if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) { - continue; - } - - try { - return $loader->getCacheKey($name); - } catch (Twig_Error_Loader $e) { - $exceptions[] = get_class($loader).': '.$e->getMessage(); - } - } - - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); - } - - public function isFresh($name, $time) - { - $exceptions = array(); - foreach ($this->loaders as $loader) { - if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) { - continue; - } - - try { - return $loader->isFresh($name, $time); - } catch (Twig_Error_Loader $e) { - $exceptions[] = get_class($loader).': '.$e->getMessage(); - } - } - - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); } } - -class_alias('Twig_Loader_Chain', 'Twig\Loader\ChainLoader', false); diff --git a/vendor/twig/twig/lib/Twig/Loader/Filesystem.php b/vendor/twig/twig/lib/Twig/Loader/Filesystem.php index 9149bc3ea46ff2651527f890537e972b70444c18..c3eae7d840cbed5627d6e68bf238c1646d3a841b 100644 --- a/vendor/twig/twig/lib/Twig/Loader/Filesystem.php +++ b/vendor/twig/twig/lib/Twig/Loader/Filesystem.php @@ -1,290 +1,11 @@ <?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\Loader\FilesystemLoader; -/** - * Loads template from the filesystem. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface -{ - /** Identifier of the main namespace. */ - const MAIN_NAMESPACE = '__main__'; +class_exists('Twig\Loader\FilesystemLoader'); - protected $paths = array(); - protected $cache = array(); - protected $errorCache = array(); - - private $rootPath; - - /** - * @param string|array $paths A path or an array of paths where to look for templates - * @param string|null $rootPath The root path common to all relative paths (null for getcwd()) - */ - public function __construct($paths = array(), $rootPath = null) - { - $this->rootPath = (null === $rootPath ? getcwd() : $rootPath).DIRECTORY_SEPARATOR; - if (false !== $realPath = realpath($rootPath)) { - $this->rootPath = $realPath.DIRECTORY_SEPARATOR; - } - - if ($paths) { - $this->setPaths($paths); - } - } - - /** - * Returns the paths to the templates. - * - * @param string $namespace A path namespace - * - * @return array The array of paths where to look for templates - */ - public function getPaths($namespace = self::MAIN_NAMESPACE) - { - return isset($this->paths[$namespace]) ? $this->paths[$namespace] : array(); - } - - /** - * Returns the path namespaces. - * - * The main namespace is always defined. - * - * @return array The array of defined namespaces - */ - public function getNamespaces() - { - return array_keys($this->paths); - } - - /** - * Sets the paths where templates are stored. - * - * @param string|array $paths A path or an array of paths where to look for templates - * @param string $namespace A path namespace - */ - public function setPaths($paths, $namespace = self::MAIN_NAMESPACE) - { - if (!is_array($paths)) { - $paths = array($paths); - } - - $this->paths[$namespace] = array(); - foreach ($paths as $path) { - $this->addPath($path, $namespace); - } - } - - /** - * Adds a path where templates are stored. - * - * @param string $path A path where to look for templates - * @param string $namespace A path namespace - * - * @throws Twig_Error_Loader - */ - public function addPath($path, $namespace = self::MAIN_NAMESPACE) - { - // invalidate the cache - $this->cache = $this->errorCache = array(); - - $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; - if (!is_dir($checkPath)) { - throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); - } - - $this->paths[$namespace][] = rtrim($path, '/\\'); - } - - /** - * Prepends a path where templates are stored. - * - * @param string $path A path where to look for templates - * @param string $namespace A path namespace - * - * @throws Twig_Error_Loader - */ - public function prependPath($path, $namespace = self::MAIN_NAMESPACE) - { - // invalidate the cache - $this->cache = $this->errorCache = array(); - - $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; - if (!is_dir($checkPath)) { - throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); - } - - $path = rtrim($path, '/\\'); - - if (!isset($this->paths[$namespace])) { - $this->paths[$namespace][] = $path; - } else { - array_unshift($this->paths[$namespace], $path); - } - } - - 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)); - } - - public function getSourceContext($name) - { - $path = $this->findTemplate($name); - - return new Twig_Source(file_get_contents($path), $name, $path); - } - - public function getCacheKey($name) - { - $path = $this->findTemplate($name); - $len = strlen($this->rootPath); - if (0 === strncmp($this->rootPath, $path, $len)) { - return substr($path, $len); - } - - return $path; - } - - public function exists($name) - { - $name = $this->normalizeName($name); - - if (isset($this->cache[$name])) { - return true; - } - - try { - return false !== $this->findTemplate($name, false); - } catch (Twig_Error_Loader $exception) { - @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); - - return false; - } - } - - public function isFresh($name, $time) - { - return filemtime($this->findTemplate($name)) <= $time; - } - - protected function findTemplate($name) - { - $throw = func_num_args() > 1 ? func_get_arg(1) : true; - $name = $this->normalizeName($name); - - if (isset($this->cache[$name])) { - return $this->cache[$name]; - } - - if (isset($this->errorCache[$name])) { - if (!$throw) { - return false; - } - - throw new Twig_Error_Loader($this->errorCache[$name]); - } - - $this->validateName($name); - - list($namespace, $shortname) = $this->parseName($name); - - if (!isset($this->paths[$namespace])) { - $this->errorCache[$name] = sprintf('There are no registered paths for namespace "%s".', $namespace); - - if (!$throw) { - return false; - } - - throw new Twig_Error_Loader($this->errorCache[$name]); - } - - foreach ($this->paths[$namespace] as $path) { - if (!$this->isAbsolutePath($path)) { - $path = $this->rootPath.'/'.$path; - } - - if (is_file($path.'/'.$shortname)) { - if (false !== $realpath = realpath($path.'/'.$shortname)) { - return $this->cache[$name] = $realpath; - } - - return $this->cache[$name] = $path.'/'.$shortname; - } - } - - $this->errorCache[$name] = sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace])); - - if (!$throw) { - return false; - } - - throw new Twig_Error_Loader($this->errorCache[$name]); - } - - protected function parseName($name, $default = self::MAIN_NAMESPACE) - { - if (isset($name[0]) && '@' == $name[0]) { - if (false === $pos = strpos($name, '/')) { - throw new Twig_Error_Loader(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); - } - - $namespace = substr($name, 1, $pos - 1); - $shortname = substr($name, $pos + 1); - - return array($namespace, $shortname); - } - - return array($default, $name); - } - - protected function normalizeName($name) - { - return preg_replace('#/{2,}#', '/', str_replace('\\', '/', (string) $name)); - } - - protected function validateName($name) - { - if (false !== strpos($name, "\0")) { - throw new Twig_Error_Loader('A template name cannot contain NUL bytes.'); - } - - $name = ltrim($name, '/'); - $parts = explode('/', $name); - $level = 0; - foreach ($parts as $part) { - if ('..' === $part) { - --$level; - } elseif ('.' !== $part) { - ++$level; - } - - if ($level < 0) { - throw new Twig_Error_Loader(sprintf('Looks like you try to load a template outside configured directories (%s).', $name)); - } - } - } - - private function isAbsolutePath($file) +if (\false) { + class Twig_Loader_Filesystem extends FilesystemLoader { - return strspn($file, '/\\', 0, 1) - || (strlen($file) > 3 && ctype_alpha($file[0]) - && ':' === substr($file, 1, 1) - && strspn($file, '/\\', 2, 1) - ) - || null !== parse_url($file, PHP_URL_SCHEME) - ; } } - -class_alias('Twig_Loader_Filesystem', 'Twig\Loader\FilesystemLoader', false); diff --git a/vendor/twig/twig/lib/Twig/Loader/String.php b/vendor/twig/twig/lib/Twig/Loader/String.php index 950bd35b0f09b8f916d121cb508cce97c5b696bd..348af0c1d5766ffd9ad5ad3d021c2cd66002ddf6 100644 --- a/vendor/twig/twig/lib/Twig/Loader/String.php +++ b/vendor/twig/twig/lib/Twig/Loader/String.php @@ -9,7 +9,12 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use Twig_Loader_Array instead or Twig_Environment::createTemplate().', E_USER_DEPRECATED); +use Twig\Loader\ExistsLoaderInterface; +use Twig\Loader\LoaderInterface; +use Twig\Loader\SourceContextLoaderInterface; +use Twig\Source; + +@trigger_error('The Twig_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use "Twig\Loader\ArrayLoader" instead or "Twig\Environment::createTemplate()".', E_USER_DEPRECATED); /** * Loads a template from a string. @@ -27,18 +32,18 @@ * * @author Fabien Potencier <fabien@symfony.com> */ -class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface +class Twig_Loader_String implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface { 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); + @trigger_error(sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', \get_class($this)), E_USER_DEPRECATED); return $name; } public function getSourceContext($name) { - return new Twig_Source($name, $name); + return new Source($name, $name); } public function exists($name) diff --git a/vendor/twig/twig/lib/Twig/LoaderInterface.php b/vendor/twig/twig/lib/Twig/LoaderInterface.php index 459a70abbf6a4cdfa46304b7862f98b5a2eb1554..db515bbdf4a2c2db2ea2c088d5dafe0a3fbdcc95 100644 --- a/vendor/twig/twig/lib/Twig/LoaderInterface.php +++ b/vendor/twig/twig/lib/Twig/LoaderInterface.php @@ -1,57 +1,11 @@ <?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\Loader\LoaderInterface; -/** - * Interface all loaders must implement. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -interface Twig_LoaderInterface -{ - /** - * Gets the source code of a template, given its name. - * - * @param string $name The name of the template to load - * - * @return string The template source code - * - * @throws Twig_Error_Loader When $name is not found - * - * @deprecated since 1.27 (to be removed in 2.0), implement Twig_SourceContextLoaderInterface - */ - public function getSource($name); +class_exists('Twig\Loader\LoaderInterface'); - /** - * Gets the cache key to use for the cache for a given template name. - * - * @param string $name The name of the template to load - * - * @return string The cache key - * - * @throws Twig_Error_Loader When $name is not found - */ - public function getCacheKey($name); - - /** - * Returns true if the template is still fresh. - * - * @param string $name The template name - * @param int $time Timestamp of the last modification time of the - * cached template - * - * @return bool true if the template is fresh, false otherwise - * - * @throws Twig_Error_Loader When $name is not found - */ - public function isFresh($name, $time); +if (\false) { + class Twig_LoaderInterface extends LoaderInterface + { + } } - -class_alias('Twig_LoaderInterface', 'Twig\Loader\LoaderInterface', false); diff --git a/vendor/twig/twig/lib/Twig/Markup.php b/vendor/twig/twig/lib/Twig/Markup.php index 8591d1f9344f0dbabb61b2616dbb3fc8dc4527a5..9a3804665445768a43008620516d77de94a1af33 100644 --- a/vendor/twig/twig/lib/Twig/Markup.php +++ b/vendor/twig/twig/lib/Twig/Markup.php @@ -1,39 +1,11 @@ <?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\Markup; -/** - * Marks a content as safe. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Markup implements Countable -{ - protected $content; - protected $charset; +class_exists('Twig\Markup'); - public function __construct($content, $charset) +if (\false) { + class Twig_Markup extends Markup { - $this->content = (string) $content; - $this->charset = $charset; - } - - public function __toString() - { - return $this->content; - } - - public function count() - { - return function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : strlen($this->content); } } - -class_alias('Twig_Markup', 'Twig\Markup', false); diff --git a/vendor/twig/twig/lib/Twig/Node.php b/vendor/twig/twig/lib/Twig/Node.php index 89ada14492d7d2a029926f49b2f3ee3ad7ef1c86..78cc271198440e026420b704a627549b38b323db 100644 --- a/vendor/twig/twig/lib/Twig/Node.php +++ b/vendor/twig/twig/lib/Twig/Node.php @@ -1,256 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\Node; -/** - * Represents a node in the AST. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node implements Twig_NodeInterface -{ - protected $nodes; - protected $attributes; - protected $lineno; - protected $tag; +class_exists('Twig\Node\Node'); - private $name; - - /** - * Constructor. - * - * The nodes are automatically made available as properties ($this->node). - * The attributes are automatically made available as array items ($this['name']). - * - * @param array $nodes An array of named nodes - * @param array $attributes An array of attributes (should not be nodes) - * @param int $lineno The line number - * @param string $tag The tag name associated with the Node - */ - public function __construct(array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null) - { - foreach ($nodes as $name => $node) { - if (!$node instanceof Twig_NodeInterface) { - @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED); - } - } - $this->nodes = $nodes; - $this->attributes = $attributes; - $this->lineno = $lineno; - $this->tag = $tag; - } - - public function __toString() - { - $attributes = array(); - foreach ($this->attributes as $name => $value) { - $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); - } - - $repr = array(get_class($this).'('.implode(', ', $attributes)); - - if (count($this->nodes)) { - foreach ($this->nodes as $name => $node) { - $len = strlen($name) + 4; - $noderepr = array(); - foreach (explode("\n", (string) $node) as $line) { - $noderepr[] = str_repeat(' ', $len).$line; - } - - $repr[] = sprintf(' %s: %s', $name, ltrim(implode("\n", $noderepr))); - } - - $repr[] = ')'; - } else { - $repr[0] .= ')'; - } - - return implode("\n", $repr); - } - - /** - * @deprecated since 1.16.1 (to be removed in 2.0) - */ - public function toXml($asDom = false) - { - @trigger_error(sprintf('%s is deprecated since version 1.16.1 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED); - - $dom = new DOMDocument('1.0', 'UTF-8'); - $dom->formatOutput = true; - $dom->appendChild($xml = $dom->createElement('twig')); - - $xml->appendChild($node = $dom->createElement('node')); - $node->setAttribute('class', get_class($this)); - - foreach ($this->attributes as $name => $value) { - $node->appendChild($attribute = $dom->createElement('attribute')); - $attribute->setAttribute('name', $name); - $attribute->appendChild($dom->createTextNode($value)); - } - - foreach ($this->nodes as $name => $n) { - if (null === $n) { - continue; - } - - $child = $n->toXml(true)->getElementsByTagName('node')->item(0); - $child = $dom->importNode($child, true); - $child->setAttribute('name', $name); - - $node->appendChild($child); - } - - return $asDom ? $dom : $dom->saveXML(); - } - - public function compile(Twig_Compiler $compiler) - { - foreach ($this->nodes as $node) { - $node->compile($compiler); - } - } - - public function getTemplateLine() - { - return $this->lineno; - } - - /** - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function getLine() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getTemplateLine() instead.', E_USER_DEPRECATED); - - return $this->lineno; - } - - public function getNodeTag() - { - return $this->tag; - } - - /** - * @return bool - */ - public function hasAttribute($name) - { - return array_key_exists($name, $this->attributes); - } - - /** - * @return mixed - */ - public function getAttribute($name) - { - if (!array_key_exists($name, $this->attributes)) { - throw new LogicException(sprintf('Attribute "%s" does not exist for Node "%s".', $name, get_class($this))); - } - - return $this->attributes[$name]; - } - - /** - * @param string $name - * @param mixed $value - */ - public function setAttribute($name, $value) - { - $this->attributes[$name] = $value; - } - - public function removeAttribute($name) - { - unset($this->attributes[$name]); - } - - /** - * @return bool - */ - public function hasNode($name) - { - return array_key_exists($name, $this->nodes); - } - - /** - * @return Twig_Node - */ - public function getNode($name) - { - if (!array_key_exists($name, $this->nodes)) { - throw new LogicException(sprintf('Node "%s" does not exist for Node "%s".', $name, get_class($this))); - } - - return $this->nodes[$name]; - } - - public function setNode($name, $node = null) - { - if (!$node instanceof Twig_NodeInterface) { - @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED); - } - - $this->nodes[$name] = $node; - } - - public function removeNode($name) - { - unset($this->nodes[$name]); - } - - public function count() - { - return count($this->nodes); - } - - public function getIterator() - { - return new ArrayIterator($this->nodes); - } - - public function setTemplateName($name) - { - $this->name = $name; - foreach ($this->nodes as $node) { - if (null !== $node) { - $node->setTemplateName($name); - } - } - } - - public function getTemplateName() - { - return $this->name; - } - - /** - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function setFilename($name) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use setTemplateName() instead.', E_USER_DEPRECATED); - - $this->setTemplateName($name); - } - - /** - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function getFilename() +if (\false) { + class Twig_Node extends Node { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getTemplateName() instead.', E_USER_DEPRECATED); - - return $this->name; } } - -class_alias('Twig_Node', 'Twig\Node\Node', false); -class_exists('Twig_Compiler'); diff --git a/vendor/twig/twig/lib/Twig/Node/AutoEscape.php b/vendor/twig/twig/lib/Twig/Node/AutoEscape.php index 17e4e3813f08c2b4dda5ab7b0ca2f89cfb7b1a5d..7d308fff5ce5799ec896e8be56f83f027a6ef445 100644 --- a/vendor/twig/twig/lib/Twig/Node/AutoEscape.php +++ b/vendor/twig/twig/lib/Twig/Node/AutoEscape.php @@ -1,36 +1,11 @@ <?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\Node\AutoEscapeNode; -/** - * Represents an autoescape node. - * - * The value is the escaping strategy (can be html, js, ...) - * - * The true value is equivalent to html. - * - * If autoescaping is disabled, then the value is false. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_AutoEscape extends Twig_Node -{ - public function __construct($value, Twig_NodeInterface $body, $lineno, $tag = 'autoescape') - { - parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag); - } +class_exists('Twig\Node\AutoEscapeNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_AutoEscape extends AutoEscapeNode { - $compiler->subcompile($this->getNode('body')); } } - -class_alias('Twig_Node_AutoEscape', 'Twig\Node\AutoEscapeNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Block.php b/vendor/twig/twig/lib/Twig/Node/Block.php index 91752ad2773f5ee1fdf56914181e372ef9e04b7b..33cd088f3bd2e17269fcc298cb7083a4b79ff1c9 100644 --- a/vendor/twig/twig/lib/Twig/Node/Block.php +++ b/vendor/twig/twig/lib/Twig/Node/Block.php @@ -1,41 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\BlockNode; -/** - * Represents a block node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Block extends Twig_Node -{ - public function __construct($name, Twig_NodeInterface $body, $lineno, $tag = null) - { - parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag); - } +class_exists('Twig\Node\BlockNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Block extends BlockNode { - $compiler - ->addDebugInfo($this) - ->write(sprintf("public function block_%s(\$context, array \$blocks = array())\n", $this->getAttribute('name')), "{\n") - ->indent() - ; - - $compiler - ->subcompile($this->getNode('body')) - ->outdent() - ->write("}\n\n") - ; } } - -class_alias('Twig_Node_Block', 'Twig\Node\BlockNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/BlockReference.php b/vendor/twig/twig/lib/Twig/Node/BlockReference.php index 92a9f398a47b817dd720e3efdf43de953f994ad6..55d2d00b2b7087cb60daf32d8f17960d8bbae914 100644 --- a/vendor/twig/twig/lib/Twig/Node/BlockReference.php +++ b/vendor/twig/twig/lib/Twig/Node/BlockReference.php @@ -1,34 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\BlockReferenceNode; -/** - * Represents a block call node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_BlockReference extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct($name, $lineno, $tag = null) - { - parent::__construct(array(), array('name' => $name), $lineno, $tag); - } +class_exists('Twig\Node\BlockReferenceNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_BlockReference extends BlockReferenceNode { - $compiler - ->addDebugInfo($this) - ->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name'))) - ; } } - -class_alias('Twig_Node_BlockReference', 'Twig\Node\BlockReferenceNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Body.php b/vendor/twig/twig/lib/Twig/Node/Body.php index 07dfef8b5e74fd17bbbcf1bee428964ef3c35042..0874364d19eaaf5d69d5c9f8f360b7515170de71 100644 --- a/vendor/twig/twig/lib/Twig/Node/Body.php +++ b/vendor/twig/twig/lib/Twig/Node/Body.php @@ -1,21 +1,11 @@ <?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\Node\BodyNode; -/** - * Represents a body node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Body extends Twig_Node -{ -} +class_exists('Twig\Node\BodyNode'); -class_alias('Twig_Node_Body', 'Twig\Node\BodyNode', false); +if (\false) { + class Twig_Node_Body extends BodyNode + { + } +} diff --git a/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php b/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php index 7258acb6a2f75fd2e76346019da4256f7afa47a9..e42ce689a807d0854b10aacf746f38bc98b357aa 100644 --- a/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php +++ b/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php @@ -1,80 +1,11 @@ <?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\Node\CheckSecurityNode; -/** - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_CheckSecurity extends Twig_Node -{ - protected $usedFilters; - protected $usedTags; - protected $usedFunctions; +class_exists('Twig\Node\CheckSecurityNode'); - public function __construct(array $usedFilters, array $usedTags, array $usedFunctions) +if (\false) { + class Twig_Node_CheckSecurity extends CheckSecurityNode { - $this->usedFilters = $usedFilters; - $this->usedTags = $usedTags; - $this->usedFunctions = $usedFunctions; - - parent::__construct(); - } - - public function compile(Twig_Compiler $compiler) - { - $tags = $filters = $functions = array(); - foreach (array('tags', 'filters', 'functions') as $type) { - foreach ($this->{'used'.ucfirst($type)} as $name => $node) { - if ($node instanceof Twig_Node) { - ${$type}[$name] = $node->getTemplateLine(); - } else { - ${$type}[$node] = null; - } - } - } - - $compiler - ->write('$tags = ')->repr(array_filter($tags))->raw(";\n") - ->write('$filters = ')->repr(array_filter($filters))->raw(";\n") - ->write('$functions = ')->repr(array_filter($functions))->raw(";\n\n") - ->write("try {\n") - ->indent() - ->write("\$this->env->getExtension('Twig_Extension_Sandbox')->checkSecurity(\n") - ->indent() - ->write(!$tags ? "array(),\n" : "array('".implode("', '", array_keys($tags))."'),\n") - ->write(!$filters ? "array(),\n" : "array('".implode("', '", array_keys($filters))."'),\n") - ->write(!$functions ? "array()\n" : "array('".implode("', '", array_keys($functions))."')\n") - ->outdent() - ->write(");\n") - ->outdent() - ->write("} catch (Twig_Sandbox_SecurityError \$e) {\n") - ->indent() - ->write("\$e->setSourceContext(\$this->getSourceContext());\n\n") - ->write("if (\$e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {\n") - ->indent() - ->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n") - ->outdent() - ->write("} elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {\n") - ->indent() - ->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n") - ->outdent() - ->write("} elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {\n") - ->indent() - ->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n") - ->outdent() - ->write("}\n\n") - ->write("throw \$e;\n") - ->outdent() - ->write("}\n\n") - ; } } - -class_alias('Twig_Node_CheckSecurity', 'Twig\Node\CheckSecurityNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Deprecated.php b/vendor/twig/twig/lib/Twig/Node/Deprecated.php new file mode 100644 index 0000000000000000000000000000000000000000..19b7f8b4aa9e1341b3130f153175307bb36c44d8 --- /dev/null +++ b/vendor/twig/twig/lib/Twig/Node/Deprecated.php @@ -0,0 +1,11 @@ +<?php + +use Twig\Node\DeprecatedNode; + +class_exists('Twig\Node\DeprecatedNode'); + +if (\false) { + class Twig_Node_Deprecated extends DeprecatedNode + { + } +} diff --git a/vendor/twig/twig/lib/Twig/Node/Do.php b/vendor/twig/twig/lib/Twig/Node/Do.php index cdd7e77a407d8910973841fabf57aa5a30cca30d..f538be2f0504e53e39da40b947ca2842021fb64a 100644 --- a/vendor/twig/twig/lib/Twig/Node/Do.php +++ b/vendor/twig/twig/lib/Twig/Node/Do.php @@ -1,35 +1,11 @@ <?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\Node\DoNode; -/** - * Represents a do node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Do extends Twig_Node -{ - public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) - { - parent::__construct(array('expr' => $expr), array(), $lineno, $tag); - } +class_exists('Twig\Node\DoNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Do extends DoNode { - $compiler - ->addDebugInfo($this) - ->write('') - ->subcompile($this->getNode('expr')) - ->raw(";\n") - ; } } - -class_alias('Twig_Node_Do', 'Twig\Node\DoNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Embed.php b/vendor/twig/twig/lib/Twig/Node/Embed.php index 3785d3a9fec456c09c8515e0fc08efd46ec69703..2dfe266a313f58c47c6301b611545e120acdf1ba 100644 --- a/vendor/twig/twig/lib/Twig/Node/Embed.php +++ b/vendor/twig/twig/lib/Twig/Node/Embed.php @@ -1,46 +1,11 @@ <?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\Node\EmbedNode; -/** - * Represents an embed node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Embed extends Twig_Node_Include -{ - // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module) - public function __construct($name, $index, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) - { - parent::__construct(new Twig_Node_Expression_Constant('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag); - - $this->setAttribute('name', $name); - // to be removed in 2.0, used name instead - $this->setAttribute('filename', $name); - $this->setAttribute('index', $index); - } +class_exists('Twig\Node\EmbedNode'); - protected function addGetTemplate(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Embed extends EmbedNode { - $compiler - ->write('$this->loadTemplate(') - ->string($this->getAttribute('name')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(', ') - ->string($this->getAttribute('index')) - ->raw(')') - ; } } - -class_alias('Twig_Node_Embed', 'Twig\Node\EmbedNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression.php b/vendor/twig/twig/lib/Twig/Node/Expression.php index a99c4e63add2dd4b07664fe91a1c971dc6401400..9775df02f830a4840431872751f3e855b404f03f 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression.php @@ -1,22 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\Expression\AbstractExpression; -/** - * Abstract class for all nodes that represents an expression. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -abstract class Twig_Node_Expression extends Twig_Node -{ -} +class_exists('Twig\Node\Expression\AbstractExpression'); -class_alias('Twig_Node_Expression', 'Twig\Node\Expression\AbstractExpression', false); +if (\false) { + class Twig_Node_Expression extends AbstractExpression + { + } +} diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Array.php b/vendor/twig/twig/lib/Twig/Node/Expression/Array.php index 0e77bb08bca88c1199a38b4707962528989b1d35..dec28df7bfe25a3a455d76d3c0f5a3ba155e4c36 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Array.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Array.php @@ -1,83 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Array extends Twig_Node_Expression -{ - protected $index; +use Twig\Node\Expression\ArrayExpression; - public function __construct(array $elements, $lineno) - { - parent::__construct($elements, array(), $lineno); - - $this->index = -1; - foreach ($this->getKeyValuePairs() as $pair) { - if ($pair['key'] instanceof Twig_Node_Expression_Constant && ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) { - $this->index = $pair['key']->getAttribute('value'); - } - } - } - - public function getKeyValuePairs() - { - $pairs = array(); - - foreach (array_chunk($this->nodes, 2) as $pair) { - $pairs[] = array( - 'key' => $pair[0], - 'value' => $pair[1], - ); - } - - return $pairs; - } - - public function hasElement(Twig_Node_Expression $key) - { - foreach ($this->getKeyValuePairs() as $pair) { - // we compare the string representation of the keys - // to avoid comparing the line numbers which are not relevant here. - if ((string) $key === (string) $pair['key']) { - return true; - } - } - - return false; - } +class_exists('Twig\Node\Expression\ArrayExpression'); - public function addElement(Twig_Node_Expression $value, Twig_Node_Expression $key = null) +if (\false) { + class Twig_Node_Expression_Array extends ArrayExpression { - if (null === $key) { - $key = new Twig_Node_Expression_Constant(++$this->index, $value->getTemplateLine()); - } - - array_push($this->nodes, $key, $value); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->raw('array('); - $first = true; - foreach ($this->getKeyValuePairs() as $pair) { - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - $compiler - ->subcompile($pair['key']) - ->raw(' => ') - ->subcompile($pair['value']) - ; - } - $compiler->raw(')'); } } - -class_alias('Twig_Node_Expression_Array', 'Twig\Node\Expression\ArrayExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php b/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php index 2e6b4c7ca3260cd4110f03b2b731d625beaa43c1..cf2e91cf0f20b3122a6377508ae4e2e3ddcfee47 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php @@ -1,25 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\Expression\AssignNameExpression; -class Twig_Node_Expression_AssignName extends Twig_Node_Expression_Name -{ - public function compile(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\AssignNameExpression'); + +if (\false) { + class Twig_Node_Expression_AssignName extends AssignNameExpression { - $compiler - ->raw('$context[') - ->string($this->getAttribute('name')) - ->raw(']') - ; } } - -class_alias('Twig_Node_Expression_AssignName', 'Twig\Node\Expression\AssignNameExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php index 2b545d98482ddb4f18403ae038213596a05a568e..6591c4223f734461e6cb69edec12edcb224735f7 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php @@ -1,37 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -abstract class Twig_Node_Expression_Binary extends Twig_Node_Expression -{ - public function __construct(Twig_NodeInterface $left, Twig_NodeInterface $right, $lineno) - { - parent::__construct(array('left' => $left, 'right' => $right), array(), $lineno); - } +use Twig\Node\Expression\Binary\AbstractBinary; + +class_exists('Twig\Node\Expression\Binary\AbstractBinary'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_Binary extends AbstractBinary { - $compiler - ->raw('(') - ->subcompile($this->getNode('left')) - ->raw(' ') - ; - $this->operator($compiler); - $compiler - ->raw(' ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; } - - abstract public function operator(Twig_Compiler $compiler); } - -class_alias('Twig_Node_Expression_Binary', 'Twig\Node\Expression\Binary\AbstractBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php index 5a09d8367fa1d8bfcd7f6a464d478c0e151dd3d2..895a2fce3bbcb772a3657180a5202b322995ce77 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Binary_Add extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\AddBinary; + +class_exists('Twig\Node\Expression\Binary\AddBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Add extends AddBinary { - return $compiler->raw('+'); } } - -class_alias('Twig_Node_Expression_Binary_Add', 'Twig\Node\Expression\Binary\AddBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php index 9ffddce6b1d36bdf34b78501b18e9521956c94b3..738c6aa1789b70a9e35519c343df131f1bcf8f3b 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Binary_And extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\AndBinary; + +class_exists('Twig\Node\Expression\Binary\AndBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_And extends AndBinary { - return $compiler->raw('&&'); } } - -class_alias('Twig_Node_Expression_Binary_And', 'Twig\Node\Expression\Binary\AndBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php index e46e9ebfa40f1fc06b5b6606d1a039f34ba83fd4..8649e899b2bea85cb7906dc9e1cce3ca1b747d76 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Binary_BitwiseAnd extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\BitwiseAndBinary; + +class_exists('Twig\Node\Expression\Binary\BitwiseAndBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_BitwiseAnd extends BitwiseAndBinary { - return $compiler->raw('&'); } } - -class_alias('Twig_Node_Expression_Binary_BitwiseAnd', 'Twig\Node\Expression\Binary\BitwiseAndBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php index 5d7f1b7c04b86e7d441398cf06bf7774c1b7d39c..473fba270ac3503d192da59cd7743b552b2588be 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Binary_BitwiseOr extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\BitwiseOrBinary; + +class_exists('Twig\Node\Expression\Binary\BitwiseOrBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_BitwiseOr extends BitwiseOrBinary { - return $compiler->raw('|'); } } - -class_alias('Twig_Node_Expression_Binary_BitwiseOr', 'Twig\Node\Expression\Binary\BitwiseOrBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php index 82edf516cec4771aabb5d5c44769986277cdd183..3fedc369ec586dbf2ba6d2c944243c03bea66c82 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Binary_BitwiseXor extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\BitwiseXorBinary; + +class_exists('Twig\Node\Expression\Binary\BitwiseXorBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_BitwiseXor extends BitwiseXorBinary { - return $compiler->raw('^'); } } - -class_alias('Twig_Node_Expression_Binary_BitwiseXor', 'Twig\Node\Expression\Binary\BitwiseXorBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php index 91abca6023bda9e27164b7c4d2ee039ef96c525b..8d7b723c1f82abc6a33cb674d2f8dd1af0a68772 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Binary_Concat extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\ConcatBinary; + +class_exists('Twig\Node\Expression\Binary\ConcatBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Concat extends ConcatBinary { - return $compiler->raw('.'); } } - -class_alias('Twig_Node_Expression_Binary_Concat', 'Twig\Node\Expression\Binary\ConcatBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php index 38ffa30c32390759d0ad4a17c78fa64bd1050592..ce19322f02a353f584a1b2576d58c19e00a41f49 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Binary_Div extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\DivBinary; + +class_exists('Twig\Node\Expression\Binary\DivBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Div extends DivBinary { - return $compiler->raw('/'); } } - -class_alias('Twig_Node_Expression_Binary_Div', 'Twig\Node\Expression\Binary\DivBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php index 85c52937665ed5707f5b19de4c46dbb1f78c8258..b6d3e3c430c96910ec4a3aa9f7be4414672ed2f5 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php @@ -1,32 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_EndsWith extends Twig_Node_Expression_Binary -{ - public function compile(Twig_Compiler $compiler) - { - $left = $compiler->getVarName(); - $right = $compiler->getVarName(); - $compiler - ->raw(sprintf('(is_string($%s = ', $left)) - ->subcompile($this->getNode('left')) - ->raw(sprintf(') && is_string($%s = ', $right)) - ->subcompile($this->getNode('right')) - ->raw(sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right)) - ; - } +use Twig\Node\Expression\Binary\EndsWithBinary; - public function operator(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Binary\EndsWithBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_EndsWith extends EndsWithBinary { - return $compiler->raw(''); } } - -class_alias('Twig_Node_Expression_Binary_EndsWith', 'Twig\Node\Expression\Binary\EndsWithBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php index a6a6946b6d4cddb3f2edc2b8fc2a0017138e0625..e737b61e8a374b666d224ca974af6294c1b9402e 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php @@ -1,19 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_Equal extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\EqualBinary; + +class_exists('Twig\Node\Expression\Binary\EqualBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Equal extends EqualBinary { - return $compiler->raw('=='); } } - -class_alias('Twig_Node_Expression_Binary_Equal', 'Twig\Node\Expression\Binary\EqualBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php index 7393bcb89756f1ae52cf7139b47b1a490a8a1564..7119351fcf6da56a0210825e9b5b9763fde1f80f 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php @@ -1,26 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_FloorDiv extends Twig_Node_Expression_Binary -{ - public function compile(Twig_Compiler $compiler) - { - $compiler->raw('(int) floor('); - parent::compile($compiler); - $compiler->raw(')'); - } +use Twig\Node\Expression\Binary\FloorDivBinary; - public function operator(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Binary\FloorDivBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_FloorDiv extends FloorDivBinary { - return $compiler->raw('/'); } } - -class_alias('Twig_Node_Expression_Binary_FloorDiv', 'Twig\Node\Expression\Binary\FloorDivBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php index 832f97977c65234dc92344e98c7c4e10da4a9d78..183301d7e0084c18430c9c4552340417ac817be2 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php @@ -1,19 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_Greater extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\GreaterBinary; + +class_exists('Twig\Node\Expression\Binary\GreaterBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Greater extends GreaterBinary { - return $compiler->raw('>'); } } - -class_alias('Twig_Node_Expression_Binary_Greater', 'Twig\Node\Expression\Binary\GreaterBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php index c5f762457282daacb7e29c195499c423a72da8ae..f47999bd84cb8fc582bf9444acbabafae8920fcf 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php @@ -1,19 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_GreaterEqual extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\GreaterEqualBinary; + +class_exists('Twig\Node\Expression\Binary\GreaterEqualBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_GreaterEqual extends GreaterEqualBinary { - return $compiler->raw('>='); } } - -class_alias('Twig_Node_Expression_Binary_GreaterEqual', 'Twig\Node\Expression\Binary\GreaterEqualBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php index af112448f46715259ab3723e1fb735bc67c64ed4..7a13d9544b1adda47165258e33dc9b4619ad5e3a 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php @@ -1,30 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_In extends Twig_Node_Expression_Binary -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('twig_in_filter(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } +use Twig\Node\Expression\Binary\InBinary; - public function operator(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Binary\InBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_In extends InBinary { - return $compiler->raw('in'); } } - -class_alias('Twig_Node_Expression_Binary_In', 'Twig\Node\Expression\Binary\InBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php index ab8fc1f9a81e13b19b19e5e7f063cb96ff6dd3d6..7295179a4ce5066b50707b17214f241e35a543e1 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php @@ -1,19 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_Less extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\LessBinary; + +class_exists('Twig\Node\Expression\Binary\LessBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Less extends LessBinary { - return $compiler->raw('<'); } } - -class_alias('Twig_Node_Expression_Binary_Less', 'Twig\Node\Expression\Binary\LessBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php index 71a279e9ceba31b48e4c9c19dc5bc7892396e7e2..cbfbc8c7ad0376ebc066aad869201a951bc9b4b9 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php @@ -1,19 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_LessEqual extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\LessEqualBinary; + +class_exists('Twig\Node\Expression\Binary\LessEqualBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_LessEqual extends LessEqualBinary { - return $compiler->raw('<='); } } - -class_alias('Twig_Node_Expression_Binary_LessEqual', 'Twig\Node\Expression\Binary\LessEqualBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php index 5cb855842887357d4a064342ba4cb7960797b8e1..5209083ebdd429ddaa8374abc37a9ff49a73ff00 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php @@ -1,30 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_Matches extends Twig_Node_Expression_Binary -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('preg_match(') - ->subcompile($this->getNode('right')) - ->raw(', ') - ->subcompile($this->getNode('left')) - ->raw(')') - ; - } +use Twig\Node\Expression\Binary\MatchesBinary; - public function operator(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Binary\MatchesBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Matches extends MatchesBinary { - return $compiler->raw(''); } } - -class_alias('Twig_Node_Expression_Binary_Matches', 'Twig\Node\Expression\Binary\MatchesBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php index 28109633dad025e6e631d3c31e28d6b7bf0f6358..aec59e3bae66755e09f7311aee6a541037882fa8 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Binary_Mod extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\ModBinary; + +class_exists('Twig\Node\Expression\Binary\ModBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Mod extends ModBinary { - return $compiler->raw('%'); } } - -class_alias('Twig_Node_Expression_Binary_Mod', 'Twig\Node\Expression\Binary\ModBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php index 790c6a22d8813e857e0dc0f7dd84dca6105161c4..850934a1008d777635a8a7758a3a44e6fd55cdbc 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Binary_Mul extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\MulBinary; + +class_exists('Twig\Node\Expression\Binary\MulBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Mul extends MulBinary { - return $compiler->raw('*'); } } - -class_alias('Twig_Node_Expression_Binary_Mul', 'Twig\Node\Expression\Binary\MulBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php index bb45c9ed552549aadf0377322dc7abf545f79c6e..842c8bc8b8bf0cf62734cff43c6952bb145117b4 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php @@ -1,19 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_NotEqual extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\NotEqualBinary; + +class_exists('Twig\Node\Expression\Binary\NotEqualBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_NotEqual extends NotEqualBinary { - return $compiler->raw('!='); } } - -class_alias('Twig_Node_Expression_Binary_NotEqual', 'Twig\Node\Expression\Binary\NotEqualBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php index 9dedf92f920a398a26895b2576109181e3ac6bbb..7d3c1288f38d6f9b86cda7b868461ef49d380e1d 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php @@ -1,30 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_NotIn extends Twig_Node_Expression_Binary -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('!twig_in_filter(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } +use Twig\Node\Expression\Binary\NotInBinary; - public function operator(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Binary\NotInBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_NotIn extends NotInBinary { - return $compiler->raw('not in'); } } - -class_alias('Twig_Node_Expression_Binary_NotIn', 'Twig\Node\Expression\Binary\NotInBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php index dc9eece14cad4e4c5ca9ac4d76c1349357cb88e6..3a38faed6bbf2f56bf2aa58868315657b14c8fa5 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Binary_Or extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\OrBinary; + +class_exists('Twig\Node\Expression\Binary\OrBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Or extends OrBinary { - return $compiler->raw('||'); } } - -class_alias('Twig_Node_Expression_Binary_Or', 'Twig\Node\Expression\Binary\OrBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php index d24777bd5525f29d4182d13c777b22ad2f97bbd3..7eafca80f28b9ccbeead737a7fd44e4a0c9a507a 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php @@ -1,34 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_Power extends Twig_Node_Expression_Binary -{ - public function compile(Twig_Compiler $compiler) - { - if (PHP_VERSION_ID >= 50600) { - return parent::compile($compiler); - } +use Twig\Node\Expression\Binary\PowerBinary; - $compiler - ->raw('pow(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } +class_exists('Twig\Node\Expression\Binary\PowerBinary'); - public function operator(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_Binary_Power extends PowerBinary { - return $compiler->raw('**'); } } - -class_alias('Twig_Node_Expression_Binary_Power', 'Twig\Node\Expression\Binary\PowerBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php index 187f67653b0510e9733fadbbaab1d71d95dcc39c..01564142afe3348f91ca49c72730e46758483d97 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php @@ -1,30 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_Range extends Twig_Node_Expression_Binary -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('range(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } +use Twig\Node\Expression\Binary\RangeBinary; - public function operator(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Binary\RangeBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Range extends RangeBinary { - return $compiler->raw('..'); } } - -class_alias('Twig_Node_Expression_Binary_Range', 'Twig\Node\Expression\Binary\RangeBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php index 7e43b8de09d3f7e30ac5d86774daa8e44d5c1d31..f72ea49ca990c7fa6ff60d5eeeb047b3988f40ba 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php @@ -1,32 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Binary_StartsWith extends Twig_Node_Expression_Binary -{ - public function compile(Twig_Compiler $compiler) - { - $left = $compiler->getVarName(); - $right = $compiler->getVarName(); - $compiler - ->raw(sprintf('(is_string($%s = ', $left)) - ->subcompile($this->getNode('left')) - ->raw(sprintf(') && is_string($%s = ', $right)) - ->subcompile($this->getNode('right')) - ->raw(sprintf(') && (\'\' === $%2$s || 0 === strpos($%1$s, $%2$s)))', $left, $right)) - ; - } +use Twig\Node\Expression\Binary\StartsWithBinary; - public function operator(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Binary\StartsWithBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_StartsWith extends StartsWithBinary { - return $compiler->raw(''); } } - -class_alias('Twig_Node_Expression_Binary_StartsWith', 'Twig\Node\Expression\Binary\StartsWithBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php index cff8ed075bae306301e3e0e25b1b76ab2ea49d12..f596da703c07eb9977d7e7bb09e5bfb55616d10f 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Binary_Sub extends Twig_Node_Expression_Binary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Binary\SubBinary; + +class_exists('Twig\Node\Expression\Binary\SubBinary'); + +if (\false) { + class Twig_Node_Expression_Binary_Sub extends SubBinary { - return $compiler->raw('-'); } } - -class_alias('Twig_Node_Expression_Binary_Sub', 'Twig\Node\Expression\Binary\SubBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php b/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php index 37a3983d68713fdeb6e6af26a4bc1a0edda343ed..8ea2350a394da1498e118733a8112aab3b0de0a6 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php @@ -1,93 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\Expression\BlockReferenceExpression; -/** - * Represents a block call node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Expression_BlockReference extends Twig_Node_Expression -{ - /** - * @param Twig_Node|null $template - */ - public function __construct(Twig_NodeInterface $name, $template = null, $lineno, $tag = null) - { - if (is_bool($template)) { - @trigger_error(sprintf('The %s method "$asString" argument is deprecated since version 1.28 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED); - - $template = null; - } - - $nodes = array('name' => $name); - if (null !== $template) { - $nodes['template'] = $template; - } - - parent::__construct($nodes, array('is_defined_test' => false, 'output' => false), $lineno, $tag); - } +class_exists('Twig\Node\Expression\BlockReferenceExpression'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_BlockReference extends BlockReferenceExpression { - if ($this->getAttribute('is_defined_test')) { - $this->compileTemplateCall($compiler, 'hasBlock'); - } else { - if ($this->getAttribute('output')) { - $compiler->addDebugInfo($this); - - $this - ->compileTemplateCall($compiler, 'displayBlock') - ->raw(";\n"); - } else { - $this->compileTemplateCall($compiler, 'renderBlock'); - } - } - } - - private function compileTemplateCall(Twig_Compiler $compiler, $method) - { - if (!$this->hasNode('template')) { - $compiler->write('$this'); - } else { - $compiler - ->write('$this->loadTemplate(') - ->subcompile($this->getNode('template')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(')') - ; - } - - $compiler->raw(sprintf('->%s', $method)); - $this->compileBlockArguments($compiler); - - return $compiler; - } - - private function compileBlockArguments(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('name')) - ->raw(', $context'); - - if (!$this->hasNode('template')) { - $compiler->raw(', $blocks'); - } - - return $compiler->raw(')'); } } - -class_alias('Twig_Node_Expression_BlockReference', 'Twig\Node\Expression\BlockReferenceExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Call.php b/vendor/twig/twig/lib/Twig/Node/Expression/Call.php index d962b6a501d6ca4ed6c11d271d3befdb547618ca..019ddf7b85db59ea9e1bb76014578802b452af34 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Call.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Call.php @@ -1,291 +1,11 @@ <?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. - */ -abstract class Twig_Node_Expression_Call extends Twig_Node_Expression -{ - private $reflector; +use Twig\Node\Expression\CallExpression; - protected function compileCallable(Twig_Compiler $compiler) - { - $closingParenthesis = false; - if ($this->hasAttribute('callable') && $callable = $this->getAttribute('callable')) { - if (is_string($callable) && false === strpos($callable, '::')) { - $compiler->raw($callable); - } else { - list($r, $callable) = $this->reflectCallable($callable); - if ($r instanceof ReflectionMethod && is_string($callable[0])) { - if ($r->isStatic()) { - $compiler->raw(sprintf('%s::%s', $callable[0], $callable[1])); - } else { - $compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1])); - } - } elseif ($r instanceof ReflectionMethod && $callable[0] instanceof Twig_ExtensionInterface) { - $compiler->raw(sprintf('$this->env->getExtension(\'%s\')->%s', get_class($callable[0]), $callable[1])); - } else { - $type = ucfirst($this->getAttribute('type')); - $compiler->raw(sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), array', $type, $this->getAttribute('name'))); - $closingParenthesis = true; - } - } - } else { - $compiler->raw($this->getAttribute('thing')->compile()); - } - - $this->compileArguments($compiler); - - if ($closingParenthesis) { - $compiler->raw(')'); - } - } +class_exists('Twig\Node\Expression\CallExpression'); - protected function compileArguments(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_Call extends CallExpression { - $compiler->raw('('); - - $first = true; - - if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { - $compiler->raw('$this->env'); - $first = false; - } - - if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->raw('$context'); - $first = false; - } - - if ($this->hasAttribute('arguments')) { - foreach ($this->getAttribute('arguments') as $argument) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->string($argument); - $first = false; - } - } - - if ($this->hasNode('node')) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->subcompile($this->getNode('node')); - $first = false; - } - - if ($this->hasNode('arguments')) { - $callable = $this->hasAttribute('callable') ? $this->getAttribute('callable') : null; - - $arguments = $this->getArguments($callable, $this->getNode('arguments')); - - foreach ($arguments as $node) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->subcompile($node); - $first = false; - } - } - - $compiler->raw(')'); - } - - protected function getArguments($callable, $arguments) - { - $callType = $this->getAttribute('type'); - $callName = $this->getAttribute('name'); - - $parameters = array(); - $named = false; - foreach ($arguments as $name => $node) { - if (!is_int($name)) { - $named = true; - $name = $this->normalizeName($name); - } elseif ($named) { - throw new Twig_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName)); - } - - $parameters[$name] = $node; - } - - $isVariadic = $this->hasAttribute('is_variadic') && $this->getAttribute('is_variadic'); - if (!$named && !$isVariadic) { - return $parameters; - } - - if (!$callable) { - if ($named) { - $message = sprintf('Named arguments are not supported for %s "%s".', $callType, $callName); - } else { - $message = sprintf('Arbitrary positional arguments are not supported for %s "%s".', $callType, $callName); - } - - throw new LogicException($message); - } - - $callableParameters = $this->getCallableParameters($callable, $isVariadic); - $arguments = array(); - $names = array(); - $missingArguments = array(); - $optionalArguments = array(); - $pos = 0; - foreach ($callableParameters as $callableParameter) { - $names[] = $name = $this->normalizeName($callableParameter->name); - - if (array_key_exists($name, $parameters)) { - if (array_key_exists($pos, $parameters)) { - throw new Twig_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName)); - } - - if (count($missingArguments)) { - throw new Twig_Error_Syntax(sprintf( - 'Argument "%s" could not be assigned for %s "%s(%s)" because it is mapped to an internal PHP function which cannot determine default value for optional argument%s "%s".', - $name, $callType, $callName, implode(', ', $names), count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments)) - ); - } - - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $parameters[$name]; - unset($parameters[$name]); - $optionalArguments = array(); - } elseif (array_key_exists($pos, $parameters)) { - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $parameters[$pos]; - unset($parameters[$pos]); - $optionalArguments = array(); - ++$pos; - } elseif ($callableParameter->isDefaultValueAvailable()) { - $optionalArguments[] = new Twig_Node_Expression_Constant($callableParameter->getDefaultValue(), -1); - } elseif ($callableParameter->isOptional()) { - if (empty($parameters)) { - break; - } else { - $missingArguments[] = $name; - } - } else { - throw new Twig_Error_Syntax(sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName)); - } - } - - if ($isVariadic) { - $arbitraryArguments = new Twig_Node_Expression_Array(array(), -1); - foreach ($parameters as $key => $value) { - if (is_int($key)) { - $arbitraryArguments->addElement($value); - } else { - $arbitraryArguments->addElement($value, new Twig_Node_Expression_Constant($key, -1)); - } - unset($parameters[$key]); - } - - if ($arbitraryArguments->count()) { - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $arbitraryArguments; - } - } - - if (!empty($parameters)) { - $unknownParameter = null; - foreach ($parameters as $parameter) { - if ($parameter instanceof Twig_Node) { - $unknownParameter = $parameter; - break; - } - } - - throw new Twig_Error_Syntax(sprintf( - 'Unknown argument%s "%s" for %s "%s(%s)".', - count($parameters) > 1 ? 's' : '', implode('", "', array_keys($parameters)), $callType, $callName, implode(', ', $names) - ), $unknownParameter ? $unknownParameter->getTemplateLine() : -1); - } - - return $arguments; - } - - protected function normalizeName($name) - { - return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), $name)); - } - - private function getCallableParameters($callable, $isVariadic) - { - list($r) = $this->reflectCallable($callable); - if (null === $r) { - return array(); - } - - $parameters = $r->getParameters(); - if ($this->hasNode('node')) { - array_shift($parameters); - } - if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { - array_shift($parameters); - } - if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { - array_shift($parameters); - } - if ($this->hasAttribute('arguments') && null !== $this->getAttribute('arguments')) { - foreach ($this->getAttribute('arguments') as $argument) { - array_shift($parameters); - } - } - if ($isVariadic) { - $argument = end($parameters); - if ($argument && $argument->isArray() && $argument->isDefaultValueAvailable() && array() === $argument->getDefaultValue()) { - array_pop($parameters); - } else { - $callableName = $r->name; - if ($r instanceof ReflectionMethod) { - $callableName = $r->getDeclaringClass()->name.'::'.$callableName; - } - - throw new LogicException(sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = array()".', $callableName, $this->getAttribute('type'), $this->getAttribute('name'))); - } - } - - return $parameters; - } - - private function reflectCallable($callable) - { - if (null !== $this->reflector) { - return $this->reflector; - } - - if (is_array($callable)) { - if (!method_exists($callable[0], $callable[1])) { - // __call() - return array(null, array()); - } - $r = new ReflectionMethod($callable[0], $callable[1]); - } elseif (is_object($callable) && !$callable instanceof Closure) { - $r = new ReflectionObject($callable); - $r = $r->getMethod('__invoke'); - $callable = array($callable, '__invoke'); - } elseif (is_string($callable) && false !== $pos = strpos($callable, '::')) { - $class = substr($callable, 0, $pos); - $method = substr($callable, $pos + 2); - if (!method_exists($class, $method)) { - // __staticCall() - return array(null, array()); - } - $r = new ReflectionMethod($callable); - $callable = array($class, $method); - } else { - $r = new ReflectionFunction($callable); - } - - return $this->reflector = array($r, $callable); } } - -class_alias('Twig_Node_Expression_Call', 'Twig\Node\Expression\CallExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php b/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php index c339d773c05b4ae8185c921f4240f262ed8d101d..308df26f0f8c826bbd798799f5bccf361db13bfb 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php @@ -1,33 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Conditional extends Twig_Node_Expression -{ - public function __construct(Twig_Node_Expression $expr1, Twig_Node_Expression $expr2, Twig_Node_Expression $expr3, $lineno) - { - parent::__construct(array('expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno); - } +use Twig\Node\Expression\ConditionalExpression; - public function compile(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\ConditionalExpression'); + +if (\false) { + class Twig_Node_Expression_Conditional extends ConditionalExpression { - $compiler - ->raw('((') - ->subcompile($this->getNode('expr1')) - ->raw(') ? (') - ->subcompile($this->getNode('expr2')) - ->raw(') : (') - ->subcompile($this->getNode('expr3')) - ->raw('))') - ; } } - -class_alias('Twig_Node_Expression_Conditional', 'Twig\Node\Expression\ConditionalExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php b/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php index bf4d031cf92dce334d1b1b7f572ac18f0dff62c5..435ccdd79f7a546c3376feba21cb75b5a546d214 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php @@ -1,25 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Constant extends Twig_Node_Expression -{ - public function __construct($value, $lineno) - { - parent::__construct(array(), array('value' => $value), $lineno); - } +use Twig\Node\Expression\ConstantExpression; - public function compile(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\ConstantExpression'); + +if (\false) { + class Twig_Node_Expression_Constant extends ConstantExpression { - $compiler->repr($this->getAttribute('value')); } } - -class_alias('Twig_Node_Expression_Constant', 'Twig\Node\Expression\ConstantExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php b/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php index 114b5cd975ff23f5f701e91be17052ed29700094..9b8927a317fa0a782c6d50180207ccbf6a3353a4 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php @@ -9,6 +9,9 @@ * file that was distributed with this source code. */ +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; + @trigger_error('The Twig_Node_Expression_ExtensionReference class is deprecated since version 1.23 and will be removed in 2.0.', E_USER_DEPRECATED); /** @@ -18,14 +21,14 @@ * * @deprecated since 1.23 and will be removed in 2.0. */ -class Twig_Node_Expression_ExtensionReference extends Twig_Node_Expression +class Twig_Node_Expression_ExtensionReference extends AbstractExpression { public function __construct($name, $lineno, $tag = null) { - parent::__construct(array(), array('name' => $name), $lineno, $tag); + parent::__construct([], ['name' => $name], $lineno, $tag); } - public function compile(Twig_Compiler $compiler) + public function compile(Compiler $compiler) { $compiler->raw(sprintf("\$this->env->getExtension('%s')", $this->getAttribute('name'))); } diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php b/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php index 12da1d676110bbfe6078745caf04aae212f9302f..85705715e9cc79a320821212739694b5e2390687 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php @@ -1,41 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Filter extends Twig_Node_Expression_Call -{ - public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null) - { - parent::__construct(array('node' => $node, 'filter' => $filterName, 'arguments' => $arguments), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $name = $this->getNode('filter')->getAttribute('value'); - $filter = $compiler->getEnvironment()->getFilter($name); +use Twig\Node\Expression\FilterExpression; - $this->setAttribute('name', $name); - $this->setAttribute('type', 'filter'); - $this->setAttribute('thing', $filter); - $this->setAttribute('needs_environment', $filter->needsEnvironment()); - $this->setAttribute('needs_context', $filter->needsContext()); - $this->setAttribute('arguments', $filter->getArguments()); - if ($filter instanceof Twig_FilterCallableInterface || $filter instanceof Twig_SimpleFilter) { - $this->setAttribute('callable', $filter->getCallable()); - } - if ($filter instanceof Twig_SimpleFilter) { - $this->setAttribute('is_variadic', $filter->isVariadic()); - } +class_exists('Twig\Node\Expression\FilterExpression'); - $this->compileCallable($compiler); +if (\false) { + class Twig_Node_Expression_Filter extends FilterExpression + { } } - -class_alias('Twig_Node_Expression_Filter', 'Twig\Node\Expression\FilterExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php b/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php index d2e19d54ef9d19bb9d574e81f78713a3e3090cb3..9688743f28d0a7c98637de81ff1887e1c1f42859 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php @@ -1,45 +1,11 @@ <?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\Node\Expression\Filter\DefaultFilter; -/** - * Returns the value or the default value when it is undefined or empty. - * - * <pre> - * {{ var.foo|default('foo item on var is not defined') }} - * </pre> - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Expression_Filter_Default extends Twig_Node_Expression_Filter -{ - public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null) - { - $default = new Twig_Node_Expression_Filter($node, new Twig_Node_Expression_Constant('default', $node->getTemplateLine()), $arguments, $node->getTemplateLine()); - - if ('default' === $filterName->getAttribute('value') && ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr)) { - $test = new Twig_Node_Expression_Test_Defined(clone $node, 'defined', new Twig_Node(), $node->getTemplateLine()); - $false = count($arguments) ? $arguments->getNode(0) : new Twig_Node_Expression_Constant('', $node->getTemplateLine()); - - $node = new Twig_Node_Expression_Conditional($test, $default, $false, $node->getTemplateLine()); - } else { - $node = $default; - } +class_exists('Twig\Node\Expression\Filter\DefaultFilter'); - parent::__construct($node, $filterName, $arguments, $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_Filter_Default extends DefaultFilter { - $compiler->subcompile($this->getNode('node')); } } - -class_alias('Twig_Node_Expression_Filter_Default', 'Twig\Node\Expression\Filter\DefaultFilter', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Function.php b/vendor/twig/twig/lib/Twig/Node/Expression/Function.php index cdee7c97220868615e84c70a83073387a6c62211..5d408e46aef7094369fe4ce6befab9326efc9241 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Function.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Function.php @@ -1,45 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Function extends Twig_Node_Expression_Call -{ - public function __construct($name, Twig_NodeInterface $arguments, $lineno) - { - parent::__construct(array('arguments' => $arguments), array('name' => $name, 'is_defined_test' => false), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $name = $this->getAttribute('name'); - $function = $compiler->getEnvironment()->getFunction($name); +use Twig\Node\Expression\FunctionExpression; - $this->setAttribute('name', $name); - $this->setAttribute('type', 'function'); - $this->setAttribute('thing', $function); - $this->setAttribute('needs_environment', $function->needsEnvironment()); - $this->setAttribute('needs_context', $function->needsContext()); - $this->setAttribute('arguments', $function->getArguments()); - if ($function instanceof Twig_FunctionCallableInterface || $function instanceof Twig_SimpleFunction) { - $callable = $function->getCallable(); - if ('constant' === $name && $this->getAttribute('is_defined_test')) { - $callable = 'twig_constant_is_defined'; - } +class_exists('Twig\Node\Expression\FunctionExpression'); - $this->setAttribute('callable', $callable); - } - if ($function instanceof Twig_SimpleFunction) { - $this->setAttribute('is_variadic', $function->isVariadic()); - } - - $this->compileCallable($compiler); +if (\false) { + class Twig_Node_Expression_Function extends FunctionExpression + { } } - -class_alias('Twig_Node_Expression_Function', 'Twig\Node\Expression\FunctionExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php b/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php index b7823accb935bddd7028aa01094c383acc231792..7b99eb376d71845fb51f235497006d5d509368e9 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php @@ -1,74 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_GetAttr extends Twig_Node_Expression -{ - public function __construct(Twig_Node_Expression $node, Twig_Node_Expression $attribute, Twig_Node_Expression $arguments = null, $type, $lineno) - { - $nodes = array('node' => $node, 'attribute' => $attribute); - if (null !== $arguments) { - $nodes['arguments'] = $arguments; - } +use Twig\Node\Expression\GetAttrExpression; - parent::__construct($nodes, array('type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'disable_c_ext' => false), $lineno); - } +class_exists('Twig\Node\Expression\GetAttrExpression'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_GetAttr extends GetAttrExpression { - if ($this->getAttribute('disable_c_ext')) { - @trigger_error(sprintf('Using the "disable_c_ext" attribute on %s is deprecated since version 1.30 and will be removed in 2.0.', __CLASS__), E_USER_DEPRECATED); - } - - if (function_exists('twig_template_get_attributes') && !$this->getAttribute('disable_c_ext')) { - $compiler->raw('twig_template_get_attributes($this, '); - } else { - $compiler->raw('$this->getAttribute('); - } - - if ($this->getAttribute('ignore_strict_check')) { - $this->getNode('node')->setAttribute('ignore_strict_check', true); - } - - $compiler->subcompile($this->getNode('node')); - - $compiler->raw(', ')->subcompile($this->getNode('attribute')); - - // only generate optional arguments when needed (to make generated code more readable) - $needFourth = $this->getAttribute('ignore_strict_check'); - $needThird = $needFourth || $this->getAttribute('is_defined_test'); - $needSecond = $needThird || Twig_Template::ANY_CALL !== $this->getAttribute('type'); - $needFirst = $needSecond || $this->hasNode('arguments'); - - if ($needFirst) { - if ($this->hasNode('arguments')) { - $compiler->raw(', ')->subcompile($this->getNode('arguments')); - } else { - $compiler->raw(', array()'); - } - } - - if ($needSecond) { - $compiler->raw(', ')->repr($this->getAttribute('type')); - } - - if ($needThird) { - $compiler->raw(', ')->repr($this->getAttribute('is_defined_test')); - } - - if ($needFourth) { - $compiler->raw(', ')->repr($this->getAttribute('ignore_strict_check')); - } - - $compiler->raw(')'); } } - -class_alias('Twig_Node_Expression_GetAttr', 'Twig\Node\Expression\GetAttrExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php b/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php index 709016eb225b620ba4ac01dc2824ef20911db844..5b0cef8c4371f6748ff0c2458fb33cef2687c613 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php @@ -1,43 +1,11 @@ <?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. - */ -class Twig_Node_Expression_MethodCall extends Twig_Node_Expression -{ - public function __construct(Twig_Node_Expression $node, $method, Twig_Node_Expression_Array $arguments, $lineno) - { - parent::__construct(array('node' => $node, 'arguments' => $arguments), array('method' => $method, 'safe' => false), $lineno); +use Twig\Node\Expression\MethodCallExpression; - if ($node instanceof Twig_Node_Expression_Name) { - $node->setAttribute('always_defined', true); - } - } +class_exists('Twig\Node\Expression\MethodCallExpression'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_MethodCall extends MethodCallExpression { - $compiler - ->subcompile($this->getNode('node')) - ->raw('->') - ->raw($this->getAttribute('method')) - ->raw('(') - ; - $first = true; - foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) { - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - $compiler->subcompile($pair['value']); - } - $compiler->raw(')'); } } - -class_alias('Twig_Node_Expression_MethodCall', 'Twig\Node\Expression\MethodCallExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Name.php b/vendor/twig/twig/lib/Twig/Node/Expression/Name.php index 9d5a21f87d768bab9d151e85aadeb64bd30b222f..3b41ff9fc7c8dda0da670285b34bfba229f54f4f 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Name.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Name.php @@ -1,102 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Name extends Twig_Node_Expression -{ - protected $specialVars = array( - '_self' => '$this', - '_context' => '$context', - '_charset' => '$this->env->getCharset()', - ); +use Twig\Node\Expression\NameExpression; - public function __construct($name, $lineno) - { - parent::__construct(array(), array('name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false), $lineno); - } +class_exists('Twig\Node\Expression\NameExpression'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_Name extends NameExpression { - $name = $this->getAttribute('name'); - - $compiler->addDebugInfo($this); - - if ($this->getAttribute('is_defined_test')) { - if ($this->isSpecial()) { - $compiler->repr(true); - } else { - $compiler->raw('array_key_exists(')->repr($name)->raw(', $context)'); - } - } elseif ($this->isSpecial()) { - $compiler->raw($this->specialVars[$name]); - } elseif ($this->getAttribute('always_defined')) { - $compiler - ->raw('$context[') - ->string($name) - ->raw(']') - ; - } else { - if (PHP_VERSION_ID >= 70000) { - // use PHP 7 null coalescing operator - $compiler - ->raw('($context[') - ->string($name) - ->raw('] ?? ') - ; - - if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) { - $compiler->raw('null)'); - } else { - $compiler->raw('$this->getContext($context, ')->string($name)->raw('))'); - } - } elseif (PHP_VERSION_ID >= 50400) { - // PHP 5.4 ternary operator performance was optimized - $compiler - ->raw('(isset($context[') - ->string($name) - ->raw(']) ? $context[') - ->string($name) - ->raw('] : ') - ; - - if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) { - $compiler->raw('null)'); - } else { - $compiler->raw('$this->getContext($context, ')->string($name)->raw('))'); - } - } else { - $compiler - ->raw('$this->getContext($context, ') - ->string($name) - ; - - if ($this->getAttribute('ignore_strict_check')) { - $compiler->raw(', true'); - } - - $compiler - ->raw(')') - ; - } - } - } - - public function isSpecial() - { - return isset($this->specialVars[$this->getAttribute('name')]); - } - - public function isSimple() - { - return !$this->isSpecial() && !$this->getAttribute('is_defined_test'); } } - -class_alias('Twig_Node_Expression_Name', 'Twig\Node\Expression\NameExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php b/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php index eaafa4c91ead2eee83ce5c1c9595561b0d8ebd66..89d6bf6a5011b7f7cdd55c773595efcbf9639b83 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php @@ -1,48 +1,11 @@ <?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. - */ -class Twig_Node_Expression_NullCoalesce extends Twig_Node_Expression_Conditional -{ - public function __construct(Twig_NodeInterface $left, Twig_NodeInterface $right, $lineno) - { - $test = new Twig_Node_Expression_Binary_And( - new Twig_Node_Expression_Test_Defined(clone $left, 'defined', new Twig_Node(), $left->getTemplateLine()), - new Twig_Node_Expression_Unary_Not(new Twig_Node_Expression_Test_Null($left, 'null', new Twig_Node(), $left->getTemplateLine()), $left->getTemplateLine()), - $left->getTemplateLine() - ); +use Twig\Node\Expression\NullCoalesceExpression; - parent::__construct($test, $left, $right, $lineno); - } +class_exists('Twig\Node\Expression\NullCoalesceExpression'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_NullCoalesce extends NullCoalesceExpression { - /* - * This optimizes only one case. PHP 7 also supports more complex expressions - * that can return null. So, for instance, if log is defined, log("foo") ?? "..." works, - * but log($a["foo"]) ?? "..." does not if $a["foo"] is not defined. More advanced - * cases might be implemented as an optimizer node visitor, but has not been done - * as benefits are probably not worth the added complexity. - */ - if (PHP_VERSION_ID >= 70000 && $this->getNode('expr2') instanceof Twig_Node_Expression_Name) { - $this->getNode('expr2')->setAttribute('always_defined', true); - $compiler - ->raw('((') - ->subcompile($this->getNode('expr2')) - ->raw(') ?? (') - ->subcompile($this->getNode('expr3')) - ->raw('))') - ; - } else { - parent::compile($compiler); - } } } - -class_alias('Twig_Node_Expression_NullCoalesce', 'Twig\Node\Expression\NullCoalesceExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php b/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php index 78692db293d7b3ee3df900e2796f28148881928e..236c79fd4d40baa881e0d5d08379d7645c000f96 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php @@ -1,44 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\Expression\ParentExpression; -/** - * Represents a parent node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Expression_Parent extends Twig_Node_Expression -{ - public function __construct($name, $lineno, $tag = null) - { - parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag); - } +class_exists('Twig\Node\Expression\ParentExpression'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_Parent extends ParentExpression { - if ($this->getAttribute('output')) { - $compiler - ->addDebugInfo($this) - ->write('$this->displayParentBlock(') - ->string($this->getAttribute('name')) - ->raw(", \$context, \$blocks);\n") - ; - } else { - $compiler - ->raw('$this->renderParentBlock(') - ->string($this->getAttribute('name')) - ->raw(', $context, $blocks)') - ; - } } } - -class_alias('Twig_Node_Expression_Parent', 'Twig\Node\Expression\ParentExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php b/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php index 0a86e003dcdcd4433f1b6b0f4b5610f7587e45d7..e77ebe06bb8ab6e136de98be6e05695fcedd2f76 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php @@ -1,28 +1,11 @@ <?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. - */ -class Twig_Node_Expression_TempName extends Twig_Node_Expression -{ - public function __construct($name, $lineno) - { - parent::__construct(array(), array('name' => $name), $lineno); - } +use Twig\Node\Expression\TempNameExpression; - public function compile(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\TempNameExpression'); + +if (\false) { + class Twig_Node_Expression_TempName extends TempNameExpression { - $compiler - ->raw('$_') - ->raw($this->getAttribute('name')) - ->raw('_') - ; } } - -class_alias('Twig_Node_Expression_TempName', 'Twig\Node\Expression\TempNameExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test.php index ad102ba60df5ae7737fede9bd9a483396b1727d5..9c300ba3f5fc4098d8eed1023c961bb1816b4acf 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Test.php @@ -1,42 +1,11 @@ <?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. - */ -class Twig_Node_Expression_Test extends Twig_Node_Expression_Call -{ - public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno) - { - $nodes = array('node' => $node); - if (null !== $arguments) { - $nodes['arguments'] = $arguments; - } +use Twig\Node\Expression\TestExpression; - parent::__construct($nodes, array('name' => $name), $lineno); - } +class_exists('Twig\Node\Expression\TestExpression'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_Test extends TestExpression { - $name = $this->getAttribute('name'); - $test = $compiler->getEnvironment()->getTest($name); - - $this->setAttribute('name', $name); - $this->setAttribute('type', 'test'); - $this->setAttribute('thing', $test); - if ($test instanceof Twig_TestCallableInterface || $test instanceof Twig_SimpleTest) { - $this->setAttribute('callable', $test->getCallable()); - } - if ($test instanceof Twig_SimpleTest) { - $this->setAttribute('is_variadic', $test->isVariadic()); - } - - $this->compileCallable($compiler); } } - -class_alias('Twig_Node_Expression_Test', 'Twig\Node\Expression\TestExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php index a51a4ba133b3fed3cf7e34a1b6894b3fed5a22d8..bc796ec356439753862395f94836c1d4ae9a0b6e 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php @@ -1,48 +1,11 @@ <?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\Node\Expression\Test\ConstantTest; -/** - * Checks if a variable is the exact same value as a constant. - * - * <pre> - * {% if post.status is constant('Post::PUBLISHED') %} - * the status attribute is exactly the same as Post::PUBLISHED - * {% endif %} - * </pre> - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' === constant(') - ; - - if ($this->getNode('arguments')->hasNode(1)) { - $compiler - ->raw('get_class(') - ->subcompile($this->getNode('arguments')->getNode(1)) - ->raw(')."::".') - ; - } +class_exists('Twig\Node\Expression\Test\ConstantTest'); - $compiler - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw('))') - ; +if (\false) { + class Twig_Node_Expression_Test_Constant extends ConstantTest + { } } - -class_alias('Twig_Node_Expression_Test_Constant', 'Twig\Node\Expression\Test\ConstantTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php index 2136c3907a5df66467cd2bee788d2cbcdb16b8c3..759cb491a351eff1222fe84696b8272ea64f70eb 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php @@ -1,61 +1,11 @@ <?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\Node\Expression\Test\DefinedTest; -/** - * Checks if a variable is defined in the current context. - * - * <pre> - * {# defined works with variable names and variable attributes #} - * {% if foo is defined %} - * {# ... #} - * {% endif %} - * </pre> - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Expression_Test_Defined extends Twig_Node_Expression_Test -{ - public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno) - { - if ($node instanceof Twig_Node_Expression_Name) { - $node->setAttribute('is_defined_test', true); - } elseif ($node instanceof Twig_Node_Expression_GetAttr) { - $node->setAttribute('is_defined_test', true); - $this->changeIgnoreStrictCheck($node); - } elseif ($node instanceof Twig_Node_Expression_BlockReference) { - $node->setAttribute('is_defined_test', true); - } elseif ($node instanceof Twig_Node_Expression_Function && 'constant' === $node->getAttribute('name')) { - $node->setAttribute('is_defined_test', true); - } elseif ($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array) { - $node = new Twig_Node_Expression_Constant(true, $node->getTemplateLine()); - } else { - throw new Twig_Error_Syntax('The "defined" test only works with simple variables.', $this->getTemplateLine()); - } - - parent::__construct($node, $name, $arguments, $lineno); - } - - protected function changeIgnoreStrictCheck(Twig_Node_Expression_GetAttr $node) - { - $node->setAttribute('ignore_strict_check', true); - - if ($node->getNode('node') instanceof Twig_Node_Expression_GetAttr) { - $this->changeIgnoreStrictCheck($node->getNode('node')); - } - } +class_exists('Twig\Node\Expression\Test\DefinedTest'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_Test_Defined extends DefinedTest { - $compiler->subcompile($this->getNode('node')); } } - -class_alias('Twig_Node_Expression_Test_Defined', 'Twig\Node\Expression\Test\DefinedTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php index a5d71961a8e3a8aacb2f8ca07ba3c939d10c9318..c999e9e174b88a57cd8c2ec077c30ea96e1d4f4a 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php @@ -1,35 +1,11 @@ <?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\Node\Expression\Test\DivisiblebyTest; -/** - * Checks if a variable is divisible by a number. - * - * <pre> - * {% if loop.index is divisible by(3) %} - * </pre> - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Expression_Test_Divisibleby extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Test\DivisiblebyTest'); + +if (\false) { + class Twig_Node_Expression_Test_Divisibleby extends DivisiblebyTest { - $compiler - ->raw('(0 == ') - ->subcompile($this->getNode('node')) - ->raw(' % ') - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw(')') - ; } } - -class_alias('Twig_Node_Expression_Test_Divisibleby', 'Twig\Node\Expression\Test\DivisiblebyTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php index 7e198bea67480f153346b714d92431ad86d9d2c2..a751079dbaa43852df005c8e97fbdf15a07e2522 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php @@ -1,34 +1,11 @@ <?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\Node\Expression\Test\EvenTest; -/** - * Checks if a number is even. - * - * <pre> - * {{ var is even }} - * </pre> - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Expression_Test_Even extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Test\EvenTest'); + +if (\false) { + class Twig_Node_Expression_Test_Even extends EvenTest { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 == 0') - ->raw(')') - ; } } - -class_alias('Twig_Node_Expression_Test_Even', 'Twig\Node\Expression\Test\EvenTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php index 3746e4cbd30f7e0b1a81a073c9a60ea03357c65a..404360ee2e151d4e8ad20087758aaae03accf603 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php @@ -1,33 +1,11 @@ <?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\Node\Expression\Test\NullTest; -/** - * Checks that a variable is null. - * - * <pre> - * {{ var is none }} - * </pre> - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Test\NullTest'); + +if (\false) { + class Twig_Node_Expression_Test_Null extends NullTest { - $compiler - ->raw('(null === ') - ->subcompile($this->getNode('node')) - ->raw(')') - ; } } - -class_alias('Twig_Node_Expression_Test_Null', 'Twig\Node\Expression\Test\NullTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php index 0c6c099bbcad430a9b272e9bcc0f7c4d8323a7dd..7a06ac59a5b86ec4282bf94a310422c904f06d00 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php @@ -1,34 +1,11 @@ <?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\Node\Expression\Test\OddTest; -/** - * Checks if a number is odd. - * - * <pre> - * {{ var is odd }} - * </pre> - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Test\OddTest'); + +if (\false) { + class Twig_Node_Expression_Test_Odd extends OddTest { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 == 1') - ->raw(')') - ; } } - -class_alias('Twig_Node_Expression_Test_Odd', 'Twig\Node\Expression\Test\OddTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php index e95ff1f20c7f4e0a67e3feb0bf361c113ca0a2ff..c937d712158e4647fec274bb7efbd58ab11f1a4a 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php @@ -1,31 +1,11 @@ <?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\Node\Expression\Test\SameasTest; -/** - * Checks if a variable is the same as another one (=== in PHP). - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) +class_exists('Twig\Node\Expression\Test\SameasTest'); + +if (\false) { + class Twig_Node_Expression_Test_Sameas extends SameasTest { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' === ') - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw(')') - ; } } - -class_alias('Twig_Node_Expression_Test_Sameas', 'Twig\Node\Expression\Test\SameasTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php b/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php index 5804485e3ecaf31f036516edf48b7fcb289a8c8d..1969d2c7663bdfb23a183a98f8b0bca5e04ba331 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php @@ -1,29 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -abstract class Twig_Node_Expression_Unary extends Twig_Node_Expression -{ - public function __construct(Twig_NodeInterface $node, $lineno) - { - parent::__construct(array('node' => $node), array(), $lineno); - } +use Twig\Node\Expression\Unary\AbstractUnary; + +class_exists('Twig\Node\Expression\Unary\AbstractUnary'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Expression_Unary extends AbstractUnary { - $compiler->raw(' '); - $this->operator($compiler); - $compiler->subcompile($this->getNode('node')); } - - abstract public function operator(Twig_Compiler $compiler); } - -class_alias('Twig_Node_Expression_Unary', 'Twig\Node\Expression\Unary\AbstractUnary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php b/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php index 039d933d9314f024a533f6addd746dcdaeb9f8c0..e6c25a01c4d7670e92e30e395369f9e0458ade94 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Unary_Neg extends Twig_Node_Expression_Unary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Unary\NegUnary; + +class_exists('Twig\Node\Expression\Unary\NegUnary'); + +if (\false) { + class Twig_Node_Expression_Unary_Neg extends NegUnary { - $compiler->raw('-'); } } - -class_alias('Twig_Node_Expression_Unary_Neg', 'Twig\Node\Expression\Unary\NegUnary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php b/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php index a0860b1838e53b815de268b9ba3116361e08cb2e..669105f36862eaca541e07f56a6fe89e3f161fa7 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Unary_Not extends Twig_Node_Expression_Unary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Unary\NotUnary; + +class_exists('Twig\Node\Expression\Unary\NotUnary'); + +if (\false) { + class Twig_Node_Expression_Unary_Not extends NotUnary { - $compiler->raw('!'); } } - -class_alias('Twig_Node_Expression_Unary_Not', 'Twig\Node\Expression\Unary\NotUnary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php b/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php index eeff5452fff98ddbf4218f34ef68edb1f583d09c..4e2bb504df01d98d8f2185a28168b686e1322a29 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php @@ -1,20 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class Twig_Node_Expression_Unary_Pos extends Twig_Node_Expression_Unary -{ - public function operator(Twig_Compiler $compiler) +use Twig\Node\Expression\Unary\PosUnary; + +class_exists('Twig\Node\Expression\Unary\PosUnary'); + +if (\false) { + class Twig_Node_Expression_Unary_Pos extends PosUnary { - $compiler->raw('+'); } } - -class_alias('Twig_Node_Expression_Unary_Pos', 'Twig\Node\Expression\Unary\PosUnary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Flush.php b/vendor/twig/twig/lib/Twig/Node/Flush.php index fcc461ac000a293d9a55b80cedad0fc431b65a06..92af475b74db4b820eafe43fc50029328217231a 100644 --- a/vendor/twig/twig/lib/Twig/Node/Flush.php +++ b/vendor/twig/twig/lib/Twig/Node/Flush.php @@ -1,33 +1,11 @@ <?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\Node\FlushNode; -/** - * Represents a flush node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Flush extends Twig_Node -{ - public function __construct($lineno, $tag) - { - parent::__construct(array(), array(), $lineno, $tag); - } +class_exists('Twig\Node\FlushNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Flush extends FlushNode { - $compiler - ->addDebugInfo($this) - ->write("flush();\n") - ; } } - -class_alias('Twig_Node_Flush', 'Twig\Node\FlushNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/For.php b/vendor/twig/twig/lib/Twig/Node/For.php index 914b70c984a31dbd1bf00a0598fe2577415d22f0..c72aa782b11b081ce072f74c9ba4b29dfa78ab1f 100644 --- a/vendor/twig/twig/lib/Twig/Node/For.php +++ b/vendor/twig/twig/lib/Twig/Node/For.php @@ -1,113 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\ForNode; -/** - * Represents a for node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_For extends Twig_Node -{ - protected $loop; +class_exists('Twig\Node\ForNode'); - public function __construct(Twig_Node_Expression_AssignName $keyTarget, Twig_Node_Expression_AssignName $valueTarget, Twig_Node_Expression $seq, Twig_Node_Expression $ifexpr = null, Twig_NodeInterface $body, Twig_NodeInterface $else = null, $lineno, $tag = null) +if (\false) { + class Twig_Node_For extends ForNode { - $body = new Twig_Node(array($body, $this->loop = new Twig_Node_ForLoop($lineno, $tag))); - - if (null !== $ifexpr) { - $body = new Twig_Node_If(new Twig_Node(array($ifexpr, $body)), null, $lineno, $tag); - } - - $nodes = array('key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body); - if (null !== $else) { - $nodes['else'] = $else; - } - - parent::__construct($nodes, array('with_loop' => true, 'ifexpr' => null !== $ifexpr), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write("\$context['_parent'] = \$context;\n") - ->write("\$context['_seq'] = twig_ensure_traversable(") - ->subcompile($this->getNode('seq')) - ->raw(");\n") - ; - - if ($this->hasNode('else')) { - $compiler->write("\$context['_iterated'] = false;\n"); - } - - if ($this->getAttribute('with_loop')) { - $compiler - ->write("\$context['loop'] = array(\n") - ->write(" 'parent' => \$context['_parent'],\n") - ->write(" 'index0' => 0,\n") - ->write(" 'index' => 1,\n") - ->write(" 'first' => true,\n") - ->write(");\n") - ; - - if (!$this->getAttribute('ifexpr')) { - $compiler - ->write("if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) {\n") - ->indent() - ->write("\$length = count(\$context['_seq']);\n") - ->write("\$context['loop']['revindex0'] = \$length - 1;\n") - ->write("\$context['loop']['revindex'] = \$length;\n") - ->write("\$context['loop']['length'] = \$length;\n") - ->write("\$context['loop']['last'] = 1 === \$length;\n") - ->outdent() - ->write("}\n") - ; - } - } - - $this->loop->setAttribute('else', $this->hasNode('else')); - $this->loop->setAttribute('with_loop', $this->getAttribute('with_loop')); - $this->loop->setAttribute('ifexpr', $this->getAttribute('ifexpr')); - - $compiler - ->write("foreach (\$context['_seq'] as ") - ->subcompile($this->getNode('key_target')) - ->raw(' => ') - ->subcompile($this->getNode('value_target')) - ->raw(") {\n") - ->indent() - ->subcompile($this->getNode('body')) - ->outdent() - ->write("}\n") - ; - - if ($this->hasNode('else')) { - $compiler - ->write("if (!\$context['_iterated']) {\n") - ->indent() - ->subcompile($this->getNode('else')) - ->outdent() - ->write("}\n") - ; - } - - $compiler->write("\$_parent = \$context['_parent'];\n"); - - // remove some "private" loop variables (needed for nested loops) - $compiler->write('unset($context[\'_seq\'], $context[\'_iterated\'], $context[\''.$this->getNode('key_target')->getAttribute('name').'\'], $context[\''.$this->getNode('value_target')->getAttribute('name').'\'], $context[\'_parent\'], $context[\'loop\']);'."\n"); - - // keep the values set in the inner context for variables defined in the outer context - $compiler->write("\$context = array_intersect_key(\$context, \$_parent) + \$_parent;\n"); } } - -class_alias('Twig_Node_For', 'Twig\Node\ForNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/ForLoop.php b/vendor/twig/twig/lib/Twig/Node/ForLoop.php index 06477cf1fe155668772fcb4839ee6145a6d0032c..5b21005270b9387d1fc6c2524070ef19ca8e4ef1 100644 --- a/vendor/twig/twig/lib/Twig/Node/ForLoop.php +++ b/vendor/twig/twig/lib/Twig/Node/ForLoop.php @@ -1,52 +1,11 @@ <?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\Node\ForLoopNode; -/** - * Internal node used by the for node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_ForLoop extends Twig_Node -{ - public function __construct($lineno, $tag = null) - { - parent::__construct(array(), array('with_loop' => false, 'ifexpr' => false, 'else' => false), $lineno, $tag); - } +class_exists('Twig\Node\ForLoopNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_ForLoop extends ForLoopNode { - if ($this->getAttribute('else')) { - $compiler->write("\$context['_iterated'] = true;\n"); - } - - if ($this->getAttribute('with_loop')) { - $compiler - ->write("++\$context['loop']['index0'];\n") - ->write("++\$context['loop']['index'];\n") - ->write("\$context['loop']['first'] = false;\n") - ; - - if (!$this->getAttribute('ifexpr')) { - $compiler - ->write("if (isset(\$context['loop']['length'])) {\n") - ->indent() - ->write("--\$context['loop']['revindex0'];\n") - ->write("--\$context['loop']['revindex'];\n") - ->write("\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n") - ->outdent() - ->write("}\n") - ; - } - } } } - -class_alias('Twig_Node_ForLoop', 'Twig\Node\ForLoopNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/If.php b/vendor/twig/twig/lib/Twig/Node/If.php index d82edec770d0cd1dc2ef72cd8253909030be0f6c..de884b345d8e51c9bd9edfd051c1bffb92dc4120 100644 --- a/vendor/twig/twig/lib/Twig/Node/If.php +++ b/vendor/twig/twig/lib/Twig/Node/If.php @@ -1,68 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\IfNode; -/** - * Represents an if node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_If extends Twig_Node -{ - public function __construct(Twig_NodeInterface $tests, Twig_NodeInterface $else = null, $lineno, $tag = null) - { - $nodes = array('tests' => $tests); - if (null !== $else) { - $nodes['else'] = $else; - } - - parent::__construct($nodes, array(), $lineno, $tag); - } +class_exists('Twig\Node\IfNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_If extends IfNode { - $compiler->addDebugInfo($this); - for ($i = 0, $count = count($this->getNode('tests')); $i < $count; $i += 2) { - if ($i > 0) { - $compiler - ->outdent() - ->write('} elseif (') - ; - } else { - $compiler - ->write('if (') - ; - } - - $compiler - ->subcompile($this->getNode('tests')->getNode($i)) - ->raw(") {\n") - ->indent() - ->subcompile($this->getNode('tests')->getNode($i + 1)) - ; - } - - if ($this->hasNode('else')) { - $compiler - ->outdent() - ->write("} else {\n") - ->indent() - ->subcompile($this->getNode('else')) - ; - } - - $compiler - ->outdent() - ->write("}\n"); } } - -class_alias('Twig_Node_If', 'Twig\Node\IfNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Import.php b/vendor/twig/twig/lib/Twig/Node/Import.php index c77e320b72d362f5e2c37e2271c9af1409bc542a..9d3892a68c76ce85b0b0d41e30d3c56be6cb9c87 100644 --- a/vendor/twig/twig/lib/Twig/Node/Import.php +++ b/vendor/twig/twig/lib/Twig/Node/Import.php @@ -1,51 +1,11 @@ <?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\Node\ImportNode; -/** - * Represents an import node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Import extends Twig_Node -{ - public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $var, $lineno, $tag = null) - { - parent::__construct(array('expr' => $expr, 'var' => $var), array(), $lineno, $tag); - } +class_exists('Twig\Node\ImportNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Import extends ImportNode { - $compiler - ->addDebugInfo($this) - ->write('') - ->subcompile($this->getNode('var')) - ->raw(' = ') - ; - - if ($this->getNode('expr') instanceof Twig_Node_Expression_Name && '_self' === $this->getNode('expr')->getAttribute('name')) { - $compiler->raw('$this'); - } else { - $compiler - ->raw('$this->loadTemplate(') - ->subcompile($this->getNode('expr')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(')') - ; - } - - $compiler->raw(";\n"); } } - -class_alias('Twig_Node_Import', 'Twig\Node\ImportNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Include.php b/vendor/twig/twig/lib/Twig/Node/Include.php index 2a5114cb87aa521d8013160cbe50c735f23cb7b2..f43d203bc17ee8bf91aa83d02c2d50a64a5489ba 100644 --- a/vendor/twig/twig/lib/Twig/Node/Include.php +++ b/vendor/twig/twig/lib/Twig/Node/Include.php @@ -1,90 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\IncludeNode; -/** - * Represents an include node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) - { - $nodes = array('expr' => $expr); - if (null !== $variables) { - $nodes['variables'] = $variables; - } - - parent::__construct($nodes, array('only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - - if ($this->getAttribute('ignore_missing')) { - $compiler - ->write("try {\n") - ->indent() - ; - } - - $this->addGetTemplate($compiler); - - $compiler->raw('->display('); +class_exists('Twig\Node\IncludeNode'); - $this->addTemplateArguments($compiler); - - $compiler->raw(");\n"); - - if ($this->getAttribute('ignore_missing')) { - $compiler - ->outdent() - ->write("} catch (Twig_Error_Loader \$e) {\n") - ->indent() - ->write("// ignore missing template\n") - ->outdent() - ->write("}\n\n") - ; - } - } - - protected function addGetTemplate(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Include extends IncludeNode { - $compiler - ->write('$this->loadTemplate(') - ->subcompile($this->getNode('expr')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(')') - ; - } - - protected function addTemplateArguments(Twig_Compiler $compiler) - { - if (!$this->hasNode('variables')) { - $compiler->raw(false === $this->getAttribute('only') ? '$context' : 'array()'); - } elseif (false === $this->getAttribute('only')) { - $compiler - ->raw('array_merge($context, ') - ->subcompile($this->getNode('variables')) - ->raw(')') - ; - } else { - $compiler->subcompile($this->getNode('variables')); - } } } - -class_alias('Twig_Node_Include', 'Twig\Node\IncludeNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Macro.php b/vendor/twig/twig/lib/Twig/Node/Macro.php index 3cf5497704459b312e88ef2bfd29d2ed896579af..8d2389dfcfbc74ce9c31d32cdde347f7d2b7f679 100644 --- a/vendor/twig/twig/lib/Twig/Node/Macro.php +++ b/vendor/twig/twig/lib/Twig/Node/Macro.php @@ -1,125 +1,11 @@ <?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\Node\MacroNode; -/** - * Represents a macro node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Macro extends Twig_Node -{ - const VARARGS_NAME = 'varargs'; +class_exists('Twig\Node\MacroNode'); - public function __construct($name, Twig_NodeInterface $body, Twig_NodeInterface $arguments, $lineno, $tag = null) +if (\false) { + class Twig_Node_Macro extends MacroNode { - foreach ($arguments as $argumentName => $argument) { - if (self::VARARGS_NAME === $argumentName) { - throw new Twig_Error_Syntax(sprintf('The argument "%s" in macro "%s" cannot be defined because the variable "%s" is reserved for arbitrary arguments.', self::VARARGS_NAME, $name, self::VARARGS_NAME), $argument->getTemplateLine()); - } - } - - parent::__construct(array('body' => $body, 'arguments' => $arguments), array('name' => $name), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write(sprintf('public function get%s(', $this->getAttribute('name'))) - ; - - $count = count($this->getNode('arguments')); - $pos = 0; - foreach ($this->getNode('arguments') as $name => $default) { - $compiler - ->raw('$__'.$name.'__ = ') - ->subcompile($default) - ; - - if (++$pos < $count) { - $compiler->raw(', '); - } - } - - if (PHP_VERSION_ID >= 50600) { - if ($count) { - $compiler->raw(', '); - } - - $compiler->raw('...$__varargs__'); - } - - $compiler - ->raw(")\n") - ->write("{\n") - ->indent() - ; - - $compiler - ->write("\$context = \$this->env->mergeGlobals(array(\n") - ->indent() - ; - - foreach ($this->getNode('arguments') as $name => $default) { - $compiler - ->write('') - ->string($name) - ->raw(' => $__'.$name.'__') - ->raw(",\n") - ; - } - - $compiler - ->write('') - ->string(self::VARARGS_NAME) - ->raw(' => ') - ; - - if (PHP_VERSION_ID >= 50600) { - $compiler->raw("\$__varargs__,\n"); - } else { - $compiler - ->raw('func_num_args() > ') - ->repr($count) - ->raw(' ? array_slice(func_get_args(), ') - ->repr($count) - ->raw(") : array(),\n") - ; - } - - $compiler - ->outdent() - ->write("));\n\n") - ->write("\$blocks = array();\n\n") - ->write("ob_start();\n") - ->write("try {\n") - ->indent() - ->subcompile($this->getNode('body')) - ->outdent() - ->write("} catch (Exception \$e) {\n") - ->indent() - ->write("ob_end_clean();\n\n") - ->write("throw \$e;\n") - ->outdent() - ->write("} catch (Throwable \$e) {\n") - ->indent() - ->write("ob_end_clean();\n\n") - ->write("throw \$e;\n") - ->outdent() - ->write("}\n\n") - ->write("return ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset());\n") - ->outdent() - ->write("}\n\n") - ; } } - -class_alias('Twig_Node_Macro', 'Twig\Node\MacroNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Module.php b/vendor/twig/twig/lib/Twig/Node/Module.php index 5cd8d0502f60c9de753d9eb23532743edd6f5349..ca5276750f6e9e5a072f024df17ad1fdbfaa09ec 100644 --- a/vendor/twig/twig/lib/Twig/Node/Module.php +++ b/vendor/twig/twig/lib/Twig/Node/Module.php @@ -1,461 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\ModuleNode; -/** - * Represents a module node. - * - * Consider this class as being final. If you need to customize the behavior of - * the generated class, consider adding nodes to the following nodes: display_start, - * display_end, constructor_start, constructor_end, and class_end. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Module extends Twig_Node -{ - private $source; +class_exists('Twig\Node\ModuleNode'); - public function __construct(Twig_NodeInterface $body, Twig_Node_Expression $parent = null, Twig_NodeInterface $blocks, Twig_NodeInterface $macros, Twig_NodeInterface $traits, $embeddedTemplates, $name, $source = '') +if (\false) { + class Twig_Node_Module extends ModuleNode { - if (!$name instanceof Twig_Source) { - @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED); - $this->source = new Twig_Source($source, $name); - } else { - $this->source = $name; - } - - $nodes = array( - 'body' => $body, - 'blocks' => $blocks, - 'macros' => $macros, - 'traits' => $traits, - 'display_start' => new Twig_Node(), - 'display_end' => new Twig_Node(), - 'constructor_start' => new Twig_Node(), - 'constructor_end' => new Twig_Node(), - 'class_end' => new Twig_Node(), - ); - if (null !== $parent) { - $nodes['parent'] = $parent; - } - - // embedded templates are set as attributes so that they are only visited once by the visitors - parent::__construct($nodes, array( - // source to be remove in 2.0 - 'source' => $this->source->getCode(), - // filename to be remove in 2.0 (use getTemplateName() instead) - 'filename' => $this->source->getName(), - 'index' => null, - 'embedded_templates' => $embeddedTemplates, - ), 1); - - // populate the template name of all node children - $this->setTemplateName($this->source->getName()); - } - - public function setIndex($index) - { - $this->setAttribute('index', $index); - } - - public function compile(Twig_Compiler $compiler) - { - $this->compileTemplate($compiler); - - foreach ($this->getAttribute('embedded_templates') as $template) { - $compiler->subcompile($template); - } - } - - protected function compileTemplate(Twig_Compiler $compiler) - { - if (!$this->getAttribute('index')) { - $compiler->write('<?php'); - } - - $this->compileClassHeader($compiler); - - if ( - count($this->getNode('blocks')) - || count($this->getNode('traits')) - || !$this->hasNode('parent') - || $this->getNode('parent') instanceof Twig_Node_Expression_Constant - || count($this->getNode('constructor_start')) - || count($this->getNode('constructor_end')) - ) { - $this->compileConstructor($compiler); - } - - $this->compileGetParent($compiler); - - $this->compileDisplay($compiler); - - $compiler->subcompile($this->getNode('blocks')); - - $this->compileMacros($compiler); - - $this->compileGetTemplateName($compiler); - - $this->compileIsTraitable($compiler); - - $this->compileDebugInfo($compiler); - - $this->compileGetSource($compiler); - - $this->compileGetSourceContext($compiler); - - $this->compileClassFooter($compiler); - } - - protected function compileGetParent(Twig_Compiler $compiler) - { - if (!$this->hasNode('parent')) { - return; - } - $parent = $this->getNode('parent'); - - $compiler - ->write("protected function doGetParent(array \$context)\n", "{\n") - ->indent() - ->addDebugInfo($parent) - ->write('return ') - ; - - if ($parent instanceof Twig_Node_Expression_Constant) { - $compiler->subcompile($parent); - } else { - $compiler - ->raw('$this->loadTemplate(') - ->subcompile($parent) - ->raw(', ') - ->repr($this->source->getName()) - ->raw(', ') - ->repr($parent->getTemplateLine()) - ->raw(')') - ; - } - - $compiler - ->raw(";\n") - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileClassHeader(Twig_Compiler $compiler) - { - $compiler - ->write("\n\n") - // if the template name contains */, add a blank to avoid a PHP parse error - ->write('/* '.str_replace('*/', '* /', $this->source->getName())." */\n") - ->write('class '.$compiler->getEnvironment()->getTemplateClass($this->source->getName(), $this->getAttribute('index'))) - ->raw(sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass())) - ->write("{\n") - ->indent() - ; - } - - protected function compileConstructor(Twig_Compiler $compiler) - { - $compiler - ->write("public function __construct(Twig_Environment \$env)\n", "{\n") - ->indent() - ->subcompile($this->getNode('constructor_start')) - ->write("parent::__construct(\$env);\n\n") - ; - - // parent - if (!$this->hasNode('parent')) { - $compiler->write("\$this->parent = false;\n\n"); - } elseif (($parent = $this->getNode('parent')) && $parent instanceof Twig_Node_Expression_Constant) { - $compiler - ->addDebugInfo($parent) - ->write('$this->parent = $this->loadTemplate(') - ->subcompile($parent) - ->raw(', ') - ->repr($this->source->getName()) - ->raw(', ') - ->repr($parent->getTemplateLine()) - ->raw(");\n") - ; - } - - $countTraits = count($this->getNode('traits')); - if ($countTraits) { - // traits - foreach ($this->getNode('traits') as $i => $trait) { - $this->compileLoadTemplate($compiler, $trait->getNode('template'), sprintf('$_trait_%s', $i)); - - $compiler - ->addDebugInfo($trait->getNode('template')) - ->write(sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i)) - ->indent() - ->write("throw new Twig_Error_Runtime('Template \"'.") - ->subcompile($trait->getNode('template')) - ->raw(".'\" cannot be used as a trait.');\n") - ->outdent() - ->write("}\n") - ->write(sprintf("\$_trait_%s_blocks = \$_trait_%s->getBlocks();\n\n", $i, $i)) - ; - - foreach ($trait->getNode('targets') as $key => $value) { - $compiler - ->write(sprintf('if (!isset($_trait_%s_blocks[', $i)) - ->string($key) - ->raw("])) {\n") - ->indent() - ->write("throw new Twig_Error_Runtime(sprintf('Block ") - ->string($key) - ->raw(' is not defined in trait ') - ->subcompile($trait->getNode('template')) - ->raw(".'));\n") - ->outdent() - ->write("}\n\n") - - ->write(sprintf('$_trait_%s_blocks[', $i)) - ->subcompile($value) - ->raw(sprintf('] = $_trait_%s_blocks[', $i)) - ->string($key) - ->raw(sprintf(']; unset($_trait_%s_blocks[', $i)) - ->string($key) - ->raw("]);\n\n") - ; - } - } - - if ($countTraits > 1) { - $compiler - ->write("\$this->traits = array_merge(\n") - ->indent() - ; - - for ($i = 0; $i < $countTraits; ++$i) { - $compiler - ->write(sprintf('$_trait_%s_blocks'.($i == $countTraits - 1 ? '' : ',')."\n", $i)) - ; - } - - $compiler - ->outdent() - ->write(");\n\n") - ; - } else { - $compiler - ->write("\$this->traits = \$_trait_0_blocks;\n\n") - ; - } - - $compiler - ->write("\$this->blocks = array_merge(\n") - ->indent() - ->write("\$this->traits,\n") - ->write("array(\n") - ; - } else { - $compiler - ->write("\$this->blocks = array(\n") - ; - } - - // blocks - $compiler - ->indent() - ; - - foreach ($this->getNode('blocks') as $name => $node) { - $compiler - ->write(sprintf("'%s' => array(\$this, 'block_%s'),\n", $name, $name)) - ; - } - - if ($countTraits) { - $compiler - ->outdent() - ->write(")\n") - ; - } - - $compiler - ->outdent() - ->write(");\n") - ->outdent() - ->subcompile($this->getNode('constructor_end')) - ->write("}\n\n") - ; - } - - protected function compileDisplay(Twig_Compiler $compiler) - { - $compiler - ->write("protected function doDisplay(array \$context, array \$blocks = array())\n", "{\n") - ->indent() - ->subcompile($this->getNode('display_start')) - ->subcompile($this->getNode('body')) - ; - - if ($this->hasNode('parent')) { - $parent = $this->getNode('parent'); - $compiler->addDebugInfo($parent); - if ($parent instanceof Twig_Node_Expression_Constant) { - $compiler->write('$this->parent'); - } else { - $compiler->write('$this->getParent($context)'); - } - $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n"); - } - - $compiler - ->subcompile($this->getNode('display_end')) - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileClassFooter(Twig_Compiler $compiler) - { - $compiler - ->subcompile($this->getNode('class_end')) - ->outdent() - ->write("}\n") - ; - } - - protected function compileMacros(Twig_Compiler $compiler) - { - $compiler->subcompile($this->getNode('macros')); - } - - protected function compileGetTemplateName(Twig_Compiler $compiler) - { - $compiler - ->write("public function getTemplateName()\n", "{\n") - ->indent() - ->write('return ') - ->repr($this->source->getName()) - ->raw(";\n") - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileIsTraitable(Twig_Compiler $compiler) - { - // A template can be used as a trait if: - // * it has no parent - // * it has no macros - // * it has no body - // - // Put another way, a template can be used as a trait if it - // only contains blocks and use statements. - $traitable = !$this->hasNode('parent') && 0 === count($this->getNode('macros')); - if ($traitable) { - if ($this->getNode('body') instanceof Twig_Node_Body) { - $nodes = $this->getNode('body')->getNode(0); - } else { - $nodes = $this->getNode('body'); - } - - if (!count($nodes)) { - $nodes = new Twig_Node(array($nodes)); - } - - foreach ($nodes as $node) { - if (!count($node)) { - continue; - } - - if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) { - continue; - } - - if ($node instanceof Twig_Node_BlockReference) { - continue; - } - - $traitable = false; - break; - } - } - - if ($traitable) { - return; - } - - $compiler - ->write("public function isTraitable()\n", "{\n") - ->indent() - ->write(sprintf("return %s;\n", $traitable ? 'true' : 'false')) - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileDebugInfo(Twig_Compiler $compiler) - { - $compiler - ->write("public function getDebugInfo()\n", "{\n") - ->indent() - ->write(sprintf("return %s;\n", str_replace("\n", '', var_export(array_reverse($compiler->getDebugInfo(), true), true)))) - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileGetSource(Twig_Compiler $compiler) - { - $compiler - ->write("/** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */\n") - ->write("public function getSource()\n", "{\n") - ->indent() - ->write("@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);\n\n") - ->write('return $this->getSourceContext()->getCode();') - ->raw("\n") - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileGetSourceContext(Twig_Compiler $compiler) - { - $compiler - ->write("public function getSourceContext()\n", "{\n") - ->indent() - ->write('return new Twig_Source(') - ->string($compiler->getEnvironment()->isDebug() ? $this->source->getCode() : '') - ->raw(', ') - ->string($this->source->getName()) - ->raw(', ') - ->string($this->source->getPath()) - ->raw(");\n") - ->outdent() - ->write("}\n") - ; - } - - protected function compileLoadTemplate(Twig_Compiler $compiler, $node, $var) - { - if ($node instanceof Twig_Node_Expression_Constant) { - $compiler - ->write(sprintf('%s = $this->loadTemplate(', $var)) - ->subcompile($node) - ->raw(', ') - ->repr($node->getTemplateName()) - ->raw(', ') - ->repr($node->getTemplateLine()) - ->raw(");\n") - ; - } else { - throw new LogicException('Trait templates can only be constant nodes.'); - } } } - -class_alias('Twig_Node_Module', 'Twig\Node\ModuleNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Print.php b/vendor/twig/twig/lib/Twig/Node/Print.php index 374db89b7cac9ac490b9ba1328480d718358bec2..65a605e7e7d32838c23b39e6fa0fdd70036f442c 100644 --- a/vendor/twig/twig/lib/Twig/Node/Print.php +++ b/vendor/twig/twig/lib/Twig/Node/Print.php @@ -1,36 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\PrintNode; -/** - * Represents a node that outputs an expression. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Print extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) - { - parent::__construct(array('expr' => $expr), array(), $lineno, $tag); - } +class_exists('Twig\Node\PrintNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Print extends PrintNode { - $compiler - ->addDebugInfo($this) - ->write('echo ') - ->subcompile($this->getNode('expr')) - ->raw(";\n") - ; } } - -class_alias('Twig_Node_Print', 'Twig\Node\PrintNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Sandbox.php b/vendor/twig/twig/lib/Twig/Node/Sandbox.php index 44b30ab9c73073b9970d4a2f31d4b062e2c81fd3..3ff57ff7d9dd147b64ce3a8893ef827dd31cb026 100644 --- a/vendor/twig/twig/lib/Twig/Node/Sandbox.php +++ b/vendor/twig/twig/lib/Twig/Node/Sandbox.php @@ -1,44 +1,11 @@ <?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\Node\SandboxNode; -/** - * Represents a sandbox node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Sandbox extends Twig_Node -{ - public function __construct(Twig_NodeInterface $body, $lineno, $tag = null) - { - parent::__construct(array('body' => $body), array(), $lineno, $tag); - } +class_exists('Twig\Node\SandboxNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Sandbox extends SandboxNode { - $compiler - ->addDebugInfo($this) - ->write("\$sandbox = \$this->env->getExtension('Twig_Extension_Sandbox');\n") - ->write("if (!\$alreadySandboxed = \$sandbox->isSandboxed()) {\n") - ->indent() - ->write("\$sandbox->enableSandbox();\n") - ->outdent() - ->write("}\n") - ->subcompile($this->getNode('body')) - ->write("if (!\$alreadySandboxed) {\n") - ->indent() - ->write("\$sandbox->disableSandbox();\n") - ->outdent() - ->write("}\n") - ; } } - -class_alias('Twig_Node_Sandbox', 'Twig\Node\SandboxNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php b/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php index a08f21f5676c21762398e4ea4496c004a47d34f3..a223eeb2cac6b08122767f857ef7c065d89e782b 100644 --- a/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php +++ b/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php @@ -1,51 +1,11 @@ <?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\Node\SandboxedPrintNode; -/** - * Twig_Node_SandboxedPrint adds a check for the __toString() method - * when the variable is an object and the sandbox is activated. - * - * When there is a simple Print statement, like {{ article }}, - * and if the sandbox is enabled, we need to check that the __toString() - * method is allowed if 'article' is an object. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_SandboxedPrint extends Twig_Node_Print -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('echo $this->env->getExtension(\'Twig_Extension_Sandbox\')->ensureToStringAllowed(') - ->subcompile($this->getNode('expr')) - ->raw(");\n") - ; - } +class_exists('Twig\Node\SandboxedPrintNode'); - /** - * Removes node filters. - * - * This is mostly needed when another visitor adds filters (like the escaper one). - * - * @return Twig_Node - */ - protected function removeNodeFilter(Twig_Node $node) +if (\false) { + class Twig_Node_SandboxedPrint extends SandboxedPrintNode { - if ($node instanceof Twig_Node_Expression_Filter) { - return $this->removeNodeFilter($node->getNode('node')); - } - - return $node; } } - -class_alias('Twig_Node_SandboxedPrint', 'Twig\Node\SandboxedPrintNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Set.php b/vendor/twig/twig/lib/Twig/Node/Set.php index 6c6743eeb3f5c142518f47d3a88aaabbd412a74f..5b0a6d4f1cd6a391af00c180d906d1ac0382b233 100644 --- a/vendor/twig/twig/lib/Twig/Node/Set.php +++ b/vendor/twig/twig/lib/Twig/Node/Set.php @@ -1,98 +1,11 @@ <?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\Node\SetNode; -/** - * Represents a set node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Set extends Twig_Node implements Twig_NodeCaptureInterface -{ - public function __construct($capture, Twig_NodeInterface $names, Twig_NodeInterface $values, $lineno, $tag = null) - { - parent::__construct(array('names' => $names, 'values' => $values), array('capture' => $capture, 'safe' => false), $lineno, $tag); - - /* - * Optimizes the node when capture is used for a large block of text. - * - * {% set foo %}foo{% endset %} is compiled to $context['foo'] = new Twig_Markup("foo"); - */ - if ($this->getAttribute('capture')) { - $this->setAttribute('safe', true); - - $values = $this->getNode('values'); - if ($values instanceof Twig_Node_Text) { - $this->setNode('values', new Twig_Node_Expression_Constant($values->getAttribute('data'), $values->getTemplateLine())); - $this->setAttribute('capture', false); - } - } - } +class_exists('Twig\Node\SetNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Set extends SetNode { - $compiler->addDebugInfo($this); - - if (count($this->getNode('names')) > 1) { - $compiler->write('list('); - foreach ($this->getNode('names') as $idx => $node) { - if ($idx) { - $compiler->raw(', '); - } - - $compiler->subcompile($node); - } - $compiler->raw(')'); - } else { - if ($this->getAttribute('capture')) { - $compiler - ->write("ob_start();\n") - ->subcompile($this->getNode('values')) - ; - } - - $compiler->subcompile($this->getNode('names'), false); - - if ($this->getAttribute('capture')) { - $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset())"); - } - } - - if (!$this->getAttribute('capture')) { - $compiler->raw(' = '); - - if (count($this->getNode('names')) > 1) { - $compiler->write('array('); - foreach ($this->getNode('values') as $idx => $value) { - if ($idx) { - $compiler->raw(', '); - } - - $compiler->subcompile($value); - } - $compiler->raw(')'); - } else { - if ($this->getAttribute('safe')) { - $compiler - ->raw("('' === \$tmp = ") - ->subcompile($this->getNode('values')) - ->raw(") ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset())") - ; - } else { - $compiler->subcompile($this->getNode('values')); - } - } - } - - $compiler->raw(";\n"); } } - -class_alias('Twig_Node_Set', 'Twig\Node\SetNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/SetTemp.php b/vendor/twig/twig/lib/Twig/Node/SetTemp.php index 996fdcde75001244f3d29f9bf273ac2587517715..211ab4ec5e733e7f62b5dc8551f1a9e01c0aa472 100644 --- a/vendor/twig/twig/lib/Twig/Node/SetTemp.php +++ b/vendor/twig/twig/lib/Twig/Node/SetTemp.php @@ -1,40 +1,11 @@ <?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\Node\SetTempNode; -/** - * @internal - */ -class Twig_Node_SetTemp extends Twig_Node -{ - public function __construct($name, $lineno) - { - parent::__construct(array(), array('name' => $name), $lineno); - } +class_exists('Twig\Node\SetTempNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_SetTemp extends SetTempNode { - $name = $this->getAttribute('name'); - $compiler - ->addDebugInfo($this) - ->write('if (isset($context[') - ->string($name) - ->raw('])) { $_') - ->raw($name) - ->raw('_ = $context[') - ->repr($name) - ->raw(']; } else { $_') - ->raw($name) - ->raw("_ = null; }\n") - ; } } - -class_alias('Twig_Node_SetTemp', 'Twig\Node\SetTempNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Spaceless.php b/vendor/twig/twig/lib/Twig/Node/Spaceless.php index 76f90cde53ea210a2b70bbac399a2975981e95fc..0ae024c3f53a5b72a75349cc921b24f6ba4ea4dc 100644 --- a/vendor/twig/twig/lib/Twig/Node/Spaceless.php +++ b/vendor/twig/twig/lib/Twig/Node/Spaceless.php @@ -1,37 +1,11 @@ <?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\Node\SpacelessNode; -/** - * Represents a spaceless node. - * - * It removes spaces between HTML tags. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Spaceless extends Twig_Node -{ - public function __construct(Twig_NodeInterface $body, $lineno, $tag = 'spaceless') - { - parent::__construct(array('body' => $body), array(), $lineno, $tag); - } +class_exists('Twig\Node\SpacelessNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Spaceless extends SpacelessNode { - $compiler - ->addDebugInfo($this) - ->write("ob_start();\n") - ->subcompile($this->getNode('body')) - ->write("echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));\n") - ; } } - -class_alias('Twig_Node_Spaceless', 'Twig\Node\SpacelessNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Text.php b/vendor/twig/twig/lib/Twig/Node/Text.php index f4577fee2b8f3adbf9ab053bd86a44f486596f6d..1a3f956fff4535208c6e5ced442b1f9ec5e20cbf 100644 --- a/vendor/twig/twig/lib/Twig/Node/Text.php +++ b/vendor/twig/twig/lib/Twig/Node/Text.php @@ -1,36 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Node\TextNode; -/** - * Represents a text node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_Text extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct($data, $lineno) - { - parent::__construct(array(), array('data' => $data), $lineno); - } +class_exists('Twig\Node\TextNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_Text extends TextNode { - $compiler - ->addDebugInfo($this) - ->write('echo ') - ->string($this->getAttribute('data')) - ->raw(";\n") - ; } } - -class_alias('Twig_Node_Text', 'Twig\Node\TextNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/With.php b/vendor/twig/twig/lib/Twig/Node/With.php index 2ab0ea5d7c80ac2e71904c3377e1b76edd1f07aa..266240d6acd301a3533b2c73a69ac5a78f378bda 100644 --- a/vendor/twig/twig/lib/Twig/Node/With.php +++ b/vendor/twig/twig/lib/Twig/Node/With.php @@ -1,64 +1,11 @@ <?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\Node\WithNode; -/** - * Represents a nested "with" scope. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Node_With extends Twig_Node -{ - public function __construct(Twig_Node $body, Twig_Node $variables = null, $only = false, $lineno, $tag = null) - { - $nodes = array('body' => $body); - if (null !== $variables) { - $nodes['variables'] = $variables; - } - - parent::__construct($nodes, array('only' => (bool) $only), $lineno, $tag); - } +class_exists('Twig\Node\WithNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Node_With extends WithNode { - $compiler->addDebugInfo($this); - - if ($this->hasNode('variables')) { - $varsName = $compiler->getVarName(); - $compiler - ->write(sprintf('$%s = ', $varsName)) - ->subcompile($this->getNode('variables')) - ->raw(";\n") - ->write(sprintf("if (!is_array(\$%s)) {\n", $varsName)) - ->indent() - ->write("throw new Twig_Error_Runtime('Variables passed to the \"with\" tag must be a hash.');\n") - ->outdent() - ->write("}\n") - ; - - if ($this->getAttribute('only')) { - $compiler->write("\$context = array('_parent' => \$context);\n"); - } else { - $compiler->write("\$context['_parent'] = \$context;\n"); - } - - $compiler->write(sprintf("\$context = array_merge(\$context, \$%s);\n", $varsName)); - } else { - $compiler->write("\$context['_parent'] = \$context;\n"); - } - - $compiler - ->subcompile($this->getNode('body')) - ->write("\$context = \$context['_parent'];\n") - ; } } - -class_alias('Twig_Node_With', 'Twig\Node\WithNode', false); diff --git a/vendor/twig/twig/lib/Twig/NodeCaptureInterface.php b/vendor/twig/twig/lib/Twig/NodeCaptureInterface.php index 6638834b12359f793cd64eaeb3489689db1db493..696f4a59f8ab90c484d53c74d536cf2f5acd809a 100644 --- a/vendor/twig/twig/lib/Twig/NodeCaptureInterface.php +++ b/vendor/twig/twig/lib/Twig/NodeCaptureInterface.php @@ -1,21 +1,11 @@ <?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\Node\NodeCaptureInterface; -/** - * Represents a node that captures any nested displayable nodes. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -interface Twig_NodeCaptureInterface -{ -} +class_exists('Twig\Node\NodeCaptureInterface'); -class_alias('Twig_NodeCaptureInterface', 'Twig\Node\NodeCaptureInterface', false); +if (\false) { + class Twig_NodeCaptureInterface extends NodeCaptureInterface + { + } +} diff --git a/vendor/twig/twig/lib/Twig/NodeInterface.php b/vendor/twig/twig/lib/Twig/NodeInterface.php index 78e758bd4321d667648552995286201b0aed3647..b2b9d3295f9177bb8a2159951936358eace28d05 100644 --- a/vendor/twig/twig/lib/Twig/NodeInterface.php +++ b/vendor/twig/twig/lib/Twig/NodeInterface.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +use Twig\Compiler; + /** * Represents a node in the AST. * @@ -16,12 +18,12 @@ * * @deprecated since 1.12 (to be removed in 3.0) */ -interface Twig_NodeInterface extends Countable, IteratorAggregate +interface Twig_NodeInterface extends \Countable, \IteratorAggregate { /** * Compiles the node to PHP. */ - public function compile(Twig_Compiler $compiler); + public function compile(Compiler $compiler); /** * @deprecated since 1.27 (to be removed in 2.0) diff --git a/vendor/twig/twig/lib/Twig/NodeOutputInterface.php b/vendor/twig/twig/lib/Twig/NodeOutputInterface.php index 5a8eaa9c3d948146aad88ed72b554cd586ded4c9..54009c0a677926093e5359051c027fd094738da7 100644 --- a/vendor/twig/twig/lib/Twig/NodeOutputInterface.php +++ b/vendor/twig/twig/lib/Twig/NodeOutputInterface.php @@ -1,21 +1,11 @@ <?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\Node\NodeOutputInterface; -/** - * Represents a displayable node in the AST. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -interface Twig_NodeOutputInterface -{ -} +class_exists('Twig\Node\NodeOutputInterface'); -class_alias('Twig_NodeOutputInterface', 'Twig\Node\NodeOutputInterface', false); +if (\false) { + class Twig_NodeOutputInterface extends NodeOutputInterface + { + } +} diff --git a/vendor/twig/twig/lib/Twig/NodeTraverser.php b/vendor/twig/twig/lib/Twig/NodeTraverser.php index 787629ce3449cc25d54ceaa33557ea56d12a8b0c..1e52a6a27189bd6ad13bb70af886496bc22474ed 100644 --- a/vendor/twig/twig/lib/Twig/NodeTraverser.php +++ b/vendor/twig/twig/lib/Twig/NodeTraverser.php @@ -1,84 +1,11 @@ <?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; -/** - * Twig_NodeTraverser is a node traverser. - * - * It visits all nodes and their children and calls the given visitor for each. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_NodeTraverser -{ - protected $env; - protected $visitors = array(); +class_exists('Twig\NodeTraverser'); - /** - * @param Twig_Environment $env - * @param Twig_NodeVisitorInterface[] $visitors - */ - public function __construct(Twig_Environment $env, array $visitors = array()) +if (\false) { + class Twig_NodeTraverser extends NodeTraverser { - $this->env = $env; - foreach ($visitors as $visitor) { - $this->addVisitor($visitor); - } - } - - public function addVisitor(Twig_NodeVisitorInterface $visitor) - { - if (!isset($this->visitors[$visitor->getPriority()])) { - $this->visitors[$visitor->getPriority()] = array(); - } - - $this->visitors[$visitor->getPriority()][] = $visitor; - } - - /** - * Traverses a node and calls the registered visitors. - * - * @return Twig_NodeInterface - */ - public function traverse(Twig_NodeInterface $node) - { - ksort($this->visitors); - foreach ($this->visitors as $visitors) { - foreach ($visitors as $visitor) { - $node = $this->traverseForVisitor($visitor, $node); - } - } - - return $node; - } - - protected function traverseForVisitor(Twig_NodeVisitorInterface $visitor, Twig_NodeInterface $node = null) - { - if (null === $node) { - return; - } - - $node = $visitor->enterNode($node, $this->env); - - foreach ($node as $k => $n) { - if (false !== $n = $this->traverseForVisitor($visitor, $n)) { - $node->setNode($k, $n); - } else { - $node->removeNode($k); - } - } - - return $visitor->leaveNode($node, $this->env); } } - -class_alias('Twig_NodeTraverser', 'Twig\NodeTraverser', false); diff --git a/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php b/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php index 1a1ae66f7584d6e916fe0d8d1fe247c9af68afd5..d8b877ed161ba2e9b2ff661297b3ce3e0fc455e9 100644 --- a/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php +++ b/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php @@ -1,154 +1,11 @@ <?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\NodeVisitor\EscaperNodeVisitor; -/** - * Twig_NodeVisitor_Escaper implements output escaping. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_NodeVisitor_Escaper extends Twig_BaseNodeVisitor -{ - protected $statusStack = array(); - protected $blocks = array(); - protected $safeAnalysis; - protected $traverser; - protected $defaultStrategy = false; - protected $safeVars = array(); +class_exists('Twig\NodeVisitor\EscaperNodeVisitor'); - public function __construct() +if (\false) { + class Twig_NodeVisitor_Escaper extends EscaperNodeVisitor { - $this->safeAnalysis = new Twig_NodeVisitor_SafeAnalysis(); - } - - protected function doEnterNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - if ($env->hasExtension('Twig_Extension_Escaper') && $defaultStrategy = $env->getExtension('Twig_Extension_Escaper')->getDefaultStrategy($node->getTemplateName())) { - $this->defaultStrategy = $defaultStrategy; - } - $this->safeVars = array(); - $this->blocks = array(); - } elseif ($node instanceof Twig_Node_AutoEscape) { - $this->statusStack[] = $node->getAttribute('value'); - } elseif ($node instanceof Twig_Node_Block) { - $this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env); - } elseif ($node instanceof Twig_Node_Import) { - $this->safeVars[] = $node->getNode('var')->getAttribute('name'); - } - - return $node; - } - - protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - $this->defaultStrategy = false; - $this->safeVars = array(); - $this->blocks = array(); - } elseif ($node instanceof Twig_Node_Expression_Filter) { - return $this->preEscapeFilterNode($node, $env); - } elseif ($node instanceof Twig_Node_Print) { - return $this->escapePrintNode($node, $env, $this->needEscaping($env)); - } - - if ($node instanceof Twig_Node_AutoEscape || $node instanceof Twig_Node_Block) { - array_pop($this->statusStack); - } elseif ($node instanceof Twig_Node_BlockReference) { - $this->blocks[$node->getAttribute('name')] = $this->needEscaping($env); - } - - return $node; - } - - protected function escapePrintNode(Twig_Node_Print $node, Twig_Environment $env, $type) - { - if (false === $type) { - return $node; - } - - $expression = $node->getNode('expr'); - - if ($this->isSafeFor($type, $expression, $env)) { - return $node; - } - - $class = get_class($node); - - return new $class( - $this->getEscaperFilter($type, $expression), - $node->getTemplateLine() - ); - } - - protected function preEscapeFilterNode(Twig_Node_Expression_Filter $filter, Twig_Environment $env) - { - $name = $filter->getNode('filter')->getAttribute('value'); - - $type = $env->getFilter($name)->getPreEscape(); - if (null === $type) { - return $filter; - } - - $node = $filter->getNode('node'); - if ($this->isSafeFor($type, $node, $env)) { - return $filter; - } - - $filter->setNode('node', $this->getEscaperFilter($type, $node)); - - return $filter; - } - - protected function isSafeFor($type, Twig_NodeInterface $expression, $env) - { - $safe = $this->safeAnalysis->getSafe($expression); - - if (null === $safe) { - if (null === $this->traverser) { - $this->traverser = new Twig_NodeTraverser($env, array($this->safeAnalysis)); - } - - $this->safeAnalysis->setSafeVars($this->safeVars); - - $this->traverser->traverse($expression); - $safe = $this->safeAnalysis->getSafe($expression); - } - - return in_array($type, $safe) || in_array('all', $safe); - } - - protected function needEscaping(Twig_Environment $env) - { - if (count($this->statusStack)) { - return $this->statusStack[count($this->statusStack) - 1]; - } - - return $this->defaultStrategy ? $this->defaultStrategy : false; - } - - protected function getEscaperFilter($type, Twig_NodeInterface $node) - { - $line = $node->getTemplateLine(); - $name = new Twig_Node_Expression_Constant('escape', $line); - $args = new Twig_Node(array(new Twig_Node_Expression_Constant((string) $type, $line), new Twig_Node_Expression_Constant(null, $line), new Twig_Node_Expression_Constant(true, $line))); - - return new Twig_Node_Expression_Filter($node, $name, $args, $line); - } - - public function getPriority() - { - return 0; } } - -class_alias('Twig_NodeVisitor_Escaper', 'Twig\NodeVisitor\EscaperNodeVisitor', false); diff --git a/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php b/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php index c55e40ff7345ae6f0c22076a32a104639cbde66c..7e6a77ae4d001877bd91777dc18d183c25a8348a 100644 --- a/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php +++ b/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php @@ -1,253 +1,11 @@ <?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\NodeVisitor\OptimizerNodeVisitor; -/** - * Twig_NodeVisitor_Optimizer tries to optimizes the AST. - * - * This visitor is always the last registered one. - * - * You can configure which optimizations you want to activate via the - * optimizer mode. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor -{ - const OPTIMIZE_ALL = -1; - const OPTIMIZE_NONE = 0; - const OPTIMIZE_FOR = 2; - const OPTIMIZE_RAW_FILTER = 4; - const OPTIMIZE_VAR_ACCESS = 8; +class_exists('Twig\NodeVisitor\OptimizerNodeVisitor'); - protected $loops = array(); - protected $loopsTargets = array(); - protected $optimizers; - protected $prependedNodes = array(); - protected $inABody = false; - - /** - * @param int $optimizers The optimizer mode - */ - public function __construct($optimizers = -1) - { - if (!is_int($optimizers) || $optimizers > (self::OPTIMIZE_FOR | self::OPTIMIZE_RAW_FILTER | self::OPTIMIZE_VAR_ACCESS)) { - throw new InvalidArgumentException(sprintf('Optimizer mode "%s" is not valid.', $optimizers)); - } - - $this->optimizers = $optimizers; - } - - protected function doEnterNode(Twig_Node $node, Twig_Environment $env) - { - if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { - $this->enterOptimizeFor($node, $env); - } - - if (PHP_VERSION_ID < 50400 && self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('Twig_Extension_Sandbox')) { - if ($this->inABody) { - if (!$node instanceof Twig_Node_Expression) { - if ('Twig_Node' !== get_class($node)) { - array_unshift($this->prependedNodes, array()); - } - } else { - $node = $this->optimizeVariables($node, $env); - } - } elseif ($node instanceof Twig_Node_Body) { - $this->inABody = true; - } - } - - return $node; - } - - protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) - { - $expression = $node instanceof Twig_Node_Expression; - - if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { - $this->leaveOptimizeFor($node, $env); - } - - if (self::OPTIMIZE_RAW_FILTER === (self::OPTIMIZE_RAW_FILTER & $this->optimizers)) { - $node = $this->optimizeRawFilter($node, $env); - } - - $node = $this->optimizePrintNode($node, $env); - - if (self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('Twig_Extension_Sandbox')) { - if ($node instanceof Twig_Node_Body) { - $this->inABody = false; - } elseif ($this->inABody) { - if (!$expression && 'Twig_Node' !== get_class($node) && $prependedNodes = array_shift($this->prependedNodes)) { - $nodes = array(); - foreach (array_unique($prependedNodes) as $name) { - $nodes[] = new Twig_Node_SetTemp($name, $node->getTemplateLine()); - } - - $nodes[] = $node; - $node = new Twig_Node($nodes); - } - } - } - - return $node; - } - - protected function optimizeVariables(Twig_NodeInterface $node, Twig_Environment $env) - { - if ('Twig_Node_Expression_Name' === get_class($node) && $node->isSimple()) { - $this->prependedNodes[0][] = $node->getAttribute('name'); - - return new Twig_Node_Expression_TempName($node->getAttribute('name'), $node->getTemplateLine()); - } - - return $node; - } - - /** - * Optimizes print nodes. - * - * It replaces: - * - * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()" - * - * @return Twig_NodeInterface - */ - protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment $env) - { - if (!$node instanceof Twig_Node_Print) { - return $node; - } - - $exprNode = $node->getNode('expr'); - if ( - $exprNode instanceof Twig_Node_Expression_BlockReference || - $exprNode instanceof Twig_Node_Expression_Parent - ) { - $exprNode->setAttribute('output', true); - - return $exprNode; - } - - return $node; - } - - /** - * Removes "raw" filters. - * - * @return Twig_NodeInterface - */ - protected function optimizeRawFilter(Twig_NodeInterface $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Expression_Filter && 'raw' == $node->getNode('filter')->getAttribute('value')) { - return $node->getNode('node'); - } - - return $node; - } - - /** - * Optimizes "for" tag by removing the "loop" variable creation whenever possible. - */ - protected function enterOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env) +if (\false) { + class Twig_NodeVisitor_Optimizer extends OptimizerNodeVisitor { - if ($node instanceof Twig_Node_For) { - // disable the loop variable by default - $node->setAttribute('with_loop', false); - array_unshift($this->loops, $node); - array_unshift($this->loopsTargets, $node->getNode('value_target')->getAttribute('name')); - array_unshift($this->loopsTargets, $node->getNode('key_target')->getAttribute('name')); - } elseif (!$this->loops) { - // we are outside a loop - return; - } - - // when do we need to add the loop variable back? - - // the loop variable is referenced for the current loop - elseif ($node instanceof Twig_Node_Expression_Name && 'loop' === $node->getAttribute('name')) { - $node->setAttribute('always_defined', true); - $this->addLoopToCurrent(); - } - - // optimize access to loop targets - elseif ($node instanceof Twig_Node_Expression_Name && in_array($node->getAttribute('name'), $this->loopsTargets)) { - $node->setAttribute('always_defined', true); - } - - // block reference - elseif ($node instanceof Twig_Node_BlockReference || $node instanceof Twig_Node_Expression_BlockReference) { - $this->addLoopToCurrent(); - } - - // include without the only attribute - elseif ($node instanceof Twig_Node_Include && !$node->getAttribute('only')) { - $this->addLoopToAll(); - } - - // include function without the with_context=false parameter - elseif ($node instanceof Twig_Node_Expression_Function - && 'include' === $node->getAttribute('name') - && (!$node->getNode('arguments')->hasNode('with_context') - || false !== $node->getNode('arguments')->getNode('with_context')->getAttribute('value') - ) - ) { - $this->addLoopToAll(); - } - - // the loop variable is referenced via an attribute - elseif ($node instanceof Twig_Node_Expression_GetAttr - && (!$node->getNode('attribute') instanceof Twig_Node_Expression_Constant - || 'parent' === $node->getNode('attribute')->getAttribute('value') - ) - && (true === $this->loops[0]->getAttribute('with_loop') - || ($node->getNode('node') instanceof Twig_Node_Expression_Name - && 'loop' === $node->getNode('node')->getAttribute('name') - ) - ) - ) { - $this->addLoopToAll(); - } - } - - /** - * Optimizes "for" tag by removing the "loop" variable creation whenever possible. - */ - protected function leaveOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_For) { - array_shift($this->loops); - array_shift($this->loopsTargets); - array_shift($this->loopsTargets); - } - } - - protected function addLoopToCurrent() - { - $this->loops[0]->setAttribute('with_loop', true); - } - - protected function addLoopToAll() - { - foreach ($this->loops as $loop) { - $loop->setAttribute('with_loop', true); - } - } - - public function getPriority() - { - return 255; } } - -class_alias('Twig_NodeVisitor_Optimizer', 'Twig\NodeVisitor\OptimizerNodeVisitor', false); diff --git a/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php b/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php index ca31c8fc76b759a484cbc815a43a13be3e7db4e8..bee25230261ec9920b2e5001b250e0bbca448c9c 100644 --- a/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php +++ b/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php @@ -1,150 +1,11 @@ <?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\NodeVisitor\SafeAnalysisNodeVisitor; -/** - * @final - */ -class Twig_NodeVisitor_SafeAnalysis extends Twig_BaseNodeVisitor -{ - protected $data = array(); - protected $safeVars = array(); +class_exists('Twig\NodeVisitor\SafeAnalysisNodeVisitor'); - public function setSafeVars($safeVars) +if (\false) { + class Twig_NodeVisitor_SafeAnalysis extends SafeAnalysisNodeVisitor { - $this->safeVars = $safeVars; - } - - public function getSafe(Twig_NodeInterface $node) - { - $hash = spl_object_hash($node); - if (!isset($this->data[$hash])) { - return; - } - - foreach ($this->data[$hash] as $bucket) { - if ($bucket['key'] !== $node) { - continue; - } - - if (in_array('html_attr', $bucket['value'])) { - $bucket['value'][] = 'html'; - } - - return $bucket['value']; - } - } - - protected function setSafe(Twig_NodeInterface $node, array $safe) - { - $hash = spl_object_hash($node); - if (isset($this->data[$hash])) { - foreach ($this->data[$hash] as &$bucket) { - if ($bucket['key'] === $node) { - $bucket['value'] = $safe; - - return; - } - } - } - $this->data[$hash][] = array( - 'key' => $node, - 'value' => $safe, - ); - } - - protected function doEnterNode(Twig_Node $node, Twig_Environment $env) - { - return $node; - } - - protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Expression_Constant) { - // constants are marked safe for all - $this->setSafe($node, array('all')); - } elseif ($node instanceof Twig_Node_Expression_BlockReference) { - // blocks are safe by definition - $this->setSafe($node, array('all')); - } elseif ($node instanceof Twig_Node_Expression_Parent) { - // parent block is safe by definition - $this->setSafe($node, array('all')); - } elseif ($node instanceof Twig_Node_Expression_Conditional) { - // intersect safeness of both operands - $safe = $this->intersectSafe($this->getSafe($node->getNode('expr2')), $this->getSafe($node->getNode('expr3'))); - $this->setSafe($node, $safe); - } elseif ($node instanceof Twig_Node_Expression_Filter) { - // filter expression is safe when the filter is safe - $name = $node->getNode('filter')->getAttribute('value'); - $args = $node->getNode('arguments'); - if (false !== $filter = $env->getFilter($name)) { - $safe = $filter->getSafe($args); - if (null === $safe) { - $safe = $this->intersectSafe($this->getSafe($node->getNode('node')), $filter->getPreservesSafety()); - } - $this->setSafe($node, $safe); - } else { - $this->setSafe($node, array()); - } - } elseif ($node instanceof Twig_Node_Expression_Function) { - // function expression is safe when the function is safe - $name = $node->getAttribute('name'); - $args = $node->getNode('arguments'); - $function = $env->getFunction($name); - if (false !== $function) { - $this->setSafe($node, $function->getSafe($args)); - } else { - $this->setSafe($node, array()); - } - } elseif ($node instanceof Twig_Node_Expression_MethodCall) { - if ($node->getAttribute('safe')) { - $this->setSafe($node, array('all')); - } else { - $this->setSafe($node, array()); - } - } elseif ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name) { - $name = $node->getNode('node')->getAttribute('name'); - // attributes on template instances are safe - if ('_self' == $name || in_array($name, $this->safeVars)) { - $this->setSafe($node, array('all')); - } else { - $this->setSafe($node, array()); - } - } else { - $this->setSafe($node, array()); - } - - return $node; - } - - protected function intersectSafe(array $a = null, array $b = null) - { - if (null === $a || null === $b) { - return array(); - } - - if (in_array('all', $a)) { - return $b; - } - - if (in_array('all', $b)) { - return $a; - } - - return array_intersect($a, $b); - } - - public function getPriority() - { - return 0; } } - -class_alias('Twig_NodeVisitor_SafeAnalysis', 'Twig\NodeVisitor\SafeAnalysisNodeVisitor', false); diff --git a/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php b/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php index 71aa4f029b4b99dd753e80a96a709a3d5eb27053..1f21c2d25870c5595db41beded8e36e8e4e90026 100644 --- a/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php +++ b/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php @@ -1,82 +1,11 @@ <?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\NodeVisitor\SandboxNodeVisitor; -/** - * Twig_NodeVisitor_Sandbox implements sandboxing. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_NodeVisitor_Sandbox extends Twig_BaseNodeVisitor -{ - protected $inAModule = false; - protected $tags; - protected $filters; - protected $functions; +class_exists('Twig\NodeVisitor\SandboxNodeVisitor'); - protected function doEnterNode(Twig_Node $node, Twig_Environment $env) +if (\false) { + class Twig_NodeVisitor_Sandbox extends SandboxNodeVisitor { - if ($node instanceof Twig_Node_Module) { - $this->inAModule = true; - $this->tags = array(); - $this->filters = array(); - $this->functions = array(); - - return $node; - } elseif ($this->inAModule) { - // look for tags - if ($node->getNodeTag() && !isset($this->tags[$node->getNodeTag()])) { - $this->tags[$node->getNodeTag()] = $node; - } - - // look for filters - if ($node instanceof Twig_Node_Expression_Filter && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) { - $this->filters[$node->getNode('filter')->getAttribute('value')] = $node; - } - - // look for functions - if ($node instanceof Twig_Node_Expression_Function && !isset($this->functions[$node->getAttribute('name')])) { - $this->functions[$node->getAttribute('name')] = $node; - } - - // the .. operator is equivalent to the range() function - if ($node instanceof Twig_Node_Expression_Binary_Range && !isset($this->functions['range'])) { - $this->functions['range'] = $node; - } - - // wrap print to check __toString() calls - if ($node instanceof Twig_Node_Print) { - return new Twig_Node_SandboxedPrint($node->getNode('expr'), $node->getTemplateLine(), $node->getNodeTag()); - } - } - - return $node; - } - - protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - $this->inAModule = false; - - $node->setNode('display_start', new Twig_Node(array(new Twig_Node_CheckSecurity($this->filters, $this->tags, $this->functions), $node->getNode('display_start')))); - } - - return $node; - } - - public function getPriority() - { - return 0; } } - -class_alias('Twig_NodeVisitor_Sandbox', 'Twig\NodeVisitor\SandboxNodeVisitor', false); diff --git a/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php b/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php index 1270a3724302d87c7b6eb70b83ea690b4d40dc83..809b4176eb57adbda1f3de00f377c9418a253bdf 100644 --- a/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php +++ b/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php @@ -1,45 +1,11 @@ <?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\NodeVisitor\NodeVisitorInterface; -/** - * Twig_NodeVisitorInterface is the interface the all node visitor classes must implement. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -interface Twig_NodeVisitorInterface -{ - /** - * Called before child nodes are visited. - * - * @return Twig_NodeInterface The modified node - */ - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env); +class_exists('Twig\NodeVisitor\NodeVisitorInterface'); - /** - * Called after child nodes are visited. - * - * @return Twig_NodeInterface|false The modified node or false if the node must be removed - */ - public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env); - - /** - * Returns the priority for this visitor. - * - * Priority should be between -10 and 10 (0 is the default). - * - * @return int The priority level - */ - public function getPriority(); +if (\false) { + class Twig_NodeVisitorInterface extends NodeVisitorInterface + { + } } - -class_alias('Twig_NodeVisitorInterface', 'Twig\NodeVisitor\NodeVisitorInterface', false); -class_exists('Twig_Environment'); -class_exists('Twig_Node'); diff --git a/vendor/twig/twig/lib/Twig/Parser.php b/vendor/twig/twig/lib/Twig/Parser.php index 6de879a584496d6e3dd10fdfb04d31a6144c07e7..cf56f69688161d815c0ce941c3783012d68918d8 100644 --- a/vendor/twig/twig/lib/Twig/Parser.php +++ b/vendor/twig/twig/lib/Twig/Parser.php @@ -1,412 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Parser; -/** - * Default parser implementation. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Parser implements Twig_ParserInterface -{ - protected $stack = array(); - protected $stream; - protected $parent; - protected $handlers; - protected $visitors; - protected $expressionParser; - protected $blocks; - protected $blockStack; - protected $macros; - protected $env; - protected $reservedMacroNames; - protected $importedSymbols; - protected $traits; - protected $embeddedTemplates = array(); - private $varNameSalt = 0; +class_exists('Twig\Parser'); - public function __construct(Twig_Environment $env) +if (\false) { + class Twig_Parser extends Parser { - $this->env = $env; - } - - /** - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function getEnvironment() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); - - return $this->env; - } - - public function getVarName() - { - return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->stream->getSourceContext()->getCode().$this->varNameSalt++)); - } - - /** - * @deprecated since 1.27 (to be removed in 2.0). Use $parser->getStream()->getSourceContext()->getPath() instead. - */ - public function getFilename() - { - @trigger_error(sprintf('The "%s" method is deprecated since version 1.27 and will be removed in 2.0. Use $parser->getStream()->getSourceContext()->getPath() instead.', __METHOD__), E_USER_DEPRECATED); - - return $this->stream->getSourceContext()->getName(); - } - - public function parse(Twig_TokenStream $stream, $test = null, $dropNeedle = false) - { - // push all variables into the stack to keep the current state of the parser - // using get_object_vars() instead of foreach would lead to https://bugs.php.net/71336 - // This hack can be removed when min version if PHP 7.0 - $vars = array(); - foreach ($this as $k => $v) { - $vars[$k] = $v; - } - - unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']); - $this->stack[] = $vars; - - // tag handlers - if (null === $this->handlers) { - $this->handlers = $this->env->getTokenParsers(); - $this->handlers->setParser($this); - } - - // node visitors - if (null === $this->visitors) { - $this->visitors = $this->env->getNodeVisitors(); - } - - if (null === $this->expressionParser) { - $this->expressionParser = new Twig_ExpressionParser($this, $this->env); - } - - $this->stream = $stream; - $this->parent = null; - $this->blocks = array(); - $this->macros = array(); - $this->traits = array(); - $this->blockStack = array(); - $this->importedSymbols = array(array()); - $this->embeddedTemplates = array(); - $this->varNameSalt = 0; - - try { - $body = $this->subparse($test, $dropNeedle); - - if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) { - $body = new Twig_Node(); - } - } catch (Twig_Error_Syntax $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($this->stream->getSourceContext()); - } - - if (!$e->getTemplateLine()) { - $e->setTemplateLine($this->stream->getCurrent()->getLine()); - } - - throw $e; - } - - $node = new Twig_Node_Module(new Twig_Node_Body(array($body)), $this->parent, new Twig_Node($this->blocks), new Twig_Node($this->macros), new Twig_Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext()); - - $traverser = new Twig_NodeTraverser($this->env, $this->visitors); - - $node = $traverser->traverse($node); - - // restore previous stack so previous parse() call can resume working - foreach (array_pop($this->stack) as $key => $val) { - $this->$key = $val; - } - - return $node; - } - - public function subparse($test, $dropNeedle = false) - { - $lineno = $this->getCurrentToken()->getLine(); - $rv = array(); - while (!$this->stream->isEOF()) { - switch ($this->getCurrentToken()->getType()) { - case Twig_Token::TEXT_TYPE: - $token = $this->stream->next(); - $rv[] = new Twig_Node_Text($token->getValue(), $token->getLine()); - break; - - case Twig_Token::VAR_START_TYPE: - $token = $this->stream->next(); - $expr = $this->expressionParser->parseExpression(); - $this->stream->expect(Twig_Token::VAR_END_TYPE); - $rv[] = new Twig_Node_Print($expr, $token->getLine()); - break; - - case Twig_Token::BLOCK_START_TYPE: - $this->stream->next(); - $token = $this->getCurrentToken(); - - if (Twig_Token::NAME_TYPE !== $token->getType()) { - throw new Twig_Error_Syntax('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext()); - } - - if (null !== $test && call_user_func($test, $token)) { - if ($dropNeedle) { - $this->stream->next(); - } - - if (1 === count($rv)) { - return $rv[0]; - } - - return new Twig_Node($rv, array(), $lineno); - } - - $subparser = $this->handlers->getTokenParser($token->getValue()); - if (null === $subparser) { - if (null !== $test) { - $e = new Twig_Error_Syntax(sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); - - if (is_array($test) && isset($test[0]) && $test[0] instanceof Twig_TokenParserInterface) { - $e->appendMessage(sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno)); - } - } else { - $e = new Twig_Error_Syntax(sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); - $e->addSuggestions($token->getValue(), array_keys($this->env->getTags())); - } - - throw $e; - } - - $this->stream->next(); - - $node = $subparser->parse($token); - if (null !== $node) { - $rv[] = $node; - } - break; - - default: - throw new Twig_Error_Syntax('Lexer or parser ended up in unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext()); - } - } - - if (1 === count($rv)) { - return $rv[0]; - } - - return new Twig_Node($rv, array(), $lineno); - } - - /** - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function addHandler($name, $class) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); - - $this->handlers[$name] = $class; - } - - /** - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); - - $this->visitors[] = $visitor; - } - - public function getBlockStack() - { - return $this->blockStack; - } - - public function peekBlockStack() - { - return $this->blockStack[count($this->blockStack) - 1]; - } - - public function popBlockStack() - { - array_pop($this->blockStack); - } - - public function pushBlockStack($name) - { - $this->blockStack[] = $name; - } - - public function hasBlock($name) - { - return isset($this->blocks[$name]); - } - - public function getBlock($name) - { - return $this->blocks[$name]; - } - - public function setBlock($name, Twig_Node_Block $value) - { - $this->blocks[$name] = new Twig_Node_Body(array($value), array(), $value->getTemplateLine()); - } - - public function hasMacro($name) - { - return isset($this->macros[$name]); - } - - public function setMacro($name, Twig_Node_Macro $node) - { - if ($this->isReservedMacroName($name)) { - throw new Twig_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword.', $name), $node->getTemplateLine(), $this->stream->getSourceContext()); - } - - $this->macros[$name] = $node; - } - - public function isReservedMacroName($name) - { - if (null === $this->reservedMacroNames) { - $this->reservedMacroNames = array(); - $r = new ReflectionClass($this->env->getBaseTemplateClass()); - foreach ($r->getMethods() as $method) { - $methodName = strtolower($method->getName()); - - if ('get' === substr($methodName, 0, 3) && isset($methodName[3])) { - $this->reservedMacroNames[] = substr($methodName, 3); - } - } - } - - return in_array(strtolower($name), $this->reservedMacroNames); - } - - public function addTrait($trait) - { - $this->traits[] = $trait; - } - - public function hasTraits() - { - return count($this->traits) > 0; - } - - public function embedTemplate(Twig_Node_Module $template) - { - $template->setIndex(mt_rand()); - - $this->embeddedTemplates[] = $template; - } - - public function addImportedSymbol($type, $alias, $name = null, Twig_Node_Expression $node = null) - { - $this->importedSymbols[0][$type][$alias] = array('name' => $name, 'node' => $node); - } - - public function getImportedSymbol($type, $alias) - { - foreach ($this->importedSymbols as $functions) { - if (isset($functions[$type][$alias])) { - return $functions[$type][$alias]; - } - } - } - - public function isMainScope() - { - return 1 === count($this->importedSymbols); - } - - public function pushLocalScope() - { - array_unshift($this->importedSymbols, array()); - } - - public function popLocalScope() - { - array_shift($this->importedSymbols); - } - - /** - * @return Twig_ExpressionParser - */ - public function getExpressionParser() - { - return $this->expressionParser; - } - - public function getParent() - { - return $this->parent; - } - - public function setParent($parent) - { - $this->parent = $parent; - } - - /** - * @return Twig_TokenStream - */ - public function getStream() - { - return $this->stream; - } - - /** - * @return Twig_Token - */ - public function getCurrentToken() - { - return $this->stream->getCurrent(); - } - - protected function filterBodyNodes(Twig_NodeInterface $node) - { - // check that the body does not contain non-empty output nodes - if ( - ($node instanceof Twig_Node_Text && !ctype_space($node->getAttribute('data'))) - || - (!$node instanceof Twig_Node_Text && !$node instanceof Twig_Node_BlockReference && $node instanceof Twig_NodeOutputInterface) - ) { - if (false !== strpos((string) $node, chr(0xEF).chr(0xBB).chr(0xBF))) { - throw new Twig_Error_Syntax('A template that extends another one cannot start with a byte order mark (BOM); it must be removed.', $node->getTemplateLine(), $this->stream->getSourceContext()); - } - - throw new Twig_Error_Syntax('A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext()); - } - - // bypass nodes that will "capture" the output - if ($node instanceof Twig_NodeCaptureInterface) { - return $node; - } - - if ($node instanceof Twig_NodeOutputInterface) { - return; - } - - foreach ($node as $k => $n) { - if (null !== $n && null === $this->filterBodyNodes($n)) { - $node->removeNode($k); - } - } - - return $node; } } - -class_alias('Twig_Parser', 'Twig\Parser', false); -class_exists('Twig_Node'); -class_exists('Twig_TokenStream'); diff --git a/vendor/twig/twig/lib/Twig/ParserInterface.php b/vendor/twig/twig/lib/Twig/ParserInterface.php index 85c6e67b20ce3ca94d5f4a9f0af85c10698c65b3..96e9aaa946373be78c0dba58c638b451beae4d78 100644 --- a/vendor/twig/twig/lib/Twig/ParserInterface.php +++ b/vendor/twig/twig/lib/Twig/ParserInterface.php @@ -9,6 +9,10 @@ * file that was distributed with this source code. */ +use Twig\Error\SyntaxError; +use Twig\Node\ModuleNode; +use Twig\TokenStream; + /** * Interface implemented by parser classes. * @@ -21,9 +25,9 @@ interface Twig_ParserInterface /** * Converts a token stream to a node tree. * - * @return Twig_Node_Module + * @return ModuleNode * - * @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong + * @throws SyntaxError When the token stream is syntactically or semantically wrong */ - public function parse(Twig_TokenStream $stream); + public function parse(TokenStream $stream); } diff --git a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Base.php b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Base.php index 913afd4f0f9679a8fa18b8a147750832fe9b79be..5bcb1ba6335d5eea98c486f03bc5142e6675b0e7 100644 --- a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Base.php +++ b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Base.php @@ -1,62 +1,11 @@ <?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\Profiler\Dumper\BaseDumper; -/** - * @author Fabien Potencier <fabien@symfony.com> - */ -abstract class Twig_Profiler_Dumper_Base -{ - private $root; +class_exists('Twig\Profiler\Dumper\BaseDumper'); - public function dump(Twig_Profiler_Profile $profile) +if (\false) { + class Twig_Profiler_Dumper_Base extends BaseDumper { - return $this->dumpProfile($profile); - } - - abstract protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix); - - abstract protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix); - - abstract protected function formatTime(Twig_Profiler_Profile $profile, $percent); - - private function dumpProfile(Twig_Profiler_Profile $profile, $prefix = '', $sibling = false) - { - if ($profile->isRoot()) { - $this->root = $profile->getDuration(); - $start = $profile->getName(); - } else { - if ($profile->isTemplate()) { - $start = $this->formatTemplate($profile, $prefix); - } else { - $start = $this->formatNonTemplate($profile, $prefix); - } - $prefix .= $sibling ? '│ ' : ' '; - } - - $percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0; - - if ($profile->getDuration() * 1000 < 1) { - $str = $start."\n"; - } else { - $str = sprintf("%s %s\n", $start, $this->formatTime($profile, $percent)); - } - - $nCount = count($profile->getProfiles()); - foreach ($profile as $i => $p) { - $str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount); - } - - return $str; } } - -class_alias('Twig_Profiler_Dumper_Base', 'Twig\Profiler\Dumper\BaseDumper', false); -class_exists('Twig_Profiler_Profile'); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php index 7a33baf2d670b3ba7367a3aa170e81a6a1ee71cc..cf09413fce3649637e5b6c15ec8431e2ed1964d9 100644 --- a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php +++ b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php @@ -1,72 +1,11 @@ <?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. - */ - -/** - * @author Fabien Potencier <fabien@symfony.com> - * - * @final - */ -class Twig_Profiler_Dumper_Blackfire -{ - public function dump(Twig_Profiler_Profile $profile) - { - $data = array(); - $this->dumpProfile('main()', $profile, $data); - $this->dumpChildren('main()', $profile, $data); - - $start = sprintf('%f', microtime(true)); - $str = <<<EOF -file-format: BlackfireProbe -cost-dimensions: wt mu pmu -request-start: {$start} +use Twig\Profiler\Dumper\BlackfireDumper; +class_exists('Twig\Profiler\Dumper\BlackfireDumper'); -EOF; - - foreach ($data as $name => $values) { - $str .= "{$name}//{$values['ct']} {$values['wt']} {$values['mu']} {$values['pmu']}\n"; - } - - return $str; - } - - private function dumpChildren($parent, Twig_Profiler_Profile $profile, &$data) +if (\false) { + class Twig_Profiler_Dumper_Blackfire extends BlackfireDumper { - foreach ($profile as $p) { - if ($p->isTemplate()) { - $name = $p->getTemplate(); - } else { - $name = sprintf('%s::%s(%s)', $p->getTemplate(), $p->getType(), $p->getName()); - } - $this->dumpProfile(sprintf('%s==>%s', $parent, $name), $p, $data); - $this->dumpChildren($name, $p, $data); - } - } - - private function dumpProfile($edge, Twig_Profiler_Profile $profile, &$data) - { - if (isset($data[$edge])) { - $data[$edge]['ct'] += 1; - $data[$edge]['wt'] += floor($profile->getDuration() * 1000000); - $data[$edge]['mu'] += $profile->getMemoryUsage(); - $data[$edge]['pmu'] += $profile->getPeakMemoryUsage(); - } else { - $data[$edge] = array( - 'ct' => 1, - 'wt' => floor($profile->getDuration() * 1000000), - 'mu' => $profile->getMemoryUsage(), - 'pmu' => $profile->getPeakMemoryUsage(), - ); - } } } - -class_alias('Twig_Profiler_Dumper_Blackfire', 'Twig\Profiler\Dumper\BlackfireDumper', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php index b57a25517e45a088f855424f1ba275980ee16de9..36dc573a5b1dcd18003847c20fb95143efc43b5b 100644 --- a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php +++ b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php @@ -1,47 +1,11 @@ <?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\Profiler\Dumper\HtmlDumper; -/** - * @author Fabien Potencier <fabien@symfony.com> - * - * @final - */ -class Twig_Profiler_Dumper_Html extends Twig_Profiler_Dumper_Base -{ - private static $colors = array( - 'block' => '#dfd', - 'macro' => '#ddf', - 'template' => '#ffd', - 'big' => '#d44', - ); +class_exists('Twig\Profiler\Dumper\HtmlDumper'); - public function dump(Twig_Profiler_Profile $profile) +if (\false) { + class Twig_Profiler_Dumper_Html extends HtmlDumper { - return '<pre>'.parent::dump($profile).'</pre>'; - } - - protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix) - { - return sprintf('%s└ <span style="background-color: %s">%s</span>', $prefix, self::$colors['template'], $profile->getTemplate()); - } - - protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix) - { - return sprintf('%s└ %s::%s(<span style="background-color: %s">%s</span>)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName()); - } - - protected function formatTime(Twig_Profiler_Profile $profile, $percent) - { - return sprintf('<span style="color: %s">%.2fms/%.0f%%</span>', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent); } } - -class_alias('Twig_Profiler_Dumper_Html', 'Twig\Profiler\Dumper\HtmlDumper', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php index 69d2c4bf34197f055d4944f04dbbc5e226504d02..3ff1395363f0b104a80cf5e846914c47420630a6 100644 --- a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php +++ b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php @@ -1,35 +1,11 @@ <?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\Profiler\Dumper\TextDumper; -/** - * @author Fabien Potencier <fabien@symfony.com> - * - * @final - */ -class Twig_Profiler_Dumper_Text extends Twig_Profiler_Dumper_Base -{ - protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix) - { - return sprintf('%s└ %s', $prefix, $profile->getTemplate()); - } - - protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix) - { - return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName()); - } +class_exists('Twig\Profiler\Dumper\TextDumper'); - protected function formatTime(Twig_Profiler_Profile $profile, $percent) +if (\false) { + class Twig_Profiler_Dumper_Text extends TextDumper { - return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent); } } - -class_alias('Twig_Profiler_Dumper_Text', 'Twig\Profiler\Dumper\TextDumper', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php b/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php index 69c8f7970224578521e17515a57a917d315d5aed..ce25ec4b5d78a59fa4d6d1e8f430e7480761cb19 100644 --- a/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php +++ b/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php @@ -1,39 +1,11 @@ <?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\Profiler\Node\EnterProfileNode; -/** - * Represents a profile enter node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Profiler_Node_EnterProfile extends Twig_Node -{ - public function __construct($extensionName, $type, $name, $varName) - { - parent::__construct(array(), array('extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName)); - } +class_exists('Twig\Profiler\Node\EnterProfileNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Profiler_Node_EnterProfile extends EnterProfileNode { - $compiler - ->write(sprintf('$%s = $this->env->getExtension(', $this->getAttribute('var_name'))) - ->repr($this->getAttribute('extension_name')) - ->raw(");\n") - ->write(sprintf('$%s->enter($%s = new Twig_Profiler_Profile($this->getTemplateName(), ', $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) - ->repr($this->getAttribute('type')) - ->raw(', ') - ->repr($this->getAttribute('name')) - ->raw("));\n\n") - ; } } - -class_alias('Twig_Profiler_Node_EnterProfile', 'Twig\Profiler\Node\EnterProfileNode', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php b/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php index d1d6a7cc114d9aa9e75b3864018c02891c362f55..31cc7231c8ed8cbefee1fca4fcbf136aa930e4a6 100644 --- a/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php +++ b/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php @@ -1,33 +1,11 @@ <?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\Profiler\Node\LeaveProfileNode; -/** - * Represents a profile leave node. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Profiler_Node_LeaveProfile extends Twig_Node -{ - public function __construct($varName) - { - parent::__construct(array(), array('var_name' => $varName)); - } +class_exists('Twig\Profiler\Node\LeaveProfileNode'); - public function compile(Twig_Compiler $compiler) +if (\false) { + class Twig_Profiler_Node_LeaveProfile extends LeaveProfileNode { - $compiler - ->write("\n") - ->write(sprintf("\$%s->leave(\$%s);\n\n", $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) - ; } } - -class_alias('Twig_Profiler_Node_LeaveProfile', 'Twig\Profiler\Node\LeaveProfileNode', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php b/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php index 5db41fea756d16ff2fc31221e3113d03e91832fd..463a96bd3acf91672c6dbb928600c23cf1aef497 100644 --- a/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php +++ b/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php @@ -1,67 +1,11 @@ <?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\Profiler\NodeVisitor\ProfilerNodeVisitor; -/** - * @author Fabien Potencier <fabien@symfony.com> - * - * @final - */ -class Twig_Profiler_NodeVisitor_Profiler extends Twig_BaseNodeVisitor -{ - private $extensionName; +class_exists('Twig\Profiler\NodeVisitor\ProfilerNodeVisitor'); - public function __construct($extensionName) +if (\false) { + class Twig_Profiler_NodeVisitor_Profiler extends ProfilerNodeVisitor { - $this->extensionName = $extensionName; - } - - protected function doEnterNode(Twig_Node $node, Twig_Environment $env) - { - return $node; - } - - protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - $varName = $this->getVarName(); - $node->setNode('display_start', new Twig_Node(array(new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::TEMPLATE, $node->getTemplateName(), $varName), $node->getNode('display_start')))); - $node->setNode('display_end', new Twig_Node(array(new Twig_Profiler_Node_LeaveProfile($varName), $node->getNode('display_end')))); - } elseif ($node instanceof Twig_Node_Block) { - $varName = $this->getVarName(); - $node->setNode('body', new Twig_Node_Body(array( - new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::BLOCK, $node->getAttribute('name'), $varName), - $node->getNode('body'), - new Twig_Profiler_Node_LeaveProfile($varName), - ))); - } elseif ($node instanceof Twig_Node_Macro) { - $varName = $this->getVarName(); - $node->setNode('body', new Twig_Node_Body(array( - new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::MACRO, $node->getAttribute('name'), $varName), - $node->getNode('body'), - new Twig_Profiler_Node_LeaveProfile($varName), - ))); - } - - return $node; - } - - private function getVarName() - { - return sprintf('__internal_%s', hash('sha256', $this->extensionName)); - } - - public function getPriority() - { - return 0; } } - -class_alias('Twig_Profiler_NodeVisitor_Profiler', 'Twig\Profiler\NodeVisitor\ProfilerNodeVisitor', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Profile.php b/vendor/twig/twig/lib/Twig/Profiler/Profile.php index 3fdc1a8ae2dbeff29142264e187dae0646ceed41..bb13c7a11d3d13249ac3e9def984ffd6d81f132e 100644 --- a/vendor/twig/twig/lib/Twig/Profiler/Profile.php +++ b/vendor/twig/twig/lib/Twig/Profiler/Profile.php @@ -1,170 +1,11 @@ <?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\Profiler\Profile; -/** - * @author Fabien Potencier <fabien@symfony.com> - * - * @final - */ -class Twig_Profiler_Profile implements IteratorAggregate, Serializable -{ - const ROOT = 'ROOT'; - const BLOCK = 'block'; - const TEMPLATE = 'template'; - const MACRO = 'macro'; +class_exists('Twig\Profiler\Profile'); - private $template; - private $name; - private $type; - private $starts = array(); - private $ends = array(); - private $profiles = array(); - - public function __construct($template = 'main', $type = self::ROOT, $name = 'main') - { - $this->template = $template; - $this->type = $type; - $this->name = 0 === strpos($name, '__internal_') ? 'INTERNAL' : $name; - $this->enter(); - } - - public function getTemplate() - { - return $this->template; - } - - public function getType() - { - return $this->type; - } - - public function getName() - { - return $this->name; - } - - public function isRoot() - { - return self::ROOT === $this->type; - } - - public function isTemplate() - { - return self::TEMPLATE === $this->type; - } - - public function isBlock() - { - return self::BLOCK === $this->type; - } - - public function isMacro() - { - return self::MACRO === $this->type; - } - - public function getProfiles() - { - return $this->profiles; - } - - public function addProfile(Twig_Profiler_Profile $profile) - { - $this->profiles[] = $profile; - } - - /** - * Returns the duration in microseconds. - * - * @return int - */ - public function getDuration() - { - if ($this->isRoot() && $this->profiles) { - // for the root node with children, duration is the sum of all child durations - $duration = 0; - foreach ($this->profiles as $profile) { - $duration += $profile->getDuration(); - } - - return $duration; - } - - return isset($this->ends['wt']) && isset($this->starts['wt']) ? $this->ends['wt'] - $this->starts['wt'] : 0; - } - - /** - * Returns the memory usage in bytes. - * - * @return int - */ - public function getMemoryUsage() +if (\false) { + class Twig_Profiler_Profile extends Profile { - return isset($this->ends['mu']) && isset($this->starts['mu']) ? $this->ends['mu'] - $this->starts['mu'] : 0; - } - - /** - * Returns the peak memory usage in bytes. - * - * @return int - */ - public function getPeakMemoryUsage() - { - return isset($this->ends['pmu']) && isset($this->starts['pmu']) ? $this->ends['pmu'] - $this->starts['pmu'] : 0; - } - - /** - * Starts the profiling. - */ - public function enter() - { - $this->starts = array( - 'wt' => microtime(true), - 'mu' => memory_get_usage(), - 'pmu' => memory_get_peak_usage(), - ); - } - - /** - * Stops the profiling. - */ - public function leave() - { - $this->ends = array( - 'wt' => microtime(true), - 'mu' => memory_get_usage(), - 'pmu' => memory_get_peak_usage(), - ); - } - - public function reset() - { - $this->starts = $this->ends = $this->profiles = array(); - $this->enter(); - } - - public function getIterator() - { - return new ArrayIterator($this->profiles); - } - - public function serialize() - { - return serialize(array($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles)); - } - - public function unserialize($data) - { - list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = unserialize($data); } } - -class_alias('Twig_Profiler_Profile', 'Twig\Profiler\Profile', false); diff --git a/vendor/twig/twig/lib/Twig/RuntimeLoaderInterface.php b/vendor/twig/twig/lib/Twig/RuntimeLoaderInterface.php index f5eb14e0d90fbe8a4a9407030549e2006a1b07ea..f21cde5a90bba6c9fed06901f5129d6c74cb8abd 100644 --- a/vendor/twig/twig/lib/Twig/RuntimeLoaderInterface.php +++ b/vendor/twig/twig/lib/Twig/RuntimeLoaderInterface.php @@ -1,29 +1,11 @@ <?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\RuntimeLoader\RuntimeLoaderInterface; -/** - * Creates runtime implementations for Twig elements (filters/functions/tests). - * - * @author Fabien Potencier <fabien@symfony.com> - */ -interface Twig_RuntimeLoaderInterface -{ - /** - * Creates the runtime implementation of a Twig element (filter/function/test). - * - * @param string $class A runtime class - * - * @return object|null The runtime instance or null if the loader does not know how to create the runtime for this class - */ - public function load($class); -} +class_exists('Twig\RuntimeLoader\RuntimeLoaderInterface'); -class_alias('Twig_RuntimeLoaderInterface', 'Twig\RuntimeLoader\RuntimeLoaderInterface', false); +if (\false) { + class Twig_RuntimeLoaderInterface extends RuntimeLoaderInterface + { + } +} diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php index b6707e3861ed73e401866b5f899b97d849890d91..d018ece1cb8c7f45ca693ada36c02bddac8aec56 100644 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php +++ b/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php @@ -1,21 +1,11 @@ <?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\Sandbox\SecurityError; -/** - * Exception thrown when a security error occurs at runtime. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Sandbox_SecurityError extends Twig_Error -{ -} +class_exists('Twig\Sandbox\SecurityError'); -class_alias('Twig_Sandbox_SecurityError', 'Twig\Sandbox\SecurityError', false); +if (\false) { + class Twig_Sandbox_SecurityError extends SecurityError + { + } +} diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php index 0ba332762d4a88b497bf025c3f044a2eef1feb9c..1a5f9eb2a57a63eccb1868648ca3e49b4288907b 100644 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php +++ b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php @@ -1,33 +1,11 @@ <?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\Sandbox\SecurityNotAllowedFilterError; -/** - * Exception thrown when a not allowed filter is used in a template. - * - * @author Martin Hasoň <martin.hason@gmail.com> - */ -class Twig_Sandbox_SecurityNotAllowedFilterError extends Twig_Sandbox_SecurityError -{ - private $filterName; +class_exists('Twig\Sandbox\SecurityNotAllowedFilterError'); - public function __construct($message, $functionName, $lineno = -1, $filename = null, Exception $previous = null) +if (\false) { + class Twig_Sandbox_SecurityNotAllowedFilterError extends SecurityNotAllowedFilterError { - parent::__construct($message, $lineno, $filename, $previous); - $this->filterName = $functionName; - } - - public function getFilterName() - { - return $this->filterName; } } - -class_alias('Twig_Sandbox_SecurityNotAllowedFilterError', 'Twig\Sandbox\SecurityNotAllowedFilterError', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php index aa39142932a29b2fe84bc4114021bb83a6ba176f..34e2b2b9a3fed318cbd60be3b52cb65662eec213 100644 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php +++ b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php @@ -1,33 +1,11 @@ <?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\Sandbox\SecurityNotAllowedFunctionError; -/** - * Exception thrown when a not allowed function is used in a template. - * - * @author Martin Hasoň <martin.hason@gmail.com> - */ -class Twig_Sandbox_SecurityNotAllowedFunctionError extends Twig_Sandbox_SecurityError -{ - private $functionName; +class_exists('Twig\Sandbox\SecurityNotAllowedFunctionError'); - public function __construct($message, $functionName, $lineno = -1, $filename = null, Exception $previous = null) +if (\false) { + class Twig_Sandbox_SecurityNotAllowedFunctionError extends SecurityNotAllowedFunctionError { - parent::__construct($message, $lineno, $filename, $previous); - $this->functionName = $functionName; - } - - public function getFunctionName() - { - return $this->functionName; } } - -class_alias('Twig_Sandbox_SecurityNotAllowedFunctionError', 'Twig\Sandbox\SecurityNotAllowedFunctionError', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php index 93012fe9909c4fe443bbb55c6a60608ade74abb7..c776b1011c28350e0250cedbd0c4f93b5ddaf34a 100644 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php +++ b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php @@ -1,40 +1,11 @@ <?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\Sandbox\SecurityNotAllowedMethodError; -/** - * Exception thrown when a not allowed class method is used in a template. - * - * @author Kit Burton-Senior <mail@kitbs.com> - */ -class Twig_Sandbox_SecurityNotAllowedMethodError extends Twig_Sandbox_SecurityError -{ - private $className; - private $methodName; +class_exists('Twig\Sandbox\SecurityNotAllowedMethodError'); - public function __construct($message, $className, $methodName, $lineno = -1, $filename = null, Exception $previous = null) +if (\false) { + class Twig_Sandbox_SecurityNotAllowedMethodError extends SecurityNotAllowedMethodError { - parent::__construct($message, $lineno, $filename, $previous); - $this->className = $className; - $this->methodName = $methodName; - } - - public function getClassName() - { - return $this->className; - } - - public function getMethodName() - { - return $this->methodName; } } - -class_alias('Twig_Sandbox_SecurityNotAllowedMethodError', 'Twig\Sandbox\SecurityNotAllowedMethodError', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php index f27969c155bf939f5dd97a7f321aeea1fffbf714..a99efeb24e4ea4b8dc0b5f3d5ebc6f4d89a29b2f 100644 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php +++ b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php @@ -1,40 +1,11 @@ <?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\Sandbox\SecurityNotAllowedPropertyError; -/** - * Exception thrown when a not allowed class property is used in a template. - * - * @author Kit Burton-Senior <mail@kitbs.com> - */ -class Twig_Sandbox_SecurityNotAllowedPropertyError extends Twig_Sandbox_SecurityError -{ - private $className; - private $propertyName; +class_exists('Twig\Sandbox\SecurityNotAllowedPropertyError'); - public function __construct($message, $className, $propertyName, $lineno = -1, $filename = null, Exception $previous = null) +if (\false) { + class Twig_Sandbox_SecurityNotAllowedPropertyError extends SecurityNotAllowedPropertyError { - parent::__construct($message, $lineno, $filename, $previous); - $this->className = $className; - $this->propertyName = $propertyName; - } - - public function getClassName() - { - return $this->className; - } - - public function getPropertyName() - { - return $this->propertyName; } } - -class_alias('Twig_Sandbox_SecurityNotAllowedPropertyError', 'Twig\Sandbox\SecurityNotAllowedPropertyError', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php index 4bbd22387397968ed29a4b36df761284a03a15e1..0ffd0f849a28ae09f01af2346dd2b5120962a0ea 100644 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php +++ b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php @@ -1,33 +1,11 @@ <?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\Sandbox\SecurityNotAllowedTagError; -/** - * Exception thrown when a not allowed tag is used in a template. - * - * @author Martin Hasoň <martin.hason@gmail.com> - */ -class Twig_Sandbox_SecurityNotAllowedTagError extends Twig_Sandbox_SecurityError -{ - private $tagName; +class_exists('Twig\Sandbox\SecurityNotAllowedTagError'); - public function __construct($message, $tagName, $lineno = -1, $filename = null, Exception $previous = null) +if (\false) { + class Twig_Sandbox_SecurityNotAllowedTagError extends SecurityNotAllowedTagError { - parent::__construct($message, $lineno, $filename, $previous); - $this->tagName = $tagName; - } - - public function getTagName() - { - return $this->tagName; } } - -class_alias('Twig_Sandbox_SecurityNotAllowedTagError', 'Twig\Sandbox\SecurityNotAllowedTagError', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php index dca0b82b5f25897b0db605237e58392ad3bb0242..41038c430f47d2e41d98b11796626e1626ffda0b 100644 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php +++ b/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php @@ -1,125 +1,11 @@ <?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\Sandbox\SecurityPolicy; -/** - * Represents a security policy which need to be enforced when sandbox mode is enabled. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Sandbox_SecurityPolicy implements Twig_Sandbox_SecurityPolicyInterface -{ - protected $allowedTags; - protected $allowedFilters; - protected $allowedMethods; - protected $allowedProperties; - protected $allowedFunctions; +class_exists('Twig\Sandbox\SecurityPolicy'); - public function __construct(array $allowedTags = array(), array $allowedFilters = array(), array $allowedMethods = array(), array $allowedProperties = array(), array $allowedFunctions = array()) +if (\false) { + class Twig_Sandbox_SecurityPolicy extends SecurityPolicy { - $this->allowedTags = $allowedTags; - $this->allowedFilters = $allowedFilters; - $this->setAllowedMethods($allowedMethods); - $this->allowedProperties = $allowedProperties; - $this->allowedFunctions = $allowedFunctions; - } - - public function setAllowedTags(array $tags) - { - $this->allowedTags = $tags; - } - - public function setAllowedFilters(array $filters) - { - $this->allowedFilters = $filters; - } - - public function setAllowedMethods(array $methods) - { - $this->allowedMethods = array(); - foreach ($methods as $class => $m) { - $this->allowedMethods[$class] = array_map('strtolower', is_array($m) ? $m : array($m)); - } - } - - public function setAllowedProperties(array $properties) - { - $this->allowedProperties = $properties; - } - - public function setAllowedFunctions(array $functions) - { - $this->allowedFunctions = $functions; - } - - public function checkSecurity($tags, $filters, $functions) - { - foreach ($tags as $tag) { - if (!in_array($tag, $this->allowedTags)) { - throw new Twig_Sandbox_SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag); - } - } - - foreach ($filters as $filter) { - if (!in_array($filter, $this->allowedFilters)) { - throw new Twig_Sandbox_SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter); - } - } - - foreach ($functions as $function) { - if (!in_array($function, $this->allowedFunctions)) { - throw new Twig_Sandbox_SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function); - } - } - } - - public function checkMethodAllowed($obj, $method) - { - if ($obj instanceof Twig_TemplateInterface || $obj instanceof Twig_Markup) { - return true; - } - - $allowed = false; - $method = strtolower($method); - foreach ($this->allowedMethods as $class => $methods) { - if ($obj instanceof $class) { - $allowed = in_array($method, $methods); - - break; - } - } - - if (!$allowed) { - $class = get_class($obj); - throw new Twig_Sandbox_SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method); - } - } - - public function checkPropertyAllowed($obj, $property) - { - $allowed = false; - foreach ($this->allowedProperties as $class => $properties) { - if ($obj instanceof $class) { - $allowed = in_array($property, is_array($properties) ? $properties : array($properties)); - - break; - } - } - - if (!$allowed) { - $class = get_class($obj); - throw new Twig_Sandbox_SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property); - } } } - -class_alias('Twig_Sandbox_SecurityPolicy', 'Twig\Sandbox\SecurityPolicy', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php index 88f64447aadee5cf58c74b9ea3c5ebcdf55a9ad1..f17e6a5e991215738fd156eb9532219ab094da80 100644 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php +++ b/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php @@ -1,26 +1,11 @@ <?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\Sandbox\SecurityPolicyInterface; -/** - * Interfaces that all security policy classes must implements. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -interface Twig_Sandbox_SecurityPolicyInterface -{ - public function checkSecurity($tags, $filters, $functions); +class_exists('Twig\Sandbox\SecurityPolicyInterface'); - public function checkMethodAllowed($obj, $method); - - public function checkPropertyAllowed($obj, $method); +if (\false) { + class Twig_Sandbox_SecurityPolicyInterface extends SecurityPolicyInterface + { + } } - -class_alias('Twig_Sandbox_SecurityPolicyInterface', 'Twig\Sandbox\SecurityPolicyInterface', false); diff --git a/vendor/twig/twig/lib/Twig/SimpleFilter.php b/vendor/twig/twig/lib/Twig/SimpleFilter.php index ee4c0aebf081f9b7433a3fa773268b9c7f9539ca..bb830e0f03b682ef7e2c245463b7c0f5243adc37 100644 --- a/vendor/twig/twig/lib/Twig/SimpleFilter.php +++ b/vendor/twig/twig/lib/Twig/SimpleFilter.php @@ -1,121 +1,11 @@ <?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\TwigFilter; -/** - * Represents a template filter. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_SimpleFilter -{ - protected $name; - protected $callable; - protected $options; - protected $arguments = array(); +class_exists('Twig\TwigFilter'); - public function __construct($name, $callable, array $options = array()) +if (\false) { + class Twig_SimpleFilter extends TwigFilter { - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge(array( - 'needs_environment' => false, - 'needs_context' => false, - 'is_variadic' => false, - 'is_safe' => null, - 'is_safe_callback' => null, - 'pre_escape' => null, - 'preserves_safety' => null, - 'node_class' => 'Twig_Node_Expression_Filter', - 'deprecated' => false, - 'alternative' => null, - ), $options); - } - - public function getName() - { - return $this->name; - } - - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } - - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - public function getArguments() - { - return $this->arguments; - } - - public function needsEnvironment() - { - return $this->options['needs_environment']; - } - - public function needsContext() - { - return $this->options['needs_context']; - } - - public function getSafe(Twig_Node $filterArgs) - { - if (null !== $this->options['is_safe']) { - return $this->options['is_safe']; - } - - if (null !== $this->options['is_safe_callback']) { - return call_user_func($this->options['is_safe_callback'], $filterArgs); - } - } - - public function getPreservesSafety() - { - return $this->options['preserves_safety']; - } - - public function getPreEscape() - { - return $this->options['pre_escape']; - } - - public function isVariadic() - { - return $this->options['is_variadic']; - } - - public function isDeprecated() - { - return (bool) $this->options['deprecated']; - } - - public function getDeprecatedVersion() - { - return $this->options['deprecated']; - } - - public function getAlternative() - { - return $this->options['alternative']; } } - -class_alias('Twig_SimpleFilter', 'Twig\TwigFilter', false); diff --git a/vendor/twig/twig/lib/Twig/SimpleFunction.php b/vendor/twig/twig/lib/Twig/SimpleFunction.php index a6aa7ca744b84c8ae8bf0ff2ad2319440319456b..6ec2abce155b94c8ba29db42dc86eddbb944b024 100644 --- a/vendor/twig/twig/lib/Twig/SimpleFunction.php +++ b/vendor/twig/twig/lib/Twig/SimpleFunction.php @@ -1,111 +1,11 @@ <?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\TwigFunction; -/** - * Represents a template function. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_SimpleFunction -{ - protected $name; - protected $callable; - protected $options; - protected $arguments = array(); +class_exists('Twig\TwigFunction'); - public function __construct($name, $callable, array $options = array()) +if (\false) { + class Twig_SimpleFunction extends TwigFunction { - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge(array( - 'needs_environment' => false, - 'needs_context' => false, - 'is_variadic' => false, - 'is_safe' => null, - 'is_safe_callback' => null, - 'node_class' => 'Twig_Node_Expression_Function', - 'deprecated' => false, - 'alternative' => null, - ), $options); - } - - public function getName() - { - return $this->name; - } - - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } - - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - public function getArguments() - { - return $this->arguments; - } - - public function needsEnvironment() - { - return $this->options['needs_environment']; - } - - public function needsContext() - { - return $this->options['needs_context']; - } - - public function getSafe(Twig_Node $functionArgs) - { - if (null !== $this->options['is_safe']) { - return $this->options['is_safe']; - } - - if (null !== $this->options['is_safe_callback']) { - return call_user_func($this->options['is_safe_callback'], $functionArgs); - } - - return array(); - } - - public function isVariadic() - { - return $this->options['is_variadic']; - } - - public function isDeprecated() - { - return (bool) $this->options['deprecated']; - } - - public function getDeprecatedVersion() - { - return $this->options['deprecated']; - } - - public function getAlternative() - { - return $this->options['alternative']; } } - -class_alias('Twig_SimpleFunction', 'Twig\TwigFunction', false); diff --git a/vendor/twig/twig/lib/Twig/SimpleTest.php b/vendor/twig/twig/lib/Twig/SimpleTest.php index fee5778b3e008c3b168a7193b6ceacca85d20556..e1d20294711121b705f02c07793fccb7c9f58fa3 100644 --- a/vendor/twig/twig/lib/Twig/SimpleTest.php +++ b/vendor/twig/twig/lib/Twig/SimpleTest.php @@ -1,73 +1,11 @@ <?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\TwigTest; -/** - * Represents a template test. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_SimpleTest -{ - protected $name; - protected $callable; - protected $options; +class_exists('Twig\TwigTest'); - public function __construct($name, $callable, array $options = array()) +if (\false) { + class Twig_SimpleTest extends TwigTest { - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge(array( - 'is_variadic' => false, - 'node_class' => 'Twig_Node_Expression_Test', - 'deprecated' => false, - 'alternative' => null, - ), $options); - } - - public function getName() - { - return $this->name; - } - - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } - - public function isVariadic() - { - return $this->options['is_variadic']; - } - - public function isDeprecated() - { - return (bool) $this->options['deprecated']; - } - - public function getDeprecatedVersion() - { - return $this->options['deprecated']; - } - - public function getAlternative() - { - return $this->options['alternative']; } } - -class_alias('Twig_SimpleTest', 'Twig\TwigTest', false); diff --git a/vendor/twig/twig/lib/Twig/Source.php b/vendor/twig/twig/lib/Twig/Source.php index bd8d869f3316cc8f3ddcd098be1c96be204a3b2f..6d3c1b97761dcc02494f44850d0c159b0caf3111 100644 --- a/vendor/twig/twig/lib/Twig/Source.php +++ b/vendor/twig/twig/lib/Twig/Source.php @@ -1,53 +1,11 @@ <?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\Source; -/** - * Holds information about a non-compiled Twig template. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Source -{ - private $code; - private $name; - private $path; +class_exists('Twig\Source'); - /** - * @param string $code The template source code - * @param string $name The template logical name - * @param string $path The filesystem path of the template if any - */ - public function __construct($code, $name, $path = '') +if (\false) { + class Twig_Source extends Source { - $this->code = $code; - $this->name = $name; - $this->path = $path; - } - - public function getCode() - { - return $this->code; - } - - public function getName() - { - return $this->name; - } - - public function getPath() - { - return $this->path; } } - -class_alias('Twig_Source', 'Twig\Source', false); diff --git a/vendor/twig/twig/lib/Twig/SourceContextLoaderInterface.php b/vendor/twig/twig/lib/Twig/SourceContextLoaderInterface.php index a6e8c42550a18d06ecafc3c0570d86ff2a4110f8..3289ac1d2b6c78a07dae53af5a021441465df945 100644 --- a/vendor/twig/twig/lib/Twig/SourceContextLoaderInterface.php +++ b/vendor/twig/twig/lib/Twig/SourceContextLoaderInterface.php @@ -1,33 +1,11 @@ <?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\Loader\SourceContextLoaderInterface; -/** - * Adds a getSourceContext() method for loaders. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @deprecated since 1.27 (to be removed in 3.0) - */ -interface Twig_SourceContextLoaderInterface -{ - /** - * Returns the source context for a given template logical name. - * - * @param string $name The template logical name - * - * @return Twig_Source - * - * @throws Twig_Error_Loader When $name is not found - */ - public function getSourceContext($name); -} +class_exists('Twig\Loader\SourceContextLoaderInterface'); -class_alias('Twig_SourceContextLoaderInterface', 'Twig\Loader\SourceContextLoaderInterface', false); +if (\false) { + class Twig_SourceContextLoaderInterface extends SourceContextLoaderInterface + { + } +} diff --git a/vendor/twig/twig/lib/Twig/Template.php b/vendor/twig/twig/lib/Twig/Template.php index 3709232afb70b1d5c4f16be67f1557c3dadc76c9..ef5988c91f290fad21726bdf3936a66e709c29cf 100644 --- a/vendor/twig/twig/lib/Twig/Template.php +++ b/vendor/twig/twig/lib/Twig/Template.php @@ -1,708 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Template; -/** - * Default base class for compiled templates. - * - * This class is an implementation detail of how template compilation currently - * works, which might change. It should never be used directly. Use $twig->load() - * instead, which returns an instance of Twig_TemplateWrapper. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @internal - */ -abstract class Twig_Template implements Twig_TemplateInterface -{ - /** - * @internal - */ - protected static $cache = array(); +class_exists('Twig\Template'); - protected $parent; - protected $parents = array(); - protected $env; - protected $blocks = array(); - protected $traits = array(); - - public function __construct(Twig_Environment $env) - { - $this->env = $env; - } - - /** - * @internal this method will be removed in 2.0 and is only used internally to provide an upgrade path from 1.x to 2.0 - */ - public function __toString() - { - return $this->getTemplateName(); - } - - /** - * Returns the template name. - * - * @return string The template name - */ - abstract public function getTemplateName(); - - /** - * Returns debug information about the template. - * - * @return array Debug information - * - * @internal - */ - public function getDebugInfo() - { - return array(); - } - - /** - * Returns the template source code. - * - * @return string The template source code - * - * @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead - */ - public function getSource() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED); - - return ''; - } - - /** - * Returns information about the original template source code. - * - * @return Twig_Source - */ - public function getSourceContext() - { - return new Twig_Source('', $this->getTemplateName()); - } - - /** - * @deprecated since 1.20 (to be removed in 2.0) - */ - public function getEnvironment() - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 1.20 and will be removed in 2.0.', E_USER_DEPRECATED); - - return $this->env; - } - - /** - * Returns the parent template. - * - * This method is for internal use only and should never be called - * directly. - * - * @param array $context - * - * @return Twig_TemplateInterface|false The parent template or false if there is no parent - * - * @internal - */ - public function getParent(array $context) - { - if (null !== $this->parent) { - return $this->parent; - } - - try { - $parent = $this->doGetParent($context); - - if (false === $parent) { - return false; - } - - if ($parent instanceof self) { - return $this->parents[$parent->getTemplateName()] = $parent; - } - - if (!isset($this->parents[$parent])) { - $this->parents[$parent] = $this->loadTemplate($parent); - } - } catch (Twig_Error_Loader $e) { - $e->setSourceContext(null); - $e->guess(); - - throw $e; - } - - return $this->parents[$parent]; - } - - protected function doGetParent(array $context) - { - return false; - } - - public function isTraitable() - { - return true; - } - - /** - * Displays a parent block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to display from the parent - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @internal - */ - public function displayParentBlock($name, array $context, array $blocks = array()) - { - $name = (string) $name; - - if (isset($this->traits[$name])) { - $this->traits[$name][0]->displayBlock($name, $context, $blocks, false); - } elseif (false !== $parent = $this->getParent($context)) { - $parent->displayBlock($name, $context, $blocks, false); - } else { - throw new Twig_Error_Runtime(sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext()); - } - } - - /** - * Displays a block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to display - * @param array $context The context - * @param array $blocks The current set of blocks - * @param bool $useBlocks Whether to use the current set of blocks - * - * @internal - */ - public function displayBlock($name, array $context, array $blocks = array(), $useBlocks = true) - { - $name = (string) $name; - - if ($useBlocks && isset($blocks[$name])) { - $template = $blocks[$name][0]; - $block = $blocks[$name][1]; - } elseif (isset($this->blocks[$name])) { - $template = $this->blocks[$name][0]; - $block = $this->blocks[$name][1]; - } else { - $template = null; - $block = null; - } - - // avoid RCEs when sandbox is enabled - if (null !== $template && !$template instanceof self) { - throw new LogicException('A block must be a method on a Twig_Template instance.'); - } - - if (null !== $template) { - try { - $template->$block($context, $blocks); - } catch (Twig_Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($template->getSourceContext()); - } - - // this is mostly useful for Twig_Error_Loader exceptions - // see Twig_Error_Loader - if (false === $e->getTemplateLine()) { - $e->setTemplateLine(-1); - $e->guess(); - } - - throw $e; - } catch (Exception $e) { - throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e); - } - } elseif (false !== $parent = $this->getParent($context)) { - $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false); - } else { - @trigger_error(sprintf('Silent display of undefined block "%s" in template "%s" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block(\'%s\') is defined" expression to test for block existence.', $name, $this->getTemplateName(), $name), E_USER_DEPRECATED); - } - } - - /** - * Renders a parent block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to render from the parent - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return string The rendered block - * - * @internal - */ - public function renderParentBlock($name, array $context, array $blocks = array()) - { - ob_start(); - $this->displayParentBlock($name, $context, $blocks); - - return ob_get_clean(); - } - - /** - * Renders a block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to render - * @param array $context The context - * @param array $blocks The current set of blocks - * @param bool $useBlocks Whether to use the current set of blocks - * - * @return string The rendered block - * - * @internal - */ - public function renderBlock($name, array $context, array $blocks = array(), $useBlocks = true) - { - ob_start(); - $this->displayBlock($name, $context, $blocks, $useBlocks); - - return ob_get_clean(); - } - - /** - * Returns whether a block exists or not in the current context of the template. - * - * This method checks blocks defined in the current template - * or defined in "used" traits or defined in parent templates. - * - * @param string $name The block name - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return bool true if the block exists, false otherwise - * - * @internal - */ - public function hasBlock($name, array $context = null, array $blocks = array()) - { - if (null === $context) { - @trigger_error('The '.__METHOD__.' method is internal and should never be called; calling it directly is deprecated since version 1.28 and won\'t be possible anymore in 2.0.', E_USER_DEPRECATED); - - return isset($this->blocks[(string) $name]); - } - - if (isset($blocks[$name])) { - return $blocks[$name][0] instanceof self; - } - - if (isset($this->blocks[$name])) { - return true; - } - - if (false !== $parent = $this->getParent($context)) { - return $parent->hasBlock($name, $context); - } - - return false; - } - - /** - * Returns all block names in the current context of the template. - * - * This method checks blocks defined in the current template - * or defined in "used" traits or defined in parent templates. - * - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return array An array of block names - * - * @internal - */ - public function getBlockNames(array $context = null, array $blocks = array()) - { - if (null === $context) { - @trigger_error('The '.__METHOD__.' method is internal and should never be called; calling it directly is deprecated since version 1.28 and won\'t be possible anymore in 2.0.', E_USER_DEPRECATED); - - return array_keys($this->blocks); - } - - $names = array_merge(array_keys($blocks), array_keys($this->blocks)); - - if (false !== $parent = $this->getParent($context)) { - $names = array_merge($names, $parent->getBlockNames($context)); - } - - return array_unique($names); - } - - protected function loadTemplate($template, $templateName = null, $line = null, $index = null) - { - try { - if (is_array($template)) { - return $this->env->resolveTemplate($template); - } - - if ($template instanceof self) { - return $template; - } - - if ($template instanceof Twig_TemplateWrapper) { - return $template; - } - - return $this->env->loadTemplate($template, $index); - } catch (Twig_Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($templateName ? new Twig_Source('', $templateName) : $this->getSourceContext()); - } - - if ($e->getTemplateLine()) { - throw $e; - } - - if (!$line) { - $e->guess(); - } else { - $e->setTemplateLine($line); - } - - throw $e; - } - } - - /** - * Returns all blocks. - * - * This method is for internal use only and should never be called - * directly. - * - * @return array An array of blocks - * - * @internal - */ - public function getBlocks() - { - return $this->blocks; - } - - public function display(array $context, array $blocks = array()) +if (\false) { + class Twig_Template extends Template { - $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks)); - } - - public function render(array $context) - { - $level = ob_get_level(); - ob_start(); - try { - $this->display($context); - } catch (Exception $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } catch (Throwable $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } - - return ob_get_clean(); - } - - protected function displayWithErrorHandling(array $context, array $blocks = array()) - { - try { - $this->doDisplay($context, $blocks); - } catch (Twig_Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($this->getSourceContext()); - } - - // this is mostly useful for Twig_Error_Loader exceptions - // see Twig_Error_Loader - if (false === $e->getTemplateLine()) { - $e->setTemplateLine(-1); - $e->guess(); - } - - throw $e; - } catch (Exception $e) { - throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e); - } - } - - /** - * Auto-generated method to display the template with the given context. - * - * @param array $context An array of parameters to pass to the template - * @param array $blocks An array of blocks to pass to the template - */ - abstract protected function doDisplay(array $context, array $blocks = array()); - - /** - * Returns a variable from the context. - * - * This method is for internal use only and should never be called - * directly. - * - * This method should not be overridden in a sub-class as this is an - * implementation detail that has been introduced to optimize variable - * access for versions of PHP before 5.4. This is not a way to override - * the way to get a variable value. - * - * @param array $context The context - * @param string $item The variable to return from the context - * @param bool $ignoreStrictCheck Whether to ignore the strict variable check or not - * - * @return mixed The content of the context variable - * - * @throws Twig_Error_Runtime if the variable does not exist and Twig is running in strict mode - * - * @internal - */ - final protected function getContext($context, $item, $ignoreStrictCheck = false) - { - if (!array_key_exists($item, $context)) { - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return; - } - - throw new Twig_Error_Runtime(sprintf('Variable "%s" does not exist.', $item), -1, $this->getSourceContext()); - } - - return $context[$item]; - } - - /** - * Returns the attribute value for a given array/object. - * - * @param mixed $object The object or array from where to get the item - * @param mixed $item The item to get from the array or object - * @param array $arguments An array of arguments to pass if the item is an object method - * @param string $type The type of attribute (@see Twig_Template constants) - * @param bool $isDefinedTest Whether this is only a defined check - * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not - * - * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true - * - * @throws Twig_Error_Runtime if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false - * - * @internal - */ - protected function getAttribute($object, $item, array $arguments = array(), $type = self::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) - { - // array - if (self::METHOD_CALL !== $type) { - $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item; - - if ((is_array($object) && (isset($object[$arrayItem]) || array_key_exists($arrayItem, $object))) - || ($object instanceof ArrayAccess && isset($object[$arrayItem])) - ) { - if ($isDefinedTest) { - return true; - } - - return $object[$arrayItem]; - } - - if (self::ARRAY_CALL === $type || !is_object($object)) { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return; - } - - if ($object instanceof ArrayAccess) { - $message = sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist.', $arrayItem, get_class($object)); - } elseif (is_object($object)) { - $message = sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface.', $item, get_class($object)); - } elseif (is_array($object)) { - if (empty($object)) { - $message = sprintf('Key "%s" does not exist as the array is empty.', $arrayItem); - } else { - $message = sprintf('Key "%s" for array with keys "%s" does not exist.', $arrayItem, implode(', ', array_keys($object))); - } - } elseif (self::ARRAY_CALL === $type) { - if (null === $object) { - $message = sprintf('Impossible to access a key ("%s") on a null variable.', $item); - } else { - $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s").', $item, gettype($object), $object); - } - } elseif (null === $object) { - $message = sprintf('Impossible to access an attribute ("%s") on a null variable.', $item); - } else { - $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, gettype($object), $object); - } - - throw new Twig_Error_Runtime($message, -1, $this->getSourceContext()); - } - } - - if (!is_object($object)) { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return; - } - - if (null === $object) { - $message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item); - } elseif (is_array($object)) { - $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item); - } else { - $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, gettype($object), $object); - } - - throw new Twig_Error_Runtime($message, -1, $this->getSourceContext()); - } - - // object property - if (self::METHOD_CALL !== $type && !$object instanceof self) { // Twig_Template does not have public properties, and we don't want to allow access to internal ones - if (isset($object->$item) || array_key_exists((string) $item, $object)) { - if ($isDefinedTest) { - return true; - } - - if ($this->env->hasExtension('Twig_Extension_Sandbox')) { - $this->env->getExtension('Twig_Extension_Sandbox')->checkPropertyAllowed($object, $item); - } - - return $object->$item; - } - } - - $class = get_class($object); - - // object method - if (!isset(self::$cache[$class])) { - // get_class_methods returns all methods accessible in the scope, but we only want public ones to be accessible in templates - if ($object instanceof self) { - $ref = new ReflectionClass($class); - $methods = array(); - - foreach ($ref->getMethods(ReflectionMethod::IS_PUBLIC) as $refMethod) { - // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment - if ('getenvironment' !== strtolower($refMethod->name)) { - $methods[] = $refMethod->name; - } - } - } else { - $methods = get_class_methods($object); - } - // sort values to have consistent behavior, so that "get" methods win precedence over "is" methods - sort($methods); - - $cache = array(); - - foreach ($methods as $method) { - $cache[$method] = $method; - $cache[$lcName = strtolower($method)] = $method; - - if ('g' === $lcName[0] && 0 === strpos($lcName, 'get')) { - $name = substr($method, 3); - $lcName = substr($lcName, 3); - } elseif ('i' === $lcName[0] && 0 === strpos($lcName, 'is')) { - $name = substr($method, 2); - $lcName = substr($lcName, 2); - } else { - continue; - } - - // skip get() and is() methods (in which case, $name is empty) - if ($name) { - if (!isset($cache[$name])) { - $cache[$name] = $method; - } - if (!isset($cache[$lcName])) { - $cache[$lcName] = $method; - } - } - } - self::$cache[$class] = $cache; - } - - $call = false; - if (isset(self::$cache[$class][$item])) { - $method = self::$cache[$class][$item]; - } elseif (isset(self::$cache[$class][$lcItem = strtolower($item)])) { - $method = self::$cache[$class][$lcItem]; - } elseif (isset(self::$cache[$class]['__call'])) { - $method = $item; - $call = true; - } else { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { - return; - } - - throw new Twig_Error_Runtime(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), -1, $this->getSourceContext()); - } - - if ($isDefinedTest) { - return true; - } - - if ($this->env->hasExtension('Twig_Extension_Sandbox')) { - $this->env->getExtension('Twig_Extension_Sandbox')->checkMethodAllowed($object, $method); - } - - // Some objects throw exceptions when they have __call, and the method we try - // to call is not supported. If ignoreStrictCheck is true, we should return null. - try { - if (!$arguments) { - $ret = $object->$method(); - } else { - $ret = call_user_func_array(array($object, $method), $arguments); - } - } catch (BadMethodCallException $e) { - if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) { - return; - } - throw $e; - } - - // @deprecated in 1.28 - if ($object instanceof Twig_TemplateInterface) { - $self = $object->getTemplateName() === $this->getTemplateName(); - $message = sprintf('Calling "%s" on template "%s" from template "%s" is deprecated since version 1.28 and won\'t be supported anymore in 2.0.', $item, $object->getTemplateName(), $this->getTemplateName()); - if ('renderBlock' === $method || 'displayBlock' === $method) { - $message .= sprintf(' Use block("%s"%s) instead).', $arguments[0], $self ? '' : ', template'); - } elseif ('hasBlock' === $method) { - $message .= sprintf(' Use "block("%s"%s) is defined" instead).', $arguments[0], $self ? '' : ', template'); - } elseif ('render' === $method || 'display' === $method) { - $message .= sprintf(' Use include("%s") instead).', $object->getTemplateName()); - } - @trigger_error($message, E_USER_DEPRECATED); - - return '' === $ret ? '' : new Twig_Markup($ret, $this->env->getCharset()); - } - - return $ret; } } - -class_alias('Twig_Template', 'Twig\Template', false); diff --git a/vendor/twig/twig/lib/Twig/TemplateInterface.php b/vendor/twig/twig/lib/Twig/TemplateInterface.php index 457ef7d7bb330d829adf9a907ceb44e4b1645bf6..0f767b8fc8d5a9b1fd316c524d47a29e35a5bda6 100644 --- a/vendor/twig/twig/lib/Twig/TemplateInterface.php +++ b/vendor/twig/twig/lib/Twig/TemplateInterface.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +use Twig\Environment; + /** * Interface implemented by all compiled templates. * @@ -37,12 +39,12 @@ public function render(array $context); * @param array $context An array of parameters to pass to the template * @param array $blocks An array of blocks to pass to the template */ - public function display(array $context, array $blocks = array()); + public function display(array $context, array $blocks = []); /** * Returns the bound environment for this template. * - * @return Twig_Environment + * @return Environment */ public function getEnvironment(); } diff --git a/vendor/twig/twig/lib/Twig/TemplateWrapper.php b/vendor/twig/twig/lib/Twig/TemplateWrapper.php index 497f6e9803f2103f02673ed05c9319263a43cd08..6cb4ce4f7ea2f1b2d006ccfff68584c1f6c436e0 100644 --- a/vendor/twig/twig/lib/Twig/TemplateWrapper.php +++ b/vendor/twig/twig/lib/Twig/TemplateWrapper.php @@ -1,133 +1,11 @@ <?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\TemplateWrapper; -/** - * Exposes a template to userland. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -final class Twig_TemplateWrapper -{ - private $env; - private $template; +class_exists('Twig\TemplateWrapper'); - /** - * This method is for internal use only and should never be called - * directly (use Twig_Environment::load() instead). - * - * @internal - */ - public function __construct(Twig_Environment $env, Twig_Template $template) +if (\false) { + class Twig_TemplateWrapper extends TemplateWrapper { - $this->env = $env; - $this->template = $template; - } - - /** - * Renders the template. - * - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered template - */ - public function render($context = array()) - { - return $this->template->render($context); - } - - /** - * Displays the template. - * - * @param array $context An array of parameters to pass to the template - */ - public function display($context = array()) - { - $this->template->display($context); - } - - /** - * Checks if a block is defined. - * - * @param string $name The block name - * @param array $context An array of parameters to pass to the template - * - * @return bool - */ - public function hasBlock($name, $context = array()) - { - return $this->template->hasBlock($name, $context); - } - - /** - * Returns defined block names in the template. - * - * @param array $context An array of parameters to pass to the template - * - * @return string[] An array of defined template block names - */ - public function getBlockNames($context = array()) - { - return $this->template->getBlockNames($context); - } - - /** - * Renders a template block. - * - * @param string $name The block name to render - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered block - */ - public function renderBlock($name, $context = array()) - { - $context = $this->env->mergeGlobals($context); - $level = ob_get_level(); - ob_start(); - try { - $this->template->displayBlock($name, $context); - } catch (Exception $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } catch (Throwable $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } - - return ob_get_clean(); - } - - /** - * Displays a template block. - * - * @param string $name The block name to render - * @param array $context An array of parameters to pass to the template - */ - public function displayBlock($name, $context = array()) - { - $this->template->displayBlock($name, $this->env->mergeGlobals($context)); - } - - /** - * @return Twig_Source - */ - public function getSourceContext() - { - return $this->template->getSourceContext(); } } - -class_alias('Twig_TemplateWrapper', 'Twig\TemplateWrapper', false); diff --git a/vendor/twig/twig/lib/Twig/Test.php b/vendor/twig/twig/lib/Twig/Test.php index b450ec625fe51115aa18cde152cb76a2d0ab0fcf..d032284eac67cf1879f6c1a8f9526b15161f2edb 100644 --- a/vendor/twig/twig/lib/Twig/Test.php +++ b/vendor/twig/twig/lib/Twig/Test.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Test class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleTest instead.', E_USER_DEPRECATED); +@trigger_error('The Twig_Test class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigTest instead.', E_USER_DEPRECATED); /** * Represents a template test. @@ -21,13 +21,13 @@ abstract class Twig_Test implements Twig_TestInterface, Twig_TestCallableInterface { protected $options; - protected $arguments = array(); + protected $arguments = []; - public function __construct(array $options = array()) + public function __construct(array $options = []) { - $this->options = array_merge(array( + $this->options = array_merge([ 'callable' => null, - ), $options); + ], $options); } public function getCallable() diff --git a/vendor/twig/twig/lib/Twig/Test/Function.php b/vendor/twig/twig/lib/Twig/Test/Function.php index 9e83c3f844cdae49ec62cfa3c7e498e931c19b10..a789c4025937dea1f53d8136742a1b1c63b49c1f 100644 --- a/vendor/twig/twig/lib/Twig/Test/Function.php +++ b/vendor/twig/twig/lib/Twig/Test/Function.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Test_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleTest instead.', E_USER_DEPRECATED); +@trigger_error('The Twig_Test_Function class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigTest instead.', E_USER_DEPRECATED); /** * Represents a function template test. @@ -22,7 +22,7 @@ class Twig_Test_Function extends Twig_Test { protected $function; - public function __construct($function, array $options = array()) + public function __construct($function, array $options = []) { $options['callable'] = $function; diff --git a/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php b/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php index 016951aa61147c741742e35b6c7c1582e9f78192..e302bdbaf8aa910e7579df7a48508d84a80cc22c 100644 --- a/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php +++ b/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php @@ -1,249 +1,11 @@ <?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\Test\IntegrationTestCase; -use PHPUnit\Framework\TestCase; +class_exists('Twig\Test\IntegrationTestCase'); -/** - * Integration test helper. - * - * @author Fabien Potencier <fabien@symfony.com> - * @author Karma Dordrak <drak@zikula.org> - */ -abstract class Twig_Test_IntegrationTestCase extends TestCase -{ - /** - * @return string - */ - abstract protected function getFixturesDir(); - - /** - * @return Twig_RuntimeLoaderInterface[] - */ - protected function getRuntimeLoaders() - { - return array(); - } - - /** - * @return Twig_ExtensionInterface[] - */ - protected function getExtensions() - { - return array(); - } - - /** - * @return Twig_SimpleFilter[] - */ - protected function getTwigFilters() - { - return array(); - } - - /** - * @return Twig_SimpleFunction[] - */ - protected function getTwigFunctions() - { - return array(); - } - - /** - * @return Twig_SimpleTest[] - */ - protected function getTwigTests() - { - return array(); - } - - /** - * @dataProvider getTests - */ - public function testIntegration($file, $message, $condition, $templates, $exception, $outputs) - { - $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs); - } - - /** - * @dataProvider getLegacyTests - * @group legacy - */ - public function testLegacyIntegration($file, $message, $condition, $templates, $exception, $outputs) +if (\false) { + class Twig_Test_IntegrationTestCase extends IntegrationTestCase { - $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs); - } - - public function getTests($name, $legacyTests = false) - { - $fixturesDir = realpath($this->getFixturesDir()); - $tests = array(); - - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fixturesDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if (!preg_match('/\.test$/', $file)) { - continue; - } - - if ($legacyTests xor false !== strpos($file->getRealpath(), '.legacy.test')) { - continue; - } - - $test = file_get_contents($file->getRealpath()); - - if (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)\s*(?:--DATA--\s*(.*))?\s*--EXCEPTION--\s*(.*)/sx', $test, $match)) { - $message = $match[1]; - $condition = $match[2]; - $templates = self::parseTemplates($match[3]); - $exception = $match[5]; - $outputs = array(array(null, $match[4], null, '')); - } elseif (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) { - $message = $match[1]; - $condition = $match[2]; - $templates = self::parseTemplates($match[3]); - $exception = false; - preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\-\-DATA\-\-|$)/s', $test, $outputs, PREG_SET_ORDER); - } else { - throw new InvalidArgumentException(sprintf('Test "%s" is not valid.', str_replace($fixturesDir.'/', '', $file))); - } - - $tests[] = array(str_replace($fixturesDir.'/', '', $file), $message, $condition, $templates, $exception, $outputs); - } - - if ($legacyTests && empty($tests)) { - // add a dummy test to avoid a PHPUnit message - return array(array('not', '-', '', array(), '', array())); - } - - return $tests; - } - - public function getLegacyTests() - { - return $this->getTests('testLegacyIntegration', true); - } - - protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs) - { - if (!$outputs) { - $this->markTestSkipped('no legacy tests to run'); - } - - if ($condition) { - eval('$ret = '.$condition.';'); - if (!$ret) { - $this->markTestSkipped($condition); - } - } - - $loader = new Twig_Loader_Array($templates); - - foreach ($outputs as $i => $match) { - $config = array_merge(array( - 'cache' => false, - 'strict_variables' => true, - ), $match[2] ? eval($match[2].';') : array()); - $twig = new Twig_Environment($loader, $config); - $twig->addGlobal('global', 'global'); - foreach ($this->getRuntimeLoaders() as $runtimeLoader) { - $twig->addRuntimeLoader($runtimeLoader); - } - - foreach ($this->getExtensions() as $extension) { - $twig->addExtension($extension); - } - - foreach ($this->getTwigFilters() as $filter) { - $twig->addFilter($filter); - } - - foreach ($this->getTwigTests() as $test) { - $twig->addTest($test); - } - - foreach ($this->getTwigFunctions() as $function) { - $twig->addFunction($function); - } - - // avoid using the same PHP class name for different cases - // only for PHP 5.2+ - if (PHP_VERSION_ID >= 50300) { - $p = new ReflectionProperty($twig, 'templateClassPrefix'); - $p->setAccessible(true); - $p->setValue($twig, '__TwigTemplate_'.hash('sha256', uniqid(mt_rand(), true), false).'_'); - } - - try { - $template = $twig->loadTemplate('index.twig'); - } catch (Exception $e) { - if (false !== $exception) { - $message = $e->getMessage(); - $this->assertSame(trim($exception), trim(sprintf('%s: %s', get_class($e), $message))); - $last = substr($message, strlen($message) - 1); - $this->assertTrue('.' === $last || '?' === $last, $message, 'Exception message must end with a dot or a question mark.'); - - return; - } - - throw new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); - } - - try { - $output = trim($template->render(eval($match[1].';')), "\n "); - } catch (Exception $e) { - if (false !== $exception) { - $this->assertSame(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); - - return; - } - - $e = new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); - - $output = trim(sprintf('%s: %s', get_class($e), $e->getMessage())); - } - - if (false !== $exception) { - list($class) = explode(':', $exception); - $constraintClass = class_exists('PHPUnit\Framework\Constraint\Exception') ? 'PHPUnit\Framework\Constraint\Exception' : 'PHPUnit_Framework_Constraint_Exception'; - $this->assertThat(null, new $constraintClass($class)); - } - - $expected = trim($match[3], "\n "); - - if ($expected !== $output) { - printf("Compiled templates that failed on case %d:\n", $i + 1); - - foreach (array_keys($templates) as $name) { - echo "Template: $name\n"; - $loader = $twig->getLoader(); - if (!$loader instanceof Twig_SourceContextLoaderInterface) { - $source = new Twig_Source($loader->getSource($name), $name); - } else { - $source = $loader->getSourceContext($name); - } - echo $twig->compile($twig->parse($twig->tokenize($source))); - } - } - $this->assertEquals($expected, $output, $message.' (in '.$file.')'); - } - } - - protected static function parseTemplates($test) - { - $templates = array(); - preg_match_all('/--TEMPLATE(?:\((.*?)\))?--(.*?)(?=\-\-TEMPLATE|$)/s', $test, $matches, PREG_SET_ORDER); - foreach ($matches as $match) { - $templates[($match[1] ? $match[1] : 'index.twig')] = $match[2]; - } - - return $templates; } } - -class_alias('Twig_Test_IntegrationTestCase', 'Twig\Test\IntegrationTestCase', false); diff --git a/vendor/twig/twig/lib/Twig/Test/Method.php b/vendor/twig/twig/lib/Twig/Test/Method.php index feccd5db345f0a1e6455c558f702b996f944c962..3559f34dc8cedd337a0b4167d3abfce8c35ffe69 100644 --- a/vendor/twig/twig/lib/Twig/Test/Method.php +++ b/vendor/twig/twig/lib/Twig/Test/Method.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -@trigger_error('The Twig_Test_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleTest instead.', E_USER_DEPRECATED); +use Twig\Extension\ExtensionInterface; + +@trigger_error('The Twig_Test_Method class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigTest instead.', E_USER_DEPRECATED); /** * Represents a method template test. @@ -23,9 +25,9 @@ class Twig_Test_Method extends Twig_Test protected $extension; protected $method; - public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) + public function __construct(ExtensionInterface $extension, $method, array $options = []) { - $options['callable'] = array($extension, $method); + $options['callable'] = [$extension, $method]; parent::__construct($options); @@ -35,6 +37,6 @@ public function __construct(Twig_ExtensionInterface $extension, $method, array $ public function compile() { - return sprintf('$this->env->getExtension(\'%s\')->%s', get_class($this->extension), $this->method); + return sprintf('$this->env->getExtension(\'%s\')->%s', \get_class($this->extension), $this->method); } } diff --git a/vendor/twig/twig/lib/Twig/Test/Node.php b/vendor/twig/twig/lib/Twig/Test/Node.php index 6098a5275f2058563673bed1a467fcc1a14a9bd6..6b5de1597b6cdf2e458eade80d8118b3f187c8f7 100644 --- a/vendor/twig/twig/lib/Twig/Test/Node.php +++ b/vendor/twig/twig/lib/Twig/Test/Node.php @@ -22,7 +22,7 @@ class Twig_Test_Node extends Twig_Test { protected $class; - public function __construct($class, array $options = array()) + public function __construct($class, array $options = []) { parent::__construct($options); diff --git a/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php b/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php index 47942675703a4799ae11480b311b355e371de7f1..62aaaaff7d797226f7817728b1bcf35b8e965f10 100644 --- a/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php +++ b/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php @@ -1,75 +1,11 @@ <?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\Test\NodeTestCase; -use PHPUnit\Framework\TestCase; +class_exists('Twig\Test\NodeTestCase'); -abstract class Twig_Test_NodeTestCase extends TestCase -{ - abstract public function getTests(); - - /** - * @dataProvider getTests - */ - public function testCompile($node, $source, $environment = null, $isPattern = false) - { - $this->assertNodeCompilation($source, $node, $environment, $isPattern); - } - - public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null, $isPattern = false) - { - $compiler = $this->getCompiler($environment); - $compiler->compile($node); - - if ($isPattern) { - $this->assertStringMatchesFormat($source, trim($compiler->getSource())); - } else { - $this->assertEquals($source, trim($compiler->getSource())); - } - } - - protected function getCompiler(Twig_Environment $environment = null) - { - return new Twig_Compiler(null === $environment ? $this->getEnvironment() : $environment); - } - - protected function getEnvironment() +if (\false) { + class Twig_Test_NodeTestCase extends NodeTestCase { - return new Twig_Environment(new Twig_Loader_Array(array())); - } - - protected function getVariableGetter($name, $line = false) - { - $line = $line > 0 ? "// line {$line}\n" : ''; - - if (PHP_VERSION_ID >= 70000) { - return sprintf('%s($context["%s"] ?? null)', $line, $name, $name); - } - - if (PHP_VERSION_ID >= 50400) { - return sprintf('%s(isset($context["%s"]) ? $context["%s"] : null)', $line, $name, $name); - } - - return sprintf('%s$this->getContext($context, "%s")', $line, $name); - } - - protected function getAttributeGetter() - { - if (function_exists('twig_template_get_attributes')) { - return 'twig_template_get_attributes($this, '; - } - - return '$this->getAttribute('; } } - -class_alias('Twig_Test_NodeTestCase', 'Twig\Test\NodeTestCase', false); -class_exists('Twig_Environment'); -class_exists('Twig_Node'); diff --git a/vendor/twig/twig/lib/Twig/Token.php b/vendor/twig/twig/lib/Twig/Token.php index c7850eccc3d8a3f84105d4ce7d7dd69b9f326b0e..e4d18069eb64d876f9b0f82bfd58a1701c48e90b 100644 --- a/vendor/twig/twig/lib/Twig/Token.php +++ b/vendor/twig/twig/lib/Twig/Token.php @@ -1,207 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\Token; -/** - * Represents a Token. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @final - */ -class Twig_Token -{ - protected $value; - protected $type; - protected $lineno; +class_exists('Twig\Token'); - const EOF_TYPE = -1; - const TEXT_TYPE = 0; - const BLOCK_START_TYPE = 1; - const VAR_START_TYPE = 2; - const BLOCK_END_TYPE = 3; - const VAR_END_TYPE = 4; - const NAME_TYPE = 5; - const NUMBER_TYPE = 6; - const STRING_TYPE = 7; - const OPERATOR_TYPE = 8; - const PUNCTUATION_TYPE = 9; - const INTERPOLATION_START_TYPE = 10; - const INTERPOLATION_END_TYPE = 11; - - /** - * @param int $type The type of the token - * @param string $value The token value - * @param int $lineno The line position in the source - */ - public function __construct($type, $value, $lineno) - { - $this->type = $type; - $this->value = $value; - $this->lineno = $lineno; - } - - public function __toString() +if (\false) { + class Twig_Token extends Token { - return sprintf('%s(%s)', self::typeToString($this->type, true), $this->value); - } - - /** - * Tests the current token for a type and/or a value. - * - * Parameters may be: - * * just type - * * type and value (or array of possible values) - * * just value (or array of possible values) (NAME_TYPE is used as type) - * - * @param array|int $type The type to test - * @param array|string|null $values The token value - * - * @return bool - */ - public function test($type, $values = null) - { - if (null === $values && !is_int($type)) { - $values = $type; - $type = self::NAME_TYPE; - } - - return ($this->type === $type) && ( - null === $values || - (is_array($values) && in_array($this->value, $values)) || - $this->value == $values - ); - } - - /** - * @return int - */ - public function getLine() - { - return $this->lineno; - } - - /** - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * Returns the constant representation (internal) of a given type. - * - * @param int $type The type as an integer - * @param bool $short Whether to return a short representation or not - * - * @return string The string representation - */ - public static function typeToString($type, $short = false) - { - switch ($type) { - case self::EOF_TYPE: - $name = 'EOF_TYPE'; - break; - case self::TEXT_TYPE: - $name = 'TEXT_TYPE'; - break; - case self::BLOCK_START_TYPE: - $name = 'BLOCK_START_TYPE'; - break; - case self::VAR_START_TYPE: - $name = 'VAR_START_TYPE'; - break; - case self::BLOCK_END_TYPE: - $name = 'BLOCK_END_TYPE'; - break; - case self::VAR_END_TYPE: - $name = 'VAR_END_TYPE'; - break; - case self::NAME_TYPE: - $name = 'NAME_TYPE'; - break; - case self::NUMBER_TYPE: - $name = 'NUMBER_TYPE'; - break; - case self::STRING_TYPE: - $name = 'STRING_TYPE'; - break; - case self::OPERATOR_TYPE: - $name = 'OPERATOR_TYPE'; - break; - case self::PUNCTUATION_TYPE: - $name = 'PUNCTUATION_TYPE'; - break; - case self::INTERPOLATION_START_TYPE: - $name = 'INTERPOLATION_START_TYPE'; - break; - case self::INTERPOLATION_END_TYPE: - $name = 'INTERPOLATION_END_TYPE'; - break; - default: - throw new LogicException(sprintf('Token of type "%s" does not exist.', $type)); - } - - return $short ? $name : 'Twig_Token::'.$name; - } - - /** - * Returns the English representation of a given type. - * - * @param int $type The type as an integer - * - * @return string The string representation - */ - public static function typeToEnglish($type) - { - switch ($type) { - case self::EOF_TYPE: - return 'end of template'; - case self::TEXT_TYPE: - return 'text'; - case self::BLOCK_START_TYPE: - return 'begin of statement block'; - case self::VAR_START_TYPE: - return 'begin of print statement'; - case self::BLOCK_END_TYPE: - return 'end of statement block'; - case self::VAR_END_TYPE: - return 'end of print statement'; - case self::NAME_TYPE: - return 'name'; - case self::NUMBER_TYPE: - return 'number'; - case self::STRING_TYPE: - return 'string'; - case self::OPERATOR_TYPE: - return 'operator'; - case self::PUNCTUATION_TYPE: - return 'punctuation'; - case self::INTERPOLATION_START_TYPE: - return 'begin of string interpolation'; - case self::INTERPOLATION_END_TYPE: - return 'end of string interpolation'; - default: - throw new LogicException(sprintf('Token of type "%s" does not exist.', $type)); - } } } - -class_alias('Twig_Token', 'Twig\Token', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser.php b/vendor/twig/twig/lib/Twig/TokenParser.php index 1b4de14da53cdb60f46dac3032616147df2849a8..c0595438ab0d51fd92a81cc6c2d7d93b3514c225 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser.php +++ b/vendor/twig/twig/lib/Twig/TokenParser.php @@ -1,33 +1,11 @@ <?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\TokenParser\AbstractTokenParser; -/** - * Base class for all token parsers. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -abstract class Twig_TokenParser implements Twig_TokenParserInterface -{ - /** - * @var Twig_Parser - */ - protected $parser; +class_exists('Twig\TokenParser\AbstractTokenParser'); - /** - * Sets the parser associated with this token parser. - */ - public function setParser(Twig_Parser $parser) +if (\false) { + class Twig_TokenParser extends AbstractTokenParser { - $this->parser = $parser; } } - -class_alias('Twig_TokenParser', 'Twig\TokenParser\AbstractTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php b/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php index a20dedd18e6048ea7428655979365da5713305a8..3f9e528d2e88ac1cb9da581b1e41c31e235805c9 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php @@ -1,83 +1,11 @@ <?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\TokenParser\AutoEscapeTokenParser; -/** - * Marks a section of a template to be escaped or not. - * - * <pre> - * {% autoescape true %} - * Everything will be automatically escaped in this block - * {% endautoescape %} - * - * {% autoescape false %} - * Everything will be outputed as is in this block - * {% endautoescape %} - * - * {% autoescape true js %} - * Everything will be automatically escaped in this block - * using the js escaping strategy - * {% endautoescape %} - * </pre> - * - * @final - */ -class Twig_TokenParser_AutoEscape extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - - if ($stream->test(Twig_Token::BLOCK_END_TYPE)) { - $value = 'html'; - } else { - $expr = $this->parser->getExpressionParser()->parseExpression(); - if (!$expr instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax('An escaping strategy must be a string or a bool.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - $value = $expr->getAttribute('value'); - - $compat = true === $value || false === $value; - - if (true === $value) { - $value = 'html'; - } - - if ($compat && $stream->test(Twig_Token::NAME_TYPE)) { - @trigger_error('Using the autoescape tag with "true" or "false" before the strategy name is deprecated since version 1.21.', E_USER_DEPRECATED); - - if (false === $value) { - throw new Twig_Error_Syntax('Unexpected escaping strategy as you set autoescaping to false.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - - $value = $stream->next()->getValue(); - } - } +class_exists('Twig\TokenParser\AutoEscapeTokenParser'); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_AutoEscape($value, $body, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) +if (\false) { + class Twig_TokenParser_AutoEscape extends AutoEscapeTokenParser { - return $token->test('endautoescape'); - } - - public function getTag() - { - return 'autoescape'; } } - -class_alias('Twig_TokenParser_AutoEscape', 'Twig\TokenParser\AutoEscapeTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Block.php b/vendor/twig/twig/lib/Twig/TokenParser/Block.php index f30f86b5812491120e792aa77b1d56bc835efe94..d2f687702353a831874cab9d86ac231c0aa8fe98 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Block.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Block.php @@ -1,73 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\TokenParser\BlockTokenParser; -/** - * Marks a section of a template as being reusable. - * - * <pre> - * {% block head %} - * <link rel="stylesheet" href="style.css" /> - * <title>{% block title %}{% endblock %} - My Webpage</title> - * {% endblock %} - * </pre> - * - * @final - */ -class Twig_TokenParser_Block extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - if ($this->parser->hasBlock($name)) { - throw new Twig_Error_Syntax(sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getTemplateLine()), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - $this->parser->setBlock($name, $block = new Twig_Node_Block($name, new Twig_Node(array()), $lineno)); - $this->parser->pushLocalScope(); - $this->parser->pushBlockStack($name); - - if ($stream->nextIf(Twig_Token::BLOCK_END_TYPE)) { - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) { - $value = $token->getValue(); - - if ($value != $name) { - throw new Twig_Error_Syntax(sprintf('Expected endblock for block "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } - } else { - $body = new Twig_Node(array( - new Twig_Node_Print($this->parser->getExpressionParser()->parseExpression(), $lineno), - )); - } - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $block->setNode('body', $body); - $this->parser->popBlockStack(); - $this->parser->popLocalScope(); - - return new Twig_Node_BlockReference($name, $lineno, $this->getTag()); - } +class_exists('Twig\TokenParser\BlockTokenParser'); - public function decideBlockEnd(Twig_Token $token) +if (\false) { + class Twig_TokenParser_Block extends BlockTokenParser { - return $token->test('endblock'); - } - - public function getTag() - { - return 'block'; } } - -class_alias('Twig_TokenParser_Block', 'Twig\TokenParser\BlockTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Deprecated.php b/vendor/twig/twig/lib/Twig/TokenParser/Deprecated.php new file mode 100644 index 0000000000000000000000000000000000000000..9a74fe43e13a91ab6c6e2dbe688726ff20202b13 --- /dev/null +++ b/vendor/twig/twig/lib/Twig/TokenParser/Deprecated.php @@ -0,0 +1,11 @@ +<?php + +use Twig\TokenParser\DeprecatedTokenParser; + +class_exists('Twig\TokenParser\DeprecatedTokenParser'); + +if (\false) { + class Twig_TokenParser_Deprecated extends DeprecatedTokenParser + { + } +} diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Do.php b/vendor/twig/twig/lib/Twig/TokenParser/Do.php index 8ce088089e0c6440efc67e15abb19483a2551e2a..0750e471ecced9f7b21eb5279531430494d4ea22 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Do.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Do.php @@ -1,34 +1,11 @@ <?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\TokenParser\DoTokenParser; -/** - * Evaluates an expression, discarding the returned value. - * - * @final - */ -class Twig_TokenParser_Do extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $expr = $this->parser->getExpressionParser()->parseExpression(); - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); +class_exists('Twig\TokenParser\DoTokenParser'); - return new Twig_Node_Do($expr, $token->getLine(), $this->getTag()); - } - - public function getTag() +if (\false) { + class Twig_TokenParser_Do extends DoTokenParser { - return 'do'; } } - -class_alias('Twig_TokenParser_Do', 'Twig\TokenParser\DoTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Embed.php b/vendor/twig/twig/lib/Twig/TokenParser/Embed.php index 44644cc6bbdf335a4182d44208ec2859dd8ee181..a60c26734f0a64c0e5c41da60317944218b91a29 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Embed.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Embed.php @@ -1,67 +1,11 @@ <?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\TokenParser\EmbedTokenParser; -/** - * Embeds a template. - * - * @final - */ -class Twig_TokenParser_Embed extends Twig_TokenParser_Include -{ - public function parse(Twig_Token $token) - { - $stream = $this->parser->getStream(); - - $parent = $this->parser->getExpressionParser()->parseExpression(); - - list($variables, $only, $ignoreMissing) = $this->parseArguments(); - - $parentToken = $fakeParentToken = new Twig_Token(Twig_Token::STRING_TYPE, '__parent__', $token->getLine()); - if ($parent instanceof Twig_Node_Expression_Constant) { - $parentToken = new Twig_Token(Twig_Token::STRING_TYPE, $parent->getAttribute('value'), $token->getLine()); - } elseif ($parent instanceof Twig_Node_Expression_Name) { - $parentToken = new Twig_Token(Twig_Token::NAME_TYPE, $parent->getAttribute('name'), $token->getLine()); - } - - // inject a fake parent to make the parent() function work - $stream->injectTokens(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', $token->getLine()), - new Twig_Token(Twig_Token::NAME_TYPE, 'extends', $token->getLine()), - $parentToken, - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', $token->getLine()), - )); - - $module = $this->parser->parse($stream, array($this, 'decideBlockEnd'), true); - - // override the parent with the correct one - if ($fakeParentToken === $parentToken) { - $module->setNode('parent', $parent); - } - - $this->parser->embedTemplate($module); +class_exists('Twig\TokenParser\EmbedTokenParser'); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Embed($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) +if (\false) { + class Twig_TokenParser_Embed extends EmbedTokenParser { - return $token->test('endembed'); - } - - public function getTag() - { - return 'embed'; } } - -class_alias('Twig_TokenParser_Embed', 'Twig\TokenParser\EmbedTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Extends.php b/vendor/twig/twig/lib/Twig/TokenParser/Extends.php index 31168ccec36d7943306f89eba92fe15e6bbccc99..79cc2d3a3dad2b8ebce539040301483c4ecc391d 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Extends.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Extends.php @@ -1,46 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\TokenParser\ExtendsTokenParser; -/** - * Extends a template by another one. - * - * <pre> - * {% extends "base.html" %} - * </pre> - * - * @final - */ -class Twig_TokenParser_Extends extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $stream = $this->parser->getStream(); - - if (!$this->parser->isMainScope()) { - throw new Twig_Error_Syntax('Cannot extend from a block.', $token->getLine(), $stream->getSourceContext()); - } - - if (null !== $this->parser->getParent()) { - throw new Twig_Error_Syntax('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext()); - } - $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); +class_exists('Twig\TokenParser\ExtendsTokenParser'); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - } - - public function getTag() +if (\false) { + class Twig_TokenParser_Extends extends ExtendsTokenParser { - return 'extends'; } } - -class_alias('Twig_TokenParser_Extends', 'Twig\TokenParser\ExtendsTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Filter.php b/vendor/twig/twig/lib/Twig/TokenParser/Filter.php index 760178293e752a0f8ed0fc796783bb3d67de54bd..5110c2344f0db4c30e88cbb31339e66ab0592832 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Filter.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Filter.php @@ -1,53 +1,11 @@ <?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\TokenParser\FilterTokenParser; -/** - * Filters a section of a template by applying filters. - * - * <pre> - * {% filter upper %} - * This text becomes uppercase - * {% endfilter %} - * </pre> - * - * @final - */ -class Twig_TokenParser_Filter extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $name = $this->parser->getVarName(); - $ref = new Twig_Node_Expression_BlockReference(new Twig_Node_Expression_Constant($name, $token->getLine()), null, $token->getLine(), $this->getTag()); - - $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - $block = new Twig_Node_Block($name, $body, $token->getLine()); - $this->parser->setBlock($name, $block); - - return new Twig_Node_Print($filter, $token->getLine(), $this->getTag()); - } +class_exists('Twig\TokenParser\FilterTokenParser'); - public function decideBlockEnd(Twig_Token $token) +if (\false) { + class Twig_TokenParser_Filter extends FilterTokenParser { - return $token->test('endfilter'); - } - - public function getTag() - { - return 'filter'; } } - -class_alias('Twig_TokenParser_Filter', 'Twig\TokenParser\FilterTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Flush.php b/vendor/twig/twig/lib/Twig/TokenParser/Flush.php index 51832c77e11689cae4efa08410e00921804b6ceb..df8be30ddf9e6ddadb15b002c23140181a446abf 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Flush.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Flush.php @@ -1,34 +1,11 @@ <?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\TokenParser\FlushTokenParser; -/** - * Flushes the output to the client. - * - * @see flush() - * - * @final - */ -class Twig_TokenParser_Flush extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Flush($token->getLine(), $this->getTag()); - } +class_exists('Twig\TokenParser\FlushTokenParser'); - public function getTag() +if (\false) { + class Twig_TokenParser_Flush extends FlushTokenParser { - return 'flush'; } } - -class_alias('Twig_TokenParser_Flush', 'Twig\TokenParser\FlushTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/For.php b/vendor/twig/twig/lib/Twig/TokenParser/For.php index 8e737c5fafb68cdf67e1107c3a8b5f0b15a55cb7..596dad785b7f70fd612f284d63d6fc267c52383d 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/For.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/For.php @@ -1,127 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\TokenParser\ForTokenParser; -/** - * Loops over each item of a sequence. - * - * <pre> - * <ul> - * {% for user in users %} - * <li>{{ user.username|e }}</li> - * {% endfor %} - * </ul> - * </pre> - * - * @final - */ -class Twig_TokenParser_For extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $targets = $this->parser->getExpressionParser()->parseAssignmentExpression(); - $stream->expect(Twig_Token::OPERATOR_TYPE, 'in'); - $seq = $this->parser->getExpressionParser()->parseExpression(); - - $ifexpr = null; - if ($stream->nextIf(Twig_Token::NAME_TYPE, 'if')) { - $ifexpr = $this->parser->getExpressionParser()->parseExpression(); - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideForFork')); - if ('else' == $stream->next()->getValue()) { - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $else = $this->parser->subparse(array($this, 'decideForEnd'), true); - } else { - $else = null; - } - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - if (count($targets) > 1) { - $keyTarget = $targets->getNode(0); - $keyTarget = new Twig_Node_Expression_AssignName($keyTarget->getAttribute('name'), $keyTarget->getTemplateLine()); - $valueTarget = $targets->getNode(1); - $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine()); - } else { - $keyTarget = new Twig_Node_Expression_AssignName('_key', $lineno); - $valueTarget = $targets->getNode(0); - $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine()); - } - - if ($ifexpr) { - $this->checkLoopUsageCondition($stream, $ifexpr); - $this->checkLoopUsageBody($stream, $body); - } - - return new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag()); - } +class_exists('Twig\TokenParser\ForTokenParser'); - public function decideForFork(Twig_Token $token) +if (\false) { + class Twig_TokenParser_For extends ForTokenParser { - return $token->test(array('else', 'endfor')); - } - - public function decideForEnd(Twig_Token $token) - { - return $token->test('endfor'); - } - - // the loop variable cannot be used in the condition - protected function checkLoopUsageCondition(Twig_TokenStream $stream, Twig_NodeInterface $node) - { - if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) { - throw new Twig_Error_Syntax('The "loop" variable cannot be used in a looping condition.', $node->getTemplateLine(), $stream->getSourceContext()); - } - - foreach ($node as $n) { - if (!$n) { - continue; - } - - $this->checkLoopUsageCondition($stream, $n); - } - } - - // check usage of non-defined loop-items - // it does not catch all problems (for instance when a for is included into another or when the variable is used in an include) - protected function checkLoopUsageBody(Twig_TokenStream $stream, Twig_NodeInterface $node) - { - if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) { - $attribute = $node->getNode('attribute'); - if ($attribute instanceof Twig_Node_Expression_Constant && in_array($attribute->getAttribute('value'), array('length', 'revindex0', 'revindex', 'last'))) { - throw new Twig_Error_Syntax(sprintf('The "loop.%s" variable is not defined when looping with a condition.', $attribute->getAttribute('value')), $node->getTemplateLine(), $stream->getSourceContext()); - } - } - - // should check for parent.loop.XXX usage - if ($node instanceof Twig_Node_For) { - return; - } - - foreach ($node as $n) { - if (!$n) { - continue; - } - - $this->checkLoopUsageBody($stream, $n); - } - } - - public function getTag() - { - return 'for'; } } - -class_alias('Twig_TokenParser_For', 'Twig\TokenParser\ForTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/From.php b/vendor/twig/twig/lib/Twig/TokenParser/From.php index f3053da4b9fdfd1e05f5632ad118832122a8d33a..af794be8898f0f9ea98ea301a98e24044797310e 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/From.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/From.php @@ -1,66 +1,11 @@ <?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\TokenParser\FromTokenParser; -/** - * Imports macros. - * - * <pre> - * {% from 'forms.html' import forms %} - * </pre> - * - * @final - */ -class Twig_TokenParser_From extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $macro = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect('import'); - - $targets = array(); - do { - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - - $alias = $name; - if ($stream->nextIf('as')) { - $alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - } - - $targets[$name] = $alias; - - if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - } while (true); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); +class_exists('Twig\TokenParser\FromTokenParser'); - $node = new Twig_Node_Import($macro, new Twig_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()), $token->getLine(), $this->getTag()); - - foreach ($targets as $name => $alias) { - if ($this->parser->isReservedMacroName($name)) { - throw new Twig_Error_Syntax(sprintf('"%s" cannot be an imported macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext()); - } - - $this->parser->addImportedSymbol('function', $alias, 'get'.$name, $node->getNode('var')); - } - - return $node; - } - - public function getTag() +if (\false) { + class Twig_TokenParser_From extends FromTokenParser { - return 'from'; } } - -class_alias('Twig_TokenParser_From', 'Twig\TokenParser\FromTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/If.php b/vendor/twig/twig/lib/Twig/TokenParser/If.php index f081df3abd2aa77f944a38a810283dbc7e7cba0d..e035c5ed5f91d15ed03eb0c7d9898e81ab39cbb3 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/If.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/If.php @@ -1,86 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\TokenParser\IfTokenParser; -/** - * Tests a condition. - * - * <pre> - * {% if users %} - * <ul> - * {% for user in users %} - * <li>{{ user.username|e }}</li> - * {% endfor %} - * </ul> - * {% endif %} - * </pre> - * - * @final - */ -class Twig_TokenParser_If extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests = array($expr, $body); - $else = null; - - $end = false; - while (!$end) { - switch ($stream->next()->getValue()) { - case 'else': - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $else = $this->parser->subparse(array($this, 'decideIfEnd')); - break; - - case 'elseif': - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests[] = $expr; - $tests[] = $body; - break; - - case 'endif': - $end = true; - break; - - default: - throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d).', $lineno), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_If(new Twig_Node($tests), $else, $lineno, $this->getTag()); - } +class_exists('Twig\TokenParser\IfTokenParser'); - public function decideIfFork(Twig_Token $token) +if (\false) { + class Twig_TokenParser_If extends IfTokenParser { - return $token->test(array('elseif', 'else', 'endif')); - } - - public function decideIfEnd(Twig_Token $token) - { - return $token->test(array('endif')); - } - - public function getTag() - { - return 'if'; } } - -class_alias('Twig_TokenParser_If', 'Twig\TokenParser\IfTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Import.php b/vendor/twig/twig/lib/Twig/TokenParser/Import.php index 47802f502aa63981429ab3560b124dbcc537db1d..2ee0165368ad6522ae364bcf8c53dd40496abc02 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Import.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Import.php @@ -1,41 +1,11 @@ <?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\TokenParser\ImportTokenParser; -/** - * Imports macros. - * - * <pre> - * {% import 'forms.html' as forms %} - * </pre> - * - * @final - */ -class Twig_TokenParser_Import extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $macro = $this->parser->getExpressionParser()->parseExpression(); - $this->parser->getStream()->expect('as'); - $var = new Twig_Node_Expression_AssignName($this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(), $token->getLine()); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - $this->parser->addImportedSymbol('template', $var->getAttribute('name')); +class_exists('Twig\TokenParser\ImportTokenParser'); - return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag()); - } - - public function getTag() +if (\false) { + class Twig_TokenParser_Import extends ImportTokenParser { - return 'import'; } } - -class_alias('Twig_TokenParser_Import', 'Twig\TokenParser\ImportTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Include.php b/vendor/twig/twig/lib/Twig/TokenParser/Include.php index 309f11db4738358106e594bd2866f8e61254d97f..6047c615dda206d4fb94a8a93bd3a064d63a4c0a 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Include.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Include.php @@ -1,65 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\TokenParser\IncludeTokenParser; -/** - * Includes a template. - * - * <pre> - * {% include 'header.html' %} - * Body - * {% include 'footer.html' %} - * </pre> - */ -class Twig_TokenParser_Include extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $expr = $this->parser->getExpressionParser()->parseExpression(); - - list($variables, $only, $ignoreMissing) = $this->parseArguments(); - - return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); - } - - protected function parseArguments() - { - $stream = $this->parser->getStream(); - - $ignoreMissing = false; - if ($stream->nextIf(Twig_Token::NAME_TYPE, 'ignore')) { - $stream->expect(Twig_Token::NAME_TYPE, 'missing'); +class_exists('Twig\TokenParser\IncludeTokenParser'); - $ignoreMissing = true; - } - - $variables = null; - if ($stream->nextIf(Twig_Token::NAME_TYPE, 'with')) { - $variables = $this->parser->getExpressionParser()->parseExpression(); - } - - $only = false; - if ($stream->nextIf(Twig_Token::NAME_TYPE, 'only')) { - $only = true; - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return array($variables, $only, $ignoreMissing); - } - - public function getTag() +if (\false) { + class Twig_TokenParser_Include extends IncludeTokenParser { - return 'include'; } } - -class_alias('Twig_TokenParser_Include', 'Twig\TokenParser\IncludeTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Macro.php b/vendor/twig/twig/lib/Twig/TokenParser/Macro.php index 4287934bad52f3149862e9fe5c8d9dd99a23fdc6..523de8c1c75c329f14ad5f72fceac2e26befb4fd 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Macro.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Macro.php @@ -1,60 +1,11 @@ <?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\TokenParser\MacroTokenParser; -/** - * Defines a macro. - * - * <pre> - * {% macro input(name, value, type, size) %} - * <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" /> - * {% endmacro %} - * </pre> - * - * @final - */ -class Twig_TokenParser_Macro extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - - $arguments = $this->parser->getExpressionParser()->parseArguments(true, true); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $this->parser->pushLocalScope(); - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) { - $value = $token->getValue(); - - if ($value != $name) { - throw new Twig_Error_Syntax(sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } - $this->parser->popLocalScope(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $this->parser->setMacro($name, new Twig_Node_Macro($name, new Twig_Node_Body(array($body)), $arguments, $lineno, $this->getTag())); - } +class_exists('Twig\TokenParser\MacroTokenParser'); - public function decideBlockEnd(Twig_Token $token) +if (\false) { + class Twig_TokenParser_Macro extends MacroTokenParser { - return $token->test('endmacro'); - } - - public function getTag() - { - return 'macro'; } } - -class_alias('Twig_TokenParser_Macro', 'Twig\TokenParser\MacroTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php b/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php index b8f581cbc3abd7ee18ef8f01c462c628b6157808..25684343a179b0d2a473897e88bb57b7997706c3 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php @@ -1,61 +1,11 @@ <?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\TokenParser\SandboxTokenParser; -/** - * Marks a section of a template as untrusted code that must be evaluated in the sandbox mode. - * - * <pre> - * {% sandbox %} - * {% include 'user.html' %} - * {% endsandbox %} - * </pre> - * - * @see http://www.twig-project.org/doc/api.html#sandbox-extension for details - * - * @final - */ -class Twig_TokenParser_Sandbox extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - // in a sandbox tag, only include tags are allowed - if (!$body instanceof Twig_Node_Include) { - foreach ($body as $node) { - if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) { - continue; - } - - if (!$node instanceof Twig_Node_Include) { - throw new Twig_Error_Syntax('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext()); - } - } - } - - return new Twig_Node_Sandbox($body, $token->getLine(), $this->getTag()); - } +class_exists('Twig\TokenParser\SandboxTokenParser'); - public function decideBlockEnd(Twig_Token $token) +if (\false) { + class Twig_TokenParser_Sandbox extends SandboxTokenParser { - return $token->test('endsandbox'); - } - - public function getTag() - { - return 'sandbox'; } } - -class_alias('Twig_TokenParser_Sandbox', 'Twig\TokenParser\SandboxTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Set.php b/vendor/twig/twig/lib/Twig/TokenParser/Set.php index 48c6b3aeb0b918514090b8fcd13f38ba11a9bbb5..03139f61abdc278de9e34c97f261fe983125fd1a 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Set.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Set.php @@ -1,75 +1,11 @@ <?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\TokenParser\SetTokenParser; -/** - * Defines a variable. - * - * <pre> - * {% set foo = 'foo' %} - * - * {% set foo = [1, 2] %} - * - * {% set foo = {'foo': 'bar'} %} - * - * {% set foo = 'foo' ~ 'bar' %} - * - * {% set foo, bar = 'foo', 'bar' %} - * - * {% set foo %}Some content{% endset %} - * </pre> - * - * @final - */ -class Twig_TokenParser_Set extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $names = $this->parser->getExpressionParser()->parseAssignmentExpression(); - - $capture = false; - if ($stream->nextIf(Twig_Token::OPERATOR_TYPE, '=')) { - $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - if (count($names) !== count($values)) { - throw new Twig_Error_Syntax('When using set, you must have the same number of variables and assignments.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } else { - $capture = true; - - if (count($names) > 1) { - throw new Twig_Error_Syntax('When using set with a block, you cannot have a multi-target.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $values = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - } +class_exists('Twig\TokenParser\SetTokenParser'); - return new Twig_Node_Set($capture, $names, $values, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endset'); - } - - public function getTag() +if (\false) { + class Twig_TokenParser_Set extends SetTokenParser { - return 'set'; } } - -class_alias('Twig_TokenParser_Set', 'Twig\TokenParser\SetTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php b/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php index cecf27c67c2e629978ee6a4758b5a72d0bbd28c7..92444a0d8e9f6ba68efe82736967cf011e4af928 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php @@ -1,51 +1,11 @@ <?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\TokenParser\SpacelessTokenParser; -/** - * Remove whitespaces between HTML tags. - * - * <pre> - * {% spaceless %} - * <div> - * <strong>foo</strong> - * </div> - * {% endspaceless %} - * - * {# output will be <div><strong>foo</strong></div> #} - * </pre> - * - * @final - */ -class Twig_TokenParser_Spaceless extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Spaceless($body, $lineno, $this->getTag()); - } +class_exists('Twig\TokenParser\SpacelessTokenParser'); - public function decideSpacelessEnd(Twig_Token $token) +if (\false) { + class Twig_TokenParser_Spaceless extends SpacelessTokenParser { - return $token->test('endspaceless'); - } - - public function getTag() - { - return 'spaceless'; } } - -class_alias('Twig_TokenParser_Spaceless', 'Twig\TokenParser\SpacelessTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Use.php b/vendor/twig/twig/lib/Twig/TokenParser/Use.php index f15a91ea0dfaa61f983da8a90a0d8881a3fa2eef..c588211eea0ff64136933359a0969afd0bf84001 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/Use.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/Use.php @@ -1,70 +1,11 @@ <?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\TokenParser\UseTokenParser; -/** - * Imports blocks defined in another template into the current template. - * - * <pre> - * {% extends "base.html" %} - * - * {% use "blocks.html" %} - * - * {% block title %}{% endblock %} - * {% block content %}{% endblock %} - * </pre> - * - * @see http://www.twig-project.org/doc/templates.html#horizontal-reuse for details. - * - * @final - */ -class Twig_TokenParser_Use extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $template = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - - if (!$template instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - - $targets = array(); - if ($stream->nextIf('with')) { - do { - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - - $alias = $name; - if ($stream->nextIf('as')) { - $alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - } - - $targets[$name] = new Twig_Node_Expression_Constant($alias, -1); - - if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - } while (true); - } +class_exists('Twig\TokenParser\UseTokenParser'); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets)))); - - return new Twig_Node(); - } - - public function getTag() +if (\false) { + class Twig_TokenParser_Use extends UseTokenParser { - return 'use'; } } - -class_alias('Twig_TokenParser_Use', 'Twig\TokenParser\UseTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/With.php b/vendor/twig/twig/lib/Twig/TokenParser/With.php index 7a692597c697acab35a10b00adda096c5b278c88..8067cbe6cc9cb2541809282b9dd9a0e7a100084c 100644 --- a/vendor/twig/twig/lib/Twig/TokenParser/With.php +++ b/vendor/twig/twig/lib/Twig/TokenParser/With.php @@ -1,52 +1,11 @@ <?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\TokenParser\WithTokenParser; -/** - * Creates a nested scope. - * - * @author Fabien Potencier <fabien@symfony.com> - * - * @final - */ -class Twig_TokenParser_With extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $stream = $this->parser->getStream(); - - $variables = null; - $only = false; - if (!$stream->test(Twig_Token::BLOCK_END_TYPE)) { - $variables = $this->parser->getExpressionParser()->parseExpression(); - $only = $stream->nextIf(Twig_Token::NAME_TYPE, 'only'); - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); +class_exists('Twig\TokenParser\WithTokenParser'); - $body = $this->parser->subparse(array($this, 'decideWithEnd'), true); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_With($body, $variables, $only, $token->getLine(), $this->getTag()); - } - - public function decideWithEnd(Twig_Token $token) +if (\false) { + class Twig_TokenParser_With extends WithTokenParser { - return $token->test('endwith'); - } - - public function getTag() - { - return 'with'; } } - -class_alias('Twig_TokenParser_With', 'Twig\TokenParser\WithTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParserBroker.php b/vendor/twig/twig/lib/Twig/TokenParserBroker.php index 0d7d6e52a84400918b4c33942ff1aa6016d158ce..8cca809b83ea861de39efc7627c873ca8cd03f2c 100644 --- a/vendor/twig/twig/lib/Twig/TokenParserBroker.php +++ b/vendor/twig/twig/lib/Twig/TokenParserBroker.php @@ -10,6 +10,8 @@ * file that was distributed with this source code. */ +use Twig\TokenParser\TokenParserInterface; + /** * Default implementation of a token parser broker. * @@ -20,40 +22,40 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface { protected $parser; - protected $parsers = array(); - protected $brokers = array(); + protected $parsers = []; + protected $brokers = []; /** - * @param array|Traversable $parsers A Traversable of Twig_TokenParserInterface instances - * @param array|Traversable $brokers A Traversable of Twig_TokenParserBrokerInterface instances - * @param bool $triggerDeprecationError + * @param array|\Traversable $parsers A \Traversable of Twig_TokenParserInterface instances + * @param array|\Traversable $brokers A \Traversable of Twig_TokenParserBrokerInterface instances + * @param bool $triggerDeprecationError */ - public function __construct($parsers = array(), $brokers = array(), $triggerDeprecationError = true) + public function __construct($parsers = [], $brokers = [], $triggerDeprecationError = true) { if ($triggerDeprecationError) { @trigger_error('The '.__CLASS__.' class is deprecated since version 1.12 and will be removed in 2.0.', E_USER_DEPRECATED); } foreach ($parsers as $parser) { - if (!$parser instanceof Twig_TokenParserInterface) { - throw new LogicException('$parsers must a an array of Twig_TokenParserInterface.'); + if (!$parser instanceof TokenParserInterface) { + throw new \LogicException('$parsers must a an array of Twig_TokenParserInterface.'); } $this->parsers[$parser->getTag()] = $parser; } foreach ($brokers as $broker) { if (!$broker instanceof Twig_TokenParserBrokerInterface) { - throw new LogicException('$brokers must a an array of Twig_TokenParserBrokerInterface.'); + throw new \LogicException('$brokers must a an array of Twig_TokenParserBrokerInterface.'); } $this->brokers[] = $broker; } } - public function addTokenParser(Twig_TokenParserInterface $parser) + public function addTokenParser(TokenParserInterface $parser) { $this->parsers[$parser->getTag()] = $parser; } - public function removeTokenParser(Twig_TokenParserInterface $parser) + public function removeTokenParser(TokenParserInterface $parser) { $name = $parser->getTag(); if (isset($this->parsers[$name]) && $parser === $this->parsers[$name]) { @@ -80,7 +82,7 @@ public function removeTokenParserBroker(self $broker) * * @param string $tag A tag name * - * @return null|Twig_TokenParserInterface A Twig_TokenParserInterface or null if no suitable TokenParser was found + * @return TokenParserInterface|null A Twig_TokenParserInterface or null if no suitable TokenParser was found */ public function getTokenParser($tag) { diff --git a/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php b/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php index 6c93f5ea19afc157bd6a24cfe2abff3962ca1495..f369264d9e6606a65d721222466b6d6dbc19fa7e 100644 --- a/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php +++ b/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php @@ -10,6 +10,8 @@ * file that was distributed with this source code. */ +use Twig\TokenParser\TokenParserInterface; + /** * Interface implemented by token parser brokers. * @@ -26,19 +28,19 @@ interface Twig_TokenParserBrokerInterface * * @param string $tag A tag name * - * @return Twig_TokenParserInterface|null A Twig_TokenParserInterface or null if no suitable TokenParser was found + * @return TokenParserInterface|null A Twig_TokenParserInterface or null if no suitable TokenParser was found */ public function getTokenParser($tag); /** - * Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of. + * Calls Twig\TokenParser\TokenParserInterface::setParser on all parsers the implementation knows of. */ public function setParser(Twig_ParserInterface $parser); /** * Gets the Twig_ParserInterface. * - * @return null|Twig_ParserInterface A Twig_ParserInterface instance or null + * @return Twig_ParserInterface|null A Twig_ParserInterface instance or null */ public function getParser(); } diff --git a/vendor/twig/twig/lib/Twig/TokenParserInterface.php b/vendor/twig/twig/lib/Twig/TokenParserInterface.php index 14acc8084b56450f99304afa97b34b480a5f1cde..800c971943b2e7dad13d30ca2b5552340735c764 100644 --- a/vendor/twig/twig/lib/Twig/TokenParserInterface.php +++ b/vendor/twig/twig/lib/Twig/TokenParserInterface.php @@ -1,43 +1,11 @@ <?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\TokenParser\TokenParserInterface; -/** - * Interface implemented by token parsers. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -interface Twig_TokenParserInterface -{ - /** - * Sets the parser associated with this token parser. - */ - public function setParser(Twig_Parser $parser); +class_exists('Twig\TokenParser\TokenParserInterface'); - /** - * Parses a token and returns a node. - * - * @return Twig_NodeInterface - * - * @throws Twig_Error_Syntax - */ - public function parse(Twig_Token $token); - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag(); +if (\false) { + class Twig_TokenParserInterface extends TokenParserInterface + { + } } - -class_alias('Twig_TokenParserInterface', 'Twig\TokenParser\TokenParserInterface', false); -class_exists('Twig_Parser'); -class_exists('Twig_Token'); diff --git a/vendor/twig/twig/lib/Twig/TokenStream.php b/vendor/twig/twig/lib/Twig/TokenStream.php index 81c043ca9f11f243708024277b7c8599a5915443..b1abb80720ea9ced4f8e085499fc58567f41f848 100644 --- a/vendor/twig/twig/lib/Twig/TokenStream.php +++ b/vendor/twig/twig/lib/Twig/TokenStream.php @@ -1,196 +1,11 @@ <?php -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +use Twig\TokenStream; -/** - * Represents a token stream. - * - * @final - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_TokenStream -{ - protected $tokens; - protected $current = 0; - protected $filename; +class_exists('Twig\TokenStream'); - private $source; - - /** - * @param array $tokens An array of tokens - * @param string|null $name The name of the template which tokens are associated with - * @param string|null $source The source code associated with the tokens - */ - public function __construct(array $tokens, $name = null, $source = null) - { - if (!$name instanceof Twig_Source) { - if (null !== $name || null !== $source) { - @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED); - } - $this->source = new Twig_Source($source, $name); - } else { - $this->source = $name; - } - - $this->tokens = $tokens; - - // deprecated, not used anymore, to be removed in 2.0 - $this->filename = $this->source->getName(); - } - - public function __toString() +if (\false) { + class Twig_TokenStream extends TokenStream { - return implode("\n", $this->tokens); - } - - public function injectTokens(array $tokens) - { - $this->tokens = array_merge(array_slice($this->tokens, 0, $this->current), $tokens, array_slice($this->tokens, $this->current)); - } - - /** - * Sets the pointer to the next token and returns the old one. - * - * @return Twig_Token - */ - public function next() - { - if (!isset($this->tokens[++$this->current])) { - throw new Twig_Error_Syntax('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source); - } - - return $this->tokens[$this->current - 1]; - } - - /** - * Tests a token, sets the pointer to the next one and returns it or throws a syntax error. - * - * @return Twig_Token|null The next token if the condition is true, null otherwise - */ - public function nextIf($primary, $secondary = null) - { - if ($this->tokens[$this->current]->test($primary, $secondary)) { - return $this->next(); - } - } - - /** - * Tests a token and returns it or throws a syntax error. - * - * @return Twig_Token - */ - public function expect($type, $value = null, $message = null) - { - $token = $this->tokens[$this->current]; - if (!$token->test($type, $value)) { - $line = $token->getLine(); - throw new Twig_Error_Syntax(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).', - $message ? $message.'. ' : '', - Twig_Token::typeToEnglish($token->getType()), $token->getValue(), - Twig_Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''), - $line, - $this->source - ); - } - $this->next(); - - return $token; - } - - /** - * Looks at the next token. - * - * @param int $number - * - * @return Twig_Token - */ - public function look($number = 1) - { - if (!isset($this->tokens[$this->current + $number])) { - throw new Twig_Error_Syntax('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source); - } - - return $this->tokens[$this->current + $number]; - } - - /** - * Tests the current token. - * - * @return bool - */ - public function test($primary, $secondary = null) - { - return $this->tokens[$this->current]->test($primary, $secondary); - } - - /** - * Checks if end of stream was reached. - * - * @return bool - */ - public function isEOF() - { - return Twig_Token::EOF_TYPE === $this->tokens[$this->current]->getType(); - } - - /** - * @return Twig_Token - */ - public function getCurrent() - { - return $this->tokens[$this->current]; - } - - /** - * Gets the name associated with this stream (null if not defined). - * - * @return string|null - * - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function getFilename() - { - @trigger_error(sprintf('The %s() method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); - - return $this->source->getName(); - } - - /** - * Gets the source code associated with this stream. - * - * @return string - * - * @internal Don't use this as it might be empty depending on the environment configuration - * - * @deprecated since 1.27 (to be removed in 2.0) - */ - public function getSource() - { - @trigger_error(sprintf('The %s() method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); - - return $this->source->getCode(); - } - - /** - * Gets the source associated with this stream. - * - * @return Twig_Source - * - * @internal - */ - public function getSourceContext() - { - return $this->source; } } - -class_alias('Twig_TokenStream', 'Twig\TokenStream', false); diff --git a/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php b/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php index c7bf53be2e705c83f0af71803ff9dde0c4716e0c..46fd4ef6bbcaa5c51685dfc730539ad567d61255 100644 --- a/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php +++ b/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php @@ -1,86 +1,11 @@ <?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\Util\DeprecationCollector; -/** - * @author Fabien Potencier <fabien@symfony.com> - * - * @final - */ -class Twig_Util_DeprecationCollector -{ - private $twig; - private $deprecations; +class_exists('Twig\Util\DeprecationCollector'); - public function __construct(Twig_Environment $twig) +if (\false) { + class Twig_Util_DeprecationCollector extends DeprecationCollector { - $this->twig = $twig; - } - - /** - * Returns deprecations for templates contained in a directory. - * - * @param string $dir A directory where templates are stored - * @param string $ext Limit the loaded templates by extension - * - * @return array An array of deprecations - */ - public function collectDir($dir, $ext = '.twig') - { - $iterator = new RegexIterator( - new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY - ), '{'.preg_quote($ext).'$}' - ); - - return $this->collect(new Twig_Util_TemplateDirIterator($iterator)); - } - - /** - * Returns deprecations for passed templates. - * - * @param Traversable $iterator An iterator of templates (where keys are template names and values the contents of the template) - * - * @return array An array of deprecations - */ - public function collect(Traversable $iterator) - { - $this->deprecations = array(); - - set_error_handler(array($this, 'errorHandler')); - - foreach ($iterator as $name => $contents) { - try { - $this->twig->parse($this->twig->tokenize(new Twig_Source($contents, $name))); - } catch (Twig_Error_Syntax $e) { - // ignore templates containing syntax errors - } - } - - restore_error_handler(); - - $deprecations = $this->deprecations; - $this->deprecations = array(); - - return $deprecations; - } - - /** - * @internal - */ - public function errorHandler($type, $msg) - { - if (E_USER_DEPRECATED === $type) { - $this->deprecations[] = $msg; - } } } - -class_alias('Twig_Util_DeprecationCollector', 'Twig\Util\DeprecationCollector', false); diff --git a/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php b/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php index c8682335dee1e0cf9fcc72a656adc4f2f26ee2b3..f9a1e0be398ae9d723d40efbf0931347dfe3d9f4 100644 --- a/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php +++ b/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php @@ -1,28 +1,11 @@ <?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\Util\TemplateDirIterator; -/** - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Util_TemplateDirIterator extends IteratorIterator -{ - public function current() - { - return file_get_contents(parent::current()); - } +class_exists('Twig\Util\TemplateDirIterator'); - public function key() +if (\false) { + class Twig_Util_TemplateDirIterator extends TemplateDirIterator { - return (string) parent::key(); } } - -class_alias('Twig_Util_TemplateDirIterator', 'Twig\Util\TemplateDirIterator', false); diff --git a/vendor/twig/twig/src/Cache/CacheInterface.php b/vendor/twig/twig/src/Cache/CacheInterface.php index 2e35e3ba03ff9fea6d2ef373a42f84bca6627b50..1c8bb1ec9a93c26ddbc65cecd17e0a7cc27b1821 100644 --- a/vendor/twig/twig/src/Cache/CacheInterface.php +++ b/vendor/twig/twig/src/Cache/CacheInterface.php @@ -1,11 +1,60 @@ <?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\Cache; -class_exists('Twig_CacheInterface'); +/** + * Interface implemented by cache classes. + * + * It is highly recommended to always store templates on the filesystem to + * benefit from the PHP opcode cache. This interface is mostly useful if you + * need to implement a custom strategy for storing templates on the filesystem. + * + * @author Andrew Tch <andrew@noop.lv> + */ +interface CacheInterface +{ + /** + * Generates a cache key for the given template class name. + * + * @param string $name The template name + * @param string $className The template class name + * + * @return string + */ + public function generateKey($name, $className); + + /** + * Writes the compiled template to cache. + * + * @param string $key The cache key + * @param string $content The template representation as a PHP class + */ + public function write($key, $content); -if (\false) { - interface CacheInterface extends \Twig_CacheInterface - { - } + /** + * Loads a template from the cache. + * + * @param string $key The cache key + */ + public function load($key); + + /** + * Returns the modification timestamp of a key. + * + * @param string $key The cache key + * + * @return int + */ + public function getTimestamp($key); } + +class_alias('Twig\Cache\CacheInterface', 'Twig_CacheInterface'); diff --git a/vendor/twig/twig/src/Cache/FilesystemCache.php b/vendor/twig/twig/src/Cache/FilesystemCache.php index 9882c988677043ac966d32b67675e7abc496145b..7e228799a690e71cf7e7b4e499daedad23dabde8 100644 --- a/vendor/twig/twig/src/Cache/FilesystemCache.php +++ b/vendor/twig/twig/src/Cache/FilesystemCache.php @@ -1,11 +1,93 @@ <?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\Cache; -class_exists('Twig_Cache_Filesystem'); +/** + * Implements a cache on the filesystem. + * + * @author Andrew Tch <andrew@noop.lv> + */ +class FilesystemCache implements CacheInterface +{ + const FORCE_BYTECODE_INVALIDATION = 1; + + private $directory; + private $options; + + /** + * @param string $directory The root cache directory + * @param int $options A set of options + */ + public function __construct($directory, $options = 0) + { + $this->directory = rtrim($directory, '\/').'/'; + $this->options = $options; + } -if (\false) { - class FilesystemCache extends \Twig_Cache_Filesystem + public function generateKey($name, $className) { + $hash = hash('sha256', $className); + + return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php'; + } + + public function load($key) + { + if (file_exists($key)) { + @include_once $key; + } + } + + public function write($key, $content) + { + $dir = \dirname($key); + if (!is_dir($dir)) { + if (false === @mkdir($dir, 0777, true)) { + clearstatcache(true, $dir); + if (!is_dir($dir)) { + throw new \RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir)); + } + } + } elseif (!is_writable($dir)) { + throw new \RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir)); + } + + $tmpFile = tempnam($dir, basename($key)); + if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $key)) { + @chmod($key, 0666 & ~umask()); + + if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) { + // Compile cached file into bytecode cache + if (\function_exists('opcache_invalidate')) { + opcache_invalidate($key, true); + } elseif (\function_exists('apc_compile_file')) { + apc_compile_file($key); + } + } + + return; + } + + throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $key)); + } + + public function getTimestamp($key) + { + if (!file_exists($key)) { + return 0; + } + + return (int) @filemtime($key); } } + +class_alias('Twig\Cache\FilesystemCache', 'Twig_Cache_Filesystem'); diff --git a/vendor/twig/twig/src/Cache/NullCache.php b/vendor/twig/twig/src/Cache/NullCache.php index c3d4055514cfc1783d4fbaa423d9ae95ed5c05c8..c1b37c1243e2f3502ae4cf93435a64fa234190b1 100644 --- a/vendor/twig/twig/src/Cache/NullCache.php +++ b/vendor/twig/twig/src/Cache/NullCache.php @@ -1,11 +1,42 @@ <?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\Cache; -class_exists('Twig_Cache_Null'); +/** + * Implements a no-cache strategy. + * + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class NullCache implements CacheInterface +{ + public function generateKey($name, $className) + { + return ''; + } + + public function write($key, $content) + { + } + + public function load($key) + { + } -if (\false) { - class NullCache extends \Twig_Cache_Null + public function getTimestamp($key) { + return 0; } } + +class_alias('Twig\Cache\NullCache', 'Twig_Cache_Null'); diff --git a/vendor/twig/twig/src/Compiler.php b/vendor/twig/twig/src/Compiler.php index 6025c4dfc4bf24eef4fd0eeb60bd11b8ed52d01f..e47003ae19ee3f6b9a3524cd114e3eaf9394ca45 100644 --- a/vendor/twig/twig/src/Compiler.php +++ b/vendor/twig/twig/src/Compiler.php @@ -1,11 +1,288 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig; -class_exists('Twig_Compiler'); +use Twig\Node\ModuleNode; + +/** + * Compiles a node to PHP code. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class Compiler implements \Twig_CompilerInterface +{ + protected $lastLine; + protected $source; + protected $indentation; + protected $env; + protected $debugInfo = []; + protected $sourceOffset; + protected $sourceLine; + protected $filename; + private $varNameSalt = 0; + + public function __construct(Environment $env) + { + $this->env = $env; + } + + /** + * @deprecated since 1.25 (to be removed in 2.0) + */ + public function getFilename() + { + @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); + + return $this->filename; + } + + /** + * Returns the environment instance related to this compiler. + * + * @return Environment + */ + public function getEnvironment() + { + return $this->env; + } + + /** + * Gets the current PHP code after compilation. + * + * @return string The PHP code + */ + public function getSource() + { + return $this->source; + } + + /** + * Compiles a node. + * + * @param int $indentation The current indentation + * + * @return $this + */ + public function compile(\Twig_NodeInterface $node, $indentation = 0) + { + $this->lastLine = null; + $this->source = ''; + $this->debugInfo = []; + $this->sourceOffset = 0; + // source code starts at 1 (as we then increment it when we encounter new lines) + $this->sourceLine = 1; + $this->indentation = $indentation; + $this->varNameSalt = 0; + + if ($node instanceof ModuleNode) { + // to be removed in 2.0 + $this->filename = $node->getTemplateName(); + } + + $node->compile($this); + + return $this; + } + + public function subcompile(\Twig_NodeInterface $node, $raw = true) + { + if (false === $raw) { + $this->source .= str_repeat(' ', $this->indentation * 4); + } + + $node->compile($this); + + return $this; + } + + /** + * Adds a raw string to the compiled code. + * + * @param string $string The string + * + * @return $this + */ + public function raw($string) + { + $this->source .= $string; + + return $this; + } + + /** + * Writes a string to the compiled code by adding indentation. + * + * @return $this + */ + public function write() + { + $strings = \func_get_args(); + foreach ($strings as $string) { + $this->source .= str_repeat(' ', $this->indentation * 4).$string; + } + + return $this; + } + + /** + * Appends an indentation to the current PHP code after compilation. + * + * @return $this + * + * @deprecated since 1.27 (to be removed in 2.0). + */ + public function addIndentation() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use write(\'\') instead.', E_USER_DEPRECATED); + + $this->source .= str_repeat(' ', $this->indentation * 4); + + return $this; + } + + /** + * Adds a quoted string to the compiled code. + * + * @param string $value The string + * + * @return $this + */ + public function string($value) + { + $this->source .= sprintf('"%s"', addcslashes($value, "\0\t\"\$\\")); + + return $this; + } + + /** + * Returns a PHP representation of a given value. + * + * @param mixed $value The value to convert + * + * @return $this + */ + public function repr($value) + { + if (\is_int($value) || \is_float($value)) { + if (false !== $locale = setlocale(LC_NUMERIC, '0')) { + setlocale(LC_NUMERIC, 'C'); + } + + $this->raw(var_export($value, true)); + + if (false !== $locale) { + setlocale(LC_NUMERIC, $locale); + } + } elseif (null === $value) { + $this->raw('null'); + } elseif (\is_bool($value)) { + $this->raw($value ? 'true' : 'false'); + } elseif (\is_array($value)) { + $this->raw('['); + $first = true; + foreach ($value as $key => $v) { + if (!$first) { + $this->raw(', '); + } + $first = false; + $this->repr($key); + $this->raw(' => '); + $this->repr($v); + } + $this->raw(']'); + } else { + $this->string($value); + } + + return $this; + } -if (\false) { - class Compiler extends \Twig_Compiler + /** + * Adds debugging information. + * + * @return $this + */ + public function addDebugInfo(\Twig_NodeInterface $node) { + if ($node->getTemplateLine() != $this->lastLine) { + $this->write(sprintf("// line %d\n", $node->getTemplateLine())); + + // when mbstring.func_overload is set to 2 + // mb_substr_count() replaces substr_count() + // but they have different signatures! + if (((int) ini_get('mbstring.func_overload')) & 2) { + @trigger_error('Support for having "mbstring.func_overload" different from 0 is deprecated version 1.29 and will be removed in 2.0.', E_USER_DEPRECATED); + + // this is much slower than the "right" version + $this->sourceLine += mb_substr_count(mb_substr($this->source, $this->sourceOffset), "\n"); + } else { + $this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset); + } + $this->sourceOffset = \strlen($this->source); + $this->debugInfo[$this->sourceLine] = $node->getTemplateLine(); + + $this->lastLine = $node->getTemplateLine(); + } + + return $this; + } + + public function getDebugInfo() + { + ksort($this->debugInfo); + + return $this->debugInfo; + } + + /** + * Indents the generated code. + * + * @param int $step The number of indentation to add + * + * @return $this + */ + public function indent($step = 1) + { + $this->indentation += $step; + + return $this; + } + + /** + * Outdents the generated code. + * + * @param int $step The number of indentation to remove + * + * @return $this + * + * @throws \LogicException When trying to outdent too much so the indentation would become negative + */ + public function outdent($step = 1) + { + // can't outdent by more steps than the current indentation level + if ($this->indentation < $step) { + throw new \LogicException('Unable to call outdent() as the indentation would become negative.'); + } + + $this->indentation -= $step; + + return $this; + } + + public function getVarName() + { + return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->varNameSalt++)); } } + +class_alias('Twig\Compiler', 'Twig_Compiler'); diff --git a/vendor/twig/twig/src/Environment.php b/vendor/twig/twig/src/Environment.php index e0f9edcdcbf955920a307890ee907eeebb840b52..1bc11cd4ad42c0bd4943da14d87853b7e59216f1 100644 --- a/vendor/twig/twig/src/Environment.php +++ b/vendor/twig/twig/src/Environment.php @@ -1,11 +1,1637 @@ <?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; -class_exists('Twig_Environment'); +use Twig\Cache\CacheInterface; +use Twig\Cache\FilesystemCache; +use Twig\Cache\NullCache; +use Twig\Error\Error; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Error\SyntaxError; +use Twig\Extension\CoreExtension; +use Twig\Extension\EscaperExtension; +use Twig\Extension\ExtensionInterface; +use Twig\Extension\GlobalsInterface; +use Twig\Extension\InitRuntimeInterface; +use Twig\Extension\OptimizerExtension; +use Twig\Extension\StagingExtension; +use Twig\Loader\ArrayLoader; +use Twig\Loader\ChainLoader; +use Twig\Loader\LoaderInterface; +use Twig\Loader\SourceContextLoaderInterface; +use Twig\Node\ModuleNode; +use Twig\NodeVisitor\NodeVisitorInterface; +use Twig\RuntimeLoader\RuntimeLoaderInterface; +use Twig\TokenParser\TokenParserInterface; + +/** + * Stores the Twig configuration. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class Environment +{ + const VERSION = '1.38.2'; + const VERSION_ID = 13802; + const MAJOR_VERSION = 2; + const MINOR_VERSION = 38; + const RELEASE_VERSION = 2; + const EXTRA_VERSION = ''; + + protected $charset; + protected $loader; + protected $debug; + protected $autoReload; + protected $cache; + protected $lexer; + protected $parser; + protected $compiler; + protected $baseTemplateClass; + protected $extensions; + protected $parsers; + protected $visitors; + protected $filters; + protected $tests; + protected $functions; + protected $globals; + protected $runtimeInitialized = false; + protected $extensionInitialized = false; + protected $loadedTemplates; + protected $strictVariables; + protected $unaryOperators; + protected $binaryOperators; + protected $templateClassPrefix = '__TwigTemplate_'; + protected $functionCallbacks = []; + protected $filterCallbacks = []; + protected $staging; + + private $originalCache; + private $bcWriteCacheFile = false; + private $bcGetCacheFilename = false; + private $lastModifiedExtension = 0; + private $extensionsByClass = []; + private $runtimeLoaders = []; + private $runtimes = []; + private $optionsHash; + private $loading = []; + + /** + * Constructor. + * + * Available options: + * + * * debug: When set to true, it automatically set "auto_reload" to true as + * well (default to false). + * + * * charset: The charset used by the templates (default to UTF-8). + * + * * base_template_class: The base template class to use for generated + * templates (default to \Twig\Template). + * + * * cache: An absolute path where to store the compiled templates, + * a \Twig\Cache\CacheInterface implementation, + * or false to disable compilation cache (default). + * + * * auto_reload: Whether to reload the template if the original source changed. + * If you don't provide the auto_reload option, it will be + * determined automatically based on the debug value. + * + * * strict_variables: Whether to ignore invalid variables in templates + * (default to false). + * + * * autoescape: Whether to enable auto-escaping (default to html): + * * false: disable auto-escaping + * * true: equivalent to html + * * html, js: set the autoescaping to one of the supported strategies + * * name: set the autoescaping strategy based on the template name extension + * * PHP callback: a PHP callback that returns an escaping strategy based on the template "name" + * + * * optimizations: A flag that indicates which optimizations to apply + * (default to -1 which means that all optimizations are enabled; + * set it to 0 to disable). + */ + public function __construct(LoaderInterface $loader = null, $options = []) + { + if (null !== $loader) { + $this->setLoader($loader); + } else { + @trigger_error('Not passing a "Twig\Lodaer\LoaderInterface" as the first constructor argument of "Twig\Environment" is deprecated since version 1.21.', E_USER_DEPRECATED); + } + + $options = array_merge([ + 'debug' => false, + 'charset' => 'UTF-8', + 'base_template_class' => '\Twig\Template', + 'strict_variables' => false, + 'autoescape' => 'html', + 'cache' => false, + 'auto_reload' => null, + 'optimizations' => -1, + ], $options); + + $this->debug = (bool) $options['debug']; + $this->charset = strtoupper($options['charset']); + $this->baseTemplateClass = $options['base_template_class']; + $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; + $this->strictVariables = (bool) $options['strict_variables']; + $this->setCache($options['cache']); + + $this->addExtension(new CoreExtension()); + $this->addExtension(new EscaperExtension($options['autoescape'])); + $this->addExtension(new OptimizerExtension($options['optimizations'])); + $this->staging = new StagingExtension(); + + // For BC + if (\is_string($this->originalCache)) { + $r = new \ReflectionMethod($this, 'writeCacheFile'); + if (__CLASS__ !== $r->getDeclaringClass()->getName()) { + @trigger_error('The Twig\Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED); + + $this->bcWriteCacheFile = true; + } + + $r = new \ReflectionMethod($this, 'getCacheFilename'); + if (__CLASS__ !== $r->getDeclaringClass()->getName()) { + @trigger_error('The Twig\Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED); + + $this->bcGetCacheFilename = true; + } + } + } + + /** + * Gets the base template class for compiled templates. + * + * @return string The base template class name + */ + public function getBaseTemplateClass() + { + return $this->baseTemplateClass; + } + + /** + * Sets the base template class for compiled templates. + * + * @param string $class The base template class name + */ + public function setBaseTemplateClass($class) + { + $this->baseTemplateClass = $class; + $this->updateOptionsHash(); + } + + /** + * Enables debugging mode. + */ + public function enableDebug() + { + $this->debug = true; + $this->updateOptionsHash(); + } + + /** + * Disables debugging mode. + */ + public function disableDebug() + { + $this->debug = false; + $this->updateOptionsHash(); + } + + /** + * Checks if debug mode is enabled. + * + * @return bool true if debug mode is enabled, false otherwise + */ + public function isDebug() + { + return $this->debug; + } + + /** + * Enables the auto_reload option. + */ + public function enableAutoReload() + { + $this->autoReload = true; + } + + /** + * Disables the auto_reload option. + */ + public function disableAutoReload() + { + $this->autoReload = false; + } + + /** + * Checks if the auto_reload option is enabled. + * + * @return bool true if auto_reload is enabled, false otherwise + */ + public function isAutoReload() + { + return $this->autoReload; + } + + /** + * Enables the strict_variables option. + */ + public function enableStrictVariables() + { + $this->strictVariables = true; + $this->updateOptionsHash(); + } + + /** + * Disables the strict_variables option. + */ + public function disableStrictVariables() + { + $this->strictVariables = false; + $this->updateOptionsHash(); + } + + /** + * Checks if the strict_variables option is enabled. + * + * @return bool true if strict_variables is enabled, false otherwise + */ + public function isStrictVariables() + { + return $this->strictVariables; + } + + /** + * Gets the current cache implementation. + * + * @param bool $original Whether to return the original cache option or the real cache instance + * + * @return CacheInterface|string|false A Twig\Cache\CacheInterface implementation, + * an absolute path to the compiled templates, + * or false to disable cache + */ + public function getCache($original = true) + { + return $original ? $this->originalCache : $this->cache; + } + + /** + * Sets the current cache implementation. + * + * @param CacheInterface|string|false $cache A Twig\Cache\CacheInterface implementation, + * an absolute path to the compiled templates, + * or false to disable cache + */ + public function setCache($cache) + { + if (\is_string($cache)) { + $this->originalCache = $cache; + $this->cache = new FilesystemCache($cache); + } elseif (false === $cache) { + $this->originalCache = $cache; + $this->cache = new NullCache(); + } elseif (null === $cache) { + @trigger_error('Using "null" as the cache strategy is deprecated since version 1.23 and will be removed in Twig 2.0.', E_USER_DEPRECATED); + $this->originalCache = false; + $this->cache = new NullCache(); + } elseif ($cache instanceof CacheInterface) { + $this->originalCache = $this->cache = $cache; + } else { + throw new \LogicException(sprintf('Cache can only be a string, false, or a \Twig\Cache\CacheInterface implementation.')); + } + } + + /** + * Gets the cache filename for a given template. + * + * @param string $name The template name + * + * @return string|false The cache file name or false when caching is disabled + * + * @deprecated since 1.22 (to be removed in 2.0) + */ + public function getCacheFilename($name) + { + @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); + + $key = $this->cache->generateKey($name, $this->getTemplateClass($name)); + + return !$key ? false : $key; + } + + /** + * Gets the template class associated with the given string. + * + * The generated template class is based on the following parameters: + * + * * The cache key for the given template; + * * The currently enabled extensions; + * * Whether the Twig C extension is available or not; + * * PHP version; + * * Twig version; + * * Options with what environment was created. + * + * @param string $name The name for which to calculate the template class name + * @param int|null $index The index if it is an embedded template + * + * @return string The template class name + */ + public function getTemplateClass($name, $index = null) + { + $key = $this->getLoader()->getCacheKey($name).$this->optionsHash; + + return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '___'.$index); + } + + /** + * Gets the template class prefix. + * + * @return string The template class prefix + * + * @deprecated since 1.22 (to be removed in 2.0) + */ + public function getTemplateClassPrefix() + { + @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); + + return $this->templateClassPrefix; + } + + /** + * Renders a template. + * + * @param string|TemplateWrapper $name The template name + * @param array $context An array of parameters to pass to the template + * + * @return string The rendered template + * + * @throws LoaderError When the template cannot be found + * @throws SyntaxError When an error occurred during compilation + * @throws RuntimeError When an error occurred during rendering + */ + public function render($name, array $context = []) + { + return $this->load($name)->render($context); + } + + /** + * Displays a template. + * + * @param string|TemplateWrapper $name The template name + * @param array $context An array of parameters to pass to the template + * + * @throws LoaderError When the template cannot be found + * @throws SyntaxError When an error occurred during compilation + * @throws RuntimeError When an error occurred during rendering + */ + public function display($name, array $context = []) + { + $this->load($name)->display($context); + } + + /** + * Loads a template. + * + * @param string|TemplateWrapper|\Twig\Template $name The template name + * + * @throws LoaderError When the template cannot be found + * @throws RuntimeError When a previously generated cache is corrupted + * @throws SyntaxError When an error occurred during compilation + * + * @return TemplateWrapper + */ + public function load($name) + { + if ($name instanceof TemplateWrapper) { + return $name; + } + + if ($name instanceof Template) { + return new TemplateWrapper($this, $name); + } + + return new TemplateWrapper($this, $this->loadTemplate($name)); + } + + /** + * Loads a template internal representation. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The template name + * @param int $index The index if it is an embedded template + * + * @return \Twig_TemplateInterface A template instance representing the given template name + * + * @throws LoaderError When the template cannot be found + * @throws RuntimeError When a previously generated cache is corrupted + * @throws SyntaxError When an error occurred during compilation + * + * @internal + */ + public function loadTemplate($name, $index = null) + { + return $this->loadClass($this->getTemplateClass($name), $name, $index); + } + + /** + * @internal + */ + public function loadClass($cls, $name, $index = null) + { + $mainCls = $cls; + if (null !== $index) { + $cls .= '___'.$index; + } + + if (isset($this->loadedTemplates[$cls])) { + return $this->loadedTemplates[$cls]; + } + + if (!class_exists($cls, false)) { + if ($this->bcGetCacheFilename) { + $key = $this->getCacheFilename($name); + } else { + $key = $this->cache->generateKey($name, $mainCls); + } + + if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) { + $this->cache->load($key); + } + + if (!class_exists($cls, false)) { + $loader = $this->getLoader(); + if (!$loader instanceof SourceContextLoaderInterface) { + $source = new Source($loader->getSource($name), $name); + } else { + $source = $loader->getSourceContext($name); + } + + $content = $this->compileSource($source); + + if ($this->bcWriteCacheFile) { + $this->writeCacheFile($key, $content); + } else { + $this->cache->write($key, $content); + $this->cache->load($key); + } + + if (!class_exists($mainCls, false)) { + /* Last line of defense if either $this->bcWriteCacheFile was used, + * $this->cache is implemented as a no-op or we have a race condition + * where the cache was cleared between the above calls to write to and load from + * the cache. + */ + eval('?>'.$content); + } + } + + if (!class_exists($cls, false)) { + throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source); + } + } + + if (!$this->runtimeInitialized) { + $this->initRuntime(); + } + + if (isset($this->loading[$cls])) { + throw new RuntimeError(sprintf('Circular reference detected for Twig template "%s", path: %s.', $name, implode(' -> ', array_merge($this->loading, [$name])))); + } + + $this->loading[$cls] = $name; + + try { + $this->loadedTemplates[$cls] = new $cls($this); + unset($this->loading[$cls]); + } catch (\Exception $e) { + unset($this->loading[$cls]); + + throw $e; + } + + return $this->loadedTemplates[$cls]; + } + + /** + * Creates a template from source. + * + * This method should not be used as a generic way to load templates. + * + * @param string $template The template name + * + * @return TemplateWrapper A template instance representing the given template name + * + * @throws LoaderError When the template cannot be found + * @throws SyntaxError When an error occurred during compilation + */ + public function createTemplate($template) + { + $name = sprintf('__string_template__%s', hash('sha256', $template, false)); + + $loader = new ChainLoader([ + new ArrayLoader([$name => $template]), + $current = $this->getLoader(), + ]); + + $this->setLoader($loader); + try { + $template = new TemplateWrapper($this, $this->loadTemplate($name)); + } catch (\Exception $e) { + $this->setLoader($current); + + throw $e; + } catch (\Throwable $e) { + $this->setLoader($current); + + throw $e; + } + $this->setLoader($current); + + return $template; + } + + /** + * Returns true if the template is still fresh. + * + * Besides checking the loader for freshness information, + * this method also checks if the enabled extensions have + * not changed. + * + * @param string $name The template name + * @param int $time The last modification time of the cached template + * + * @return bool true if the template is fresh, false otherwise + */ + public function isTemplateFresh($name, $time) + { + if (0 === $this->lastModifiedExtension) { + foreach ($this->extensions as $extension) { + $r = new \ReflectionObject($extension); + if (file_exists($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModifiedExtension) { + $this->lastModifiedExtension = $extensionTime; + } + } + } + + return $this->lastModifiedExtension <= $time && $this->getLoader()->isFresh($name, $time); + } + + /** + * Tries to load a template consecutively from an array. + * + * Similar to load() but it also accepts instances of \Twig\Template and + * \Twig\TemplateWrapper, and an array of templates where each is tried to be loaded. + * + * @param string|Template|\Twig\TemplateWrapper|array $names A template or an array of templates to try consecutively + * + * @return TemplateWrapper + * + * @throws LoaderError When none of the templates can be found + * @throws SyntaxError When an error occurred during compilation + */ + public function resolveTemplate($names) + { + if (!\is_array($names)) { + return $this->load($names); + } + + foreach ($names as $name) { + try { + return $this->load($name); + } catch (LoaderError $e) { + } + } + + throw new LoaderError(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names))); + } + + /** + * Clears the internal template cache. + * + * @deprecated since 1.18.3 (to be removed in 2.0) + */ + public function clearTemplateCache() + { + @trigger_error(sprintf('The %s method is deprecated since version 1.18.3 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); + + $this->loadedTemplates = []; + } + + /** + * Clears the template cache files on the filesystem. + * + * @deprecated since 1.22 (to be removed in 2.0) + */ + public function clearCacheFiles() + { + @trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); + + if (\is_string($this->originalCache)) { + foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->originalCache), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + if ($file->isFile()) { + @unlink($file->getPathname()); + } + } + } + } + + /** + * Gets the Lexer instance. + * + * @return \Twig_LexerInterface + * + * @deprecated since 1.25 (to be removed in 2.0) + */ + public function getLexer() + { + @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); + + if (null === $this->lexer) { + $this->lexer = new Lexer($this); + } + + return $this->lexer; + } + + public function setLexer(\Twig_LexerInterface $lexer) + { + $this->lexer = $lexer; + } + + /** + * Tokenizes a source code. + * + * @param string|Source $source The template source code + * @param string $name The template name (deprecated) + * + * @return TokenStream + * + * @throws SyntaxError When the code is syntactically wrong + */ + public function tokenize($source, $name = null) + { + if (!$source instanceof Source) { + @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); + $source = new Source($source, $name); + } + + if (null === $this->lexer) { + $this->lexer = new Lexer($this); + } + + return $this->lexer->tokenize($source); + } + + /** + * Gets the Parser instance. + * + * @return \Twig_ParserInterface + * + * @deprecated since 1.25 (to be removed in 2.0) + */ + public function getParser() + { + @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); + + if (null === $this->parser) { + $this->parser = new Parser($this); + } + + return $this->parser; + } + + public function setParser(\Twig_ParserInterface $parser) + { + $this->parser = $parser; + } + + /** + * Converts a token stream to a node tree. + * + * @return ModuleNode + * + * @throws SyntaxError When the token stream is syntactically or semantically wrong + */ + public function parse(TokenStream $stream) + { + if (null === $this->parser) { + $this->parser = new Parser($this); + } + + return $this->parser->parse($stream); + } + + /** + * Gets the Compiler instance. + * + * @return \Twig_CompilerInterface + * + * @deprecated since 1.25 (to be removed in 2.0) + */ + public function getCompiler() + { + @trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED); + + if (null === $this->compiler) { + $this->compiler = new Compiler($this); + } + + return $this->compiler; + } + + public function setCompiler(\Twig_CompilerInterface $compiler) + { + $this->compiler = $compiler; + } + + /** + * Compiles a node and returns the PHP code. + * + * @return string The compiled PHP source code + */ + public function compile(\Twig_NodeInterface $node) + { + if (null === $this->compiler) { + $this->compiler = new Compiler($this); + } + + return $this->compiler->compile($node)->getSource(); + } + + /** + * Compiles a template source code. + * + * @param string|Source $source The template source code + * @param string $name The template name (deprecated) + * + * @return string The compiled PHP source code + * + * @throws SyntaxError When there was an error during tokenizing, parsing or compiling + */ + public function compileSource($source, $name = null) + { + if (!$source instanceof Source) { + @trigger_error(sprintf('Passing a string as the $source argument of %s() is deprecated since version 1.27. Pass a Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); + $source = new Source($source, $name); + } + + try { + return $this->compile($this->parse($this->tokenize($source))); + } catch (Error $e) { + $e->setSourceContext($source); + throw $e; + } catch (\Exception $e) { + throw new SyntaxError(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e); + } + } + + public function setLoader(LoaderInterface $loader) + { + if (!$loader instanceof SourceContextLoaderInterface && 0 !== strpos(\get_class($loader), 'Mock_')) { + @trigger_error(sprintf('Twig loader "%s" should implement Twig\Loader\SourceContextLoaderInterface since version 1.27.', \get_class($loader)), E_USER_DEPRECATED); + } + + $this->loader = $loader; + } + + /** + * Gets the Loader instance. + * + * @return LoaderInterface + */ + public function getLoader() + { + if (null === $this->loader) { + throw new \LogicException('You must set a loader first.'); + } + + return $this->loader; + } + + /** + * Sets the default template charset. + * + * @param string $charset The default charset + */ + public function setCharset($charset) + { + $this->charset = strtoupper($charset); + } + + /** + * Gets the default template charset. + * + * @return string The default charset + */ + public function getCharset() + { + return $this->charset; + } + + /** + * Initializes the runtime environment. + * + * @deprecated since 1.23 (to be removed in 2.0) + */ + public function initRuntime() + { + $this->runtimeInitialized = true; + + foreach ($this->getExtensions() as $name => $extension) { + if (!$extension instanceof InitRuntimeInterface) { + $m = new \ReflectionMethod($extension, 'initRuntime'); + + $parentClass = $m->getDeclaringClass()->getName(); + if ('Twig_Extension' !== $parentClass && 'Twig\Extension\AbstractExtension' !== $parentClass) { + @trigger_error(sprintf('Defining the initRuntime() method in the "%s" extension is deprecated since version 1.23. Use the `needs_environment` option to get the \Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig\Extension\InitRuntimeInterface if needed (not recommended).', $name), E_USER_DEPRECATED); + } + } -if (\false) { - class Environment extends \Twig_Environment + $extension->initRuntime($this); + } + } + + /** + * Returns true if the given extension is registered. + * + * @param string $class The extension class name + * + * @return bool Whether the extension is registered or not + */ + public function hasExtension($class) + { + $class = ltrim($class, '\\'); + if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { + // For BC/FC with namespaced aliases + $class = new \ReflectionClass($class); + $class = $class->name; + } + + if (isset($this->extensions[$class])) { + if ($class !== \get_class($this->extensions[$class])) { + @trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED); + } + + return true; + } + + return isset($this->extensionsByClass[$class]); + } + + /** + * Adds a runtime loader. + */ + public function addRuntimeLoader(RuntimeLoaderInterface $loader) + { + $this->runtimeLoaders[] = $loader; + } + + /** + * Gets an extension by class name. + * + * @param string $class The extension class name + * + * @return ExtensionInterface + */ + public function getExtension($class) + { + $class = ltrim($class, '\\'); + if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { + // For BC/FC with namespaced aliases + $class = new \ReflectionClass($class); + $class = $class->name; + } + + if (isset($this->extensions[$class])) { + if ($class !== \get_class($this->extensions[$class])) { + @trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED); + } + + return $this->extensions[$class]; + } + + if (!isset($this->extensionsByClass[$class])) { + throw new RuntimeError(sprintf('The "%s" extension is not enabled.', $class)); + } + + return $this->extensionsByClass[$class]; + } + + /** + * Returns the runtime implementation of a Twig element (filter/function/test). + * + * @param string $class A runtime class name + * + * @return object The runtime implementation + * + * @throws RuntimeError When the template cannot be found + */ + public function getRuntime($class) + { + if (isset($this->runtimes[$class])) { + return $this->runtimes[$class]; + } + + foreach ($this->runtimeLoaders as $loader) { + if (null !== $runtime = $loader->load($class)) { + return $this->runtimes[$class] = $runtime; + } + } + + throw new RuntimeError(sprintf('Unable to load the "%s" runtime.', $class)); + } + + public function addExtension(ExtensionInterface $extension) + { + if ($this->extensionInitialized) { + throw new \LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName())); + } + + $class = \get_class($extension); + if ($class !== $extension->getName()) { + if (isset($this->extensions[$extension->getName()])) { + unset($this->extensions[$extension->getName()], $this->extensionsByClass[$class]); + @trigger_error(sprintf('The possibility to register the same extension twice ("%s") is deprecated since version 1.23 and will be removed in Twig 2.0. Use proper PHP inheritance instead.', $extension->getName()), E_USER_DEPRECATED); + } + } + + $this->lastModifiedExtension = 0; + $this->extensionsByClass[$class] = $extension; + $this->extensions[$extension->getName()] = $extension; + $this->updateOptionsHash(); + } + + /** + * Removes an extension by name. + * + * This method is deprecated and you should not use it. + * + * @param string $name The extension name + * + * @deprecated since 1.12 (to be removed in 2.0) + */ + public function removeExtension($name) + { + @trigger_error(sprintf('The %s method is deprecated since version 1.12 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); + + if ($this->extensionInitialized) { + throw new \LogicException(sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name)); + } + + $class = ltrim($name, '\\'); + if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) { + // For BC/FC with namespaced aliases + $class = new \ReflectionClass($class); + $class = $class->name; + } + + if (isset($this->extensions[$class])) { + if ($class !== \get_class($this->extensions[$class])) { + @trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED); + } + + unset($this->extensions[$class]); + } + + unset($this->extensions[$class]); + $this->updateOptionsHash(); + } + + /** + * Registers an array of extensions. + * + * @param array $extensions An array of extensions + */ + public function setExtensions(array $extensions) + { + foreach ($extensions as $extension) { + $this->addExtension($extension); + } + } + + /** + * Returns all registered extensions. + * + * @return ExtensionInterface[] An array of extensions (keys are for internal usage only and should not be relied on) + */ + public function getExtensions() + { + return $this->extensions; + } + + public function addTokenParser(TokenParserInterface $parser) + { + if ($this->extensionInitialized) { + throw new \LogicException('Unable to add a token parser as extensions have already been initialized.'); + } + + $this->staging->addTokenParser($parser); + } + + /** + * Gets the registered Token Parsers. + * + * @return \Twig_TokenParserBrokerInterface + * + * @internal + */ + public function getTokenParsers() { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->parsers; + } + + /** + * Gets registered tags. + * + * Be warned that this method cannot return tags defined by \Twig_TokenParserBrokerInterface classes. + * + * @return TokenParserInterface[] + * + * @internal + */ + public function getTags() + { + $tags = []; + foreach ($this->getTokenParsers()->getParsers() as $parser) { + if ($parser instanceof TokenParserInterface) { + $tags[$parser->getTag()] = $parser; + } + } + + return $tags; + } + + public function addNodeVisitor(NodeVisitorInterface $visitor) + { + if ($this->extensionInitialized) { + throw new \LogicException('Unable to add a node visitor as extensions have already been initialized.'); + } + + $this->staging->addNodeVisitor($visitor); + } + + /** + * Gets the registered Node Visitors. + * + * @return NodeVisitorInterface[] + * + * @internal + */ + public function getNodeVisitors() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->visitors; + } + + /** + * Registers a Filter. + * + * @param string|TwigFilter $name The filter name or a \Twig_SimpleFilter instance + * @param \Twig_FilterInterface|TwigFilter $filter + */ + public function addFilter($name, $filter = null) + { + if (!$name instanceof TwigFilter && !($filter instanceof TwigFilter || $filter instanceof \Twig_FilterInterface)) { + throw new \LogicException('A filter must be an instance of \Twig_FilterInterface or \Twig_SimpleFilter.'); + } + + if ($name instanceof TwigFilter) { + $filter = $name; + $name = $filter->getName(); + } else { + @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFilter" instead when defining filter "%s".', __METHOD__, $name), E_USER_DEPRECATED); + } + + if ($this->extensionInitialized) { + throw new \LogicException(sprintf('Unable to add filter "%s" as extensions have already been initialized.', $name)); + } + + $this->staging->addFilter($name, $filter); + } + + /** + * Get a filter by name. + * + * Subclasses may override this method and load filters differently; + * so no list of filters is available. + * + * @param string $name The filter name + * + * @return \Twig_Filter|false + * + * @internal + */ + public function getFilter($name) + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + if (isset($this->filters[$name])) { + return $this->filters[$name]; + } + + foreach ($this->filters as $pattern => $filter) { + $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); + + if ($count) { + if (preg_match('#^'.$pattern.'$#', $name, $matches)) { + array_shift($matches); + $filter->setArguments($matches); + + return $filter; + } + } + } + + foreach ($this->filterCallbacks as $callback) { + if (false !== $filter = \call_user_func($callback, $name)) { + return $filter; + } + } + + return false; + } + + public function registerUndefinedFilterCallback($callable) + { + $this->filterCallbacks[] = $callable; + } + + /** + * Gets the registered Filters. + * + * Be warned that this method cannot return filters defined with registerUndefinedFilterCallback. + * + * @return \Twig_FilterInterface[] + * + * @see registerUndefinedFilterCallback + * + * @internal + */ + public function getFilters() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->filters; + } + + /** + * Registers a Test. + * + * @param string|TwigTest $name The test name or a \Twig_SimpleTest instance + * @param \Twig_TestInterface|TwigTest $test A \Twig_TestInterface instance or a \Twig_SimpleTest instance + */ + public function addTest($name, $test = null) + { + if (!$name instanceof TwigTest && !($test instanceof TwigTest || $test instanceof \Twig_TestInterface)) { + throw new \LogicException('A test must be an instance of \Twig_TestInterface or \Twig_SimpleTest.'); + } + + if ($name instanceof TwigTest) { + $test = $name; + $name = $test->getName(); + } else { + @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleTest" instead when defining test "%s".', __METHOD__, $name), E_USER_DEPRECATED); + } + + if ($this->extensionInitialized) { + throw new \LogicException(sprintf('Unable to add test "%s" as extensions have already been initialized.', $name)); + } + + $this->staging->addTest($name, $test); + } + + /** + * Gets the registered Tests. + * + * @return \Twig_TestInterface[] + * + * @internal + */ + public function getTests() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->tests; + } + + /** + * Gets a test by name. + * + * @param string $name The test name + * + * @return \Twig_Test|false + * + * @internal + */ + public function getTest($name) + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + if (isset($this->tests[$name])) { + return $this->tests[$name]; + } + + foreach ($this->tests as $pattern => $test) { + $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); + + if ($count) { + if (preg_match('#^'.$pattern.'$#', $name, $matches)) { + array_shift($matches); + $test->setArguments($matches); + + return $test; + } + } + } + + return false; + } + + /** + * Registers a Function. + * + * @param string|TwigFunction $name The function name or a \Twig_SimpleFunction instance + * @param \Twig_FunctionInterface|TwigFunction $function + */ + public function addFunction($name, $function = null) + { + if (!$name instanceof TwigFunction && !($function instanceof TwigFunction || $function instanceof \Twig_FunctionInterface)) { + throw new \LogicException('A function must be an instance of \Twig_FunctionInterface or \Twig_SimpleFunction.'); + } + + if ($name instanceof TwigFunction) { + $function = $name; + $name = $function->getName(); + } else { + @trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFunction" instead when defining function "%s".', __METHOD__, $name), E_USER_DEPRECATED); + } + + if ($this->extensionInitialized) { + throw new \LogicException(sprintf('Unable to add function "%s" as extensions have already been initialized.', $name)); + } + + $this->staging->addFunction($name, $function); + } + + /** + * Get a function by name. + * + * Subclasses may override this method and load functions differently; + * so no list of functions is available. + * + * @param string $name function name + * + * @return \Twig_Function|false + * + * @internal + */ + public function getFunction($name) + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + if (isset($this->functions[$name])) { + return $this->functions[$name]; + } + + foreach ($this->functions as $pattern => $function) { + $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); + + if ($count) { + if (preg_match('#^'.$pattern.'$#', $name, $matches)) { + array_shift($matches); + $function->setArguments($matches); + + return $function; + } + } + } + + foreach ($this->functionCallbacks as $callback) { + if (false !== $function = \call_user_func($callback, $name)) { + return $function; + } + } + + return false; + } + + public function registerUndefinedFunctionCallback($callable) + { + $this->functionCallbacks[] = $callable; + } + + /** + * Gets registered functions. + * + * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback. + * + * @return \Twig_FunctionInterface[] + * + * @see registerUndefinedFunctionCallback + * + * @internal + */ + public function getFunctions() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->functions; + } + + /** + * Registers a Global. + * + * New globals can be added before compiling or rendering a template; + * but after, you can only update existing globals. + * + * @param string $name The global name + * @param mixed $value The global value + */ + public function addGlobal($name, $value) + { + if ($this->extensionInitialized || $this->runtimeInitialized) { + if (null === $this->globals) { + $this->globals = $this->initGlobals(); + } + + if (!\array_key_exists($name, $this->globals)) { + // The deprecation notice must be turned into the following exception in Twig 2.0 + @trigger_error(sprintf('Registering global variable "%s" at runtime or when the extensions have already been initialized is deprecated since version 1.21.', $name), E_USER_DEPRECATED); + //throw new \LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name)); + } + } + + if ($this->extensionInitialized || $this->runtimeInitialized) { + // update the value + $this->globals[$name] = $value; + } else { + $this->staging->addGlobal($name, $value); + } + } + + /** + * Gets the registered Globals. + * + * @return array An array of globals + * + * @internal + */ + public function getGlobals() + { + if (!$this->runtimeInitialized && !$this->extensionInitialized) { + return $this->initGlobals(); + } + + if (null === $this->globals) { + $this->globals = $this->initGlobals(); + } + + return $this->globals; + } + + /** + * Merges a context with the defined globals. + * + * @param array $context An array representing the context + * + * @return array The context merged with the globals + */ + public function mergeGlobals(array $context) + { + // we don't use array_merge as the context being generally + // bigger than globals, this code is faster. + foreach ($this->getGlobals() as $key => $value) { + if (!\array_key_exists($key, $context)) { + $context[$key] = $value; + } + } + + return $context; + } + + /** + * Gets the registered unary Operators. + * + * @return array An array of unary operators + * + * @internal + */ + public function getUnaryOperators() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->unaryOperators; + } + + /** + * Gets the registered binary Operators. + * + * @return array An array of binary operators + * + * @internal + */ + public function getBinaryOperators() + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + return $this->binaryOperators; + } + + /** + * @deprecated since 1.23 (to be removed in 2.0) + */ + public function computeAlternatives($name, $items) + { + @trigger_error(sprintf('The %s method is deprecated since version 1.23 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED); + + return SyntaxError::computeAlternatives($name, $items); + } + + /** + * @internal + */ + protected function initGlobals() + { + $globals = []; + foreach ($this->extensions as $name => $extension) { + if (!$extension instanceof GlobalsInterface) { + $m = new \ReflectionMethod($extension, 'getGlobals'); + + $parentClass = $m->getDeclaringClass()->getName(); + if ('Twig_Extension' !== $parentClass && 'Twig\Extension\AbstractExtension' !== $parentClass) { + @trigger_error(sprintf('Defining the getGlobals() method in the "%s" extension without explicitly implementing Twig\Extension\GlobalsInterface is deprecated since version 1.23.', $name), E_USER_DEPRECATED); + } + } + + $extGlob = $extension->getGlobals(); + if (!\is_array($extGlob)) { + throw new \UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', \get_class($extension))); + } + + $globals[] = $extGlob; + } + + $globals[] = $this->staging->getGlobals(); + + return \call_user_func_array('array_merge', $globals); + } + + /** + * @internal + */ + protected function initExtensions() + { + if ($this->extensionInitialized) { + return; + } + + $this->parsers = new \Twig_TokenParserBroker([], [], false); + $this->filters = []; + $this->functions = []; + $this->tests = []; + $this->visitors = []; + $this->unaryOperators = []; + $this->binaryOperators = []; + + foreach ($this->extensions as $extension) { + $this->initExtension($extension); + } + $this->initExtension($this->staging); + // Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception + $this->extensionInitialized = true; + } + + /** + * @internal + */ + protected function initExtension(ExtensionInterface $extension) + { + // filters + foreach ($extension->getFilters() as $name => $filter) { + if ($filter instanceof TwigFilter) { + $name = $filter->getName(); + } else { + @trigger_error(sprintf('Using an instance of "%s" for filter "%s" is deprecated since version 1.21. Use \Twig_SimpleFilter instead.', \get_class($filter), $name), E_USER_DEPRECATED); + } + + $this->filters[$name] = $filter; + } + + // functions + foreach ($extension->getFunctions() as $name => $function) { + if ($function instanceof TwigFunction) { + $name = $function->getName(); + } else { + @trigger_error(sprintf('Using an instance of "%s" for function "%s" is deprecated since version 1.21. Use \Twig_SimpleFunction instead.', \get_class($function), $name), E_USER_DEPRECATED); + } + + $this->functions[$name] = $function; + } + + // tests + foreach ($extension->getTests() as $name => $test) { + if ($test instanceof TwigTest) { + $name = $test->getName(); + } else { + @trigger_error(sprintf('Using an instance of "%s" for test "%s" is deprecated since version 1.21. Use \Twig_SimpleTest instead.', \get_class($test), $name), E_USER_DEPRECATED); + } + + $this->tests[$name] = $test; + } + + // token parsers + foreach ($extension->getTokenParsers() as $parser) { + if ($parser instanceof TokenParserInterface) { + $this->parsers->addTokenParser($parser); + } elseif ($parser instanceof \Twig_TokenParserBrokerInterface) { + @trigger_error('Registering a \Twig_TokenParserBrokerInterface instance is deprecated since version 1.21.', E_USER_DEPRECATED); + + $this->parsers->addTokenParserBroker($parser); + } else { + throw new \LogicException('getTokenParsers() must return an array of \Twig_TokenParserInterface or \Twig_TokenParserBrokerInterface instances.'); + } + } + + // node visitors + foreach ($extension->getNodeVisitors() as $visitor) { + $this->visitors[] = $visitor; + } + + // operators + if ($operators = $extension->getOperators()) { + if (!\is_array($operators)) { + throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', \get_class($extension), \is_object($operators) ? \get_class($operators) : \gettype($operators).(\is_resource($operators) ? '' : '#'.$operators))); + } + + if (2 !== \count($operators)) { + throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', \get_class($extension), \count($operators))); + } + + $this->unaryOperators = array_merge($this->unaryOperators, $operators[0]); + $this->binaryOperators = array_merge($this->binaryOperators, $operators[1]); + } + } + + /** + * @deprecated since 1.22 (to be removed in 2.0) + */ + protected function writeCacheFile($file, $content) + { + $this->cache->write($file, $content); + } + + private function updateOptionsHash() + { + $hashParts = array_merge( + array_keys($this->extensions), + [ + (int) \function_exists('twig_template_get_attributes'), + PHP_MAJOR_VERSION, + PHP_MINOR_VERSION, + self::VERSION, + (int) $this->debug, + $this->baseTemplateClass, + (int) $this->strictVariables, + ] + ); + $this->optionsHash = implode(':', $hashParts); } } + +class_alias('Twig\Environment', 'Twig_Environment'); diff --git a/vendor/twig/twig/src/Error/Error.php b/vendor/twig/twig/src/Error/Error.php index 52224d8afb785395b6e53a40160345e07326686f..e43a363746f487fb8c2255c39c90f259d770d3b5 100644 --- a/vendor/twig/twig/src/Error/Error.php +++ b/vendor/twig/twig/src/Error/Error.php @@ -1,11 +1,337 @@ <?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\Error; -class_exists('Twig_Error'); +use Twig\Source; +use Twig\Template; + +/** + * Twig base exception. + * + * This exception class and its children must only be used when + * an error occurs during the loading of a template, when a syntax error + * is detected in a template, or when rendering a template. Other + * errors must use regular PHP exception classes (like when the template + * cache directory is not writable for instance). + * + * To help debugging template issues, this class tracks the original template + * name and line where the error occurred. + * + * Whenever possible, you must set these information (original template name + * and line number) yourself by passing them to the constructor. If some or all + * these information are not available from where you throw the exception, then + * this class will guess them automatically (when the line number is set to -1 + * and/or the name is set to null). As this is a costly operation, this + * can be disabled by passing false for both the name and the line number + * when creating a new instance of this class. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class Error extends \Exception +{ + protected $lineno; + // to be renamed to name in 2.0 + protected $filename; + protected $rawMessage; + + private $sourcePath; + private $sourceCode; + + /** + * 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 + * @param \Exception $previous The previous exception + */ + public function __construct($message, $lineno = -1, $source = null, \Exception $previous = null, $autoGuess = true) + { + if (null === $source) { + $name = null; + } elseif (!$source instanceof Source) { + // for compat with the Twig C ext., passing the template name as string is accepted + $name = $source; + } else { + $name = $source->getName(); + $this->sourceCode = $source->getCode(); + $this->sourcePath = $source->getPath(); + } + parent::__construct('', 0, $previous); + + $this->lineno = $lineno; + $this->filename = $name; + + if ($autoGuess && (-1 === $lineno || null === $name || null === $this->sourcePath)) { + $this->guessTemplateInfo(); + } + + $this->rawMessage = $message; + + $this->updateRepr(); + } -if (\false) { - class Error extends \Twig_Error + /** + * Gets the raw message. + * + * @return string The raw message + */ + public function getRawMessage() { + return $this->rawMessage; + } + + /** + * Gets the logical name where the error occurred. + * + * @return string The name + * + * @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead. + */ + public function getTemplateFile() + { + @trigger_error(sprintf('The "%s" method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); + + return $this->filename; + } + + /** + * Sets the logical name where the error occurred. + * + * @param string $name The name + * + * @deprecated since 1.27 (to be removed in 2.0). Use setSourceContext() instead. + */ + public function setTemplateFile($name) + { + @trigger_error(sprintf('The "%s" method is deprecated since version 1.27 and will be removed in 2.0. Use setSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); + + $this->filename = $name; + + $this->updateRepr(); + } + + /** + * Gets the logical name where the error occurred. + * + * @return string The name + * + * @deprecated since 1.29 (to be removed in 2.0). Use getSourceContext() instead. + */ + public function getTemplateName() + { + @trigger_error(sprintf('The "%s" method is deprecated since version 1.29 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); + + return $this->filename; + } + + /** + * Sets the logical name where the error occurred. + * + * @param string $name The name + * + * @deprecated since 1.29 (to be removed in 2.0). Use setSourceContext() instead. + */ + public function setTemplateName($name) + { + @trigger_error(sprintf('The "%s" method is deprecated since version 1.29 and will be removed in 2.0. Use setSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); + + $this->filename = $name; + $this->sourceCode = $this->sourcePath = null; + + $this->updateRepr(); + } + + /** + * Gets the template line where the error occurred. + * + * @return int The template line + */ + public function getTemplateLine() + { + return $this->lineno; + } + + /** + * Sets the template line where the error occurred. + * + * @param int $lineno The template line + */ + public function setTemplateLine($lineno) + { + $this->lineno = $lineno; + + $this->updateRepr(); + } + + /** + * Gets the source context of the Twig template where the error occurred. + * + * @return Source|null + */ + public function getSourceContext() + { + return $this->filename ? new Source($this->sourceCode, $this->filename, $this->sourcePath) : null; + } + + /** + * Sets the source context of the Twig template where the error occurred. + */ + public function setSourceContext(Source $source = null) + { + if (null === $source) { + $this->sourceCode = $this->filename = $this->sourcePath = null; + } else { + $this->sourceCode = $source->getCode(); + $this->filename = $source->getName(); + $this->sourcePath = $source->getPath(); + } + + $this->updateRepr(); + } + + public function guess() + { + $this->guessTemplateInfo(); + $this->updateRepr(); + } + + public function appendMessage($rawMessage) + { + $this->rawMessage .= $rawMessage; + $this->updateRepr(); + } + + /** + * @internal + */ + protected function updateRepr() + { + $this->message = $this->rawMessage; + + if ($this->sourcePath && $this->lineno > 0) { + $this->file = $this->sourcePath; + $this->line = $this->lineno; + + return; + } + + $dot = false; + if ('.' === substr($this->message, -1)) { + $this->message = substr($this->message, 0, -1); + $dot = true; + } + + $questionMark = false; + if ('?' === substr($this->message, -1)) { + $this->message = substr($this->message, 0, -1); + $questionMark = true; + } + + if ($this->filename) { + if (\is_string($this->filename) || (\is_object($this->filename) && method_exists($this->filename, '__toString'))) { + $name = sprintf('"%s"', $this->filename); + } else { + $name = json_encode($this->filename); + } + $this->message .= sprintf(' in %s', $name); + } + + if ($this->lineno && $this->lineno >= 0) { + $this->message .= sprintf(' at line %d', $this->lineno); + } + + if ($dot) { + $this->message .= '.'; + } + + if ($questionMark) { + $this->message .= '?'; + } + } + + /** + * @internal + */ + protected function guessTemplateInfo() + { + $template = null; + $templateClass = null; + + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT); + foreach ($backtrace as $trace) { + if (isset($trace['object']) && $trace['object'] instanceof Template && 'Twig_Template' !== \get_class($trace['object'])) { + $currentClass = \get_class($trace['object']); + $isEmbedContainer = 0 === strpos($templateClass, $currentClass); + if (null === $this->filename || ($this->filename == $trace['object']->getTemplateName() && !$isEmbedContainer)) { + $template = $trace['object']; + $templateClass = \get_class($trace['object']); + } + } + } + + // update template name + if (null !== $template && null === $this->filename) { + $this->filename = $template->getTemplateName(); + } + + // update template path if any + if (null !== $template && null === $this->sourcePath) { + $src = $template->getSourceContext(); + $this->sourceCode = $src->getCode(); + $this->sourcePath = $src->getPath(); + } + + if (null === $template || $this->lineno > -1) { + return; + } + + $r = new \ReflectionObject($template); + $file = $r->getFileName(); + + $exceptions = [$e = $this]; + while ($e instanceof self && $e = $e->getPrevious()) { + $exceptions[] = $e; + } + + while ($e = array_pop($exceptions)) { + $traces = $e->getTrace(); + array_unshift($traces, ['file' => $e->getFile(), 'line' => $e->getLine()]); + + while ($trace = array_shift($traces)) { + if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) { + continue; + } + + foreach ($template->getDebugInfo() as $codeLine => $templateLine) { + if ($codeLine <= $trace['line']) { + // update template line + $this->lineno = $templateLine; + + return; + } + } + } + } } } + +class_alias('Twig\Error\Error', 'Twig_Error'); diff --git a/vendor/twig/twig/src/Error/LoaderError.php b/vendor/twig/twig/src/Error/LoaderError.php index df731b15b30bac1db493ae7682b8477bbe4252df..5a1cd1ecc0721af2d118bbbc5aba89b201529494 100644 --- a/vendor/twig/twig/src/Error/LoaderError.php +++ b/vendor/twig/twig/src/Error/LoaderError.php @@ -1,11 +1,35 @@ <?php -namespace Twig\Error; +/* + * 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. + */ -class_exists('Twig_Error_Loader'); +namespace Twig\Error; -if (\false) { - class LoaderError extends \Twig_Error_Loader +/** + * Exception thrown when an error occurs during template loading. + * + * Automatic template information guessing is always turned off as + * if a template cannot be loaded, there is nothing to guess. + * However, when a template is loaded from another one, then, we need + * to find the current context and this is automatically done by + * Twig\Template::displayWithErrorHandling(). + * + * This strategy makes Twig\Environment::resolveTemplate() much faster. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class LoaderError extends Error +{ + public function __construct($message, $lineno = -1, $source = null, \Exception $previous = null) { + parent::__construct($message, $lineno, $source, $previous, false); } } + +class_alias('Twig\Error\LoaderError', 'Twig_Error_Loader'); diff --git a/vendor/twig/twig/src/Error/RuntimeError.php b/vendor/twig/twig/src/Error/RuntimeError.php index b29ec536c2a7da3c34dd7ea1d33aaf3122b099fe..9b3f36e050e7bdf45a0b2af28d71ba06fb8a1bba 100644 --- a/vendor/twig/twig/src/Error/RuntimeError.php +++ b/vendor/twig/twig/src/Error/RuntimeError.php @@ -1,11 +1,24 @@ <?php -namespace Twig\Error; +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ -class_exists('Twig_Error_Runtime'); +namespace Twig\Error; -if (\false) { - class RuntimeError extends \Twig_Error_Runtime - { - } +/** + * Exception thrown when an error occurs at runtime. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class RuntimeError extends Error +{ } + +class_alias('Twig\Error\RuntimeError', 'Twig_Error_Runtime'); diff --git a/vendor/twig/twig/src/Error/SyntaxError.php b/vendor/twig/twig/src/Error/SyntaxError.php index 1b31520e5307da97eba8a0955bfadd9e1c0ff9e7..480e6606210c80c9b4dc371c4b6d4d1186bc3805 100644 --- a/vendor/twig/twig/src/Error/SyntaxError.php +++ b/vendor/twig/twig/src/Error/SyntaxError.php @@ -1,11 +1,57 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Error; -class_exists('Twig_Error_Syntax'); +/** + * \Exception thrown when a syntax error occurs during lexing or parsing of a template. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class SyntaxError extends Error +{ + /** + * Tweaks the error message to include suggestions. + * + * @param string $name The original name of the item that does not exist + * @param array $items An array of possible items + */ + public function addSuggestions($name, array $items) + { + if (!$alternatives = self::computeAlternatives($name, $items)) { + return; + } + + $this->appendMessage(sprintf(' Did you mean "%s"?', implode('", "', $alternatives))); + } -if (\false) { - class SyntaxError extends \Twig_Error_Syntax + /** + * @internal + * + * To be merged with the addSuggestions() method in 2.0. + */ + public static function computeAlternatives($name, $items) { + $alternatives = []; + foreach ($items as $item) { + $lev = levenshtein($name, $item); + if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) { + $alternatives[$item] = $lev; + } + } + asort($alternatives); + + return array_keys($alternatives); } } + +class_alias('Twig\Error\SyntaxError', 'Twig_Error_Syntax'); diff --git a/vendor/twig/twig/src/ExpressionParser.php b/vendor/twig/twig/src/ExpressionParser.php index 0cbbdbc246541efa6e8a8f5813cf6fd3658ed15b..a786e6fb1cdc3fea90ff4220c3f6d5cdab4cfeeb 100644 --- a/vendor/twig/twig/src/ExpressionParser.php +++ b/vendor/twig/twig/src/ExpressionParser.php @@ -1,11 +1,765 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig; -class_exists('Twig_ExpressionParser'); +use Twig\Error\SyntaxError; +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\Expression\Binary\ConcatBinary; +use Twig\Node\Expression\BlockReferenceExpression; +use Twig\Node\Expression\ConditionalExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\GetAttrExpression; +use Twig\Node\Expression\MethodCallExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\Expression\ParentExpression; +use Twig\Node\Expression\Unary\NegUnary; +use Twig\Node\Expression\Unary\NotUnary; +use Twig\Node\Expression\Unary\PosUnary; +use Twig\Node\Node; + +/** + * Parses expressions. + * + * This parser implements a "Precedence climbing" algorithm. + * + * @see https://www.engr.mun.ca/~theo/Misc/exp_parsing.htm + * @see https://en.wikipedia.org/wiki/Operator-precedence_parser + * + * @author Fabien Potencier <fabien@symfony.com> + * + * @internal + */ +class ExpressionParser +{ + const OPERATOR_LEFT = 1; + const OPERATOR_RIGHT = 2; + + protected $parser; + protected $unaryOperators; + protected $binaryOperators; + + private $env; + + public function __construct(Parser $parser, $env = null) + { + $this->parser = $parser; + + if ($env instanceof Environment) { + $this->env = $env; + $this->unaryOperators = $env->getUnaryOperators(); + $this->binaryOperators = $env->getBinaryOperators(); + } else { + @trigger_error('Passing the operators as constructor arguments to '.__METHOD__.' is deprecated since version 1.27. Pass the environment instead.', E_USER_DEPRECATED); + + $this->env = $parser->getEnvironment(); + $this->unaryOperators = func_get_arg(1); + $this->binaryOperators = func_get_arg(2); + } + } + + public function parseExpression($precedence = 0) + { + $expr = $this->getPrimary(); + $token = $this->parser->getCurrentToken(); + while ($this->isBinary($token) && $this->binaryOperators[$token->getValue()]['precedence'] >= $precedence) { + $op = $this->binaryOperators[$token->getValue()]; + $this->parser->getStream()->next(); + + if ('is not' === $token->getValue()) { + $expr = $this->parseNotTestExpression($expr); + } elseif ('is' === $token->getValue()) { + $expr = $this->parseTestExpression($expr); + } elseif (isset($op['callable'])) { + $expr = \call_user_func($op['callable'], $this->parser, $expr); + } else { + $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']); + $class = $op['class']; + $expr = new $class($expr, $expr1, $token->getLine()); + } + + $token = $this->parser->getCurrentToken(); + } + + if (0 === $precedence) { + return $this->parseConditionalExpression($expr); + } + + return $expr; + } + + protected function getPrimary() + { + $token = $this->parser->getCurrentToken(); + + if ($this->isUnary($token)) { + $operator = $this->unaryOperators[$token->getValue()]; + $this->parser->getStream()->next(); + $expr = $this->parseExpression($operator['precedence']); + $class = $operator['class']; + + return $this->parsePostfixExpression(new $class($expr, $token->getLine())); + } elseif ($token->test(Token::PUNCTUATION_TYPE, '(')) { + $this->parser->getStream()->next(); + $expr = $this->parseExpression(); + $this->parser->getStream()->expect(Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed'); + + return $this->parsePostfixExpression($expr); + } + + return $this->parsePrimaryExpression(); + } -if (\false) { - class ExpressionParser extends \Twig_ExpressionParser + protected function parseConditionalExpression($expr) { + while ($this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, '?')) { + if (!$this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ':')) { + $expr2 = $this->parseExpression(); + if ($this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ':')) { + $expr3 = $this->parseExpression(); + } else { + $expr3 = new ConstantExpression('', $this->parser->getCurrentToken()->getLine()); + } + } else { + $expr2 = $expr; + $expr3 = $this->parseExpression(); + } + + $expr = new ConditionalExpression($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine()); + } + + return $expr; + } + + protected function isUnary(Token $token) + { + return $token->test(Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->getValue()]); + } + + protected function isBinary(Token $token) + { + return $token->test(Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]); + } + + public function parsePrimaryExpression() + { + $token = $this->parser->getCurrentToken(); + switch ($token->getType()) { + case Token::NAME_TYPE: + $this->parser->getStream()->next(); + switch ($token->getValue()) { + case 'true': + case 'TRUE': + $node = new ConstantExpression(true, $token->getLine()); + break; + + case 'false': + case 'FALSE': + $node = new ConstantExpression(false, $token->getLine()); + break; + + case 'none': + case 'NONE': + case 'null': + case 'NULL': + $node = new ConstantExpression(null, $token->getLine()); + break; + + default: + if ('(' === $this->parser->getCurrentToken()->getValue()) { + $node = $this->getFunctionNode($token->getValue(), $token->getLine()); + } else { + $node = new NameExpression($token->getValue(), $token->getLine()); + } + } + break; + + case Token::NUMBER_TYPE: + $this->parser->getStream()->next(); + $node = new ConstantExpression($token->getValue(), $token->getLine()); + break; + + case Token::STRING_TYPE: + case Token::INTERPOLATION_START_TYPE: + $node = $this->parseStringExpression(); + break; + + case Token::OPERATOR_TYPE: + if (preg_match(Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) { + // in this context, string operators are variable names + $this->parser->getStream()->next(); + $node = new NameExpression($token->getValue(), $token->getLine()); + break; + } elseif (isset($this->unaryOperators[$token->getValue()])) { + $class = $this->unaryOperators[$token->getValue()]['class']; + + $ref = new \ReflectionClass($class); + $negClass = 'Twig\Node\Expression\Unary\NegUnary'; + $posClass = 'Twig\Node\Expression\Unary\PosUnary'; + if (!(\in_array($ref->getName(), [$negClass, $posClass, 'Twig_Node_Expression_Unary_Neg', 'Twig_Node_Expression_Unary_Pos']) + || $ref->isSubclassOf($negClass) || $ref->isSubclassOf($posClass) + || $ref->isSubclassOf('Twig_Node_Expression_Unary_Neg') || $ref->isSubclassOf('Twig_Node_Expression_Unary_Pos')) + ) { + throw new SyntaxError(sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); + } + + $this->parser->getStream()->next(); + $expr = $this->parsePrimaryExpression(); + + $node = new $class($expr, $token->getLine()); + break; + } + + // no break + default: + if ($token->test(Token::PUNCTUATION_TYPE, '[')) { + $node = $this->parseArrayExpression(); + } elseif ($token->test(Token::PUNCTUATION_TYPE, '{')) { + $node = $this->parseHashExpression(); + } elseif ($token->test(Token::OPERATOR_TYPE, '=') && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) { + throw new SyntaxError(sprintf('Unexpected operator of value "%s". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead.', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); + } else { + throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s".', Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); + } + } + + return $this->parsePostfixExpression($node); + } + + public function parseStringExpression() + { + $stream = $this->parser->getStream(); + + $nodes = []; + // a string cannot be followed by another string in a single expression + $nextCanBeString = true; + while (true) { + if ($nextCanBeString && $token = $stream->nextIf(Token::STRING_TYPE)) { + $nodes[] = new ConstantExpression($token->getValue(), $token->getLine()); + $nextCanBeString = false; + } elseif ($stream->nextIf(Token::INTERPOLATION_START_TYPE)) { + $nodes[] = $this->parseExpression(); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $nextCanBeString = true; + } else { + break; + } + } + + $expr = array_shift($nodes); + foreach ($nodes as $node) { + $expr = new ConcatBinary($expr, $node, $node->getTemplateLine()); + } + + return $expr; + } + + public function parseArrayExpression() + { + $stream = $this->parser->getStream(); + $stream->expect(Token::PUNCTUATION_TYPE, '[', 'An array element was expected'); + + $node = new ArrayExpression([], $stream->getCurrent()->getLine()); + $first = true; + while (!$stream->test(Token::PUNCTUATION_TYPE, ']')) { + if (!$first) { + $stream->expect(Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma'); + + // trailing ,? + if ($stream->test(Token::PUNCTUATION_TYPE, ']')) { + break; + } + } + $first = false; + + $node->addElement($this->parseExpression()); + } + $stream->expect(Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed'); + + return $node; + } + + public function parseHashExpression() + { + $stream = $this->parser->getStream(); + $stream->expect(Token::PUNCTUATION_TYPE, '{', 'A hash element was expected'); + + $node = new ArrayExpression([], $stream->getCurrent()->getLine()); + $first = true; + while (!$stream->test(Token::PUNCTUATION_TYPE, '}')) { + if (!$first) { + $stream->expect(Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma'); + + // trailing ,? + if ($stream->test(Token::PUNCTUATION_TYPE, '}')) { + break; + } + } + $first = false; + + // a hash key can be: + // + // * a number -- 12 + // * a string -- 'a' + // * a name, which is equivalent to a string -- a + // * an expression, which must be enclosed in parentheses -- (1 + 2) + if (($token = $stream->nextIf(Token::STRING_TYPE)) || ($token = $stream->nextIf(Token::NAME_TYPE)) || $token = $stream->nextIf(Token::NUMBER_TYPE)) { + $key = new ConstantExpression($token->getValue(), $token->getLine()); + } elseif ($stream->test(Token::PUNCTUATION_TYPE, '(')) { + $key = $this->parseExpression(); + } else { + $current = $stream->getCurrent(); + + throw new SyntaxError(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext()); + } + + $stream->expect(Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); + $value = $this->parseExpression(); + + $node->addElement($value, $key); + } + $stream->expect(Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed'); + + return $node; + } + + public function parsePostfixExpression($node) + { + while (true) { + $token = $this->parser->getCurrentToken(); + if (Token::PUNCTUATION_TYPE == $token->getType()) { + if ('.' == $token->getValue() || '[' == $token->getValue()) { + $node = $this->parseSubscriptExpression($node); + } elseif ('|' == $token->getValue()) { + $node = $this->parseFilterExpression($node); + } else { + break; + } + } else { + break; + } + } + + return $node; + } + + public function getFunctionNode($name, $line) + { + switch ($name) { + case 'parent': + $this->parseArguments(); + if (!\count($this->parser->getBlockStack())) { + throw new SyntaxError('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext()); + } + + if (!$this->parser->getParent() && !$this->parser->hasTraits()) { + throw new SyntaxError('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext()); + } + + return new ParentExpression($this->parser->peekBlockStack(), $line); + case 'block': + $args = $this->parseArguments(); + if (\count($args) < 1) { + throw new SyntaxError('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext()); + } + + return new BlockReferenceExpression($args->getNode(0), \count($args) > 1 ? $args->getNode(1) : null, $line); + case 'attribute': + $args = $this->parseArguments(); + if (\count($args) < 2) { + throw new SyntaxError('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext()); + } + + return new GetAttrExpression($args->getNode(0), $args->getNode(1), \count($args) > 2 ? $args->getNode(2) : null, Template::ANY_CALL, $line); + default: + if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) { + $arguments = new ArrayExpression([], $line); + foreach ($this->parseArguments() as $n) { + $arguments->addElement($n); + } + + $node = new MethodCallExpression($alias['node'], $alias['name'], $arguments, $line); + $node->setAttribute('safe', true); + + return $node; + } + + $args = $this->parseArguments(true); + $class = $this->getFunctionNodeClass($name, $line); + + return new $class($name, $args, $line); + } + } + + public function parseSubscriptExpression($node) + { + $stream = $this->parser->getStream(); + $token = $stream->next(); + $lineno = $token->getLine(); + $arguments = new ArrayExpression([], $lineno); + $type = Template::ANY_CALL; + if ('.' == $token->getValue()) { + $token = $stream->next(); + if ( + Token::NAME_TYPE == $token->getType() + || + Token::NUMBER_TYPE == $token->getType() + || + (Token::OPERATOR_TYPE == $token->getType() && preg_match(Lexer::REGEX_NAME, $token->getValue())) + ) { + $arg = new ConstantExpression($token->getValue(), $lineno); + + if ($stream->test(Token::PUNCTUATION_TYPE, '(')) { + $type = Template::METHOD_CALL; + foreach ($this->parseArguments() as $n) { + $arguments->addElement($n); + } + } + } else { + throw new SyntaxError('Expected name or number.', $lineno, $stream->getSourceContext()); + } + + if ($node instanceof NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { + if (!$arg instanceof ConstantExpression) { + throw new SyntaxError(sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $stream->getSourceContext()); + } + + $name = $arg->getAttribute('value'); + + if ($this->parser->isReservedMacroName($name)) { + throw new SyntaxError(sprintf('"%s" cannot be called as macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext()); + } + + $node = new MethodCallExpression($node, 'get'.$name, $arguments, $lineno); + $node->setAttribute('safe', true); + + return $node; + } + } else { + $type = Template::ARRAY_CALL; + + // slice? + $slice = false; + if ($stream->test(Token::PUNCTUATION_TYPE, ':')) { + $slice = true; + $arg = new ConstantExpression(0, $token->getLine()); + } else { + $arg = $this->parseExpression(); + } + + if ($stream->nextIf(Token::PUNCTUATION_TYPE, ':')) { + $slice = true; + } + + if ($slice) { + if ($stream->test(Token::PUNCTUATION_TYPE, ']')) { + $length = new ConstantExpression(null, $token->getLine()); + } else { + $length = $this->parseExpression(); + } + + $class = $this->getFilterNodeClass('slice', $token->getLine()); + $arguments = new Node([$arg, $length]); + $filter = new $class($node, new ConstantExpression('slice', $token->getLine()), $arguments, $token->getLine()); + + $stream->expect(Token::PUNCTUATION_TYPE, ']'); + + return $filter; + } + + $stream->expect(Token::PUNCTUATION_TYPE, ']'); + } + + return new GetAttrExpression($node, $arg, $arguments, $type, $lineno); + } + + public function parseFilterExpression($node) + { + $this->parser->getStream()->next(); + + return $this->parseFilterExpressionRaw($node); + } + + public function parseFilterExpressionRaw($node, $tag = null) + { + while (true) { + $token = $this->parser->getStream()->expect(Token::NAME_TYPE); + + $name = new ConstantExpression($token->getValue(), $token->getLine()); + if (!$this->parser->getStream()->test(Token::PUNCTUATION_TYPE, '(')) { + $arguments = new Node(); + } else { + $arguments = $this->parseArguments(true); + } + + $class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine()); + + $node = new $class($node, $name, $arguments, $token->getLine(), $tag); + + if (!$this->parser->getStream()->test(Token::PUNCTUATION_TYPE, '|')) { + break; + } + + $this->parser->getStream()->next(); + } + + return $node; + } + + /** + * Parses arguments. + * + * @param bool $namedArguments Whether to allow named arguments or not + * @param bool $definition Whether we are parsing arguments for a function definition + * + * @return Node + * + * @throws SyntaxError + */ + public function parseArguments($namedArguments = false, $definition = false) + { + $args = []; + $stream = $this->parser->getStream(); + + $stream->expect(Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); + while (!$stream->test(Token::PUNCTUATION_TYPE, ')')) { + if (!empty($args)) { + $stream->expect(Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma'); + } + + if ($definition) { + $token = $stream->expect(Token::NAME_TYPE, null, 'An argument must be a name'); + $value = new NameExpression($token->getValue(), $this->parser->getCurrentToken()->getLine()); + } else { + $value = $this->parseExpression(); + } + + $name = null; + if ($namedArguments && $token = $stream->nextIf(Token::OPERATOR_TYPE, '=')) { + if (!$value instanceof NameExpression) { + throw new SyntaxError(sprintf('A parameter name must be a string, "%s" given.', \get_class($value)), $token->getLine(), $stream->getSourceContext()); + } + $name = $value->getAttribute('name'); + + if ($definition) { + $value = $this->parsePrimaryExpression(); + + if (!$this->checkConstantExpression($value)) { + throw new SyntaxError(sprintf('A default value for an argument must be a constant (a boolean, a string, a number, or an array).'), $token->getLine(), $stream->getSourceContext()); + } + } else { + $value = $this->parseExpression(); + } + } + + if ($definition) { + if (null === $name) { + $name = $value->getAttribute('name'); + $value = new ConstantExpression(null, $this->parser->getCurrentToken()->getLine()); + } + $args[$name] = $value; + } else { + if (null === $name) { + $args[] = $value; + } else { + $args[$name] = $value; + } + } + } + $stream->expect(Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis'); + + return new Node($args); + } + + public function parseAssignmentExpression() + { + $stream = $this->parser->getStream(); + $targets = []; + while (true) { + $token = $stream->expect(Token::NAME_TYPE, null, 'Only variables can be assigned to'); + $value = $token->getValue(); + if (\in_array(strtolower($value), ['true', 'false', 'none', 'null'])) { + throw new SyntaxError(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext()); + } + $targets[] = new AssignNameExpression($value, $token->getLine()); + + if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { + break; + } + } + + return new Node($targets); + } + + public function parseMultitargetExpression() + { + $targets = []; + while (true) { + $targets[] = $this->parseExpression(); + if (!$this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ',')) { + break; + } + } + + return new Node($targets); + } + + private function parseNotTestExpression(\Twig_NodeInterface $node) + { + return new NotUnary($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine()); + } + + private function parseTestExpression(\Twig_NodeInterface $node) + { + $stream = $this->parser->getStream(); + list($name, $test) = $this->getTest($node->getTemplateLine()); + + $class = $this->getTestNodeClass($test); + $arguments = null; + if ($stream->test(Token::PUNCTUATION_TYPE, '(')) { + $arguments = $this->parser->getExpressionParser()->parseArguments(true); + } + + return new $class($node, $name, $arguments, $this->parser->getCurrentToken()->getLine()); + } + + private function getTest($line) + { + $stream = $this->parser->getStream(); + $name = $stream->expect(Token::NAME_TYPE)->getValue(); + + if ($test = $this->env->getTest($name)) { + return [$name, $test]; + } + + if ($stream->test(Token::NAME_TYPE)) { + // try 2-words tests + $name = $name.' '.$this->parser->getCurrentToken()->getValue(); + + if ($test = $this->env->getTest($name)) { + $stream->next(); + + return [$name, $test]; + } + } + + $e = new SyntaxError(sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext()); + $e->addSuggestions($name, array_keys($this->env->getTests())); + + throw $e; + } + + private function getTestNodeClass($test) + { + if ($test instanceof TwigTest && $test->isDeprecated()) { + $stream = $this->parser->getStream(); + $message = sprintf('Twig Test "%s" is deprecated', $test->getName()); + if (!\is_bool($test->getDeprecatedVersion())) { + $message .= sprintf(' since version %s', $test->getDeprecatedVersion()); + } + if ($test->getAlternative()) { + $message .= sprintf('. Use "%s" instead', $test->getAlternative()); + } + $src = $stream->getSourceContext(); + $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $stream->getCurrent()->getLine()); + + @trigger_error($message, E_USER_DEPRECATED); + } + + if ($test instanceof TwigTest) { + return $test->getNodeClass(); + } + + return $test instanceof \Twig_Test_Node ? $test->getClass() : 'Twig\Node\Expression\TestExpression'; + } + + protected function getFunctionNodeClass($name, $line) + { + if (false === $function = $this->env->getFunction($name)) { + $e = new SyntaxError(sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext()); + $e->addSuggestions($name, array_keys($this->env->getFunctions())); + + throw $e; + } + + if ($function instanceof TwigFunction && $function->isDeprecated()) { + $message = sprintf('Twig Function "%s" is deprecated', $function->getName()); + if (!\is_bool($function->getDeprecatedVersion())) { + $message .= sprintf(' since version %s', $function->getDeprecatedVersion()); + } + if ($function->getAlternative()) { + $message .= sprintf('. Use "%s" instead', $function->getAlternative()); + } + $src = $this->parser->getStream()->getSourceContext(); + $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line); + + @trigger_error($message, E_USER_DEPRECATED); + } + + if ($function instanceof TwigFunction) { + return $function->getNodeClass(); + } + + return $function instanceof \Twig_Function_Node ? $function->getClass() : 'Twig\Node\Expression\FunctionExpression'; + } + + protected function getFilterNodeClass($name, $line) + { + if (false === $filter = $this->env->getFilter($name)) { + $e = new SyntaxError(sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext()); + $e->addSuggestions($name, array_keys($this->env->getFilters())); + + throw $e; + } + + if ($filter instanceof TwigFilter && $filter->isDeprecated()) { + $message = sprintf('Twig Filter "%s" is deprecated', $filter->getName()); + if (!\is_bool($filter->getDeprecatedVersion())) { + $message .= sprintf(' since version %s', $filter->getDeprecatedVersion()); + } + if ($filter->getAlternative()) { + $message .= sprintf('. Use "%s" instead', $filter->getAlternative()); + } + $src = $this->parser->getStream()->getSourceContext(); + $message .= sprintf(' in %s at line %d.', $src->getPath() ? $src->getPath() : $src->getName(), $line); + + @trigger_error($message, E_USER_DEPRECATED); + } + + if ($filter instanceof TwigFilter) { + return $filter->getNodeClass(); + } + + return $filter instanceof \Twig_Filter_Node ? $filter->getClass() : 'Twig\Node\Expression\FilterExpression'; + } + + // checks that the node only contains "constant" elements + protected function checkConstantExpression(\Twig_NodeInterface $node) + { + if (!($node instanceof ConstantExpression || $node instanceof ArrayExpression + || $node instanceof NegUnary || $node instanceof PosUnary + )) { + return false; + } + + foreach ($node as $n) { + if (!$this->checkConstantExpression($n)) { + return false; + } + } + + return true; } } + +class_alias('Twig\ExpressionParser', 'Twig_ExpressionParser'); diff --git a/vendor/twig/twig/src/Extension/AbstractExtension.php b/vendor/twig/twig/src/Extension/AbstractExtension.php index 8fc965c463a5dd54c1170ae76100193c458b80f1..fa3245b2984c4d6411bbd5e393801795fcee7a8a 100644 --- a/vendor/twig/twig/src/Extension/AbstractExtension.php +++ b/vendor/twig/twig/src/Extension/AbstractExtension.php @@ -1,11 +1,72 @@ <?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\Extension; -class_exists('Twig_Extension'); +use Twig\Environment; + +abstract class AbstractExtension implements ExtensionInterface +{ + /** + * @deprecated since 1.23 (to be removed in 2.0), implement \Twig_Extension_InitRuntimeInterface instead + */ + public function initRuntime(Environment $environment) + { + } + + public function getTokenParsers() + { + return []; + } + + public function getNodeVisitors() + { + return []; + } + + public function getFilters() + { + return []; + } + + public function getTests() + { + return []; + } -if (\false) { - class AbstractExtension extends \Twig_Extension + public function getFunctions() { + return []; + } + + public function getOperators() + { + return []; + } + + /** + * @deprecated since 1.23 (to be removed in 2.0), implement \Twig_Extension_GlobalsInterface instead + */ + public function getGlobals() + { + return []; + } + + /** + * @deprecated since 1.26 (to be removed in 2.0), not used anymore internally + */ + public function getName() + { + return \get_class($this); } } + +class_alias('Twig\Extension\AbstractExtension', 'Twig_Extension'); diff --git a/vendor/twig/twig/src/Extension/CoreExtension.php b/vendor/twig/twig/src/Extension/CoreExtension.php index 6f66a44dd44e7971f35dfb6bae4161eae7f94fd9..63265d619aff0f16e7fe9c7b3e8c92e049fb1a86 100644 --- a/vendor/twig/twig/src/Extension/CoreExtension.php +++ b/vendor/twig/twig/src/Extension/CoreExtension.php @@ -1,11 +1,1662 @@ <?php -namespace Twig\Extension; +/* + * 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. + */ -class_exists('Twig_Extension_Core'); +namespace Twig\Extension { +use Twig\ExpressionParser; +use Twig\TokenParser\BlockTokenParser; +use Twig\TokenParser\DeprecatedTokenParser; +use Twig\TokenParser\DoTokenParser; +use Twig\TokenParser\EmbedTokenParser; +use Twig\TokenParser\ExtendsTokenParser; +use Twig\TokenParser\FilterTokenParser; +use Twig\TokenParser\FlushTokenParser; +use Twig\TokenParser\ForTokenParser; +use Twig\TokenParser\FromTokenParser; +use Twig\TokenParser\IfTokenParser; +use Twig\TokenParser\ImportTokenParser; +use Twig\TokenParser\IncludeTokenParser; +use Twig\TokenParser\MacroTokenParser; +use Twig\TokenParser\SetTokenParser; +use Twig\TokenParser\SpacelessTokenParser; +use Twig\TokenParser\UseTokenParser; +use Twig\TokenParser\WithTokenParser; +use Twig\TwigFilter; +use Twig\TwigFunction; +use Twig\TwigTest; -if (\false) { - class CoreExtension extends \Twig_Extension_Core +/** + * @final + */ +class CoreExtension extends AbstractExtension +{ + protected $dateFormats = ['F j, Y H:i', '%d days']; + protected $numberFormat = [0, '.', ',']; + protected $timezone = null; + protected $escapers = []; + + /** + * Defines a new escaper to be used via the escape filter. + * + * @param string $strategy The strategy name that should be used as a strategy in the escape call + * @param callable $callable A valid PHP callable + */ + public function setEscaper($strategy, $callable) + { + $this->escapers[$strategy] = $callable; + } + + /** + * Gets all defined escapers. + * + * @return array An array of escapers + */ + public function getEscapers() + { + return $this->escapers; + } + + /** + * Sets the default format to be used by the date filter. + * + * @param string $format The default date format string + * @param string $dateIntervalFormat The default date interval format string + */ + public function setDateFormat($format = null, $dateIntervalFormat = null) + { + if (null !== $format) { + $this->dateFormats[0] = $format; + } + + if (null !== $dateIntervalFormat) { + $this->dateFormats[1] = $dateIntervalFormat; + } + } + + /** + * Gets the default format to be used by the date filter. + * + * @return array The default date format string and the default date interval format string + */ + public function getDateFormat() + { + return $this->dateFormats; + } + + /** + * Sets the default timezone to be used by the date filter. + * + * @param \DateTimeZone|string $timezone The default timezone string or a \DateTimeZone object + */ + public function setTimezone($timezone) + { + $this->timezone = $timezone instanceof \DateTimeZone ? $timezone : new \DateTimeZone($timezone); + } + + /** + * Gets the default timezone to be used by the date filter. + * + * @return \DateTimeZone The default timezone currently in use + */ + public function getTimezone() + { + if (null === $this->timezone) { + $this->timezone = new \DateTimeZone(date_default_timezone_get()); + } + + return $this->timezone; + } + + /** + * Sets the default format to be used by the number_format filter. + * + * @param int $decimal the number of decimal places to use + * @param string $decimalPoint the character(s) to use for the decimal point + * @param string $thousandSep the character(s) to use for the thousands separator + */ + public function setNumberFormat($decimal, $decimalPoint, $thousandSep) + { + $this->numberFormat = [$decimal, $decimalPoint, $thousandSep]; + } + + /** + * Get the default format used by the number_format filter. + * + * @return array The arguments for number_format() + */ + public function getNumberFormat() + { + return $this->numberFormat; + } + + public function getTokenParsers() + { + return [ + new ForTokenParser(), + new IfTokenParser(), + new ExtendsTokenParser(), + new IncludeTokenParser(), + new BlockTokenParser(), + new UseTokenParser(), + new FilterTokenParser(), + new MacroTokenParser(), + new ImportTokenParser(), + new FromTokenParser(), + new SetTokenParser(), + new SpacelessTokenParser(), + new FlushTokenParser(), + new DoTokenParser(), + new EmbedTokenParser(), + new WithTokenParser(), + new DeprecatedTokenParser(), + ]; + } + + public function getFilters() + { + $filters = [ + // formatting filters + new TwigFilter('date', 'twig_date_format_filter', ['needs_environment' => true]), + new TwigFilter('date_modify', 'twig_date_modify_filter', ['needs_environment' => true]), + new TwigFilter('format', 'sprintf'), + new TwigFilter('replace', 'twig_replace_filter'), + new TwigFilter('number_format', 'twig_number_format_filter', ['needs_environment' => true]), + new TwigFilter('abs', 'abs'), + new TwigFilter('round', 'twig_round'), + + // encoding + new TwigFilter('url_encode', 'twig_urlencode_filter'), + new TwigFilter('json_encode', 'twig_jsonencode_filter'), + new TwigFilter('convert_encoding', 'twig_convert_encoding'), + + // string filters + new TwigFilter('title', 'twig_title_string_filter', ['needs_environment' => true]), + new TwigFilter('capitalize', 'twig_capitalize_string_filter', ['needs_environment' => true]), + new TwigFilter('upper', 'strtoupper'), + new TwigFilter('lower', 'strtolower'), + new TwigFilter('striptags', 'strip_tags'), + new TwigFilter('trim', 'twig_trim_filter'), + new TwigFilter('nl2br', 'nl2br', ['pre_escape' => 'html', 'is_safe' => ['html']]), + new TwigFilter('spaceless', 'twig_spaceless', ['is_safe' => ['html']]), + + // array helpers + new TwigFilter('join', 'twig_join_filter'), + new TwigFilter('split', 'twig_split_filter', ['needs_environment' => true]), + new TwigFilter('sort', 'twig_sort_filter'), + new TwigFilter('merge', 'twig_array_merge'), + new TwigFilter('batch', 'twig_array_batch'), + + // string/array filters + new TwigFilter('reverse', 'twig_reverse_filter', ['needs_environment' => true]), + new TwigFilter('length', 'twig_length_filter', ['needs_environment' => true]), + new TwigFilter('slice', 'twig_slice', ['needs_environment' => true]), + new TwigFilter('first', 'twig_first', ['needs_environment' => true]), + new TwigFilter('last', 'twig_last', ['needs_environment' => true]), + + // iteration and runtime + new TwigFilter('default', '_twig_default_filter', ['node_class' => '\Twig\Node\Expression\Filter\DefaultFilter']), + new TwigFilter('keys', 'twig_get_array_keys_filter'), + + // escaping + new TwigFilter('escape', 'twig_escape_filter', ['needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe']), + new TwigFilter('e', 'twig_escape_filter', ['needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe']), + ]; + + if (\function_exists('mb_get_info')) { + $filters[] = new TwigFilter('upper', 'twig_upper_filter', ['needs_environment' => true]); + $filters[] = new TwigFilter('lower', 'twig_lower_filter', ['needs_environment' => true]); + } + + return $filters; + } + + public function getFunctions() + { + return [ + new TwigFunction('max', 'max'), + new TwigFunction('min', 'min'), + new TwigFunction('range', 'range'), + new TwigFunction('constant', 'twig_constant'), + new TwigFunction('cycle', 'twig_cycle'), + new TwigFunction('random', 'twig_random', ['needs_environment' => true]), + new TwigFunction('date', 'twig_date_converter', ['needs_environment' => true]), + new TwigFunction('include', 'twig_include', ['needs_environment' => true, 'needs_context' => true, 'is_safe' => ['all']]), + new TwigFunction('source', 'twig_source', ['needs_environment' => true, 'is_safe' => ['all']]), + ]; + } + + public function getTests() + { + return [ + new TwigTest('even', null, ['node_class' => '\Twig\Node\Expression\Test\EvenTest']), + new TwigTest('odd', null, ['node_class' => '\Twig\Node\Expression\Test\OddTest']), + new TwigTest('defined', null, ['node_class' => '\Twig\Node\Expression\Test\DefinedTest']), + new TwigTest('sameas', null, ['node_class' => '\Twig\Node\Expression\Test\SameasTest', 'deprecated' => '1.21', 'alternative' => 'same as']), + new TwigTest('same as', null, ['node_class' => '\Twig\Node\Expression\Test\SameasTest']), + new TwigTest('none', null, ['node_class' => '\Twig\Node\Expression\Test\NullTest']), + new TwigTest('null', null, ['node_class' => '\Twig\Node\Expression\Test\NullTest']), + new TwigTest('divisibleby', null, ['node_class' => '\Twig\Node\Expression\Test\DivisiblebyTest', 'deprecated' => '1.21', 'alternative' => 'divisible by']), + new TwigTest('divisible by', null, ['node_class' => '\Twig\Node\Expression\Test\DivisiblebyTest']), + new TwigTest('constant', null, ['node_class' => '\Twig\Node\Expression\Test\ConstantTest']), + new TwigTest('empty', 'twig_test_empty'), + new TwigTest('iterable', 'twig_test_iterable'), + ]; + } + + public function getOperators() + { + return [ + [ + 'not' => ['precedence' => 50, 'class' => '\Twig\Node\Expression\Unary\NotUnary'], + '-' => ['precedence' => 500, 'class' => '\Twig\Node\Expression\Unary\NegUnary'], + '+' => ['precedence' => 500, 'class' => '\Twig\Node\Expression\Unary\PosUnary'], + ], + [ + 'or' => ['precedence' => 10, 'class' => '\Twig\Node\Expression\Binary\OrBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'and' => ['precedence' => 15, 'class' => '\Twig\Node\Expression\Binary\AndBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'b-or' => ['precedence' => 16, 'class' => '\Twig\Node\Expression\Binary\BitwiseOrBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'b-xor' => ['precedence' => 17, 'class' => '\Twig\Node\Expression\Binary\BitwiseXorBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'b-and' => ['precedence' => 18, 'class' => '\Twig\Node\Expression\Binary\BitwiseAndBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '==' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\EqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '!=' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotEqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '<' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '>' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '>=' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterEqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '<=' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessEqualBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'not in' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotInBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'in' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\InBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'matches' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\MatchesBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'starts with' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\StartsWithBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'ends with' => ['precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\EndsWithBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '..' => ['precedence' => 25, 'class' => '\Twig\Node\Expression\Binary\RangeBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '+' => ['precedence' => 30, 'class' => '\Twig\Node\Expression\Binary\AddBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '-' => ['precedence' => 30, 'class' => '\Twig\Node\Expression\Binary\SubBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '~' => ['precedence' => 40, 'class' => '\Twig\Node\Expression\Binary\ConcatBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '*' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\MulBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '/' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\DivBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '//' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\FloorDivBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + '%' => ['precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\ModBinary', 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'is' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'is not' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '**' => ['precedence' => 200, 'class' => '\Twig\Node\Expression\Binary\PowerBinary', 'associativity' => ExpressionParser::OPERATOR_RIGHT], + '??' => ['precedence' => 300, 'class' => '\Twig\Node\Expression\NullCoalesceExpression', 'associativity' => ExpressionParser::OPERATOR_RIGHT], + ], + ]; + } + + public function getName() { + return 'core'; + } +} + +class_alias('Twig\Extension\CoreExtension', 'Twig_Extension_Core'); +} + +namespace { +use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Loader\SourceContextLoaderInterface; +use Twig\Markup; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Node; + +/** + * Cycles over a value. + * + * @param \ArrayAccess|array $values + * @param int $position The cycle position + * + * @return string The next value in the cycle + */ +function twig_cycle($values, $position) +{ + if (!\is_array($values) && !$values instanceof \ArrayAccess) { + return $values; + } + + return $values[$position % \count($values)]; +} + +/** + * Returns a random value depending on the supplied parameter type: + * - a random item from a \Traversable or array + * - a random character from a string + * - a random integer between 0 and the integer parameter. + * + * @param \Traversable|array|int|float|string $values The values to pick a random item from + * @param int|null $max Maximum value used when $values is an int + * + * @throws RuntimeError when $values is an empty array (does not apply to an empty string which is returned as is) + * + * @return mixed A random value from the given sequence + */ +function twig_random(Environment $env, $values = null, $max = null) +{ + if (null === $values) { + return null === $max ? mt_rand() : mt_rand(0, $max); + } + + if (\is_int($values) || \is_float($values)) { + if (null === $max) { + if ($values < 0) { + $max = 0; + $min = $values; + } else { + $max = $values; + $min = 0; + } + } else { + $min = $values; + $max = $max; + } + + return mt_rand($min, $max); + } + + if ($values instanceof \Traversable) { + $values = iterator_to_array($values); + } elseif (\is_string($values)) { + if ('' === $values) { + return ''; + } + if (null !== $charset = $env->getCharset()) { + if ('UTF-8' !== $charset) { + $values = twig_convert_encoding($values, 'UTF-8', $charset); + } + + // unicode version of str_split() + // split at all positions, but not after the start and not before the end + $values = preg_split('/(?<!^)(?!$)/u', $values); + + if ('UTF-8' !== $charset) { + foreach ($values as $i => $value) { + $values[$i] = twig_convert_encoding($value, $charset, 'UTF-8'); + } + } + } else { + return $values[mt_rand(0, \strlen($values) - 1)]; + } + } + + if (!\is_array($values)) { + return $values; + } + + if (0 === \count($values)) { + throw new RuntimeError('The random function cannot pick from an empty array.'); + } + + return $values[array_rand($values, 1)]; +} + +/** + * Converts a date to the given format. + * + * {{ post.published_at|date("m/d/Y") }} + * + * @param \DateTime|\DateTimeInterface|\DateInterval|string $date A date + * @param string|null $format The target format, null to use the default + * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged + * + * @return string The formatted date + */ +function twig_date_format_filter(Environment $env, $date, $format = null, $timezone = null) +{ + if (null === $format) { + $formats = $env->getExtension('\Twig\Extension\CoreExtension')->getDateFormat(); + $format = $date instanceof \DateInterval ? $formats[1] : $formats[0]; + } + + if ($date instanceof \DateInterval) { + return $date->format($format); + } + + return twig_date_converter($env, $date, $timezone)->format($format); +} + +/** + * Returns a new date object modified. + * + * {{ post.published_at|date_modify("-1day")|date("m/d/Y") }} + * + * @param \DateTime|string $date A date + * @param string $modifier A modifier string + * + * @return \DateTime + */ +function twig_date_modify_filter(Environment $env, $date, $modifier) +{ + $date = twig_date_converter($env, $date, false); + $resultDate = $date->modify($modifier); + + // This is a hack to ensure PHP 5.2 support and support for \DateTimeImmutable + // \DateTime::modify does not return the modified \DateTime object < 5.3.0 + // and \DateTimeImmutable does not modify $date. + return null === $resultDate ? $date : $resultDate; +} + +/** + * Converts an input to a \DateTime instance. + * + * {% if date(user.created_at) < date('+2days') %} + * {# do something #} + * {% endif %} + * + * @param \DateTime|\DateTimeInterface|string|null $date A date + * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged + * + * @return \DateTime + */ +function twig_date_converter(Environment $env, $date = null, $timezone = null) +{ + // determine the timezone + if (false !== $timezone) { + if (null === $timezone) { + $timezone = $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone(); + } elseif (!$timezone instanceof \DateTimeZone) { + $timezone = new \DateTimeZone($timezone); + } + } + + // immutable dates + if ($date instanceof \DateTimeImmutable) { + return false !== $timezone ? $date->setTimezone($timezone) : $date; + } + + if ($date instanceof \DateTime || $date instanceof \DateTimeInterface) { + $date = clone $date; + if (false !== $timezone) { + $date->setTimezone($timezone); + } + + return $date; + } + + if (null === $date || 'now' === $date) { + return new \DateTime($date, false !== $timezone ? $timezone : $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone()); + } + + $asString = (string) $date; + if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) { + $date = new \DateTime('@'.$date); + } else { + $date = new \DateTime($date, $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone()); + } + + if (false !== $timezone) { + $date->setTimezone($timezone); + } + + return $date; +} + +/** + * Replaces strings within a string. + * + * @param string $str String to replace in + * @param array|\Traversable $from Replace values + * @param string|null $to Replace to, deprecated (@see https://secure.php.net/manual/en/function.strtr.php) + * + * @return string + */ +function twig_replace_filter($str, $from, $to = null) +{ + if ($from instanceof \Traversable) { + $from = iterator_to_array($from); + } elseif (\is_string($from) && \is_string($to)) { + @trigger_error('Using "replace" with character by character replacement is deprecated since version 1.22 and will be removed in Twig 2.0', E_USER_DEPRECATED); + + return strtr($str, $from, $to); + } elseif (!\is_array($from)) { + throw new RuntimeError(sprintf('The "replace" filter expects an array or "Traversable" as replace values, got "%s".', \is_object($from) ? \get_class($from) : \gettype($from))); + } + + return strtr($str, $from); +} + +/** + * Rounds a number. + * + * @param int|float $value The value to round + * @param int|float $precision The rounding precision + * @param string $method The method to use for rounding + * + * @return int|float The rounded number + */ +function twig_round($value, $precision = 0, $method = 'common') +{ + if ('common' == $method) { + return round($value, $precision); + } + + if ('ceil' != $method && 'floor' != $method) { + throw new RuntimeError('The round filter only supports the "common", "ceil", and "floor" methods.'); + } + + return $method($value * pow(10, $precision)) / pow(10, $precision); +} + +/** + * Number format filter. + * + * All of the formatting options can be left null, in that case the defaults will + * be used. Supplying any of the parameters will override the defaults set in the + * environment object. + * + * @param mixed $number A float/int/string of the number to format + * @param int $decimal the number of decimal points to display + * @param string $decimalPoint the character(s) to use for the decimal point + * @param string $thousandSep the character(s) to use for the thousands separator + * + * @return string The formatted number + */ +function twig_number_format_filter(Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) +{ + $defaults = $env->getExtension('\Twig\Extension\CoreExtension')->getNumberFormat(); + if (null === $decimal) { + $decimal = $defaults[0]; + } + + if (null === $decimalPoint) { + $decimalPoint = $defaults[1]; + } + + if (null === $thousandSep) { + $thousandSep = $defaults[2]; + } + + return number_format((float) $number, $decimal, $decimalPoint, $thousandSep); +} + +/** + * URL encodes (RFC 3986) a string as a path segment or an array as a query string. + * + * @param string|array $url A URL or an array of query parameters + * + * @return string The URL encoded value + */ +function twig_urlencode_filter($url) +{ + if (\is_array($url)) { + if (\defined('PHP_QUERY_RFC3986')) { + return http_build_query($url, '', '&', PHP_QUERY_RFC3986); + } + + return http_build_query($url, '', '&'); + } + + return rawurlencode($url); +} + +/** + * JSON encodes a variable. + * + * @param mixed $value the value to encode + * @param int $options Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT + * + * @return mixed The JSON encoded value + */ +function twig_jsonencode_filter($value, $options = 0) +{ + if ($value instanceof Markup) { + $value = (string) $value; + } elseif (\is_array($value)) { + array_walk_recursive($value, '_twig_markup2string'); + } + + return json_encode($value, $options); +} + +function _twig_markup2string(&$value) +{ + if ($value instanceof Markup) { + $value = (string) $value; + } +} + +/** + * Merges an array with another one. + * + * {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} + * + * {% set items = items|merge({ 'peugeot': 'car' }) %} + * + * {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #} + * + * @param array|\Traversable $arr1 An array + * @param array|\Traversable $arr2 An array + * + * @return array The merged array + */ +function twig_array_merge($arr1, $arr2) +{ + if ($arr1 instanceof \Traversable) { + $arr1 = iterator_to_array($arr1); + } elseif (!\is_array($arr1)) { + throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($arr1))); + } + + if ($arr2 instanceof \Traversable) { + $arr2 = iterator_to_array($arr2); + } elseif (!\is_array($arr2)) { + throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', \gettype($arr2))); + } + + return array_merge($arr1, $arr2); +} + +/** + * Slices a variable. + * + * @param mixed $item A variable + * @param int $start Start of the slice + * @param int $length Size of the slice + * @param bool $preserveKeys Whether to preserve key or not (when the input is an array) + * + * @return mixed The sliced variable + */ +function twig_slice(Environment $env, $item, $start, $length = null, $preserveKeys = false) +{ + if ($item instanceof \Traversable) { + while ($item instanceof \IteratorAggregate) { + $item = $item->getIterator(); + } + + if ($start >= 0 && $length >= 0 && $item instanceof \Iterator) { + try { + return iterator_to_array(new \LimitIterator($item, $start, null === $length ? -1 : $length), $preserveKeys); + } catch (\OutOfBoundsException $exception) { + return []; + } + } + + $item = iterator_to_array($item, $preserveKeys); + } + + if (\is_array($item)) { + return \array_slice($item, $start, $length, $preserveKeys); + } + + $item = (string) $item; + + if (\function_exists('mb_get_info') && null !== $charset = $env->getCharset()) { + return (string) mb_substr($item, $start, null === $length ? mb_strlen($item, $charset) - $start : $length, $charset); + } + + return (string) (null === $length ? substr($item, $start) : substr($item, $start, $length)); +} + +/** + * Returns the first element of the item. + * + * @param mixed $item A variable + * + * @return mixed The first element of the item + */ +function twig_first(Environment $env, $item) +{ + $elements = twig_slice($env, $item, 0, 1, false); + + return \is_string($elements) ? $elements : current($elements); +} + +/** + * Returns the last element of the item. + * + * @param mixed $item A variable + * + * @return mixed The last element of the item + */ +function twig_last(Environment $env, $item) +{ + $elements = twig_slice($env, $item, -1, 1, false); + + return \is_string($elements) ? $elements : current($elements); +} + +/** + * Joins the values to a string. + * + * The separators between elements are empty strings per default, you can define them with the optional parameters. + * + * {{ [1, 2, 3]|join(', ', ' and ') }} + * {# returns 1, 2 and 3 #} + * + * {{ [1, 2, 3]|join('|') }} + * {# returns 1|2|3 #} + * + * {{ [1, 2, 3]|join }} + * {# returns 123 #} + * + * @param array $value An array + * @param string $glue The separator + * @param string|null $and The separator for the last pair + * + * @return string The concatenated string + */ +function twig_join_filter($value, $glue = '', $and = null) +{ + if ($value instanceof \Traversable) { + $value = iterator_to_array($value, false); + } else { + $value = (array) $value; + } + + if (0 === \count($value)) { + return ''; + } + + if (null === $and || $and === $glue) { + return implode($glue, $value); + } + + $v = array_values($value); + if (1 === \count($v)) { + return $v[0]; + } + + return implode($glue, \array_slice($value, 0, -1)).$and.$v[\count($v) - 1]; +} + +/** + * Splits the string into an array. + * + * {{ "one,two,three"|split(',') }} + * {# returns [one, two, three] #} + * + * {{ "one,two,three,four,five"|split(',', 3) }} + * {# returns [one, two, "three,four,five"] #} + * + * {{ "123"|split('') }} + * {# returns [1, 2, 3] #} + * + * {{ "aabbcc"|split('', 2) }} + * {# returns [aa, bb, cc] #} + * + * @param string $value A string + * @param string $delimiter The delimiter + * @param int $limit The limit + * + * @return array The split string as an array + */ +function twig_split_filter(Environment $env, $value, $delimiter, $limit = null) +{ + if (!empty($delimiter)) { + return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); + } + + if (!\function_exists('mb_get_info') || null === $charset = $env->getCharset()) { + return str_split($value, null === $limit ? 1 : $limit); + } + + if ($limit <= 1) { + return preg_split('/(?<!^)(?!$)/u', $value); + } + + $length = mb_strlen($value, $charset); + if ($length < $limit) { + return [$value]; + } + + $r = []; + for ($i = 0; $i < $length; $i += $limit) { + $r[] = mb_substr($value, $i, $limit, $charset); + } + + return $r; +} + +// The '_default' filter is used internally to avoid using the ternary operator +// which costs a lot for big contexts (before PHP 5.4). So, on average, +// a function call is cheaper. +/** + * @internal + */ +function _twig_default_filter($value, $default = '') +{ + if (twig_test_empty($value)) { + return $default; + } + + return $value; +} + +/** + * Returns the keys for the given array. + * + * It is useful when you want to iterate over the keys of an array: + * + * {% for key in array|keys %} + * {# ... #} + * {% endfor %} + * + * @param array $array An array + * + * @return array The keys + */ +function twig_get_array_keys_filter($array) +{ + if ($array instanceof \Traversable) { + while ($array instanceof \IteratorAggregate) { + $array = $array->getIterator(); + } + + if ($array instanceof \Iterator) { + $keys = []; + $array->rewind(); + while ($array->valid()) { + $keys[] = $array->key(); + $array->next(); + } + + return $keys; + } + + $keys = []; + foreach ($array as $key => $item) { + $keys[] = $key; + } + + return $keys; + } + + if (!\is_array($array)) { + return []; + } + + return array_keys($array); +} + +/** + * Reverses a variable. + * + * @param array|\Traversable|string $item An array, a \Traversable instance, or a string + * @param bool $preserveKeys Whether to preserve key or not + * + * @return mixed The reversed input + */ +function twig_reverse_filter(Environment $env, $item, $preserveKeys = false) +{ + if ($item instanceof \Traversable) { + return array_reverse(iterator_to_array($item), $preserveKeys); + } + + if (\is_array($item)) { + return array_reverse($item, $preserveKeys); } + + if (null !== $charset = $env->getCharset()) { + $string = (string) $item; + + if ('UTF-8' !== $charset) { + $item = twig_convert_encoding($string, 'UTF-8', $charset); + } + + preg_match_all('/./us', $item, $matches); + + $string = implode('', array_reverse($matches[0])); + + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + } + + return strrev((string) $item); +} + +/** + * Sorts an array. + * + * @param array|\Traversable $array + * + * @return array + */ +function twig_sort_filter($array) +{ + if ($array instanceof \Traversable) { + $array = iterator_to_array($array); + } elseif (!\is_array($array)) { + throw new RuntimeError(sprintf('The sort filter only works with arrays or "Traversable", got "%s".', \gettype($array))); + } + + asort($array); + + return $array; +} + +/** + * @internal + */ +function twig_in_filter($value, $compare) +{ + 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))) { + return '' === $value || false !== strpos($compare, (string) $value); + } elseif ($compare instanceof \Traversable) { + if (\is_object($value) || \is_resource($value)) { + foreach ($compare as $item) { + if ($item === $value) { + return true; + } + } + } else { + foreach ($compare as $item) { + if ($item == $value) { + return true; + } + } + } + + return false; + } + + return false; +} + +/** + * Returns a trimmed string. + * + * @return string + * + * @throws RuntimeError When an invalid trimming side is used (not a string or not 'left', 'right', or 'both') + */ +function twig_trim_filter($string, $characterMask = null, $side = 'both') +{ + if (null === $characterMask) { + $characterMask = " \t\n\r\0\x0B"; + } + + switch ($side) { + case 'both': + return trim($string, $characterMask); + case 'left': + return ltrim($string, $characterMask); + case 'right': + return rtrim($string, $characterMask); + default: + throw new RuntimeError('Trimming side must be "left", "right" or "both".'); + } +} + +/** + * Removes whitespaces between HTML tags. + * + * @return string + */ +function twig_spaceless($content) +{ + return preg_replace('/>\s+</', '><', $content); +} + +/** + * Escapes a string. + * + * @param mixed $string The value to be escaped + * @param string $strategy The escaping strategy + * @param string $charset The charset + * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) + * + * @return string + */ +function twig_escape_filter(Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false) +{ + if ($autoescape && $string instanceof Markup) { + return $string; + } + + if (!\is_string($string)) { + if (\is_object($string) && method_exists($string, '__toString')) { + $string = (string) $string; + } elseif (\in_array($strategy, ['html', 'js', 'css', 'html_attr', 'url'])) { + return $string; + } + } + + if ('' === $string) { + return ''; + } + + if (null === $charset) { + $charset = $env->getCharset(); + } + + switch ($strategy) { + case 'html': + // see https://secure.php.net/htmlspecialchars + + // Using a static variable to avoid initializing the array + // each time the function is called. Moving the declaration on the + // top of the function slow downs other escaping strategies. + static $htmlspecialcharsCharsets = [ + 'ISO-8859-1' => true, 'ISO8859-1' => true, + 'ISO-8859-15' => true, 'ISO8859-15' => true, + 'utf-8' => true, 'UTF-8' => true, + 'CP866' => true, 'IBM866' => true, '866' => true, + 'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true, + '1251' => true, + 'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true, + 'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true, + 'BIG5' => true, '950' => true, + 'GB2312' => true, '936' => true, + 'BIG5-HKSCS' => true, + 'SHIFT_JIS' => true, 'SJIS' => true, '932' => true, + 'EUC-JP' => true, 'EUCJP' => true, + 'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true, + ]; + + if (isset($htmlspecialcharsCharsets[$charset])) { + return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); + } + + if (isset($htmlspecialcharsCharsets[strtoupper($charset)])) { + // cache the lowercase variant for future iterations + $htmlspecialcharsCharsets[$charset] = true; + + return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); + } + + $string = twig_convert_encoding($string, 'UTF-8', $charset); + $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); + + return twig_convert_encoding($string, $charset, 'UTF-8'); + + case 'js': + // escape all non-alphanumeric characters + // into their \x or \uHHHH representations + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (!preg_match('//u', $string)) { + throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', '_twig_escape_js_callback', $string); + + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + + case 'css': + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (!preg_match('//u', $string)) { + throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', '_twig_escape_css_callback', $string); + + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + + case 'html_attr': + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (!preg_match('//u', $string)) { + throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', '_twig_escape_html_attr_callback', $string); + + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + + case 'url': + return rawurlencode($string); + + default: + static $escapers; + + if (null === $escapers) { + $escapers = $env->getExtension('\Twig\Extension\CoreExtension')->getEscapers(); + } + + if (isset($escapers[$strategy])) { + return \call_user_func($escapers[$strategy], $env, $string, $charset); + } + + $validStrategies = implode(', ', array_merge(['html', 'js', 'url', 'css', 'html_attr'], array_keys($escapers))); + + throw new RuntimeError(sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies)); + } +} + +/** + * @internal + */ +function twig_escape_filter_is_safe(Node $filterArgs) +{ + foreach ($filterArgs as $arg) { + if ($arg instanceof ConstantExpression) { + return [$arg->getAttribute('value')]; + } + + return []; + } + + return ['html']; +} + +if (\function_exists('mb_convert_encoding')) { + function twig_convert_encoding($string, $to, $from) + { + return mb_convert_encoding($string, $to, $from); + } +} elseif (\function_exists('iconv')) { + function twig_convert_encoding($string, $to, $from) + { + return iconv($from, $to, $string); + } +} else { + function twig_convert_encoding($string, $to, $from) + { + throw new RuntimeError('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).'); + } +} + +if (\function_exists('mb_ord')) { + function twig_ord($string) + { + return mb_ord($string, 'UTF-8'); + } +} else { + function twig_ord($string) + { + $code = ($string = unpack('C*', substr($string, 0, 4))) ? $string[1] : 0; + if (0xF0 <= $code) { + return (($code - 0xF0) << 18) + (($string[2] - 0x80) << 12) + (($string[3] - 0x80) << 6) + $string[4] - 0x80; + } + if (0xE0 <= $code) { + return (($code - 0xE0) << 12) + (($string[2] - 0x80) << 6) + $string[3] - 0x80; + } + if (0xC0 <= $code) { + return (($code - 0xC0) << 6) + $string[2] - 0x80; + } + + return $code; + } +} + +function _twig_escape_js_callback($matches) +{ + $char = $matches[0]; + + /* + * A few characters have short escape sequences in JSON and JavaScript. + * Escape sequences supported only by JavaScript, not JSON, are ommitted. + * \" is also supported but omitted, because the resulting string is not HTML safe. + */ + static $shortMap = [ + '\\' => '\\\\', + '/' => '\\/', + "\x08" => '\b', + "\x0C" => '\f', + "\x0A" => '\n', + "\x0D" => '\r', + "\x09" => '\t', + ]; + + if (isset($shortMap[$char])) { + return $shortMap[$char]; + } + + // \uHHHH + $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); + $char = strtoupper(bin2hex($char)); + + if (4 >= \strlen($char)) { + return sprintf('\u%04s', $char); + } + + return sprintf('\u%04s\u%04s', substr($char, 0, -4), substr($char, -4)); +} + +function _twig_escape_css_callback($matches) +{ + $char = $matches[0]; + + return sprintf('\\%X ', 1 === \strlen($char) ? \ord($char) : twig_ord($char)); +} + +/** + * This function is adapted from code coming from Zend Framework. + * + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://framework.zend.com/license/new-bsd New BSD License + */ +function _twig_escape_html_attr_callback($matches) +{ + $chr = $matches[0]; + $ord = \ord($chr); + + /* + * The following replaces characters undefined in HTML with the + * hex entity for the Unicode replacement character. + */ + if (($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr) || ($ord >= 0x7f && $ord <= 0x9f)) { + return '�'; + } + + /* + * Check if the current character to escape has a name entity we should + * replace it with while grabbing the hex value of the character. + */ + if (1 == \strlen($chr)) { + /* + * While HTML supports far more named entities, the lowest common denominator + * has become HTML5's XML Serialisation which is restricted to the those named + * entities that XML supports. Using HTML entities would result in this error: + * XML Parsing Error: undefined entity + */ + static $entityMap = [ + 34 => '"', /* quotation mark */ + 38 => '&', /* ampersand */ + 60 => '<', /* less-than sign */ + 62 => '>', /* greater-than sign */ + ]; + + if (isset($entityMap[$ord])) { + return $entityMap[$ord]; + } + + return sprintf('&#x%02X;', $ord); + } + + /* + * Per OWASP recommendations, we'll use hex entities for any other + * characters where a named entity does not exist. + */ + return sprintf('&#x%04X;', twig_ord($chr)); +} + +// add multibyte extensions if possible +if (\function_exists('mb_get_info')) { + /** + * Returns the length of a variable. + * + * @param mixed $thing A variable + * + * @return int The length of the value + */ + function twig_length_filter(Environment $env, $thing) + { + if (null === $thing) { + return 0; + } + + if (is_scalar($thing)) { + return mb_strlen($thing, $env->getCharset()); + } + + if ($thing instanceof \SimpleXMLElement) { + return \count($thing); + } + + if (\is_object($thing) && method_exists($thing, '__toString') && !$thing instanceof \Countable) { + return mb_strlen((string) $thing, $env->getCharset()); + } + + if ($thing instanceof \Countable || \is_array($thing)) { + return \count($thing); + } + + if ($thing instanceof \IteratorAggregate) { + return iterator_count($thing); + } + + return 1; + } + + /** + * Converts a string to uppercase. + * + * @param string $string A string + * + * @return string The uppercased string + */ + function twig_upper_filter(Environment $env, $string) + { + if (null !== $charset = $env->getCharset()) { + return mb_strtoupper($string, $charset); + } + + return strtoupper($string); + } + + /** + * Converts a string to lowercase. + * + * @param string $string A string + * + * @return string The lowercased string + */ + function twig_lower_filter(Environment $env, $string) + { + if (null !== $charset = $env->getCharset()) { + return mb_strtolower($string, $charset); + } + + return strtolower($string); + } + + /** + * Returns a titlecased string. + * + * @param string $string A string + * + * @return string The titlecased string + */ + function twig_title_string_filter(Environment $env, $string) + { + if (null !== $charset = $env->getCharset()) { + return mb_convert_case($string, MB_CASE_TITLE, $charset); + } + + return ucwords(strtolower($string)); + } + + /** + * Returns a capitalized string. + * + * @param string $string A string + * + * @return string The capitalized string + */ + function twig_capitalize_string_filter(Environment $env, $string) + { + if (null !== $charset = $env->getCharset()) { + return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset).mb_strtolower(mb_substr($string, 1, mb_strlen($string, $charset), $charset), $charset); + } + + return ucfirst(strtolower($string)); + } +} +// and byte fallback +else { + /** + * Returns the length of a variable. + * + * @param mixed $thing A variable + * + * @return int The length of the value + */ + function twig_length_filter(Environment $env, $thing) + { + if (null === $thing) { + return 0; + } + + if (is_scalar($thing)) { + return \strlen($thing); + } + + if ($thing instanceof \SimpleXMLElement) { + return \count($thing); + } + + if (\is_object($thing) && method_exists($thing, '__toString') && !$thing instanceof \Countable) { + return \strlen((string) $thing); + } + + if ($thing instanceof \Countable || \is_array($thing)) { + return \count($thing); + } + + if ($thing instanceof \IteratorAggregate) { + return iterator_count($thing); + } + + return 1; + } + + /** + * Returns a titlecased string. + * + * @param string $string A string + * + * @return string The titlecased string + */ + function twig_title_string_filter(Environment $env, $string) + { + return ucwords(strtolower($string)); + } + + /** + * Returns a capitalized string. + * + * @param string $string A string + * + * @return string The capitalized string + */ + function twig_capitalize_string_filter(Environment $env, $string) + { + return ucfirst(strtolower($string)); + } +} + +/** + * @internal + */ +function twig_ensure_traversable($seq) +{ + if ($seq instanceof \Traversable || \is_array($seq)) { + return $seq; + } + + return []; +} + +/** + * Checks if a variable is empty. + * + * {# evaluates to true if the foo variable is null, false, or the empty string #} + * {% if foo is empty %} + * {# ... #} + * {% endif %} + * + * @param mixed $value A variable + * + * @return bool true if the value is empty, false otherwise + */ +function twig_test_empty($value) +{ + if ($value instanceof \Countable) { + return 0 == \count($value); + } + + if (\is_object($value) && method_exists($value, '__toString')) { + return '' === (string) $value; + } + + return '' === $value || false === $value || null === $value || [] === $value; +} + +/** + * Checks if a variable is traversable. + * + * {# evaluates to true if the foo variable is an array or a traversable object #} + * {% if foo is iterable %} + * {# ... #} + * {% endif %} + * + * @param mixed $value A variable + * + * @return bool true if the value is traversable + */ +function twig_test_iterable($value) +{ + return $value instanceof \Traversable || \is_array($value); +} + +/** + * Renders a template. + * + * @param array $context + * @param string|array $template The template to render or an array of templates to try consecutively + * @param array $variables The variables to pass to the template + * @param bool $withContext + * @param bool $ignoreMissing Whether to ignore missing templates or not + * @param bool $sandboxed Whether to sandbox the template or not + * + * @return string The rendered template + */ +function twig_include(Environment $env, $context, $template, $variables = [], $withContext = true, $ignoreMissing = false, $sandboxed = false) +{ + $alreadySandboxed = false; + $sandbox = null; + if ($withContext) { + $variables = array_merge($context, $variables); + } + + if ($isSandboxed = $sandboxed && $env->hasExtension('\Twig\Extension\SandboxExtension')) { + $sandbox = $env->getExtension('\Twig\Extension\SandboxExtension'); + if (!$alreadySandboxed = $sandbox->isSandboxed()) { + $sandbox->enableSandbox(); + } + } + + $result = ''; + try { + $result = $env->resolveTemplate($template)->render($variables); + } catch (LoaderError $e) { + if (!$ignoreMissing) { + if ($isSandboxed && !$alreadySandboxed) { + $sandbox->disableSandbox(); + } + + throw $e; + } + } catch (\Throwable $e) { + if ($isSandboxed && !$alreadySandboxed) { + $sandbox->disableSandbox(); + } + + throw $e; + } catch (\Exception $e) { + if ($isSandboxed && !$alreadySandboxed) { + $sandbox->disableSandbox(); + } + + throw $e; + } + + if ($isSandboxed && !$alreadySandboxed) { + $sandbox->disableSandbox(); + } + + return $result; +} + +/** + * Returns a template content without rendering it. + * + * @param string $name The template name + * @param bool $ignoreMissing Whether to ignore missing templates or not + * + * @return string The template source + */ +function twig_source(Environment $env, $name, $ignoreMissing = false) +{ + $loader = $env->getLoader(); + try { + if (!$loader instanceof SourceContextLoaderInterface) { + return $loader->getSource($name); + } else { + return $loader->getSourceContext($name)->getCode(); + } + } catch (LoaderError $e) { + if (!$ignoreMissing) { + throw $e; + } + } +} + +/** + * Provides the ability to get constants from instances as well as class/global constants. + * + * @param string $constant The name of the constant + * @param object|null $object The object to get the constant from + * + * @return string + */ +function twig_constant($constant, $object = null) +{ + if (null !== $object) { + $constant = \get_class($object).'::'.$constant; + } + + return \constant($constant); +} + +/** + * Checks if a constant exists. + * + * @param string $constant The name of the constant + * @param object|null $object The object to get the constant from + * + * @return bool + */ +function twig_constant_is_defined($constant, $object = null) +{ + if (null !== $object) { + $constant = \get_class($object).'::'.$constant; + } + + return \defined($constant); +} + +/** + * Batches item. + * + * @param array $items An array of items + * @param int $size The size of the batch + * @param mixed $fill A value used to fill missing items + * + * @return array + */ +function twig_array_batch($items, $size, $fill = null, $preserveKeys = true) +{ + if ($items instanceof \Traversable) { + $items = iterator_to_array($items, $preserveKeys); + } + + $size = ceil($size); + + $result = array_chunk($items, $size, $preserveKeys); + + if (null !== $fill && $result) { + $last = \count($result) - 1; + if ($fillCount = $size - \count($result[$last])) { + for ($i = 0; $i < $fillCount; $i++) { + $result[$last][] = $fill; + } + } + } + + return $result; +} } diff --git a/vendor/twig/twig/src/Extension/DebugExtension.php b/vendor/twig/twig/src/Extension/DebugExtension.php index d196850c2ff680e131a65ea8a4086417f0eb658a..85ced738144b6f1a0f0843e2ddf6fb2eb7089b52 100644 --- a/vendor/twig/twig/src/Extension/DebugExtension.php +++ b/vendor/twig/twig/src/Extension/DebugExtension.php @@ -1,11 +1,76 @@ <?php -namespace Twig\Extension; +/* + * 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. + */ -class_exists('Twig_Extension_Debug'); +namespace Twig\Extension { +use Twig\TwigFunction; -if (\false) { - class DebugExtension extends \Twig_Extension_Debug +/** + * @final + */ +class DebugExtension extends AbstractExtension +{ + public function getFunctions() { + // dump is safe if var_dump is overridden by xdebug + $isDumpOutputHtmlSafe = \extension_loaded('xdebug') + // false means that it was not set (and the default is on) or it explicitly enabled + && (false === ini_get('xdebug.overload_var_dump') || ini_get('xdebug.overload_var_dump')) + // false means that it was not set (and the default is on) or it explicitly enabled + // xdebug.overload_var_dump produces HTML only when html_errors is also enabled + && (false === ini_get('html_errors') || ini_get('html_errors')) + || 'cli' === \PHP_SAPI + ; + + return [ + new TwigFunction('dump', 'twig_var_dump', ['is_safe' => $isDumpOutputHtmlSafe ? ['html'] : [], 'needs_context' => true, 'needs_environment' => true]), + ]; + } + + public function getName() + { + return 'debug'; + } +} + +class_alias('Twig\Extension\DebugExtension', 'Twig_Extension_Debug'); +} + +namespace { +use Twig\Environment; +use Twig\Template; + +function twig_var_dump(Environment $env, $context) +{ + if (!$env->isDebug()) { + return; + } + + ob_start(); + + $count = \func_num_args(); + if (2 === $count) { + $vars = []; + foreach ($context as $key => $value) { + if (!$value instanceof Template) { + $vars[$key] = $value; + } + } + + var_dump($vars); + } else { + for ($i = 2; $i < $count; ++$i) { + var_dump(func_get_arg($i)); + } } + + return ob_get_clean(); +} } diff --git a/vendor/twig/twig/src/Extension/EscaperExtension.php b/vendor/twig/twig/src/Extension/EscaperExtension.php index c6d60b5e52d69e14b4dfe5551c1946608f21f739..fc7f6dfeeadee5a7e350acf1be5037239b727ea9 100644 --- a/vendor/twig/twig/src/Extension/EscaperExtension.php +++ b/vendor/twig/twig/src/Extension/EscaperExtension.php @@ -1,11 +1,120 @@ <?php -namespace Twig\Extension; +/* + * 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. + */ -class_exists('Twig_Extension_Escaper'); +namespace Twig\Extension { +use Twig\NodeVisitor\EscaperNodeVisitor; +use Twig\TokenParser\AutoEscapeTokenParser; +use Twig\TwigFilter; -if (\false) { - class EscaperExtension extends \Twig_Extension_Escaper +/** + * @final + */ +class EscaperExtension extends AbstractExtension +{ + protected $defaultStrategy; + + /** + * @param string|false|callable $defaultStrategy An escaping strategy + * + * @see setDefaultStrategy() + */ + public function __construct($defaultStrategy = 'html') + { + $this->setDefaultStrategy($defaultStrategy); + } + + public function getTokenParsers() + { + return [new AutoEscapeTokenParser()]; + } + + public function getNodeVisitors() + { + return [new EscaperNodeVisitor()]; + } + + public function getFilters() + { + return [ + new TwigFilter('raw', 'twig_raw_filter', ['is_safe' => ['all']]), + ]; + } + + /** + * Sets the default strategy to use when not defined by the user. + * + * The strategy can be a valid PHP callback that takes the template + * name as an argument and returns the strategy to use. + * + * @param string|false|callable $defaultStrategy An escaping strategy + */ + public function setDefaultStrategy($defaultStrategy) + { + // for BC + if (true === $defaultStrategy) { + @trigger_error('Using "true" as the default strategy is deprecated since version 1.21. Use "html" instead.', E_USER_DEPRECATED); + + $defaultStrategy = 'html'; + } + + if ('filename' === $defaultStrategy) { + @trigger_error('Using "filename" as the default strategy is deprecated since version 1.27. Use "name" instead.', E_USER_DEPRECATED); + + $defaultStrategy = 'name'; + } + + if ('name' === $defaultStrategy) { + $defaultStrategy = ['\Twig\FileExtensionEscapingStrategy', 'guess']; + } + + $this->defaultStrategy = $defaultStrategy; + } + + /** + * Gets the default strategy to use when not defined by the user. + * + * @param string $name The template name + * + * @return string|false The default strategy to use for the template + */ + public function getDefaultStrategy($name) { + // disable string callables to avoid calling a function named html or js, + // or any other upcoming escaping strategy + if (!\is_string($this->defaultStrategy) && false !== $this->defaultStrategy) { + return \call_user_func($this->defaultStrategy, $name); + } + + return $this->defaultStrategy; } + + public function getName() + { + return 'escaper'; + } +} + +class_alias('Twig\Extension\EscaperExtension', 'Twig_Extension_Escaper'); +} + +namespace { +/** + * Marks a variable as being safe. + * + * @param string $string A PHP variable + * + * @return string + */ +function twig_raw_filter($string) +{ + return $string; +} } diff --git a/vendor/twig/twig/src/Extension/ExtensionInterface.php b/vendor/twig/twig/src/Extension/ExtensionInterface.php index 0a1d502e47ce6ea97f89c9a6bb8f87931c42f25c..72b31e9d1af9da107e299810dbb6a95229abc209 100644 --- a/vendor/twig/twig/src/Extension/ExtensionInterface.php +++ b/vendor/twig/twig/src/Extension/ExtensionInterface.php @@ -1,11 +1,101 @@ <?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\Extension; -class_exists('Twig_ExtensionInterface'); +use Twig\Environment; +use Twig\NodeVisitor\NodeVisitorInterface; +use Twig\TokenParser\TokenParserInterface; +use Twig\TwigFilter; +use Twig\TwigFunction; +use Twig\TwigTest; + +/** + * Interface implemented by extension classes. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +interface ExtensionInterface +{ + /** + * Initializes the runtime environment. + * + * This is where you can load some file that contains filter functions for instance. + * + * @deprecated since 1.23 (to be removed in 2.0), implement \Twig_Extension_InitRuntimeInterface instead + */ + public function initRuntime(Environment $environment); + + /** + * Returns the token parser instances to add to the existing list. + * + * @return TokenParserInterface[] + */ + public function getTokenParsers(); + + /** + * Returns the node visitor instances to add to the existing list. + * + * @return NodeVisitorInterface[] + */ + public function getNodeVisitors(); + + /** + * Returns a list of filters to add to the existing list. + * + * @return TwigFilter[] + */ + public function getFilters(); + + /** + * Returns a list of tests to add to the existing list. + * + * @return TwigTest[] + */ + public function getTests(); -if (\false) { - interface ExtensionInterface extends \Twig_ExtensionInterface - { - } + /** + * Returns a list of functions to add to the existing list. + * + * @return TwigFunction[] + */ + public function getFunctions(); + + /** + * Returns a list of operators to add to the existing list. + * + * @return array<array> First array of unary operators, second array of binary operators + */ + public function getOperators(); + + /** + * Returns a list of global variables to add to the existing list. + * + * @return array An array of global variables + * + * @deprecated since 1.23 (to be removed in 2.0), implement \Twig_Extension_GlobalsInterface instead + */ + public function getGlobals(); + + /** + * Returns the name of the extension. + * + * @return string The extension name + * + * @deprecated since 1.26 (to be removed in 2.0), not used anymore internally + */ + public function getName(); } + +class_alias('Twig\Extension\ExtensionInterface', 'Twig_ExtensionInterface'); + +// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. +class_exists('Twig\Environment'); diff --git a/vendor/twig/twig/src/Extension/GlobalsInterface.php b/vendor/twig/twig/src/Extension/GlobalsInterface.php index 024f314d9a02d1444367e9cf58e1e7318ac82ed6..1f54e257245b1e07055e6f1fb77dd163079d87e5 100644 --- a/vendor/twig/twig/src/Extension/GlobalsInterface.php +++ b/vendor/twig/twig/src/Extension/GlobalsInterface.php @@ -1,11 +1,26 @@ <?php -namespace Twig\Extension; +/* + * 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. + */ -class_exists('Twig_Extension_GlobalsInterface'); +namespace Twig\Extension; -if (\false) { - interface GlobalsInterface extends \Twig_Extension_ExtensionInterface - { - } +/** + * Enables usage of the deprecated Twig\Extension\AbstractExtension::getGlobals() method. + * + * Explicitly implement this interface if you really need to implement the + * deprecated getGlobals() method in your extensions. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +interface GlobalsInterface +{ } + +class_alias('Twig\Extension\GlobalsInterface', 'Twig_Extension_GlobalsInterface'); diff --git a/vendor/twig/twig/src/Extension/InitRuntimeInterface.php b/vendor/twig/twig/src/Extension/InitRuntimeInterface.php index b7a2e30086e5d04a7f617cf5f90ef8a9d802c0f4..f71d9cb51dce81ec98fb3e3861b86c817a096847 100644 --- a/vendor/twig/twig/src/Extension/InitRuntimeInterface.php +++ b/vendor/twig/twig/src/Extension/InitRuntimeInterface.php @@ -1,11 +1,26 @@ <?php -namespace Twig\Extension; +/* + * 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. + */ -class_exists('Twig_Extension_InitRuntimeInterface'); +namespace Twig\Extension; -if (\false) { - interface InitRuntimeInterface extends \Twig_Extension_InitRuntimeInterface - { - } +/** + * Enables usage of the deprecated Twig\Extension\AbstractExtension::initRuntime() method. + * + * Explicitly implement this interface if you really need to implement the + * deprecated initRuntime() method in your extensions. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +interface InitRuntimeInterface +{ } + +class_alias('Twig\Extension\InitRuntimeInterface', 'Twig_Extension_InitRuntimeInterface'); diff --git a/vendor/twig/twig/src/Extension/OptimizerExtension.php b/vendor/twig/twig/src/Extension/OptimizerExtension.php index 5aa6ea3449af697d329aef7bd1def2e0a33d76a8..3e137409e27ada9541d16810b8f8f803341462ed 100644 --- a/vendor/twig/twig/src/Extension/OptimizerExtension.php +++ b/vendor/twig/twig/src/Extension/OptimizerExtension.php @@ -1,11 +1,39 @@ <?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\Extension; -class_exists('Twig_Extension_Optimizer'); +use Twig\NodeVisitor\OptimizerNodeVisitor; + +/** + * @final + */ +class OptimizerExtension extends AbstractExtension +{ + protected $optimizers; + + public function __construct($optimizers = -1) + { + $this->optimizers = $optimizers; + } -if (\false) { - class OptimizerExtension extends \Twig_Extension_Optimizer + public function getNodeVisitors() { + return [new OptimizerNodeVisitor($this->optimizers)]; + } + + public function getName() + { + return 'optimizer'; } } + +class_alias('Twig\Extension\OptimizerExtension', 'Twig_Extension_Optimizer'); diff --git a/vendor/twig/twig/src/Extension/ProfilerExtension.php b/vendor/twig/twig/src/Extension/ProfilerExtension.php index 58fb5bc8b219e638d47efe2e9f08ee7d4fa20276..7b21b9fa55580c8df4019bfac0255fee9e463ebe 100644 --- a/vendor/twig/twig/src/Extension/ProfilerExtension.php +++ b/vendor/twig/twig/src/Extension/ProfilerExtension.php @@ -1,11 +1,53 @@ <?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\Extension; -class_exists('Twig_Extension_Profiler'); +use Twig\Profiler\NodeVisitor\ProfilerNodeVisitor; +use Twig\Profiler\Profile; + +class ProfilerExtension extends AbstractExtension +{ + private $actives = []; + + public function __construct(Profile $profile) + { + $this->actives[] = $profile; + } + + public function enter(Profile $profile) + { + $this->actives[0]->addProfile($profile); + array_unshift($this->actives, $profile); + } + + public function leave(Profile $profile) + { + $profile->leave(); + array_shift($this->actives); + + if (1 === \count($this->actives)) { + $this->actives[0]->leave(); + } + } + + public function getNodeVisitors() + { + return [new ProfilerNodeVisitor(\get_class($this))]; + } -if (\false) { - class ProfilerExtension extends \Twig_Extension_Profiler + public function getName() { + return 'profiler'; } } + +class_alias('Twig\Extension\ProfilerExtension', 'Twig_Extension_Profiler'); diff --git a/vendor/twig/twig/src/Extension/SandboxExtension.php b/vendor/twig/twig/src/Extension/SandboxExtension.php index 0c244ffc660d8acdd8d6f77cf0e1dde11dfab815..818c8c94c816aefcd0c55fcfc512272b111c420c 100644 --- a/vendor/twig/twig/src/Extension/SandboxExtension.php +++ b/vendor/twig/twig/src/Extension/SandboxExtension.php @@ -1,11 +1,109 @@ <?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\Extension; -class_exists('Twig_Extension_Sandbox'); +use Twig\NodeVisitor\SandboxNodeVisitor; +use Twig\Sandbox\SecurityPolicyInterface; +use Twig\TokenParser\SandboxTokenParser; + +/** + * @final + */ +class SandboxExtension extends AbstractExtension +{ + protected $sandboxedGlobally; + protected $sandboxed; + protected $policy; + + public function __construct(SecurityPolicyInterface $policy, $sandboxed = false) + { + $this->policy = $policy; + $this->sandboxedGlobally = $sandboxed; + } + + public function getTokenParsers() + { + return [new SandboxTokenParser()]; + } + + public function getNodeVisitors() + { + return [new SandboxNodeVisitor()]; + } + + public function enableSandbox() + { + $this->sandboxed = true; + } + + public function disableSandbox() + { + $this->sandboxed = false; + } -if (\false) { - class SandboxExtension extends \Twig_Extension_Sandbox + public function isSandboxed() { + return $this->sandboxedGlobally || $this->sandboxed; + } + + public function isSandboxedGlobally() + { + return $this->sandboxedGlobally; + } + + public function setSecurityPolicy(SecurityPolicyInterface $policy) + { + $this->policy = $policy; + } + + public function getSecurityPolicy() + { + return $this->policy; + } + + public function checkSecurity($tags, $filters, $functions) + { + if ($this->isSandboxed()) { + $this->policy->checkSecurity($tags, $filters, $functions); + } + } + + public function checkMethodAllowed($obj, $method) + { + if ($this->isSandboxed()) { + $this->policy->checkMethodAllowed($obj, $method); + } + } + + public function checkPropertyAllowed($obj, $method) + { + if ($this->isSandboxed()) { + $this->policy->checkPropertyAllowed($obj, $method); + } + } + + public function ensureToStringAllowed($obj) + { + if ($this->isSandboxed() && \is_object($obj) && method_exists($obj, '__toString')) { + $this->policy->checkMethodAllowed($obj, '__toString'); + } + + return $obj; + } + + public function getName() + { + return 'sandbox'; } } + +class_alias('Twig\Extension\SandboxExtension', 'Twig_Extension_Sandbox'); diff --git a/vendor/twig/twig/src/Extension/StagingExtension.php b/vendor/twig/twig/src/Extension/StagingExtension.php index 62016faefedfad14ee70e9e0ce21f836cedaa880..049c5c79775c4d7f1a3b07f3c191978147859cec 100644 --- a/vendor/twig/twig/src/Extension/StagingExtension.php +++ b/vendor/twig/twig/src/Extension/StagingExtension.php @@ -1,11 +1,117 @@ <?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\Extension; -class_exists('Twig_Extension_Staging'); +use Twig\NodeVisitor\NodeVisitorInterface; +use Twig\TokenParser\TokenParserInterface; + +/** + * Internal class. + * + * This class is used by \Twig\Environment as a staging area and must not be used directly. + * + * @author Fabien Potencier <fabien@symfony.com> + * + * @internal + */ +class StagingExtension extends AbstractExtension +{ + protected $functions = []; + protected $filters = []; + protected $visitors = []; + protected $tokenParsers = []; + protected $globals = []; + protected $tests = []; + + public function addFunction($name, $function) + { + if (isset($this->functions[$name])) { + @trigger_error(sprintf('Overriding function "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED); + } + + $this->functions[$name] = $function; + } + + public function getFunctions() + { + return $this->functions; + } + + public function addFilter($name, $filter) + { + if (isset($this->filters[$name])) { + @trigger_error(sprintf('Overriding filter "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED); + } + + $this->filters[$name] = $filter; + } + + public function getFilters() + { + return $this->filters; + } -if (\false) { - class StagingExtension extends \Twig_Extension_Staging + public function addNodeVisitor(NodeVisitorInterface $visitor) { + $this->visitors[] = $visitor; + } + + public function getNodeVisitors() + { + return $this->visitors; + } + + public function addTokenParser(TokenParserInterface $parser) + { + if (isset($this->tokenParsers[$parser->getTag()])) { + @trigger_error(sprintf('Overriding tag "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $parser->getTag()), E_USER_DEPRECATED); + } + + $this->tokenParsers[$parser->getTag()] = $parser; + } + + public function getTokenParsers() + { + return $this->tokenParsers; + } + + public function addGlobal($name, $value) + { + $this->globals[$name] = $value; + } + + public function getGlobals() + { + return $this->globals; + } + + public function addTest($name, $test) + { + if (isset($this->tests[$name])) { + @trigger_error(sprintf('Overriding test "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED); + } + + $this->tests[$name] = $test; + } + + public function getTests() + { + return $this->tests; + } + + public function getName() + { + return 'staging'; } } + +class_alias('Twig\Extension\StagingExtension', 'Twig_Extension_Staging'); diff --git a/vendor/twig/twig/src/Extension/StringLoaderExtension.php b/vendor/twig/twig/src/Extension/StringLoaderExtension.php index 0474432d79167bbdc814ae70d931b5ce12ef1a8d..9d7e2aa53720821f4a4f7caf7f50214dff0ee7a9 100644 --- a/vendor/twig/twig/src/Extension/StringLoaderExtension.php +++ b/vendor/twig/twig/src/Extension/StringLoaderExtension.php @@ -1,11 +1,53 @@ <?php -namespace Twig\Extension; +/* + * 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. + */ -class_exists('Twig_Extension_StringLoader'); +namespace Twig\Extension { +use Twig\TwigFunction; -if (\false) { - class StringLoaderExtension extends \Twig_Extension_StringLoader +/** + * @final + */ +class StringLoaderExtension extends AbstractExtension +{ + public function getFunctions() { + return [ + new TwigFunction('template_from_string', 'twig_template_from_string', ['needs_environment' => true]), + ]; } + + public function getName() + { + return 'string_loader'; + } +} + +class_alias('Twig\Extension\StringLoaderExtension', 'Twig_Extension_StringLoader'); +} + +namespace { +use Twig\Environment; +use Twig\Template; + +/** + * Loads a template from a string. + * + * {{ include(template_from_string("Hello {{ name }}")) }} + * + * @param string $template A template as a string or object implementing __toString() + * + * @return Template + */ +function twig_template_from_string(Environment $env, $template) +{ + return $env->createTemplate((string) $template); +} } diff --git a/vendor/twig/twig/src/FileExtensionEscapingStrategy.php b/vendor/twig/twig/src/FileExtensionEscapingStrategy.php index 189f8132d915856c3191e427667c9017bbe9958b..bc95f33435c8dea866c87b47c5cd428b0b559d89 100644 --- a/vendor/twig/twig/src/FileExtensionEscapingStrategy.php +++ b/vendor/twig/twig/src/FileExtensionEscapingStrategy.php @@ -1,11 +1,62 @@ <?php -namespace Twig; +/* + * 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. + */ -class_exists('Twig_FileExtensionEscapingStrategy'); +namespace Twig; -if (\false) { - class FileExtensionEscapingStrategy extends \Twig_FileExtensionEscapingStrategy +/** + * Default autoescaping strategy based on file names. + * + * This strategy sets the HTML as the default autoescaping strategy, + * but changes it based on the template name. + * + * Note that there is no runtime performance impact as the + * default autoescaping strategy is set at compilation time. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class FileExtensionEscapingStrategy +{ + /** + * Guesses the best autoescaping strategy based on the file name. + * + * @param string $name The template name + * + * @return string|false The escaping strategy name to use or false to disable + */ + public static function guess($name) { + if (\in_array(substr($name, -1), ['/', '\\'])) { + return 'html'; // return html for directories + } + + if ('.twig' === substr($name, -5)) { + $name = substr($name, 0, -5); + } + + $extension = pathinfo($name, PATHINFO_EXTENSION); + + switch ($extension) { + case 'js': + return 'js'; + + case 'css': + return 'css'; + + case 'txt': + return false; + + default: + return 'html'; + } } } + +class_alias('Twig\FileExtensionEscapingStrategy', 'Twig_FileExtensionEscapingStrategy'); diff --git a/vendor/twig/twig/src/Lexer.php b/vendor/twig/twig/src/Lexer.php index f141afe6f7ca338cab8712b38400d2ab175c9ae4..fcb5d5511b1e9ec2c030eb5803ce3a71ad47a02f 100644 --- a/vendor/twig/twig/src/Lexer.php +++ b/vendor/twig/twig/src/Lexer.php @@ -1,11 +1,431 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig; -class_exists('Twig_Lexer'); +use Twig\Error\SyntaxError; + +/** + * Lexes a template string. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class Lexer implements \Twig_LexerInterface +{ + protected $tokens; + protected $code; + protected $cursor; + protected $lineno; + protected $end; + protected $state; + protected $states; + protected $brackets; + protected $env; + // to be renamed to $name in 2.0 (where it is private) + protected $filename; + protected $options; + protected $regexes; + protected $position; + protected $positions; + protected $currentVarBlockLine; + + private $source; + + const STATE_DATA = 0; + const STATE_BLOCK = 1; + const STATE_VAR = 2; + const STATE_STRING = 3; + const STATE_INTERPOLATION = 4; + + const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'; + const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?/A'; + const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As'; + const REGEX_DQ_STRING_DELIM = '/"/A'; + const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As'; + const PUNCTUATION = '()[]{}?:.,|'; + + public function __construct(Environment $env, array $options = []) + { + $this->env = $env; + + $this->options = array_merge([ + 'tag_comment' => ['{#', '#}'], + 'tag_block' => ['{%', '%}'], + 'tag_variable' => ['{{', '}}'], + 'whitespace_trim' => '-', + 'interpolation' => ['#{', '}'], + ], $options); + + $this->regexes = [ + 'lex_var' => '/\s*'.preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_variable'][1], '/').'/A', + 'lex_block' => '/\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')\n?/A', + 'lex_raw_data' => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s*(?:end%s)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s', + 'operator' => $this->getOperatorRegex(), + 'lex_comment' => '/(?:'.preg_quote($this->options['whitespace_trim'], '/').preg_quote($this->options['tag_comment'][1], '/').'\s*|'.preg_quote($this->options['tag_comment'][1], '/').')\n?/s', + 'lex_block_raw' => '/\s*(raw|verbatim)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\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', + 'lex_tokens_start' => '/('.preg_quote($this->options['tag_variable'][0], '/').'|'.preg_quote($this->options['tag_block'][0], '/').'|'.preg_quote($this->options['tag_comment'][0], '/').')('.preg_quote($this->options['whitespace_trim'], '/').')?/s', + 'interpolation_start' => '/'.preg_quote($this->options['interpolation'][0], '/').'\s*/A', + 'interpolation_end' => '/\s*'.preg_quote($this->options['interpolation'][1], '/').'/A', + ]; + } + + public function tokenize($code, $name = null) + { + if (!$code instanceof Source) { + @trigger_error(sprintf('Passing a string as the $code argument of %s() is deprecated since version 1.27 and will be removed in 2.0. Pass a \Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); + $this->source = new Source($code, $name); + } else { + $this->source = $code; + } + + if (((int) ini_get('mbstring.func_overload')) & 2) { + @trigger_error('Support for having "mbstring.func_overload" different from 0 is deprecated version 1.29 and will be removed in 2.0.', E_USER_DEPRECATED); + } + + if (\function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { + $mbEncoding = mb_internal_encoding(); + mb_internal_encoding('ASCII'); + } else { + $mbEncoding = null; + } + + $this->code = str_replace(["\r\n", "\r"], "\n", $this->source->getCode()); + $this->filename = $this->source->getName(); + $this->cursor = 0; + $this->lineno = 1; + $this->end = \strlen($this->code); + $this->tokens = []; + $this->state = self::STATE_DATA; + $this->states = []; + $this->brackets = []; + $this->position = -1; + + // find all token starts in one go + preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, PREG_OFFSET_CAPTURE); + $this->positions = $matches; + + while ($this->cursor < $this->end) { + // dispatch to the lexing functions depending + // on the current state + switch ($this->state) { + case self::STATE_DATA: + $this->lexData(); + break; + + case self::STATE_BLOCK: + $this->lexBlock(); + break; + + case self::STATE_VAR: + $this->lexVar(); + break; + + case self::STATE_STRING: + $this->lexString(); + break; + + case self::STATE_INTERPOLATION: + $this->lexInterpolation(); + break; + } + } + + $this->pushToken(Token::EOF_TYPE); + + if (!empty($this->brackets)) { + list($expect, $lineno) = array_pop($this->brackets); + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); + } + + if ($mbEncoding) { + mb_internal_encoding($mbEncoding); + } + + return new TokenStream($this->tokens, $this->source); + } + + protected function lexData() + { + // if no matches are left we return the rest of the template as simple text token + if ($this->position == \count($this->positions[0]) - 1) { + $this->pushToken(Token::TEXT_TYPE, substr($this->code, $this->cursor)); + $this->cursor = $this->end; + + return; + } + + // Find the first token after the current cursor + $position = $this->positions[0][++$this->position]; + while ($position[1] < $this->cursor) { + if ($this->position == \count($this->positions[0]) - 1) { + return; + } + $position = $this->positions[0][++$this->position]; + } + + // push the template text first + $text = $textContent = substr($this->code, $this->cursor, $position[1] - $this->cursor); + if (isset($this->positions[2][$this->position][0])) { + $text = rtrim($text); + } + $this->pushToken(Token::TEXT_TYPE, $text); + $this->moveCursor($textContent.$position[0]); + + switch ($this->positions[1][$this->position][0]) { + case $this->options['tag_comment'][0]: + $this->lexComment(); + break; + + case $this->options['tag_block'][0]: + // raw data? + if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, null, $this->cursor)) { + $this->moveCursor($match[0]); + $this->lexRawData($match[1]); + // {% line \d+ %} + } elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, null, $this->cursor)) { + $this->moveCursor($match[0]); + $this->lineno = (int) $match[1]; + } else { + $this->pushToken(Token::BLOCK_START_TYPE); + $this->pushState(self::STATE_BLOCK); + $this->currentVarBlockLine = $this->lineno; + } + break; + + case $this->options['tag_variable'][0]: + $this->pushToken(Token::VAR_START_TYPE); + $this->pushState(self::STATE_VAR); + $this->currentVarBlockLine = $this->lineno; + break; + } + } + + protected function lexBlock() + { + if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, null, $this->cursor)) { + $this->pushToken(Token::BLOCK_END_TYPE); + $this->moveCursor($match[0]); + $this->popState(); + } else { + $this->lexExpression(); + } + } + + protected function lexVar() + { + if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, null, $this->cursor)) { + $this->pushToken(Token::VAR_END_TYPE); + $this->moveCursor($match[0]); + $this->popState(); + } else { + $this->lexExpression(); + } + } + + protected function lexExpression() + { + // whitespace + if (preg_match('/\s+/A', $this->code, $match, null, $this->cursor)) { + $this->moveCursor($match[0]); + + if ($this->cursor >= $this->end) { + throw new SyntaxError(sprintf('Unclosed "%s".', self::STATE_BLOCK === $this->state ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source); + } + } + + // operators + if (preg_match($this->regexes['operator'], $this->code, $match, null, $this->cursor)) { + $this->pushToken(Token::OPERATOR_TYPE, preg_replace('/\s+/', ' ', $match[0])); + $this->moveCursor($match[0]); + } + // names + elseif (preg_match(self::REGEX_NAME, $this->code, $match, null, $this->cursor)) { + $this->pushToken(Token::NAME_TYPE, $match[0]); + $this->moveCursor($match[0]); + } + // numbers + elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, null, $this->cursor)) { + $number = (float) $match[0]; // floats + if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { + $number = (int) $match[0]; // integers lower than the maximum + } + $this->pushToken(Token::NUMBER_TYPE, $number); + $this->moveCursor($match[0]); + } + // punctuation + elseif (false !== strpos(self::PUNCTUATION, $this->code[$this->cursor])) { + // opening bracket + if (false !== strpos('([{', $this->code[$this->cursor])) { + $this->brackets[] = [$this->code[$this->cursor], $this->lineno]; + } + // closing bracket + elseif (false !== strpos(')]}', $this->code[$this->cursor])) { + if (empty($this->brackets)) { + throw new SyntaxError(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); + } + + list($expect, $lineno) = array_pop($this->brackets); + if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) { + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); + } + } + + $this->pushToken(Token::PUNCTUATION_TYPE, $this->code[$this->cursor]); + ++$this->cursor; + } + // strings + elseif (preg_match(self::REGEX_STRING, $this->code, $match, null, $this->cursor)) { + $this->pushToken(Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1))); + $this->moveCursor($match[0]); + } + // opening double quoted string + elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { + $this->brackets[] = ['"', $this->lineno]; + $this->pushState(self::STATE_STRING); + $this->moveCursor($match[0]); + } + // unlexable + else { + throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); + } + } + + protected function lexRawData($tag) + { + if ('raw' === $tag) { + @trigger_error(sprintf('Twig Tag "raw" is deprecated since version 1.21. Use "verbatim" instead in %s at line %d.', $this->filename, $this->lineno), E_USER_DEPRECATED); + } + + if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { + throw new SyntaxError(sprintf('Unexpected end of file: Unclosed "%s" block.', $tag), $this->lineno, $this->source); + } + + $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); + $this->moveCursor($text.$match[0][0]); + + if (false !== strpos($match[1][0], $this->options['whitespace_trim'])) { + $text = rtrim($text); + } + + $this->pushToken(Token::TEXT_TYPE, $text); + } + + protected function lexComment() + { + if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { + throw new SyntaxError('Unclosed comment.', $this->lineno, $this->source); + } -if (\false) { - class Lexer extends \Twig_Lexer + $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]); + } + + protected function lexString() { + if (preg_match($this->regexes['interpolation_start'], $this->code, $match, null, $this->cursor)) { + $this->brackets[] = [$this->options['interpolation'][0], $this->lineno]; + $this->pushToken(Token::INTERPOLATION_START_TYPE); + $this->moveCursor($match[0]); + $this->pushState(self::STATE_INTERPOLATION); + } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, null, $this->cursor) && \strlen($match[0]) > 0) { + $this->pushToken(Token::STRING_TYPE, stripcslashes($match[0])); + $this->moveCursor($match[0]); + } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { + list($expect, $lineno) = array_pop($this->brackets); + if ('"' != $this->code[$this->cursor]) { + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); + } + + $this->popState(); + ++$this->cursor; + } else { + // unlexable + throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); + } + } + + protected function lexInterpolation() + { + $bracket = end($this->brackets); + if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, null, $this->cursor)) { + array_pop($this->brackets); + $this->pushToken(Token::INTERPOLATION_END_TYPE); + $this->moveCursor($match[0]); + $this->popState(); + } else { + $this->lexExpression(); + } + } + + protected function pushToken($type, $value = '') + { + // do not push empty text tokens + if (Token::TEXT_TYPE === $type && '' === $value) { + return; + } + + $this->tokens[] = new Token($type, $value, $this->lineno); + } + + protected function moveCursor($text) + { + $this->cursor += \strlen($text); + $this->lineno += substr_count($text, "\n"); + } + + protected function getOperatorRegex() + { + $operators = array_merge( + ['='], + array_keys($this->env->getUnaryOperators()), + array_keys($this->env->getBinaryOperators()) + ); + + $operators = array_combine($operators, array_map('strlen', $operators)); + arsort($operators); + + $regex = []; + foreach ($operators as $operator => $length) { + // an operator that ends with a character must be followed by + // a whitespace or a parenthesis + if (ctype_alpha($operator[$length - 1])) { + $r = preg_quote($operator, '/').'(?=[\s()])'; + } else { + $r = preg_quote($operator, '/'); + } + + // an operator with a space can be any amount of whitespaces + $r = preg_replace('/\s+/', '\s+', $r); + + $regex[] = $r; + } + + return '/'.implode('|', $regex).'/A'; + } + + protected function pushState($state) + { + $this->states[] = $this->state; + $this->state = $state; + } + + protected function popState() + { + if (0 === \count($this->states)) { + throw new \LogicException('Cannot pop state without a previous state.'); + } + + $this->state = array_pop($this->states); } } + +class_alias('Twig\Lexer', 'Twig_Lexer'); diff --git a/vendor/twig/twig/src/Loader/ArrayLoader.php b/vendor/twig/twig/src/Loader/ArrayLoader.php index 9f5de3c7ed27f9e34eae20bb5dac1d3cf17d2611..6bc430f50e4b64cba6b5f3dc7413ab09bedda0a2 100644 --- a/vendor/twig/twig/src/Loader/ArrayLoader.php +++ b/vendor/twig/twig/src/Loader/ArrayLoader.php @@ -1,11 +1,102 @@ <?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\Loader; -class_exists('Twig_Loader_Array'); +use Twig\Error\LoaderError; +use Twig\Source; + +/** + * Loads a template from an array. + * + * When using this loader 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. + * + * This loader should only be used for unit testing. + * + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class ArrayLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface +{ + protected $templates = []; + + /** + * @param array $templates An array of templates (keys are the names, and values are the source code) + */ + public function __construct(array $templates = []) + { + $this->templates = $templates; + } + + /** + * Adds or overrides a template. + * + * @param string $name The template name + * @param string $template The template source + */ + public function setTemplate($name, $template) + { + $this->templates[(string) $name] = $template; + } + + 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); + + $name = (string) $name; + if (!isset($this->templates[$name])) { + throw new LoaderError(sprintf('Template "%s" is not defined.', $name)); + } + + return $this->templates[$name]; + } + + public function getSourceContext($name) + { + $name = (string) $name; + if (!isset($this->templates[$name])) { + throw new LoaderError(sprintf('Template "%s" is not defined.', $name)); + } + + return new Source($this->templates[$name], $name); + } -if (\false) { - class ArrayLoader extends \Twig_Loader_Array + public function exists($name) { + return isset($this->templates[(string) $name]); + } + + public function getCacheKey($name) + { + $name = (string) $name; + if (!isset($this->templates[$name])) { + throw new LoaderError(sprintf('Template "%s" is not defined.', $name)); + } + + return $name.':'.$this->templates[$name]; + } + + public function isFresh($name, $time) + { + $name = (string) $name; + if (!isset($this->templates[$name])) { + throw new LoaderError(sprintf('Template "%s" is not defined.', $name)); + } + + return true; } } + +class_alias('Twig\Loader\ArrayLoader', 'Twig_Loader_Array'); diff --git a/vendor/twig/twig/src/Loader/ChainLoader.php b/vendor/twig/twig/src/Loader/ChainLoader.php index 396eca525fc0b58294612675ec5b2f93dbd00a2e..25ac55a335b82e7455e3417475914e8e89a97d3f 100644 --- a/vendor/twig/twig/src/Loader/ChainLoader.php +++ b/vendor/twig/twig/src/Loader/ChainLoader.php @@ -1,11 +1,164 @@ <?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\Loader; -class_exists('Twig_Loader_Chain'); +use Twig\Error\LoaderError; +use Twig\Source; + +/** + * Loads templates from other loaders. + * + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class ChainLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface +{ + private $hasSourceCache = []; + protected $loaders = []; + + /** + * @param LoaderInterface[] $loaders + */ + public function __construct(array $loaders = []) + { + foreach ($loaders as $loader) { + $this->addLoader($loader); + } + } + + public function addLoader(LoaderInterface $loader) + { + $this->loaders[] = $loader; + $this->hasSourceCache = []; + } + + /** + * @return LoaderInterface[] + */ + public function getLoaders() + { + return $this->loaders; + } + + 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); + + $exceptions = []; + foreach ($this->loaders as $loader) { + if ($loader instanceof ExistsLoaderInterface && !$loader->exists($name)) { + continue; + } + + try { + return $loader->getSource($name); + } catch (LoaderError $e) { + $exceptions[] = $e->getMessage(); + } + } + + throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); + } + + public function getSourceContext($name) + { + $exceptions = []; + foreach ($this->loaders as $loader) { + if ($loader instanceof ExistsLoaderInterface && !$loader->exists($name)) { + continue; + } + + try { + if ($loader instanceof SourceContextLoaderInterface) { + return $loader->getSourceContext($name); + } -if (\false) { - class ChainLoader extends \Twig_Loader_Chain + return new Source($loader->getSource($name), $name); + } catch (LoaderError $e) { + $exceptions[] = $e->getMessage(); + } + } + + throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); + } + + public function exists($name) + { + $name = (string) $name; + + if (isset($this->hasSourceCache[$name])) { + return $this->hasSourceCache[$name]; + } + + foreach ($this->loaders as $loader) { + if ($loader instanceof ExistsLoaderInterface) { + if ($loader->exists($name)) { + return $this->hasSourceCache[$name] = true; + } + + continue; + } + + try { + if ($loader instanceof SourceContextLoaderInterface) { + $loader->getSourceContext($name); + } else { + $loader->getSource($name); + } + + return $this->hasSourceCache[$name] = true; + } catch (LoaderError $e) { + } + } + + return $this->hasSourceCache[$name] = false; + } + + public function getCacheKey($name) + { + $exceptions = []; + foreach ($this->loaders as $loader) { + if ($loader instanceof ExistsLoaderInterface && !$loader->exists($name)) { + continue; + } + + try { + return $loader->getCacheKey($name); + } catch (LoaderError $e) { + $exceptions[] = \get_class($loader).': '.$e->getMessage(); + } + } + + throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); + } + + public function isFresh($name, $time) { + $exceptions = []; + foreach ($this->loaders as $loader) { + if ($loader instanceof ExistsLoaderInterface && !$loader->exists($name)) { + continue; + } + + try { + return $loader->isFresh($name, $time); + } catch (LoaderError $e) { + $exceptions[] = \get_class($loader).': '.$e->getMessage(); + } + } + + throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); } } + +class_alias('Twig\Loader\ChainLoader', 'Twig_Loader_Chain'); diff --git a/vendor/twig/twig/src/Loader/ExistsLoaderInterface.php b/vendor/twig/twig/src/Loader/ExistsLoaderInterface.php index e533d4b24195e0d2a0b892917b48e1fa5b31051d..940d87618c6c45a863a267653bdd4c254f9c0372 100644 --- a/vendor/twig/twig/src/Loader/ExistsLoaderInterface.php +++ b/vendor/twig/twig/src/Loader/ExistsLoaderInterface.php @@ -1,11 +1,33 @@ <?php -namespace Twig\Loader; +/* + * 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. + */ -class_exists('Twig_ExistsLoaderInterface'); +namespace Twig\Loader; -if (\false) { - interface ExistsLoaderInterface extends \Twig_ExistsLoaderInterface - { - } +/** + * Adds an exists() method for loaders. + * + * @author Florin Patan <florinpatan@gmail.com> + * + * @deprecated since 1.12 (to be removed in 3.0) + */ +interface ExistsLoaderInterface +{ + /** + * Check if we have the source code of a template, given its name. + * + * @param string $name The name of the template to check if we can load + * + * @return bool If the template source code is handled by this loader or not + */ + public function exists($name); } + +class_alias('Twig\Loader\ExistsLoaderInterface', 'Twig_ExistsLoaderInterface'); diff --git a/vendor/twig/twig/src/Loader/FilesystemLoader.php b/vendor/twig/twig/src/Loader/FilesystemLoader.php index 83e8833f7d08775d790c22d44b45c13bbcc69002..c30b41a1bc567789d78c8e0c45e3229c32b6df4b 100644 --- a/vendor/twig/twig/src/Loader/FilesystemLoader.php +++ b/vendor/twig/twig/src/Loader/FilesystemLoader.php @@ -1,11 +1,303 @@ <?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\Loader; -class_exists('Twig_Loader_Filesystem'); +use Twig\Error\LoaderError; +use Twig\Source; + +/** + * Loads template from the filesystem. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class FilesystemLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface +{ + /** Identifier of the main namespace. */ + const MAIN_NAMESPACE = '__main__'; + + protected $paths = []; + protected $cache = []; + protected $errorCache = []; + + private $rootPath; + + /** + * @param string|array $paths A path or an array of paths where to look for templates + * @param string|null $rootPath The root path common to all relative paths (null for getcwd()) + */ + public function __construct($paths = [], $rootPath = null) + { + $this->rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR; + if (false !== $realPath = realpath($rootPath)) { + $this->rootPath = $realPath.\DIRECTORY_SEPARATOR; + } + + if ($paths) { + $this->setPaths($paths); + } + } + + /** + * Returns the paths to the templates. + * + * @param string $namespace A path namespace + * + * @return array The array of paths where to look for templates + */ + public function getPaths($namespace = self::MAIN_NAMESPACE) + { + return isset($this->paths[$namespace]) ? $this->paths[$namespace] : []; + } + + /** + * Returns the path namespaces. + * + * The main namespace is always defined. + * + * @return array The array of defined namespaces + */ + public function getNamespaces() + { + return array_keys($this->paths); + } + + /** + * Sets the paths where templates are stored. + * + * @param string|array $paths A path or an array of paths where to look for templates + * @param string $namespace A path namespace + */ + public function setPaths($paths, $namespace = self::MAIN_NAMESPACE) + { + if (!\is_array($paths)) { + $paths = [$paths]; + } + + $this->paths[$namespace] = []; + foreach ($paths as $path) { + $this->addPath($path, $namespace); + } + } + + /** + * Adds a path where templates are stored. + * + * @param string $path A path where to look for templates + * @param string $namespace A path namespace + * + * @throws LoaderError + */ + public function addPath($path, $namespace = self::MAIN_NAMESPACE) + { + // invalidate the cache + $this->cache = $this->errorCache = []; + + $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; + if (!is_dir($checkPath)) { + throw new LoaderError(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); + } -if (\false) { - class FilesystemLoader extends \Twig_Loader_Filesystem + $this->paths[$namespace][] = rtrim($path, '/\\'); + } + + /** + * Prepends a path where templates are stored. + * + * @param string $path A path where to look for templates + * @param string $namespace A path namespace + * + * @throws LoaderError + */ + public function prependPath($path, $namespace = self::MAIN_NAMESPACE) { + // invalidate the cache + $this->cache = $this->errorCache = []; + + $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; + if (!is_dir($checkPath)) { + throw new LoaderError(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); + } + + $path = rtrim($path, '/\\'); + + if (!isset($this->paths[$namespace])) { + $this->paths[$namespace][] = $path; + } else { + array_unshift($this->paths[$namespace], $path); + } + } + + 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)); + } + + public function getSourceContext($name) + { + $path = $this->findTemplate($name); + + return new Source(file_get_contents($path), $name, $path); + } + + public function getCacheKey($name) + { + $path = $this->findTemplate($name); + $len = \strlen($this->rootPath); + if (0 === strncmp($this->rootPath, $path, $len)) { + return substr($path, $len); + } + + return $path; + } + + public function exists($name) + { + $name = $this->normalizeName($name); + + if (isset($this->cache[$name])) { + return true; + } + + try { + return false !== $this->findTemplate($name, false); + } catch (LoaderError $exception) { + @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); + + return false; + } + } + + public function isFresh($name, $time) + { + return filemtime($this->findTemplate($name)) < $time; + } + + protected function findTemplate($name) + { + $throw = \func_num_args() > 1 ? func_get_arg(1) : true; + $name = $this->normalizeName($name); + + if (isset($this->cache[$name])) { + return $this->cache[$name]; + } + + if (isset($this->errorCache[$name])) { + if (!$throw) { + return false; + } + + throw new LoaderError($this->errorCache[$name]); + } + + try { + $this->validateName($name); + + list($namespace, $shortname) = $this->parseName($name); + } catch (LoaderError $e) { + if (!$throw) { + return false; + } + + throw $e; + } + + if (!isset($this->paths[$namespace])) { + $this->errorCache[$name] = sprintf('There are no registered paths for namespace "%s".', $namespace); + + if (!$throw) { + return false; + } + + throw new LoaderError($this->errorCache[$name]); + } + + foreach ($this->paths[$namespace] as $path) { + if (!$this->isAbsolutePath($path)) { + $path = $this->rootPath.$path; + } + + if (is_file($path.'/'.$shortname)) { + if (false !== $realpath = realpath($path.'/'.$shortname)) { + return $this->cache[$name] = $realpath; + } + + return $this->cache[$name] = $path.'/'.$shortname; + } + } + + $this->errorCache[$name] = sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace])); + + if (!$throw) { + return false; + } + + throw new LoaderError($this->errorCache[$name]); + } + + protected function parseName($name, $default = self::MAIN_NAMESPACE) + { + if (isset($name[0]) && '@' == $name[0]) { + if (false === $pos = strpos($name, '/')) { + throw new LoaderError(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); + } + + $namespace = substr($name, 1, $pos - 1); + $shortname = substr($name, $pos + 1); + + return [$namespace, $shortname]; + } + + return [$default, $name]; + } + + protected function normalizeName($name) + { + return preg_replace('#/{2,}#', '/', str_replace('\\', '/', (string) $name)); + } + + protected function validateName($name) + { + if (false !== strpos($name, "\0")) { + throw new LoaderError('A template name cannot contain NUL bytes.'); + } + + $name = ltrim($name, '/'); + $parts = explode('/', $name); + $level = 0; + foreach ($parts as $part) { + if ('..' === $part) { + --$level; + } elseif ('.' !== $part) { + ++$level; + } + + if ($level < 0) { + throw new LoaderError(sprintf('Looks like you try to load a template outside configured directories (%s).', $name)); + } + } + } + + private function isAbsolutePath($file) + { + return strspn($file, '/\\', 0, 1) + || (\strlen($file) > 3 && ctype_alpha($file[0]) + && ':' === substr($file, 1, 1) + && strspn($file, '/\\', 2, 1) + ) + || null !== parse_url($file, PHP_URL_SCHEME) + ; } } + +class_alias('Twig\Loader\FilesystemLoader', 'Twig_Loader_Filesystem'); diff --git a/vendor/twig/twig/src/Loader/LoaderInterface.php b/vendor/twig/twig/src/Loader/LoaderInterface.php index 67c331e6c6e331e57aa236f8253d60702fcab049..15be7a88cd00b075bcbb44d1233d69df98be2609 100644 --- a/vendor/twig/twig/src/Loader/LoaderInterface.php +++ b/vendor/twig/twig/src/Loader/LoaderInterface.php @@ -1,11 +1,61 @@ <?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\Loader; -class_exists('Twig_LoaderInterface'); +use Twig\Error\LoaderError; + +/** + * Interface all loaders must implement. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +interface LoaderInterface +{ + /** + * Gets the source code of a template, given its name. + * + * @param string $name The name of the template to load + * + * @return string The template source code + * + * @throws LoaderError When $name is not found + * + * @deprecated since 1.27 (to be removed in 2.0), implement Twig\Loader\SourceContextLoaderInterface + */ + public function getSource($name); -if (\false) { - interface LoaderInterface extends \Twig_LoaderInterface - { - } + /** + * Gets the cache key to use for the cache for a given template name. + * + * @param string $name The name of the template to load + * + * @return string The cache key + * + * @throws LoaderError When $name is not found + */ + public function getCacheKey($name); + + /** + * Returns true if the template is still fresh. + * + * @param string $name The template name + * @param int $time Timestamp of the last modification time of the + * cached template + * + * @return bool true if the template is fresh, false otherwise + * + * @throws LoaderError When $name is not found + */ + public function isFresh($name, $time); } + +class_alias('Twig\Loader\LoaderInterface', 'Twig_LoaderInterface'); diff --git a/vendor/twig/twig/src/Loader/SourceContextLoaderInterface.php b/vendor/twig/twig/src/Loader/SourceContextLoaderInterface.php index 4444f8082a49e8fa727586cbf51e149e50313a4a..78b1fcd40e480c0bb9861bf770bf123d8fdc5866 100644 --- a/vendor/twig/twig/src/Loader/SourceContextLoaderInterface.php +++ b/vendor/twig/twig/src/Loader/SourceContextLoaderInterface.php @@ -1,11 +1,38 @@ <?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\Loader; -class_exists('Twig_SourceContextLoaderInterface'); +use Twig\Error\LoaderError; +use Twig\Source; -if (\false) { - interface SourceContextLoaderInterface extends \Twig_SourceContextLoaderInterface - { - } +/** + * Adds a getSourceContext() method for loaders. + * + * @author Fabien Potencier <fabien@symfony.com> + * + * @deprecated since 1.27 (to be removed in 3.0) + */ +interface SourceContextLoaderInterface +{ + /** + * Returns the source context for a given template logical name. + * + * @param string $name The template logical name + * + * @return Source + * + * @throws LoaderError When $name is not found + */ + public function getSourceContext($name); } + +class_alias('Twig\Loader\SourceContextLoaderInterface', 'Twig_SourceContextLoaderInterface'); diff --git a/vendor/twig/twig/src/Markup.php b/vendor/twig/twig/src/Markup.php index 8dad08221a5fd04c75ccd473883d4564ed6b3ecb..107941cdf71425e14a4473bcb5896f43d4ad0b05 100644 --- a/vendor/twig/twig/src/Markup.php +++ b/vendor/twig/twig/src/Markup.php @@ -1,11 +1,41 @@ <?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; -class_exists('Twig_Markup'); +/** + * Marks a content as safe. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class Markup implements \Countable +{ + protected $content; + protected $charset; + + public function __construct($content, $charset) + { + $this->content = (string) $content; + $this->charset = $charset; + } + + public function __toString() + { + return $this->content; + } -if (\false) { - class Markup extends \Twig_Markup + public function count() { + return \function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : \strlen($this->content); } } + +class_alias('Twig\Markup', 'Twig_Markup'); diff --git a/vendor/twig/twig/src/Node/AutoEscapeNode.php b/vendor/twig/twig/src/Node/AutoEscapeNode.php index 9edb8e3da17c3b78c5e37db0f879615ed8d0fe1f..a9403066aea798e776b059abacd0755104f9d870 100644 --- a/vendor/twig/twig/src/Node/AutoEscapeNode.php +++ b/vendor/twig/twig/src/Node/AutoEscapeNode.php @@ -1,11 +1,40 @@ <?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\Node; -class_exists('Twig_Node_AutoEscape'); +use Twig\Compiler; -if (\false) { - class AutoEscapeNode extends \Twig_Node_AutoEscape +/** + * Represents an autoescape node. + * + * The value is the escaping strategy (can be html, js, ...) + * + * The true value is equivalent to html. + * + * If autoescaping is disabled, then the value is false. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class AutoEscapeNode extends Node +{ + public function __construct($value, \Twig_NodeInterface $body, $lineno, $tag = 'autoescape') { + parent::__construct(['body' => $body], ['value' => $value], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler->subcompile($this->getNode('body')); } } + +class_alias('Twig\Node\AutoEscapeNode', 'Twig_Node_AutoEscape'); diff --git a/vendor/twig/twig/src/Node/BlockNode.php b/vendor/twig/twig/src/Node/BlockNode.php index 27e30f98357ad944262252a30365c4e97ba3df3f..1ffc8ca78a60c73ac562a07ec63fdb489d5a757e 100644 --- a/vendor/twig/twig/src/Node/BlockNode.php +++ b/vendor/twig/twig/src/Node/BlockNode.php @@ -1,11 +1,45 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node; -class_exists('Twig_Node_Block'); +use Twig\Compiler; + +/** + * Represents a block node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class BlockNode extends Node +{ + public function __construct($name, \Twig_NodeInterface $body, $lineno, $tag = null) + { + parent::__construct(['body' => $body], ['name' => $name], $lineno, $tag); + } -if (\false) { - class BlockNode extends \Twig_Node_Block + public function compile(Compiler $compiler) { + $compiler + ->addDebugInfo($this) + ->write(sprintf("public function block_%s(\$context, array \$blocks = [])\n", $this->getAttribute('name')), "{\n") + ->indent() + ; + + $compiler + ->subcompile($this->getNode('body')) + ->outdent() + ->write("}\n\n") + ; } } + +class_alias('Twig\Node\BlockNode', 'Twig_Node_Block'); diff --git a/vendor/twig/twig/src/Node/BlockReferenceNode.php b/vendor/twig/twig/src/Node/BlockReferenceNode.php index 87bdd1f93de2527b2b83832d79ee49a93ac1751e..de069093f6611daabfc4e162405c2f6d31a64d31 100644 --- a/vendor/twig/twig/src/Node/BlockReferenceNode.php +++ b/vendor/twig/twig/src/Node/BlockReferenceNode.php @@ -1,11 +1,38 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node; -class_exists('Twig_Node_BlockReference'); +use Twig\Compiler; -if (\false) { - class BlockReferenceNode extends \Twig_Node_BlockReference +/** + * Represents a block call node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class BlockReferenceNode extends Node implements NodeOutputInterface +{ + public function __construct($name, $lineno, $tag = null) { + parent::__construct([], ['name' => $name], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name'))) + ; } } + +class_alias('Twig\Node\BlockReferenceNode', 'Twig_Node_BlockReference'); diff --git a/vendor/twig/twig/src/Node/BodyNode.php b/vendor/twig/twig/src/Node/BodyNode.php index 013bda3b506079dfe5dbfcd939433fa3c714c457..5290be56db6739abb0bd41032300c18f4d4cfa58 100644 --- a/vendor/twig/twig/src/Node/BodyNode.php +++ b/vendor/twig/twig/src/Node/BodyNode.php @@ -1,11 +1,23 @@ <?php -namespace Twig\Node; +/* + * 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. + */ -class_exists('Twig_Node_Body'); +namespace Twig\Node; -if (\false) { - class BodyNode extends \Twig_Node_Body - { - } +/** + * Represents a body node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class BodyNode extends Node +{ } + +class_alias('Twig\Node\BodyNode', 'Twig_Node_Body'); diff --git a/vendor/twig/twig/src/Node/CheckSecurityNode.php b/vendor/twig/twig/src/Node/CheckSecurityNode.php index 6510086baf8c3e7b7d5cc92aa0a9fedd37b56904..cf0a7a13d8acd376a04111386241551e3b30c252 100644 --- a/vendor/twig/twig/src/Node/CheckSecurityNode.php +++ b/vendor/twig/twig/src/Node/CheckSecurityNode.php @@ -1,11 +1,85 @@ <?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\Node; -class_exists('Twig_Node_CheckSecurity'); +use Twig\Compiler; + +/** + * @author Fabien Potencier <fabien@symfony.com> + */ +class CheckSecurityNode extends Node +{ + protected $usedFilters; + protected $usedTags; + protected $usedFunctions; + + public function __construct(array $usedFilters, array $usedTags, array $usedFunctions) + { + $this->usedFilters = $usedFilters; + $this->usedTags = $usedTags; + $this->usedFunctions = $usedFunctions; + + parent::__construct(); + } -if (\false) { - class CheckSecurityNode extends \Twig_Node_CheckSecurity + public function compile(Compiler $compiler) { + $tags = $filters = $functions = []; + foreach (['tags', 'filters', 'functions'] as $type) { + foreach ($this->{'used'.ucfirst($type)} as $name => $node) { + if ($node instanceof Node) { + ${$type}[$name] = $node->getTemplateLine(); + } else { + ${$type}[$node] = null; + } + } + } + + $compiler + ->write("\$this->sandbox = \$this->env->getExtension('\Twig\Extension\SandboxExtension');\n") + ->write('$tags = ')->repr(array_filter($tags))->raw(";\n") + ->write('$filters = ')->repr(array_filter($filters))->raw(";\n") + ->write('$functions = ')->repr(array_filter($functions))->raw(";\n\n") + ->write("try {\n") + ->indent() + ->write("\$this->sandbox->checkSecurity(\n") + ->indent() + ->write(!$tags ? "[],\n" : "['".implode("', '", array_keys($tags))."'],\n") + ->write(!$filters ? "[],\n" : "['".implode("', '", array_keys($filters))."'],\n") + ->write(!$functions ? "[]\n" : "['".implode("', '", array_keys($functions))."']\n") + ->outdent() + ->write(");\n") + ->outdent() + ->write("} catch (SecurityError \$e) {\n") + ->indent() + ->write("\$e->setSourceContext(\$this->getSourceContext());\n\n") + ->write("if (\$e instanceof SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {\n") + ->indent() + ->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n") + ->outdent() + ->write("} elseif (\$e instanceof SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {\n") + ->indent() + ->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n") + ->outdent() + ->write("} elseif (\$e instanceof SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {\n") + ->indent() + ->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n") + ->outdent() + ->write("}\n\n") + ->write("throw \$e;\n") + ->outdent() + ->write("}\n\n") + ; } } + +class_alias('Twig\Node\CheckSecurityNode', 'Twig_Node_CheckSecurity'); diff --git a/vendor/twig/twig/src/Node/CheckToStringNode.php b/vendor/twig/twig/src/Node/CheckToStringNode.php new file mode 100644 index 0000000000000000000000000000000000000000..464c96fbae84596cab8b5cd942247c5cfffe43a2 --- /dev/null +++ b/vendor/twig/twig/src/Node/CheckToStringNode.php @@ -0,0 +1,42 @@ +<?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\Node; + +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; + +/** + * Checks if casting an expression to __toString() is allowed by the sandbox. + * + * For instance, when there is a simple Print statement, like {{ article }}, + * and if the sandbox is enabled, we need to check that the __toString() + * method is allowed if 'article' is an object. The same goes for {{ article|upper }} + * or {{ random(article) }} + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class CheckToStringNode extends Node +{ + public function __construct(AbstractExpression $expr) + { + parent::__construct(['expr' => $expr], [], $expr->getTemplateLine(), $expr->getNodeTag()); + } + + public function compile(Compiler $compiler) + { + $compiler + ->raw('$this->sandbox->ensureToStringAllowed(') + ->subcompile($this->getNode('expr')) + ->raw(')') + ; + } +} diff --git a/vendor/twig/twig/src/Node/DeprecatedNode.php b/vendor/twig/twig/src/Node/DeprecatedNode.php new file mode 100644 index 0000000000000000000000000000000000000000..62c0dd4ba51ab61cea0295a4c46e65806c687901 --- /dev/null +++ b/vendor/twig/twig/src/Node/DeprecatedNode.php @@ -0,0 +1,55 @@ +<?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\Node; + +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; +use Twig\Node\Expression\ConstantExpression; + +/** + * Represents a deprecated node. + * + * @author Yonel Ceruto <yonelceruto@gmail.com> + */ +class DeprecatedNode extends Node +{ + public function __construct(AbstractExpression $expr, $lineno, $tag = null) + { + parent::__construct(['expr' => $expr], [], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler->addDebugInfo($this); + + $expr = $this->getNode('expr'); + + if ($expr instanceof ConstantExpression) { + $compiler->write('@trigger_error(') + ->subcompile($expr); + } else { + $varName = $compiler->getVarName(); + $compiler->write(sprintf('$%s = ', $varName)) + ->subcompile($expr) + ->raw(";\n") + ->write(sprintf('@trigger_error($%s', $varName)); + } + + $compiler + ->raw('.') + ->string(sprintf(' ("%s" at line %d).', $this->getTemplateName(), $this->getTemplateLine())) + ->raw(", E_USER_DEPRECATED);\n") + ; + } +} + +class_alias('Twig\Node\DeprecatedNode', 'Twig_Node_Deprecated'); diff --git a/vendor/twig/twig/src/Node/DoNode.php b/vendor/twig/twig/src/Node/DoNode.php index 1a972ff35557aa4c1ede6ed4d149657a130d21c6..80c4cea79ec3b914d3297595011012cc98f4f9a8 100644 --- a/vendor/twig/twig/src/Node/DoNode.php +++ b/vendor/twig/twig/src/Node/DoNode.php @@ -1,11 +1,40 @@ <?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\Node; -class_exists('Twig_Node_Do'); +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; -if (\false) { - class DoNode extends \Twig_Node_Do +/** + * Represents a do node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class DoNode extends Node +{ + public function __construct(AbstractExpression $expr, $lineno, $tag = null) { + parent::__construct(['expr' => $expr], [], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('') + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ; } } + +class_alias('Twig\Node\DoNode', 'Twig_Node_Do'); diff --git a/vendor/twig/twig/src/Node/EmbedNode.php b/vendor/twig/twig/src/Node/EmbedNode.php index 960942393e10bf9ff46c39cdb26bba8b2dea3090..05051ecec8a92d854ea52175fce55967fe928100 100644 --- a/vendor/twig/twig/src/Node/EmbedNode.php +++ b/vendor/twig/twig/src/Node/EmbedNode.php @@ -1,11 +1,52 @@ <?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\Node; -class_exists('Twig_Node_Embed'); +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; +use Twig\Node\Expression\ConstantExpression; + +/** + * Represents an embed node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class EmbedNode extends IncludeNode +{ + // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module) + public function __construct($name, $index, AbstractExpression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) + { + parent::__construct(new ConstantExpression('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag); + + $this->setAttribute('name', $name); + // to be removed in 2.0, used name instead + $this->setAttribute('filename', $name); + $this->setAttribute('index', $index); + } -if (\false) { - class EmbedNode extends \Twig_Node_Embed + protected function addGetTemplate(Compiler $compiler) { + $compiler + ->write('$this->loadTemplate(') + ->string($this->getAttribute('name')) + ->raw(', ') + ->repr($this->getTemplateName()) + ->raw(', ') + ->repr($this->getTemplateLine()) + ->raw(', ') + ->string($this->getAttribute('index')) + ->raw(')') + ; } } + +class_alias('Twig\Node\EmbedNode', 'Twig_Node_Embed'); diff --git a/vendor/twig/twig/src/Node/Expression/AbstractExpression.php b/vendor/twig/twig/src/Node/Expression/AbstractExpression.php index 1fdbea85e799c761198d98322721cfa5626ec49e..a3528924ca044c8f00f15279221570a3d20dfd62 100644 --- a/vendor/twig/twig/src/Node/Expression/AbstractExpression.php +++ b/vendor/twig/twig/src/Node/Expression/AbstractExpression.php @@ -1,11 +1,26 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression; -class_exists('Twig_Node_Expression'); +use Twig\Node\Node; -if (\false) { - class AbstractExpression extends \Twig_Node_Expression - { - } +/** + * Abstract class for all nodes that represents an expression. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +abstract class AbstractExpression extends Node +{ } + +class_alias('Twig\Node\Expression\AbstractExpression', 'Twig_Node_Expression'); diff --git a/vendor/twig/twig/src/Node/Expression/ArrayExpression.php b/vendor/twig/twig/src/Node/Expression/ArrayExpression.php index c408657965db08811d085a073171242b24c3b030..cd63f934e4febdcb75680fe551af61927e5453e1 100644 --- a/vendor/twig/twig/src/Node/Expression/ArrayExpression.php +++ b/vendor/twig/twig/src/Node/Expression/ArrayExpression.php @@ -1,11 +1,88 @@ <?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\Node\Expression; -class_exists('Twig_Node_Expression_Array'); +use Twig\Compiler; + +class ArrayExpression extends AbstractExpression +{ + protected $index; -if (\false) { - class ArrayExpression extends \Twig_Node_Expression_Array + public function __construct(array $elements, $lineno) { + parent::__construct($elements, [], $lineno); + + $this->index = -1; + foreach ($this->getKeyValuePairs() as $pair) { + if ($pair['key'] instanceof ConstantExpression && ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) { + $this->index = $pair['key']->getAttribute('value'); + } + } + } + + public function getKeyValuePairs() + { + $pairs = []; + + foreach (array_chunk($this->nodes, 2) as $pair) { + $pairs[] = [ + 'key' => $pair[0], + 'value' => $pair[1], + ]; + } + + return $pairs; + } + + public function hasElement(AbstractExpression $key) + { + foreach ($this->getKeyValuePairs() as $pair) { + // we compare the string representation of the keys + // to avoid comparing the line numbers which are not relevant here. + if ((string) $key === (string) $pair['key']) { + return true; + } + } + + return false; + } + + public function addElement(AbstractExpression $value, AbstractExpression $key = null) + { + if (null === $key) { + $key = new ConstantExpression(++$this->index, $value->getTemplateLine()); + } + + array_push($this->nodes, $key, $value); + } + + public function compile(Compiler $compiler) + { + $compiler->raw('['); + $first = true; + foreach ($this->getKeyValuePairs() as $pair) { + if (!$first) { + $compiler->raw(', '); + } + $first = false; + + $compiler + ->subcompile($pair['key']) + ->raw(' => ') + ->subcompile($pair['value']) + ; + } + $compiler->raw(']'); } } + +class_alias('Twig\Node\Expression\ArrayExpression', 'Twig_Node_Expression_Array'); diff --git a/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php b/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php index f1cd3a1a8446b627fd3b812498dcadc818fdcffb..62c4ac0b48fbeb696df55a12a8b6c90581b57315 100644 --- a/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php +++ b/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php @@ -1,11 +1,29 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression; -class_exists('Twig_Node_Expression_AssignName'); +use Twig\Compiler; -if (\false) { - class AssignNameExpression extends \Twig_Node_Expression_AssignName +class AssignNameExpression extends NameExpression +{ + public function compile(Compiler $compiler) { + $compiler + ->raw('$context[') + ->string($this->getAttribute('name')) + ->raw(']') + ; } } + +class_alias('Twig\Node\Expression\AssignNameExpression', 'Twig_Node_Expression_AssignName'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php index 7462a8cf61053aee81d9ca289fa57d7c76da290f..0600aeedbb704438246d1b5ae04eb3ff62443de9 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php @@ -1,11 +1,43 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary'); +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; + +abstract class AbstractBinary extends AbstractExpression +{ + public function __construct(\Twig_NodeInterface $left, \Twig_NodeInterface $right, $lineno) + { + parent::__construct(['left' => $left, 'right' => $right], [], $lineno); + } -if (\false) { - class AbstractBinary extends \Twig_Node_Expression_Binary + public function compile(Compiler $compiler) { + $compiler + ->raw('(') + ->subcompile($this->getNode('left')) + ->raw(' ') + ; + $this->operator($compiler); + $compiler + ->raw(' ') + ->subcompile($this->getNode('right')) + ->raw(')') + ; } + + abstract public function operator(Compiler $compiler); } + +class_alias('Twig\Node\Expression\Binary\AbstractBinary', 'Twig_Node_Expression_Binary'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php index 9bb84168b11b05cb9fec346e0cec9af40d91eafb..f7719a19ea2af51160ebaba612c7833887cfc797 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Add'); +use Twig\Compiler; -if (\false) { - class AddBinary extends \Twig_Node_Expression_Binary_Add +class AddBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('+'); } } + +class_alias('Twig\Node\Expression\Binary\AddBinary', 'Twig_Node_Expression_Binary_Add'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php index 06034a60bac5aa1ca7196fc42fa79fc40a2b7c8a..484597da77d2407143b06bebe47e169f24641961 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_And'); +use Twig\Compiler; -if (\false) { - class AndBinary extends \Twig_Node_Expression_Binary_And +class AndBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('&&'); } } + +class_alias('Twig\Node\Expression\Binary\AndBinary', 'Twig_Node_Expression_Binary_And'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php index da98ce061deec48cdc2bd071d2293700fbadf367..cf286912b28bbfdf3b9772fb1e300f17d5c56794 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_BitwiseAnd'); +use Twig\Compiler; -if (\false) { - class BitwiseAndBinary extends \Twig_Node_Expression_Binary_BitwiseAnd +class BitwiseAndBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('&'); } } + +class_alias('Twig\Node\Expression\Binary\BitwiseAndBinary', 'Twig_Node_Expression_Binary_BitwiseAnd'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php index 16b434c4d33b938fdbb74369ce2a1a513abf881d..7d5d260079999987afc2d2ae1517875c0f3636b2 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_BitwiseOr'); +use Twig\Compiler; -if (\false) { - class BitwiseOrBinary extends \Twig_Node_Expression_Binary_BitwiseOr +class BitwiseOrBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('|'); } } + +class_alias('Twig\Node\Expression\Binary\BitwiseOrBinary', 'Twig_Node_Expression_Binary_BitwiseOr'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php index ee6a6880a89abd0e66a149f213c4fcec4f37ffb8..729198719528b97b0ab508318cd7fe2647b1eb66 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_BitwiseXor'); +use Twig\Compiler; -if (\false) { - class BitwiseXorBinary extends \Twig_Node_Expression_Binary_BitwiseXor +class BitwiseXorBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('^'); } } + +class_alias('Twig\Node\Expression\Binary\BitwiseXorBinary', 'Twig_Node_Expression_Binary_BitwiseXor'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php index 29dfda34082e3298dc14e80983e2494df4236ff6..f6e5938fdd1d9be7ec0fa32327901b72f9c14be3 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Concat'); +use Twig\Compiler; -if (\false) { - class ConcatBinary extends \Twig_Node_Expression_Binary_Concat +class ConcatBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('.'); } } + +class_alias('Twig\Node\Expression\Binary\ConcatBinary', 'Twig_Node_Expression_Binary_Concat'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php index 7326bde69f7628479bd71c520b7bd98ea5de804b..ebfcc758b6576c6334448561d35bf44ec72a487d 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Div'); +use Twig\Compiler; -if (\false) { - class DivBinary extends \Twig_Node_Expression_Binary_Div +class DivBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('/'); } } + +class_alias('Twig\Node\Expression\Binary\DivBinary', 'Twig_Node_Expression_Binary_Div'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php index 9845ad163b8f8937b37b1cdabfe2d51d5d2c69e2..41a0065bbc69b83b66c1b1cce3d4e03a8ccc4c20 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php @@ -1,11 +1,37 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_EndsWith'); +use Twig\Compiler; -if (\false) { - class EndsWithBinary extends \Twig_Node_Expression_Binary_EndsWith +class EndsWithBinary extends AbstractBinary +{ + public function compile(Compiler $compiler) { + $left = $compiler->getVarName(); + $right = $compiler->getVarName(); + $compiler + ->raw(sprintf('(is_string($%s = ', $left)) + ->subcompile($this->getNode('left')) + ->raw(sprintf(') && is_string($%s = ', $right)) + ->subcompile($this->getNode('right')) + ->raw(sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right)) + ; + } + + public function operator(Compiler $compiler) + { + return $compiler->raw(''); } } + +class_alias('Twig\Node\Expression\Binary\EndsWithBinary', 'Twig_Node_Expression_Binary_EndsWith'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php index 97e4889a7524127fb8ade6719ed54771b2c8f6a8..84904c364ae3000323d8b793da0d58cb36ea807a 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php @@ -1,11 +1,24 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Equal'); +use Twig\Compiler; -if (\false) { - class EqualBinary extends \Twig_Node_Expression_Binary_Equal +class EqualBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('=='); } } + +class_alias('Twig\Node\Expression\Binary\EqualBinary', 'Twig_Node_Expression_Binary_Equal'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php index 9e8676f49afc2ea574b16ce0f6713e66baeabe0e..4dd5e3d32b749cb805e9285fc9d43b692ce2efde 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php @@ -1,11 +1,31 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_FloorDiv'); +use Twig\Compiler; -if (\false) { - class FloorDivBinary extends \Twig_Node_Expression_Binary_FloorDiv +class FloorDivBinary extends AbstractBinary +{ + public function compile(Compiler $compiler) { + $compiler->raw('(int) floor('); + parent::compile($compiler); + $compiler->raw(')'); + } + + public function operator(Compiler $compiler) + { + return $compiler->raw('/'); } } + +class_alias('Twig\Node\Expression\Binary\FloorDivBinary', 'Twig_Node_Expression_Binary_FloorDiv'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php index 8dde9d2a97675c800e7e76029f8fb53a230575b3..be73001e5b9ad45d4701cff4448bb705adf97f43 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php @@ -1,11 +1,24 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Greater'); +use Twig\Compiler; -if (\false) { - class GreaterBinary extends \Twig_Node_Expression_Binary_Greater +class GreaterBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('>'); } } + +class_alias('Twig\Node\Expression\Binary\GreaterBinary', 'Twig_Node_Expression_Binary_Greater'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php index 455f6d840efd031b79e8cf070774e13f02cd7666..5c2ae72ee23f669ffa487c3790bade772f398122 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php @@ -1,11 +1,24 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_GreaterEqual'); +use Twig\Compiler; -if (\false) { - class GreaterEqualBinary extends \Twig_Node_Expression_Binary_GreaterEqual +class GreaterEqualBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('>='); } } + +class_alias('Twig\Node\Expression\Binary\GreaterEqualBinary', 'Twig_Node_Expression_Binary_GreaterEqual'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php index 3e3cf2fe3eb476169bd4b5f56c464bd2c249804a..f00b23060f8e76cabfe709e5412ac246d6db277f 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php @@ -1,11 +1,35 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_In'); +use Twig\Compiler; -if (\false) { - class InBinary extends \Twig_Node_Expression_Binary_In +class InBinary extends AbstractBinary +{ + public function compile(Compiler $compiler) { + $compiler + ->raw('twig_in_filter(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw(')') + ; + } + + public function operator(Compiler $compiler) + { + return $compiler->raw('in'); } } + +class_alias('Twig\Node\Expression\Binary\InBinary', 'Twig_Node_Expression_Binary_In'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php index 84bcfe6b3bba3f0a09b5e4b9c745c303aea4d3e2..2b202daa72873ebaf400349d9b152f8cbda0a6f4 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php @@ -1,11 +1,24 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Less'); +use Twig\Compiler; -if (\false) { - class LessBinary extends \Twig_Node_Expression_Binary_Less +class LessBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('<'); } } + +class_alias('Twig\Node\Expression\Binary\LessBinary', 'Twig_Node_Expression_Binary_Less'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php index 0f3018a4c3c263223f8359680b2b973e843836c1..4fffafea6dccce1320e06cb418968e67d860cd5f 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php @@ -1,11 +1,24 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_LessEqual'); +use Twig\Compiler; -if (\false) { - class LessEqualBinary extends \Twig_Node_Expression_Binary_LessEqual +class LessEqualBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('<='); } } + +class_alias('Twig\Node\Expression\Binary\LessEqualBinary', 'Twig_Node_Expression_Binary_LessEqual'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php index d8b039a7792aaadfe2d562e2ef90e1216e80edf0..ae810b2664a859b851c3ee941b530b5e378ad855 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php @@ -1,11 +1,35 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Matches'); +use Twig\Compiler; -if (\false) { - class MatchesBinary extends \Twig_Node_Expression_Binary_Matches +class MatchesBinary extends AbstractBinary +{ + public function compile(Compiler $compiler) { + $compiler + ->raw('preg_match(') + ->subcompile($this->getNode('right')) + ->raw(', ') + ->subcompile($this->getNode('left')) + ->raw(')') + ; + } + + public function operator(Compiler $compiler) + { + return $compiler->raw(''); } } + +class_alias('Twig\Node\Expression\Binary\MatchesBinary', 'Twig_Node_Expression_Binary_Matches'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php index d39d5a4674e0303446b2f03622f43626355ac004..e6a2b360346a89f0d0752c0d364a6289f31e0932 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Mod'); +use Twig\Compiler; -if (\false) { - class ModBinary extends \Twig_Node_Expression_Binary_Mod +class ModBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('%'); } } + +class_alias('Twig\Node\Expression\Binary\ModBinary', 'Twig_Node_Expression_Binary_Mod'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php index 46d6d3f61fdd94c2a72bad56e62800104e843bb4..cd65f5dff2d01c78e0b2dc868c28f7501c7c4656 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Mul'); +use Twig\Compiler; -if (\false) { - class MulBinary extends \Twig_Node_Expression_Binary_Mul +class MulBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('*'); } } + +class_alias('Twig\Node\Expression\Binary\MulBinary', 'Twig_Node_Expression_Binary_Mul'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php index 09a546fd9afbec8a74ba565dd57cde0c6b615b08..df5c6a23884d7ed740a287cd9bae52eb6b67e727 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php @@ -1,11 +1,24 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_NotEqual'); +use Twig\Compiler; -if (\false) { - class NotEqualBinary extends \Twig_Node_Expression_Binary_NotEqual +class NotEqualBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('!='); } } + +class_alias('Twig\Node\Expression\Binary\NotEqualBinary', 'Twig_Node_Expression_Binary_NotEqual'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php index 3ef89954ced8e770f5275a48ca68a6bf486f2f00..ed2034e35ad3d36a777589173d4c35d3157f87f9 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php @@ -1,11 +1,35 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_NotIn'); +use Twig\Compiler; -if (\false) { - class NotInBinary extends \Twig_Node_Expression_Binary_NotIn +class NotInBinary extends AbstractBinary +{ + public function compile(Compiler $compiler) { + $compiler + ->raw('!twig_in_filter(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw(')') + ; + } + + public function operator(Compiler $compiler) + { + return $compiler->raw('not in'); } } + +class_alias('Twig\Node\Expression\Binary\NotInBinary', 'Twig_Node_Expression_Binary_NotIn'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php index f0311fd26f1ca8de13ad2844105b2caf43d94768..8f9da43105c32adb60b6cf4e7e9781197c5ffb6f 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Or'); +use Twig\Compiler; -if (\false) { - class OrBinary extends \Twig_Node_Expression_Binary_Or +class OrBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('||'); } } + +class_alias('Twig\Node\Expression\Binary\OrBinary', 'Twig_Node_Expression_Binary_Or'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php index f4033cb12eed42d350034db4ec4086670b3c1cac..10a8d94cfe879a864750ead07431f494d8f94fa5 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php @@ -1,11 +1,39 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Power'); +use Twig\Compiler; + +class PowerBinary extends AbstractBinary +{ + public function compile(Compiler $compiler) + { + if (\PHP_VERSION_ID >= 50600) { + return parent::compile($compiler); + } + + $compiler + ->raw('pow(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw(')') + ; + } -if (\false) { - class PowerBinary extends \Twig_Node_Expression_Binary_Power + public function operator(Compiler $compiler) { + return $compiler->raw('**'); } } + +class_alias('Twig\Node\Expression\Binary\PowerBinary', 'Twig_Node_Expression_Binary_Power'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php index 7ffe00a05ee273461ee24ffbe347541f5a06f2f5..e9c0cdf5e4131a57e32cf46460045c1f892e39be 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php @@ -1,11 +1,35 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Range'); +use Twig\Compiler; -if (\false) { - class RangeBinary extends \Twig_Node_Expression_Binary_Range +class RangeBinary extends AbstractBinary +{ + public function compile(Compiler $compiler) { + $compiler + ->raw('range(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw(')') + ; + } + + public function operator(Compiler $compiler) + { + return $compiler->raw('..'); } } + +class_alias('Twig\Node\Expression\Binary\RangeBinary', 'Twig_Node_Expression_Binary_Range'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php index 3548ce47d4f5eb4f9f20da1055d2159886c2e2bb..1fe59fb417385fd257731c520e58f61679c7e37d 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php @@ -1,11 +1,37 @@ <?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\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_StartsWith'); +use Twig\Compiler; -if (\false) { - class StartsWithBinary extends \Twig_Node_Expression_Binary_StartsWith +class StartsWithBinary extends AbstractBinary +{ + public function compile(Compiler $compiler) { + $left = $compiler->getVarName(); + $right = $compiler->getVarName(); + $compiler + ->raw(sprintf('(is_string($%s = ', $left)) + ->subcompile($this->getNode('left')) + ->raw(sprintf(') && is_string($%s = ', $right)) + ->subcompile($this->getNode('right')) + ->raw(sprintf(') && (\'\' === $%2$s || 0 === strpos($%1$s, $%2$s)))', $left, $right)) + ; + } + + public function operator(Compiler $compiler) + { + return $compiler->raw(''); } } + +class_alias('Twig\Node\Expression\Binary\StartsWithBinary', 'Twig_Node_Expression_Binary_StartsWith'); diff --git a/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php index 1bd35cc3f2db7740fa3928007d4fa7554d6f93f5..25469750aa0ca580446ec92b1127984314b6da24 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Binary; -class_exists('Twig_Node_Expression_Binary_Sub'); +use Twig\Compiler; -if (\false) { - class SubBinary extends \Twig_Node_Expression_Binary_Sub +class SubBinary extends AbstractBinary +{ + public function operator(Compiler $compiler) { + return $compiler->raw('-'); } } + +class_alias('Twig\Node\Expression\Binary\SubBinary', 'Twig_Node_Expression_Binary_Sub'); diff --git a/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php b/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php index 4d4439e35fb2a5f605de678de81da653201de90a..0a56849c7aade3b92390524bf64dbc5c420845c2 100644 --- a/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php +++ b/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php @@ -1,11 +1,98 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression; -class_exists('Twig_Node_Expression_BlockReference'); +use Twig\Compiler; +use Twig\Node\Node; + +/** + * Represents a block call node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class BlockReferenceExpression extends AbstractExpression +{ + /** + * @param Node|null $template + */ + public function __construct(\Twig_NodeInterface $name, $template = null, $lineno, $tag = null) + { + if (\is_bool($template)) { + @trigger_error(sprintf('The %s method "$asString" argument is deprecated since version 1.28 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED); + + $template = null; + } + + $nodes = ['name' => $name]; + if (null !== $template) { + $nodes['template'] = $template; + } -if (\false) { - class BlockReferenceExpression extends \Twig_Node_Expression_BlockReference + parent::__construct($nodes, ['is_defined_test' => false, 'output' => false], $lineno, $tag); + } + + public function compile(Compiler $compiler) { + if ($this->getAttribute('is_defined_test')) { + $this->compileTemplateCall($compiler, 'hasBlock'); + } else { + if ($this->getAttribute('output')) { + $compiler->addDebugInfo($this); + + $this + ->compileTemplateCall($compiler, 'displayBlock') + ->raw(";\n"); + } else { + $this->compileTemplateCall($compiler, 'renderBlock'); + } + } + } + + private function compileTemplateCall(Compiler $compiler, $method) + { + if (!$this->hasNode('template')) { + $compiler->write('$this'); + } else { + $compiler + ->write('$this->loadTemplate(') + ->subcompile($this->getNode('template')) + ->raw(', ') + ->repr($this->getTemplateName()) + ->raw(', ') + ->repr($this->getTemplateLine()) + ->raw(')') + ; + } + + $compiler->raw(sprintf('->%s', $method)); + $this->compileBlockArguments($compiler); + + return $compiler; + } + + private function compileBlockArguments(Compiler $compiler) + { + $compiler + ->raw('(') + ->subcompile($this->getNode('name')) + ->raw(', $context'); + + if (!$this->hasNode('template')) { + $compiler->raw(', $blocks'); + } + + return $compiler->raw(')'); } } + +class_alias('Twig\Node\Expression\BlockReferenceExpression', 'Twig_Node_Expression_BlockReference'); diff --git a/vendor/twig/twig/src/Node/Expression/CallExpression.php b/vendor/twig/twig/src/Node/Expression/CallExpression.php index f9af30b2933fd8d67a71558a06ee38501190687d..162393bdfa6fe7aeafdbc6a45993fcc9e1a83f40 100644 --- a/vendor/twig/twig/src/Node/Expression/CallExpression.php +++ b/vendor/twig/twig/src/Node/Expression/CallExpression.php @@ -1,11 +1,301 @@ <?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\Node\Expression; -class_exists('Twig_Node_Expression_Call'); +use Twig\Compiler; +use Twig\Error\SyntaxError; +use Twig\Extension\ExtensionInterface; +use Twig\Node\Node; + +abstract class CallExpression extends AbstractExpression +{ + private $reflector; + + protected function compileCallable(Compiler $compiler) + { + $closingParenthesis = false; + $isArray = false; + if ($this->hasAttribute('callable') && $callable = $this->getAttribute('callable')) { + if (\is_string($callable) && false === strpos($callable, '::')) { + $compiler->raw($callable); + } else { + list($r, $callable) = $this->reflectCallable($callable); + if ($r instanceof \ReflectionMethod && \is_string($callable[0])) { + if ($r->isStatic()) { + $compiler->raw(sprintf('%s::%s', $callable[0], $callable[1])); + } else { + $compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1])); + } + } elseif ($r instanceof \ReflectionMethod && $callable[0] instanceof ExtensionInterface) { + $compiler->raw(sprintf('$this->env->getExtension(\'%s\')->%s', \get_class($callable[0]), $callable[1])); + } else { + $type = ucfirst($this->getAttribute('type')); + $compiler->raw(sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), ', $type, $this->getAttribute('name'))); + $closingParenthesis = true; + $isArray = true; + } + } + } else { + $compiler->raw($this->getAttribute('thing')->compile()); + } + + $this->compileArguments($compiler, $isArray); + + if ($closingParenthesis) { + $compiler->raw(')'); + } + } + + protected function compileArguments(Compiler $compiler, $isArray = false) + { + $compiler->raw($isArray ? '[' : '('); + + $first = true; + + if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { + $compiler->raw('$this->env'); + $first = false; + } + + if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->raw('$context'); + $first = false; + } + + if ($this->hasAttribute('arguments')) { + foreach ($this->getAttribute('arguments') as $argument) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->string($argument); + $first = false; + } + } + + if ($this->hasNode('node')) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->subcompile($this->getNode('node')); + $first = false; + } + + if ($this->hasNode('arguments')) { + $callable = $this->hasAttribute('callable') ? $this->getAttribute('callable') : null; + + $arguments = $this->getArguments($callable, $this->getNode('arguments')); + + foreach ($arguments as $node) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->subcompile($node); + $first = false; + } + } + + $compiler->raw($isArray ? ']' : ')'); + } + + protected function getArguments($callable, $arguments) + { + $callType = $this->getAttribute('type'); + $callName = $this->getAttribute('name'); + + $parameters = []; + $named = false; + foreach ($arguments as $name => $node) { + if (!\is_int($name)) { + $named = true; + $name = $this->normalizeName($name); + } elseif ($named) { + throw new SyntaxError(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName), $this->getTemplateLine(), null, null, false); + } + + $parameters[$name] = $node; + } + + $isVariadic = $this->hasAttribute('is_variadic') && $this->getAttribute('is_variadic'); + if (!$named && !$isVariadic) { + return $parameters; + } -if (\false) { - class CallExpression extends \Twig_Node_Expression_Call + if (!$callable) { + if ($named) { + $message = sprintf('Named arguments are not supported for %s "%s".', $callType, $callName); + } else { + $message = sprintf('Arbitrary positional arguments are not supported for %s "%s".', $callType, $callName); + } + + throw new \LogicException($message); + } + + $callableParameters = $this->getCallableParameters($callable, $isVariadic); + $arguments = []; + $names = []; + $missingArguments = []; + $optionalArguments = []; + $pos = 0; + foreach ($callableParameters as $callableParameter) { + $names[] = $name = $this->normalizeName($callableParameter->name); + + if (\array_key_exists($name, $parameters)) { + if (\array_key_exists($pos, $parameters)) { + throw new SyntaxError(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName), $this->getTemplateLine(), null, null, false); + } + + if (\count($missingArguments)) { + throw new SyntaxError(sprintf( + 'Argument "%s" could not be assigned for %s "%s(%s)" because it is mapped to an internal PHP function which cannot determine default value for optional argument%s "%s".', + $name, $callType, $callName, implode(', ', $names), \count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments) + ), $this->getTemplateLine(), null, null, false); + } + + $arguments = array_merge($arguments, $optionalArguments); + $arguments[] = $parameters[$name]; + unset($parameters[$name]); + $optionalArguments = []; + } elseif (\array_key_exists($pos, $parameters)) { + $arguments = array_merge($arguments, $optionalArguments); + $arguments[] = $parameters[$pos]; + unset($parameters[$pos]); + $optionalArguments = []; + ++$pos; + } elseif ($callableParameter->isDefaultValueAvailable()) { + $optionalArguments[] = new ConstantExpression($callableParameter->getDefaultValue(), -1); + } elseif ($callableParameter->isOptional()) { + if (empty($parameters)) { + break; + } else { + $missingArguments[] = $name; + } + } else { + throw new SyntaxError(sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName), $this->getTemplateLine(), null, null, false); + } + } + + if ($isVariadic) { + $arbitraryArguments = new ArrayExpression([], -1); + foreach ($parameters as $key => $value) { + if (\is_int($key)) { + $arbitraryArguments->addElement($value); + } else { + $arbitraryArguments->addElement($value, new ConstantExpression($key, -1)); + } + unset($parameters[$key]); + } + + if ($arbitraryArguments->count()) { + $arguments = array_merge($arguments, $optionalArguments); + $arguments[] = $arbitraryArguments; + } + } + + if (!empty($parameters)) { + $unknownParameter = null; + foreach ($parameters as $parameter) { + if ($parameter instanceof Node) { + $unknownParameter = $parameter; + break; + } + } + + throw new SyntaxError(sprintf( + 'Unknown argument%s "%s" for %s "%s(%s)".', + \count($parameters) > 1 ? 's' : '', implode('", "', array_keys($parameters)), $callType, $callName, implode(', ', $names) + ), $unknownParameter ? $unknownParameter->getTemplateLine() : $this->getTemplateLine(), null, null, false); + } + + return $arguments; + } + + protected function normalizeName($name) { + return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $name)); + } + + private function getCallableParameters($callable, $isVariadic) + { + list($r) = $this->reflectCallable($callable); + if (null === $r) { + return []; + } + + $parameters = $r->getParameters(); + if ($this->hasNode('node')) { + array_shift($parameters); + } + if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { + array_shift($parameters); + } + if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { + array_shift($parameters); + } + if ($this->hasAttribute('arguments') && null !== $this->getAttribute('arguments')) { + foreach ($this->getAttribute('arguments') as $argument) { + array_shift($parameters); + } + } + if ($isVariadic) { + $argument = end($parameters); + if ($argument && $argument->isArray() && $argument->isDefaultValueAvailable() && [] === $argument->getDefaultValue()) { + array_pop($parameters); + } else { + $callableName = $r->name; + if ($r instanceof \ReflectionMethod) { + $callableName = $r->getDeclaringClass()->name.'::'.$callableName; + } + + throw new \LogicException(sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = []".', $callableName, $this->getAttribute('type'), $this->getAttribute('name'))); + } + } + + return $parameters; + } + + private function reflectCallable($callable) + { + if (null !== $this->reflector) { + return $this->reflector; + } + + if (\is_array($callable)) { + if (!method_exists($callable[0], $callable[1])) { + // __call() + return [null, []]; + } + $r = new \ReflectionMethod($callable[0], $callable[1]); + } elseif (\is_object($callable) && !$callable instanceof \Closure) { + $r = new \ReflectionObject($callable); + $r = $r->getMethod('__invoke'); + $callable = [$callable, '__invoke']; + } elseif (\is_string($callable) && false !== $pos = strpos($callable, '::')) { + $class = substr($callable, 0, $pos); + $method = substr($callable, $pos + 2); + if (!method_exists($class, $method)) { + // __staticCall() + return [null, []]; + } + $r = new \ReflectionMethod($callable); + $callable = [$class, $method]; + } else { + $r = new \ReflectionFunction($callable); + } + + return $this->reflector = [$r, $callable]; } } + +class_alias('Twig\Node\Expression\CallExpression', 'Twig_Node_Expression_Call'); diff --git a/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php b/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php index 507d085e020913a3d81374cf794f46acdc8f3f7f..b611218d31b862180a15be20d147ed591364efef 100644 --- a/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php +++ b/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php @@ -1,11 +1,38 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression; -class_exists('Twig_Node_Expression_Conditional'); +use Twig\Compiler; -if (\false) { - class ConditionalExpression extends \Twig_Node_Expression_Conditional +class ConditionalExpression extends AbstractExpression +{ + public function __construct(AbstractExpression $expr1, AbstractExpression $expr2, AbstractExpression $expr3, $lineno) { + parent::__construct(['expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3], [], $lineno); + } + + public function compile(Compiler $compiler) + { + $compiler + ->raw('((') + ->subcompile($this->getNode('expr1')) + ->raw(') ? (') + ->subcompile($this->getNode('expr2')) + ->raw(') : (') + ->subcompile($this->getNode('expr3')) + ->raw('))') + ; } } + +class_alias('Twig\Node\Expression\ConditionalExpression', 'Twig_Node_Expression_Conditional'); diff --git a/vendor/twig/twig/src/Node/Expression/ConstantExpression.php b/vendor/twig/twig/src/Node/Expression/ConstantExpression.php index ef197ba02d2645181026db8e5654ee96868950f6..fd58264dca1bcc84a71f5f4902e0356dabc007a8 100644 --- a/vendor/twig/twig/src/Node/Expression/ConstantExpression.php +++ b/vendor/twig/twig/src/Node/Expression/ConstantExpression.php @@ -1,11 +1,30 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression; -class_exists('Twig_Node_Expression_Constant'); +use Twig\Compiler; -if (\false) { - class ConstantExpression extends \Twig_Node_Expression_Constant +class ConstantExpression extends AbstractExpression +{ + public function __construct($value, $lineno) { + parent::__construct([], ['value' => $value], $lineno); + } + + public function compile(Compiler $compiler) + { + $compiler->repr($this->getAttribute('value')); } } + +class_alias('Twig\Node\Expression\ConstantExpression', 'Twig_Node_Expression_Constant'); diff --git a/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php b/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php index 2eb573c2f0084c94d0a306733a0ff88afed529a8..7c5e2d20aa46ddcfc4c393a88d0edd51eea29a7e 100644 --- a/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php +++ b/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php @@ -1,11 +1,54 @@ <?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\Node\Expression\Filter; -class_exists('Twig_Node_Expression_Filter_Default'); +use Twig\Compiler; +use Twig\Node\Expression\ConditionalExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FilterExpression; +use Twig\Node\Expression\GetAttrExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\Expression\Test\DefinedTest; +use Twig\Node\Node; + +/** + * Returns the value or the default value when it is undefined or empty. + * + * {{ var.foo|default('foo item on var is not defined') }} + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class DefaultFilter extends FilterExpression +{ + public function __construct(\Twig_NodeInterface $node, ConstantExpression $filterName, \Twig_NodeInterface $arguments, $lineno, $tag = null) + { + $default = new FilterExpression($node, new ConstantExpression('default', $node->getTemplateLine()), $arguments, $node->getTemplateLine()); + + if ('default' === $filterName->getAttribute('value') && ($node instanceof NameExpression || $node instanceof GetAttrExpression)) { + $test = new DefinedTest(clone $node, 'defined', new Node(), $node->getTemplateLine()); + $false = \count($arguments) ? $arguments->getNode(0) : new ConstantExpression('', $node->getTemplateLine()); -if (\false) { - class DefaultFilter extends \Twig_Node_Expression_Filter_Default + $node = new ConditionalExpression($test, $default, $false, $node->getTemplateLine()); + } else { + $node = $default; + } + + parent::__construct($node, $filterName, $arguments, $lineno, $tag); + } + + public function compile(Compiler $compiler) { + $compiler->subcompile($this->getNode('node')); } } + +class_alias('Twig\Node\Expression\Filter\DefaultFilter', 'Twig_Node_Expression_Filter_Default'); diff --git a/vendor/twig/twig/src/Node/Expression/FilterExpression.php b/vendor/twig/twig/src/Node/Expression/FilterExpression.php index 47b3b41efbd56871116a231251819ca2c7c482fa..6131c2fd4033683076cd17d22072c945f375b503 100644 --- a/vendor/twig/twig/src/Node/Expression/FilterExpression.php +++ b/vendor/twig/twig/src/Node/Expression/FilterExpression.php @@ -1,11 +1,47 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression; -class_exists('Twig_Node_Expression_Filter'); +use Twig\Compiler; +use Twig\TwigFilter; -if (\false) { - class FilterExpression extends \Twig_Node_Expression_Filter +class FilterExpression extends CallExpression +{ + public function __construct(\Twig_NodeInterface $node, ConstantExpression $filterName, \Twig_NodeInterface $arguments, $lineno, $tag = null) { + parent::__construct(['node' => $node, 'filter' => $filterName, 'arguments' => $arguments], [], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $name = $this->getNode('filter')->getAttribute('value'); + $filter = $compiler->getEnvironment()->getFilter($name); + + $this->setAttribute('name', $name); + $this->setAttribute('type', 'filter'); + $this->setAttribute('thing', $filter); + $this->setAttribute('needs_environment', $filter->needsEnvironment()); + $this->setAttribute('needs_context', $filter->needsContext()); + $this->setAttribute('arguments', $filter->getArguments()); + if ($filter instanceof \Twig_FilterCallableInterface || $filter instanceof TwigFilter) { + $this->setAttribute('callable', $filter->getCallable()); + } + if ($filter instanceof TwigFilter) { + $this->setAttribute('is_variadic', $filter->isVariadic()); + } + + $this->compileCallable($compiler); } } + +class_alias('Twig\Node\Expression\FilterExpression', 'Twig_Node_Expression_Filter'); diff --git a/vendor/twig/twig/src/Node/Expression/FunctionExpression.php b/vendor/twig/twig/src/Node/Expression/FunctionExpression.php index 9ab002fbfb0ddc9ad31204f82a389f7ddb675119..cf2c72b635f78ee09b0f0564ada6029d85667a1b 100644 --- a/vendor/twig/twig/src/Node/Expression/FunctionExpression.php +++ b/vendor/twig/twig/src/Node/Expression/FunctionExpression.php @@ -1,11 +1,51 @@ <?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\Node\Expression; -class_exists('Twig_Node_Expression_Function'); +use Twig\Compiler; +use Twig\TwigFunction; + +class FunctionExpression extends CallExpression +{ + public function __construct($name, \Twig_NodeInterface $arguments, $lineno) + { + parent::__construct(['arguments' => $arguments], ['name' => $name, 'is_defined_test' => false], $lineno); + } -if (\false) { - class FunctionExpression extends \Twig_Node_Expression_Function + public function compile(Compiler $compiler) { + $name = $this->getAttribute('name'); + $function = $compiler->getEnvironment()->getFunction($name); + + $this->setAttribute('name', $name); + $this->setAttribute('type', 'function'); + $this->setAttribute('thing', $function); + $this->setAttribute('needs_environment', $function->needsEnvironment()); + $this->setAttribute('needs_context', $function->needsContext()); + $this->setAttribute('arguments', $function->getArguments()); + if ($function instanceof \Twig_FunctionCallableInterface || $function instanceof TwigFunction) { + $callable = $function->getCallable(); + if ('constant' === $name && $this->getAttribute('is_defined_test')) { + $callable = 'twig_constant_is_defined'; + } + + $this->setAttribute('callable', $callable); + } + if ($function instanceof TwigFunction) { + $this->setAttribute('is_variadic', $function->isVariadic()); + } + + $this->compileCallable($compiler); } } + +class_alias('Twig\Node\Expression\FunctionExpression', 'Twig_Node_Expression_Function'); diff --git a/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php b/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php index 6e810c7fe75f5ce59bbf572c8f543a975b7e4af9..b790bf7af7a840641dab6bbc9a9bcebefe65870d 100644 --- a/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php +++ b/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php @@ -1,11 +1,80 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression; -class_exists('Twig_Node_Expression_GetAttr'); +use Twig\Compiler; +use Twig\Template; + +class GetAttrExpression extends AbstractExpression +{ + public function __construct(AbstractExpression $node, AbstractExpression $attribute, AbstractExpression $arguments = null, $type, $lineno) + { + $nodes = ['node' => $node, 'attribute' => $attribute]; + if (null !== $arguments) { + $nodes['arguments'] = $arguments; + } + + parent::__construct($nodes, ['type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'disable_c_ext' => false], $lineno); + } -if (\false) { - class GetAttrExpression extends \Twig_Node_Expression_GetAttr + public function compile(Compiler $compiler) { + if ($this->getAttribute('disable_c_ext')) { + @trigger_error(sprintf('Using the "disable_c_ext" attribute on %s is deprecated since version 1.30 and will be removed in 2.0.', __CLASS__), E_USER_DEPRECATED); + } + + if (\function_exists('twig_template_get_attributes') && !$this->getAttribute('disable_c_ext')) { + $compiler->raw('twig_template_get_attributes($this, '); + } else { + $compiler->raw('$this->getAttribute('); + } + + if ($this->getAttribute('ignore_strict_check')) { + $this->getNode('node')->setAttribute('ignore_strict_check', true); + } + + $compiler->subcompile($this->getNode('node')); + + $compiler->raw(', ')->subcompile($this->getNode('attribute')); + + // only generate optional arguments when needed (to make generated code more readable) + $needFourth = $this->getAttribute('ignore_strict_check'); + $needThird = $needFourth || $this->getAttribute('is_defined_test'); + $needSecond = $needThird || Template::ANY_CALL !== $this->getAttribute('type'); + $needFirst = $needSecond || $this->hasNode('arguments'); + + if ($needFirst) { + if ($this->hasNode('arguments')) { + $compiler->raw(', ')->subcompile($this->getNode('arguments')); + } else { + $compiler->raw(', []'); + } + } + + if ($needSecond) { + $compiler->raw(', ')->repr($this->getAttribute('type')); + } + + if ($needThird) { + $compiler->raw(', ')->repr($this->getAttribute('is_defined_test')); + } + + if ($needFourth) { + $compiler->raw(', ')->repr($this->getAttribute('ignore_strict_check')); + } + + $compiler->raw(')'); } } + +class_alias('Twig\Node\Expression\GetAttrExpression', 'Twig_Node_Expression_GetAttr'); diff --git a/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php b/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php index e751c31b83a5fe8293abc31bf5de817c316ee533..f6311249dee691091421498d3003b86de837086a 100644 --- a/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php +++ b/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php @@ -1,11 +1,48 @@ <?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\Node\Expression; -class_exists('Twig_Node_Expression_MethodCall'); +use Twig\Compiler; -if (\false) { - class MethodCallExpression extends \Twig_Node_Expression_MethodCall +class MethodCallExpression extends AbstractExpression +{ + public function __construct(AbstractExpression $node, $method, ArrayExpression $arguments, $lineno) { + parent::__construct(['node' => $node, 'arguments' => $arguments], ['method' => $method, 'safe' => false], $lineno); + + if ($node instanceof NameExpression) { + $node->setAttribute('always_defined', true); + } + } + + public function compile(Compiler $compiler) + { + $compiler + ->subcompile($this->getNode('node')) + ->raw('->') + ->raw($this->getAttribute('method')) + ->raw('(') + ; + $first = true; + foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) { + if (!$first) { + $compiler->raw(', '); + } + $first = false; + + $compiler->subcompile($pair['value']); + } + $compiler->raw(')'); } } + +class_alias('Twig\Node\Expression\MethodCallExpression', 'Twig_Node_Expression_MethodCall'); diff --git a/vendor/twig/twig/src/Node/Expression/NameExpression.php b/vendor/twig/twig/src/Node/Expression/NameExpression.php index c32981afd6e72ecb74c52084e91517b936e3161e..516ba285e94d7b740728cb23962ab94d3e73588b 100644 --- a/vendor/twig/twig/src/Node/Expression/NameExpression.php +++ b/vendor/twig/twig/src/Node/Expression/NameExpression.php @@ -1,11 +1,112 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression; -class_exists('Twig_Node_Expression_Name'); +use Twig\Compiler; + +class NameExpression extends AbstractExpression +{ + protected $specialVars = [ + '_self' => '$this', + '_context' => '$context', + '_charset' => '$this->env->getCharset()', + ]; + + public function __construct($name, $lineno) + { + parent::__construct([], ['name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false], $lineno); + } + + public function compile(Compiler $compiler) + { + $name = $this->getAttribute('name'); + + $compiler->addDebugInfo($this); + + if ($this->getAttribute('is_defined_test')) { + if ($this->isSpecial()) { + $compiler->repr(true); + } else { + $compiler + ->raw('(isset($context[') + ->string($name) + ->raw(']) || array_key_exists(') + ->string($name) + ->raw(', $context))'); + } + } elseif ($this->isSpecial()) { + $compiler->raw($this->specialVars[$name]); + } elseif ($this->getAttribute('always_defined')) { + $compiler + ->raw('$context[') + ->string($name) + ->raw(']') + ; + } else { + if (\PHP_VERSION_ID >= 70000) { + // use PHP 7 null coalescing operator + $compiler + ->raw('($context[') + ->string($name) + ->raw('] ?? ') + ; -if (\false) { - class NameExpression extends \Twig_Node_Expression_Name + if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) { + $compiler->raw('null)'); + } else { + $compiler->raw('$this->getContext($context, ')->string($name)->raw('))'); + } + } elseif (\PHP_VERSION_ID >= 50400) { + // PHP 5.4 ternary operator performance was optimized + $compiler + ->raw('(isset($context[') + ->string($name) + ->raw(']) ? $context[') + ->string($name) + ->raw('] : ') + ; + + if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) { + $compiler->raw('null)'); + } else { + $compiler->raw('$this->getContext($context, ')->string($name)->raw('))'); + } + } else { + $compiler + ->raw('$this->getContext($context, ') + ->string($name) + ; + + if ($this->getAttribute('ignore_strict_check')) { + $compiler->raw(', true'); + } + + $compiler + ->raw(')') + ; + } + } + } + + public function isSpecial() { + return isset($this->specialVars[$this->getAttribute('name')]); + } + + public function isSimple() + { + return !$this->isSpecial() && !$this->getAttribute('is_defined_test'); } } + +class_alias('Twig\Node\Expression\NameExpression', 'Twig_Node_Expression_Name'); diff --git a/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php b/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php index a1d3590a1c2604620390fdeaa3eeaf697e0b18dd..49326d467dbefe9f40fcbb44396a11965f2fc3dc 100644 --- a/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php +++ b/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php @@ -1,11 +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\Node\Expression; -class_exists('Twig_Node_Expression_NullCoalesce'); +use Twig\Compiler; +use Twig\Node\Expression\Binary\AndBinary; +use Twig\Node\Expression\Test\DefinedTest; +use Twig\Node\Expression\Test\NullTest; +use Twig\Node\Expression\Unary\NotUnary; +use Twig\Node\Node; + +class NullCoalesceExpression extends ConditionalExpression +{ + public function __construct(\Twig_NodeInterface $left, \Twig_NodeInterface $right, $lineno) + { + $test = new AndBinary( + new DefinedTest(clone $left, 'defined', new Node(), $left->getTemplateLine()), + new NotUnary(new NullTest($left, 'null', new Node(), $left->getTemplateLine()), $left->getTemplateLine()), + $left->getTemplateLine() + ); + + parent::__construct($test, $left, $right, $lineno); + } -if (\false) { - class NullCoalesceExpression extends \Twig_Node_Expression_NullCoalesce + public function compile(Compiler $compiler) { + /* + * This optimizes only one case. PHP 7 also supports more complex expressions + * that can return null. So, for instance, if log is defined, log("foo") ?? "..." works, + * but log($a["foo"]) ?? "..." does not if $a["foo"] is not defined. More advanced + * cases might be implemented as an optimizer node visitor, but has not been done + * as benefits are probably not worth the added complexity. + */ + if (\PHP_VERSION_ID >= 70000 && $this->getNode('expr2') instanceof NameExpression) { + $this->getNode('expr2')->setAttribute('always_defined', true); + $compiler + ->raw('((') + ->subcompile($this->getNode('expr2')) + ->raw(') ?? (') + ->subcompile($this->getNode('expr3')) + ->raw('))') + ; + } else { + parent::compile($compiler); + } } } + +class_alias('Twig\Node\Expression\NullCoalesceExpression', 'Twig_Node_Expression_NullCoalesce'); diff --git a/vendor/twig/twig/src/Node/Expression/ParentExpression.php b/vendor/twig/twig/src/Node/Expression/ParentExpression.php index 70b0e360ce31d1a08e011b8c2e8e8736c2b8d826..12472830362a1705e698e28e41ec6addefc69940 100644 --- a/vendor/twig/twig/src/Node/Expression/ParentExpression.php +++ b/vendor/twig/twig/src/Node/Expression/ParentExpression.php @@ -1,11 +1,48 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression; -class_exists('Twig_Node_Expression_Parent'); +use Twig\Compiler; -if (\false) { - class ParentExpression extends \Twig_Node_Expression_Parent +/** + * Represents a parent node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class ParentExpression extends AbstractExpression +{ + public function __construct($name, $lineno, $tag = null) { + parent::__construct([], ['output' => false, 'name' => $name], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + if ($this->getAttribute('output')) { + $compiler + ->addDebugInfo($this) + ->write('$this->displayParentBlock(') + ->string($this->getAttribute('name')) + ->raw(", \$context, \$blocks);\n") + ; + } else { + $compiler + ->raw('$this->renderParentBlock(') + ->string($this->getAttribute('name')) + ->raw(', $context, $blocks)') + ; + } } } + +class_alias('Twig\Node\Expression\ParentExpression', 'Twig_Node_Expression_Parent'); diff --git a/vendor/twig/twig/src/Node/Expression/TempNameExpression.php b/vendor/twig/twig/src/Node/Expression/TempNameExpression.php index 178b6dec25423ace74a91f15ffd09a8cc4d1fd06..ce0a158981eda749aaa44519e5a57969ef5a48ac 100644 --- a/vendor/twig/twig/src/Node/Expression/TempNameExpression.php +++ b/vendor/twig/twig/src/Node/Expression/TempNameExpression.php @@ -1,11 +1,33 @@ <?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\Node\Expression; -class_exists('Twig_Node_Expression_TempName'); +use Twig\Compiler; -if (\false) { - class TempNameExpression extends \Twig_Node_Expression_TempName +class TempNameExpression extends AbstractExpression +{ + public function __construct($name, $lineno) { + parent::__construct([], ['name' => $name], $lineno); + } + + public function compile(Compiler $compiler) + { + $compiler + ->raw('$_') + ->raw($this->getAttribute('name')) + ->raw('_') + ; } } + +class_alias('Twig\Node\Expression\TempNameExpression', 'Twig_Node_Expression_TempName'); diff --git a/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php b/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php index b54b2801ecf92c0a5a07f37151629b412414a6a0..78353a8b256aa79d3cbf8ff92d07285491876ade 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php @@ -1,11 +1,51 @@ <?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\Node\Expression\Test; -class_exists('Twig_Node_Expression_Test_Constant'); +use Twig\Compiler; +use Twig\Node\Expression\TestExpression; -if (\false) { - class ConstantTest extends \Twig_Node_Expression_Test_Constant +/** + * Checks if a variable is the exact same value as a constant. + * + * {% if post.status is constant('Post::PUBLISHED') %} + * the status attribute is exactly the same as Post::PUBLISHED + * {% endif %} + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class ConstantTest extends TestExpression +{ + public function compile(Compiler $compiler) { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' === constant(') + ; + + if ($this->getNode('arguments')->hasNode(1)) { + $compiler + ->raw('get_class(') + ->subcompile($this->getNode('arguments')->getNode(1)) + ->raw(')."::".') + ; + } + + $compiler + ->subcompile($this->getNode('arguments')->getNode(0)) + ->raw('))') + ; } } + +class_alias('Twig\Node\Expression\Test\ConstantTest', 'Twig_Node_Expression_Test_Constant'); diff --git a/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php b/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php index 69c36a0bb61780019bfc682c8bbc75f408f610d3..6197fb93caebd8c8edcaf1ee4016ff401cf551aa 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php @@ -1,11 +1,71 @@ <?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\Node\Expression\Test; -class_exists('Twig_Node_Expression_Test_Defined'); +use Twig\Compiler; +use Twig\Error\SyntaxError; +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Expression\BlockReferenceExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FunctionExpression; +use Twig\Node\Expression\GetAttrExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\Expression\TestExpression; + +/** + * Checks if a variable is defined in the current context. + * + * {# defined works with variable names and variable attributes #} + * {% if foo is defined %} + * {# ... #} + * {% endif %} + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class DefinedTest extends TestExpression +{ + public function __construct(\Twig_NodeInterface $node, $name, \Twig_NodeInterface $arguments = null, $lineno) + { + if ($node instanceof NameExpression) { + $node->setAttribute('is_defined_test', true); + } elseif ($node instanceof GetAttrExpression) { + $node->setAttribute('is_defined_test', true); + $this->changeIgnoreStrictCheck($node); + } elseif ($node instanceof BlockReferenceExpression) { + $node->setAttribute('is_defined_test', true); + } elseif ($node instanceof FunctionExpression && 'constant' === $node->getAttribute('name')) { + $node->setAttribute('is_defined_test', true); + } elseif ($node instanceof ConstantExpression || $node instanceof ArrayExpression) { + $node = new ConstantExpression(true, $node->getTemplateLine()); + } else { + throw new SyntaxError('The "defined" test only works with simple variables.', $this->getTemplateLine(), null, null, false); + } + + parent::__construct($node, $name, $arguments, $lineno); + } + + protected function changeIgnoreStrictCheck(GetAttrExpression $node) + { + $node->setAttribute('ignore_strict_check', true); -if (\false) { - class DefinedTest extends \Twig_Node_Expression_Test_Defined + if ($node->getNode('node') instanceof GetAttrExpression) { + $this->changeIgnoreStrictCheck($node->getNode('node')); + } + } + + public function compile(Compiler $compiler) { + $compiler->subcompile($this->getNode('node')); } } + +class_alias('Twig\Node\Expression\Test\DefinedTest', 'Twig_Node_Expression_Test_Defined'); diff --git a/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php b/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php index e9d9100480a1ec0919a8fa6b801e6b5235162aa3..05c8ad8f7c39f9743ab78db3c2c52933b46bae8c 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php @@ -1,11 +1,38 @@ <?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\Node\Expression\Test; -class_exists('Twig_Node_Expression_Test_Divisibleby'); +use Twig\Compiler; +use Twig\Node\Expression\TestExpression; -if (\false) { - class DivisiblebyTest extends \Twig_Node_Expression_Test_Divisibleby +/** + * Checks if a variable is divisible by a number. + * + * {% if loop.index is divisible by(3) %} + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class DivisiblebyTest extends TestExpression +{ + public function compile(Compiler $compiler) { + $compiler + ->raw('(0 == ') + ->subcompile($this->getNode('node')) + ->raw(' % ') + ->subcompile($this->getNode('arguments')->getNode(0)) + ->raw(')') + ; } } + +class_alias('Twig\Node\Expression\Test\DivisiblebyTest', 'Twig_Node_Expression_Test_Divisibleby'); diff --git a/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php b/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php index feb3a89c08a166dbfb2a59a7bf6ae4fd8d3ad3c4..3b955d26a2fceb9c5ebf135914084f6fb7b3172c 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php @@ -1,11 +1,37 @@ <?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\Node\Expression\Test; -class_exists('Twig_Node_Expression_Test_Even'); +use Twig\Compiler; +use Twig\Node\Expression\TestExpression; -if (\false) { - class EvenTest extends \Twig_Node_Expression_Test_Even +/** + * Checks if a number is even. + * + * {{ var is even }} + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class EvenTest extends TestExpression +{ + public function compile(Compiler $compiler) { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' % 2 == 0') + ->raw(')') + ; } } + +class_alias('Twig\Node\Expression\Test\EvenTest', 'Twig_Node_Expression_Test_Even'); diff --git a/vendor/twig/twig/src/Node/Expression/Test/NullTest.php b/vendor/twig/twig/src/Node/Expression/Test/NullTest.php index 2263b1b2ba012015f10b9504d03ea29eb48a5347..24d399781ecd98c930dc0ab107e42955267d268f 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/NullTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/NullTest.php @@ -1,11 +1,36 @@ <?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\Node\Expression\Test; -class_exists('Twig_Node_Expression_Test_Null'); +use Twig\Compiler; +use Twig\Node\Expression\TestExpression; -if (\false) { - class NullTest extends \Twig_Node_Expression_Test_Null +/** + * Checks that a variable is null. + * + * {{ var is none }} + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class NullTest extends TestExpression +{ + public function compile(Compiler $compiler) { + $compiler + ->raw('(null === ') + ->subcompile($this->getNode('node')) + ->raw(')') + ; } } + +class_alias('Twig\Node\Expression\Test\NullTest', 'Twig_Node_Expression_Test_Null'); diff --git a/vendor/twig/twig/src/Node/Expression/Test/OddTest.php b/vendor/twig/twig/src/Node/Expression/Test/OddTest.php index 86ddb22450146258de73c028363fe6b6400a99df..2dc693a9ae6f613b1517e8f410330a014ceaaef1 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/OddTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/OddTest.php @@ -1,11 +1,37 @@ <?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\Node\Expression\Test; -class_exists('Twig_Node_Expression_Test_Odd'); +use Twig\Compiler; +use Twig\Node\Expression\TestExpression; -if (\false) { - class OddTest extends \Twig_Node_Expression_Test_Odd +/** + * Checks if a number is odd. + * + * {{ var is odd }} + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class OddTest extends TestExpression +{ + public function compile(Compiler $compiler) { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' % 2 == 1') + ->raw(')') + ; } } + +class_alias('Twig\Node\Expression\Test\OddTest', 'Twig_Node_Expression_Test_Odd'); diff --git a/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php b/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php index 26a8f0ea5cffee0e112fc7b14bb01f03733e5bcc..75f2b82a5bbf8cbea257fc724450a2cc1b3c7044 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php @@ -1,11 +1,36 @@ <?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\Node\Expression\Test; -class_exists('Twig_Node_Expression_Test_Sameas'); +use Twig\Compiler; +use Twig\Node\Expression\TestExpression; -if (\false) { - class SameasTest extends \Twig_Node_Expression_Test_Sameas +/** + * Checks if a variable is the same as another one (=== in PHP). + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class SameasTest extends TestExpression +{ + public function compile(Compiler $compiler) { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' === ') + ->subcompile($this->getNode('arguments')->getNode(0)) + ->raw(')') + ; } } + +class_alias('Twig\Node\Expression\Test\SameasTest', 'Twig_Node_Expression_Test_Sameas'); diff --git a/vendor/twig/twig/src/Node/Expression/TestExpression.php b/vendor/twig/twig/src/Node/Expression/TestExpression.php index f3d4f903ffe57b3b9464ad37a08bf2ff5eda3a27..8fc31d3aadc028969f7b4bddf6d92f0ebebfda65 100644 --- a/vendor/twig/twig/src/Node/Expression/TestExpression.php +++ b/vendor/twig/twig/src/Node/Expression/TestExpression.php @@ -1,11 +1,51 @@ <?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\Node\Expression; -class_exists('Twig_Node_Expression_Test'); +use Twig\Compiler; +use Twig\TwigTest; + +class TestExpression extends CallExpression +{ + public function __construct(\Twig_NodeInterface $node, $name, \Twig_NodeInterface $arguments = null, $lineno) + { + $nodes = ['node' => $node]; + if (null !== $arguments) { + $nodes['arguments'] = $arguments; + } + + parent::__construct($nodes, ['name' => $name], $lineno); + } -if (\false) { - class TestExpression extends \Twig_Node_Expression_Test + public function compile(Compiler $compiler) { + $name = $this->getAttribute('name'); + $test = $compiler->getEnvironment()->getTest($name); + + $this->setAttribute('name', $name); + $this->setAttribute('type', 'test'); + $this->setAttribute('thing', $test); + if ($test instanceof TwigTest) { + $this->setAttribute('arguments', $test->getArguments()); + } + if ($test instanceof \Twig_TestCallableInterface || $test instanceof TwigTest) { + $this->setAttribute('callable', $test->getCallable()); + } + if ($test instanceof TwigTest) { + $this->setAttribute('is_variadic', $test->isVariadic()); + } + + $this->compileCallable($compiler); } } + +class_alias('Twig\Node\Expression\TestExpression', 'Twig_Node_Expression_Test'); diff --git a/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php b/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php index 7d998559a78aa241f9d56c00be8ef66dfd892ed9..415c3d407e9e4aad02122698c464801370f9319e 100644 --- a/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php +++ b/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php @@ -1,11 +1,35 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Unary; -class_exists('Twig_Node_Expression_Unary'); +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; + +abstract class AbstractUnary extends AbstractExpression +{ + public function __construct(\Twig_NodeInterface $node, $lineno) + { + parent::__construct(['node' => $node], [], $lineno); + } -if (\false) { - class AbstractUnary extends \Twig_Node_Expression_Unary + public function compile(Compiler $compiler) { + $compiler->raw(' '); + $this->operator($compiler); + $compiler->subcompile($this->getNode('node')); } + + abstract public function operator(Compiler $compiler); } + +class_alias('Twig\Node\Expression\Unary\AbstractUnary', 'Twig_Node_Expression_Unary'); diff --git a/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php b/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php index 344b1216cf5fbd00ffc96bfaf606fc31eb7bda31..dfb6f542954a0de504d9c5c62d0fcb5319301456 100644 --- a/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php +++ b/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Unary; -class_exists('Twig_Node_Expression_Unary_Neg'); +use Twig\Compiler; -if (\false) { - class NegUnary extends \Twig_Node_Expression_Unary_Neg +class NegUnary extends AbstractUnary +{ + public function operator(Compiler $compiler) { + $compiler->raw('-'); } } + +class_alias('Twig\Node\Expression\Unary\NegUnary', 'Twig_Node_Expression_Unary_Neg'); diff --git a/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php b/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php index 79c246286a92c8f01629201e42379c9b6316c3be..7bdde96fffc7c84f255258cbae8bb7e23332b752 100644 --- a/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php +++ b/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Unary; -class_exists('Twig_Node_Expression_Unary_Not'); +use Twig\Compiler; -if (\false) { - class NotUnary extends \Twig_Node_Expression_Unary_Not +class NotUnary extends AbstractUnary +{ + public function operator(Compiler $compiler) { + $compiler->raw('!'); } } + +class_alias('Twig\Node\Expression\Unary\NotUnary', 'Twig_Node_Expression_Unary_Not'); diff --git a/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php b/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php index 24d88ccbe2d32a91c85dc9edaad58d6d68aa1f70..52d5d0c89a774a5368eaacdb7342dcbc7c4976f5 100644 --- a/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php +++ b/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php @@ -1,11 +1,25 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node\Expression\Unary; -class_exists('Twig_Node_Expression_Unary_Pos'); +use Twig\Compiler; -if (\false) { - class PosUnary extends \Twig_Node_Expression_Unary_Pos +class PosUnary extends AbstractUnary +{ + public function operator(Compiler $compiler) { + $compiler->raw('+'); } } + +class_alias('Twig\Node\Expression\Unary\PosUnary', 'Twig_Node_Expression_Unary_Pos'); diff --git a/vendor/twig/twig/src/Node/FlushNode.php b/vendor/twig/twig/src/Node/FlushNode.php index c06306e1fca3b36c95dc97d298064a3d6faa0822..6cbc489a62de1222171b5924bfec3bd022cb9c75 100644 --- a/vendor/twig/twig/src/Node/FlushNode.php +++ b/vendor/twig/twig/src/Node/FlushNode.php @@ -1,11 +1,37 @@ <?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\Node; -class_exists('Twig_Node_Flush'); +use Twig\Compiler; -if (\false) { - class FlushNode extends \Twig_Node_Flush +/** + * Represents a flush node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class FlushNode extends Node +{ + public function __construct($lineno, $tag) { + parent::__construct([], [], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write("flush();\n") + ; } } + +class_alias('Twig\Node\FlushNode', 'Twig_Node_Flush'); diff --git a/vendor/twig/twig/src/Node/ForLoopNode.php b/vendor/twig/twig/src/Node/ForLoopNode.php index e8e3936c8726f93e58ce41b1b17d46c2af21483e..3902093556b93693981d8c3ed5fa111706e32be1 100644 --- a/vendor/twig/twig/src/Node/ForLoopNode.php +++ b/vendor/twig/twig/src/Node/ForLoopNode.php @@ -1,11 +1,56 @@ <?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\Node; -class_exists('Twig_Node_ForLoop'); +use Twig\Compiler; -if (\false) { - class ForLoopNode extends \Twig_Node_ForLoop +/** + * Internal node used by the for node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class ForLoopNode extends Node +{ + public function __construct($lineno, $tag = null) { + parent::__construct([], ['with_loop' => false, 'ifexpr' => false, 'else' => false], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + if ($this->getAttribute('else')) { + $compiler->write("\$context['_iterated'] = true;\n"); + } + + if ($this->getAttribute('with_loop')) { + $compiler + ->write("++\$context['loop']['index0'];\n") + ->write("++\$context['loop']['index'];\n") + ->write("\$context['loop']['first'] = false;\n") + ; + + if (!$this->getAttribute('ifexpr')) { + $compiler + ->write("if (isset(\$context['loop']['length'])) {\n") + ->indent() + ->write("--\$context['loop']['revindex0'];\n") + ->write("--\$context['loop']['revindex'];\n") + ->write("\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n") + ->outdent() + ->write("}\n") + ; + } + } } } + +class_alias('Twig\Node\ForLoopNode', 'Twig_Node_ForLoop'); diff --git a/vendor/twig/twig/src/Node/ForNode.php b/vendor/twig/twig/src/Node/ForNode.php index 86521f4ee2cb2ecaeaa8965af3652a5f39a2cf57..49409a39b18eedfc743bfbbcc028aa2b6f260a46 100644 --- a/vendor/twig/twig/src/Node/ForNode.php +++ b/vendor/twig/twig/src/Node/ForNode.php @@ -1,11 +1,119 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node; -class_exists('Twig_Node_For'); +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; +use Twig\Node\Expression\AssignNameExpression; + +/** + * Represents a for node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class ForNode extends Node +{ + protected $loop; -if (\false) { - class ForNode extends \Twig_Node_For + public function __construct(AssignNameExpression $keyTarget, AssignNameExpression $valueTarget, AbstractExpression $seq, AbstractExpression $ifexpr = null, \Twig_NodeInterface $body, \Twig_NodeInterface $else = null, $lineno, $tag = null) { + $body = new Node([$body, $this->loop = new ForLoopNode($lineno, $tag)]); + + if (null !== $ifexpr) { + $body = new IfNode(new Node([$ifexpr, $body]), null, $lineno, $tag); + } + + $nodes = ['key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body]; + if (null !== $else) { + $nodes['else'] = $else; + } + + parent::__construct($nodes, ['with_loop' => true, 'ifexpr' => null !== $ifexpr], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write("\$context['_parent'] = \$context;\n") + ->write("\$context['_seq'] = twig_ensure_traversable(") + ->subcompile($this->getNode('seq')) + ->raw(");\n") + ; + + if ($this->hasNode('else')) { + $compiler->write("\$context['_iterated'] = false;\n"); + } + + if ($this->getAttribute('with_loop')) { + $compiler + ->write("\$context['loop'] = [\n") + ->write(" 'parent' => \$context['_parent'],\n") + ->write(" 'index0' => 0,\n") + ->write(" 'index' => 1,\n") + ->write(" 'first' => true,\n") + ->write("];\n") + ; + + if (!$this->getAttribute('ifexpr')) { + $compiler + ->write("if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \Countable)) {\n") + ->indent() + ->write("\$length = count(\$context['_seq']);\n") + ->write("\$context['loop']['revindex0'] = \$length - 1;\n") + ->write("\$context['loop']['revindex'] = \$length;\n") + ->write("\$context['loop']['length'] = \$length;\n") + ->write("\$context['loop']['last'] = 1 === \$length;\n") + ->outdent() + ->write("}\n") + ; + } + } + + $this->loop->setAttribute('else', $this->hasNode('else')); + $this->loop->setAttribute('with_loop', $this->getAttribute('with_loop')); + $this->loop->setAttribute('ifexpr', $this->getAttribute('ifexpr')); + + $compiler + ->write("foreach (\$context['_seq'] as ") + ->subcompile($this->getNode('key_target')) + ->raw(' => ') + ->subcompile($this->getNode('value_target')) + ->raw(") {\n") + ->indent() + ->subcompile($this->getNode('body')) + ->outdent() + ->write("}\n") + ; + + if ($this->hasNode('else')) { + $compiler + ->write("if (!\$context['_iterated']) {\n") + ->indent() + ->subcompile($this->getNode('else')) + ->outdent() + ->write("}\n") + ; + } + + $compiler->write("\$_parent = \$context['_parent'];\n"); + + // remove some "private" loop variables (needed for nested loops) + $compiler->write('unset($context[\'_seq\'], $context[\'_iterated\'], $context[\''.$this->getNode('key_target')->getAttribute('name').'\'], $context[\''.$this->getNode('value_target')->getAttribute('name').'\'], $context[\'_parent\'], $context[\'loop\']);'."\n"); + + // keep the values set in the inner context for variables defined in the outer context + $compiler->write("\$context = array_intersect_key(\$context, \$_parent) + \$_parent;\n"); } } + +class_alias('Twig\Node\ForNode', 'Twig_Node_For'); diff --git a/vendor/twig/twig/src/Node/IfNode.php b/vendor/twig/twig/src/Node/IfNode.php index 2710ead0d352f69f07fb5513b4d334af944ce965..4836d91f088f311086519720f7c7e1ffd0041346 100644 --- a/vendor/twig/twig/src/Node/IfNode.php +++ b/vendor/twig/twig/src/Node/IfNode.php @@ -1,11 +1,72 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node; -class_exists('Twig_Node_If'); +use Twig\Compiler; -if (\false) { - class IfNode extends \Twig_Node_If +/** + * Represents an if node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class IfNode extends Node +{ + public function __construct(\Twig_NodeInterface $tests, \Twig_NodeInterface $else = null, $lineno, $tag = null) { + $nodes = ['tests' => $tests]; + if (null !== $else) { + $nodes['else'] = $else; + } + + parent::__construct($nodes, [], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler->addDebugInfo($this); + for ($i = 0, $count = \count($this->getNode('tests')); $i < $count; $i += 2) { + if ($i > 0) { + $compiler + ->outdent() + ->write('} elseif (') + ; + } else { + $compiler + ->write('if (') + ; + } + + $compiler + ->subcompile($this->getNode('tests')->getNode($i)) + ->raw(") {\n") + ->indent() + ->subcompile($this->getNode('tests')->getNode($i + 1)) + ; + } + + if ($this->hasNode('else')) { + $compiler + ->outdent() + ->write("} else {\n") + ->indent() + ->subcompile($this->getNode('else')) + ; + } + + $compiler + ->outdent() + ->write("}\n"); } } + +class_alias('Twig\Node\IfNode', 'Twig_Node_If'); diff --git a/vendor/twig/twig/src/Node/ImportNode.php b/vendor/twig/twig/src/Node/ImportNode.php index 0bc23f339231169c16a2efc9c3d2ae34860b1817..309bd1ac72a76f6cd0153e8fa6df0ed6e2b13a34 100644 --- a/vendor/twig/twig/src/Node/ImportNode.php +++ b/vendor/twig/twig/src/Node/ImportNode.php @@ -1,11 +1,57 @@ <?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\Node; -class_exists('Twig_Node_Import'); +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; +use Twig\Node\Expression\NameExpression; -if (\false) { - class ImportNode extends \Twig_Node_Import +/** + * Represents an import node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class ImportNode extends Node +{ + public function __construct(AbstractExpression $expr, AbstractExpression $var, $lineno, $tag = null) { + parent::__construct(['expr' => $expr, 'var' => $var], [], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('') + ->subcompile($this->getNode('var')) + ->raw(' = ') + ; + + if ($this->getNode('expr') instanceof NameExpression && '_self' === $this->getNode('expr')->getAttribute('name')) { + $compiler->raw('$this'); + } else { + $compiler + ->raw('$this->loadTemplate(') + ->subcompile($this->getNode('expr')) + ->raw(', ') + ->repr($this->getTemplateName()) + ->raw(', ') + ->repr($this->getTemplateLine()) + ->raw(')') + ; + } + + $compiler->raw(";\n"); } } + +class_alias('Twig\Node\ImportNode', 'Twig_Node_Import'); diff --git a/vendor/twig/twig/src/Node/IncludeNode.php b/vendor/twig/twig/src/Node/IncludeNode.php index d557efee2bb597e10b1399a9b3c03da8db365d2c..524ddef23e988f8f52984a7bfaf471a5b4ceb42c 100644 --- a/vendor/twig/twig/src/Node/IncludeNode.php +++ b/vendor/twig/twig/src/Node/IncludeNode.php @@ -1,11 +1,95 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node; -class_exists('Twig_Node_Include'); +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; + +/** + * Represents an include node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class IncludeNode extends Node implements NodeOutputInterface +{ + public function __construct(AbstractExpression $expr, AbstractExpression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) + { + $nodes = ['expr' => $expr]; + if (null !== $variables) { + $nodes['variables'] = $variables; + } + + parent::__construct($nodes, ['only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler->addDebugInfo($this); + + if ($this->getAttribute('ignore_missing')) { + $compiler + ->write("try {\n") + ->indent() + ; + } + + $this->addGetTemplate($compiler); -if (\false) { - class IncludeNode extends \Twig_Node_Include + $compiler->raw('->display('); + + $this->addTemplateArguments($compiler); + + $compiler->raw(");\n"); + + if ($this->getAttribute('ignore_missing')) { + $compiler + ->outdent() + ->write("} catch (LoaderError \$e) {\n") + ->indent() + ->write("// ignore missing template\n") + ->outdent() + ->write("}\n\n") + ; + } + } + + protected function addGetTemplate(Compiler $compiler) { + $compiler + ->write('$this->loadTemplate(') + ->subcompile($this->getNode('expr')) + ->raw(', ') + ->repr($this->getTemplateName()) + ->raw(', ') + ->repr($this->getTemplateLine()) + ->raw(')') + ; + } + + protected function addTemplateArguments(Compiler $compiler) + { + if (!$this->hasNode('variables')) { + $compiler->raw(false === $this->getAttribute('only') ? '$context' : '[]'); + } elseif (false === $this->getAttribute('only')) { + $compiler + ->raw('array_merge($context, ') + ->subcompile($this->getNode('variables')) + ->raw(')') + ; + } else { + $compiler->subcompile($this->getNode('variables')); + } } } + +class_alias('Twig\Node\IncludeNode', 'Twig_Node_Include'); diff --git a/vendor/twig/twig/src/Node/MacroNode.php b/vendor/twig/twig/src/Node/MacroNode.php index 5752c6c8be69fdbe492b24444b9508dbcf9fdfd5..31f4baa7a49aca5b99f534c818878177b18ebb85 100644 --- a/vendor/twig/twig/src/Node/MacroNode.php +++ b/vendor/twig/twig/src/Node/MacroNode.php @@ -1,11 +1,130 @@ <?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\Node; -class_exists('Twig_Node_Macro'); +use Twig\Compiler; +use Twig\Error\SyntaxError; + +/** + * Represents a macro node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class MacroNode extends Node +{ + const VARARGS_NAME = 'varargs'; -if (\false) { - class MacroNode extends \Twig_Node_Macro + public function __construct($name, \Twig_NodeInterface $body, \Twig_NodeInterface $arguments, $lineno, $tag = null) { + foreach ($arguments as $argumentName => $argument) { + if (self::VARARGS_NAME === $argumentName) { + throw new SyntaxError(sprintf('The argument "%s" in macro "%s" cannot be defined because the variable "%s" is reserved for arbitrary arguments.', self::VARARGS_NAME, $name, self::VARARGS_NAME), $argument->getTemplateLine(), null, null, false); + } + } + + parent::__construct(['body' => $body, 'arguments' => $arguments], ['name' => $name], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write(sprintf('public function get%s(', $this->getAttribute('name'))) + ; + + $count = \count($this->getNode('arguments')); + $pos = 0; + foreach ($this->getNode('arguments') as $name => $default) { + $compiler + ->raw('$__'.$name.'__ = ') + ->subcompile($default) + ; + + if (++$pos < $count) { + $compiler->raw(', '); + } + } + + if (\PHP_VERSION_ID >= 50600) { + if ($count) { + $compiler->raw(', '); + } + + $compiler->raw('...$__varargs__'); + } + + $compiler + ->raw(")\n") + ->write("{\n") + ->indent() + ; + + $compiler + ->write("\$context = \$this->env->mergeGlobals([\n") + ->indent() + ; + + foreach ($this->getNode('arguments') as $name => $default) { + $compiler + ->write('') + ->string($name) + ->raw(' => $__'.$name.'__') + ->raw(",\n") + ; + } + + $compiler + ->write('') + ->string(self::VARARGS_NAME) + ->raw(' => ') + ; + + if (\PHP_VERSION_ID >= 50600) { + $compiler->raw("\$__varargs__,\n"); + } else { + $compiler + ->raw('func_num_args() > ') + ->repr($count) + ->raw(' ? array_slice(func_get_args(), ') + ->repr($count) + ->raw(") : [],\n") + ; + } + + $compiler + ->outdent() + ->write("]);\n\n") + ->write("\$blocks = [];\n\n") + ->write("ob_start();\n") + ->write("try {\n") + ->indent() + ->subcompile($this->getNode('body')) + ->outdent() + ->write("} catch (\Exception \$e) {\n") + ->indent() + ->write("ob_end_clean();\n\n") + ->write("throw \$e;\n") + ->outdent() + ->write("} catch (\Throwable \$e) {\n") + ->indent() + ->write("ob_end_clean();\n\n") + ->write("throw \$e;\n") + ->outdent() + ->write("}\n\n") + ->write("return ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset());\n") + ->outdent() + ->write("}\n\n") + ; } } + +class_alias('Twig\Node\MacroNode', 'Twig_Node_Macro'); diff --git a/vendor/twig/twig/src/Node/ModuleNode.php b/vendor/twig/twig/src/Node/ModuleNode.php index d39c6ff0f6a63b4a5c6d42e59e8f1f7c79ab114a..2eb0d49dc0f7ffdd3742bd48cf7441fe7168ec54 100644 --- a/vendor/twig/twig/src/Node/ModuleNode.php +++ b/vendor/twig/twig/src/Node/ModuleNode.php @@ -1,11 +1,489 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node; -class_exists('Twig_Node_Module'); +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Source; + +/** + * Represents a module node. + * + * Consider this class as being final. If you need to customize the behavior of + * the generated class, consider adding nodes to the following nodes: display_start, + * display_end, constructor_start, constructor_end, and class_end. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class ModuleNode extends Node +{ + private $source; + + public function __construct(\Twig_NodeInterface $body, AbstractExpression $parent = null, \Twig_NodeInterface $blocks, \Twig_NodeInterface $macros, \Twig_NodeInterface $traits, $embeddedTemplates, $name, $source = '') + { + if (!$name instanceof Source) { + @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a \Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); + $this->source = new Source($source, $name); + } else { + $this->source = $name; + } + + $nodes = [ + 'body' => $body, + 'blocks' => $blocks, + 'macros' => $macros, + 'traits' => $traits, + 'display_start' => new Node(), + 'display_end' => new Node(), + 'constructor_start' => new Node(), + 'constructor_end' => new Node(), + 'class_end' => new Node(), + ]; + if (null !== $parent) { + $nodes['parent'] = $parent; + } + + // embedded templates are set as attributes so that they are only visited once by the visitors + parent::__construct($nodes, [ + // source to be remove in 2.0 + 'source' => $this->source->getCode(), + // filename to be remove in 2.0 (use getTemplateName() instead) + 'filename' => $this->source->getName(), + 'index' => null, + 'embedded_templates' => $embeddedTemplates, + ], 1); -if (\false) { - class ModuleNode extends \Twig_Node_Module + // populate the template name of all node children + $this->setTemplateName($this->source->getName()); + } + + public function setIndex($index) + { + $this->setAttribute('index', $index); + } + + public function compile(Compiler $compiler) { + $this->compileTemplate($compiler); + + foreach ($this->getAttribute('embedded_templates') as $template) { + $compiler->subcompile($template); + } + } + + protected function compileTemplate(Compiler $compiler) + { + if (!$this->getAttribute('index')) { + $compiler->write('<?php'); + } + + $this->compileClassHeader($compiler); + + if ( + \count($this->getNode('blocks')) + || \count($this->getNode('traits')) + || !$this->hasNode('parent') + || $this->getNode('parent') instanceof ConstantExpression + || \count($this->getNode('constructor_start')) + || \count($this->getNode('constructor_end')) + ) { + $this->compileConstructor($compiler); + } + + $this->compileGetParent($compiler); + + $this->compileDisplay($compiler); + + $compiler->subcompile($this->getNode('blocks')); + + $this->compileMacros($compiler); + + $this->compileGetTemplateName($compiler); + + $this->compileIsTraitable($compiler); + + $this->compileDebugInfo($compiler); + + $this->compileGetSource($compiler); + + $this->compileGetSourceContext($compiler); + + $this->compileClassFooter($compiler); + } + + protected function compileGetParent(Compiler $compiler) + { + if (!$this->hasNode('parent')) { + return; + } + $parent = $this->getNode('parent'); + + $compiler + ->write("protected function doGetParent(array \$context)\n", "{\n") + ->indent() + ->addDebugInfo($parent) + ->write('return ') + ; + + if ($parent instanceof ConstantExpression) { + $compiler->subcompile($parent); + } else { + $compiler + ->raw('$this->loadTemplate(') + ->subcompile($parent) + ->raw(', ') + ->repr($this->source->getName()) + ->raw(', ') + ->repr($parent->getTemplateLine()) + ->raw(')') + ; + } + + $compiler + ->raw(";\n") + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileClassHeader(Compiler $compiler) + { + $compiler + ->write("\n\n") + ; + if (!$this->getAttribute('index')) { + $compiler + ->write("use Twig\Environment;\n") + ->write("use Twig\Error\LoaderError;\n") + ->write("use Twig\Error\RuntimeError;\n") + ->write("use Twig\Markup;\n") + ->write("use Twig\Sandbox\SecurityError;\n") + ->write("use Twig\Sandbox\SecurityNotAllowedTagError;\n") + ->write("use Twig\Sandbox\SecurityNotAllowedFilterError;\n") + ->write("use Twig\Sandbox\SecurityNotAllowedFunctionError;\n") + ->write("use Twig\Source;\n") + ->write("use Twig\Template;\n\n") + ; + } + $compiler + // if the template name contains */, add a blank to avoid a PHP parse error + ->write('/* '.str_replace('*/', '* /', $this->source->getName())." */\n") + ->write('class '.$compiler->getEnvironment()->getTemplateClass($this->source->getName(), $this->getAttribute('index'))) + ->raw(sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass())) + ->write("{\n") + ->indent() + ; + } + + protected function compileConstructor(Compiler $compiler) + { + $compiler + ->write("public function __construct(Environment \$env)\n", "{\n") + ->indent() + ->subcompile($this->getNode('constructor_start')) + ->write("parent::__construct(\$env);\n\n") + ; + + // parent + if (!$this->hasNode('parent')) { + $compiler->write("\$this->parent = false;\n\n"); + } elseif (($parent = $this->getNode('parent')) && $parent instanceof ConstantExpression) { + $compiler + ->addDebugInfo($parent) + ->write('$this->parent = $this->loadTemplate(') + ->subcompile($parent) + ->raw(', ') + ->repr($this->source->getName()) + ->raw(', ') + ->repr($parent->getTemplateLine()) + ->raw(");\n") + ; + } + + $countTraits = \count($this->getNode('traits')); + if ($countTraits) { + // traits + foreach ($this->getNode('traits') as $i => $trait) { + $this->compileLoadTemplate($compiler, $trait->getNode('template'), sprintf('$_trait_%s', $i)); + + $compiler + ->addDebugInfo($trait->getNode('template')) + ->write(sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i)) + ->indent() + ->write("throw new RuntimeError('Template \"'.") + ->subcompile($trait->getNode('template')) + ->raw(".'\" cannot be used as a trait.');\n") + ->outdent() + ->write("}\n") + ->write(sprintf("\$_trait_%s_blocks = \$_trait_%s->getBlocks();\n\n", $i, $i)) + ; + + foreach ($trait->getNode('targets') as $key => $value) { + $compiler + ->write(sprintf('if (!isset($_trait_%s_blocks[', $i)) + ->string($key) + ->raw("])) {\n") + ->indent() + ->write("throw new RuntimeError(sprintf('Block ") + ->string($key) + ->raw(' is not defined in trait ') + ->subcompile($trait->getNode('template')) + ->raw(".'));\n") + ->outdent() + ->write("}\n\n") + + ->write(sprintf('$_trait_%s_blocks[', $i)) + ->subcompile($value) + ->raw(sprintf('] = $_trait_%s_blocks[', $i)) + ->string($key) + ->raw(sprintf(']; unset($_trait_%s_blocks[', $i)) + ->string($key) + ->raw("]);\n\n") + ; + } + } + + if ($countTraits > 1) { + $compiler + ->write("\$this->traits = array_merge(\n") + ->indent() + ; + + for ($i = 0; $i < $countTraits; ++$i) { + $compiler + ->write(sprintf('$_trait_%s_blocks'.($i == $countTraits - 1 ? '' : ',')."\n", $i)) + ; + } + + $compiler + ->outdent() + ->write(");\n\n") + ; + } else { + $compiler + ->write("\$this->traits = \$_trait_0_blocks;\n\n") + ; + } + + $compiler + ->write("\$this->blocks = array_merge(\n") + ->indent() + ->write("\$this->traits,\n") + ->write("[\n") + ; + } else { + $compiler + ->write("\$this->blocks = [\n") + ; + } + + // blocks + $compiler + ->indent() + ; + + foreach ($this->getNode('blocks') as $name => $node) { + $compiler + ->write(sprintf("'%s' => [\$this, 'block_%s'],\n", $name, $name)) + ; + } + + if ($countTraits) { + $compiler + ->outdent() + ->write("]\n") + ->outdent() + ->write(");\n") + ; + } else { + $compiler + ->outdent() + ->write("];\n") + ; + } + + $compiler + ->subcompile($this->getNode('constructor_end')) + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileDisplay(Compiler $compiler) + { + $compiler + ->write("protected function doDisplay(array \$context, array \$blocks = [])\n", "{\n") + ->indent() + ->subcompile($this->getNode('display_start')) + ->subcompile($this->getNode('body')) + ; + + if ($this->hasNode('parent')) { + $parent = $this->getNode('parent'); + $compiler->addDebugInfo($parent); + if ($parent instanceof ConstantExpression) { + $compiler->write('$this->parent'); + } else { + $compiler->write('$this->getParent($context)'); + } + $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n"); + } + + $compiler + ->subcompile($this->getNode('display_end')) + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileClassFooter(Compiler $compiler) + { + $compiler + ->subcompile($this->getNode('class_end')) + ->outdent() + ->write("}\n") + ; + } + + protected function compileMacros(Compiler $compiler) + { + $compiler->subcompile($this->getNode('macros')); + } + + protected function compileGetTemplateName(Compiler $compiler) + { + $compiler + ->write("public function getTemplateName()\n", "{\n") + ->indent() + ->write('return ') + ->repr($this->source->getName()) + ->raw(";\n") + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileIsTraitable(Compiler $compiler) + { + // A template can be used as a trait if: + // * it has no parent + // * it has no macros + // * it has no body + // + // Put another way, a template can be used as a trait if it + // only contains blocks and use statements. + $traitable = !$this->hasNode('parent') && 0 === \count($this->getNode('macros')); + if ($traitable) { + if ($this->getNode('body') instanceof BodyNode) { + $nodes = $this->getNode('body')->getNode(0); + } else { + $nodes = $this->getNode('body'); + } + + if (!\count($nodes)) { + $nodes = new Node([$nodes]); + } + + foreach ($nodes as $node) { + if (!\count($node)) { + continue; + } + + if ($node instanceof TextNode && ctype_space($node->getAttribute('data'))) { + continue; + } + + if ($node instanceof BlockReferenceNode) { + continue; + } + + $traitable = false; + break; + } + } + + if ($traitable) { + return; + } + + $compiler + ->write("public function isTraitable()\n", "{\n") + ->indent() + ->write(sprintf("return %s;\n", $traitable ? 'true' : 'false')) + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileDebugInfo(Compiler $compiler) + { + $compiler + ->write("public function getDebugInfo()\n", "{\n") + ->indent() + ->write(sprintf("return %s;\n", str_replace("\n", '', var_export(array_reverse($compiler->getDebugInfo(), true), true)))) + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileGetSource(Compiler $compiler) + { + $compiler + ->write("/** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */\n") + ->write("public function getSource()\n", "{\n") + ->indent() + ->write("@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);\n\n") + ->write('return $this->getSourceContext()->getCode();') + ->raw("\n") + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileGetSourceContext(Compiler $compiler) + { + $compiler + ->write("public function getSourceContext()\n", "{\n") + ->indent() + ->write('return new Source(') + ->string($compiler->getEnvironment()->isDebug() ? $this->source->getCode() : '') + ->raw(', ') + ->string($this->source->getName()) + ->raw(', ') + ->string($this->source->getPath()) + ->raw(");\n") + ->outdent() + ->write("}\n") + ; + } + + protected function compileLoadTemplate(Compiler $compiler, $node, $var) + { + if ($node instanceof ConstantExpression) { + $compiler + ->write(sprintf('%s = $this->loadTemplate(', $var)) + ->subcompile($node) + ->raw(', ') + ->repr($node->getTemplateName()) + ->raw(', ') + ->repr($node->getTemplateLine()) + ->raw(");\n") + ; + } else { + throw new \LogicException('Trait templates can only be constant nodes.'); + } } } + +class_alias('Twig\Node\ModuleNode', 'Twig_Node_Module'); diff --git a/vendor/twig/twig/src/Node/Node.php b/vendor/twig/twig/src/Node/Node.php index ca14a38cd3d470ef17b2fd7dce14bad3b2d848a8..d60367ff2513d0ab80ad82b375039a39eba08178 100644 --- a/vendor/twig/twig/src/Node/Node.php +++ b/vendor/twig/twig/src/Node/Node.php @@ -1,11 +1,262 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node; -class_exists('Twig_Node'); +use Twig\Compiler; + +/** + * Represents a node in the AST. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class Node implements \Twig_NodeInterface +{ + protected $nodes; + protected $attributes; + protected $lineno; + protected $tag; + + private $name; + + /** + * Constructor. + * + * The nodes are automatically made available as properties ($this->node). + * The attributes are automatically made available as array items ($this['name']). + * + * @param array $nodes An array of named nodes + * @param array $attributes An array of attributes (should not be nodes) + * @param int $lineno The line number + * @param string $tag The tag name associated with the Node + */ + public function __construct(array $nodes = [], array $attributes = [], $lineno = 0, $tag = null) + { + foreach ($nodes as $name => $node) { + if (!$node instanceof \Twig_NodeInterface) { + @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', \is_object($node) ? \get_class($node) : null === $node ? 'null' : \gettype($node), $name, \get_class($this)), E_USER_DEPRECATED); + } + } + $this->nodes = $nodes; + $this->attributes = $attributes; + $this->lineno = $lineno; + $this->tag = $tag; + } + + public function __toString() + { + $attributes = []; + foreach ($this->attributes as $name => $value) { + $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); + } + + $repr = [\get_class($this).'('.implode(', ', $attributes)]; + + if (\count($this->nodes)) { + foreach ($this->nodes as $name => $node) { + $len = \strlen($name) + 4; + $noderepr = []; + foreach (explode("\n", (string) $node) as $line) { + $noderepr[] = str_repeat(' ', $len).$line; + } + + $repr[] = sprintf(' %s: %s', $name, ltrim(implode("\n", $noderepr))); + } + + $repr[] = ')'; + } else { + $repr[0] .= ')'; + } + + return implode("\n", $repr); + } + + /** + * @deprecated since 1.16.1 (to be removed in 2.0) + */ + public function toXml($asDom = false) + { + @trigger_error(sprintf('%s is deprecated since version 1.16.1 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED); + + $dom = new \DOMDocument('1.0', 'UTF-8'); + $dom->formatOutput = true; + $dom->appendChild($xml = $dom->createElement('twig')); + + $xml->appendChild($node = $dom->createElement('node')); + $node->setAttribute('class', \get_class($this)); + + foreach ($this->attributes as $name => $value) { + $node->appendChild($attribute = $dom->createElement('attribute')); + $attribute->setAttribute('name', $name); + $attribute->appendChild($dom->createTextNode($value)); + } + + foreach ($this->nodes as $name => $n) { + if (null === $n) { + continue; + } + + $child = $n->toXml(true)->getElementsByTagName('node')->item(0); + $child = $dom->importNode($child, true); + $child->setAttribute('name', $name); -if (\false) { - class Node extends \Twig_Node + $node->appendChild($child); + } + + return $asDom ? $dom : $dom->saveXML(); + } + + public function compile(Compiler $compiler) + { + foreach ($this->nodes as $node) { + $node->compile($compiler); + } + } + + public function getTemplateLine() { + return $this->lineno; + } + + /** + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function getLine() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getTemplateLine() instead.', E_USER_DEPRECATED); + + return $this->lineno; + } + + public function getNodeTag() + { + return $this->tag; + } + + /** + * @return bool + */ + public function hasAttribute($name) + { + return \array_key_exists($name, $this->attributes); + } + + /** + * @return mixed + */ + public function getAttribute($name) + { + if (!\array_key_exists($name, $this->attributes)) { + throw new \LogicException(sprintf('Attribute "%s" does not exist for Node "%s".', $name, \get_class($this))); + } + + return $this->attributes[$name]; + } + + /** + * @param string $name + * @param mixed $value + */ + public function setAttribute($name, $value) + { + $this->attributes[$name] = $value; + } + + public function removeAttribute($name) + { + unset($this->attributes[$name]); + } + + /** + * @return bool + */ + public function hasNode($name) + { + return \array_key_exists($name, $this->nodes); + } + + /** + * @return Node + */ + public function getNode($name) + { + if (!\array_key_exists($name, $this->nodes)) { + throw new \LogicException(sprintf('Node "%s" does not exist for Node "%s".', $name, \get_class($this))); + } + + return $this->nodes[$name]; + } + + public function setNode($name, $node = null) + { + if (!$node instanceof \Twig_NodeInterface) { + @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', \is_object($node) ? \get_class($node) : null === $node ? 'null' : \gettype($node), $name, \get_class($this)), E_USER_DEPRECATED); + } + + $this->nodes[$name] = $node; + } + + public function removeNode($name) + { + unset($this->nodes[$name]); + } + + public function count() + { + return \count($this->nodes); + } + + public function getIterator() + { + return new \ArrayIterator($this->nodes); + } + + public function setTemplateName($name) + { + $this->name = $name; + foreach ($this->nodes as $node) { + if (null !== $node) { + $node->setTemplateName($name); + } + } + } + + public function getTemplateName() + { + return $this->name; + } + + /** + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function setFilename($name) + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use setTemplateName() instead.', E_USER_DEPRECATED); + + $this->setTemplateName($name); + } + + /** + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function getFilename() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getTemplateName() instead.', E_USER_DEPRECATED); + + return $this->name; } } + +class_alias('Twig\Node\Node', 'Twig_Node'); + +// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. +class_exists('Twig\Compiler'); diff --git a/vendor/twig/twig/src/Node/NodeCaptureInterface.php b/vendor/twig/twig/src/Node/NodeCaptureInterface.php index 4ba4e21f7494cf3a0c0567a1f42ac0b06f9980c5..474003f34bda95d91d1c59a20d81f9c2fd490cbd 100644 --- a/vendor/twig/twig/src/Node/NodeCaptureInterface.php +++ b/vendor/twig/twig/src/Node/NodeCaptureInterface.php @@ -1,11 +1,23 @@ <?php -namespace Twig\Node; +/* + * 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. + */ -class_exists('Twig_NodeCaptureInterface'); +namespace Twig\Node; -if (\false) { - interface NodeCaptureInterface extends \Twig_NodeCaptureInterface - { - } +/** + * Represents a node that captures any nested displayable nodes. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +interface NodeCaptureInterface +{ } + +class_alias('Twig\Node\NodeCaptureInterface', 'Twig_NodeCaptureInterface'); diff --git a/vendor/twig/twig/src/Node/NodeOutputInterface.php b/vendor/twig/twig/src/Node/NodeOutputInterface.php index 5602e7a1dd5cf8b1b25882804690c6fbca12ec6c..8b046ee766180c566a1555eeaa27adf1d33b43a9 100644 --- a/vendor/twig/twig/src/Node/NodeOutputInterface.php +++ b/vendor/twig/twig/src/Node/NodeOutputInterface.php @@ -1,11 +1,23 @@ <?php -namespace Twig\Node; +/* + * 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. + */ -class_exists('Twig_NodeOutputInterface'); +namespace Twig\Node; -if (\false) { - interface NodeOutputInterface extends \Twig_NodeOutputInterface - { - } +/** + * Represents a displayable node in the AST. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +interface NodeOutputInterface +{ } + +class_alias('Twig\Node\NodeOutputInterface', 'Twig_NodeOutputInterface'); diff --git a/vendor/twig/twig/src/Node/PrintNode.php b/vendor/twig/twig/src/Node/PrintNode.php index 4ff2ed6124e23a509fefa485cd276043d22e61e8..27f1ca42272f2ca11d9291d3bf1100a8ceb119b4 100644 --- a/vendor/twig/twig/src/Node/PrintNode.php +++ b/vendor/twig/twig/src/Node/PrintNode.php @@ -1,11 +1,41 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node; -class_exists('Twig_Node_Print'); +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; -if (\false) { - class PrintNode extends \Twig_Node_Print +/** + * Represents a node that outputs an expression. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class PrintNode extends Node implements NodeOutputInterface +{ + public function __construct(AbstractExpression $expr, $lineno, $tag = null) { + parent::__construct(['expr' => $expr], [], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('echo ') + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ; } } + +class_alias('Twig\Node\PrintNode', 'Twig_Node_Print'); diff --git a/vendor/twig/twig/src/Node/SandboxNode.php b/vendor/twig/twig/src/Node/SandboxNode.php index a24219f1cec69d038e91cb8cd266b5eab5c8da80..2d644c3a137ba8ef47c6c918884e13648d95150f 100644 --- a/vendor/twig/twig/src/Node/SandboxNode.php +++ b/vendor/twig/twig/src/Node/SandboxNode.php @@ -1,11 +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. + */ + namespace Twig\Node; -class_exists('Twig_Node_Sandbox'); +use Twig\Compiler; -if (\false) { - class SandboxNode extends \Twig_Node_Sandbox +/** + * Represents a sandbox node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class SandboxNode extends Node +{ + public function __construct(\Twig_NodeInterface $body, $lineno, $tag = null) { + parent::__construct(['body' => $body], [], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write("if (!\$alreadySandboxed = \$this->sandbox->isSandboxed()) {\n") + ->indent() + ->write("\$this->sandbox->enableSandbox();\n") + ->outdent() + ->write("}\n") + ->subcompile($this->getNode('body')) + ->write("if (!\$alreadySandboxed) {\n") + ->indent() + ->write("\$this->sandbox->disableSandbox();\n") + ->outdent() + ->write("}\n") + ; } } + +class_alias('Twig\Node\SandboxNode', 'Twig_Node_Sandbox'); diff --git a/vendor/twig/twig/src/Node/SandboxedPrintNode.php b/vendor/twig/twig/src/Node/SandboxedPrintNode.php index a9f42bd5122a4f0a4a9461ba3bfd09ad02310367..2359af911047977724cd29c8474d4e900e749ada 100644 --- a/vendor/twig/twig/src/Node/SandboxedPrintNode.php +++ b/vendor/twig/twig/src/Node/SandboxedPrintNode.php @@ -1,11 +1,69 @@ <?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\Node; -class_exists('Twig_Node_SandboxedPrint'); +use Twig\Compiler; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FilterExpression; + +/** + * Adds a check for the __toString() method when the variable is an object and the sandbox is activated. + * + * When there is a simple Print statement, like {{ article }}, + * and if the sandbox is enabled, we need to check that the __toString() + * method is allowed if 'article' is an object. + * + * Not used anymore, to be deprecated in 2.x and removed in 3.0 + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class SandboxedPrintNode extends PrintNode +{ + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('echo ') + ; + $expr = $this->getNode('expr'); + if ($expr instanceof ConstantExpression) { + $compiler + ->subcompile($expr) + ->raw(";\n") + ; + } else { + $compiler + ->write('$this->env->getExtension(\'\Twig\Extension\SandboxExtension\')->ensureToStringAllowed(') + ->subcompile($expr) + ->raw(");\n") + ; + } + } -if (\false) { - class SandboxedPrintNode extends \Twig_Node_SandboxedPrint + /** + * Removes node filters. + * + * This is mostly needed when another visitor adds filters (like the escaper one). + * + * @return Node + */ + protected function removeNodeFilter(Node $node) { + if ($node instanceof FilterExpression) { + return $this->removeNodeFilter($node->getNode('node')); + } + + return $node; } } + +class_alias('Twig\Node\SandboxedPrintNode', 'Twig_Node_SandboxedPrint'); diff --git a/vendor/twig/twig/src/Node/SetNode.php b/vendor/twig/twig/src/Node/SetNode.php index d45f133e1c2e8698ac0eac383726327d93ed04e8..2c10a3a92e331e0c1bd5cbddc4f58d8e1cd24202 100644 --- a/vendor/twig/twig/src/Node/SetNode.php +++ b/vendor/twig/twig/src/Node/SetNode.php @@ -1,11 +1,103 @@ <?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\Node; -class_exists('Twig_Node_Set'); +use Twig\Compiler; +use Twig\Node\Expression\ConstantExpression; -if (\false) { - class SetNode extends \Twig_Node_Set +/** + * Represents a set node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class SetNode extends Node implements NodeCaptureInterface +{ + public function __construct($capture, \Twig_NodeInterface $names, \Twig_NodeInterface $values, $lineno, $tag = null) { + parent::__construct(['names' => $names, 'values' => $values], ['capture' => $capture, 'safe' => false], $lineno, $tag); + + /* + * Optimizes the node when capture is used for a large block of text. + * + * {% set foo %}foo{% endset %} is compiled to $context['foo'] = new Twig\Markup("foo"); + */ + if ($this->getAttribute('capture')) { + $this->setAttribute('safe', true); + + $values = $this->getNode('values'); + if ($values instanceof TextNode) { + $this->setNode('values', new ConstantExpression($values->getAttribute('data'), $values->getTemplateLine())); + $this->setAttribute('capture', false); + } + } + } + + public function compile(Compiler $compiler) + { + $compiler->addDebugInfo($this); + + if (\count($this->getNode('names')) > 1) { + $compiler->write('list('); + foreach ($this->getNode('names') as $idx => $node) { + if ($idx) { + $compiler->raw(', '); + } + + $compiler->subcompile($node); + } + $compiler->raw(')'); + } else { + if ($this->getAttribute('capture')) { + $compiler + ->write("ob_start();\n") + ->subcompile($this->getNode('values')) + ; + } + + $compiler->subcompile($this->getNode('names'), false); + + if ($this->getAttribute('capture')) { + $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset())"); + } + } + + if (!$this->getAttribute('capture')) { + $compiler->raw(' = '); + + if (\count($this->getNode('names')) > 1) { + $compiler->write('['); + foreach ($this->getNode('values') as $idx => $value) { + if ($idx) { + $compiler->raw(', '); + } + + $compiler->subcompile($value); + } + $compiler->raw(']'); + } else { + if ($this->getAttribute('safe')) { + $compiler + ->raw("('' === \$tmp = ") + ->subcompile($this->getNode('values')) + ->raw(") ? '' : new Markup(\$tmp, \$this->env->getCharset())") + ; + } else { + $compiler->subcompile($this->getNode('values')); + } + } + } + + $compiler->raw(";\n"); } } + +class_alias('Twig\Node\SetNode', 'Twig_Node_Set'); diff --git a/vendor/twig/twig/src/Node/SetTempNode.php b/vendor/twig/twig/src/Node/SetTempNode.php index 90915d2f563d3287cabb64bfa70915187c5b5914..918fb991de008d380e80c2558228b4d555697d8c 100644 --- a/vendor/twig/twig/src/Node/SetTempNode.php +++ b/vendor/twig/twig/src/Node/SetTempNode.php @@ -1,11 +1,44 @@ <?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\Node; -class_exists('Twig_Node_SetTemp'); +use Twig\Compiler; -if (\false) { - class SetTempNode extends \Twig_Node_SetTemp +/** + * @internal + */ +class SetTempNode extends Node +{ + public function __construct($name, $lineno) { + parent::__construct([], ['name' => $name], $lineno); + } + + public function compile(Compiler $compiler) + { + $name = $this->getAttribute('name'); + $compiler + ->addDebugInfo($this) + ->write('if (isset($context[') + ->string($name) + ->raw('])) { $_') + ->raw($name) + ->raw('_ = $context[') + ->repr($name) + ->raw(']; } else { $_') + ->raw($name) + ->raw("_ = null; }\n") + ; } } + +class_alias('Twig\Node\SetTempNode', 'Twig_Node_SetTemp'); diff --git a/vendor/twig/twig/src/Node/SpacelessNode.php b/vendor/twig/twig/src/Node/SpacelessNode.php index 08cf9d082de007d164e3c41bf126d6ec36826b0d..9beebf32cb437eaba926000428d4eefbd0f73b3d 100644 --- a/vendor/twig/twig/src/Node/SpacelessNode.php +++ b/vendor/twig/twig/src/Node/SpacelessNode.php @@ -1,11 +1,41 @@ <?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\Node; -class_exists('Twig_Node_Spaceless'); +use Twig\Compiler; -if (\false) { - class SpacelessNode extends \Twig_Node_Spaceless +/** + * Represents a spaceless node. + * + * It removes spaces between HTML tags. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class SpacelessNode extends Node +{ + public function __construct(\Twig_NodeInterface $body, $lineno, $tag = 'spaceless') { + parent::__construct(['body' => $body], [], $lineno, $tag); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write("ob_start();\n") + ->subcompile($this->getNode('body')) + ->write("echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));\n") + ; } } + +class_alias('Twig\Node\SpacelessNode', 'Twig_Node_Spaceless'); diff --git a/vendor/twig/twig/src/Node/TextNode.php b/vendor/twig/twig/src/Node/TextNode.php index daff76478dcd003de1ba15b727538fef3f3d1902..9ac435e904f3078e12bc0546114e27efad363fd2 100644 --- a/vendor/twig/twig/src/Node/TextNode.php +++ b/vendor/twig/twig/src/Node/TextNode.php @@ -1,11 +1,40 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\Node; -class_exists('Twig_Node_Text'); +use Twig\Compiler; -if (\false) { - class TextNode extends \Twig_Node_Text +/** + * Represents a text node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class TextNode extends Node implements NodeOutputInterface +{ + public function __construct($data, $lineno) { + parent::__construct([], ['data' => $data], $lineno); + } + + public function compile(Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('echo ') + ->string($this->getAttribute('data')) + ->raw(";\n") + ; } } + +class_alias('Twig\Node\TextNode', 'Twig_Node_Text'); diff --git a/vendor/twig/twig/src/Node/WithNode.php b/vendor/twig/twig/src/Node/WithNode.php index 072fa6d8869c3d465284a5e7da1af5167d995c02..77364ac51083233aacebfd7ad89bd6028bbbbd9b 100644 --- a/vendor/twig/twig/src/Node/WithNode.php +++ b/vendor/twig/twig/src/Node/WithNode.php @@ -1,11 +1,68 @@ <?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\Node; -class_exists('Twig_Node_With'); +use Twig\Compiler; + +/** + * Represents a nested "with" scope. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class WithNode extends Node +{ + public function __construct(Node $body, Node $variables = null, $only = false, $lineno, $tag = null) + { + $nodes = ['body' => $body]; + if (null !== $variables) { + $nodes['variables'] = $variables; + } + + parent::__construct($nodes, ['only' => (bool) $only], $lineno, $tag); + } -if (\false) { - class WithNode extends \Twig_Node_With + public function compile(Compiler $compiler) { + $compiler->addDebugInfo($this); + + if ($this->hasNode('variables')) { + $varsName = $compiler->getVarName(); + $compiler + ->write(sprintf('$%s = ', $varsName)) + ->subcompile($this->getNode('variables')) + ->raw(";\n") + ->write(sprintf("if (!is_array(\$%s)) {\n", $varsName)) + ->indent() + ->write("throw new RuntimeError('Variables passed to the \"with\" tag must be a hash.');\n") + ->outdent() + ->write("}\n") + ; + + if ($this->getAttribute('only')) { + $compiler->write("\$context = ['_parent' => \$context];\n"); + } else { + $compiler->write("\$context['_parent'] = \$context;\n"); + } + + $compiler->write(sprintf("\$context = array_merge(\$context, \$%s);\n", $varsName)); + } else { + $compiler->write("\$context['_parent'] = \$context;\n"); + } + + $compiler + ->subcompile($this->getNode('body')) + ->write("\$context = \$context['_parent'];\n") + ; } } + +class_alias('Twig\Node\WithNode', 'Twig_Node_With'); diff --git a/vendor/twig/twig/src/NodeTraverser.php b/vendor/twig/twig/src/NodeTraverser.php index 7fe843b7a9817c22841ac688dc27195aae3a825c..8b0f85c52f799ed046bf60ec41693b2b1796f194 100644 --- a/vendor/twig/twig/src/NodeTraverser.php +++ b/vendor/twig/twig/src/NodeTraverser.php @@ -1,11 +1,85 @@ <?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; -class_exists('Twig_NodeTraverser'); +use Twig\NodeVisitor\NodeVisitorInterface; + +/** + * A node traverser. + * + * It visits all nodes and their children and calls the given visitor for each. + * + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class NodeTraverser +{ + protected $env; + protected $visitors = []; + + /** + * @param NodeVisitorInterface[] $visitors + */ + public function __construct(Environment $env, array $visitors = []) + { + $this->env = $env; + foreach ($visitors as $visitor) { + $this->addVisitor($visitor); + } + } + + public function addVisitor(NodeVisitorInterface $visitor) + { + $this->visitors[$visitor->getPriority()][] = $visitor; + } + + /** + * Traverses a node and calls the registered visitors. + * + * @return \Twig_NodeInterface + */ + public function traverse(\Twig_NodeInterface $node) + { + ksort($this->visitors); + foreach ($this->visitors as $visitors) { + foreach ($visitors as $visitor) { + $node = $this->traverseForVisitor($visitor, $node); + } + } + + return $node; + } -if (\false) { - class NodeTraverser extends \Twig_NodeTraverser + protected function traverseForVisitor(NodeVisitorInterface $visitor, \Twig_NodeInterface $node = null) { + if (null === $node) { + return; + } + + $node = $visitor->enterNode($node, $this->env); + + foreach ($node as $k => $n) { + if (false !== $m = $this->traverseForVisitor($visitor, $n)) { + if ($m !== $n) { + $node->setNode($k, $m); + } + } else { + $node->removeNode($k); + } + } + + return $visitor->leaveNode($node, $this->env); } } + +class_alias('Twig\NodeTraverser', 'Twig_NodeTraverser'); diff --git a/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php index 30e956fb54f83ad069c732d8370c8f427da162d2..184be8ecb6ef9b0302b74cad770503881e795e6e 100644 --- a/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php @@ -1,11 +1,57 @@ <?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\NodeVisitor; -class_exists('Twig_BaseNodeVisitor'); +use Twig\Environment; +use Twig\Node\Node; -if (\false) { - class AbstractNodeVisitor extends \Twig_BaseNodeVisitor +/** + * Used to make node visitors compatible with Twig 1.x and 2.x. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +abstract class AbstractNodeVisitor implements NodeVisitorInterface +{ + final public function enterNode(\Twig_NodeInterface $node, Environment $env) { + if (!$node instanceof Node) { + throw new \LogicException(sprintf('%s only supports \Twig\Node\Node instances.', __CLASS__)); + } + + return $this->doEnterNode($node, $env); } + + final public function leaveNode(\Twig_NodeInterface $node, Environment $env) + { + if (!$node instanceof Node) { + throw new \LogicException(sprintf('%s only supports \Twig\Node\Node instances.', __CLASS__)); + } + + return $this->doLeaveNode($node, $env); + } + + /** + * Called before child nodes are visited. + * + * @return Node The modified node + */ + 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 + */ + abstract protected function doLeaveNode(Node $node, Environment $env); } + +class_alias('Twig\NodeVisitor\AbstractNodeVisitor', 'Twig_BaseNodeVisitor'); diff --git a/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php index 68c28322e6207802dfe379fafadd154c57716b4e..959108f0571b010a3fb99295c5f145020ab08d21 100644 --- a/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php @@ -1,11 +1,166 @@ <?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\NodeVisitor; -class_exists('Twig_NodeVisitor_Escaper'); +use Twig\Environment; +use Twig\Node\AutoEscapeNode; +use Twig\Node\BlockNode; +use Twig\Node\BlockReferenceNode; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FilterExpression; +use Twig\Node\ImportNode; +use Twig\Node\ModuleNode; +use Twig\Node\Node; +use Twig\Node\PrintNode; +use Twig\NodeTraverser; + +/** + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class EscaperNodeVisitor extends AbstractNodeVisitor +{ + protected $statusStack = []; + protected $blocks = []; + protected $safeAnalysis; + protected $traverser; + protected $defaultStrategy = false; + protected $safeVars = []; + + public function __construct() + { + $this->safeAnalysis = new SafeAnalysisNodeVisitor(); + } + + protected function doEnterNode(Node $node, Environment $env) + { + if ($node instanceof ModuleNode) { + if ($env->hasExtension('\Twig\Extension\EscaperExtension') && $defaultStrategy = $env->getExtension('\Twig\Extension\EscaperExtension')->getDefaultStrategy($node->getTemplateName())) { + $this->defaultStrategy = $defaultStrategy; + } + $this->safeVars = []; + $this->blocks = []; + } elseif ($node instanceof AutoEscapeNode) { + $this->statusStack[] = $node->getAttribute('value'); + } elseif ($node instanceof BlockNode) { + $this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env); + } elseif ($node instanceof ImportNode) { + $this->safeVars[] = $node->getNode('var')->getAttribute('name'); + } + + return $node; + } + + protected function doLeaveNode(Node $node, Environment $env) + { + if ($node instanceof ModuleNode) { + $this->defaultStrategy = false; + $this->safeVars = []; + $this->blocks = []; + } elseif ($node instanceof FilterExpression) { + return $this->preEscapeFilterNode($node, $env); + } elseif ($node instanceof PrintNode) { + return $this->escapePrintNode($node, $env, $this->needEscaping($env)); + } + + if ($node instanceof AutoEscapeNode || $node instanceof BlockNode) { + array_pop($this->statusStack); + } elseif ($node instanceof BlockReferenceNode) { + $this->blocks[$node->getAttribute('name')] = $this->needEscaping($env); + } + + return $node; + } + + protected function escapePrintNode(PrintNode $node, Environment $env, $type) + { + if (false === $type) { + return $node; + } + + $expression = $node->getNode('expr'); + + if ($this->isSafeFor($type, $expression, $env)) { + return $node; + } + + $class = \get_class($node); + + return new $class( + $this->getEscaperFilter($type, $expression), + $node->getTemplateLine() + ); + } + + protected function preEscapeFilterNode(FilterExpression $filter, Environment $env) + { + $name = $filter->getNode('filter')->getAttribute('value'); + + $type = $env->getFilter($name)->getPreEscape(); + if (null === $type) { + return $filter; + } + + $node = $filter->getNode('node'); + if ($this->isSafeFor($type, $node, $env)) { + return $filter; + } + + $filter->setNode('node', $this->getEscaperFilter($type, $node)); + + return $filter; + } + + protected function isSafeFor($type, \Twig_NodeInterface $expression, $env) + { + $safe = $this->safeAnalysis->getSafe($expression); + + if (null === $safe) { + if (null === $this->traverser) { + $this->traverser = new NodeTraverser($env, [$this->safeAnalysis]); + } + + $this->safeAnalysis->setSafeVars($this->safeVars); + + $this->traverser->traverse($expression); + $safe = $this->safeAnalysis->getSafe($expression); + } -if (\false) { - class EscaperNodeVisitor extends \Twig_NodeVisitor_Escaper + return \in_array($type, $safe) || \in_array('all', $safe); + } + + protected function needEscaping(Environment $env) { + if (\count($this->statusStack)) { + return $this->statusStack[\count($this->statusStack) - 1]; + } + + return $this->defaultStrategy ? $this->defaultStrategy : false; + } + + protected function getEscaperFilter($type, \Twig_NodeInterface $node) + { + $line = $node->getTemplateLine(); + $name = new ConstantExpression('escape', $line); + $args = new Node([new ConstantExpression((string) $type, $line), new ConstantExpression(null, $line), new ConstantExpression(true, $line)]); + + return new FilterExpression($node, $name, $args, $line); + } + + public function getPriority() + { + return 0; } } + +class_alias('Twig\NodeVisitor\EscaperNodeVisitor', 'Twig_NodeVisitor_Escaper'); diff --git a/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php b/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php index f78f1d73dbcb79f0fa4530e1ac36ed676a0fe357..5e21c4f616ac4544ae110c7ba7e0903cde95d617 100644 --- a/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php +++ b/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php @@ -1,11 +1,50 @@ <?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\NodeVisitor; -class_exists('Twig_NodeVisitorInterface'); +use Twig\Environment; + +/** + * Interface for node visitor classes. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +interface NodeVisitorInterface +{ + /** + * Called before child nodes are visited. + * + * @return \Twig_NodeInterface The modified node + */ + 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 + */ + public function leaveNode(\Twig_NodeInterface $node, Environment $env); -if (\false) { - interface NodeVisitorInterface extends \Twig_NodeVisitorInterface - { - } + /** + * Returns the priority for this visitor. + * + * Priority should be between -10 and 10 (0 is the default). + * + * @return int The priority level + */ + public function getPriority(); } + +class_alias('Twig\NodeVisitor\NodeVisitorInterface', 'Twig_NodeVisitorInterface'); + +// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. +class_exists('Twig\Environment'); diff --git a/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php index 9ed37a555fda11c86fa81be4cc39c701ca8e0a3e..e5ea9b7cc396fcd21dfa2845dcd4f93f97b6383d 100644 --- a/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php @@ -1,11 +1,273 @@ <?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\NodeVisitor; -class_exists('Twig_NodeVisitor_Optimizer'); +use Twig\Environment; +use Twig\Node\BlockReferenceNode; +use Twig\Node\BodyNode; +use Twig\Node\Expression\AbstractExpression; +use Twig\Node\Expression\BlockReferenceExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FilterExpression; +use Twig\Node\Expression\FunctionExpression; +use Twig\Node\Expression\GetAttrExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\Expression\ParentExpression; +use Twig\Node\Expression\TempNameExpression; +use Twig\Node\ForNode; +use Twig\Node\IncludeNode; +use Twig\Node\Node; +use Twig\Node\PrintNode; +use Twig\Node\SetTempNode; + +/** + * Tries to optimize the AST. + * + * This visitor is always the last registered one. + * + * You can configure which optimizations you want to activate via the + * optimizer mode. + * + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class OptimizerNodeVisitor extends AbstractNodeVisitor +{ + const OPTIMIZE_ALL = -1; + const OPTIMIZE_NONE = 0; + const OPTIMIZE_FOR = 2; + const OPTIMIZE_RAW_FILTER = 4; + const OPTIMIZE_VAR_ACCESS = 8; + + protected $loops = []; + protected $loopsTargets = []; + protected $optimizers; + protected $prependedNodes = []; + protected $inABody = false; + + /** + * @param int $optimizers The optimizer mode + */ + public function __construct($optimizers = -1) + { + if (!\is_int($optimizers) || $optimizers > (self::OPTIMIZE_FOR | self::OPTIMIZE_RAW_FILTER | self::OPTIMIZE_VAR_ACCESS)) { + throw new \InvalidArgumentException(sprintf('Optimizer mode "%s" is not valid.', $optimizers)); + } + + $this->optimizers = $optimizers; + } + + protected function doEnterNode(Node $node, Environment $env) + { + if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { + $this->enterOptimizeFor($node, $env); + } + + if (\PHP_VERSION_ID < 50400 && self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('\Twig\Extension\SandboxExtension')) { + if ($this->inABody) { + if (!$node instanceof AbstractExpression) { + if ('Twig_Node' !== \get_class($node)) { + array_unshift($this->prependedNodes, []); + } + } else { + $node = $this->optimizeVariables($node, $env); + } + } elseif ($node instanceof BodyNode) { + $this->inABody = true; + } + } + + return $node; + } + + protected function doLeaveNode(Node $node, Environment $env) + { + $expression = $node instanceof AbstractExpression; + + if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { + $this->leaveOptimizeFor($node, $env); + } + + if (self::OPTIMIZE_RAW_FILTER === (self::OPTIMIZE_RAW_FILTER & $this->optimizers)) { + $node = $this->optimizeRawFilter($node, $env); + } + + $node = $this->optimizePrintNode($node, $env); + + if (self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('\Twig\Extension\SandboxExtension')) { + if ($node instanceof BodyNode) { + $this->inABody = false; + } elseif ($this->inABody) { + if (!$expression && 'Twig_Node' !== \get_class($node) && $prependedNodes = array_shift($this->prependedNodes)) { + $nodes = []; + foreach (array_unique($prependedNodes) as $name) { + $nodes[] = new SetTempNode($name, $node->getTemplateLine()); + } + + $nodes[] = $node; + $node = new Node($nodes); + } + } + } + + return $node; + } + + protected function optimizeVariables(\Twig_NodeInterface $node, Environment $env) + { + if ('Twig_Node_Expression_Name' === \get_class($node) && $node->isSimple()) { + $this->prependedNodes[0][] = $node->getAttribute('name'); + + return new TempNameExpression($node->getAttribute('name'), $node->getTemplateLine()); + } + + return $node; + } + + /** + * Optimizes print nodes. + * + * It replaces: + * + * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()" + * + * @return \Twig_NodeInterface + */ + protected function optimizePrintNode(\Twig_NodeInterface $node, Environment $env) + { + if (!$node instanceof PrintNode) { + return $node; + } + + $exprNode = $node->getNode('expr'); + if ( + $exprNode instanceof BlockReferenceExpression || + $exprNode instanceof ParentExpression + ) { + $exprNode->setAttribute('output', true); + + return $exprNode; + } + + return $node; + } + + /** + * Removes "raw" filters. + * + * @return \Twig_NodeInterface + */ + protected function optimizeRawFilter(\Twig_NodeInterface $node, Environment $env) + { + if ($node instanceof FilterExpression && 'raw' == $node->getNode('filter')->getAttribute('value')) { + return $node->getNode('node'); + } + + return $node; + } + + /** + * Optimizes "for" tag by removing the "loop" variable creation whenever possible. + */ + protected function enterOptimizeFor(\Twig_NodeInterface $node, Environment $env) + { + if ($node instanceof ForNode) { + // disable the loop variable by default + $node->setAttribute('with_loop', false); + array_unshift($this->loops, $node); + array_unshift($this->loopsTargets, $node->getNode('value_target')->getAttribute('name')); + array_unshift($this->loopsTargets, $node->getNode('key_target')->getAttribute('name')); + } elseif (!$this->loops) { + // we are outside a loop + return; + } + + // when do we need to add the loop variable back? + + // the loop variable is referenced for the current loop + elseif ($node instanceof NameExpression && 'loop' === $node->getAttribute('name')) { + $node->setAttribute('always_defined', true); + $this->addLoopToCurrent(); + } + + // optimize access to loop targets + elseif ($node instanceof NameExpression && \in_array($node->getAttribute('name'), $this->loopsTargets)) { + $node->setAttribute('always_defined', true); + } + + // block reference + elseif ($node instanceof BlockReferenceNode || $node instanceof BlockReferenceExpression) { + $this->addLoopToCurrent(); + } -if (\false) { - class OptimizerNodeVisitor extends \Twig_NodeVisitor_Optimizer + // include without the only attribute + elseif ($node instanceof IncludeNode && !$node->getAttribute('only')) { + $this->addLoopToAll(); + } + + // include function without the with_context=false parameter + elseif ($node instanceof FunctionExpression + && 'include' === $node->getAttribute('name') + && (!$node->getNode('arguments')->hasNode('with_context') + || false !== $node->getNode('arguments')->getNode('with_context')->getAttribute('value') + ) + ) { + $this->addLoopToAll(); + } + + // the loop variable is referenced via an attribute + elseif ($node instanceof GetAttrExpression + && (!$node->getNode('attribute') instanceof ConstantExpression + || 'parent' === $node->getNode('attribute')->getAttribute('value') + ) + && (true === $this->loops[0]->getAttribute('with_loop') + || ($node->getNode('node') instanceof NameExpression + && 'loop' === $node->getNode('node')->getAttribute('name') + ) + ) + ) { + $this->addLoopToAll(); + } + } + + /** + * Optimizes "for" tag by removing the "loop" variable creation whenever possible. + */ + protected function leaveOptimizeFor(\Twig_NodeInterface $node, Environment $env) + { + if ($node instanceof ForNode) { + array_shift($this->loops); + array_shift($this->loopsTargets); + array_shift($this->loopsTargets); + } + } + + protected function addLoopToCurrent() { + $this->loops[0]->setAttribute('with_loop', true); + } + + protected function addLoopToAll() + { + foreach ($this->loops as $loop) { + $loop->setAttribute('with_loop', true); + } + } + + public function getPriority() + { + return 255; } } + +class_alias('Twig\NodeVisitor\OptimizerNodeVisitor', 'Twig_NodeVisitor_Optimizer'); diff --git a/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php index 8906b37cc0cf4adab11225a2719916d146fbe222..97a7a3e6eebda081db690f26cfc00ecd2c712f02 100644 --- a/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php @@ -1,11 +1,164 @@ <?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\NodeVisitor; -class_exists('Twig_NodeVisitor_SafeAnalysis'); +use Twig\Environment; +use Twig\Node\Expression\BlockReferenceExpression; +use Twig\Node\Expression\ConditionalExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FilterExpression; +use Twig\Node\Expression\FunctionExpression; +use Twig\Node\Expression\GetAttrExpression; +use Twig\Node\Expression\MethodCallExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\Expression\ParentExpression; +use Twig\Node\Node; + +/** + * @final + */ +class SafeAnalysisNodeVisitor extends AbstractNodeVisitor +{ + protected $data = []; + protected $safeVars = []; + + public function setSafeVars($safeVars) + { + $this->safeVars = $safeVars; + } + + public function getSafe(\Twig_NodeInterface $node) + { + $hash = spl_object_hash($node); + if (!isset($this->data[$hash])) { + return; + } + + foreach ($this->data[$hash] as $bucket) { + if ($bucket['key'] !== $node) { + continue; + } + + if (\in_array('html_attr', $bucket['value'])) { + $bucket['value'][] = 'html'; + } + + return $bucket['value']; + } + } + + protected function setSafe(\Twig_NodeInterface $node, array $safe) + { + $hash = spl_object_hash($node); + if (isset($this->data[$hash])) { + foreach ($this->data[$hash] as &$bucket) { + if ($bucket['key'] === $node) { + $bucket['value'] = $safe; + + return; + } + } + } + $this->data[$hash][] = [ + 'key' => $node, + 'value' => $safe, + ]; + } -if (\false) { - class SafeAnalysisNodeVisitor extends \Twig_NodeVisitor_SafeAnalysis + protected function doEnterNode(Node $node, Environment $env) { + return $node; + } + + protected function doLeaveNode(Node $node, Environment $env) + { + if ($node instanceof ConstantExpression) { + // constants are marked safe for all + $this->setSafe($node, ['all']); + } elseif ($node instanceof BlockReferenceExpression) { + // blocks are safe by definition + $this->setSafe($node, ['all']); + } elseif ($node instanceof ParentExpression) { + // parent block is safe by definition + $this->setSafe($node, ['all']); + } elseif ($node instanceof ConditionalExpression) { + // intersect safeness of both operands + $safe = $this->intersectSafe($this->getSafe($node->getNode('expr2')), $this->getSafe($node->getNode('expr3'))); + $this->setSafe($node, $safe); + } elseif ($node instanceof FilterExpression) { + // filter expression is safe when the filter is safe + $name = $node->getNode('filter')->getAttribute('value'); + $args = $node->getNode('arguments'); + if (false !== $filter = $env->getFilter($name)) { + $safe = $filter->getSafe($args); + if (null === $safe) { + $safe = $this->intersectSafe($this->getSafe($node->getNode('node')), $filter->getPreservesSafety()); + } + $this->setSafe($node, $safe); + } else { + $this->setSafe($node, []); + } + } elseif ($node instanceof FunctionExpression) { + // function expression is safe when the function is safe + $name = $node->getAttribute('name'); + $args = $node->getNode('arguments'); + $function = $env->getFunction($name); + if (false !== $function) { + $this->setSafe($node, $function->getSafe($args)); + } else { + $this->setSafe($node, []); + } + } elseif ($node instanceof MethodCallExpression) { + if ($node->getAttribute('safe')) { + $this->setSafe($node, ['all']); + } else { + $this->setSafe($node, []); + } + } elseif ($node instanceof GetAttrExpression && $node->getNode('node') instanceof NameExpression) { + $name = $node->getNode('node')->getAttribute('name'); + // attributes on template instances are safe + if ('_self' == $name || \in_array($name, $this->safeVars)) { + $this->setSafe($node, ['all']); + } else { + $this->setSafe($node, []); + } + } else { + $this->setSafe($node, []); + } + + return $node; + } + + protected function intersectSafe(array $a = null, array $b = null) + { + if (null === $a || null === $b) { + return []; + } + + if (\in_array('all', $a)) { + return $b; + } + + if (\in_array('all', $b)) { + return $a; + } + + return array_intersect($a, $b); + } + + public function getPriority() + { + return 0; } } + +class_alias('Twig\NodeVisitor\SafeAnalysisNodeVisitor', 'Twig_NodeVisitor_SafeAnalysis'); diff --git a/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php index 1e4632f3c061aae3f12e05a1455b5145e1f4e1f7..c1d302a89b90e70a45fe8146f1c3e371dd65f533 100644 --- a/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php @@ -1,11 +1,137 @@ <?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\NodeVisitor; -class_exists('Twig_NodeVisitor_Sandbox'); +use Twig\Environment; +use Twig\Node\CheckSecurityNode; +use Twig\Node\CheckToStringNode; +use Twig\Node\Expression\Binary\ConcatBinary; +use Twig\Node\Expression\Binary\RangeBinary; +use Twig\Node\Expression\FilterExpression; +use Twig\Node\Expression\FunctionExpression; +use Twig\Node\Expression\GetAttrExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\ModuleNode; +use Twig\Node\Node; +use Twig\Node\PrintNode; +use Twig\Node\SetNode; + +/** + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class SandboxNodeVisitor extends AbstractNodeVisitor +{ + protected $inAModule = false; + protected $tags; + protected $filters; + protected $functions; + + private $needsToStringWrap = false; + + protected function doEnterNode(Node $node, Environment $env) + { + if ($node instanceof ModuleNode) { + $this->inAModule = true; + $this->tags = []; + $this->filters = []; + $this->functions = []; + + return $node; + } elseif ($this->inAModule) { + // look for tags + if ($node->getNodeTag() && !isset($this->tags[$node->getNodeTag()])) { + $this->tags[$node->getNodeTag()] = $node; + } + + // look for filters + if ($node instanceof FilterExpression && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) { + $this->filters[$node->getNode('filter')->getAttribute('value')] = $node; + } + + // look for functions + if ($node instanceof FunctionExpression && !isset($this->functions[$node->getAttribute('name')])) { + $this->functions[$node->getAttribute('name')] = $node; + } + + // the .. operator is equivalent to the range() function + if ($node instanceof RangeBinary && !isset($this->functions['range'])) { + $this->functions['range'] = $node; + } + + if ($node instanceof PrintNode) { + $this->needsToStringWrap = true; + $this->wrapNode($node, 'expr'); + } + + if ($node instanceof SetNode && !$node->getAttribute('capture')) { + $this->needsToStringWrap = true; + } + + // wrap outer nodes that can implicitly call __toString() + if ($this->needsToStringWrap) { + if ($node instanceof ConcatBinary) { + $this->wrapNode($node, 'left'); + $this->wrapNode($node, 'right'); + } + if ($node instanceof FilterExpression) { + $this->wrapNode($node, 'node'); + $this->wrapArrayNode($node, 'arguments'); + } + if ($node instanceof FunctionExpression) { + $this->wrapArrayNode($node, 'arguments'); + } + } + } + + return $node; + } -if (\false) { - class SandboxNodeVisitor extends \Twig_NodeVisitor_Sandbox + protected function doLeaveNode(Node $node, Environment $env) { + if ($node instanceof ModuleNode) { + $this->inAModule = false; + + $node->setNode('constructor_end', new Node([new CheckSecurityNode($this->filters, $this->tags, $this->functions), $node->getNode('display_start')])); + } elseif ($this->inAModule) { + if ($node instanceof PrintNode || $node instanceof SetNode) { + $this->needsToStringWrap = false; + } + } + + return $node; + } + + private function wrapNode(Node $node, $name) + { + $expr = $node->getNode($name); + if ($expr instanceof NameExpression || $expr instanceof GetAttrExpression) { + $node->setNode($name, new CheckToStringNode($expr)); + } + } + + private function wrapArrayNode(Node $node, $name) + { + $args = $node->getNode($name); + foreach ($args as $name => $_) { + $this->wrapNode($args, $name); + } + } + + public function getPriority() + { + return 0; } } + +class_alias('Twig\NodeVisitor\SandboxNodeVisitor', 'Twig_NodeVisitor_Sandbox'); diff --git a/vendor/twig/twig/src/Parser.php b/vendor/twig/twig/src/Parser.php index 738a4047c9edb6a70436d78dd13fc9a0a2bbadbe..444d4c5a1abc9997db8fc7ad4f20a5b3695e0358 100644 --- a/vendor/twig/twig/src/Parser.php +++ b/vendor/twig/twig/src/Parser.php @@ -1,11 +1,431 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig; -class_exists('Twig_Parser'); +use Twig\Error\SyntaxError; +use Twig\Node\BlockNode; +use Twig\Node\BlockReferenceNode; +use Twig\Node\BodyNode; +use Twig\Node\Expression\AbstractExpression; +use Twig\Node\MacroNode; +use Twig\Node\ModuleNode; +use Twig\Node\Node; +use Twig\Node\NodeCaptureInterface; +use Twig\Node\NodeOutputInterface; +use Twig\Node\PrintNode; +use Twig\Node\TextNode; +use Twig\NodeVisitor\NodeVisitorInterface; +use Twig\TokenParser\TokenParserInterface; + +/** + * Default parser implementation. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class Parser implements \Twig_ParserInterface +{ + protected $stack = []; + protected $stream; + protected $parent; + protected $handlers; + protected $visitors; + protected $expressionParser; + protected $blocks; + protected $blockStack; + protected $macros; + protected $env; + protected $reservedMacroNames; + protected $importedSymbols; + protected $traits; + protected $embeddedTemplates = []; + private $varNameSalt = 0; + + public function __construct(Environment $env) + { + $this->env = $env; + } + + /** + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function getEnvironment() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); + + return $this->env; + } + + public function getVarName() + { + return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->stream->getSourceContext()->getCode().$this->varNameSalt++)); + } -if (\false) { - class Parser extends \Twig_Parser + /** + * @deprecated since 1.27 (to be removed in 2.0). Use $parser->getStream()->getSourceContext()->getPath() instead. + */ + public function getFilename() { + @trigger_error(sprintf('The "%s" method is deprecated since version 1.27 and will be removed in 2.0. Use $parser->getStream()->getSourceContext()->getPath() instead.', __METHOD__), E_USER_DEPRECATED); + + return $this->stream->getSourceContext()->getName(); + } + + public function parse(TokenStream $stream, $test = null, $dropNeedle = false) + { + // push all variables into the stack to keep the current state of the parser + // using get_object_vars() instead of foreach would lead to https://bugs.php.net/71336 + // This hack can be removed when min version if PHP 7.0 + $vars = []; + foreach ($this as $k => $v) { + $vars[$k] = $v; + } + + unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']); + $this->stack[] = $vars; + + // tag handlers + if (null === $this->handlers) { + $this->handlers = $this->env->getTokenParsers(); + $this->handlers->setParser($this); + } + + // node visitors + if (null === $this->visitors) { + $this->visitors = $this->env->getNodeVisitors(); + } + + if (null === $this->expressionParser) { + $this->expressionParser = new ExpressionParser($this, $this->env); + } + + $this->stream = $stream; + $this->parent = null; + $this->blocks = []; + $this->macros = []; + $this->traits = []; + $this->blockStack = []; + $this->importedSymbols = [[]]; + $this->embeddedTemplates = []; + $this->varNameSalt = 0; + + try { + $body = $this->subparse($test, $dropNeedle); + + if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) { + $body = new Node(); + } + } catch (SyntaxError $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($this->stream->getSourceContext()); + } + + if (!$e->getTemplateLine()) { + $e->setTemplateLine($this->stream->getCurrent()->getLine()); + } + + throw $e; + } + + $node = new ModuleNode(new BodyNode([$body]), $this->parent, new Node($this->blocks), new Node($this->macros), new Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext()); + + $traverser = new NodeTraverser($this->env, $this->visitors); + + $node = $traverser->traverse($node); + + // restore previous stack so previous parse() call can resume working + foreach (array_pop($this->stack) as $key => $val) { + $this->$key = $val; + } + + return $node; + } + + public function subparse($test, $dropNeedle = false) + { + $lineno = $this->getCurrentToken()->getLine(); + $rv = []; + while (!$this->stream->isEOF()) { + switch ($this->getCurrentToken()->getType()) { + case Token::TEXT_TYPE: + $token = $this->stream->next(); + $rv[] = new TextNode($token->getValue(), $token->getLine()); + break; + + case Token::VAR_START_TYPE: + $token = $this->stream->next(); + $expr = $this->expressionParser->parseExpression(); + $this->stream->expect(Token::VAR_END_TYPE); + $rv[] = new PrintNode($expr, $token->getLine()); + break; + + case Token::BLOCK_START_TYPE: + $this->stream->next(); + $token = $this->getCurrentToken(); + + if (Token::NAME_TYPE !== $token->getType()) { + throw new SyntaxError('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext()); + } + + if (null !== $test && \call_user_func($test, $token)) { + if ($dropNeedle) { + $this->stream->next(); + } + + if (1 === \count($rv)) { + return $rv[0]; + } + + return new Node($rv, [], $lineno); + } + + $subparser = $this->handlers->getTokenParser($token->getValue()); + if (null === $subparser) { + if (null !== $test) { + $e = new SyntaxError(sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); + + if (\is_array($test) && isset($test[0]) && $test[0] instanceof TokenParserInterface) { + $e->appendMessage(sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno)); + } + } else { + $e = new SyntaxError(sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); + $e->addSuggestions($token->getValue(), array_keys($this->env->getTags())); + } + + throw $e; + } + + $this->stream->next(); + + $node = $subparser->parse($token); + if (null !== $node) { + $rv[] = $node; + } + break; + + default: + throw new SyntaxError('Lexer or parser ended up in unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext()); + } + } + + if (1 === \count($rv)) { + return $rv[0]; + } + + return new Node($rv, [], $lineno); + } + + /** + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function addHandler($name, $class) + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); + + $this->handlers[$name] = $class; + } + + /** + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function addNodeVisitor(NodeVisitorInterface $visitor) + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED); + + $this->visitors[] = $visitor; + } + + public function getBlockStack() + { + return $this->blockStack; + } + + public function peekBlockStack() + { + return $this->blockStack[\count($this->blockStack) - 1]; + } + + public function popBlockStack() + { + array_pop($this->blockStack); + } + + public function pushBlockStack($name) + { + $this->blockStack[] = $name; + } + + public function hasBlock($name) + { + return isset($this->blocks[$name]); + } + + public function getBlock($name) + { + return $this->blocks[$name]; + } + + public function setBlock($name, BlockNode $value) + { + $this->blocks[$name] = new BodyNode([$value], [], $value->getTemplateLine()); + } + + public function hasMacro($name) + { + return isset($this->macros[$name]); + } + + public function setMacro($name, MacroNode $node) + { + if ($this->isReservedMacroName($name)) { + throw new SyntaxError(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword.', $name), $node->getTemplateLine(), $this->stream->getSourceContext()); + } + + $this->macros[$name] = $node; + } + + public function isReservedMacroName($name) + { + if (null === $this->reservedMacroNames) { + $this->reservedMacroNames = []; + $r = new \ReflectionClass($this->env->getBaseTemplateClass()); + foreach ($r->getMethods() as $method) { + $methodName = strtolower($method->getName()); + + if ('get' === substr($methodName, 0, 3) && isset($methodName[3])) { + $this->reservedMacroNames[] = substr($methodName, 3); + } + } + } + + return \in_array(strtolower($name), $this->reservedMacroNames); + } + + public function addTrait($trait) + { + $this->traits[] = $trait; + } + + public function hasTraits() + { + return \count($this->traits) > 0; + } + + public function embedTemplate(ModuleNode $template) + { + $template->setIndex(mt_rand()); + + $this->embeddedTemplates[] = $template; + } + + public function addImportedSymbol($type, $alias, $name = null, AbstractExpression $node = null) + { + $this->importedSymbols[0][$type][$alias] = ['name' => $name, 'node' => $node]; + } + + public function getImportedSymbol($type, $alias) + { + foreach ($this->importedSymbols as $functions) { + if (isset($functions[$type][$alias])) { + return $functions[$type][$alias]; + } + } + } + + public function isMainScope() + { + return 1 === \count($this->importedSymbols); + } + + public function pushLocalScope() + { + array_unshift($this->importedSymbols, []); + } + + public function popLocalScope() + { + array_shift($this->importedSymbols); + } + + /** + * @return ExpressionParser + */ + public function getExpressionParser() + { + return $this->expressionParser; + } + + public function getParent() + { + return $this->parent; + } + + public function setParent($parent) + { + $this->parent = $parent; + } + + /** + * @return TokenStream + */ + public function getStream() + { + return $this->stream; + } + + /** + * @return Token + */ + public function getCurrentToken() + { + return $this->stream->getCurrent(); + } + + protected function filterBodyNodes(\Twig_NodeInterface $node) + { + // check that the body does not contain non-empty output nodes + if ( + ($node instanceof TextNode && !ctype_space($node->getAttribute('data'))) + || + (!$node instanceof TextNode && !$node instanceof BlockReferenceNode && $node instanceof NodeOutputInterface) + ) { + if (false !== strpos((string) $node, \chr(0xEF).\chr(0xBB).\chr(0xBF))) { + $t = substr($node->getAttribute('data'), 3); + if ('' === $t || ctype_space($t)) { + // bypass empty nodes starting with a BOM + return; + } + } + + throw new SyntaxError('A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext()); + } + + // bypass nodes that will "capture" the output + if ($node instanceof NodeCaptureInterface) { + return $node; + } + + if ($node instanceof NodeOutputInterface) { + return; + } + + foreach ($node as $k => $n) { + if (null !== $n && null === $this->filterBodyNodes($n)) { + $node->removeNode($k); + } + } + + return $node; } } + +class_alias('Twig\Parser', 'Twig_Parser'); diff --git a/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php b/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php index 33c32801c99540667f0073e02d3d24f1bb168fb7..d965dc75421e43cafe0b51edea5e25d5e26313c3 100644 --- a/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php +++ b/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php @@ -1,11 +1,65 @@ <?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\Profiler\Dumper; -class_exists('Twig_Profiler_Dumper_Base'); +use Twig\Profiler\Profile; + +/** + * @author Fabien Potencier <fabien@symfony.com> + */ +abstract class BaseDumper +{ + private $root; -if (\false) { - class BaseDumper extends \Twig_Profiler_Dumper_Base + public function dump(Profile $profile) { + return $this->dumpProfile($profile); + } + + abstract protected function formatTemplate(Profile $profile, $prefix); + + abstract protected function formatNonTemplate(Profile $profile, $prefix); + + abstract protected function formatTime(Profile $profile, $percent); + + private function dumpProfile(Profile $profile, $prefix = '', $sibling = false) + { + if ($profile->isRoot()) { + $this->root = $profile->getDuration(); + $start = $profile->getName(); + } else { + if ($profile->isTemplate()) { + $start = $this->formatTemplate($profile, $prefix); + } else { + $start = $this->formatNonTemplate($profile, $prefix); + } + $prefix .= $sibling ? '│ ' : ' '; + } + + $percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0; + + if ($profile->getDuration() * 1000 < 1) { + $str = $start."\n"; + } else { + $str = sprintf("%s %s\n", $start, $this->formatTime($profile, $percent)); + } + + $nCount = \count($profile->getProfiles()); + foreach ($profile as $i => $p) { + $str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount); + } + + return $str; } } + +class_alias('Twig\Profiler\Dumper\BaseDumper', 'Twig_Profiler_Dumper_Base'); diff --git a/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php b/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php index afab9394a1f6a17126d3597a50a7124ac1d2db59..a1c3c7bce691b59d4585e666f40716e944648a51 100644 --- a/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php +++ b/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php @@ -1,11 +1,76 @@ <?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\Profiler\Dumper; -class_exists('Twig_Profiler_Dumper_Blackfire'); +use Twig\Profiler\Profile; -if (\false) { - class BlackfireDumper extends \Twig_Profiler_Dumper_Blackfire +/** + * @author Fabien Potencier <fabien@symfony.com> + * + * @final + */ +class BlackfireDumper +{ + public function dump(Profile $profile) { + $data = []; + $this->dumpProfile('main()', $profile, $data); + $this->dumpChildren('main()', $profile, $data); + + $start = sprintf('%f', microtime(true)); + $str = <<<EOF +file-format: BlackfireProbe +cost-dimensions: wt mu pmu +request-start: {$start} + + +EOF; + + foreach ($data as $name => $values) { + $str .= "{$name}//{$values['ct']} {$values['wt']} {$values['mu']} {$values['pmu']}\n"; + } + + return $str; + } + + private function dumpChildren($parent, Profile $profile, &$data) + { + foreach ($profile as $p) { + if ($p->isTemplate()) { + $name = $p->getTemplate(); + } else { + $name = sprintf('%s::%s(%s)', $p->getTemplate(), $p->getType(), $p->getName()); + } + $this->dumpProfile(sprintf('%s==>%s', $parent, $name), $p, $data); + $this->dumpChildren($name, $p, $data); + } + } + + private function dumpProfile($edge, Profile $profile, &$data) + { + if (isset($data[$edge])) { + ++$data[$edge]['ct']; + $data[$edge]['wt'] += floor($profile->getDuration() * 1000000); + $data[$edge]['mu'] += $profile->getMemoryUsage(); + $data[$edge]['pmu'] += $profile->getPeakMemoryUsage(); + } else { + $data[$edge] = [ + 'ct' => 1, + 'wt' => floor($profile->getDuration() * 1000000), + 'mu' => $profile->getMemoryUsage(), + 'pmu' => $profile->getPeakMemoryUsage(), + ]; + } } } + +class_alias('Twig\Profiler\Dumper\BlackfireDumper', 'Twig_Profiler_Dumper_Blackfire'); diff --git a/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php b/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php index 51654d2d03988fb529ddea928b16ffb7f28beccb..c70b405b30b5aac7b51933c706f69458eeafa990 100644 --- a/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php +++ b/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php @@ -1,11 +1,51 @@ <?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\Profiler\Dumper; -class_exists('Twig_Profiler_Dumper_Html'); +use Twig\Profiler\Profile; + +/** + * @author Fabien Potencier <fabien@symfony.com> + * + * @final + */ +class HtmlDumper extends BaseDumper +{ + private static $colors = [ + 'block' => '#dfd', + 'macro' => '#ddf', + 'template' => '#ffd', + 'big' => '#d44', + ]; + + public function dump(Profile $profile) + { + return '<pre>'.parent::dump($profile).'</pre>'; + } + + protected function formatTemplate(Profile $profile, $prefix) + { + return sprintf('%s└ <span style="background-color: %s">%s</span>', $prefix, self::$colors['template'], $profile->getTemplate()); + } + + protected function formatNonTemplate(Profile $profile, $prefix) + { + return sprintf('%s└ %s::%s(<span style="background-color: %s">%s</span>)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName()); + } -if (\false) { - class HtmlDumper extends \Twig_Profiler_Dumper_Html + protected function formatTime(Profile $profile, $percent) { + return sprintf('<span style="color: %s">%.2fms/%.0f%%</span>', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent); } } + +class_alias('Twig\Profiler\Dumper\HtmlDumper', 'Twig_Profiler_Dumper_Html'); diff --git a/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php b/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php index a9ec4efacaf2f317a0f6e66507d1463f94c2a098..c6b515891e7d1120e23143c614f506fc7a4cc524 100644 --- a/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php +++ b/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php @@ -1,11 +1,39 @@ <?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\Profiler\Dumper; -class_exists('Twig_Profiler_Dumper_Text'); +use Twig\Profiler\Profile; + +/** + * @author Fabien Potencier <fabien@symfony.com> + * + * @final + */ +class TextDumper extends BaseDumper +{ + protected function formatTemplate(Profile $profile, $prefix) + { + return sprintf('%s└ %s', $prefix, $profile->getTemplate()); + } + + protected function formatNonTemplate(Profile $profile, $prefix) + { + return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName()); + } -if (\false) { - class TextDumper extends \Twig_Profiler_Dumper_Text + protected function formatTime(Profile $profile, $percent) { + return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent); } } + +class_alias('Twig\Profiler\Dumper\TextDumper', 'Twig_Profiler_Dumper_Text'); diff --git a/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php b/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php index 3b9786b2c49bb9217e8a333d9ca77d3f9b0f0d5a..8ffd3dc78c691719d2228da97e2773add58a307a 100644 --- a/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php +++ b/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php @@ -1,11 +1,44 @@ <?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\Profiler\Node; -class_exists('Twig_Profiler_Node_EnterProfile'); +use Twig\Compiler; +use Twig\Node\Node; -if (\false) { - class EnterProfileNode extends \Twig_Profiler_Node_EnterProfile +/** + * Represents a profile enter node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class EnterProfileNode extends Node +{ + public function __construct($extensionName, $type, $name, $varName) { + parent::__construct([], ['extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName]); + } + + public function compile(Compiler $compiler) + { + $compiler + ->write(sprintf('$%s = $this->env->getExtension(', $this->getAttribute('var_name'))) + ->repr($this->getAttribute('extension_name')) + ->raw(");\n") + ->write(sprintf('$%s->enter($%s = new \Twig\Profiler\Profile($this->getTemplateName(), ', $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) + ->repr($this->getAttribute('type')) + ->raw(', ') + ->repr($this->getAttribute('name')) + ->raw("));\n\n") + ; } } + +class_alias('Twig\Profiler\Node\EnterProfileNode', 'Twig_Profiler_Node_EnterProfile'); diff --git a/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php b/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php index c4024f3e9ba30f8c2d88b277a77f3c52a8a92107..3b7a74d02638ecce320e34e447049ad59cb99eab 100644 --- a/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php +++ b/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php @@ -1,11 +1,38 @@ <?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\Profiler\Node; -class_exists('Twig_Profiler_Node_LeaveProfile'); +use Twig\Compiler; +use Twig\Node\Node; -if (\false) { - class LeaveProfileNode extends \Twig_Profiler_Node_LeaveProfile +/** + * Represents a profile leave node. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class LeaveProfileNode extends Node +{ + public function __construct($varName) { + parent::__construct([], ['var_name' => $varName]); + } + + public function compile(Compiler $compiler) + { + $compiler + ->write("\n") + ->write(sprintf("\$%s->leave(\$%s);\n\n", $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) + ; } } + +class_alias('Twig\Profiler\Node\LeaveProfileNode', 'Twig_Profiler_Node_LeaveProfile'); diff --git a/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php b/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php index 0e401a7312535448ac25fda4220c8f7e1295c0b2..41ca9e1f297df366d67b33cff9a5a590e4495744 100644 --- a/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php +++ b/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php @@ -1,11 +1,80 @@ <?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\Profiler\NodeVisitor; -class_exists('Twig_Profiler_NodeVisitor_Profiler'); +use Twig\Environment; +use Twig\Node\BlockNode; +use Twig\Node\BodyNode; +use Twig\Node\MacroNode; +use Twig\Node\ModuleNode; +use Twig\Node\Node; +use Twig\NodeVisitor\AbstractNodeVisitor; +use Twig\Profiler\Node\EnterProfileNode; +use Twig\Profiler\Node\LeaveProfileNode; +use Twig\Profiler\Profile; + +/** + * @author Fabien Potencier <fabien@symfony.com> + * + * @final + */ +class ProfilerNodeVisitor extends AbstractNodeVisitor +{ + private $extensionName; + + public function __construct($extensionName) + { + $this->extensionName = $extensionName; + } + + protected function doEnterNode(Node $node, Environment $env) + { + return $node; + } + + protected function doLeaveNode(Node $node, Environment $env) + { + if ($node instanceof ModuleNode) { + $varName = $this->getVarName(); + $node->setNode('display_start', new Node([new EnterProfileNode($this->extensionName, Profile::TEMPLATE, $node->getTemplateName(), $varName), $node->getNode('display_start')])); + $node->setNode('display_end', new Node([new LeaveProfileNode($varName), $node->getNode('display_end')])); + } elseif ($node instanceof BlockNode) { + $varName = $this->getVarName(); + $node->setNode('body', new BodyNode([ + new EnterProfileNode($this->extensionName, Profile::BLOCK, $node->getAttribute('name'), $varName), + $node->getNode('body'), + new LeaveProfileNode($varName), + ])); + } elseif ($node instanceof MacroNode) { + $varName = $this->getVarName(); + $node->setNode('body', new BodyNode([ + new EnterProfileNode($this->extensionName, Profile::MACRO, $node->getAttribute('name'), $varName), + $node->getNode('body'), + new LeaveProfileNode($varName), + ])); + } + + return $node; + } + + private function getVarName() + { + return sprintf('__internal_%s', hash('sha256', $this->extensionName)); + } -if (\false) { - class ProfilerNodeVisitor extends \Twig_Profiler_NodeVisitor_Profiler + public function getPriority() { + return 0; } } + +class_alias('Twig\Profiler\NodeVisitor\ProfilerNodeVisitor', 'Twig_Profiler_NodeVisitor_Profiler'); diff --git a/vendor/twig/twig/src/Profiler/Profile.php b/vendor/twig/twig/src/Profiler/Profile.php index b18a7f4c35e856a8baa7bca09af9505084047c88..f33963b31fdbd00acc89dcbbd0f5da4cf578ff1e 100644 --- a/vendor/twig/twig/src/Profiler/Profile.php +++ b/vendor/twig/twig/src/Profiler/Profile.php @@ -1,11 +1,172 @@ <?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\Profiler; -class_exists('Twig_Profiler_Profile'); +/** + * @author Fabien Potencier <fabien@symfony.com> + * + * @final + */ +class Profile implements \IteratorAggregate, \Serializable +{ + const ROOT = 'ROOT'; + const BLOCK = 'block'; + const TEMPLATE = 'template'; + const MACRO = 'macro'; + + private $template; + private $name; + private $type; + private $starts = []; + private $ends = []; + private $profiles = []; + + public function __construct($template = 'main', $type = self::ROOT, $name = 'main') + { + $this->template = $template; + $this->type = $type; + $this->name = 0 === strpos($name, '__internal_') ? 'INTERNAL' : $name; + $this->enter(); + } + + public function getTemplate() + { + return $this->template; + } + + public function getType() + { + return $this->type; + } + + public function getName() + { + return $this->name; + } + + public function isRoot() + { + return self::ROOT === $this->type; + } + + public function isTemplate() + { + return self::TEMPLATE === $this->type; + } + + public function isBlock() + { + return self::BLOCK === $this->type; + } -if (\false) { - class Profile extends \Twig_Profiler_Profile + public function isMacro() { + return self::MACRO === $this->type; + } + + public function getProfiles() + { + return $this->profiles; + } + + public function addProfile(self $profile) + { + $this->profiles[] = $profile; + } + + /** + * Returns the duration in microseconds. + * + * @return int + */ + public function getDuration() + { + if ($this->isRoot() && $this->profiles) { + // for the root node with children, duration is the sum of all child durations + $duration = 0; + foreach ($this->profiles as $profile) { + $duration += $profile->getDuration(); + } + + return $duration; + } + + return isset($this->ends['wt']) && isset($this->starts['wt']) ? $this->ends['wt'] - $this->starts['wt'] : 0; + } + + /** + * Returns the memory usage in bytes. + * + * @return int + */ + public function getMemoryUsage() + { + return isset($this->ends['mu']) && isset($this->starts['mu']) ? $this->ends['mu'] - $this->starts['mu'] : 0; + } + + /** + * Returns the peak memory usage in bytes. + * + * @return int + */ + public function getPeakMemoryUsage() + { + return isset($this->ends['pmu']) && isset($this->starts['pmu']) ? $this->ends['pmu'] - $this->starts['pmu'] : 0; + } + + /** + * Starts the profiling. + */ + public function enter() + { + $this->starts = [ + 'wt' => microtime(true), + 'mu' => memory_get_usage(), + 'pmu' => memory_get_peak_usage(), + ]; + } + + /** + * Stops the profiling. + */ + public function leave() + { + $this->ends = [ + 'wt' => microtime(true), + 'mu' => memory_get_usage(), + 'pmu' => memory_get_peak_usage(), + ]; + } + + public function reset() + { + $this->starts = $this->ends = $this->profiles = []; + $this->enter(); + } + + public function getIterator() + { + return new \ArrayIterator($this->profiles); + } + + public function serialize() + { + return serialize([$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles]); + } + + public function unserialize($data) + { + list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = unserialize($data); } } + +class_alias('Twig\Profiler\Profile', 'Twig_Profiler_Profile'); diff --git a/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php b/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php index 35ff7afb1e5816c4cb8b7e64bbcc88d1cb8a4c56..04a6602f2298059964b52cc646845787146ca76d 100644 --- a/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php +++ b/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php @@ -1,11 +1,41 @@ <?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\RuntimeLoader; -class_exists('Twig_ContainerRuntimeLoader'); +use Psr\Container\ContainerInterface; + +/** + * Lazily loads Twig runtime implementations from a PSR-11 container. + * + * Note that the runtime services MUST use their class names as identifiers. + * + * @author Fabien Potencier <fabien@symfony.com> + * @author Robin Chalas <robin.chalas@gmail.com> + */ +class ContainerRuntimeLoader implements RuntimeLoaderInterface +{ + private $container; + + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } -if (\false) { - class ContainerRuntimeLoader extends \Twig_ContainerRuntimeLoader + public function load($class) { + if ($this->container->has($class)) { + return $this->container->get($class); + } } } + +class_alias('Twig\RuntimeLoader\ContainerRuntimeLoader', 'Twig_ContainerRuntimeLoader'); diff --git a/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php b/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php index bb9880763edc57725fee8b5ca755f6ef7b31a0b5..43b5f24ebac0a7295e09958f21a18d37ca4f9a89 100644 --- a/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php +++ b/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php @@ -1,11 +1,41 @@ <?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\RuntimeLoader; -class_exists('Twig_FactoryRuntimeLoader'); +/** + * Lazy loads the runtime implementations for a Twig element. + * + * @author Robin Chalas <robin.chalas@gmail.com> + */ +class FactoryRuntimeLoader implements RuntimeLoaderInterface +{ + private $map; + + /** + * @param array $map An array where keys are class names and values factory callables + */ + public function __construct($map = []) + { + $this->map = $map; + } -if (\false) { - class FactoryRuntimeLoader extends \Twig_FactoryRuntimeLoader + public function load($class) { + if (isset($this->map[$class])) { + $runtimeFactory = $this->map[$class]; + + return $runtimeFactory(); + } } } + +class_alias('Twig\RuntimeLoader\FactoryRuntimeLoader', 'Twig_FactoryRuntimeLoader'); diff --git a/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php b/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php index 4721a44746078d6c8fb3d16a43d25cad201a621c..4eb5ad859994065a14826fbdbae4b1b9ee37edd9 100644 --- a/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php +++ b/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php @@ -1,11 +1,31 @@ <?php -namespace Twig\RuntimeLoader; +/* + * 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. + */ -class_exists('Twig_RuntimeLoaderInterface'); +namespace Twig\RuntimeLoader; -if (\false) { - interface RuntimeLoaderInterface extends \Twig_RuntimeLoaderInterface - { - } +/** + * Creates runtime implementations for Twig elements (filters/functions/tests). + * + * @author Fabien Potencier <fabien@symfony.com> + */ +interface RuntimeLoaderInterface +{ + /** + * Creates the runtime implementation of a Twig element (filter/function/test). + * + * @param string $class A runtime class + * + * @return object|null The runtime instance or null if the loader does not know how to create the runtime for this class + */ + public function load($class); } + +class_alias('Twig\RuntimeLoader\RuntimeLoaderInterface', 'Twig_RuntimeLoaderInterface'); diff --git a/vendor/twig/twig/src/Sandbox/SecurityError.php b/vendor/twig/twig/src/Sandbox/SecurityError.php index e1cd3f06f062a88c92599fb9a6d85cee4e1afbe0..5f96d46bd8458577460fa0f556206078d16f5f1c 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityError.php @@ -1,11 +1,25 @@ <?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\Sandbox; -class_exists('Twig_Sandbox_SecurityError'); +use Twig\Error\Error; -if (\false) { - class SecurityError extends \Twig_Sandbox_SecurityError - { - } +/** + * Exception thrown when a security error occurs at runtime. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class SecurityError extends Error +{ } + +class_alias('Twig\Sandbox\SecurityError', 'Twig_Sandbox_SecurityError'); diff --git a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php index b56d2c9b29640de76e62f6b9cec4071238ce6afc..fa0fdee72f30b480e5dc506bc0752b731765cb7b 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php @@ -1,11 +1,35 @@ <?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\Sandbox; -class_exists('Twig_Sandbox_SecurityNotAllowedFilterError'); +/** + * Exception thrown when a not allowed filter is used in a template. + * + * @author Martin Hasoň <martin.hason@gmail.com> + */ +class SecurityNotAllowedFilterError extends SecurityError +{ + private $filterName; -if (\false) { - class SecurityNotAllowedFilterError extends \Twig_Sandbox_SecurityNotAllowedFilterError + public function __construct($message, $functionName, $lineno = -1, $filename = null, \Exception $previous = null) { + parent::__construct($message, $lineno, $filename, $previous); + $this->filterName = $functionName; + } + + public function getFilterName() + { + return $this->filterName; } } + +class_alias('Twig\Sandbox\SecurityNotAllowedFilterError', 'Twig_Sandbox_SecurityNotAllowedFilterError'); diff --git a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php index 1a91764fad47fcca691f7bd574ee67484d599c8a..8f23f93acd98bd986342f8ea2feb04dfff581b1a 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php @@ -1,11 +1,35 @@ <?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\Sandbox; -class_exists('Twig_Sandbox_SecurityNotAllowedFunctionError'); +/** + * Exception thrown when a not allowed function is used in a template. + * + * @author Martin Hasoň <martin.hason@gmail.com> + */ +class SecurityNotAllowedFunctionError extends SecurityError +{ + private $functionName; -if (\false) { - class SecurityNotAllowedFunctionError extends \Twig_Sandbox_SecurityNotAllowedFunctionError + public function __construct($message, $functionName, $lineno = -1, $filename = null, \Exception $previous = null) { + parent::__construct($message, $lineno, $filename, $previous); + $this->functionName = $functionName; + } + + public function getFunctionName() + { + return $this->functionName; } } + +class_alias('Twig\Sandbox\SecurityNotAllowedFunctionError', 'Twig_Sandbox_SecurityNotAllowedFunctionError'); diff --git a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php index 9f81c69e5d71c2a627dac706be7bc7dbb0394b26..62e13f49bde533f31f79e1a64c144bac4bd438d3 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php @@ -1,11 +1,42 @@ <?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\Sandbox; -class_exists('Twig_Sandbox_SecurityNotAllowedMethodError'); +/** + * Exception thrown when a not allowed class method is used in a template. + * + * @author Kit Burton-Senior <mail@kitbs.com> + */ +class SecurityNotAllowedMethodError extends SecurityError +{ + private $className; + private $methodName; + + public function __construct($message, $className, $methodName, $lineno = -1, $filename = null, \Exception $previous = null) + { + parent::__construct($message, $lineno, $filename, $previous); + $this->className = $className; + $this->methodName = $methodName; + } + + public function getClassName() + { + return $this->className; + } -if (\false) { - class SecurityNotAllowedMethodError extends \Twig_Sandbox_SecurityNotAllowedMethodError + public function getMethodName() { + return $this->methodName; } } + +class_alias('Twig\Sandbox\SecurityNotAllowedMethodError', 'Twig_Sandbox_SecurityNotAllowedMethodError'); diff --git a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php index 5a5d4307a38589a0e1bd3e8c3f91e9e03748d4e2..3bf530574f85672e4217ead8f8152d0743f82003 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php @@ -1,11 +1,42 @@ <?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\Sandbox; -class_exists('Twig_Sandbox_SecurityNotAllowedPropertyError'); +/** + * Exception thrown when a not allowed class property is used in a template. + * + * @author Kit Burton-Senior <mail@kitbs.com> + */ +class SecurityNotAllowedPropertyError extends SecurityError +{ + private $className; + private $propertyName; + + public function __construct($message, $className, $propertyName, $lineno = -1, $filename = null, \Exception $previous = null) + { + parent::__construct($message, $lineno, $filename, $previous); + $this->className = $className; + $this->propertyName = $propertyName; + } + + public function getClassName() + { + return $this->className; + } -if (\false) { - class SecurityNotAllowedPropertyError extends \Twig_Sandbox_SecurityNotAllowedPropertyError + public function getPropertyName() { + return $this->propertyName; } } + +class_alias('Twig\Sandbox\SecurityNotAllowedPropertyError', 'Twig_Sandbox_SecurityNotAllowedPropertyError'); diff --git a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php index 0463f2a38dc908b3799e560063560b6505d5e02b..de283b40cd7e9f96ce1443e3ecde7d6c94b53ecb 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php @@ -1,11 +1,35 @@ <?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\Sandbox; -class_exists('Twig_Sandbox_SecurityNotAllowedTagError'); +/** + * Exception thrown when a not allowed tag is used in a template. + * + * @author Martin Hasoň <martin.hason@gmail.com> + */ +class SecurityNotAllowedTagError extends SecurityError +{ + private $tagName; -if (\false) { - class SecurityNotAllowedTagError extends \Twig_Sandbox_SecurityNotAllowedTagError + public function __construct($message, $tagName, $lineno = -1, $filename = null, \Exception $previous = null) { + parent::__construct($message, $lineno, $filename, $previous); + $this->tagName = $tagName; + } + + public function getTagName() + { + return $this->tagName; } } + +class_alias('Twig\Sandbox\SecurityNotAllowedTagError', 'Twig_Sandbox_SecurityNotAllowedTagError'); diff --git a/vendor/twig/twig/src/Sandbox/SecurityPolicy.php b/vendor/twig/twig/src/Sandbox/SecurityPolicy.php index b45b28526f0823c73a8a4c534495940494b56a52..c6f7465c465da9a96fb41a86e86ec01b77ea418f 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityPolicy.php +++ b/vendor/twig/twig/src/Sandbox/SecurityPolicy.php @@ -1,11 +1,129 @@ <?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\Sandbox; -class_exists('Twig_Sandbox_SecurityPolicy'); +use Twig\Markup; + +/** + * Represents a security policy which need to be enforced when sandbox mode is enabled. + * + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class SecurityPolicy implements SecurityPolicyInterface +{ + protected $allowedTags; + protected $allowedFilters; + protected $allowedMethods; + protected $allowedProperties; + protected $allowedFunctions; + + public function __construct(array $allowedTags = [], array $allowedFilters = [], array $allowedMethods = [], array $allowedProperties = [], array $allowedFunctions = []) + { + $this->allowedTags = $allowedTags; + $this->allowedFilters = $allowedFilters; + $this->setAllowedMethods($allowedMethods); + $this->allowedProperties = $allowedProperties; + $this->allowedFunctions = $allowedFunctions; + } + + public function setAllowedTags(array $tags) + { + $this->allowedTags = $tags; + } + + public function setAllowedFilters(array $filters) + { + $this->allowedFilters = $filters; + } + + public function setAllowedMethods(array $methods) + { + $this->allowedMethods = []; + foreach ($methods as $class => $m) { + $this->allowedMethods[$class] = array_map('strtolower', \is_array($m) ? $m : [$m]); + } + } + + public function setAllowedProperties(array $properties) + { + $this->allowedProperties = $properties; + } + + public function setAllowedFunctions(array $functions) + { + $this->allowedFunctions = $functions; + } -if (\false) { - class SecurityPolicy extends \Twig_Sandbox_SecurityPolicy + public function checkSecurity($tags, $filters, $functions) { + foreach ($tags as $tag) { + if (!\in_array($tag, $this->allowedTags)) { + throw new SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag); + } + } + + foreach ($filters as $filter) { + if (!\in_array($filter, $this->allowedFilters)) { + throw new SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter); + } + } + + foreach ($functions as $function) { + if (!\in_array($function, $this->allowedFunctions)) { + throw new SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function); + } + } + } + + public function checkMethodAllowed($obj, $method) + { + if ($obj instanceof \Twig_TemplateInterface || $obj instanceof Markup) { + return true; + } + + $allowed = false; + $method = strtolower($method); + foreach ($this->allowedMethods as $class => $methods) { + if ($obj instanceof $class) { + $allowed = \in_array($method, $methods); + + break; + } + } + + if (!$allowed) { + $class = \get_class($obj); + throw new SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method); + } + } + + public function checkPropertyAllowed($obj, $property) + { + $allowed = false; + foreach ($this->allowedProperties as $class => $properties) { + if ($obj instanceof $class) { + $allowed = \in_array($property, \is_array($properties) ? $properties : [$properties]); + + break; + } + } + + if (!$allowed) { + $class = \get_class($obj); + throw new SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property); + } } } + +class_alias('Twig\Sandbox\SecurityPolicy', 'Twig_Sandbox_SecurityPolicy'); diff --git a/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php b/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php index 78a84e387b8f6565b3b829210578d6b52e634e8a..d2d783d488d3b62d4e4a3d2daf1178fd82095f47 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php +++ b/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php @@ -1,11 +1,28 @@ <?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\Sandbox; -class_exists('Twig_Sandbox_SecurityPolicyInterface'); +/** + * Interfaces that all security policy classes must implements. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +interface SecurityPolicyInterface +{ + public function checkSecurity($tags, $filters, $functions); + + public function checkMethodAllowed($obj, $method); -if (\false) { - interface SecurityPolicyInterface extends \Twig_Sandbox_SecurityPolicyInterface - { - } + public function checkPropertyAllowed($obj, $method); } + +class_alias('Twig\Sandbox\SecurityPolicyInterface', 'Twig_Sandbox_SecurityPolicyInterface'); diff --git a/vendor/twig/twig/src/Source.php b/vendor/twig/twig/src/Source.php index b4978136110b2189182bf2077b5cfa8665e40a5d..32a82163f4b999734b72c7a687521077f756f5dc 100644 --- a/vendor/twig/twig/src/Source.php +++ b/vendor/twig/twig/src/Source.php @@ -1,11 +1,55 @@ <?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; -class_exists('Twig_Source'); +/** + * Holds information about a non-compiled Twig template. + * + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class Source +{ + private $code; + private $name; + private $path; + + /** + * @param string $code The template source code + * @param string $name The template logical name + * @param string $path The filesystem path of the template if any + */ + public function __construct($code, $name, $path = '') + { + $this->code = $code; + $this->name = $name; + $this->path = $path; + } -if (\false) { - class Source extends \Twig_Source + public function getCode() { + return $this->code; + } + + public function getName() + { + return $this->name; + } + + public function getPath() + { + return $this->path; } } + +class_alias('Twig\Source', 'Twig_Source'); diff --git a/vendor/twig/twig/src/Template.php b/vendor/twig/twig/src/Template.php index 13677f600a44c31720ec482ca7a139b3372ff031..8889c024dd88df78126a75defb3de63b302ee587 100644 --- a/vendor/twig/twig/src/Template.php +++ b/vendor/twig/twig/src/Template.php @@ -1,11 +1,702 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig; -class_exists('Twig_Template'); +use Twig\Error\Error; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; + +/** + * Default base class for compiled templates. + * + * This class is an implementation detail of how template compilation currently + * works, which might change. It should never be used directly. Use $twig->load() + * instead, which returns an instance of \Twig\TemplateWrapper. + * + * @author Fabien Potencier <fabien@symfony.com> + * + * @internal + */ +abstract class Template implements \Twig_TemplateInterface +{ + /** + * @internal + */ + protected static $cache = []; + + protected $parent; + protected $parents = []; + protected $env; + protected $blocks = []; + protected $traits = []; + protected $sandbox; + + public function __construct(Environment $env) + { + $this->env = $env; + } + + /** + * @internal this method will be removed in 2.0 and is only used internally to provide an upgrade path from 1.x to 2.0 + */ + public function __toString() + { + return $this->getTemplateName(); + } + + /** + * Returns the template name. + * + * @return string The template name + */ + abstract public function getTemplateName(); -if (\false) { - class Template extends \Twig_Template + /** + * Returns debug information about the template. + * + * @return array Debug information + */ + public function getDebugInfo() { + return []; + } + + /** + * Returns the template source code. + * + * @return string The template source code + * + * @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead + */ + public function getSource() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED); + + return ''; + } + + /** + * Returns information about the original template source code. + * + * @return Source + */ + public function getSourceContext() + { + return new Source('', $this->getTemplateName()); + } + + /** + * @deprecated since 1.20 (to be removed in 2.0) + */ + public function getEnvironment() + { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.20 and will be removed in 2.0.', E_USER_DEPRECATED); + + return $this->env; + } + + /** + * Returns the parent template. + * + * This method is for internal use only and should never be called + * directly. + * + * @param array $context + * + * @return \Twig_TemplateInterface|TemplateWrapper|false The parent template or false if there is no parent + * + * @internal + */ + public function getParent(array $context) + { + if (null !== $this->parent) { + return $this->parent; + } + + try { + $parent = $this->doGetParent($context); + + if (false === $parent) { + return false; + } + + if ($parent instanceof self || $parent instanceof TemplateWrapper) { + return $this->parents[$parent->getSourceContext()->getName()] = $parent; + } + + if (!isset($this->parents[$parent])) { + $this->parents[$parent] = $this->loadTemplate($parent); + } + } catch (LoaderError $e) { + $e->setSourceContext(null); + $e->guess(); + + throw $e; + } + + return $this->parents[$parent]; + } + + protected function doGetParent(array $context) + { + return false; + } + + public function isTraitable() + { + return true; + } + + /** + * Displays a parent block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to display from the parent + * @param array $context The context + * @param array $blocks The current set of blocks + */ + public function displayParentBlock($name, array $context, array $blocks = []) + { + $name = (string) $name; + + if (isset($this->traits[$name])) { + $this->traits[$name][0]->displayBlock($name, $context, $blocks, false); + } elseif (false !== $parent = $this->getParent($context)) { + $parent->displayBlock($name, $context, $blocks, false); + } else { + throw new RuntimeError(sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext()); + } + } + + /** + * Displays a block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to display + * @param array $context The context + * @param array $blocks The current set of blocks + * @param bool $useBlocks Whether to use the current set of blocks + */ + public function displayBlock($name, array $context, array $blocks = [], $useBlocks = true) + { + $name = (string) $name; + + if ($useBlocks && isset($blocks[$name])) { + $template = $blocks[$name][0]; + $block = $blocks[$name][1]; + } elseif (isset($this->blocks[$name])) { + $template = $this->blocks[$name][0]; + $block = $this->blocks[$name][1]; + } else { + $template = null; + $block = null; + } + + // avoid RCEs when sandbox is enabled + if (null !== $template && !$template instanceof self) { + throw new \LogicException('A block must be a method on a \Twig\Template instance.'); + } + + if (null !== $template) { + try { + $template->$block($context, $blocks); + } catch (Error $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($template->getSourceContext()); + } + + // this is mostly useful for \Twig\Error\LoaderError exceptions + // see \Twig\Error\LoaderError + if (-1 === $e->getTemplateLine()) { + $e->guess(); + } + + throw $e; + } catch (\Exception $e) { + throw new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e); + } + } elseif (false !== $parent = $this->getParent($context)) { + $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false); + } else { + @trigger_error(sprintf('Silent display of undefined block "%s" in template "%s" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block(\'%s\') is defined" expression to test for block existence.', $name, $this->getTemplateName(), $name), E_USER_DEPRECATED); + } + } + + /** + * Renders a parent block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to render from the parent + * @param array $context The context + * @param array $blocks The current set of blocks + * + * @return string The rendered block + */ + public function renderParentBlock($name, array $context, array $blocks = []) + { + ob_start(); + $this->displayParentBlock($name, $context, $blocks); + + return ob_get_clean(); + } + + /** + * Renders a block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to render + * @param array $context The context + * @param array $blocks The current set of blocks + * @param bool $useBlocks Whether to use the current set of blocks + * + * @return string The rendered block + */ + public function renderBlock($name, array $context, array $blocks = [], $useBlocks = true) + { + ob_start(); + $this->displayBlock($name, $context, $blocks, $useBlocks); + + return ob_get_clean(); + } + + /** + * Returns whether a block exists or not in the current context of the template. + * + * This method checks blocks defined in the current template + * or defined in "used" traits or defined in parent templates. + * + * @param string $name The block name + * @param array $context The context + * @param array $blocks The current set of blocks + * + * @return bool true if the block exists, false otherwise + */ + public function hasBlock($name, array $context = null, array $blocks = []) + { + if (null === $context) { + @trigger_error('The '.__METHOD__.' method is internal and should never be called; calling it directly is deprecated since version 1.28 and won\'t be possible anymore in 2.0.', E_USER_DEPRECATED); + + return isset($this->blocks[(string) $name]); + } + + if (isset($blocks[$name])) { + return $blocks[$name][0] instanceof self; + } + + if (isset($this->blocks[$name])) { + return true; + } + + if (false !== $parent = $this->getParent($context)) { + return $parent->hasBlock($name, $context); + } + + return false; + } + + /** + * Returns all block names in the current context of the template. + * + * This method checks blocks defined in the current template + * or defined in "used" traits or defined in parent templates. + * + * @param array $context The context + * @param array $blocks The current set of blocks + * + * @return array An array of block names + */ + public function getBlockNames(array $context = null, array $blocks = []) + { + if (null === $context) { + @trigger_error('The '.__METHOD__.' method is internal and should never be called; calling it directly is deprecated since version 1.28 and won\'t be possible anymore in 2.0.', E_USER_DEPRECATED); + + return array_keys($this->blocks); + } + + $names = array_merge(array_keys($blocks), array_keys($this->blocks)); + + if (false !== $parent = $this->getParent($context)) { + $names = array_merge($names, $parent->getBlockNames($context)); + } + + return array_unique($names); + } + + protected function loadTemplate($template, $templateName = null, $line = null, $index = null) + { + try { + if (\is_array($template)) { + return $this->env->resolveTemplate($template); + } + + if ($template instanceof self || $template instanceof TemplateWrapper) { + return $template; + } + + if ($template === $this->getTemplateName()) { + $class = get_class($this); + if (false !== $pos = strrpos($class, '___', -1)) { + $class = substr($class, 0, $pos); + } + + return $this->env->loadClass($class, $template, $index); + } + + return $this->env->loadTemplate($template, $index); + } catch (Error $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($templateName ? new Source('', $templateName) : $this->getSourceContext()); + } + + if ($e->getTemplateLine() > 0) { + throw $e; + } + + if (!$line) { + $e->guess(); + } else { + $e->setTemplateLine($line); + } + + throw $e; + } + } + + /** + * Returns all blocks. + * + * This method is for internal use only and should never be called + * directly. + * + * @return array An array of blocks + */ + public function getBlocks() + { + return $this->blocks; + } + + public function display(array $context, array $blocks = []) + { + $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks)); + } + + public function render(array $context) + { + $level = ob_get_level(); + ob_start(); + try { + $this->display($context); + } catch (\Exception $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } catch (\Throwable $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } + + return ob_get_clean(); + } + + protected function displayWithErrorHandling(array $context, array $blocks = []) + { + try { + $this->doDisplay($context, $blocks); + } catch (Error $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($this->getSourceContext()); + } + + // this is mostly useful for \Twig\Error\LoaderError exceptions + // see \Twig\Error\LoaderError + if (-1 === $e->getTemplateLine()) { + $e->guess(); + } + + throw $e; + } catch (\Exception $e) { + throw new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e); + } + } + + /** + * Auto-generated method to display the template with the given context. + * + * @param array $context An array of parameters to pass to the template + * @param array $blocks An array of blocks to pass to the template + */ + abstract protected function doDisplay(array $context, array $blocks = []); + + /** + * Returns a variable from the context. + * + * This method is for internal use only and should never be called + * directly. + * + * This method should not be overridden in a sub-class as this is an + * implementation detail that has been introduced to optimize variable + * access for versions of PHP before 5.4. This is not a way to override + * the way to get a variable value. + * + * @param array $context The context + * @param string $item The variable to return from the context + * @param bool $ignoreStrictCheck Whether to ignore the strict variable check or not + * + * @return mixed The content of the context variable + * + * @throws RuntimeError if the variable does not exist and Twig is running in strict mode + * + * @internal + */ + final protected function getContext($context, $item, $ignoreStrictCheck = false) + { + if (!\array_key_exists($item, $context)) { + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return; + } + + throw new RuntimeError(sprintf('Variable "%s" does not exist.', $item), -1, $this->getSourceContext()); + } + + return $context[$item]; + } + + /** + * Returns the attribute value for a given array/object. + * + * @param mixed $object The object or array from where to get the item + * @param mixed $item The item to get from the array or object + * @param array $arguments An array of arguments to pass if the item is an object method + * @param string $type The type of attribute (@see \Twig\Template constants) + * @param bool $isDefinedTest Whether this is only a defined check + * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not + * + * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true + * + * @throws RuntimeError if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false + * + * @internal + */ + protected function getAttribute($object, $item, array $arguments = [], $type = self::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) + { + // array + if (self::METHOD_CALL !== $type) { + $arrayItem = \is_bool($item) || \is_float($item) ? (int) $item : $item; + + if (((\is_array($object) || $object instanceof \ArrayObject) && (isset($object[$arrayItem]) || \array_key_exists($arrayItem, $object))) + || ($object instanceof \ArrayAccess && isset($object[$arrayItem])) + ) { + if ($isDefinedTest) { + return true; + } + + return $object[$arrayItem]; + } + + if (self::ARRAY_CALL === $type || !\is_object($object)) { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return; + } + + if ($object instanceof \ArrayAccess) { + $message = sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist.', $arrayItem, \get_class($object)); + } elseif (\is_object($object)) { + $message = sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface.', $item, \get_class($object)); + } elseif (\is_array($object)) { + if (empty($object)) { + $message = sprintf('Key "%s" does not exist as the array is empty.', $arrayItem); + } else { + $message = sprintf('Key "%s" for array with keys "%s" does not exist.', $arrayItem, implode(', ', array_keys($object))); + } + } elseif (self::ARRAY_CALL === $type) { + if (null === $object) { + $message = sprintf('Impossible to access a key ("%s") on a null variable.', $item); + } else { + $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); + } + } elseif (null === $object) { + $message = sprintf('Impossible to access an attribute ("%s") on a null variable.', $item); + } else { + $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); + } + + throw new RuntimeError($message, -1, $this->getSourceContext()); + } + } + + if (!\is_object($object)) { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return; + } + + if (null === $object) { + $message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item); + } elseif (\is_array($object)) { + $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item); + } else { + $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); + } + + throw new RuntimeError($message, -1, $this->getSourceContext()); + } + + // object property + if (self::METHOD_CALL !== $type && !$object instanceof self) { // \Twig\Template does not have public properties, and we don't want to allow access to internal ones + if (isset($object->$item) || \array_key_exists((string) $item, $object)) { + if ($isDefinedTest) { + return true; + } + + if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) { + $this->env->getExtension('\Twig\Extension\SandboxExtension')->checkPropertyAllowed($object, $item); + } + + return $object->$item; + } + } + + $class = \get_class($object); + + // object method + if (!isset(self::$cache[$class])) { + // get_class_methods returns all methods accessible in the scope, but we only want public ones to be accessible in templates + if ($object instanceof self) { + $ref = new \ReflectionClass($class); + $methods = []; + + foreach ($ref->getMethods(\ReflectionMethod::IS_PUBLIC) as $refMethod) { + // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment + if ('getenvironment' !== strtolower($refMethod->name)) { + $methods[] = $refMethod->name; + } + } + } else { + $methods = get_class_methods($object); + } + // sort values to have consistent behavior, so that "get" methods win precedence over "is" methods + sort($methods); + + $cache = []; + + foreach ($methods as $method) { + $cache[$method] = $method; + $cache[$lcName = strtolower($method)] = $method; + + if ('g' === $lcName[0] && 0 === strpos($lcName, 'get')) { + $name = substr($method, 3); + $lcName = substr($lcName, 3); + } elseif ('i' === $lcName[0] && 0 === strpos($lcName, 'is')) { + $name = substr($method, 2); + $lcName = substr($lcName, 2); + } else { + continue; + } + + // skip get() and is() methods (in which case, $name is empty) + if ($name) { + if (!isset($cache[$name])) { + $cache[$name] = $method; + } + if (!isset($cache[$lcName])) { + $cache[$lcName] = $method; + } + } + } + self::$cache[$class] = $cache; + } + + $call = false; + if (isset(self::$cache[$class][$item])) { + $method = self::$cache[$class][$item]; + } elseif (isset(self::$cache[$class][$lcItem = strtolower($item)])) { + $method = self::$cache[$class][$lcItem]; + } elseif (isset(self::$cache[$class]['__call'])) { + $method = $item; + $call = true; + } else { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return; + } + + throw new RuntimeError(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), -1, $this->getSourceContext()); + } + + if ($isDefinedTest) { + return true; + } + + if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) { + $this->env->getExtension('\Twig\Extension\SandboxExtension')->checkMethodAllowed($object, $method); + } + + // Some objects throw exceptions when they have __call, and the method we try + // to call is not supported. If ignoreStrictCheck is true, we should return null. + try { + if (!$arguments) { + $ret = $object->$method(); + } else { + $ret = \call_user_func_array([$object, $method], $arguments); + } + } catch (\BadMethodCallException $e) { + if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) { + return; + } + throw $e; + } + + // @deprecated in 1.28 + if ($object instanceof \Twig_TemplateInterface) { + $self = $object->getTemplateName() === $this->getTemplateName(); + $message = sprintf('Calling "%s" on template "%s" from template "%s" is deprecated since version 1.28 and won\'t be supported anymore in 2.0.', $item, $object->getTemplateName(), $this->getTemplateName()); + if ('renderBlock' === $method || 'displayBlock' === $method) { + $message .= sprintf(' Use block("%s"%s) instead).', $arguments[0], $self ? '' : ', template'); + } elseif ('hasBlock' === $method) { + $message .= sprintf(' Use "block("%s"%s) is defined" instead).', $arguments[0], $self ? '' : ', template'); + } elseif ('render' === $method || 'display' === $method) { + $message .= sprintf(' Use include("%s") instead).', $object->getTemplateName()); + } + @trigger_error($message, E_USER_DEPRECATED); + + return '' === $ret ? '' : new Markup($ret, $this->env->getCharset()); + } + + return $ret; } } + +class_alias('Twig\Template', 'Twig_Template'); diff --git a/vendor/twig/twig/src/TemplateWrapper.php b/vendor/twig/twig/src/TemplateWrapper.php index d11ad81cc660e8b17fbc249a9ca27aa2c63aade3..5ddee92291abec3f73c502bf17c210d7b7a95bd2 100644 --- a/vendor/twig/twig/src/TemplateWrapper.php +++ b/vendor/twig/twig/src/TemplateWrapper.php @@ -1,11 +1,147 @@ <?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; -class_exists('Twig_TemplateWrapper'); +/** + * Exposes a template to userland. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +final class TemplateWrapper +{ + private $env; + private $template; + + /** + * This method is for internal use only and should never be called + * directly (use Twig\Environment::load() instead). + * + * @internal + */ + public function __construct(Environment $env, Template $template) + { + $this->env = $env; + $this->template = $template; + } + + /** + * Renders the template. + * + * @param array $context An array of parameters to pass to the template + * + * @return string The rendered template + */ + public function render($context = []) + { + // using func_get_args() allows to not expose the blocks argument + // as it should only be used by internal code + return $this->template->render($context, \func_num_args() > 1 ? func_get_arg(1) : []); + } -if (\false) { - class TemplateWrapper extends \Twig_TemplateWrapper + /** + * Displays the template. + * + * @param array $context An array of parameters to pass to the template + */ + public function display($context = []) { + // using func_get_args() allows to not expose the blocks argument + // as it should only be used by internal code + $this->template->display($context, \func_num_args() > 1 ? func_get_arg(1) : []); + } + + /** + * Checks if a block is defined. + * + * @param string $name The block name + * @param array $context An array of parameters to pass to the template + * + * @return bool + */ + public function hasBlock($name, $context = []) + { + return $this->template->hasBlock($name, $context); + } + + /** + * Returns defined block names in the template. + * + * @param array $context An array of parameters to pass to the template + * + * @return string[] An array of defined template block names + */ + public function getBlockNames($context = []) + { + return $this->template->getBlockNames($context); + } + + /** + * Renders a template block. + * + * @param string $name The block name to render + * @param array $context An array of parameters to pass to the template + * + * @return string The rendered block + */ + public function renderBlock($name, $context = []) + { + $context = $this->env->mergeGlobals($context); + $level = ob_get_level(); + ob_start(); + try { + $this->template->displayBlock($name, $context); + } catch (\Exception $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } catch (\Throwable $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } + + return ob_get_clean(); + } + + /** + * Displays a template block. + * + * @param string $name The block name to render + * @param array $context An array of parameters to pass to the template + */ + public function displayBlock($name, $context = []) + { + $this->template->displayBlock($name, $this->env->mergeGlobals($context)); + } + + /** + * @return Source + */ + public function getSourceContext() + { + return $this->template->getSourceContext(); + } + + /** + * @return string + */ + public function getTemplatename() + { + return $this->template->getTemplateName(); } } + +class_alias('Twig\TemplateWrapper', 'Twig_TemplateWrapper'); diff --git a/vendor/twig/twig/src/Test/IntegrationTestCase.php b/vendor/twig/twig/src/Test/IntegrationTestCase.php index 50f90ac436b696e6133807d91430246522327103..d1b633ab94798b0223681f7a6da93c8f77331fea 100644 --- a/vendor/twig/twig/src/Test/IntegrationTestCase.php +++ b/vendor/twig/twig/src/Test/IntegrationTestCase.php @@ -1,11 +1,257 @@ <?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\Test; -class_exists('Twig_Test_IntegrationTestCase'); +use PHPUnit\Framework\TestCase; +use Twig\Environment; +use Twig\Error\Error; +use Twig\Extension\ExtensionInterface; +use Twig\Loader\ArrayLoader; +use Twig\Loader\SourceContextLoaderInterface; +use Twig\RuntimeLoader\RuntimeLoaderInterface; +use Twig\Source; +use Twig\TwigFilter; +use Twig\TwigFunction; +use Twig\TwigTest; + +/** + * Integration test helper. + * + * @author Fabien Potencier <fabien@symfony.com> + * @author Karma Dordrak <drak@zikula.org> + */ +abstract class IntegrationTestCase extends TestCase +{ + /** + * @return string + */ + abstract protected function getFixturesDir(); + + /** + * @return RuntimeLoaderInterface[] + */ + protected function getRuntimeLoaders() + { + return []; + } + + /** + * @return ExtensionInterface[] + */ + protected function getExtensions() + { + return []; + } + + /** + * @return TwigFilter[] + */ + protected function getTwigFilters() + { + return []; + } + + /** + * @return TwigFunction[] + */ + protected function getTwigFunctions() + { + return []; + } + + /** + * @return TwigTest[] + */ + protected function getTwigTests() + { + return []; + } + + /** + * @dataProvider getTests + */ + public function testIntegration($file, $message, $condition, $templates, $exception, $outputs) + { + $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs); + } + + /** + * @dataProvider getLegacyTests + * @group legacy + */ + public function testLegacyIntegration($file, $message, $condition, $templates, $exception, $outputs) + { + $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs); + } + + public function getTests($name, $legacyTests = false) + { + $fixturesDir = realpath($this->getFixturesDir()); + $tests = []; + + foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fixturesDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + if (!preg_match('/\.test$/', $file)) { + continue; + } + + if ($legacyTests xor false !== strpos($file->getRealpath(), '.legacy.test')) { + continue; + } + + $test = file_get_contents($file->getRealpath()); + + if (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)\s*(?:--DATA--\s*(.*))?\s*--EXCEPTION--\s*(.*)/sx', $test, $match)) { + $message = $match[1]; + $condition = $match[2]; + $templates = self::parseTemplates($match[3]); + $exception = $match[5]; + $outputs = [[null, $match[4], null, '']]; + } elseif (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) { + $message = $match[1]; + $condition = $match[2]; + $templates = self::parseTemplates($match[3]); + $exception = false; + preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\-\-DATA\-\-|$)/s', $test, $outputs, PREG_SET_ORDER); + } else { + throw new \InvalidArgumentException(sprintf('Test "%s" is not valid.', str_replace($fixturesDir.'/', '', $file))); + } + + $tests[] = [str_replace($fixturesDir.'/', '', $file), $message, $condition, $templates, $exception, $outputs]; + } -if (\false) { - class IntegrationTestCase extends \Twig_Test_IntegrationTestCase + if ($legacyTests && empty($tests)) { + // add a dummy test to avoid a PHPUnit message + return [['not', '-', '', [], '', []]]; + } + + return $tests; + } + + public function getLegacyTests() + { + return $this->getTests('testLegacyIntegration', true); + } + + protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs) + { + if (!$outputs) { + $this->markTestSkipped('no tests to run'); + } + + if ($condition) { + eval('$ret = '.$condition.';'); + if (!$ret) { + $this->markTestSkipped($condition); + } + } + + $loader = new ArrayLoader($templates); + + foreach ($outputs as $i => $match) { + $config = array_merge([ + 'cache' => false, + 'strict_variables' => true, + ], $match[2] ? eval($match[2].';') : []); + $twig = new Environment($loader, $config); + $twig->addGlobal('global', 'global'); + foreach ($this->getRuntimeLoaders() as $runtimeLoader) { + $twig->addRuntimeLoader($runtimeLoader); + } + + foreach ($this->getExtensions() as $extension) { + $twig->addExtension($extension); + } + + foreach ($this->getTwigFilters() as $filter) { + $twig->addFilter($filter); + } + + foreach ($this->getTwigTests() as $test) { + $twig->addTest($test); + } + + foreach ($this->getTwigFunctions() as $function) { + $twig->addFunction($function); + } + + $p = new \ReflectionProperty($twig, 'templateClassPrefix'); + $p->setAccessible(true); + $p->setValue($twig, '__TwigTemplate_'.hash('sha256', uniqid(mt_rand(), true), false).'_'); + + try { + $template = $twig->load('index.twig'); + } catch (\Exception $e) { + if (false !== $exception) { + $message = $e->getMessage(); + $this->assertSame(trim($exception), trim(sprintf('%s: %s', \get_class($e), $message))); + $last = substr($message, \strlen($message) - 1); + $this->assertTrue('.' === $last || '?' === $last, $message, 'Exception message must end with a dot or a question mark.'); + + return; + } + + throw new Error(sprintf('%s: %s', \get_class($e), $e->getMessage()), -1, null, $e); + } + + try { + $output = trim($template->render(eval($match[1].';')), "\n "); + } catch (\Exception $e) { + if (false !== $exception) { + $this->assertSame(trim($exception), trim(sprintf('%s: %s', \get_class($e), $e->getMessage()))); + + return; + } + + $e = new Error(sprintf('%s: %s', \get_class($e), $e->getMessage()), -1, null, $e); + + $output = trim(sprintf('%s: %s', \get_class($e), $e->getMessage())); + } + + if (false !== $exception) { + list($class) = explode(':', $exception); + $constraintClass = class_exists('PHPUnit\Framework\Constraint\Exception') ? 'PHPUnit\Framework\Constraint\Exception' : 'PHPUnit_Framework_Constraint_Exception'; + $this->assertThat(null, new $constraintClass($class)); + } + + $expected = trim($match[3], "\n "); + + if ($expected !== $output) { + printf("Compiled templates that failed on case %d:\n", $i + 1); + + foreach (array_keys($templates) as $name) { + echo "Template: $name\n"; + $loader = $twig->getLoader(); + if (!$loader instanceof SourceContextLoaderInterface) { + $source = new Source($loader->getSource($name), $name); + } else { + $source = $loader->getSourceContext($name); + } + echo $twig->compile($twig->parse($twig->tokenize($source))); + } + } + $this->assertEquals($expected, $output, $message.' (in '.$file.')'); + } + } + + protected static function parseTemplates($test) { + $templates = []; + preg_match_all('/--TEMPLATE(?:\((.*?)\))?--(.*?)(?=\-\-TEMPLATE|$)/s', $test, $matches, PREG_SET_ORDER); + foreach ($matches as $match) { + $templates[($match[1] ? $match[1] : 'index.twig')] = $match[2]; + } + + return $templates; } } + +class_alias('Twig\Test\IntegrationTestCase', 'Twig_Test_IntegrationTestCase'); diff --git a/vendor/twig/twig/src/Test/NodeTestCase.php b/vendor/twig/twig/src/Test/NodeTestCase.php index bf56b9742f40c7032bba376d42e860755ee3bdb3..b35cd21853c201d2578f011b4537ea2f8b9b574a 100644 --- a/vendor/twig/twig/src/Test/NodeTestCase.php +++ b/vendor/twig/twig/src/Test/NodeTestCase.php @@ -1,11 +1,79 @@ <?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\Test; -class_exists('Twig_Test_NodeTestCase'); +use PHPUnit\Framework\TestCase; +use Twig\Compiler; +use Twig\Environment; +use Twig\Loader\ArrayLoader; +use Twig\Node\Node; + +abstract class NodeTestCase extends TestCase +{ + abstract public function getTests(); + + /** + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null, $isPattern = false) + { + $this->assertNodeCompilation($source, $node, $environment, $isPattern); + } + + public function assertNodeCompilation($source, Node $node, Environment $environment = null, $isPattern = false) + { + $compiler = $this->getCompiler($environment); + $compiler->compile($node); + + if ($isPattern) { + $this->assertStringMatchesFormat($source, trim($compiler->getSource())); + } else { + $this->assertEquals($source, trim($compiler->getSource())); + } + } + + protected function getCompiler(Environment $environment = null) + { + return new Compiler(null === $environment ? $this->getEnvironment() : $environment); + } -if (\false) { - class NodeTestCase extends \Twig_Test_NodeTestCase + protected function getEnvironment() { + return new Environment(new ArrayLoader([])); + } + + protected function getVariableGetter($name, $line = false) + { + $line = $line > 0 ? "// line {$line}\n" : ''; + + if (\PHP_VERSION_ID >= 70000) { + return sprintf('%s($context["%s"] ?? null)', $line, $name, $name); + } + + if (\PHP_VERSION_ID >= 50400) { + return sprintf('%s(isset($context["%s"]) ? $context["%s"] : null)', $line, $name, $name); + } + + return sprintf('%s$this->getContext($context, "%s")', $line, $name); + } + + protected function getAttributeGetter() + { + if (\function_exists('twig_template_get_attributes')) { + return 'twig_template_get_attributes($this, '; + } + + return '$this->getAttribute('; } } + +class_alias('Twig\Test\NodeTestCase', 'Twig_Test_NodeTestCase'); diff --git a/vendor/twig/twig/src/Token.php b/vendor/twig/twig/src/Token.php index c7751aa468875a5b67fde8dfb8910e8cb4984839..9338972999007e4d4cd27fa59532db493870e971 100644 --- a/vendor/twig/twig/src/Token.php +++ b/vendor/twig/twig/src/Token.php @@ -1,11 +1,209 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig; -class_exists('Twig_Token'); +/** + * Represents a Token. + * + * @author Fabien Potencier <fabien@symfony.com> + * + * @final + */ +class Token +{ + protected $value; + protected $type; + protected $lineno; + + const EOF_TYPE = -1; + const TEXT_TYPE = 0; + const BLOCK_START_TYPE = 1; + const VAR_START_TYPE = 2; + const BLOCK_END_TYPE = 3; + const VAR_END_TYPE = 4; + const NAME_TYPE = 5; + const NUMBER_TYPE = 6; + const STRING_TYPE = 7; + const OPERATOR_TYPE = 8; + const PUNCTUATION_TYPE = 9; + const INTERPOLATION_START_TYPE = 10; + const INTERPOLATION_END_TYPE = 11; + + /** + * @param int $type The type of the token + * @param string $value The token value + * @param int $lineno The line position in the source + */ + public function __construct($type, $value, $lineno) + { + $this->type = $type; + $this->value = $value; + $this->lineno = $lineno; + } + + public function __toString() + { + return sprintf('%s(%s)', self::typeToString($this->type, true), $this->value); + } + + /** + * Tests the current token for a type and/or a value. + * + * Parameters may be: + * * just type + * * type and value (or array of possible values) + * * just value (or array of possible values) (NAME_TYPE is used as type) + * + * @param array|string|int $type The type to test + * @param array|string|null $values The token value + * + * @return bool + */ + public function test($type, $values = null) + { + if (null === $values && !\is_int($type)) { + $values = $type; + $type = self::NAME_TYPE; + } + + return ($this->type === $type) && ( + null === $values || + (\is_array($values) && \in_array($this->value, $values)) || + $this->value == $values + ); + } + + /** + * @return int + */ + public function getLine() + { + return $this->lineno; + } -if (\false) { - class Token extends \Twig_Token + /** + * @return int + */ + public function getType() { + return $this->type; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Returns the constant representation (internal) of a given type. + * + * @param int $type The type as an integer + * @param bool $short Whether to return a short representation or not + * + * @return string The string representation + */ + public static function typeToString($type, $short = false) + { + switch ($type) { + case self::EOF_TYPE: + $name = 'EOF_TYPE'; + break; + case self::TEXT_TYPE: + $name = 'TEXT_TYPE'; + break; + case self::BLOCK_START_TYPE: + $name = 'BLOCK_START_TYPE'; + break; + case self::VAR_START_TYPE: + $name = 'VAR_START_TYPE'; + break; + case self::BLOCK_END_TYPE: + $name = 'BLOCK_END_TYPE'; + break; + case self::VAR_END_TYPE: + $name = 'VAR_END_TYPE'; + break; + case self::NAME_TYPE: + $name = 'NAME_TYPE'; + break; + case self::NUMBER_TYPE: + $name = 'NUMBER_TYPE'; + break; + case self::STRING_TYPE: + $name = 'STRING_TYPE'; + break; + case self::OPERATOR_TYPE: + $name = 'OPERATOR_TYPE'; + break; + case self::PUNCTUATION_TYPE: + $name = 'PUNCTUATION_TYPE'; + break; + case self::INTERPOLATION_START_TYPE: + $name = 'INTERPOLATION_START_TYPE'; + break; + case self::INTERPOLATION_END_TYPE: + $name = 'INTERPOLATION_END_TYPE'; + break; + default: + throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type)); + } + + return $short ? $name : 'Twig\Token::'.$name; + } + + /** + * Returns the English representation of a given type. + * + * @param int $type The type as an integer + * + * @return string The string representation + */ + public static function typeToEnglish($type) + { + switch ($type) { + case self::EOF_TYPE: + return 'end of template'; + case self::TEXT_TYPE: + return 'text'; + case self::BLOCK_START_TYPE: + return 'begin of statement block'; + case self::VAR_START_TYPE: + return 'begin of print statement'; + case self::BLOCK_END_TYPE: + return 'end of statement block'; + case self::VAR_END_TYPE: + return 'end of print statement'; + case self::NAME_TYPE: + return 'name'; + case self::NUMBER_TYPE: + return 'number'; + case self::STRING_TYPE: + return 'string'; + case self::OPERATOR_TYPE: + return 'operator'; + case self::PUNCTUATION_TYPE: + return 'punctuation'; + case self::INTERPOLATION_START_TYPE: + return 'begin of string interpolation'; + case self::INTERPOLATION_END_TYPE: + return 'end of string interpolation'; + default: + throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type)); + } } } + +class_alias('Twig\Token', 'Twig_Token'); diff --git a/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php b/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php index 6ae78a5967beb89d922e8df2eab3435cd335dfa2..fc8c11a23b7de0ca4a6085971af81187ca1434d9 100644 --- a/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php @@ -1,11 +1,31 @@ <?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; -class_exists('Twig_TokenParser'); +use Twig\Parser; + +/** + * Base class for all token parsers. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +abstract class AbstractTokenParser implements TokenParserInterface +{ + protected $parser; -if (\false) { - class AbstractTokenParser extends \Twig_TokenParser + public function setParser(Parser $parser) { + $this->parser = $parser; } } + +class_alias('Twig\TokenParser\AbstractTokenParser', 'Twig_TokenParser'); diff --git a/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php b/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php index 68a99da5a490b4c40626882a38570055e2ee6ed9..2cd0cc69d73681e496097c33f150073d3e5c5101 100644 --- a/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php @@ -1,11 +1,88 @@ <?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; -class_exists('Twig_TokenParser_AutoEscape'); +use Twig\Error\SyntaxError; +use Twig\Node\AutoEscapeNode; +use Twig\Node\Expression\ConstantExpression; +use Twig\Token; + +/** + * Marks a section of a template to be escaped or not. + * + * {% autoescape true %} + * Everything will be automatically escaped in this block + * {% endautoescape %} + * + * {% autoescape false %} + * Everything will be outputed as is in this block + * {% endautoescape %} + * + * {% autoescape true js %} + * Everything will be automatically escaped in this block + * using the js escaping strategy + * {% endautoescape %} + * + * @final + */ +class AutoEscapeTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + + if ($stream->test(Token::BLOCK_END_TYPE)) { + $value = 'html'; + } else { + $expr = $this->parser->getExpressionParser()->parseExpression(); + if (!$expr instanceof ConstantExpression) { + throw new SyntaxError('An escaping strategy must be a string or a bool.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + $value = $expr->getAttribute('value'); + + $compat = true === $value || false === $value; + + if (true === $value) { + $value = 'html'; + } + + if ($compat && $stream->test(Token::NAME_TYPE)) { + @trigger_error('Using the autoescape tag with "true" or "false" before the strategy name is deprecated since version 1.21.', E_USER_DEPRECATED); + + if (false === $value) { + throw new SyntaxError('Unexpected escaping strategy as you set autoescaping to false.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } -if (\false) { - class AutoEscapeTokenParser extends \Twig_TokenParser_AutoEscape + $value = $stream->next()->getValue(); + } + } + + $stream->expect(Token::BLOCK_END_TYPE); + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $stream->expect(Token::BLOCK_END_TYPE); + + return new AutoEscapeNode($value, $body, $lineno, $this->getTag()); + } + + public function decideBlockEnd(Token $token) { + return $token->test('endautoescape'); + } + + public function getTag() + { + return 'autoescape'; } } + +class_alias('Twig\TokenParser\AutoEscapeTokenParser', 'Twig_TokenParser_AutoEscape'); diff --git a/vendor/twig/twig/src/TokenParser/BlockTokenParser.php b/vendor/twig/twig/src/TokenParser/BlockTokenParser.php index 8be168302121f40be9f1548f6e9627b7c36ffd68..caf11f0b7266184549d6d27e755f7aae372ef5fa 100644 --- a/vendor/twig/twig/src/TokenParser/BlockTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/BlockTokenParser.php @@ -1,11 +1,80 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\TokenParser; -class_exists('Twig_TokenParser_Block'); +use Twig\Error\SyntaxError; +use Twig\Node\BlockNode; +use Twig\Node\BlockReferenceNode; +use Twig\Node\Node; +use Twig\Node\PrintNode; +use Twig\Token; + +/** + * Marks a section of a template as being reusable. + * + * {% block head %} + * <link rel="stylesheet" href="style.css" /> + * <title>{% block title %}{% endblock %} - My Webpage</title> + * {% endblock %} + * + * @final + */ +class BlockTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + $name = $stream->expect(Token::NAME_TYPE)->getValue(); + if ($this->parser->hasBlock($name)) { + throw new SyntaxError(sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getTemplateLine()), $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + $this->parser->setBlock($name, $block = new BlockNode($name, new Node([]), $lineno)); + $this->parser->pushLocalScope(); + $this->parser->pushBlockStack($name); + + if ($stream->nextIf(Token::BLOCK_END_TYPE)) { + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + if ($token = $stream->nextIf(Token::NAME_TYPE)) { + $value = $token->getValue(); + + if ($value != $name) { + throw new SyntaxError(sprintf('Expected endblock for block "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + } + } else { + $body = new Node([ + new PrintNode($this->parser->getExpressionParser()->parseExpression(), $lineno), + ]); + } + $stream->expect(Token::BLOCK_END_TYPE); + + $block->setNode('body', $body); + $this->parser->popBlockStack(); + $this->parser->popLocalScope(); -if (\false) { - class BlockTokenParser extends \Twig_TokenParser_Block + return new BlockReferenceNode($name, $lineno, $this->getTag()); + } + + public function decideBlockEnd(Token $token) + { + return $token->test('endblock'); + } + + public function getTag() { + return 'block'; } } + +class_alias('Twig\TokenParser\BlockTokenParser', 'Twig_TokenParser_Block'); diff --git a/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php b/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php new file mode 100644 index 0000000000000000000000000000000000000000..6575cff167d21a41512210882ba87f0b19a5bf76 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php @@ -0,0 +1,44 @@ +<?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\DeprecatedNode; +use Twig\Token; + +/** + * Deprecates a section of a template. + * + * {% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %} + * {% extends 'layout.html.twig' %} + * + * @author Yonel Ceruto <yonelceruto@gmail.com> + * + * @final + */ +class DeprecatedTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new DeprecatedNode($expr, $token->getLine(), $this->getTag()); + } + + public function getTag() + { + return 'deprecated'; + } +} + +class_alias('Twig\TokenParser\DeprecatedTokenParser', 'Twig_TokenParser_Deprecated'); diff --git a/vendor/twig/twig/src/TokenParser/DoTokenParser.php b/vendor/twig/twig/src/TokenParser/DoTokenParser.php index a40b166d0e29cb59022c7b2035bb3a785fd05e19..e1eae10f230267258bd4c4a60544e18bfd9fd635 100644 --- a/vendor/twig/twig/src/TokenParser/DoTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/DoTokenParser.php @@ -1,11 +1,39 @@ <?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; -class_exists('Twig_TokenParser_Do'); +use Twig\Node\DoNode; +use Twig\Token; -if (\false) { - class DoTokenParser extends \Twig_TokenParser_Do +/** + * Evaluates an expression, discarding the returned value. + * + * @final + */ +class DoTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new DoNode($expr, $token->getLine(), $this->getTag()); + } + + public function getTag() + { + return 'do'; } } + +class_alias('Twig\TokenParser\DoTokenParser', 'Twig_TokenParser_Do'); diff --git a/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php b/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php index f557db9da85796b180a4a675d2b495ad38fbd2c8..973ff2e45b1f55f1e2c1e72db0e3ca6423c51fb6 100644 --- a/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php @@ -1,11 +1,74 @@ <?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; -class_exists('Twig_TokenParser_Embed'); +use Twig\Node\EmbedNode; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Token; -if (\false) { - class EmbedTokenParser extends \Twig_TokenParser_Embed +/** + * Embeds a template. + * + * @final + */ +class EmbedTokenParser extends IncludeTokenParser +{ + public function parse(Token $token) { + $stream = $this->parser->getStream(); + + $parent = $this->parser->getExpressionParser()->parseExpression(); + + list($variables, $only, $ignoreMissing) = $this->parseArguments(); + + $parentToken = $fakeParentToken = new Token(Token::STRING_TYPE, '__parent__', $token->getLine()); + if ($parent instanceof ConstantExpression) { + $parentToken = new Token(Token::STRING_TYPE, $parent->getAttribute('value'), $token->getLine()); + } elseif ($parent instanceof NameExpression) { + $parentToken = new Token(Token::NAME_TYPE, $parent->getAttribute('name'), $token->getLine()); + } + + // inject a fake parent to make the parent() function work + $stream->injectTokens([ + new Token(Token::BLOCK_START_TYPE, '', $token->getLine()), + new Token(Token::NAME_TYPE, 'extends', $token->getLine()), + $parentToken, + new Token(Token::BLOCK_END_TYPE, '', $token->getLine()), + ]); + + $module = $this->parser->parse($stream, [$this, 'decideBlockEnd'], true); + + // override the parent with the correct one + if ($fakeParentToken === $parentToken) { + $module->setNode('parent', $parent); + } + + $this->parser->embedTemplate($module); + + $stream->expect(Token::BLOCK_END_TYPE); + + return new EmbedNode($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + } + + public function decideBlockEnd(Token $token) + { + return $token->test('endembed'); + } + + public function getTag() + { + return 'embed'; } } + +class_alias('Twig\TokenParser\EmbedTokenParser', 'Twig_TokenParser_Embed'); diff --git a/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php b/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php index cf929ab4b9f17a445528eb902779cd4deb33b10a..74f129c564a75ffac1fb6bdaf5d4f399be3aaf1c 100644 --- a/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php @@ -1,11 +1,49 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\TokenParser; -class_exists('Twig_TokenParser_Extends'); +use Twig\Error\SyntaxError; +use Twig\Token; + +/** + * Extends a template by another one. + * + * {% extends "base.html" %} + * + * @final + */ +class ExtendsTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $stream = $this->parser->getStream(); + + if (!$this->parser->isMainScope()) { + throw new SyntaxError('Cannot extend from a block.', $token->getLine(), $stream->getSourceContext()); + } -if (\false) { - class ExtendsTokenParser extends \Twig_TokenParser_Extends + if (null !== $this->parser->getParent()) { + throw new SyntaxError('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext()); + } + $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); + + $stream->expect(Token::BLOCK_END_TYPE); + } + + public function getTag() { + return 'extends'; } } + +class_alias('Twig\TokenParser\ExtendsTokenParser', 'Twig_TokenParser_Extends'); diff --git a/vendor/twig/twig/src/TokenParser/FilterTokenParser.php b/vendor/twig/twig/src/TokenParser/FilterTokenParser.php index de9d6ab49e5932a1ae2a9c68386e03ba5a7e72ee..dc07dcfa41ea155a32b30a8ea57ef7fc98cf28ac 100644 --- a/vendor/twig/twig/src/TokenParser/FilterTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/FilterTokenParser.php @@ -1,11 +1,59 @@ <?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; -class_exists('Twig_TokenParser_Filter'); +use Twig\Node\BlockNode; +use Twig\Node\Expression\BlockReferenceExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\PrintNode; +use Twig\Token; + +/** + * Filters a section of a template by applying filters. + * + * {% filter upper %} + * This text becomes uppercase + * {% endfilter %} + * + * @final + */ +class FilterTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $name = $this->parser->getVarName(); + $ref = new BlockReferenceExpression(new ConstantExpression($name, $token->getLine()), null, $token->getLine(), $this->getTag()); + + $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + $block = new BlockNode($name, $body, $token->getLine()); + $this->parser->setBlock($name, $block); -if (\false) { - class FilterTokenParser extends \Twig_TokenParser_Filter + return new PrintNode($filter, $token->getLine(), $this->getTag()); + } + + public function decideBlockEnd(Token $token) + { + return $token->test('endfilter'); + } + + public function getTag() { + return 'filter'; } } + +class_alias('Twig\TokenParser\FilterTokenParser', 'Twig_TokenParser_Filter'); diff --git a/vendor/twig/twig/src/TokenParser/FlushTokenParser.php b/vendor/twig/twig/src/TokenParser/FlushTokenParser.php index ce1302643ec8ca29d6494f76931d56c06a9ee5a2..b25524fa8da74895583cbf29cfdc6746d32ca1f3 100644 --- a/vendor/twig/twig/src/TokenParser/FlushTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/FlushTokenParser.php @@ -1,11 +1,39 @@ <?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; -class_exists('Twig_TokenParser_Flush'); +use Twig\Node\FlushNode; +use Twig\Token; + +/** + * Flushes the output to the client. + * + * @see flush() + * + * @final + */ +class FlushTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new FlushNode($token->getLine(), $this->getTag()); + } -if (\false) { - class FlushTokenParser extends \Twig_TokenParser_Flush + public function getTag() { + return 'flush'; } } + +class_alias('Twig\TokenParser\FlushTokenParser', 'Twig_TokenParser_Flush'); diff --git a/vendor/twig/twig/src/TokenParser/ForTokenParser.php b/vendor/twig/twig/src/TokenParser/ForTokenParser.php index 25ddcea3a2d8d6e711e3d7f1a780aaac0f6f1b1c..69278d98ed3fe8b4988186719985d83023450dc5 100644 --- a/vendor/twig/twig/src/TokenParser/ForTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/ForTokenParser.php @@ -1,11 +1,136 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\TokenParser; -class_exists('Twig_TokenParser_For'); +use Twig\Error\SyntaxError; +use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\GetAttrExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\ForNode; +use Twig\Token; +use Twig\TokenStream; + +/** + * Loops over each item of a sequence. + * + * <ul> + * {% for user in users %} + * <li>{{ user.username|e }}</li> + * {% endfor %} + * </ul> + * + * @final + */ +class ForTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + $targets = $this->parser->getExpressionParser()->parseAssignmentExpression(); + $stream->expect(Token::OPERATOR_TYPE, 'in'); + $seq = $this->parser->getExpressionParser()->parseExpression(); + + $ifexpr = null; + if ($stream->nextIf(Token::NAME_TYPE, 'if')) { + $ifexpr = $this->parser->getExpressionParser()->parseExpression(); + } + + $stream->expect(Token::BLOCK_END_TYPE); + $body = $this->parser->subparse([$this, 'decideForFork']); + if ('else' == $stream->next()->getValue()) { + $stream->expect(Token::BLOCK_END_TYPE); + $else = $this->parser->subparse([$this, 'decideForEnd'], true); + } else { + $else = null; + } + $stream->expect(Token::BLOCK_END_TYPE); + + if (\count($targets) > 1) { + $keyTarget = $targets->getNode(0); + $keyTarget = new AssignNameExpression($keyTarget->getAttribute('name'), $keyTarget->getTemplateLine()); + $valueTarget = $targets->getNode(1); + $valueTarget = new AssignNameExpression($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine()); + } else { + $keyTarget = new AssignNameExpression('_key', $lineno); + $valueTarget = $targets->getNode(0); + $valueTarget = new AssignNameExpression($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine()); + } + + if ($ifexpr) { + $this->checkLoopUsageCondition($stream, $ifexpr); + $this->checkLoopUsageBody($stream, $body); + } -if (\false) { - class ForTokenParser extends \Twig_TokenParser_For + return new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag()); + } + + public function decideForFork(Token $token) { + return $token->test(['else', 'endfor']); + } + + public function decideForEnd(Token $token) + { + return $token->test('endfor'); + } + + // the loop variable cannot be used in the condition + protected function checkLoopUsageCondition(TokenStream $stream, \Twig_NodeInterface $node) + { + if ($node instanceof GetAttrExpression && $node->getNode('node') instanceof NameExpression && 'loop' == $node->getNode('node')->getAttribute('name')) { + throw new SyntaxError('The "loop" variable cannot be used in a looping condition.', $node->getTemplateLine(), $stream->getSourceContext()); + } + + foreach ($node as $n) { + if (!$n) { + continue; + } + + $this->checkLoopUsageCondition($stream, $n); + } + } + + // check usage of non-defined loop-items + // it does not catch all problems (for instance when a for is included into another or when the variable is used in an include) + protected function checkLoopUsageBody(TokenStream $stream, \Twig_NodeInterface $node) + { + if ($node instanceof GetAttrExpression && $node->getNode('node') instanceof NameExpression && 'loop' == $node->getNode('node')->getAttribute('name')) { + $attribute = $node->getNode('attribute'); + if ($attribute instanceof ConstantExpression && \in_array($attribute->getAttribute('value'), ['length', 'revindex0', 'revindex', 'last'])) { + throw new SyntaxError(sprintf('The "loop.%s" variable is not defined when looping with a condition.', $attribute->getAttribute('value')), $node->getTemplateLine(), $stream->getSourceContext()); + } + } + + // should check for parent.loop.XXX usage + if ($node instanceof ForNode) { + return; + } + + foreach ($node as $n) { + if (!$n) { + continue; + } + + $this->checkLoopUsageBody($stream, $n); + } + } + + public function getTag() + { + return 'for'; } } + +class_alias('Twig\TokenParser\ForTokenParser', 'Twig_TokenParser_For'); diff --git a/vendor/twig/twig/src/TokenParser/FromTokenParser.php b/vendor/twig/twig/src/TokenParser/FromTokenParser.php index 1e5a4bc0bc0dfe2310696d992de60583433a780b..a47f197e8672c3bfb0c2be801d0ebe7a64d60059 100644 --- a/vendor/twig/twig/src/TokenParser/FromTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/FromTokenParser.php @@ -1,11 +1,71 @@ <?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; -class_exists('Twig_TokenParser_From'); +use Twig\Error\SyntaxError; +use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\ImportNode; +use Twig\Token; + +/** + * Imports macros. + * + * {% from 'forms.html' import forms %} + * + * @final + */ +class FromTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $macro = $this->parser->getExpressionParser()->parseExpression(); + $stream = $this->parser->getStream(); + $stream->expect('import'); + + $targets = []; + do { + $name = $stream->expect(Token::NAME_TYPE)->getValue(); + + $alias = $name; + if ($stream->nextIf('as')) { + $alias = $stream->expect(Token::NAME_TYPE)->getValue(); + } + + $targets[$name] = $alias; + + if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { + break; + } + } while (true); -if (\false) { - class FromTokenParser extends \Twig_TokenParser_From + $stream->expect(Token::BLOCK_END_TYPE); + + $node = new ImportNode($macro, new AssignNameExpression($this->parser->getVarName(), $token->getLine()), $token->getLine(), $this->getTag()); + + foreach ($targets as $name => $alias) { + if ($this->parser->isReservedMacroName($name)) { + throw new SyntaxError(sprintf('"%s" cannot be an imported macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getSourceContext()); + } + + $this->parser->addImportedSymbol('function', $alias, 'get'.$name, $node->getNode('var')); + } + + return $node; + } + + public function getTag() { + return 'from'; } } + +class_alias('Twig\TokenParser\FromTokenParser', 'Twig_TokenParser_From'); diff --git a/vendor/twig/twig/src/TokenParser/IfTokenParser.php b/vendor/twig/twig/src/TokenParser/IfTokenParser.php index 1852cf1e69f8419efab74b5379125c1ecc51c10e..2631a20cec588740580092c4a9e7f2e2f0d88d24 100644 --- a/vendor/twig/twig/src/TokenParser/IfTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/IfTokenParser.php @@ -1,11 +1,91 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\TokenParser; -class_exists('Twig_TokenParser_If'); +use Twig\Error\SyntaxError; +use Twig\Node\IfNode; +use Twig\Node\Node; +use Twig\Token; -if (\false) { - class IfTokenParser extends \Twig_TokenParser_If +/** + * Tests a condition. + * + * {% if users %} + * <ul> + * {% for user in users %} + * <li>{{ user.username|e }}</li> + * {% endfor %} + * </ul> + * {% endif %} + * + * @final + */ +class IfTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) { + $lineno = $token->getLine(); + $expr = $this->parser->getExpressionParser()->parseExpression(); + $stream = $this->parser->getStream(); + $stream->expect(Token::BLOCK_END_TYPE); + $body = $this->parser->subparse([$this, 'decideIfFork']); + $tests = [$expr, $body]; + $else = null; + + $end = false; + while (!$end) { + switch ($stream->next()->getValue()) { + case 'else': + $stream->expect(Token::BLOCK_END_TYPE); + $else = $this->parser->subparse([$this, 'decideIfEnd']); + break; + + case 'elseif': + $expr = $this->parser->getExpressionParser()->parseExpression(); + $stream->expect(Token::BLOCK_END_TYPE); + $body = $this->parser->subparse([$this, 'decideIfFork']); + $tests[] = $expr; + $tests[] = $body; + break; + + case 'endif': + $end = true; + break; + + default: + throw new SyntaxError(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d).', $lineno), $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + } + + $stream->expect(Token::BLOCK_END_TYPE); + + return new IfNode(new Node($tests), $else, $lineno, $this->getTag()); + } + + public function decideIfFork(Token $token) + { + return $token->test(['elseif', 'else', 'endif']); + } + + public function decideIfEnd(Token $token) + { + return $token->test(['endif']); + } + + public function getTag() + { + return 'if'; } } + +class_alias('Twig\TokenParser\IfTokenParser', 'Twig_TokenParser_If'); diff --git a/vendor/twig/twig/src/TokenParser/ImportTokenParser.php b/vendor/twig/twig/src/TokenParser/ImportTokenParser.php index 1a42d0128cc1a27ecd2881cde787d13e865b0d2a..317e0a5ea4befcc430aa99822585bfd5df8e9836 100644 --- a/vendor/twig/twig/src/TokenParser/ImportTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/ImportTokenParser.php @@ -1,11 +1,45 @@ <?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; -class_exists('Twig_TokenParser_Import'); +use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\ImportNode; +use Twig\Token; -if (\false) { - class ImportTokenParser extends \Twig_TokenParser_Import +/** + * Imports macros. + * + * {% import 'forms.html' as forms %} + * + * @final + */ +class ImportTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) { + $macro = $this->parser->getExpressionParser()->parseExpression(); + $this->parser->getStream()->expect('as'); + $var = new AssignNameExpression($this->parser->getStream()->expect(Token::NAME_TYPE)->getValue(), $token->getLine()); + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + $this->parser->addImportedSymbol('template', $var->getAttribute('name')); + + return new ImportNode($macro, $var, $token->getLine(), $this->getTag()); + } + + public function getTag() + { + return 'import'; } } + +class_alias('Twig\TokenParser\ImportTokenParser', 'Twig_TokenParser_Import'); diff --git a/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php b/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php index 7f8c061fd70ef7a5c28551df919cd79a133e2cb6..57aa4cf41afe9273b5a4e76768678daddf6f259c 100644 --- a/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php @@ -1,11 +1,68 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig\TokenParser; -class_exists('Twig_TokenParser_Include'); +use Twig\Node\IncludeNode; +use Twig\Token; + +/** + * Includes a template. + * + * {% include 'header.html' %} + * Body + * {% include 'footer.html' %} + */ +class IncludeTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + list($variables, $only, $ignoreMissing) = $this->parseArguments(); + + return new IncludeNode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + } + + protected function parseArguments() + { + $stream = $this->parser->getStream(); + + $ignoreMissing = false; + if ($stream->nextIf(Token::NAME_TYPE, 'ignore')) { + $stream->expect(Token::NAME_TYPE, 'missing'); + + $ignoreMissing = true; + } + + $variables = null; + if ($stream->nextIf(Token::NAME_TYPE, 'with')) { + $variables = $this->parser->getExpressionParser()->parseExpression(); + } + + $only = false; + if ($stream->nextIf(Token::NAME_TYPE, 'only')) { + $only = true; + } -if (\false) { - class IncludeTokenParser extends \Twig_TokenParser_Include + $stream->expect(Token::BLOCK_END_TYPE); + + return [$variables, $only, $ignoreMissing]; + } + + public function getTag() { + return 'include'; } } + +class_alias('Twig\TokenParser\IncludeTokenParser', 'Twig_TokenParser_Include'); diff --git a/vendor/twig/twig/src/TokenParser/MacroTokenParser.php b/vendor/twig/twig/src/TokenParser/MacroTokenParser.php index 152fb2672db4e73e027a0fdadea1d3202c907233..734ebc60f11d4cf3769bd4d7eec3849517b18878 100644 --- a/vendor/twig/twig/src/TokenParser/MacroTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/MacroTokenParser.php @@ -1,11 +1,65 @@ <?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; -class_exists('Twig_TokenParser_Macro'); +use Twig\Error\SyntaxError; +use Twig\Node\BodyNode; +use Twig\Node\MacroNode; +use Twig\Token; + +/** + * Defines a macro. + * + * {% macro input(name, value, type, size) %} + * <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" /> + * {% endmacro %} + * + * @final + */ +class MacroTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + $name = $stream->expect(Token::NAME_TYPE)->getValue(); + + $arguments = $this->parser->getExpressionParser()->parseArguments(true, true); + + $stream->expect(Token::BLOCK_END_TYPE); + $this->parser->pushLocalScope(); + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + if ($token = $stream->nextIf(Token::NAME_TYPE)) { + $value = $token->getValue(); + + if ($value != $name) { + throw new SyntaxError(sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + } + $this->parser->popLocalScope(); + $stream->expect(Token::BLOCK_END_TYPE); -if (\false) { - class MacroTokenParser extends \Twig_TokenParser_Macro + $this->parser->setMacro($name, new MacroNode($name, new BodyNode([$body]), $arguments, $lineno, $this->getTag())); + } + + public function decideBlockEnd(Token $token) + { + return $token->test('endmacro'); + } + + public function getTag() { + return 'macro'; } } + +class_alias('Twig\TokenParser\MacroTokenParser', 'Twig_TokenParser_Macro'); diff --git a/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php b/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php index e54c315a1866fffad26d306dbf740521ad51023d..0f3ad9e3e6c70aef58348322c36034fe9ef27df8 100644 --- a/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php @@ -1,11 +1,67 @@ <?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; -class_exists('Twig_TokenParser_Sandbox'); +use Twig\Error\SyntaxError; +use Twig\Node\IncludeNode; +use Twig\Node\SandboxNode; +use Twig\Node\TextNode; +use Twig\Token; -if (\false) { - class SandboxTokenParser extends \Twig_TokenParser_Sandbox +/** + * Marks a section of a template as untrusted code that must be evaluated in the sandbox mode. + * + * {% sandbox %} + * {% include 'user.html' %} + * {% endsandbox %} + * + * @see https://twig.symfony.com/doc/api.html#sandbox-extension for details + * + * @final + */ +class SandboxTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) { + $stream = $this->parser->getStream(); + $stream->expect(Token::BLOCK_END_TYPE); + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $stream->expect(Token::BLOCK_END_TYPE); + + // in a sandbox tag, only include tags are allowed + if (!$body instanceof IncludeNode) { + foreach ($body as $node) { + if ($node instanceof TextNode && ctype_space($node->getAttribute('data'))) { + continue; + } + + if (!$node instanceof IncludeNode) { + throw new SyntaxError('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext()); + } + } + } + + return new SandboxNode($body, $token->getLine(), $this->getTag()); + } + + public function decideBlockEnd(Token $token) + { + return $token->test('endsandbox'); + } + + public function getTag() + { + return 'sandbox'; } } + +class_alias('Twig\TokenParser\SandboxTokenParser', 'Twig_TokenParser_Sandbox'); diff --git a/vendor/twig/twig/src/TokenParser/SetTokenParser.php b/vendor/twig/twig/src/TokenParser/SetTokenParser.php index a9d04d7dc4a726d01c07522496bcee7c6de507e0..eebebc698513f9031fa8b808ed0dc974975269fe 100644 --- a/vendor/twig/twig/src/TokenParser/SetTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/SetTokenParser.php @@ -1,11 +1,74 @@ <?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; -class_exists('Twig_TokenParser_Set'); +use Twig\Error\SyntaxError; +use Twig\Node\SetNode; +use Twig\Token; -if (\false) { - class SetTokenParser extends \Twig_TokenParser_Set +/** + * Defines a variable. + * + * {% set foo = 'foo' %} + * {% set foo = [1, 2] %} + * {% set foo = {'foo': 'bar'} %} + * {% set foo = 'foo' ~ 'bar' %} + * {% set foo, bar = 'foo', 'bar' %} + * {% set foo %}Some content{% endset %} + * + * @final + */ +class SetTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + $names = $this->parser->getExpressionParser()->parseAssignmentExpression(); + + $capture = false; + if ($stream->nextIf(Token::OPERATOR_TYPE, '=')) { + $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); + + $stream->expect(Token::BLOCK_END_TYPE); + + if (\count($names) !== \count($values)) { + throw new SyntaxError('When using set, you must have the same number of variables and assignments.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + } else { + $capture = true; + + if (\count($names) > 1) { + throw new SyntaxError('When using set with a block, you cannot have a multi-target.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + + $stream->expect(Token::BLOCK_END_TYPE); + + $values = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $stream->expect(Token::BLOCK_END_TYPE); + } + + return new SetNode($capture, $names, $values, $lineno, $this->getTag()); + } + + public function decideBlockEnd(Token $token) + { + return $token->test('endset'); + } + + public function getTag() + { + return 'set'; } } + +class_alias('Twig\TokenParser\SetTokenParser', 'Twig_TokenParser_Set'); diff --git a/vendor/twig/twig/src/TokenParser/SpacelessTokenParser.php b/vendor/twig/twig/src/TokenParser/SpacelessTokenParser.php index 5e7e3dd93a3d046bff2189d9321191109f7939ac..5b5656bc64fe54a5798207655a8df75a806d17c9 100644 --- a/vendor/twig/twig/src/TokenParser/SpacelessTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/SpacelessTokenParser.php @@ -1,11 +1,53 @@ <?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; -class_exists('Twig_TokenParser_Spaceless'); +use Twig\Node\SpacelessNode; +use Twig\Token; + +/** + * Remove whitespaces between HTML tags. + * + * {% spaceless %} + * <div> + * <strong>foo</strong> + * </div> + * {% endspaceless %} + * {# output will be <div><strong>foo</strong></div> #} + * + * @final + */ +class SpacelessTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $lineno = $token->getLine(); + + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + $body = $this->parser->subparse([$this, 'decideSpacelessEnd'], true); + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new SpacelessNode($body, $lineno, $this->getTag()); + } -if (\false) { - class SpacelessTokenParser extends \Twig_TokenParser_Spaceless + public function decideSpacelessEnd(Token $token) { + return $token->test('endspaceless'); + } + + public function getTag() + { + return 'spaceless'; } } + +class_alias('Twig\TokenParser\SpacelessTokenParser', 'Twig_TokenParser_Spaceless'); diff --git a/vendor/twig/twig/src/TokenParser/TokenParserInterface.php b/vendor/twig/twig/src/TokenParser/TokenParserInterface.php index 08ab0c92622c5330323723537a11545020a0da08..4b603b213ff826d3bbd792d5901acacc0ab989be 100644 --- a/vendor/twig/twig/src/TokenParser/TokenParserInterface.php +++ b/vendor/twig/twig/src/TokenParser/TokenParserInterface.php @@ -1,11 +1,51 @@ <?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; -class_exists('Twig_TokenParserInterface'); +use Twig\Error\SyntaxError; +use Twig\Parser; +use Twig\Token; + +/** + * Interface implemented by token parsers. + * + * @author Fabien Potencier <fabien@symfony.com> + */ +interface TokenParserInterface +{ + /** + * Sets the parser associated with this token parser. + */ + public function setParser(Parser $parser); + + /** + * Parses a token and returns a node. + * + * @return \Twig_NodeInterface + * + * @throws SyntaxError + */ + public function parse(Token $token); -if (\false) { - interface TokenParserInterface extends \Twig_TokenParserInterface - { - } + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag(); } + +class_alias('Twig\TokenParser\TokenParserInterface', 'Twig_TokenParserInterface'); + +// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. +class_exists('Twig\Token'); +class_exists('Twig\Parser'); diff --git a/vendor/twig/twig/src/TokenParser/UseTokenParser.php b/vendor/twig/twig/src/TokenParser/UseTokenParser.php index db58a6050cbd7530fa60600598382ac9f664b5af..d2e39aabeeacd7530bb210e950ebed2c4be97f8c 100644 --- a/vendor/twig/twig/src/TokenParser/UseTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/UseTokenParser.php @@ -1,11 +1,75 @@ <?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; -class_exists('Twig_TokenParser_Use'); +use Twig\Error\SyntaxError; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Node; +use Twig\Token; -if (\false) { - class UseTokenParser extends \Twig_TokenParser_Use +/** + * Imports blocks defined in another template into the current template. + * + * {% extends "base.html" %} + * + * {% use "blocks.html" %} + * + * {% block title %}{% endblock %} + * {% block content %}{% endblock %} + * + * @see https://twig.symfony.com/doc/templates.html#horizontal-reuse for details. + * + * @final + */ +class UseTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) { + $template = $this->parser->getExpressionParser()->parseExpression(); + $stream = $this->parser->getStream(); + + if (!$template instanceof ConstantExpression) { + throw new SyntaxError('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + + $targets = []; + if ($stream->nextIf('with')) { + do { + $name = $stream->expect(Token::NAME_TYPE)->getValue(); + + $alias = $name; + if ($stream->nextIf('as')) { + $alias = $stream->expect(Token::NAME_TYPE)->getValue(); + } + + $targets[$name] = new ConstantExpression($alias, -1); + + if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { + break; + } + } while (true); + } + + $stream->expect(Token::BLOCK_END_TYPE); + + $this->parser->addTrait(new Node(['template' => $template, 'targets' => new Node($targets)])); + + return new Node(); + } + + public function getTag() + { + return 'use'; } } + +class_alias('Twig\TokenParser\UseTokenParser', 'Twig_TokenParser_Use'); diff --git a/vendor/twig/twig/src/TokenParser/WithTokenParser.php b/vendor/twig/twig/src/TokenParser/WithTokenParser.php index 518d6f59afbb00dea3b2d44e366a22f5f7565e75..411e2b4a139d846b82b4fb3b521f218ebea121ad 100644 --- a/vendor/twig/twig/src/TokenParser/WithTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/WithTokenParser.php @@ -1,11 +1,57 @@ <?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; -class_exists('Twig_TokenParser_With'); +use Twig\Node\WithNode; +use Twig\Token; -if (\false) { - class WithTokenParser extends \Twig_TokenParser_With +/** + * Creates a nested scope. + * + * @author Fabien Potencier <fabien@symfony.com> + * + * @final + */ +class WithTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) { + $stream = $this->parser->getStream(); + + $variables = null; + $only = false; + if (!$stream->test(Token::BLOCK_END_TYPE)) { + $variables = $this->parser->getExpressionParser()->parseExpression(); + $only = $stream->nextIf(Token::NAME_TYPE, 'only'); + } + + $stream->expect(Token::BLOCK_END_TYPE); + + $body = $this->parser->subparse([$this, 'decideWithEnd'], true); + + $stream->expect(Token::BLOCK_END_TYPE); + + return new WithNode($body, $variables, $only, $token->getLine(), $this->getTag()); + } + + public function decideWithEnd(Token $token) + { + return $token->test('endwith'); + } + + public function getTag() + { + return 'with'; } } + +class_alias('Twig\TokenParser\WithTokenParser', 'Twig_TokenParser_With'); diff --git a/vendor/twig/twig/src/TokenStream.php b/vendor/twig/twig/src/TokenStream.php index 2dcf38ea140d21053ddb339cd5c54dd2937b6e72..b5b089fd61a368a2e3e63181a137858f9d556fee 100644 --- a/vendor/twig/twig/src/TokenStream.php +++ b/vendor/twig/twig/src/TokenStream.php @@ -1,11 +1,200 @@ <?php +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * (c) Armin Ronacher + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Twig; -class_exists('Twig_TokenStream'); +use Twig\Error\SyntaxError; + +/** + * Represents a token stream. + * + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class TokenStream +{ + protected $tokens; + protected $current = 0; + protected $filename; + + private $source; + + /** + * @param array $tokens An array of tokens + * @param string|null $name The name of the template which tokens are associated with + * @param string|null $source The source code associated with the tokens + */ + public function __construct(array $tokens, $name = null, $source = null) + { + if (!$name instanceof Source) { + if (null !== $name || null !== $source) { + @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a \Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); + } + $this->source = new Source($source, $name); + } else { + $this->source = $name; + } + + $this->tokens = $tokens; + + // deprecated, not used anymore, to be removed in 2.0 + $this->filename = $this->source->getName(); + } + + public function __toString() + { + return implode("\n", $this->tokens); + } + + public function injectTokens(array $tokens) + { + $this->tokens = array_merge(\array_slice($this->tokens, 0, $this->current), $tokens, \array_slice($this->tokens, $this->current)); + } + + /** + * Sets the pointer to the next token and returns the old one. + * + * @return Token + */ + public function next() + { + if (!isset($this->tokens[++$this->current])) { + throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source); + } + + return $this->tokens[$this->current - 1]; + } -if (\false) { - class TokenStream extends \Twig_TokenStream + /** + * Tests a token, sets the pointer to the next one and returns it or throws a syntax error. + * + * @return Token|null The next token if the condition is true, null otherwise + */ + public function nextIf($primary, $secondary = null) { + if ($this->tokens[$this->current]->test($primary, $secondary)) { + return $this->next(); + } + } + + /** + * Tests a token and returns it or throws a syntax error. + * + * @return Token + */ + public function expect($type, $value = null, $message = null) + { + $token = $this->tokens[$this->current]; + if (!$token->test($type, $value)) { + $line = $token->getLine(); + throw new SyntaxError(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).', + $message ? $message.'. ' : '', + Token::typeToEnglish($token->getType()), $token->getValue(), + Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''), + $line, + $this->source + ); + } + $this->next(); + + return $token; + } + + /** + * Looks at the next token. + * + * @param int $number + * + * @return Token + */ + public function look($number = 1) + { + if (!isset($this->tokens[$this->current + $number])) { + throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source); + } + + return $this->tokens[$this->current + $number]; + } + + /** + * Tests the current token. + * + * @return bool + */ + public function test($primary, $secondary = null) + { + return $this->tokens[$this->current]->test($primary, $secondary); + } + + /** + * Checks if end of stream was reached. + * + * @return bool + */ + public function isEOF() + { + return Token::EOF_TYPE === $this->tokens[$this->current]->getType(); + } + + /** + * @return Token + */ + public function getCurrent() + { + return $this->tokens[$this->current]; + } + + /** + * Gets the name associated with this stream (null if not defined). + * + * @return string|null + * + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function getFilename() + { + @trigger_error(sprintf('The %s() method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); + + return $this->source->getName(); + } + + /** + * Gets the source code associated with this stream. + * + * @return string + * + * @internal Don't use this as it might be empty depending on the environment configuration + * + * @deprecated since 1.27 (to be removed in 2.0) + */ + public function getSource() + { + @trigger_error(sprintf('The %s() method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', __METHOD__), E_USER_DEPRECATED); + + return $this->source->getCode(); + } + + /** + * Gets the source associated with this stream. + * + * @return Source + * + * @internal + */ + public function getSourceContext() + { + return $this->source; } } + +class_alias('Twig\TokenStream', 'Twig_TokenStream'); diff --git a/vendor/twig/twig/src/TwigFilter.php b/vendor/twig/twig/src/TwigFilter.php index 8207048f0286f271a9772339e85d8fe85def613f..089a6d1b8895e8daf80b7eed12152778c8577473 100644 --- a/vendor/twig/twig/src/TwigFilter.php +++ b/vendor/twig/twig/src/TwigFilter.php @@ -1,11 +1,128 @@ <?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; -class_exists('Twig_SimpleFilter'); +use Twig\Node\Node; + +/** + * Represents a template filter. + * + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class TwigFilter +{ + protected $name; + protected $callable; + protected $options; + protected $arguments = []; + + public function __construct($name, $callable, array $options = []) + { + $this->name = $name; + $this->callable = $callable; + $this->options = array_merge([ + 'needs_environment' => false, + 'needs_context' => false, + 'is_variadic' => false, + 'is_safe' => null, + 'is_safe_callback' => null, + 'pre_escape' => null, + 'preserves_safety' => null, + 'node_class' => '\Twig\Node\Expression\FilterExpression', + 'deprecated' => false, + 'alternative' => null, + ], $options); + } + + public function getName() + { + return $this->name; + } + + public function getCallable() + { + return $this->callable; + } + + public function getNodeClass() + { + return $this->options['node_class']; + } + + public function setArguments($arguments) + { + $this->arguments = $arguments; + } + + public function getArguments() + { + return $this->arguments; + } + + public function needsEnvironment() + { + return $this->options['needs_environment']; + } -if (\false) { - class TwigFilter extends \Twig_SimpleFilter + public function needsContext() { + return $this->options['needs_context']; + } + + public function getSafe(Node $filterArgs) + { + if (null !== $this->options['is_safe']) { + return $this->options['is_safe']; + } + + if (null !== $this->options['is_safe_callback']) { + return \call_user_func($this->options['is_safe_callback'], $filterArgs); + } + } + + public function getPreservesSafety() + { + return $this->options['preserves_safety']; + } + + public function getPreEscape() + { + return $this->options['pre_escape']; + } + + public function isVariadic() + { + return $this->options['is_variadic']; + } + + public function isDeprecated() + { + return (bool) $this->options['deprecated']; + } + + public function getDeprecatedVersion() + { + return $this->options['deprecated']; + } + + public function getAlternative() + { + return $this->options['alternative']; } } + +class_alias('Twig\TwigFilter', 'Twig_SimpleFilter'); + +// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. +class_exists('Twig\Node\Node'); diff --git a/vendor/twig/twig/src/TwigFunction.php b/vendor/twig/twig/src/TwigFunction.php index d8b8605f1a873f352bcf7affa58644ed9c4dd4aa..374f07071e6738b6cf01e3313deab6865f23bdb3 100644 --- a/vendor/twig/twig/src/TwigFunction.php +++ b/vendor/twig/twig/src/TwigFunction.php @@ -1,11 +1,118 @@ <?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; -class_exists('Twig_SimpleFunction'); +use Twig\Node\Node; + +/** + * Represents a template function. + * + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class TwigFunction +{ + protected $name; + protected $callable; + protected $options; + protected $arguments = []; + + public function __construct($name, $callable, array $options = []) + { + $this->name = $name; + $this->callable = $callable; + $this->options = array_merge([ + 'needs_environment' => false, + 'needs_context' => false, + 'is_variadic' => false, + 'is_safe' => null, + 'is_safe_callback' => null, + 'node_class' => '\Twig\Node\Expression\FunctionExpression', + 'deprecated' => false, + 'alternative' => null, + ], $options); + } + + public function getName() + { + return $this->name; + } + + public function getCallable() + { + return $this->callable; + } + + public function getNodeClass() + { + return $this->options['node_class']; + } + + public function setArguments($arguments) + { + $this->arguments = $arguments; + } + + public function getArguments() + { + return $this->arguments; + } + + public function needsEnvironment() + { + return $this->options['needs_environment']; + } -if (\false) { - class TwigFunction extends \Twig_SimpleFunction + public function needsContext() { + return $this->options['needs_context']; + } + + public function getSafe(Node $functionArgs) + { + if (null !== $this->options['is_safe']) { + return $this->options['is_safe']; + } + + if (null !== $this->options['is_safe_callback']) { + return \call_user_func($this->options['is_safe_callback'], $functionArgs); + } + + return []; + } + + public function isVariadic() + { + return $this->options['is_variadic']; + } + + public function isDeprecated() + { + return (bool) $this->options['deprecated']; + } + + public function getDeprecatedVersion() + { + return $this->options['deprecated']; + } + + public function getAlternative() + { + return $this->options['alternative']; } } + +class_alias('Twig\TwigFunction', 'Twig_SimpleFunction'); + +// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. +class_exists('Twig\Node\Node'); diff --git a/vendor/twig/twig/src/TwigTest.php b/vendor/twig/twig/src/TwigTest.php index 11248827e7b1e066beb0924028d86d8692d6db78..5054965fe9ae66fbc9fd73fdebc523d7451043db 100644 --- a/vendor/twig/twig/src/TwigTest.php +++ b/vendor/twig/twig/src/TwigTest.php @@ -1,11 +1,87 @@ <?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; -class_exists('Twig_SimpleTest'); +/** + * Represents a template test. + * + * @final + * + * @author Fabien Potencier <fabien@symfony.com> + */ +class TwigTest +{ + protected $name; + protected $callable; + protected $options; + + private $arguments = []; + + public function __construct($name, $callable, array $options = []) + { + $this->name = $name; + $this->callable = $callable; + $this->options = array_merge([ + 'is_variadic' => false, + 'node_class' => '\Twig\Node\Expression\TestExpression', + 'deprecated' => false, + 'alternative' => null, + ], $options); + } + + public function getName() + { + return $this->name; + } + + public function getCallable() + { + return $this->callable; + } + + public function getNodeClass() + { + return $this->options['node_class']; + } + + public function isVariadic() + { + return $this->options['is_variadic']; + } + + public function isDeprecated() + { + return (bool) $this->options['deprecated']; + } + + public function getDeprecatedVersion() + { + return $this->options['deprecated']; + } -if (\false) { - class TwigTest extends \Twig_SimpleTest + public function getAlternative() { + return $this->options['alternative']; + } + + public function setArguments($arguments) + { + $this->arguments = $arguments; + } + + public function getArguments() + { + return $this->arguments; } } + +class_alias('Twig\TwigTest', 'Twig_SimpleTest'); diff --git a/vendor/twig/twig/src/Util/DeprecationCollector.php b/vendor/twig/twig/src/Util/DeprecationCollector.php index 002713f187644b7f04d88741baf5946b35d9b244..09917e927c1ab735793dedc53b3b46a2081157ee 100644 --- a/vendor/twig/twig/src/Util/DeprecationCollector.php +++ b/vendor/twig/twig/src/Util/DeprecationCollector.php @@ -1,11 +1,92 @@ <?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\Util; -class_exists('Twig_Util_DeprecationCollector'); +use Twig\Environment; +use Twig\Error\SyntaxError; +use Twig\Source; + +/** + * @author Fabien Potencier <fabien@symfony.com> + * + * @final + */ +class DeprecationCollector +{ + private $twig; + private $deprecations; + + public function __construct(Environment $twig) + { + $this->twig = $twig; + } + + /** + * Returns deprecations for templates contained in a directory. + * + * @param string $dir A directory where templates are stored + * @param string $ext Limit the loaded templates by extension + * + * @return array An array of deprecations + */ + public function collectDir($dir, $ext = '.twig') + { + $iterator = new \RegexIterator( + new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY + ), '{'.preg_quote($ext).'$}' + ); + + return $this->collect(new TemplateDirIterator($iterator)); + } + + /** + * Returns deprecations for passed templates. + * + * @param \Traversable $iterator An iterator of templates (where keys are template names and values the contents of the template) + * + * @return array An array of deprecations + */ + public function collect(\Traversable $iterator) + { + $this->deprecations = []; + + set_error_handler([$this, 'errorHandler']); + + foreach ($iterator as $name => $contents) { + try { + $this->twig->parse($this->twig->tokenize(new Source($contents, $name))); + } catch (SyntaxError $e) { + // ignore templates containing syntax errors + } + } + + restore_error_handler(); -if (\false) { - class DeprecationCollector extends \Twig_Util_DeprecationCollector + $deprecations = $this->deprecations; + $this->deprecations = []; + + return $deprecations; + } + + /** + * @internal + */ + public function errorHandler($type, $msg) { + if (E_USER_DEPRECATED === $type) { + $this->deprecations[] = $msg; + } } } + +class_alias('Twig\Util\DeprecationCollector', 'Twig_Util_DeprecationCollector'); diff --git a/vendor/twig/twig/src/Util/TemplateDirIterator.php b/vendor/twig/twig/src/Util/TemplateDirIterator.php index 0e1352cc496809b2cf5261de3d2ea49d3d3a45a0..1ab0dac59d59359f2856757b70a6047e25c6704b 100644 --- a/vendor/twig/twig/src/Util/TemplateDirIterator.php +++ b/vendor/twig/twig/src/Util/TemplateDirIterator.php @@ -1,11 +1,30 @@ <?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\Util; -class_exists('Twig_Util_TemplateDirIterator'); +/** + * @author Fabien Potencier <fabien@symfony.com> + */ +class TemplateDirIterator extends \IteratorIterator +{ + public function current() + { + return file_get_contents(parent::current()); + } -if (\false) { - class TemplateDirIterator extends \Twig_Util_TemplateDirIterator + public function key() { + return (string) parent::key(); } } + +class_alias('Twig\Util\TemplateDirIterator', 'Twig_Util_TemplateDirIterator'); diff --git a/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php b/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php index e9e600c1f23263b67ec65d7cb436c7c63519e0f3..8ea464d6325587522ddff2e059d4fc3c3c32a073 100644 --- a/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -require_once dirname(dirname(__FILE__)).'/FilesystemHelper.php'; +use Twig\Cache\FilesystemCache; + +require_once \dirname(__DIR__).'/FilesystemHelper.php'; class Twig_Tests_Cache_FilesystemTest extends \PHPUnit\Framework\TestCase { @@ -22,7 +24,7 @@ protected function setUp() $nonce = hash('sha256', uniqid(mt_rand(), true)); $this->classname = '__Twig_Tests_Cache_FilesystemTest_Template_'.$nonce; $this->directory = sys_get_temp_dir().'/twig-test'; - $this->cache = new Twig_Cache_Filesystem($this->directory); + $this->cache = new FilesystemCache($this->directory); } protected function tearDown() @@ -36,7 +38,7 @@ public function testLoad() { $key = $this->directory.'/cache/cachefile.php'; - $dir = dirname($key); + $dir = \dirname($key); @mkdir($dir, 0777, true); $this->assertTrue(is_dir($dir)); $this->assertFalse(class_exists($this->classname, false)); @@ -76,12 +78,12 @@ public function testWrite() } /** - * @expectedException RuntimeException + * @expectedException \RuntimeException * @expectedExceptionMessage Unable to create the cache directory */ public function testWriteFailMkdir() { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { + if (\defined('PHP_WINDOWS_VERSION_BUILD')) { $this->markTestSkipped('Read-only directories not possible on Windows.'); } @@ -98,12 +100,12 @@ public function testWriteFailMkdir() } /** - * @expectedException RuntimeException + * @expectedException \RuntimeException * @expectedExceptionMessage Unable to write in the cache directory */ public function testWriteFailDirWritable() { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { + if (\defined('PHP_WINDOWS_VERSION_BUILD')) { $this->markTestSkipped('Read-only directories not possible on Windows.'); } @@ -122,7 +124,7 @@ public function testWriteFailDirWritable() } /** - * @expectedException RuntimeException + * @expectedException \RuntimeException * @expectedExceptionMessage Failed to write cache file */ public function testWriteFailWriteFile() @@ -143,7 +145,7 @@ public function testGetTimestamp() { $key = $this->directory.'/cache/cachefile.php'; - $dir = dirname($key); + $dir = \dirname($key); @mkdir($dir, 0777, true); $this->assertTrue(is_dir($dir)); @@ -166,28 +168,28 @@ public function testGetTimestampMissingFile() */ public function testGenerateKey($expected, $input) { - $cache = new Twig_Cache_Filesystem($input); - $this->assertRegExp($expected, $cache->generateKey('_test_', get_class($this))); + $cache = new FilesystemCache($input); + $this->assertRegExp($expected, $cache->generateKey('_test_', \get_class($this))); } public function provideDirectories() { $pattern = '#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#'; - return array( - array($pattern, 'a/b'), - array($pattern, 'a/b/'), - array($pattern, 'a/b\\'), - array($pattern, 'a/b\\/'), - array($pattern, 'a/b\\//'), - array('#/'.substr($pattern, 1), '/a/b'), - ); + return [ + [$pattern, 'a/b'], + [$pattern, 'a/b/'], + [$pattern, 'a/b\\'], + [$pattern, 'a/b\\/'], + [$pattern, 'a/b\\//'], + ['#/'.substr($pattern, 1), '/a/b'], + ]; } private function generateSource() { - return strtr('<?php class {{classname}} {}', array( + return strtr('<?php class {{classname}} {}', [ '{{classname}}' => $this->classname, - )); + ]); } } diff --git a/vendor/twig/twig/test/Twig/Tests/CompilerTest.php b/vendor/twig/twig/test/Twig/Tests/CompilerTest.php index 4d4b8df9e375786d4cae374fbda16c062dc13b11..5191b28cb964defd02de0cf77cfd7c379cf5fb33 100644 --- a/vendor/twig/twig/test/Twig/Tests/CompilerTest.php +++ b/vendor/twig/twig/test/Twig/Tests/CompilerTest.php @@ -9,18 +9,21 @@ * file that was distributed with this source code. */ +use Twig\Compiler; +use Twig\Environment; + class Twig_Tests_CompilerTest extends \PHPUnit\Framework\TestCase { public function testReprNumericValueWithLocale() { - $compiler = new Twig_Compiler(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); + $compiler = new Compiler(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); $locale = setlocale(LC_NUMERIC, 0); if (false === $locale) { $this->markTestSkipped('Your platform does not support locales.'); } - $required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'); + $required_locales = ['fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252']; if (false === setlocale(LC_NUMERIC, $required_locales)) { $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $required_locales)); } diff --git a/vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php b/vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php index c111f9284b39d6b596185de60e134fdd8711f263..1c04ef20170a3ee531e8d6ff2926cc579e9ca3e3 100644 --- a/vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php +++ b/vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +use Twig\RuntimeLoader\ContainerRuntimeLoader; + class Twig_Tests_ContainerRuntimeLoaderTest extends \PHPUnit\Framework\TestCase { /** @@ -18,9 +20,9 @@ public function testLoad() { $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock(); $container->expects($this->once())->method('has')->with('stdClass')->willReturn(true); - $container->expects($this->once())->method('get')->with('stdClass')->willReturn(new stdClass()); + $container->expects($this->once())->method('get')->with('stdClass')->willReturn(new \stdClass()); - $loader = new Twig_ContainerRuntimeLoader($container); + $loader = new ContainerRuntimeLoader($container); $this->assertInstanceOf('stdClass', $loader->load('stdClass')); } @@ -34,7 +36,7 @@ public function testLoadUnknownRuntimeReturnsNull() $container->expects($this->once())->method('has')->with('Foo'); $container->expects($this->never())->method('get'); - $loader = new Twig_ContainerRuntimeLoader($container); + $loader = new ContainerRuntimeLoader($container); $this->assertNull($loader->load('Foo')); } } diff --git a/vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php b/vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php index f9d44fda5e248a0293807c37197a4e94d48c6419..6505313738b9ee0c504d392ce32d00dba46d3d09 100644 --- a/vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php +++ b/vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php @@ -9,13 +9,16 @@ * file that was distributed with this source code. */ +use Twig\Environment; +use Twig\Extension\ExtensionInterface; + class CustomExtensionTest extends \PHPUnit\Framework\TestCase { /** * @requires PHP 5.3 * @dataProvider provideInvalidExtensions */ - public function testGetInvalidOperators(Twig_ExtensionInterface $extension, $expectedExceptionMessage) + public function testGetInvalidOperators(ExtensionInterface $extension, $expectedExceptionMessage) { if (method_exists($this, 'expectException')) { $this->expectException('InvalidArgumentException'); @@ -24,21 +27,21 @@ public function testGetInvalidOperators(Twig_ExtensionInterface $extension, $exp $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage); } - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $env->addExtension($extension); $env->getUnaryOperators(); } public function provideInvalidExtensions() { - return array( - array(new InvalidOperatorExtension(new stdClass()), '"InvalidOperatorExtension::getOperators()" must return an array with operators, got "stdClass".'), - array(new InvalidOperatorExtension(array(1, 2, 3)), '"InvalidOperatorExtension::getOperators()" must return an array of 2 elements, got 3.'), - ); + return [ + [new InvalidOperatorExtension(new \stdClass()), '"InvalidOperatorExtension::getOperators()" must return an array with operators, got "stdClass".'], + [new InvalidOperatorExtension([1, 2, 3]), '"InvalidOperatorExtension::getOperators()" must return an array of 2 elements, got 3.'], + ]; } } -class InvalidOperatorExtension implements Twig_ExtensionInterface +class InvalidOperatorExtension implements ExtensionInterface { private $operators; @@ -47,38 +50,38 @@ public function __construct($operators) $this->operators = $operators; } - public function initRuntime(Twig_Environment $environment) + public function initRuntime(Environment $environment) { } public function getTokenParsers() { - return array(); + return []; } public function getNodeVisitors() { - return array(); + return []; } public function getFilters() { - return array(); + return []; } public function getTests() { - return array(); + return []; } public function getFunctions() { - return array(); + return []; } public function getGlobals() { - return array(); + return []; } public function getOperators() diff --git a/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php b/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php index ca9f2cf8aced58799bfe03dbb0c9070f9e68dcf5..d4163efdf2074b27ab5fef35f529f1ebf4a860f1 100644 --- a/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php +++ b/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php @@ -9,18 +9,34 @@ * file that was distributed with this source code. */ -require_once dirname(__FILE__).'/FilesystemHelper.php'; +use Twig\Cache\FilesystemCache; +use Twig\Environment; +use Twig\Extension\AbstractExtension; +use Twig\Extension\GlobalsInterface; +use Twig\Extension\InitRuntimeInterface; +use Twig\Loader\ArrayLoader; +use Twig\Loader\LoaderInterface; +use Twig\Loader\SourceContextLoaderInterface; +use Twig\NodeVisitor\NodeVisitorInterface; +use Twig\Source; +use Twig\Token; +use Twig\TokenParser\AbstractTokenParser; +use Twig\TwigFilter; +use Twig\TwigFunction; +use Twig\TwigTest; + +require_once __DIR__.'/FilesystemHelper.php'; class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase { - private $deprecations = array(); + private $deprecations = []; /** * @group legacy */ public function testLegacyTokenizeSignature() { - $env = new Twig_Environment(); + $env = new Environment(); $stream = $env->tokenize('{{ foo }}', 'foo'); $this->assertEquals('{{ foo }}', $stream->getSource()); $this->assertEquals('foo', $stream->getFilename()); @@ -31,37 +47,37 @@ public function testLegacyTokenizeSignature() */ public function testLegacyCompileSourceSignature() { - $loader = new Twig_Loader_Array(array('foo' => '{{ foo }}')); - $env = new Twig_Environment($loader); + $loader = new ArrayLoader(['foo' => '{{ foo }}']); + $env = new Environment($loader); $this->assertContains('getTemplateName', $env->compileSource('{{ foo }}', 'foo')); } /** - * @expectedException LogicException + * @expectedException \LogicException * @expectedExceptionMessage You must set a loader first. * @group legacy */ public function testRenderNoLoader() { - $env = new Twig_Environment(); + $env = new Environment(); $env->render('test'); } public function testAutoescapeOption() { - $loader = new Twig_Loader_Array(array( + $loader = new ArrayLoader([ 'html' => '{{ foo }} {{ foo }}', 'js' => '{{ bar }} {{ bar }}', - )); + ]); - $twig = new Twig_Environment($loader, array( + $twig = new Environment($loader, [ 'debug' => true, 'cache' => false, - 'autoescape' => array($this, 'escapingStrategyCallback'), - )); + 'autoescape' => [$this, 'escapingStrategyCallback'], + ]); - $this->assertEquals('foo<br/ > foo<br/ >', $twig->render('html', array('foo' => 'foo<br/ >'))); - $this->assertEquals('foo\x3Cbr\x2F\x20\x3E foo\x3Cbr\x2F\x20\x3E', $twig->render('js', array('bar' => 'foo<br/ >'))); + $this->assertEquals('foo<br/ > foo<br/ >', $twig->render('html', ['foo' => 'foo<br/ >'])); + $this->assertEquals('foo\u003Cbr\/\u0020\u003E foo\u003Cbr\/\u0020\u003E', $twig->render('js', ['bar' => 'foo<br/ >'])); } public function escapingStrategyCallback($name) @@ -73,12 +89,12 @@ public function testGlobals() { // to be removed in 2.0 $loader = $this->getMockBuilder('Twig_EnvironmentTestLoaderInterface')->getMock(); - //$loader = $this->getMockBuilder(array('Twig_LoaderInterface', 'Twig_SourceContextLoaderInterface'))->getMock(); - $loader->expects($this->any())->method('getSourceContext')->will($this->returnValue(new Twig_Source('', ''))); + //$loader = $this->getMockBuilder(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface'])->getMock(); + $loader->expects($this->any())->method('getSourceContext')->will($this->returnValue(new Source('', ''))); // globals can be added after calling getGlobals - $twig = new Twig_Environment($loader); + $twig = new Environment($loader); $twig->addGlobal('foo', 'foo'); $twig->getGlobals(); $twig->addGlobal('foo', 'bar'); @@ -86,7 +102,7 @@ public function testGlobals() $this->assertEquals('bar', $globals['foo']); // globals can be modified after a template has been loaded - $twig = new Twig_Environment($loader); + $twig = new Environment($loader); $twig->addGlobal('foo', 'foo'); $twig->getGlobals(); $twig->loadTemplate('index'); @@ -95,7 +111,7 @@ public function testGlobals() $this->assertEquals('bar', $globals['foo']); // globals can be modified after extensions init - $twig = new Twig_Environment($loader); + $twig = new Environment($loader); $twig->addGlobal('foo', 'foo'); $twig->getGlobals(); $twig->getFunctions(); @@ -104,8 +120,8 @@ public function testGlobals() $this->assertEquals('bar', $globals['foo']); // globals can be modified after extensions and a template has been loaded - $arrayLoader = new Twig_Loader_Array(array('index' => '{{foo}}')); - $twig = new Twig_Environment($arrayLoader); + $arrayLoader = new ArrayLoader(['index' => '{{foo}}']); + $twig = new Environment($arrayLoader); $twig->addGlobal('foo', 'foo'); $twig->getGlobals(); $twig->getFunctions(); @@ -114,39 +130,39 @@ public function testGlobals() $globals = $twig->getGlobals(); $this->assertEquals('bar', $globals['foo']); - $twig = new Twig_Environment($arrayLoader); + $twig = new Environment($arrayLoader); $twig->getGlobals(); $twig->addGlobal('foo', 'bar'); $template = $twig->loadTemplate('index'); - $this->assertEquals('bar', $template->render(array())); + $this->assertEquals('bar', $template->render([])); /* to be uncomment in Twig 2.0 // globals cannot be added after a template has been loaded - $twig = new Twig_Environment($loader); + $twig = new Environment($loader); $twig->addGlobal('foo', 'foo'); $twig->getGlobals(); $twig->loadTemplate('index'); try { $twig->addGlobal('bar', 'bar'); $this->fail(); - } catch (LogicException $e) { + } catch (\LogicException $e) { $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); } // globals cannot be added after extensions init - $twig = new Twig_Environment($loader); + $twig = new Environment($loader); $twig->addGlobal('foo', 'foo'); $twig->getGlobals(); $twig->getFunctions(); try { $twig->addGlobal('bar', 'bar'); $this->fail(); - } catch (LogicException $e) { + } catch (\LogicException $e) { $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); } // globals cannot be added after extensions and a template has been loaded - $twig = new Twig_Environment($loader); + $twig = new Environment($loader); $twig->addGlobal('foo', 'foo'); $twig->getGlobals(); $twig->getFunctions(); @@ -154,17 +170,17 @@ public function testGlobals() try { $twig->addGlobal('bar', 'bar'); $this->fail(); - } catch (LogicException $e) { + } catch (\LogicException $e) { $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); } // test adding globals after a template has been loaded without call to getGlobals - $twig = new Twig_Environment($loader); + $twig = new Environment($loader); $twig->loadTemplate('index'); try { $twig->addGlobal('bar', 'bar'); $this->fail(); - } catch (LogicException $e) { + } catch (\LogicException $e) { $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); } */ @@ -172,27 +188,27 @@ public function testGlobals() public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate() { - $cache = new Twig_Cache_Filesystem($dir = sys_get_temp_dir().'/twig'); - $options = array('cache' => $cache, 'auto_reload' => false, 'debug' => false); + $cache = new FilesystemCache($dir = sys_get_temp_dir().'/twig'); + $options = ['cache' => $cache, 'auto_reload' => false, 'debug' => false]; // force compilation - $twig = new Twig_Environment($loader = new Twig_Loader_Array(array('index' => '{{ foo }}')), $options); + $twig = new Environment($loader = new ArrayLoader(['index' => '{{ foo }}']), $options); $key = $cache->generateKey('index', $twig->getTemplateClass('index')); - $cache->write($key, $twig->compileSource(new Twig_Source('{{ foo }}', 'index'))); + $cache->write($key, $twig->compileSource(new Source('{{ foo }}', 'index'))); // check that extensions won't be initialized when rendering a template that is already in the cache $twig = $this - ->getMockBuilder('Twig_Environment') - ->setConstructorArgs(array($loader, $options)) - ->setMethods(array('initExtensions')) + ->getMockBuilder('\Twig\Environment') + ->setConstructorArgs([$loader, $options]) + ->setMethods(['initExtensions']) ->getMock() ; $twig->expects($this->never())->method('initExtensions'); // render template - $output = $twig->render('index', array('foo' => 'bar')); + $output = $twig->render('index', ['foo' => 'bar']); $this->assertEquals('bar', $output); Twig_Tests_FilesystemHelper::removeDir($dir); @@ -203,9 +219,9 @@ public function testAutoReloadCacheMiss() $templateName = __FUNCTION__; $templateContent = __FUNCTION__; - $cache = $this->getMockBuilder('Twig_CacheInterface')->getMock(); + $cache = $this->getMockBuilder('\Twig\Cache\CacheInterface')->getMock(); $loader = $this->getMockLoader($templateName, $templateContent); - $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); + $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]); // Cache miss: getTimestamp returns 0 and as a result the load() is // skipped. @@ -230,9 +246,9 @@ public function testAutoReloadCacheHit() $templateName = __FUNCTION__; $templateContent = __FUNCTION__; - $cache = $this->getMockBuilder('Twig_CacheInterface')->getMock(); + $cache = $this->getMockBuilder('\Twig\Cache\CacheInterface')->getMock(); $loader = $this->getMockLoader($templateName, $templateContent); - $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); + $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]); $now = time(); @@ -258,9 +274,9 @@ public function testAutoReloadOutdatedCacheHit() $templateName = __FUNCTION__; $templateContent = __FUNCTION__; - $cache = $this->getMockBuilder('Twig_CacheInterface')->getMock(); + $cache = $this->getMockBuilder('\Twig\Cache\CacheInterface')->getMock(); $loader = $this->getMockLoader($templateName, $templateContent); - $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); + $twig = new Environment($loader, ['cache' => $cache, 'auto_reload' => true, 'debug' => false]); $now = time(); @@ -286,7 +302,7 @@ public function testAutoReloadOutdatedCacheHit() */ public function testHasGetExtensionWithDynamicName() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $ext1 = new Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName('ext1'); $ext2 = new Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName('ext2'); @@ -304,7 +320,7 @@ public function testHasGetExtensionWithDynamicName() public function testHasGetExtensionByClassName() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $twig->addExtension($ext = new Twig_Tests_EnvironmentTest_Extension()); $this->assertTrue($twig->hasExtension('Twig_Tests_EnvironmentTest_Extension')); $this->assertTrue($twig->hasExtension('\Twig_Tests_EnvironmentTest_Extension')); @@ -318,7 +334,7 @@ public function testHasGetExtensionByClassName() public function testAddExtension() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); $this->assertArrayHasKey('test', $twig->getTags()); @@ -343,11 +359,11 @@ public function testAddExtension() */ public function testAddExtensionWithDeprecatedGetGlobals() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithGlobals()); - $this->deprecations = array(); - set_error_handler(array($this, 'handleError')); + $this->deprecations = []; + set_error_handler([$this, 'handleError']); $this->assertArrayHasKey('foo_global', $twig->getGlobals()); @@ -362,7 +378,7 @@ public function testAddExtensionWithDeprecatedGetGlobals() */ public function testRemoveExtension() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName()); $twig->removeExtension('environment_test'); @@ -379,27 +395,29 @@ public function testRemoveExtension() public function testAddMockExtension() { // should be replaced by the following in 2.0 (this current code is just to avoid a dep notice) - // $extension = $this->getMockBuilder('Twig_Extension')->getMock(); + // $extension = $this->getMockBuilder('\Twig\Extension\AbstractExtension')->getMock(); $extension = eval(<<<EOF -class Twig_Tests_EnvironmentTest_ExtensionInEval extends Twig_Extension +use Twig\Extension\AbstractExtension; + +class Twig_Tests_EnvironmentTest_ExtensionInEval extends AbstractExtension { } EOF ); $extension = new Twig_Tests_EnvironmentTest_ExtensionInEval(); - $loader = new Twig_Loader_Array(array('page' => 'hey')); + $loader = new ArrayLoader(['page' => 'hey']); - $twig = new Twig_Environment($loader); + $twig = new Environment($loader); $twig->addExtension($extension); - $this->assertInstanceOf('Twig_ExtensionInterface', $twig->getExtension(get_class($extension))); + $this->assertInstanceOf('\Twig\Extension\ExtensionInterface', $twig->getExtension(\get_class($extension))); $this->assertTrue($twig->isTemplateFresh('page', time())); } public function testInitRuntimeWithAnExtensionUsingInitRuntimeNoDeprecation() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime()); $twig->initRuntime(); @@ -413,11 +431,11 @@ public function testInitRuntimeWithAnExtensionUsingInitRuntimeNoDeprecation() */ public function testInitRuntimeWithAnExtensionUsingInitRuntimeDeprecation() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime()); - $this->deprecations = array(); - set_error_handler(array($this, 'handleError')); + $this->deprecations = []; + set_error_handler([$this, 'handleError']); $twig->initRuntime(); @@ -439,11 +457,11 @@ public function handleError($type, $msg) */ public function testOverrideExtension() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime()); - $this->deprecations = array(); - set_error_handler(array($this, 'handleError')); + $this->deprecations = []; + set_error_handler([$this, 'handleError']); $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName()); $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName()); @@ -456,19 +474,19 @@ public function testOverrideExtension() public function testAddRuntimeLoader() { - $runtimeLoader = $this->getMockBuilder('Twig_RuntimeLoaderInterface')->getMock(); + $runtimeLoader = $this->getMockBuilder('\Twig\RuntimeLoader\RuntimeLoaderInterface')->getMock(); $runtimeLoader->expects($this->any())->method('load')->will($this->returnValue(new Twig_Tests_EnvironmentTest_Runtime())); - $loader = new Twig_Loader_Array(array( + $loader = new ArrayLoader([ 'func_array' => '{{ from_runtime_array("foo") }}', 'func_array_default' => '{{ from_runtime_array() }}', 'func_array_named_args' => '{{ from_runtime_array(name="foo") }}', 'func_string' => '{{ from_runtime_string("foo") }}', 'func_string_default' => '{{ from_runtime_string() }}', 'func_string_named_args' => '{{ from_runtime_string(name="foo") }}', - )); + ]); - $twig = new Twig_Environment($loader); + $twig = new Environment($loader); $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutRuntime()); $twig->addRuntimeLoader($runtimeLoader); @@ -481,28 +499,28 @@ public function testAddRuntimeLoader() } /** - * @expectedException Twig_Error_Runtime + * @expectedException \Twig\Error\RuntimeError * @expectedExceptionMessage Circular reference detected for Twig template "base.html.twig", path: base.html.twig -> base.html.twig in "base.html.twig" at line 1 */ public function testFailLoadTemplateOnCircularReference() { - $twig = new Twig_Environment(new Twig_Loader_Array(array( + $twig = new Environment(new ArrayLoader([ 'base.html.twig' => '{% extends "base.html.twig" %}', - ))); + ])); $twig->loadTemplate('base.html.twig'); } /** - * @expectedException Twig_Error_Runtime + * @expectedException \Twig\Error\RuntimeError * @expectedExceptionMessage Circular reference detected for Twig template "base1.html.twig", path: base1.html.twig -> base2.html.twig -> base1.html.twig in "base1.html.twig" at line 1 */ public function testFailLoadTemplateOnComplexCircularReference() { - $twig = new Twig_Environment(new Twig_Loader_Array(array( + $twig = new Environment(new ArrayLoader([ 'base1.html.twig' => '{% extends "base2.html.twig" %}', 'base2.html.twig' => '{% extends "base1.html.twig" %}', - ))); + ])); $twig->loadTemplate('base1.html.twig'); } @@ -511,11 +529,11 @@ protected function getMockLoader($templateName, $templateContent) { // to be removed in 2.0 $loader = $this->getMockBuilder('Twig_EnvironmentTestLoaderInterface')->getMock(); - //$loader = $this->getMockBuilder(array('Twig_LoaderInterface', 'Twig_SourceContextLoaderInterface'))->getMock(); + //$loader = $this->getMockBuilder(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface'])->getMock(); $loader->expects($this->any()) ->method('getSourceContext') ->with($templateName) - ->will($this->returnValue(new Twig_Source($templateContent, $templateName))); + ->will($this->returnValue(new Source($templateContent, $templateName))); $loader->expects($this->any()) ->method('getCacheKey') ->with($templateName) @@ -525,71 +543,71 @@ protected function getMockLoader($templateName, $templateContent) } } -class Twig_Tests_EnvironmentTest_Extension_WithGlobals extends Twig_Extension +class Twig_Tests_EnvironmentTest_Extension_WithGlobals extends AbstractExtension { public function getGlobals() { - return array( + return [ 'foo_global' => 'foo_global', - ); + ]; } } -class Twig_Tests_EnvironmentTest_Extension extends Twig_Extension implements Twig_Extension_GlobalsInterface +class Twig_Tests_EnvironmentTest_Extension extends AbstractExtension implements GlobalsInterface { public function getTokenParsers() { - return array( + return [ new Twig_Tests_EnvironmentTest_TokenParser(), - ); + ]; } public function getNodeVisitors() { - return array( + return [ new Twig_Tests_EnvironmentTest_NodeVisitor(), - ); + ]; } public function getFilters() { - return array( - new Twig_SimpleFilter('foo_filter', 'foo_filter'), - ); + return [ + new TwigFilter('foo_filter', 'foo_filter'), + ]; } public function getTests() { - return array( - new Twig_SimpleTest('foo_test', 'foo_test'), - ); + return [ + new TwigTest('foo_test', 'foo_test'), + ]; } public function getFunctions() { - return array( - new Twig_SimpleFunction('foo_function', 'foo_function'), - ); + return [ + new TwigFunction('foo_function', 'foo_function'), + ]; } public function getOperators() { - return array( - array('foo_unary' => array()), - array('foo_binary' => array()), - ); + return [ + ['foo_unary' => []], + ['foo_binary' => []], + ]; } public function getGlobals() { - return array( + return [ 'foo_global' => 'foo_global', - ); + ]; } } class_alias('Twig_Tests_EnvironmentTest_Extension', 'Twig\Tests\EnvironmentTest\Extension', false); -class Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName extends Twig_Extension +class Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName extends AbstractExtension { public function getName() { @@ -597,7 +615,7 @@ public function getName() } } -class Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName extends Twig_Extension +class Twig_Tests_EnvironmentTest_Extension_DynamicWithDeprecatedName extends AbstractExtension { private $name; @@ -612,9 +630,9 @@ public function getName() } } -class Twig_Tests_EnvironmentTest_TokenParser extends Twig_TokenParser +class Twig_Tests_EnvironmentTest_TokenParser extends AbstractTokenParser { - public function parse(Twig_Token $token) + public function parse(Token $token) { } @@ -624,14 +642,14 @@ public function getTag() } } -class Twig_Tests_EnvironmentTest_NodeVisitor implements Twig_NodeVisitorInterface +class Twig_Tests_EnvironmentTest_NodeVisitor implements NodeVisitorInterface { - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) + public function enterNode(Twig_NodeInterface $node, Environment $env) { return $node; } - public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) + public function leaveNode(Twig_NodeInterface $node, Environment $env) { return $node; } @@ -642,28 +660,28 @@ public function getPriority() } } -class Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime extends Twig_Extension +class Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime extends AbstractExtension { - public function initRuntime(Twig_Environment $env) + public function initRuntime(Environment $env) { } } -class Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime extends Twig_Extension implements Twig_Extension_InitRuntimeInterface +class Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime extends AbstractExtension implements InitRuntimeInterface { - public function initRuntime(Twig_Environment $env) + public function initRuntime(Environment $env) { } } -class Twig_Tests_EnvironmentTest_ExtensionWithoutRuntime extends Twig_Extension +class Twig_Tests_EnvironmentTest_ExtensionWithoutRuntime extends AbstractExtension { public function getFunctions() { - return array( - new Twig_SimpleFunction('from_runtime_array', array('Twig_Tests_EnvironmentTest_Runtime', 'fromRuntime')), - new Twig_SimpleFunction('from_runtime_string', 'Twig_Tests_EnvironmentTest_Runtime::fromRuntime'), - ); + return [ + new TwigFunction('from_runtime_array', ['Twig_Tests_EnvironmentTest_Runtime', 'fromRuntime']), + new TwigFunction('from_runtime_string', 'Twig_Tests_EnvironmentTest_Runtime::fromRuntime'), + ]; } public function getName() @@ -681,6 +699,6 @@ public function fromRuntime($name = 'bar') } // to be removed in 2.0 -interface Twig_EnvironmentTestLoaderInterface extends Twig_LoaderInterface, Twig_SourceContextLoaderInterface +interface Twig_EnvironmentTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface { } diff --git a/vendor/twig/twig/test/Twig/Tests/ErrorTest.php b/vendor/twig/twig/test/Twig/Tests/ErrorTest.php index 3ec572ab2deaaf7cf4e878401c02e605bc654ef8..52010611a1ed1b20c749cd89ca5e79fc29e4949c 100644 --- a/vendor/twig/twig/test/Twig/Tests/ErrorTest.php +++ b/vendor/twig/twig/test/Twig/Tests/ErrorTest.php @@ -9,27 +9,34 @@ * file that was distributed with this source code. */ +use Twig\Environment; +use Twig\Error\Error; +use Twig\Error\RuntimeError; +use Twig\Loader\ArrayLoader; +use Twig\Loader\FilesystemLoader; +use Twig\Source; + class Twig_Tests_ErrorTest extends \PHPUnit\Framework\TestCase { public function testErrorWithObjectFilename() { - $error = new Twig_Error('foo'); - $error->setSourceContext(new Twig_Source('', new SplFileInfo(__FILE__))); + $error = new Error('foo'); + $error->setSourceContext(new Source('', new \SplFileInfo(__FILE__))); $this->assertContains('test'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Tests'.DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage()); } public function testErrorWithArrayFilename() { - $error = new Twig_Error('foo'); - $error->setSourceContext(new Twig_Source('', array('foo' => 'bar'))); + $error = new Error('foo'); + $error->setSourceContext(new Source('', ['foo' => 'bar'])); $this->assertEquals('foo in {"foo":"bar"}', $error->getMessage()); } public function testTwigExceptionGuessWithMissingVarAndArrayLoader() { - $loader = new Twig_Loader_Array(array( + $loader = new ArrayLoader([ 'base.html' => '{% block content %}{% endblock %}', 'index.html' => <<<EOHTML {% extends 'base.html' %} @@ -40,15 +47,15 @@ public function testTwigExceptionGuessWithMissingVarAndArrayLoader() {{ foo.bar }} {% endblock %} EOHTML - )); - $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + ]); + $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]); - $template = $twig->loadTemplate('index.html'); + $template = $twig->load('index.html'); try { - $template->render(array()); + $template->render([]); $this->fail(); - } catch (Twig_Error_Runtime $e) { + } catch (RuntimeError $e) { $this->assertEquals('Variable "foo" does not exist in "index.html" at line 3.', $e->getMessage()); $this->assertEquals(3, $e->getTemplateLine()); $this->assertEquals('index.html', $e->getSourceContext()->getName()); @@ -57,7 +64,7 @@ public function testTwigExceptionGuessWithMissingVarAndArrayLoader() public function testTwigExceptionGuessWithExceptionAndArrayLoader() { - $loader = new Twig_Loader_Array(array( + $loader = new ArrayLoader([ 'base.html' => '{% block content %}{% endblock %}', 'index.html' => <<<EOHTML {% extends 'base.html' %} @@ -68,15 +75,15 @@ public function testTwigExceptionGuessWithExceptionAndArrayLoader() {{ foo.bar }} {% endblock %} EOHTML - )); - $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + ]); + $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]); - $template = $twig->loadTemplate('index.html'); + $template = $twig->load('index.html'); try { - $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); + $template->render(['foo' => new Twig_Tests_ErrorTest_Foo()]); $this->fail(); - } catch (Twig_Error_Runtime $e) { + } catch (RuntimeError $e) { $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index.html" at line 3.', $e->getMessage()); $this->assertEquals(3, $e->getTemplateLine()); $this->assertEquals('index.html', $e->getSourceContext()->getName()); @@ -85,39 +92,39 @@ public function testTwigExceptionGuessWithExceptionAndArrayLoader() public function testTwigExceptionGuessWithMissingVarAndFilesystemLoader() { - $loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors'); - $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + $loader = new FilesystemLoader(__DIR__.'/Fixtures/errors'); + $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]); - $template = $twig->loadTemplate('index.html'); + $template = $twig->load('index.html'); try { - $template->render(array()); + $template->render([]); $this->fail(); - } catch (Twig_Error_Runtime $e) { + } catch (RuntimeError $e) { $this->assertEquals('Variable "foo" does not exist.', $e->getMessage()); $this->assertEquals(3, $e->getTemplateLine()); $this->assertEquals('index.html', $e->getSourceContext()->getName()); $this->assertEquals(3, $e->getLine()); - $this->assertEquals(strtr(dirname(__FILE__).'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); + $this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); } } public function testTwigExceptionGuessWithExceptionAndFilesystemLoader() { - $loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors'); - $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + $loader = new FilesystemLoader(__DIR__.'/Fixtures/errors'); + $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]); - $template = $twig->loadTemplate('index.html'); + $template = $twig->load('index.html'); try { - $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); + $template->render(['foo' => new Twig_Tests_ErrorTest_Foo()]); $this->fail(); - } catch (Twig_Error_Runtime $e) { + } catch (RuntimeError $e) { $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...").', $e->getMessage()); $this->assertEquals(3, $e->getTemplateLine()); $this->assertEquals('index.html', $e->getSourceContext()->getName()); $this->assertEquals(3, $e->getLine()); - $this->assertEquals(strtr(dirname(__FILE__).'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); + $this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); } } @@ -126,26 +133,26 @@ public function testTwigExceptionGuessWithExceptionAndFilesystemLoader() */ public function testTwigExceptionAddsFileAndLine($templates, $name, $line) { - $loader = new Twig_Loader_Array($templates); - $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + $loader = new ArrayLoader($templates); + $twig = new Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]); - $template = $twig->loadTemplate('index'); + $template = $twig->load('index'); try { - $template->render(array()); + $template->render([]); $this->fail(); - } catch (Twig_Error_Runtime $e) { + } catch (RuntimeError $e) { $this->assertEquals(sprintf('Variable "foo" does not exist in "%s" at line %d.', $name, $line), $e->getMessage()); $this->assertEquals($line, $e->getTemplateLine()); $this->assertEquals($name, $e->getSourceContext()->getName()); } try { - $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); + $template->render(['foo' => new Twig_Tests_ErrorTest_Foo()]); $this->fail(); - } catch (Twig_Error_Runtime $e) { + } catch (RuntimeError $e) { $this->assertEquals(sprintf('An exception has been thrown during the rendering of a template ("Runtime error...") in "%s" at line %d.', $name, $line), $e->getMessage()); $this->assertEquals($line, $e->getTemplateLine()); $this->assertEquals($name, $e->getSourceContext()->getName()); @@ -154,39 +161,39 @@ public function testTwigExceptionAddsFileAndLine($templates, $name, $line) public function getErroredTemplates() { - return array( + return [ // error occurs in a template - array( - array( + [ + [ 'index' => "\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}", - ), + ], 'index', 3, - ), + ], // error occurs in an included template - array( - array( + [ + [ 'index' => "{% include 'partial' %}", 'partial' => '{{ foo.bar }}', - ), + ], 'partial', 1, - ), + ], // error occurs in a parent block when called via parent() - array( - array( + [ + [ 'index' => "{% extends 'base' %} {% block content %} {{ parent() }} {% endblock %}", 'base' => '{% block content %}{{ foo.bar }}{% endblock %}', - ), + ], 'base', 1, - ), + ], // error occurs in a block from the child - array( - array( + [ + [ 'index' => "{% extends 'base' %} {% block content %} {{ foo.bar }} @@ -195,10 +202,10 @@ public function getErroredTemplates() {{ foo.bar }} {% endblock %}", 'base' => '{% block content %}{% endblock %}', - ), + ], 'index', 3, - ), - ); + ], + ]; } } @@ -206,6 +213,6 @@ class Twig_Tests_ErrorTest_Foo { public function bar() { - throw new Exception('Runtime error...'); + throw new \Exception('Runtime error...'); } } diff --git a/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php b/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php index 3a173f035f7c4f28d09131749a343f1774e6254b..1696938071ae4e8e3137e00e66931e039bbd3c15 100644 --- a/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php +++ b/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php @@ -9,36 +9,44 @@ * file that was distributed with this source code. */ +use Twig\Environment; +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Expression\Binary\ConcatBinary; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Parser; +use Twig\Source; + class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase { /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @dataProvider getFailingTestsForAssignment */ public function testCanOnlyAssignToNames($template) { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source($template, 'index'))); + $parser->parse($env->tokenize(new Source($template, 'index'))); } public function getFailingTestsForAssignment() { - return array( - array('{% set false = "foo" %}'), - array('{% set FALSE = "foo" %}'), - array('{% set true = "foo" %}'), - array('{% set TRUE = "foo" %}'), - array('{% set none = "foo" %}'), - array('{% set NONE = "foo" %}'), - array('{% set null = "foo" %}'), - array('{% set NULL = "foo" %}'), - array('{% set 3 = "foo" %}'), - array('{% set 1 + 2 = "foo" %}'), - array('{% set "bar" = "foo" %}'), - array('{% set %}{% endset %}'), - ); + return [ + ['{% set false = "foo" %}'], + ['{% set FALSE = "foo" %}'], + ['{% set true = "foo" %}'], + ['{% set TRUE = "foo" %}'], + ['{% set none = "foo" %}'], + ['{% set NONE = "foo" %}'], + ['{% set null = "foo" %}'], + ['{% set NULL = "foo" %}'], + ['{% set 3 = "foo" %}'], + ['{% set 1 + 2 = "foo" %}'], + ['{% set "bar" = "foo" %}'], + ['{% set %}{% endset %}'], + ]; } /** @@ -46,117 +54,117 @@ public function getFailingTestsForAssignment() */ public function testArrayExpression($template, $expected) { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $stream = $env->tokenize(new Twig_Source($template, '')); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $stream = $env->tokenize(new Source($template, '')); + $parser = new Parser($env); $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @dataProvider getFailingTestsForArray */ public function testArraySyntaxError($template) { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source($template, 'index'))); + $parser->parse($env->tokenize(new Source($template, 'index'))); } public function getFailingTestsForArray() { - return array( - array('{{ [1, "a": "b"] }}'), - array('{{ {"a": "b", 2} }}'), - ); + return [ + ['{{ [1, "a": "b"] }}'], + ['{{ {"a": "b", 2} }}'], + ]; } public function getTestsForArray() { - return array( + return [ // simple array - array('{{ [1, 2] }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), + ['{{ [1, 2] }}', new ArrayExpression([ + new ConstantExpression(0, 1), + new ConstantExpression(1, 1), - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Constant(2, 1), - ), 1), - ), + new ConstantExpression(1, 1), + new ConstantExpression(2, 1), + ], 1), + ], // array with trailing , - array('{{ [1, 2, ] }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), + ['{{ [1, 2, ] }}', new ArrayExpression([ + new ConstantExpression(0, 1), + new ConstantExpression(1, 1), - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Constant(2, 1), - ), 1), - ), + new ConstantExpression(1, 1), + new ConstantExpression(2, 1), + ], 1), + ], // simple hash - array('{{ {"a": "b", "b": "c"} }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Constant('b', 1), + ['{{ {"a": "b", "b": "c"} }}', new ArrayExpression([ + new ConstantExpression('a', 1), + new ConstantExpression('b', 1), - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), + new ConstantExpression('b', 1), + new ConstantExpression('c', 1), + ], 1), + ], // hash with trailing , - array('{{ {"a": "b", "b": "c", } }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Constant('b', 1), + ['{{ {"a": "b", "b": "c", } }}', new ArrayExpression([ + new ConstantExpression('a', 1), + new ConstantExpression('b', 1), - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), + new ConstantExpression('b', 1), + new ConstantExpression('c', 1), + ], 1), + ], // hash in an array - array('{{ [1, {"a": "b", "b": "c"}] }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), + ['{{ [1, {"a": "b", "b": "c"}] }}', new ArrayExpression([ + new ConstantExpression(0, 1), + new ConstantExpression(1, 1), - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Constant('b', 1), + new ConstantExpression(1, 1), + new ArrayExpression([ + new ConstantExpression('a', 1), + new ConstantExpression('b', 1), - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), 1), - ), + new ConstantExpression('b', 1), + new ConstantExpression('c', 1), + ], 1), + ], 1), + ], // array in a hash - array('{{ {"a": [1, 2], "b": "c"} }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), - - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Constant(2, 1), - ), 1), - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), - ); + ['{{ {"a": [1, 2], "b": "c"} }}', new ArrayExpression([ + new ConstantExpression('a', 1), + new ArrayExpression([ + new ConstantExpression(0, 1), + new ConstantExpression(1, 1), + + new ConstantExpression(1, 1), + new ConstantExpression(2, 1), + ], 1), + new ConstantExpression('b', 1), + new ConstantExpression('c', 1), + ], 1), + ], + ]; } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError */ public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); - $stream = $env->tokenize(new Twig_Source('{{ "a" "b" }}', 'index')); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]); + $stream = $env->tokenize(new Source('{{ "a" "b" }}', 'index')); + $parser = new Parser($env); $parser->parse($stream); } @@ -166,113 +174,113 @@ public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings() */ public function testStringExpression($template, $expected) { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); - $stream = $env->tokenize(new Twig_Source($template, '')); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false, 'optimizations' => 0]); + $stream = $env->tokenize(new Source($template, '')); + $parser = new Parser($env); $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); } public function getTestsForString() { - return array( - array( - '{{ "foo" }}', new Twig_Node_Expression_Constant('foo', 1), - ), - array( - '{{ "foo #{bar}" }}', new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Name('bar', 1), + return [ + [ + '{{ "foo" }}', new ConstantExpression('foo', 1), + ], + [ + '{{ "foo #{bar}" }}', new ConcatBinary( + new ConstantExpression('foo ', 1), + new NameExpression('bar', 1), 1 ), - ), - array( - '{{ "foo #{bar} baz" }}', new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Name('bar', 1), + ], + [ + '{{ "foo #{bar} baz" }}', new ConcatBinary( + new ConcatBinary( + new ConstantExpression('foo ', 1), + new NameExpression('bar', 1), 1 ), - new Twig_Node_Expression_Constant(' baz', 1), + new ConstantExpression(' baz', 1), 1 ), - ), - - array( - '{{ "foo #{"foo #{bar} baz"} baz" }}', new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Name('bar', 1), + ], + + [ + '{{ "foo #{"foo #{bar} baz"} baz" }}', new ConcatBinary( + new ConcatBinary( + new ConstantExpression('foo ', 1), + new ConcatBinary( + new ConcatBinary( + new ConstantExpression('foo ', 1), + new NameExpression('bar', 1), 1 ), - new Twig_Node_Expression_Constant(' baz', 1), + new ConstantExpression(' baz', 1), 1 ), 1 ), - new Twig_Node_Expression_Constant(' baz', 1), + new ConstantExpression(' baz', 1), 1 ), - ), - ); + ], + ]; } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError */ public function testAttributeCallDoesNotSupportNamedArguments() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source('{{ foo.bar(name="Foo") }}', 'index'))); + $parser->parse($env->tokenize(new Source('{{ foo.bar(name="Foo") }}', 'index'))); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError */ public function testMacroCallDoesNotSupportNamedArguments() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source('{% from _self import foo %}{% macro foo() %}{% endmacro %}{{ foo(name="Foo") }}', 'index'))); + $parser->parse($env->tokenize(new Source('{% from _self import foo %}{% macro foo() %}{% endmacro %}{{ foo(name="Foo") }}', 'index'))); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage An argument must be a name. Unexpected token "string" of value "a" ("name" expected) in "index" at line 1. */ public function testMacroDefinitionDoesNotSupportNonNameVariableName() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source('{% macro foo("a") %}{% endmacro %}', 'index'))); + $parser->parse($env->tokenize(new Source('{% macro foo("a") %}{% endmacro %}', 'index'))); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage A default value for an argument must be a constant (a boolean, a string, a number, or an array) in "index" at line 1 * @dataProvider getMacroDefinitionDoesNotSupportNonConstantDefaultValues */ public function testMacroDefinitionDoesNotSupportNonConstantDefaultValues($template) { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source($template, 'index'))); + $parser->parse($env->tokenize(new Source($template, 'index'))); } public function getMacroDefinitionDoesNotSupportNonConstantDefaultValues() { - return array( - array('{% macro foo(name = "a #{foo} a") %}{% endmacro %}'), - array('{% macro foo(name = [["b", "a #{foo} a"]]) %}{% endmacro %}'), - ); + return [ + ['{% macro foo(name = "a #{foo} a") %}{% endmacro %}'], + ['{% macro foo(name = [["b", "a #{foo} a"]]) %}{% endmacro %}'], + ]; } /** @@ -280,10 +288,10 @@ public function getMacroDefinitionDoesNotSupportNonConstantDefaultValues() */ public function testMacroDefinitionSupportsConstantDefaultValues($template) { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source($template, 'index'))); + $parser->parse($env->tokenize(new Source($template, 'index'))); // 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 @@ -292,86 +300,86 @@ public function testMacroDefinitionSupportsConstantDefaultValues($template) public function getMacroDefinitionSupportsConstantDefaultValues() { - return array( - array('{% macro foo(name = "aa") %}{% endmacro %}'), - array('{% macro foo(name = 12) %}{% endmacro %}'), - array('{% macro foo(name = true) %}{% endmacro %}'), - array('{% macro foo(name = ["a"]) %}{% endmacro %}'), - array('{% macro foo(name = [["a"]]) %}{% endmacro %}'), - array('{% macro foo(name = {a: "a"}) %}{% endmacro %}'), - array('{% macro foo(name = {a: {b: "a"}}) %}{% endmacro %}'), - ); + return [ + ['{% macro foo(name = "aa") %}{% endmacro %}'], + ['{% macro foo(name = 12) %}{% endmacro %}'], + ['{% macro foo(name = true) %}{% endmacro %}'], + ['{% macro foo(name = ["a"]) %}{% endmacro %}'], + ['{% macro foo(name = [["a"]]) %}{% endmacro %}'], + ['{% macro foo(name = {a: "a"}) %}{% endmacro %}'], + ['{% macro foo(name = {a: {b: "a"}}) %}{% endmacro %}'], + ]; } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unknown "cycl" function. Did you mean "cycle" in "index" at line 1? */ public function testUnknownFunction() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source('{{ cycl() }}', 'index'))); + $parser->parse($env->tokenize(new Source('{{ cycl() }}', 'index'))); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unknown "foobar" function in "index" at line 1. */ public function testUnknownFunctionWithoutSuggestions() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source('{{ foobar() }}', 'index'))); + $parser->parse($env->tokenize(new Source('{{ foobar() }}', 'index'))); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unknown "lowe" filter. Did you mean "lower" in "index" at line 1? */ public function testUnknownFilter() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source('{{ 1|lowe }}', 'index'))); + $parser->parse($env->tokenize(new Source('{{ 1|lowe }}', 'index'))); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unknown "foobar" filter in "index" at line 1. */ public function testUnknownFilterWithoutSuggestions() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source('{{ 1|foobar }}', 'index'))); + $parser->parse($env->tokenize(new Source('{{ 1|foobar }}', 'index'))); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unknown "nul" test. Did you mean "null" in "index" at line 1 */ public function testUnknownTest() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - $stream = $env->tokenize(new Twig_Source('{{ 1 is nul }}', 'index')); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); + $stream = $env->tokenize(new Source('{{ 1 is nul }}', 'index')); $parser->parse($stream); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unknown "foobar" test in "index" at line 1. */ public function testUnknownTestWithoutSuggestions() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $parser = new Parser($env); - $parser->parse($env->tokenize(new Twig_Source('{{ 1 is foobar }}', 'index'))); + $parser->parse($env->tokenize(new Source('{{ 1 is foobar }}', 'index'))); } } diff --git a/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php b/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php index ca69b4af65034f6c090b4256cb9ce9b43900f865..c29431824abd9838ae772b4ed38396c67825843c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php @@ -9,52 +9,68 @@ * file that was distributed with this source code. */ +use Twig\Environment; + class Twig_Tests_Extension_CoreTest extends \PHPUnit\Framework\TestCase { /** * @dataProvider getRandomFunctionTestData */ - public function testRandomFunction($value, $expectedInArray) + public function testRandomFunction(array $expectedInArray, $value1, $value2 = null) { $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - for ($i = 0; $i < 100; ++$i) { - $this->assertTrue(in_array(twig_random($env, $value), $expectedInArray, true)); // assertContains() would not consider the type + $this->assertTrue(\in_array(twig_random($env, $value1, $value2), $expectedInArray, true)); // assertContains() would not consider the type } } public function getRandomFunctionTestData() { - return array( - array(// array - array('apple', 'orange', 'citrus'), - array('apple', 'orange', 'citrus'), - ), - array(// Traversable - new ArrayObject(array('apple', 'orange', 'citrus')), - array('apple', 'orange', 'citrus'), - ), - array(// unicode string + return [ + 'array' => [ + ['apple', 'orange', 'citrus'], + ['apple', 'orange', 'citrus'], + ], + 'Traversable' => [ + ['apple', 'orange', 'citrus'], + new ArrayObject(['apple', 'orange', 'citrus']), + ], + 'unicode string' => [ + ['Ä', '€', 'é'], 'Ä€é', - array('Ä', '€', 'é'), - ), - array(// numeric but string + ], + 'numeric but string' => [ + ['1', '2', '3'], '123', - array('1', '2', '3'), - ), - array(// integer + ], + 'integer' => [ + range(0, 5, 1), 5, + ], + 'float' => [ range(0, 5, 1), - ), - array(// float 5.9, - range(0, 5, 1), - ), - array(// negative + ], + 'negative' => [ + [0, -1, -2], -2, - array(0, -1, -2), - ), - ); + ], + 'min max int' => [ + range(50, 100), + 50, + 100, + ], + 'min max float' => [ + range(-10, 10), + -9.5, + 9.5, + ], + 'min null' => [ + range(0, 100), + null, + 100, + ], + ]; } public function testRandomFunctionWithoutParameter() @@ -62,51 +78,51 @@ public function testRandomFunctionWithoutParameter() $max = mt_getrandmax(); for ($i = 0; $i < 100; ++$i) { - $val = twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $this->assertTrue(is_int($val) && $val >= 0 && $val <= $max); + $val = twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $this->assertTrue(\is_int($val) && $val >= 0 && $val <= $max); } } public function testRandomFunctionReturnsAsIs() { - $this->assertSame('', twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), '')); - $this->assertSame('', twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('charset' => null)), '')); + $this->assertSame('', twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), '')); + $this->assertSame('', twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['charset' => null]), '')); - $instance = new stdClass(); - $this->assertSame($instance, twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), $instance)); + $instance = new \stdClass(); + $this->assertSame($instance, twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), $instance)); } /** - * @expectedException Twig_Error_Runtime + * @expectedException \Twig\Error\RuntimeError */ public function testRandomFunctionOfEmptyArrayThrowsException() { - twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), array()); + twig_random(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), []); } public function testRandomFunctionOnNonUTF8String() { - if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { + if (!\function_exists('iconv') && !\function_exists('mb_convert_encoding')) { $this->markTestSkipped('needs iconv or mbstring'); } - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $twig->setCharset('ISO-8859-1'); $text = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); for ($i = 0; $i < 30; ++$i) { $rand = twig_random($twig, $text); - $this->assertTrue(in_array(twig_convert_encoding($rand, 'UTF-8', 'ISO-8859-1'), array('Ä', 'é'), true)); + $this->assertTrue(\in_array(twig_convert_encoding($rand, 'UTF-8', 'ISO-8859-1'), ['Ä', 'é'], true)); } } public function testReverseFilterOnNonUTF8String() { - if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { + if (!\function_exists('iconv') && !\function_exists('mb_convert_encoding')) { $this->markTestSkipped('needs iconv or mbstring'); } - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $twig->setCharset('ISO-8859-1'); $input = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); @@ -120,27 +136,27 @@ public function testReverseFilterOnNonUTF8String() */ public function testCustomEscaper($expected, $string, $strategy) { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $twig->getExtension('Twig_Extension_Core')->setEscaper('foo', 'foo_escaper_for_test'); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->getExtension('\Twig\Extension\CoreExtension')->setEscaper('foo', 'foo_escaper_for_test'); $this->assertSame($expected, twig_escape_filter($twig, $string, $strategy)); } public function provideCustomEscaperCases() { - return array( - array('fooUTF-8', 'foo', 'foo'), - array('UTF-8', null, 'foo'), - array('42UTF-8', 42, 'foo'), - ); + return [ + ['fooUTF-8', 'foo', 'foo'], + ['UTF-8', null, 'foo'], + ['42UTF-8', 42, 'foo'], + ]; } /** - * @expectedException Twig_Error_Runtime + * @expectedException \Twig\Error\RuntimeError */ public function testUnknownCustomEscaper() { - twig_escape_filter(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), 'foo', 'bar'); + twig_escape_filter(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), 'foo', 'bar'); } /** @@ -148,21 +164,21 @@ public function testUnknownCustomEscaper() */ public function testTwigFirst($expected, $input) { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $this->assertSame($expected, twig_first($twig, $input)); } public function provideTwigFirstCases() { - $i = array(1 => 'a', 2 => 'b', 3 => 'c'); - - return array( - array('a', 'abc'), - array(1, array(1, 2, 3)), - array('', null), - array('', ''), - array('a', new CoreTestIterator($i, array_keys($i), true, 3)), - ); + $i = [1 => 'a', 2 => 'b', 3 => 'c']; + + return [ + ['a', 'abc'], + [1, [1, 2, 3]], + ['', null], + ['', ''], + ['a', new CoreTestIterator($i, array_keys($i), true, 3)], + ]; } /** @@ -170,21 +186,21 @@ public function provideTwigFirstCases() */ public function testTwigLast($expected, $input) { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $this->assertSame($expected, twig_last($twig, $input)); } public function provideTwigLastCases() { - $i = array(1 => 'a', 2 => 'b', 3 => 'c'); - - return array( - array('c', 'abc'), - array(3, array(1, 2, 3)), - array('', null), - array('', ''), - array('c', new CoreTestIterator($i, array_keys($i), true)), - ); + $i = [1 => 'a', 2 => 'b', 3 => 'c']; + + return [ + ['c', 'abc'], + [3, [1, 2, 3]], + ['', null], + ['', ''], + ['c', new CoreTestIterator($i, array_keys($i), true)], + ]; } /** @@ -197,17 +213,17 @@ public function testArrayKeysFilter(array $expected, $input) public function provideArrayKeyCases() { - $array = array('a' => 'a1', 'b' => 'b1', 'c' => 'c1'); + $array = ['a' => 'a1', 'b' => 'b1', 'c' => 'c1']; $keys = array_keys($array); - return array( - array($keys, $array), - array($keys, new CoreTestIterator($array, $keys)), - array($keys, new CoreTestIteratorAggregate($array, $keys)), - array($keys, new CoreTestIteratorAggregateAggregate($array, $keys)), - array(array(), null), - array(array('a'), new SimpleXMLElement('<xml><a></a></xml>')), - ); + return [ + [$keys, $array], + [$keys, new CoreTestIterator($array, $keys)], + [$keys, new CoreTestIteratorAggregate($array, $keys)], + [$keys, new CoreTestIteratorAggregateAggregate($array, $keys)], + [[], null], + [['a'], new \SimpleXMLElement('<xml><a></a></xml>')], + ]; } /** @@ -220,22 +236,22 @@ public function testInFilter($expected, $value, $compare) public function provideInFilterCases() { - $array = array(1, 2, 'a' => 3, 5, 6, 7); + $array = [1, 2, 'a' => 3, 5, 6, 7]; $keys = array_keys($array); - return array( - array(true, 1, $array), - array(true, '3', $array), - array(true, '3', 'abc3def'), - array(true, 1, new CoreTestIterator($array, $keys, true, 1)), - array(true, '3', new CoreTestIterator($array, $keys, true, 3)), - array(true, '3', new CoreTestIteratorAggregateAggregate($array, $keys, true, 3)), - array(false, 4, $array), - array(false, 4, new CoreTestIterator($array, $keys, true)), - array(false, 4, new CoreTestIteratorAggregateAggregate($array, $keys, true)), - array(false, 1, 1), - array(true, 'b', new SimpleXMLElement('<xml><a>b</a></xml>')), - ); + return [ + [true, 1, $array], + [true, '3', $array], + [true, '3', 'abc3def'], + [true, 1, new CoreTestIterator($array, $keys, true, 1)], + [true, '3', new CoreTestIterator($array, $keys, true, 3)], + [true, '3', new CoreTestIteratorAggregateAggregate($array, $keys, true, 3)], + [false, 4, $array], + [false, 4, new CoreTestIterator($array, $keys, true)], + [false, 4, new CoreTestIteratorAggregateAggregate($array, $keys, true)], + [false, 1, 1], + [true, 'b', new \SimpleXMLElement('<xml><a>b</a></xml>')], + ]; } /** @@ -243,38 +259,38 @@ public function provideInFilterCases() */ public function testSliceFilter($expected, $input, $start, $length = null, $preserveKeys = false) { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); $this->assertSame($expected, twig_slice($twig, $input, $start, $length, $preserveKeys)); } public function provideSliceFilterCases() { - $i = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4); + $i = ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4]; $keys = array_keys($i); - return array( - array(array('a' => 1), $i, 0, 1, true), - array(array('a' => 1), $i, 0, 1, false), - array(array('b' => 2, 'c' => 3), $i, 1, 2), - array(array(1), array(1, 2, 3, 4), 0, 1), - array(array(2, 3), array(1, 2, 3, 4), 1, 2), - array(array(2, 3), new CoreTestIterator($i, $keys, true), 1, 2), - array(array('c' => 3, 'd' => 4), new CoreTestIteratorAggregate($i, $keys, true), 2, null, true), - array($i, new CoreTestIterator($i, $keys, true), 0, count($keys) + 10, true), - array(array(), new CoreTestIterator($i, $keys, true), count($keys) + 10), - array('de', 'abcdef', 3, 2), - array(array(), new SimpleXMLElement('<items><item>1</item><item>2</item></items>'), 3), - array(array(), new ArrayIterator(array(1, 2)), 3), - ); + return [ + [['a' => 1], $i, 0, 1, true], + [['a' => 1], $i, 0, 1, false], + [['b' => 2, 'c' => 3], $i, 1, 2], + [[1], [1, 2, 3, 4], 0, 1], + [[2, 3], [1, 2, 3, 4], 1, 2], + [[2, 3], new CoreTestIterator($i, $keys, true), 1, 2], + [['c' => 3, 'd' => 4], new CoreTestIteratorAggregate($i, $keys, true), 2, null, true], + [$i, new CoreTestIterator($i, $keys, true), 0, \count($keys) + 10, true], + [[], new CoreTestIterator($i, $keys, true), \count($keys) + 10], + ['de', 'abcdef', 3, 2], + [[], new \SimpleXMLElement('<items><item>1</item><item>2</item></items>'), 3], + [[], new \ArrayIterator([1, 2]), 3], + ]; } } -function foo_escaper_for_test(Twig_Environment $env, $string, $charset) +function foo_escaper_for_test(Environment $env, $string, $charset) { return $string.$charset; } -final class CoreTestIteratorAggregate implements IteratorAggregate +final class CoreTestIteratorAggregate implements \IteratorAggregate { private $iterator; @@ -289,7 +305,7 @@ public function getIterator() } } -final class CoreTestIteratorAggregateAggregate implements IteratorAggregate +final class CoreTestIteratorAggregateAggregate implements \IteratorAggregate { private $iterator; @@ -318,7 +334,7 @@ public function __construct(array $values, array $keys, $allowValueAccess = fals $this->arrayKeys = $keys; $this->position = 0; $this->allowValueAccess = $allowValueAccess; - $this->maxPosition = false === $maxPosition ? count($values) + 1 : $maxPosition; + $this->maxPosition = false === $maxPosition ? \count($values) + 1 : $maxPosition; } public function rewind() @@ -332,7 +348,7 @@ public function current() return $this->array[$this->key()]; } - throw new LogicException('Code should only use the keys, not the values provided by iterator.'); + throw new \LogicException('Code should only use the keys, not the values provided by iterator.'); } public function key() @@ -344,7 +360,7 @@ public function next() { ++$this->position; if ($this->position === $this->maxPosition) { - throw new LogicException(sprintf('Code should not iterate beyond %d.', $this->maxPosition)); + throw new \LogicException(sprintf('Code should not iterate beyond %d.', $this->maxPosition)); } } diff --git a/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php b/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php index e268115c24a64584ff586ab4639524d03e35339e..de9ced0234bd267876baf54cae49e8fa8e767fdd 100644 --- a/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php @@ -9,6 +9,12 @@ * file that was distributed with this source code. */ +use Twig\Environment; +use Twig\Extension\SandboxExtension; +use Twig\Loader\ArrayLoader; +use Twig\Sandbox\SecurityError; +use Twig\Sandbox\SecurityPolicy; + class Twig_Tests_Extension_SandboxTest extends \PHPUnit\Framework\TestCase { protected static $params; @@ -16,19 +22,18 @@ class Twig_Tests_Extension_SandboxTest extends \PHPUnit\Framework\TestCase protected function setUp() { - self::$params = array( + self::$params = [ 'name' => 'Fabien', 'obj' => new FooObject(), - 'arr' => array('obj' => new FooObject()), - ); + 'arr' => ['obj' => new FooObject()], + ]; - self::$templates = array( + self::$templates = [ '1_basic1' => '{{ obj.foo }}', '1_basic2' => '{{ name|upper }}', '1_basic3' => '{% if name %}foo{% endif %}', '1_basic4' => '{{ obj.bar }}', '1_basic5' => '{{ obj }}', - '1_basic6' => '{{ arr.obj }}', '1_basic7' => '{{ cycle(["foo","bar"], 1) }}', '1_basic8' => '{{ obj.getfoobar }}{{ obj.getFooBar }}', '1_basic9' => '{{ obj.foobar }}{{ obj.fooBar }}', @@ -37,33 +42,33 @@ protected function setUp() '1_child' => "{% extends \"1_layout\" %}\n{% block content %}\n{{ \"a\"|json_encode }}\n{% endblock %}", '1_include' => '{{ include("1_basic1", sandboxed=true) }}', '1_range_operator' => '{{ (1..2)[0] }}', - ); + ]; } /** - * @expectedException Twig_Sandbox_SecurityError + * @expectedException \Twig\Sandbox\SecurityError * @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child" at line 3. */ public function testSandboxWithInheritance() { - $twig = $this->getEnvironment(true, array(), self::$templates, array('block')); - $twig->loadTemplate('1_child')->render(array()); + $twig = $this->getEnvironment(true, [], self::$templates, ['block']); + $twig->load('1_child')->render([]); } public function testSandboxGloballySet() { - $twig = $this->getEnvironment(false, array(), self::$templates); - $this->assertEquals('FOO', $twig->loadTemplate('1_basic')->render(self::$params), 'Sandbox does nothing if it is disabled globally'); + $twig = $this->getEnvironment(false, [], self::$templates); + $this->assertEquals('FOO', $twig->load('1_basic')->render(self::$params), 'Sandbox does nothing if it is disabled globally'); } public function testSandboxUnallowedMethodAccessor() { - $twig = $this->getEnvironment(true, array(), self::$templates); + $twig = $this->getEnvironment(true, [], self::$templates); try { - $twig->loadTemplate('1_basic1')->render(self::$params); + $twig->load('1_basic1')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed method is called'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError'); $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class'); $this->assertEquals('foo', $e->getMethodName(), 'Exception should be raised on the "foo" method'); } @@ -71,219 +76,250 @@ public function testSandboxUnallowedMethodAccessor() public function testSandboxUnallowedFilter() { - $twig = $this->getEnvironment(true, array(), self::$templates); + $twig = $this->getEnvironment(true, [], self::$templates); try { - $twig->loadTemplate('1_basic2')->render(self::$params); + $twig->load('1_basic2')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed filter is called'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedFilterError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFilterError'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFilterError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFilterError'); $this->assertEquals('upper', $e->getFilterName(), 'Exception should be raised on the "upper" filter'); } } public function testSandboxUnallowedTag() { - $twig = $this->getEnvironment(true, array(), self::$templates); + $twig = $this->getEnvironment(true, [], self::$templates); try { - $twig->loadTemplate('1_basic3')->render(self::$params); + $twig->load('1_basic3')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed tag is used in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError'); $this->assertEquals('if', $e->getTagName(), 'Exception should be raised on the "if" tag'); } } public function testSandboxUnallowedProperty() { - $twig = $this->getEnvironment(true, array(), self::$templates); + $twig = $this->getEnvironment(true, [], self::$templates); try { - $twig->loadTemplate('1_basic4')->render(self::$params); + $twig->load('1_basic4')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed property is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedPropertyError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedPropertyError'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedPropertyError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedPropertyError'); $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class'); $this->assertEquals('bar', $e->getPropertyName(), 'Exception should be raised on the "bar" property'); } } - public function testSandboxUnallowedToString() + /** + * @dataProvider getSandboxUnallowedToStringTests + */ + public function testSandboxUnallowedToString($template) { - $twig = $this->getEnvironment(true, array(), self::$templates); + $twig = $this->getEnvironment(true, [], ['index' => $template], [], ['upper'], ['FooObject' => 'getAnotherFooObject'], [], ['random']); try { - $twig->loadTemplate('1_basic5')->render(self::$params); + $twig->loadTemplate('index')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError'); $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class'); $this->assertEquals('__tostring', $e->getMethodName(), 'Exception should be raised on the "__toString" method'); } } - public function testSandboxUnallowedToStringArray() + public function getSandboxUnallowedToStringTests() { - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic6')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError'); - $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class'); - $this->assertEquals('__tostring', $e->getMethodName(), 'Exception should be raised on the "__toString" method'); - } + return [ + 'simple' => ['{{ obj }}'], + 'object_from_array' => ['{{ arr.obj }}'], + 'object_chain' => ['{{ obj.anotherFooObject }}'], + 'filter' => ['{{ obj|upper }}'], + 'filter_from_array' => ['{{ arr.obj|upper }}'], + 'function' => ['{{ random(obj) }}'], + 'function_from_array' => ['{{ random(arr.obj) }}'], + 'function_and_filter' => ['{{ random(obj|upper) }}'], + 'function_and_filter_from_array' => ['{{ random(arr.obj|upper) }}'], + 'object_chain_and_filter' => ['{{ obj.anotherFooObject|upper }}'], + 'object_chain_and_function' => ['{{ random(obj.anotherFooObject) }}'], + 'concat' => ['{{ obj ~ "" }}'], + 'concat_again' => ['{{ "" ~ obj }}'], + ]; + } + + /** + * @dataProvider getSandboxAllowedToStringTests + */ + public function testSandboxAllowedToString($template, $output) + { + $twig = $this->getEnvironment(true, [], ['index' => $template], ['set'], [], ['FooObject' => ['foo', 'getAnotherFooObject']]); + $this->assertEquals($output, $twig->load('index')->render(self::$params)); + } + + public function getSandboxAllowedToStringTests() + { + return [ + 'constant_test' => ['{{ obj is constant("PHP_INT_MAX") }}', ''], + 'set_object' => ['{% set a = obj.anotherFooObject %}{{ a.foo }}', 'foo'], + 'is_defined' => ['{{ obj.anotherFooObject is defined }}', '1'], + 'is_null' => ['{{ obj is null }}', ''], + 'is_sameas' => ['{{ obj is same as(obj) }}', '1'], + 'is_sameas_from_array' => ['{{ arr.obj is same as(arr.obj) }}', '1'], + 'is_sameas_from_another_method' => ['{{ obj.anotherFooObject is same as(obj.anotherFooObject) }}', ''], + ]; + } + + public function testSandboxAllowMethodToString() + { + $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['FooObject' => '__toString']); + FooObject::reset(); + $this->assertEquals('foo', $twig->load('1_basic5')->render(self::$params), 'Sandbox allow some methods'); + $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once'); + } + + public function testSandboxAllowMethodToStringDisabled() + { + $twig = $this->getEnvironment(false, [], self::$templates); + FooObject::reset(); + $this->assertEquals('foo', $twig->load('1_basic5')->render(self::$params), 'Sandbox allows __toString when sandbox disabled'); + $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once'); } public function testSandboxUnallowedFunction() { - $twig = $this->getEnvironment(true, array(), self::$templates); + $twig = $this->getEnvironment(true, [], self::$templates); try { - $twig->loadTemplate('1_basic7')->render(self::$params); + $twig->load('1_basic7')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if an unallowed function is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError'); $this->assertEquals('cycle', $e->getFunctionName(), 'Exception should be raised on the "cycle" function'); } } public function testSandboxUnallowedRangeOperator() { - $twig = $this->getEnvironment(true, array(), self::$templates); + $twig = $this->getEnvironment(true, [], self::$templates); try { - $twig->loadTemplate('1_range_operator')->render(self::$params); + $twig->load('1_range_operator')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception if the unallowed range operator is called'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError'); $this->assertEquals('range', $e->getFunctionName(), 'Exception should be raised on the "range" function'); } } public function testSandboxAllowMethodFoo() { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => 'foo')); + $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['FooObject' => 'foo']); FooObject::reset(); - $this->assertEquals('foo', $twig->loadTemplate('1_basic1')->render(self::$params), 'Sandbox allow some methods'); + $this->assertEquals('foo', $twig->load('1_basic1')->render(self::$params), 'Sandbox allow some methods'); $this->assertEquals(1, FooObject::$called['foo'], 'Sandbox only calls method once'); } - public function testSandboxAllowMethodToString() - { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => '__toString')); - FooObject::reset(); - $this->assertEquals('foo', $twig->loadTemplate('1_basic5')->render(self::$params), 'Sandbox allow some methods'); - $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once'); - } - - public function testSandboxAllowMethodToStringDisabled() - { - $twig = $this->getEnvironment(false, array(), self::$templates); - FooObject::reset(); - $this->assertEquals('foo', $twig->loadTemplate('1_basic5')->render(self::$params), 'Sandbox allows __toString when sandbox disabled'); - $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once'); - } - public function testSandboxAllowFilter() { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array('upper')); - $this->assertEquals('FABIEN', $twig->loadTemplate('1_basic2')->render(self::$params), 'Sandbox allow some filters'); + $twig = $this->getEnvironment(true, [], self::$templates, [], ['upper']); + $this->assertEquals('FABIEN', $twig->load('1_basic2')->render(self::$params), 'Sandbox allow some filters'); } public function testSandboxAllowTag() { - $twig = $this->getEnvironment(true, array(), self::$templates, array('if')); - $this->assertEquals('foo', $twig->loadTemplate('1_basic3')->render(self::$params), 'Sandbox allow some tags'); + $twig = $this->getEnvironment(true, [], self::$templates, ['if']); + $this->assertEquals('foo', $twig->load('1_basic3')->render(self::$params), 'Sandbox allow some tags'); } public function testSandboxAllowProperty() { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array('FooObject' => 'bar')); - $this->assertEquals('bar', $twig->loadTemplate('1_basic4')->render(self::$params), 'Sandbox allow some properties'); + $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], ['FooObject' => 'bar']); + $this->assertEquals('bar', $twig->load('1_basic4')->render(self::$params), 'Sandbox allow some properties'); } public function testSandboxAllowFunction() { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array(), array('cycle')); - $this->assertEquals('bar', $twig->loadTemplate('1_basic7')->render(self::$params), 'Sandbox allow some functions'); + $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], [], ['cycle']); + $this->assertEquals('bar', $twig->load('1_basic7')->render(self::$params), 'Sandbox allow some functions'); } public function testSandboxAllowRangeOperator() { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array(), array('range')); - $this->assertEquals('1', $twig->loadTemplate('1_range_operator')->render(self::$params), 'Sandbox allow the range operator'); + $twig = $this->getEnvironment(true, [], self::$templates, [], [], [], [], ['range']); + $this->assertEquals('1', $twig->load('1_range_operator')->render(self::$params), 'Sandbox allow the range operator'); } public function testSandboxAllowFunctionsCaseInsensitive() { - foreach (array('getfoobar', 'getFoobar', 'getFooBar') as $name) { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => $name)); + foreach (['getfoobar', 'getFoobar', 'getFooBar'] as $name) { + $twig = $this->getEnvironment(true, [], self::$templates, [], [], ['FooObject' => $name]); FooObject::reset(); - $this->assertEquals('foobarfoobar', $twig->loadTemplate('1_basic8')->render(self::$params), 'Sandbox allow methods in a case-insensitive way'); + $this->assertEquals('foobarfoobar', $twig->load('1_basic8')->render(self::$params), 'Sandbox allow methods in a case-insensitive way'); $this->assertEquals(2, FooObject::$called['getFooBar'], 'Sandbox only calls method once'); - $this->assertEquals('foobarfoobar', $twig->loadTemplate('1_basic9')->render(self::$params), 'Sandbox allow methods via shortcut names (ie. without get/set)'); + $this->assertEquals('foobarfoobar', $twig->load('1_basic9')->render(self::$params), 'Sandbox allow methods via shortcut names (ie. without get/set)'); } } public function testSandboxLocallySetForAnInclude() { - self::$templates = array( + self::$templates = [ '2_basic' => '{{ obj.foo }}{% include "2_included" %}{{ obj.foo }}', '2_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', - ); + ]; - $twig = $this->getEnvironment(false, array(), self::$templates); - $this->assertEquals('fooFOOfoo', $twig->loadTemplate('2_basic')->render(self::$params), 'Sandbox does nothing if disabled globally and sandboxed not used for the include'); + $twig = $this->getEnvironment(false, [], self::$templates); + $this->assertEquals('fooFOOfoo', $twig->load('2_basic')->render(self::$params), 'Sandbox does nothing if disabled globally and sandboxed not used for the include'); - self::$templates = array( + self::$templates = [ '3_basic' => '{{ obj.foo }}{% sandbox %}{% include "3_included" %}{% endsandbox %}{{ obj.foo }}', '3_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', - ); + ]; - $twig = $this->getEnvironment(true, array(), self::$templates); + $twig = $this->getEnvironment(true, [], self::$templates); try { - $twig->loadTemplate('3_basic')->render(self::$params); + $twig->load('3_basic')->render(self::$params); $this->fail('Sandbox throws a SecurityError exception when the included file is sandboxed'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError'); + } catch (SecurityError $e) { + $this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError'); $this->assertEquals('sandbox', $e->getTagName()); } } public function testMacrosInASandbox() { - $twig = $this->getEnvironment(true, array('autoescape' => 'html'), array('index' => <<<EOF + $twig = $this->getEnvironment(true, ['autoescape' => 'html'], ['index' => <<<EOF {%- import _self as macros %} {%- macro test(text) %}<p>{{ text }}</p>{% endmacro %} {{- macros.test('username') }} EOF - ), array('macro', 'import'), array('escape')); + ], ['macro', 'import'], ['escape']); - $this->assertEquals('<p>username</p>', $twig->loadTemplate('index')->render(array())); + $this->assertEquals('<p>username</p>', $twig->load('index')->render([])); } public function testSandboxDisabledAfterIncludeFunctionError() { - $twig = $this->getEnvironment(false, array(), self::$templates); + $twig = $this->getEnvironment(false, [], self::$templates); $e = null; try { - $twig->loadTemplate('1_include')->render(self::$params); - } catch (Throwable $e) { - } catch (Exception $e) { + $twig->load('1_include')->render(self::$params); + } catch (\Throwable $e) { + } catch (\Exception $e) { } if (null === $e) { $this->fail('An exception should be thrown for this test to be valid.'); } - $this->assertFalse($twig->getExtension('Twig_Extension_Sandbox')->isSandboxed(), 'Sandboxed include() function call should not leave Sandbox enabled when an error occurs.'); + $this->assertFalse($twig->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed(), 'Sandboxed include() function call should not leave Sandbox enabled when an error occurs.'); } - protected function getEnvironment($sandboxed, $options, $templates, $tags = array(), $filters = array(), $methods = array(), $properties = array(), $functions = array()) + protected function getEnvironment($sandboxed, $options, $templates, $tags = [], $filters = [], $methods = [], $properties = [], $functions = []) { - $loader = new Twig_Loader_Array($templates); - $twig = new Twig_Environment($loader, array_merge(array('debug' => true, 'cache' => false, 'autoescape' => false), $options)); - $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); - $twig->addExtension(new Twig_Extension_Sandbox($policy, $sandboxed)); + $loader = new ArrayLoader($templates); + $twig = new Environment($loader, array_merge(['debug' => true, 'cache' => false, 'autoescape' => false], $options)); + $policy = new SecurityPolicy($tags, $filters, $methods, $properties, $functions); + $twig->addExtension(new SandboxExtension($policy, $sandboxed)); return $twig; } @@ -291,13 +327,13 @@ protected function getEnvironment($sandboxed, $options, $templates, $tags = arra class FooObject { - public static $called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); + public static $called = ['__toString' => 0, 'foo' => 0, 'getFooBar' => 0]; public $bar = 'bar'; public static function reset() { - self::$called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); + self::$called = ['__toString' => 0, 'foo' => 0, 'getFooBar' => 0]; } public function __toString() @@ -320,4 +356,9 @@ public function getFooBar() return 'foobar'; } + + public function getAnotherFooObject() + { + return new self(); + } } diff --git a/vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php b/vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php index f97d30694b9584f35d42f04bb32e28bd5090680d..47d62afc88470936a46f205403fad56c57a05e40 100644 --- a/vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php +++ b/vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php @@ -9,18 +9,20 @@ * file that was distributed with this source code. */ +use Twig\RuntimeLoader\FactoryRuntimeLoader; + class Twig_Tests_FactoryRuntimeLoaderTest extends \PHPUnit\Framework\TestCase { public function testLoad() { - $loader = new Twig_FactoryRuntimeLoader(array('stdClass' => 'getRuntime')); + $loader = new FactoryRuntimeLoader(['stdClass' => 'getRuntime']); $this->assertInstanceOf('stdClass', $loader->load('stdClass')); } public function testLoadReturnsNullForUnmappedRuntime() { - $loader = new Twig_FactoryRuntimeLoader(); + $loader = new FactoryRuntimeLoader(); $this->assertNull($loader->load('stdClass')); } @@ -28,5 +30,5 @@ public function testLoadReturnsNullForUnmappedRuntime() function getRuntime() { - return new stdClass(); + return new \stdClass(); } diff --git a/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php b/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php index e8a23eade978b382d255a1ec53a9bdde62bd1cac..aa41b8326ee10a79a48af5595992d9a8850ce7bc 100644 --- a/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php +++ b/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php @@ -9,7 +9,10 @@ * file that was distributed with this source code. */ -require_once dirname(__FILE__).'/FilesystemHelper.php'; +use Twig\Environment; +use Twig\Loader\ArrayLoader; + +require_once __DIR__.'/FilesystemHelper.php'; class Twig_Tests_FileCachingTest extends \PHPUnit\Framework\TestCase { @@ -27,7 +30,7 @@ protected function setUp() $this->markTestSkipped(sprintf('Unable to run the tests as "%s" is not writable.', $this->tmpDir)); } - $this->env = new Twig_Environment(new Twig_Loader_Array(array('index' => 'index', 'index2' => 'index2')), array('cache' => $this->tmpDir)); + $this->env = new Environment(new ArrayLoader(['index' => 'index', 'index2' => 'index2']), ['cache' => $this->tmpDir]); } protected function tearDown() diff --git a/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php b/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php index a983a47c85877727e299f5f39b603723fd4b0c06..120d9ce7c443e2aa712e31048009efa9f3c951b1 100644 --- a/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php +++ b/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +use Twig\FileExtensionEscapingStrategy; + class Twig_Tests_FileExtensionEscapingStrategyTest extends \PHPUnit\Framework\TestCase { /** @@ -16,36 +18,36 @@ class Twig_Tests_FileExtensionEscapingStrategyTest extends \PHPUnit\Framework\Te */ public function testGuess($strategy, $filename) { - $this->assertSame($strategy, Twig_FileExtensionEscapingStrategy::guess($filename)); + $this->assertSame($strategy, FileExtensionEscapingStrategy::guess($filename)); } public function getGuessData() { - return array( + return [ // default - array('html', 'foo.html'), - array('html', 'foo.html.twig'), - array('html', 'foo'), - array('html', 'foo.bar.twig'), - array('html', 'foo.txt/foo'), - array('html', 'foo.txt/foo.js/'), + ['html', 'foo.html'], + ['html', 'foo.html.twig'], + ['html', 'foo'], + ['html', 'foo.bar.twig'], + ['html', 'foo.txt/foo'], + ['html', 'foo.txt/foo.js/'], // css - array('css', 'foo.css'), - array('css', 'foo.css.twig'), - array('css', 'foo.twig.css'), - array('css', 'foo.js.css'), - array('css', 'foo.js.css.twig'), + ['css', 'foo.css'], + ['css', 'foo.css.twig'], + ['css', 'foo.twig.css'], + ['css', 'foo.js.css'], + ['css', 'foo.js.css.twig'], // js - array('js', 'foo.js'), - array('js', 'foo.js.twig'), - array('js', 'foo.txt/foo.js'), - array('js', 'foo.txt.twig/foo.js'), + ['js', 'foo.js'], + ['js', 'foo.js.twig'], + ['js', 'foo.txt/foo.js'], + ['js', 'foo.txt.twig/foo.js'], // txt - array(false, 'foo.txt'), - array(false, 'foo.txt.twig'), - ); + [false, 'foo.txt'], + [false, 'foo.txt.twig'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php b/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php index 0e315e8f7739c2e41dbbd22dfda8864e49484cf9..17c7ae1a19ba7760bd4c939576e1456555af33d2 100644 --- a/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php +++ b/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php @@ -13,7 +13,7 @@ class Twig_Tests_FilesystemHelper { public static function removeDir($dir) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, PHP_VERSION_ID < 50300 ? 0 : FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST); + $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, PHP_VERSION_ID < 50300 ? 0 : \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST); foreach ($iterator as $filename => $fileInfo) { if ($iterator->isDot()) { continue; diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test index 1290973a5113a6243ec4890935ab629d64f4c2fd..a80b80c376e5fd8e6824588209132a983ecad374 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test @@ -14,8 +14,8 @@ blocks and autoescape {% set _content = block('content')|raw %} {{ _content|raw }} --DATA-- -return array('br' => '<br />') +return ['br' => '<br />'] --CONFIG-- -return array('autoescape' => 'name') +return ['autoescape' => 'name'] --EXPECT-- <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test index 04299bed3566ff69fd2b85981098e73ecc0dc465..5ad573cf0aa492029a268c071a473095a36d08db 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test @@ -12,11 +12,11 @@ --TEMPLATE(index.txt.twig)-- {{ br -}} --DATA-- -return array('br' => '<br />') +return ['br' => '<br />'] --CONFIG-- -return array('autoescape' => 'name') +return ['autoescape' => 'name'] --EXPECT-- <br /> -\x3Cbr\x20\x2F\x3E +\u003Cbr\u0020\/\u003E <br /> <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test index 2a9c5e7975c82d8390e9ffdcdc4254faebf9f1ea..74a1cc2833c21e402368f62fb4514b6b63c6c02c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test @@ -12,4 +12,4 @@ Content outside a block. {% block sidebar %} {% endblock %} --EXCEPTION-- -Twig_Error_Syntax: A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag in "index.twig" at line 3? +Twig\Error\SyntaxError: A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag in "index.twig" at line 3? diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test index 7ff2eedb7406974be157b46428f6714bbb62877b..66784292c9106ee55b9f076f703146fe7df88efb 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test @@ -13,6 +13,6 @@ Exception for multiline array with undefined variable foo2: foo2, } %} --DATA-- -return array('foobar' => 'foobar') +return ['foobar' => 'foobar'] --EXCEPTION-- -Twig_Error_Runtime: Variable "foo2" does not exist in "index.twig" at line 11. +Twig\Error\RuntimeError: Variable "foo2" does not exist in "index.twig" at line 11. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test index c425069bf8135b3674d508714132467a0258154f..7f5e96b0491bd5ec1d2fc58eb18a6e9ec152c5c5 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test @@ -13,6 +13,6 @@ Exception for multiline array with undefined variable foo2: foo2, } %} --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Runtime: Variable "foobar" does not exist in "index.twig" at line 7. +Twig\Error\RuntimeError: Variable "foobar" does not exist in "index.twig" at line 7. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test index 2f94a5ee9db1d8bed6660844639017438d1e6bb0..8bc524ef1816d2e175cbff5970ece90b5a7c7cdd 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test @@ -7,6 +7,6 @@ Exception for multile function with undefined variable --TEMPLATE(foo)-- Foo --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Runtime: Variable "with_context" does not exist in "index.twig" at line 3. +Twig\Error\RuntimeError: Variable "with_context" does not exist in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test index 64761fcf12e983121d8827305ead9e91378bc289..5f413d406afbb686ead7f2cc4ac37d177c30b95c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test @@ -6,4 +6,4 @@ Exception for multiline function with unknown argument invalid=False ) }} --EXCEPTION-- -Twig_Error_Syntax: Unknown argument "invalid" for function "include(template, variables, with_context, ignore_missing, sandboxed)" in "index.twig" at line 4. +Twig\Error\SyntaxError: Unknown argument "invalid" for function "include(template, variables, with_context, ignore_missing, sandboxed)" in "index.twig" at line 4. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test index 7b3b1daf967e517235e33809a2cb7453cf4a56bc..032ad831ec5515a5efdd16ce699cfadfd51f5306 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test @@ -7,6 +7,6 @@ Exception for multiline tag with undefined variable --TEMPLATE(foo)-- Foo --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Runtime: Variable "vars" does not exist in "index.twig" at line 3. +Twig\Error\RuntimeError: Variable "vars" does not exist in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/strict_comparison_operator.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/strict_comparison_operator.test index dffbc016ee00bf006a6db67aad83858ff969e042..e14beb672dde80c9499fca0398debc90ef26b4f5 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/strict_comparison_operator.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/strict_comparison_operator.test @@ -3,4 +3,4 @@ The PHP === strict comparison operator is not supported --TEMPLATE-- {{ 1 === 2 }} --EXCEPTION-- -Twig_Error_Syntax: Unexpected operator of value "=". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead in "index.twig" at line 2. +Twig\Error\SyntaxError: Unexpected operator of value "=". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test index 9ca418b2254c9d6a4b391ff7dd8fb073a1fefbda..4ce06854fb7d2b629006a39e62d5de0b5b3090e9 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test @@ -7,4 +7,4 @@ Exception for syntax error in reused template {% do node.data = 5 %} {% endblock %} --EXCEPTION-- -Twig_Error_Syntax: Unexpected token "operator" of value "=" ("end of statement block" expected) in "foo.twig" at line 3. +Twig\Error\SyntaxError: Unexpected token "operator" of value "=" ("end of statement block" expected) in "foo.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test index 2c35ad56492101fde928ccd8d31d3d9626ba17f3..b4fc169167632eb1d58f70494dd21a143eafba0e 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test @@ -17,4 +17,4 @@ Exception for an unclosed tag {% endblock %} --EXCEPTION-- -Twig_Error_Syntax: Unexpected "endblock" tag (expecting closing tag for the "if" tag defined near line 4) in "index.twig" at line 16. +Twig\Error\SyntaxError: Unexpected "endblock" tag (expecting closing tag for the "if" tag defined near line 4) in "index.twig" at line 16. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test index c8e7a097363575f5eb66ccfd6d1d89b9af84019b..566ee721925bb0c9feccb280cdb5ebabc761ed4c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test @@ -5,4 +5,4 @@ Exception for an undefined parent {% set foo = "foo" %} --EXCEPTION-- -Twig_Error_Loader: Template "foo.html" is not defined in "index.twig" at line 2. +Twig\Error\LoaderError: Template "foo.html" is not defined in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test index 1992510b269dd259b669fc63d10b7ad233e3d99b..904faa50ad433995693a09491cac760438af57e4 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test @@ -10,6 +10,6 @@ Exception for an undefined template in a child template {% block sidebar %} {% endblock %} --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Loader: Template "include.twig" is not defined in "index.twig" at line 5. +Twig\Error\LoaderError: Template "include.twig" is not defined in "index.twig" at line 5. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test index 6679fbe132dc0f417d7d2afa77529c9f1d0b49ec..5bfdd07e6125439b0c20555f1b7fa7b6cfb2b42f 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test @@ -6,4 +6,4 @@ Exception for an undefined trait {% block bar %} {% endblock %} --EXCEPTION-- -Twig_Error_Runtime: Block "foobar" is not defined in trait "foo" in "index.twig" at line 2. +Twig\Error\RuntimeError: Block "foobar" is not defined in trait "foo" in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test index 32fed8fd078fc2dde623021dfde6138ce06327c2..fb88f4c859d1c6d732747dd244b4f45de86a645f 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test @@ -3,6 +3,6 @@ _self returns the template name --TEMPLATE-- {{ _self }} --DATA-- -return array() +return [] --EXPECT-- index.twig diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test index c69b1192fbabeebc6c5923a82d150673af980f48..bf6033356a1c5bd3cbf44e7677b562ccf566fa8e 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test @@ -38,7 +38,7 @@ Twig supports array notation {{ ary|keys|join(',') }} {{ ary|join(',') }} --DATA-- -return array('bar' => 'bar', 'foo' => array('bar' => 'bar')) +return ['bar' => 'bar', 'foo' => ['bar' => 'bar']] --EXPECT-- 1,2 foo,bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test index f3df328fe3c7715f5cb800642d5853cfcbe892d2..8c7a2ee7cb8f6f0e1a9fce0072d18c04b35a58ec 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test @@ -6,7 +6,7 @@ Twig supports method calls {{ items[foo] }} {{ items[items[foo]] }} --DATA-- -return array('foo' => 'bar', 'items' => array('foo' => 'bar', 'bar' => 'foo')) +return ['foo' => 'bar', 'items' => ['foo' => 'bar', 'bar' => 'foo']] --EXPECT-- bar bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test index f5e68456d78a8c9edbc53d84ef55adf1e43cba74..b4e8be58d3ccb4e09f5e71b7a0a3916953758b1f 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test @@ -22,7 +22,7 @@ Twig supports binary operations (+, -, *, /, ~, %, and, or) {{ foo ~ bar }} {{ 20 // 7 }} --DATA-- -return array('foo' => 'bar', 'bar' => 'foo') +return ['foo' => 'bar', 'bar' => 'foo'] --EXPECT-- 2 1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test index 74fe6cabb7d06bfaf0f822b13766bb8ba1597dd7..c2bda1cc6b61d050904e36912294ec43a6f301d5 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test @@ -6,7 +6,7 @@ Twig supports bitwise operations {{ 1 b-xor 5 }} {{ (1 and 0 b-or 0) is same as(1 and (0 b-or 0)) ? 'ok' : 'ko' }} --DATA-- -return array() +return [] --EXPECT-- 1 5 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test index 726b85075d4f09f18a182994ae39ff475ada649a..2811634f76aeec591c926c26debff2fe056fbca6 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test @@ -6,7 +6,7 @@ Twig supports comparison operators (==, !=, <, >, >=, <=) {{ 1 == 1 }}/{{ 1 == 2 }} {{ 1 != 1 }}/{{ 1 != 2 }} --DATA-- -return array() +return [] --EXPECT-- ///1 1//1/1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test index 238dd279039fc9de23aa1909d38ee7cd53b90407..f1bf5681e59389476732670212836133020a999a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test @@ -9,7 +9,7 @@ Twig supports the "divisible by" operator by (3) ? 'OK' }} --DATA-- -return array() +return [] --EXPECT-- OK OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test index 9cd0676ce7354309b00e9ffefad05377d504a2fe..0efa9305694208f36d0849fe6c0606c10a781877 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test @@ -11,7 +11,7 @@ Twig supports the .. operator {% for i in 0 + 1 .. 10 - 1 %}{{ i }} {% endfor %} --DATA-- -return array('foo' => array(1, 10)) +return ['foo' => [1, 10]] --EXPECT-- 0 1 2 3 4 5 6 7 8 9 10 a b c d e f g h i j k l m n o p q r s t u v w x y z diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test index 9ad5e5e8ebf29d656854287abe5d55e9a7b4053c..c8086d6d4c283c5b71128462efb3c8ad4fabc579 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test @@ -12,7 +12,7 @@ Twig supports the "ends with" operator {{ false ends with false ? 'OK' : 'KO' }} {{ false ends with '' ? 'OK' : 'KO' }} --DATA-- -return array() +return [] --EXPECT-- OK OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/floats.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/floats.test new file mode 100644 index 0000000000000000000000000000000000000000..cf563a03200ca20510af67b0c273298a418b59a6 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/floats.test @@ -0,0 +1,16 @@ +--TEST-- +Twig compiles floats properly +--CONDITION-- +version_compare(phpversion(), '7.0.0', '>=') +--TEMPLATE-- +{% set val2 = 0.0 %} + +{{ val is same as (0.0) ? 'Yes' : 'No' }} +{{ val2 is same as (0.0) ? 'Yes' : 'No' }} +{{ val is same as (val2) ? 'Yes' : 'No' }} +--DATA-- +return array('val' => 0.0) +--EXPECT-- +Yes +Yes +Yes diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test index 79f8e0b0d35e806e759c93f1f0db328505de27b8..069ebf793d10429a4f9cd30dbe66be1e07240a63 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test @@ -3,6 +3,6 @@ Twig supports grouping of expressions --TEMPLATE-- {{ (2 + 2) / 2 }} --DATA-- -return array() +return [] --EXPECT-- 2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test index 7ae3bae9598732d3f0e35d28d8ad3bb0034fb86c..308e8df2ac6b734a4744862429647f4ef0aa3408 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test @@ -10,7 +10,7 @@ Twig supports literals 7 {{ null }} 8 {{ NULL }} --DATA-- -return array() +return [] --EXPECT-- 1 1 2 1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test index 1a27a2d6fa90a436a987f0f01465ab747f8af2ea..60417e04ffd0fffc22aac1dedfec44dfb68e4a78 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test @@ -21,7 +21,7 @@ class TestClassForMagicCallAttributes } } -return array('foo' => new TestClassForMagicCallAttributes()) +return ['foo' => new TestClassForMagicCallAttributes()] --EXPECT-- foo_from_call bar_from_getbar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test index b6c771657a7c525185a30112bd61536b4c7628a3..95459c3b0f28ee16136bea9462f6e3780b4d17a7 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test @@ -5,7 +5,7 @@ Twig supports the "matches" operator {{ 'foo' matches '/^fo/' ? 'OK' : 'KO' }} {{ 'foo' matches '/O/i' ? 'OK' : 'KO' }} --DATA-- -return array() +return [] --EXPECT-- OK OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test index 5f801e6354a06d688cf02afff08d8ba0b1038fa8..1826842b6fbb054b8ebfae53e8e7afb47f4febec 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test @@ -12,9 +12,9 @@ Twig supports method calls {{ items.foo.in }} {{ items.foo.not }} --DATA-- -return array('foo' => 'bar', 'items' => array('foo' => new TwigTestFoo(), 'bar' => 'foo')) +return ['foo' => 'bar', 'items' => ['foo' => new TwigTestFoo(), 'bar' => 'foo']] --CONFIG-- -return array('strict_variables' => false) +return ['strict_variables' => false] --EXPECT-- foo foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test index 1853b1b0637d8599eb6ffa670f7ec3b1520e9b2c..c2a6e340245bf32153d7a2bc761c010e09c965d6 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test @@ -8,7 +8,7 @@ Twig manages negative numbers correctly {{ 5 + -1 }} {{ 5 + - 1 }} --DATA-- -return array() +return [] --EXPECT-- -1 -1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test index fe29d08bbf7228d0c85f58b64f30fb2f7f51242f..fa9a843c0fa9f1eddd45685a2eac65729d696e85 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test @@ -7,7 +7,7 @@ Twig allows to use named operators as variable names {{ in }} {{ is }} --DATA-- -return array('matches' => array(1, 2, 3), 'in' => 'in', 'is' => 'is') +return ['matches' => [1, 2, 3], 'in' => 'in', 'is' => 'is'] --EXPECT-- 1 2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test index 542c3504611258181a98651d5915e2d2e5720555..276cbf197d1ebe2827d58b892749b70f2596883a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test @@ -12,7 +12,7 @@ Twig parses postfix expressions {{ macros.foo() }} {{ (macros).foo() }} --DATA-- -return array(); +return [] --EXPECT-- a A diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test index eacc98f86fc6359ddae601bfa1ffc6c417f99862..84fd23692ce4edf6acd8370747fbab5ede1a6957 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test @@ -9,7 +9,7 @@ Twig parses power expressions {{ b ** a }} {{ b ** b }} --DATA-- -return array('a' => 4, 'b' => -2); +return ['a' => 4, 'b' => -2] --EXPECT-- 8 -8 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test index 601201deb384eff3cb34b053a50b3b269d5cefce..83f3691f97277b76d46938e99a7c40c717963e92 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test @@ -11,7 +11,7 @@ Twig supports the "same as" operator as (true) ? 'OK' }} --DATA-- -return array() +return [] --EXPECT-- OK OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test index 75d331e90a89cf3065f0f9a7e665af59ba33f8cc..a78ff1eac714184589eab0ec68babc5574fcdac3 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test @@ -13,7 +13,7 @@ with 'f' ? 'OK' : 'KO' }} {{ 'a' starts with false ? 'OK' : 'KO' }} {{ false starts with '' ? 'OK' : 'KO' }} --DATA-- -return array() +return [] --EXPECT-- OK OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test index a9116613e9421dd218e4ebd8d4847c58e2e37f74..f402c8939916a93080fa8457a3367c59b90f07b3 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test @@ -4,7 +4,7 @@ Twig supports string interpolation {{ "foo #{"foo #{bar} baz"} baz" }} {{ "foo #{bar}#{bar} baz" }} --DATA-- -return array('bar' => 'BAR'); +return ['bar' => 'BAR'] --EXPECT-- foo foo BAR baz baz foo BARBAR baz diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test index 0e6fa96e254fab5f1a6a36c513f5bea0be7de937..37eccc0f545955f35b14fd99bacb6a3f5f2eb0d5 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test @@ -8,7 +8,7 @@ Twig supports the ternary operator {{ 1 == 1 ? 'foo<br />':'' }} {{ foo ~ (bar ? ('-' ~ bar) : '') }} --DATA-- -return array('foo' => 'foo', 'bar' => 'bar') +return ['foo' => 'foo', 'bar' => 'bar'] --EXPECT-- YES NO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test index fdc660fc5e7368af5b8d9d268e66a3c2ebd038b9..8b0f7284b9b235f1f3eb3573dadaaa07c57f2cb9 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test @@ -4,7 +4,7 @@ Twig supports the ternary operator {{ 1 ? 'YES' }} {{ 0 ? 'YES' }} --DATA-- -return array() +return [] --EXPECT-- YES diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test index 9057e837018b694dec29290387c70af4b9af6cdb..ecd6b7546563de086095574ec7cb20e345e1be44 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test @@ -4,7 +4,7 @@ Twig supports the ternary operator {{ 'YES' ?: 'NO' }} {{ 0 ?: 'NO' }} --DATA-- -return array() +return [] --EXPECT-- YES NO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test index 0eaabb446e4655aa294e64cfb8ac462a2e3314ef..eca3b285bbe5993fe235afaa8d6be6df1cff6542 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test @@ -3,6 +3,6 @@ Twig does not allow to use two-word named operators as variable names --TEMPLATE-- {{ starts with }} --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Syntax: Unexpected token "operator" of value "starts with" in "index.twig" at line 2. +Twig\Error\SyntaxError: Unexpected token "operator" of value "starts with" in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test index b79219a2aa51d4a623e2813884ab85a18ceed0df..54225311903ec6dfe7586a525c37c15a1bd6602b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test @@ -5,7 +5,7 @@ Twig supports unary operators (not, -, +) {{ +1 + 1 }}/{{ -1 - 1 }} {{ not (false or true) }} --DATA-- -return array() +return [] --EXPECT-- /1 2/-2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test index ad84a9c26b17d3fdceced601c783c5102c724e63..27deba3ef519db1f0bb62a06a2d4dcaa16dabdb7 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test @@ -13,7 +13,7 @@ Twig manages negative numbers as default parameters {% macro positive_number1(nb = +1) %}{{ nb }}{% endmacro %} {% macro positive_number2(nb = ++1) %}{{ nb }}{% endmacro %} --DATA-- -return array() +return [] --EXPECT-- -1 1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test index cc6eef8d2a078cb824a3d6418aa2e9648147ea51..9c56ab12c0f1f648a2a76ef557ed96ade530392e 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test @@ -6,7 +6,7 @@ Twig unary operators precedence {{ -1 * -1 }} {{ 4 / -1 * 5 }} --DATA-- -return array() +return [] --EXPECT-- -2 0 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test index 27e93fd638129486eb23b36d65f110931c365e96..7518769d4a06fcec199c034f264439533cac0d60 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test @@ -14,7 +14,7 @@ {{ number5|abs }} {{ number6|abs }} --DATA-- -return array('number1' => -5.5, 'number2' => -5, 'number3' => -0, 'number4' => 0, 'number5' => 5, 'number6' => 5.5) +return ['number1' => -5.5, 'number2' => -5, 'number3' => -0, 'number4' => 0, 'number5' => 5, 'number6' => 5.5] --EXPECT-- 5.5 5 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test index cb6de7f97e963d3aadd4765878b87c6d985556fc..0acf25bd6144eef88ae05019b13e3bc1db0c4bcf 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test @@ -9,7 +9,7 @@ </div> {% endfor %} --DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) +return ['items' => ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']] --EXPECT-- <div class=row> <div class=item>a</div> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test index e2ec4beb21535d69b70c5c3a3bd393ce7157a2d4..dad004ec2c5558f10a0a785072f1a7296d7a44ee 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test @@ -9,7 +9,7 @@ </div> {% endfor %} --DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) +return ['items' => ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']] --EXPECT-- <div class=row> <div class=item>a</div> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test index af996f2469b0fa2bd6ff56f7097c72ee1ce24f98..411b4fc749913585fd7184ffddae07375b65a77b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test @@ -11,7 +11,7 @@ {% endfor %} </table> --DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) +return ['items' => ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']] --EXPECT-- <table> <tr> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test index 72483f4b5a442060507de6f8e0395e3c6417600c..750d1557aab1c087a23af76293b71dabb3792e23 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test @@ -9,7 +9,7 @@ </div> {% endfor %} --DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l')) +return ['items' => ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l']] --EXPECT-- <div class=row> <div class=item>a</div> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test index 746295f1b24452400523e07763309bf73e11c2fa..5d470d005b12cd41b4ebe1f92d7cf774c6df255a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test @@ -11,7 +11,7 @@ {% endfor %} </table> --DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) +return ['items' => ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']] --EXPECT-- <table> <tr> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test index 6015380e2a14c7ae9ad15b38f274b7c5cb9c9659..e56cd79bbc923df292d875c0672185ea7d2ec7d1 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test @@ -1,10 +1,10 @@ --TEST-- "batch" filter preserves array keys --TEMPLATE-- -{{ {'foo': 'bar', 'key': 'value'}|batch(4)|first|keys|join(',') }} -{{ {'foo': 'bar', 'key': 'value'}|batch(4, 'fill')|first|keys|join(',') }} +{{ {'foo': 'bar', 'key': 'value'}|batch(4)|first|keys|join(',') }} +{{ {'foo': 'bar', 'key': 'value'}|batch(4, 'fill')|first|keys|join(',') }} --DATA-- -return array() +return [] --EXPECT-- foo,key foo,key,0,1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_more_elements.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_more_elements.test new file mode 100644 index 0000000000000000000000000000000000000000..90f4de6859d8d2976e47c42eb616bb4afe737de3 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_more_elements.test @@ -0,0 +1,23 @@ +--TEST-- +"batch" filter +--TEMPLATE-- +{% for row in items|batch(3, 'fill') %} + <div class=row> + {% for key, column in row %} + <div class={{ key }}>{{ column }}</div> + {% endfor %} + </div> +{% endfor %} +--DATA-- +return ['items' => ['a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', '123' => 'e']] +--EXPECT-- +<div class=row> + <div class=a>a</div> + <div class=b>b</div> + <div class=c>c</div> + </div> + <div class=row> + <div class=d>d</div> + <div class=123>e</div> + <div class=124>fill</div> + </div> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test index b9c058d6b25e28a8287a63924f45464c632a8196..bc303da8ab6082be4fcf0606bd9dc66266691b5d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test @@ -4,7 +4,7 @@ {{ []|batch(3)|length }} {{ []|batch(3, 'fill')|length }} --DATA-- -return array() +return [] --EXPECT-- 0 0 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test index 380b04bb86984bf584d8b5687f35b1fb44bd48de..db8acedef5ed72273c49f2c01ef38e9a18bbec1c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test @@ -5,6 +5,6 @@ function_exists('iconv') || function_exists('mb_convert_encoding') --TEMPLATE-- {{ "愛していますか?"|convert_encoding('ISO-2022-JP', 'UTF-8')|convert_encoding('UTF-8', 'ISO-2022-JP') }} --DATA-- -return array() +return [] --EXPECT-- 愛していますか? diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test index d17e5e2f07260703f1b5903f36779acefed26c74..16816aa994806eae8b62969055af433b51b1002b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test @@ -40,16 +40,16 @@ {{ '2010-01-28 15:00:00'|date(timezone="Asia/Hong_Kong") }} --DATA-- date_default_timezone_set('Europe/Paris'); -return array( +return [ 'date1' => mktime(13, 45, 0, 10, 4, 2010), - 'date2' => new DateTime('2010-10-04 13:45'), + 'date2' => new \DateTime('2010-10-04 13:45'), 'date3' => '2010-10-04 13:45', - 'date4' => 1286199900, // DateTime::createFromFormat('Y-m-d H:i', '2010-10-04 13:45', new DateTimeZone('UTC'))->getTimestamp() -- A unixtimestamp is always GMT - 'date5' => -189291360, // DateTime::createFromFormat('Y-m-d H:i', '1964-01-02 03:04', new DateTimeZone('UTC'))->getTimestamp(), - 'date6' => new DateTime('2010-10-04 13:45', new DateTimeZone('America/New_York')), + 'date4' => 1286199900, // \DateTime::createFromFormat('Y-m-d H:i', '2010-10-04 13:45', new \DateTimeZone('UTC'))->getTimestamp() -- A unixtimestamp is always GMT + 'date5' => -189291360, // \DateTime::createFromFormat('Y-m-d H:i', '1964-01-02 03:04', new \DateTimeZone('UTC'))->getTimestamp(), + 'date6' => new \DateTime('2010-10-04 13:45', new \DateTimeZone('America/New_York')), 'date7' => '2010-01-28T15:00:00+04:00', - 'timezone1' => new DateTimeZone('America/New_York'), -) + 'timezone1' => new \DateTimeZone('America/New_York'), +] --EXPECT-- October 4, 2010 13:45 04/10/2010 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test index 6ad504cdf0e0de330bc896322bde9b26907a73d2..c6e81302df657a86c81cdcc082c061fe854ca4d2 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test @@ -5,10 +5,10 @@ {{ date1|date('d/m/Y') }} --DATA-- date_default_timezone_set('UTC'); -$twig->getExtension('Twig_Extension_Core')->setDateFormat('Y-m-d', '%d days %h hours'); -return array( +$twig->getExtension('\Twig\Extension\CoreExtension')->setDateFormat('Y-m-d', '%d days %h hours'); +return [ 'date1' => mktime(13, 45, 0, 10, 4, 2010), -) +] --EXPECT-- 2010-10-04 04/10/2010 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test index be4a642e7145962405b30361c9b9a5e0df2826b6..a72fb81d629669e2234f144a0d8137b964b36912 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test @@ -7,10 +7,10 @@ version_compare(phpversion(), '5.3.0', '>=') {{ date2|date('%d days') }} --DATA-- date_default_timezone_set('UTC'); -$twig->getExtension('Twig_Extension_Core')->setDateFormat('Y-m-d', '%d days %h hours'); -return array( - 'date2' => new DateInterval('P2D'), -) +$twig->getExtension('\Twig\Extension\CoreExtension')->setDateFormat('Y-m-d', '%d days %h hours'); +return [ + 'date2' => new \DateInterval('P2D'), +] --EXPECT-- 2 days 0 hours 2 days diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test index 4e183256209011a1ddc68662b1cdda9e99f002b8..2414db5015b39b268f14fba7f06ce27d7e0bc367 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test @@ -17,11 +17,11 @@ version_compare(phpversion(), '5.5.0', '>=') {{ date2|date('e', false) }} --DATA-- date_default_timezone_set('Europe/Paris'); -return array( - 'date1' => new DateTimeImmutable('2010-10-04 13:45'), - 'date2' => new DateTimeImmutable('2010-10-04 13:45', new DateTimeZone('America/New_York')), - 'timezone1' => new DateTimeZone('America/New_York'), -) +return [ + 'date1' => new \DateTimeImmutable('2010-10-04 13:45'), + 'date2' => new \DateTimeImmutable('2010-10-04 13:45', new \DateTimeZone('America/New_York')), + 'timezone1' => new \DateTimeZone('America/New_York'), +] --EXPECT-- October 4, 2010 13:45 04/10/2010 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test index 0c8c6f1a28cc20700b87d7c30e16a5cc14646c5f..c3333f565bf79ce56966a719d77a14d57ac306ac 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test @@ -8,11 +8,11 @@ version_compare(phpversion(), '5.3.0', '>=') {{ date1|date('%d days %h hours', timezone1) }} --DATA-- date_default_timezone_set('UTC'); -return array( - 'date1' => new DateInterval('P2D'), - // This should have no effect on DateInterval formatting - 'timezone1' => new DateTimeZone('America/New_York'), -) +return [ + 'date1' => new \DateInterval('P2D'), + // This should have no effect on \DateInterval formatting + 'timezone1' => new \DateTimeZone('America/New_York'), +] --EXPECT-- 2 days 2 days 0 hours diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test index 53d3a69cdf4080e65dc5462b4f958e0bd67c0cdd..d7f8fdf42a1d5a913a1f3ab354d304d89f8e58f8 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test @@ -5,10 +5,10 @@ {{ date2|date_modify('-1day')|date('Y-m-d H:i:s') }} --DATA-- date_default_timezone_set('UTC'); -return array( +return [ 'date1' => '2010-10-04 13:45', - 'date2' => new DateTime('2010-10-04 13:45'), -) + 'date2' => new \DateTime('2010-10-04 13:45'), +] --EXPECT-- 2010-10-03 13:45:00 2010-10-03 13:45:00 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test index 4ecde8a185c79e652ad27d2c9cb2d9471e2140d5..2d1aa134496c3eab54315588205b53862bf84c18 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test @@ -6,7 +6,7 @@ {{ date|date('d/m/Y H:i:s P', timezone='America/Chicago') }} --DATA-- date_default_timezone_set('UTC'); -return array('date' => mktime(13, 45, 0, 10, 4, 2010)) +return ['date' => mktime(13, 45, 0, 10, 4, 2010)] --EXPECT-- 04/10/2010 08:45:00 -05:00 04/10/2010 08:45:00 -05:00 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test index b8d1d66f5ed2f24e7ec0bb060fa0142c543a64aa..058873aae3e72ae974e7c80344f1d9da59ff9675 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test @@ -39,22 +39,22 @@ Deep nested: {{ object.self.undefinedMethod |default('default') is same as('default') ? 'ok' : 'ko' }} {{ object.undefinedMethod.self |default('default') is same as('default') ? 'ok' : 'ko' }} --DATA-- -return array( +return [ 'definedVar' => 'defined', 'zeroVar' => 0, 'emptyVar' => '', 'nullVar' => null, - 'nested' => array( + 'nested' => [ 'definedVar' => 'defined', 'zeroVar' => 0, 'emptyVar' => '', 'nullVar' => null, - 'definedArray' => array(0), - ), + 'definedArray' => [0], + ], 'object' => new TwigTestFoo(), -) +] --CONFIG-- -return array('strict_variables' => false) +return ['strict_variables' => false] --EXPECT-- Variable: ok @@ -94,22 +94,22 @@ ok ok ok --DATA-- -return array( +return [ 'definedVar' => 'defined', 'zeroVar' => 0, 'emptyVar' => '', 'nullVar' => null, - 'nested' => array( + 'nested' => [ 'definedVar' => 'defined', 'zeroVar' => 0, 'emptyVar' => '', 'nullVar' => null, - 'definedArray' => array(0), - ), + 'definedArray' => [0], + ], 'object' => new TwigTestFoo(), -) +] --CONFIG-- -return array('strict_variables' => true) +return ['strict_variables' => true] --EXPECT-- Variable: ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test index 93c5913f2beb8695daba670be24d4de94024cfe1..27dc8784c6b64aa8f8472d84aa0205d680be11bb 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test @@ -4,7 +4,7 @@ dynamic filter {{ 'bar'|foo_path }} {{ 'bar'|a_foo_b_bar }} --DATA-- -return array() +return [] --EXPECT-- foo/bar a/b/bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test index a606c10650d7006a26fe11be2c8d45f68d8c7320..131f5b4e72b76badd09fcd26786b467b433b49b6 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test @@ -3,6 +3,6 @@ --TEMPLATE-- {{ "foo <br />"|e }} --DATA-- -return array() +return [] --EXPECT-- foo <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test index 009a24532fd9c43550d2ffa51a7b6bc2d75c04b0..10e3275542102d8a0d8e5b60b1dc88619bf881b4 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test @@ -3,6 +3,6 @@ --TEMPLATE-- {{ '<br />'|escape('html_attr') }} --DATA-- -return array() +return [] --EXPECT-- <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test index 647147a439dc4c1ce4bfe4c48491cdd208a87ff3..4c2fb7a3668257beba238933252c17cc8831abab 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test @@ -3,6 +3,6 @@ --TEMPLATE-- {{ "é ♜ 𝌆"|e('js') }} --DATA-- -return array() +return [] --EXPECT-- -\u00E9\x20\u265C\x20\uD834\uDF06 +\u00E9\u0020\u265C\u0020\uD834\uDF06 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test index bba26a0df424cc62b7822a86fa7ff72d7277a8be..93f34297b09bb5a1b2f1cb5334c75ee0148db0c0 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test @@ -3,6 +3,6 @@ --TEMPLATE-- {{ "愛していますか? <br />"|e }} --DATA-- -return array() +return [] --EXPECT-- 愛していますか? <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test index aa54645c38da342177ed6e8665b7f7176cdb9b00..b19f2eed7bdeaa7e9661fef1b4284ce399bc9b55 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test @@ -8,7 +8,7 @@ {{ 'Ä€é'|first }} {{ ''|first }} --DATA-- -return array('arr' => new ArrayObject(array(1, 2, 3, 4))) +return ['arr' => new \ArrayObject([1, 2, 3, 4])] --EXPECT-- 1 1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test index 85a9b7172bdd49691b01232ead6d5ddf51f3f0cc..7efbe3200a673f3ba9ccfd11c318b5ae1b654df1 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test @@ -11,8 +11,8 @@ {{ foo }} {% endautoescape %} --DATA-- -return array() +return [] --EXPECT-- foo<br /> -\x20\x20\x20\x20foo\x3Cbr\x20\x2F\x3E\x0A +\u0020\u0020\u0020\u0020foo\u003Cbr\u0020\/\u003E\n foo<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test index 97221ff80ee2b20ac1dc02ea46eed6ab82cc55d1..efaf8317a3c2f8341b620d720f5631452ba2119d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test @@ -3,6 +3,6 @@ --TEMPLATE-- {{ string|format(foo, 3) }} --DATA-- -return array('string' => '%s/%d', 'foo' => 'bar') +return ['string' => '%s/%d', 'foo' => 'bar'] --EXPECT-- bar/3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test index b342c174c9858c59f9570cd0f4aae9dd5c9d5070..5792586304c3f494d804a72bdf6aae01e46fdb73 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test @@ -4,9 +4,35 @@ {{ ["foo", "bar"]|join(', ') }} {{ foo|join(', ') }} {{ bar|join(', ') }} + +{{ ["foo", "bar"]|join(', ', ' and ') }} +{{ foo|join(', ', ' and ') }} +{{ bar|join(', ', ' and ') }} +{{ ["one", "two", "three"]|join(', ', ' and ') }} +{{ ["a", "b", "c"]|join('','-') }} +{{ ["a", "b", "c"]|join('-','-') }} +{{ ["a", "b", "c"]|join('-','') }} +{{ ["hello"]|join('|','-') }} + +{{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join }} +{{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join(',') }} +{{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join(',','-') }} --DATA-- -return array('foo' => new TwigTestFoo(), 'bar' => new ArrayObject(array(3, 4))) +return ['foo' => new TwigTestFoo(), 'bar' => new \ArrayObject([3, 4])] --EXPECT-- foo, bar 1, 2 3, 4 + +foo and bar +1 and 2 +3 and 4 +one, two and three +ab-c +a-b-c +a-bc +hello + +wxyz +w,x,y,z +w,x,y-z diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test index 1738d40cdfb79bb6f2aea41c2433b7708677635c..902f90b337743bbbb0610b6a0b07cad5c058c73b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test @@ -5,7 +5,7 @@ {{ foo|json_encode|raw }} {{ [foo, "foo"]|json_encode|raw }} --DATA-- -return array('foo' => new Twig_Markup('foo', 'UTF-8')) +return ['foo' => new \Twig\Markup('foo', 'UTF-8')] --EXPECT-- "foo" "foo" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test index 1b8031ee840a92e0734f2d9971424c4f3bf134cb..f71896c77f6434a9e0a2b689aaa3e6af143b96b5 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test @@ -8,7 +8,7 @@ {{ 'Ä€é'|last }} {{ ''|last }} --DATA-- -return array('arr' => new ArrayObject(array(1, 2, 3, 4))) +return ['arr' => new \ArrayObject([1, 2, 3, 4])] --EXPECT-- 4 4 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test index bad5cf56fe374b5e9f1d8896b9f9ca2bace51a6e..67d2f6ac8c57651b15bc2fea0246967ffd2afc1c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test @@ -12,18 +12,18 @@ {{ non_countable|length }} {{ simple_xml_element|length }} --DATA-- -return array( - 'array' => array(1, 4), +return [ + 'array' => [1, 4], 'string' => 'foo', 'number' => 1000, 'to_string_able' => new ToStringStub('foobar'), 'countable' => new CountableStub(42), /* also asserts we do *not* call __toString() */ - 'iterator_aggregate' => new IteratorAggregateStub(array('a', 'b', 'c')), /* also asserts we do *not* call __toString() */ + 'iterator_aggregate' => new IteratorAggregateStub(['a', 'b', 'c']), /* also asserts we do *not* call __toString() */ 'null' => null, 'magic' => new MagicCallStub(), /* used to assert we do *not* call __call */ 'non_countable' => new \StdClass(), 'simple_xml_element' => new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><doc><elem/><elem/></doc>'), -); +] --EXPECT-- 2 3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test index 5d5e243616d76c494987afb2c9e75682d8e48fba..b1e9681a5d556e528593d513356debe044a62645 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test @@ -6,7 +6,7 @@ function_exists('mb_get_info') {{ string|length }} {{ markup|length }} --DATA-- -return array('string' => 'été', 'markup' => new Twig_Markup('foo', 'UTF-8')) +return ['string' => 'été', 'markup' => new \Twig\Markup('foo', 'UTF-8')] --EXPECT-- 3 3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test index 81371a41b94fd7d69f9739df91a6f0040035fbe5..8877501d4cc1227ff0dded4afb5680ca5c0df403 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test @@ -8,7 +8,14 @@ {{ numerics|merge([4, 5, 6])|join }} {{ traversable.a|merge(traversable.b)|join }} --DATA-- -return array('items' => array('foo' => 'bar'), 'numerics' => array(1, 2, 3), 'traversable' => array('a' => new ArrayObject(array(0 => 1, 1 => 2, 2 => 3)), 'b' => new ArrayObject(array('a' => 'b')))) +return [ + 'items' => ['foo' => 'bar'], + 'numerics' => [1, 2, 3], + 'traversable' => [ + 'a' => new \ArrayObject([0 => 1, 1 => 2, 2 => 3]), + 'b' => new \ArrayObject(['a' => 'b']) + ] +] --EXPECT-- barfoo foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test index 6545a9bb0104e76fe9062df592ab1566319e8fe9..524ec45f9630367a5c5f8b6a5dcd044d8251a798 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test @@ -4,7 +4,7 @@ {{ "I like Twig.\nYou will like it too.\n\nEverybody like it!"|nl2br }} {{ text|nl2br }} --DATA-- -return array('text' => "If you have some <strong>HTML</strong>\nit will be escaped.") +return ['text' => "If you have some <strong>HTML</strong>\nit will be escaped."] --EXPECT-- I like Twig.<br /> You will like it too.<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test index 639a8659f0d4af012416d8fa5faff16fc540fa47..7f1e2e16a288e52db5c47e0270fd0ed370a6053a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test @@ -8,7 +8,7 @@ {{ 1020.25|number_format(2, ',') }} {{ 1020.25|number_format(2, ',', '.') }} --DATA-- -return array(); +return [] --EXPECT-- 20 20 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test index 65c1cdb4862b03d012f9ffb0fd4e1f49c832a365..beedd901a090379d7657b5757d07d1b6a911e92d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test @@ -9,8 +9,8 @@ {{ 1020.25|number_format(2, ',') }} {{ 1020.25|number_format(2, ',', '.') }} --DATA-- -$twig->getExtension('Twig_Extension_Core')->setNumberFormat(2, '!', '='); -return array(); +$twig->getExtension('\Twig\Extension\CoreExtension')->setNumberFormat(2, '!', '='); +return [] --EXPECT-- 20!00 20!25 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test index 06be7e270aefd08b58d2b27b3982580eb600140f..1b9670a17b38e6480f8e7902990383949de353af 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test @@ -5,7 +5,7 @@ {{ 'I like single replace operation only %that%'|replace({'%that%' : '%that%1'}) }} {{ 'I like %this% and %that%.'|replace(traversable) }} --DATA-- -return array('traversable' => new ArrayObject(array('%this%' => 'foo', '%that%' => 'bar'))) +return ['traversable' => new \ArrayObject(['%this%' => 'foo', '%that%' => 'bar'])] --EXPECT-- I liké foo and bar. I like single replace operation only %that%1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test index 2143a869096620ea90da6077431c5db092a5fca3..ba6fea4125a2eb3c18b6cce12b2e8b5f801b1760 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test @@ -3,6 +3,6 @@ Exception for invalid argument type in replace call --TEMPLATE-- {{ 'test %foo%'|replace(stdClass) }} --DATA-- -return array('stdClass' => new stdClass()) +return ['stdClass' => new \stdClass()] --EXCEPTION-- -Twig_Error_Runtime: The "replace" filter expects an array or "Traversable" as replace values, got "stdClass" in "index.twig" at line 2. +Twig\Error\RuntimeError: The "replace" filter expects an array or "Traversable" as replace values, got "stdClass" in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test index 7948ac45fece15b5811347c66b1272925bffa888..904e5839b02971e6c08e1c4a78b34e13e78513d5 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test @@ -8,7 +8,7 @@ {{ {'a': 'c', 'b': 'a'}|reverse(preserveKeys=true)|join(glue=',') }} {{ {'a': 'c', 'b': 'a'}|reverse(preserve_keys=true)|join(glue=',') }} --DATA-- -return array('arr' => new ArrayObject(array(1, 2, 3, 4))) +return ['arr' => new \ArrayObject([1, 2, 3, 4])] --EXPECT-- 4321 tnemenèvé4321 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test index 57806b619717f8a086ce82936b181c4b12024592..709237543a4c62e358ac92eff1e5c89b4353d5b7 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test @@ -10,7 +10,7 @@ {{ 21.3|round(-1, 'ceil')}} {{ 21.3|round(-1, 'floor')}} --DATA-- -return array() +return [] --EXPECT-- 3 2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test index b49b89fe56d25cedd39bb89822786a85806bd6b3..fc975d7bb186d7f9079f46f7ae7b844b9cc07af2 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test @@ -26,7 +26,7 @@ {{ arr[2:]|join('') }} {{ xml|slice(1)|join('')}} --DATA-- -return array('start' => 1, 'length' => 2, 'arr' => new ArrayObject(array(1, 2, 3, 4)), 'xml' => new SimpleXMLElement('<items><item>1</item><item>2</item></items>')) +return ['start' => 1, 'length' => 2, 'arr' => new \ArrayObject([1, 2, 3, 4]), 'xml' => new \SimpleXMLElement('<items><item>1</item><item>2</item></items>')] --EXPECT-- 23 23 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test index c67c18ea90a3f9cf2a7fd7e7ac9d187831a2a814..c3b2c70dd4ae670e69954eb54ff76fcf0b590ef1 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test @@ -5,7 +5,7 @@ {{ array2|sort|join }} {{ traversable|sort|join }} --DATA-- -return array('array1' => array(4, 1), 'array2' => array('foo', 'bar'), 'traversable' => new ArrayObject(array(0 => 3, 1 => 2, 2 => 1))) +return ['array1' => [4, 1], 'array2' => ['foo', 'bar'], 'traversable' => new \ArrayObject([0 => 3, 1 => 2, 2 => 1])] --EXPECT-- 14 barfoo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/spaceless.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/spaceless.test new file mode 100644 index 0000000000000000000000000000000000000000..eadc1d4962a3e87c517b8b42dce03736e71e9712 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/spaceless.test @@ -0,0 +1,8 @@ +--TEST-- +"spaceless" filter +--TEMPLATE-- +{{ " <div> <div> foo </div> </div>"|spaceless }} +--DATA-- +return [] +--EXPECT-- +<div><div> foo </div></div> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test index dbaf7dc979bf1d5bfe5872dd730b6e9777023b97..9869ec91c345b3432516527c44a239018094ec3b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test @@ -3,6 +3,6 @@ --TEMPLATE-- {{ 'foo'|§ }} --DATA-- -return array() +return [] --EXPECT-- §foo§ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test index a093ed79b5a584d1e6fedbfa484742585be8ba18..92dbf0a05c9bba7fb25f8dc0ccf815cd850a8658 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test @@ -9,7 +9,7 @@ {{ baz|split('', 2)|join('-') }} {{ foo|split(',', -2)|join('-') }} --DATA-- -return array('foo' => "one,two,three,four,five", 'baz' => '12345',) +return ['foo' => "one,two,three,four,five", 'baz' => '12345',] --EXPECT-- one-two-three-four-five one-two-three-four-five diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test index 305e162feacfda508329da5eeaecf677d784da22..bf52e6df76173ea13e48c87f6eea45b5dac10e7d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test @@ -12,7 +12,7 @@ function_exists('mb_get_info') {{ baz|split('', 1)|join('-') }} {{ baz|split('', 2)|join('-') }} --DATA-- -return array('foo' => 'Ä,é,Äほ', 'baz' => 'éÄßごa',) +return ['foo' => 'Ä,é,Äほ', 'baz' => 'éÄßごa',] --EXPECT-- é Ä-é-Äほ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test index 4e17b7726cb71f1df8c1d93634f0b61d0d05098e..1626db0c97298765d39d45006b24c41910ba2e3a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test @@ -4,7 +4,7 @@ Filters as static method calls {{ 'foo'|static_call_string }} {{ 'foo'|static_call_array }} --DATA-- -return array('foo' => 'foo') +return ['foo' => 'foo'] --EXPECT-- *foo* *foo* diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test index b1ef7b473128365aa40486cd65df0086ca411b87..432989ff165f06a3cde1dd13acf44f770fdd821b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test @@ -11,7 +11,7 @@ {{ "/ foo/"|trim(character_mask="/", side="left") }} {{ " do nothing. "|trim("", "right") }} --DATA-- -return array('text' => " If you have some <strong>HTML</strong> it will be escaped. ") +return ['text' => " If you have some <strong>HTML</strong> it will be escaped. "] --EXPECT-- I like Twig. If you have some <strong>HTML</strong> it will be escaped. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test index 8726159db0668a03502bdaddd4ddea7d4a1fc35a..66a682dd397ce2da5cad04837ab781125b87015d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test @@ -8,7 +8,7 @@ defined('PHP_QUERY_RFC3986') {{ {}|url_encode|default("default") }} {{ 'spéßi%le%c0d@dspa ce'|url_encode }} --DATA-- -return array() +return [] --EXPECT-- foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce= foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce= diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test index 35e50390d57c89bcae1bf7dff1207d5dc74673b0..38d726492aad5b0600e568997e442d9dfe98ad1d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode_deprecated.test @@ -8,7 +8,7 @@ defined('PHP_QUERY_RFC3986') {{ {}|url_encode|default("default") }} {{ 'spéßi%le%c0d@dspa ce'|url_encode }} --DATA-- -return array() +return [] --EXPECT-- foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce= foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce= diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test index 71b2038aa9402e1376aaa29c4d9bdadedfb6eaea..2972bd45eda4e99cf37800b341fdc886d970538a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test @@ -8,7 +8,7 @@ {{ attribute(obj, method) is defined ? 'ok' : 'ko' }} {{ attribute(obj, nonmethod) is defined ? 'ok' : 'ko' }} --DATA-- -return array('obj' => new TwigTestFoo(), 'method' => 'foo', 'array' => array('foo' => 'bar'), 'item' => 'foo', 'nonmethod' => 'xxx', 'arguments' => array('a', 'b')) +return ['obj' => new TwigTestFoo(), 'method' => 'foo', 'array' => ['foo' => 'bar'], 'item' => 'foo', 'nonmethod' => 'xxx', 'arguments' => ['a', 'b']] --EXPECT-- foo bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test index 8e54059aee1ba1adfd2e0bc5f7f8a524066e3eaa..1a4fd5492f859c8b46b9955c3b2fcf7c941a37b3 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test @@ -7,6 +7,6 @@ {% block foo %}{{ block('bar') }}{% endblock %} {% block bar %}BAR_BASE{% endblock %} --DATA-- -return array() +return [] --EXPECT-- BARBAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test index 8305eb67fcfdd220ee92a5930920013c3c03df9b..37cb7a4813fcf0d1ff2870d41730fd300a9bfebe 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test @@ -10,10 +10,10 @@ --TEMPLATE(included.twig)-- {% block foo %}FOO{% endblock %} --DATA-- -return array( +return [ 'included_loaded' => $twig->load('included.twig'), - 'included_loaded_internal' => $twig->loadTemplate('included.twig'), -) + 'included_loaded_internal' => $twig->load('included.twig'), +] --EXPECT-- FOO FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test index 665cc87e584eef28c0c0761ad9e50f9139cc4def..236df945109f46142e602e6fe814d6460df14378 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test @@ -7,6 +7,6 @@ {% block foo %}{{ block() }}{% endblock %} {% block bar %}BAR_BASE{% endblock %} --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Syntax: The "block" function takes one argument (the block name) in "base.twig" at line 2. +Twig\Error\SyntaxError: The "block" function takes one argument (the block name) in "base.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test index 63128791f5573177f7e046625993b0a3dd034d00..fd6dd06111667f0391410cbaccb3e6252fb2c8d4 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test @@ -4,7 +4,7 @@ {{ constant('DATE_W3C') == expect ? 'true' : 'false' }} {{ constant('ARRAY_AS_PROPS', object) }} --DATA-- -return array('expect' => DATE_W3C, 'object' => new ArrayObject(array('hi'))); +return ['expect' => DATE_W3C, 'object' => new \ArrayObject(['hi'])] --EXPECT-- true 2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test index 522a63b85f5a0f576c3ae3012675629b412cf07f..0ac6dccd3aee48f744065e8bd03e7c65f3c1c092 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test @@ -5,7 +5,7 @@ {{ cycle(array1, i) }}-{{ cycle(array2, i) }} {% endfor %} --DATA-- -return array('array1' => array('odd', 'even'), 'array2' => array('apple', 'orange', 'citrus')) +return ['array1' => ['odd', 'even'], 'array2' => ['apple', 'orange', 'citrus']] --EXPECT-- odd-apple even-orange diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test index c9f46446805d491e9dd2d7618bfba1a47b597b0e..c879da3cfd8d2ea67af0aa40c1fe0e0ee026670f 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test @@ -10,13 +10,13 @@ {{ date() > date('-1day') ? 'OK' : 'KO' }} --DATA-- date_default_timezone_set('UTC'); -return array( +return [ 'date1' => mktime(13, 45, 0, 10, 4, 2010), - 'date2' => new DateTime('2010-10-04 13:45'), + 'date2' => new \DateTime('2010-10-04 13:45'), 'date3' => '2010-10-04 13:45', - 'date4' => 1286199900, // DateTime::createFromFormat('Y-m-d H:i', '2010-10-04 13:45', new DateTimeZone('UTC'))->getTimestamp() -- A unixtimestamp is always GMT - 'date5' => -189291360, // DateTime::createFromFormat('Y-m-d H:i', '1964-01-02 03:04', new DateTimeZone('UTC'))->getTimestamp(), -) + 'date4' => 1286199900, // \DateTime::createFromFormat('Y-m-d H:i', '2010-10-04 13:45', new \DateTimeZone('UTC'))->getTimestamp() -- A unixtimestamp is always GMT + 'date5' => -189291360, // \DateTime::createFromFormat('Y-m-d H:i', '1964-01-02 03:04', new \DateTimeZone('UTC'))->getTimestamp(), +] --EXPECT-- OK OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test index b9dd9e38329f6bf8fef6ecdfb62e67ade95dab2e..11f60ee8bf2ee393960132a5d99ea8cfcc9269f0 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test @@ -5,7 +5,7 @@ {{ date(timezone="America/New_York", date=date)|date('d/m/Y H:i:s P', false) }} --DATA-- date_default_timezone_set('UTC'); -return array('date' => mktime(13, 45, 0, 10, 4, 2010)) +return ['date' => mktime(13, 45, 0, 10, 4, 2010)] --EXPECT-- 04/10/2010 09:45:00 -04:00 04/10/2010 09:45:00 -04:00 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test index f4072375a808f738b0930ce2ea6ac6a07f66a445..691a3abea9bdb16de4611222463e628f05e370ab 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test @@ -6,9 +6,9 @@ {{ dump('foo') }} {{ dump('foo', 'bar') }} --DATA-- -return array('foo' => 'foo', 'bar' => 'bar') +return ['foo' => 'foo', 'bar' => 'bar'] --CONFIG-- -return array('debug' => true, 'autoescape' => false); +return ['debug' => true, 'autoescape' => false] --EXPECT-- string(3) "foo" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test index 889b7a922e60ed439080a1a2739890de87f8df5d..5fd9383cd6ad44683039940a8bd5e7306bc0ccaf 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test @@ -1,13 +1,13 @@ --TEST-- "dump" function, xdebug is not loaded or xdebug <2.2-dev is loaded --CONDITION-- -!extension_loaded('xdebug') || (($r = new ReflectionExtension('xdebug')) && version_compare($r->getVersion(), '2.2-dev', '<')) +!extension_loaded('xdebug') || (($r = new \ReflectionExtension('xdebug')) && version_compare($r->getVersion(), '2.2-dev', '<')) --TEMPLATE-- {{ dump() }} --DATA-- -return array('foo' => 'foo', 'bar' => 'bar') +return ['foo' => 'foo', 'bar' => 'bar'] --CONFIG-- -return array('debug' => true, 'autoescape' => false); +return ['debug' => true, 'autoescape' => false] --EXPECT-- array(3) { ["foo"]=> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test index 913fbc99595aab3e0a07dc07880e559f32950b00..c7b3539c4026a1561affacf871637c8ef4fc60cf 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test @@ -4,7 +4,7 @@ dynamic function {{ foo_path('bar') }} {{ a_foo_b_bar('bar') }} --DATA-- -return array() +return [] --EXPECT-- foo/bar a/b/bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test index b7653b4ef683b556c9803ae31e205d0f23019e07..c9ce8123feae7288f39daf4c8da69dad62f41a7a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test @@ -7,7 +7,7 @@ FOO{{ tmp }}BAR --TEMPLATE(foo.twig)-- FOOBAR --DATA-- -return array() +return [] --EXPECT-- FOO FOOBARBAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test index 56f8f3b5a33cf4c5c5e5fb302bd9da17e9851006..a3666261f3953aef38c96e9a628c3a57506b5efb 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test @@ -5,6 +5,6 @@ --TEMPLATE(foo.twig)-- <p>Test</p> --DATA-- -return array() +return [] --EXPECT-- <p>Test</p> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test index a434182a214b517206a736dfb4ebaa74a0d18303..f90983c02f3901f0deb0caa12e3502e0e8f60d93 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test @@ -8,7 +8,7 @@ BAR --TEMPLATE(foo.twig)-- FOOBAR --DATA-- -return array() +return [] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test index aba30ce3fcb963f5bcb83004197bed938f874a38..c6d3d1c5331e6fb49dd0a75f8cca49bb56092d55 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test @@ -8,7 +8,7 @@ BAR --TEMPLATE(foo.twig)-- FOOBAR --DATA-- -return array('foo' => 'foo.twig') +return ['foo' => 'foo.twig'] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test index 43a2ccc2c8957efee4e76d6d5a9406277670e4f1..c05b43e140315a123d36f761f1aeea1fa394542f 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test @@ -6,5 +6,5 @@ {{ include("foo.twig", ignore_missing = true, variables = {}) }} {{ include("foo.twig", ignore_missing = true, variables = {}, with_context = true) }} --DATA-- -return array() +return [] --EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test index 4d2f6cf136ce43682dafc754c226ffe9b44b96b0..1d50f7ac2feed6ff24da39d443758007ad28fd27 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test @@ -3,6 +3,6 @@ --TEMPLATE-- {{ include("foo.twig") }} --DATA-- -return array(); +return [] --EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "index.twig" at line 2. +Twig\Error\LoaderError: Template "foo.twig" is not defined in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test index 78fddc7a683a4c0883d9a105f4e7aa7d9d30ca70..9ae8c9ee75935298bf77046f3e37eebe7a6adc07 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test @@ -11,6 +11,6 @@ {{ include("foo.twig") }} {% endblock %} --DATA-- -return array(); +return [] --EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "base.twig" at line 3. +Twig\Error\LoaderError: Template "foo.twig" is not defined in "base.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test index 7b9ccaca81f12f51c48e0bc879ec9681e0154161..ebfdb1eb8fff038b42071ce9e2a6bcedae1f6327 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test @@ -8,6 +8,6 @@ {{ foo|e }} {{ foo|e }} --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Sandbox_SecurityNotAllowedFilterError: Filter "e" is not allowed in "foo.twig" at line 4. +Twig\Sandbox\SecurityNotAllowedFilterError: Filter "e" is not allowed in "foo.twig" at line 4. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test index 8ffc49225e1b3954f6e6b5d09d8ba9196000f0eb..1206b67fe319bcb593a097a45329d00529ae8765 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test @@ -8,7 +8,7 @@ foo --TEMPLATE(bar.twig)-- {{ foo|e }} --DATA-- -return array('foo' => 'bar<br />') +return ['foo' => 'bar<br />'] --EXPECT-- foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test index 8bf6e102d9e4c81202c829ba9f8f8b29f8e6af51..c5be0088af646fee6f1489f9bd952b6ac9ca5fd0 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test @@ -6,7 +6,7 @@ --TEMPLATE(bar.twig)-- {{ foo|e }} --DATA-- -return array('foo' => 'bar<br />') +return ['foo' => 'bar<br />'] --EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test index 18d405a02e3a33394775a590ebc9865a755697a3..4c8b450835c1ef6ba2f6009612bcd89afc00a9fd 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test @@ -5,6 +5,6 @@ --TEMPLATE(foo.twig)-- BAR --DATA-- -return array('foo' => $twig->loadTemplate('foo.twig')) +return ['foo' => $twig->load('foo.twig')] --EXPECT-- BAR FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test index 1a8100687cd3de1e10817c583dbc1f2f42c7eaa1..21e5bb2efd20dfa6793d20e13dbebfc5be48f4bc 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test @@ -6,7 +6,7 @@ --TEMPLATE(foo.twig)-- foo --DATA-- -return array() +return [] --EXPECT-- foo foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test index 35611fbb9c68ea89ab9113c93966b39b6a11f3f3..46ac8c79bdc28854c5282b631f9751c2ffc2ea77 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test @@ -8,7 +8,7 @@ --TEMPLATE(foo.twig)-- {% for k, v in _context %}{{ k }},{% endfor %} --DATA-- -return array('foo' => 'bar') +return ['foo' => 'bar'] --EXPECT-- foo,global,_parent, global,_parent, diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test index b2ace940e955812440cb474bd37eb66276bb64d3..0ed98fed02f664d305732a97a67a574c0718f575 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test @@ -6,7 +6,7 @@ --TEMPLATE(foo.twig)-- {{ foo }} --DATA-- -return array('vars' => array('foo' => 'bar')) +return ['vars' => ['foo' => 'bar']] --EXPECT-- bar bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include_template_from_string.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include_template_from_string.test new file mode 100644 index 0000000000000000000000000000000000000000..8d9ba60ce6661d7d7a448430926ff883e0b4a4a4 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include_template_from_string.test @@ -0,0 +1,11 @@ +--TEST-- +"template_from_string" function works in an "include" +--TEMPLATE-- +{% set embed = '{% embed "embed.twig" %}{% endembed %}' %} +{{ include(template_from_string(embed)) }} +--TEMPLATE(embed.twig)-- +Cool +--DATA-- +return [] +--EXPECT-- +Cool diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test index 9335443128d3faa753841acd16b75964525d8d72..4dd5e27042b0455033a4f913dba71a0cf95baec7 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test @@ -3,6 +3,6 @@ __call calls --TEMPLATE-- {{ 'foo'|magic_call }} --DATA-- -return array() +return [] --EXPECT-- magic_foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call53.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call53.test index a0f55e11601ec3afff8c8767bd2f4c037d5771ed..a7c65bf6765121e927b768a826e277cee546d0e4 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call53.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call53.test @@ -6,7 +6,7 @@ version_compare(phpversion(), '5.3.0', '>=') {{ 'foo'|magic_call_string }} {{ 'foo'|magic_call_array }} --DATA-- -return array() +return [] --EXPECT-- static_magic_foo static_magic_foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test index e6c94af635b45d42874ef602b2e7f83ea59317dd..6d2de000d5e323dabd52390b41ac1f7cec498b76 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test @@ -5,7 +5,7 @@ {{ max(2, 1, 3, 5, 4) }} {{ max({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} --DATA-- -return array() +return [] --EXPECT-- 5 5 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test index 660471c0007ac65d627ae393095ea5830b73e000..1fe5446b7ca6c1531fb1dbd395d5e43efe90b2df 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test @@ -5,7 +5,7 @@ {{ min([2, 1, 3, 5, 4]) }} {{ min({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} --DATA-- -return array() +return [] --EXPECT-- 1 1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test index e0377c8d41d3b22e477b4f8eaded310b185e3d89..2927333b97fca0b3818bc3d3783f5d533ec7df43 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test @@ -3,6 +3,6 @@ --TEMPLATE-- {{ range(low=0+1, high=10+0, step=2)|join(',') }} --DATA-- -return array() +return [] --EXPECT-- 1,3,5,7,9 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test index bf0556d245dc2f34279d0383cdb64919e683dd80..1c3fffb5dabb72d36f8ae629b95cef75b89dcbc3 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test @@ -16,6 +16,6 @@ --TEMPLATE(base.twig)-- {{ block('list') }} --DATA-- -return array('item' => array('1', '2', array('3.1', array('3.2.1', '3.2.2'), '3.4'))) +return ['item' => ['1', '2', ['3.1', ['3.2.1', '3.2.2'], '3.4']]] --EXPECT-- <ol class="b"><li>"1"</li><li>"2"</li><li><ol class="b"><li>"3.1"</li><li><ol class="b"><li>"3.2.1"</li><li>"3.2.2"</li></ol></li><li>"3.4"</li></ol></li></ol> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test index 0e094c3b2e178cf72928cca62183737f8c783b0f..b691ce7bcd9ee45fd067fdb934b0ede31e41df10 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test @@ -8,7 +8,7 @@ BAR --TEMPLATE(foo.twig)-- {{ foo }}<br /> --DATA-- -return array() +return [] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test index 30c3df516801284c95578447b93bb2b8413b72cd..9c9e249455ea8126dd1ad1142ce6cc8386e2ff44 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test @@ -3,6 +3,6 @@ --TEMPLATE-- {{ §('foo') }} --DATA-- -return array() +return [] --EXPECT-- §foo§ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test index 57e5be392d63809d99c750c8297a6fe462941f82..dd13abb0bc56901af37fefa3148143d4d57e5454 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test @@ -4,7 +4,7 @@ Functions as static method calls {{ static_call_string('foo') }} {{ static_call_array('foo') }} --DATA-- -return array('foo' => 'foo') +return ['foo' => 'foo'] --EXPECT-- *foo* *foo* diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test index 3d3b9587453cb6f59fda50e733bc68ea723633a3..33b0e40d7c31a98d96effd8a7ee4c69f7ea8b13e 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test @@ -8,7 +8,7 @@ --TEMPLATE(parent.twig)-- {% block content %}{% endblock %} --DATA-- -return array('name' => 'Fabien', 'template' => "Hello {{ name }}") +return ['name' => 'Fabien', 'template' => "Hello {{ name }}"] --EXPECT-- Hello Fabien Hello Fabien diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test index 4ccff7b6701738959855a9d9a97f75abdcf7e0eb..18bba524ad94134dc644155c4d1d0a96851c5061 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test @@ -10,7 +10,7 @@ macro {{ test('foo') }} {{ test('bar', 'foo') }} --DATA-- -return array(); +return [] --EXPECT-- foobar barfoo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test index cd25428108c4b467f769721dce41af82385c60b1..4577286d0cbfb87c8a7538904d8af1769c3b36a8 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test @@ -13,6 +13,6 @@ macro {{ macros.foo(macros.bar()) }} --DATA-- -return array(); +return [] --EXPECT-- <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test index cbfb921b2cba2a24653f6edd3c3a02ed0218e830..05dd9213008a5fa0772dd2f14134e7e115a22ece 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test @@ -9,6 +9,6 @@ macro {{ test(this) }} --DATA-- -return array('this' => 'foo'); +return ['this' => 'foo'] --EXPECT-- foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test index 6a366cdf1b39c64fbb34da54d0a00b5aaaa7e49d..8fc6b477fb2d4348ee1bb4bc3f3bd37a5de1adca 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test @@ -14,7 +14,7 @@ macro {{ test.test(1, "c") }} {{ test(1, "c") }} --DATA-- -return array(); +return [] --EXPECT-- a<br />b<br /> a<br />b<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test index 412c90fae4e2ad8413bbedee5fbc822ecfad41e3..dd4b5c9f4710f2d172322168707979693bac039f 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test @@ -14,7 +14,7 @@ macro with arbitrary arguments {{ test1("foo", "bar", "foobar") }} {{ test2("foo", "bar", "foobar") }} --DATA-- -return array(); +return [] --EXPECT-- foo: bar, foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test index 800c262e7905c8fd8e3e49ba67c9b27c85f95720..1ad368bf1e1b30d329656292140be931a75fac41 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test @@ -4,4 +4,4 @@ macro with varargs argument {% macro test(varargs) %} {% endmacro %} --EXCEPTION-- -Twig_Error_Syntax: The argument "varargs" in macro "test" cannot be defined because the variable "varargs" is reserved for arbitrary arguments in "index.twig" at line 2. +Twig\Error\SyntaxError: The argument "varargs" in macro "test" cannot be defined because the variable "varargs" is reserved for arbitrary arguments in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test index 685626f2aca45cd6343a585ded458150035cad8e..96064ba0123b9c40f9a51e8819d31f503a8f82b4 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test @@ -9,6 +9,6 @@ macro with a filter {{ test.test() }} --DATA-- -return array(); +return [] --EXPECT-- foo<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/block_names_unicity.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/block_names_unicity.test index 40c067391f1127578b434e7fc6637c8b3d61ab7d..df0747072430fd6b44ddc97defe77da41b9fdc2c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/block_names_unicity.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/block_names_unicity.test @@ -13,7 +13,7 @@ Block names are unique per template {% endfilter %} {% block content %}{% endblock %} --DATA-- -return array(); +return [] --EXPECT-- First Second diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test index ff977ad62718008246dd582c372de876e32e96a8..6426d2c1d858d94b68092e529dd567dd3720c730 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test @@ -10,6 +10,6 @@ index foo {{ foo.bar }} --DATA-- -return array('foo' => 'foo'); +return ['foo' => 'foo'] --EXCEPTION-- -Twig_Error_Runtime: Impossible to access an attribute ("bar") on a string variable ("foo") in "foo" at line 3. +Twig\Error\RuntimeError: Impossible to access an attribute ("bar") on a string variable ("foo") in "foo" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test index 65f6cd2b8618fb7a9ccb0723f509489598f0bd8c..25bdc9e407c86c929ae79865d0036cf0e164c75e 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test @@ -3,6 +3,6 @@ Twig outputs 0 nodes correctly --TEMPLATE-- {{ foo }}0{{ foo }} --DATA-- -return array('foo' => 'foo') +return ['foo' => 'foo'] --EXPECT-- foo0foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test index ff7c8bb70454113bf8a316813ba8aa5c05c10d59..e2ab950e18353e45d656ff5dc7bdb3e80bf3c424 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test @@ -8,7 +8,7 @@ class House const REGION_S = 1; const REGION_P = 2; - public static $regionChoices = array(self::REGION_S => 'house.region.s', self::REGION_P => 'house.region.p'); + public static $regionChoices = [self::REGION_S => 'house.region.s', self::REGION_P => 'house.region.p']; public function getRegionChoices() { @@ -18,6 +18,6 @@ class House $object = new House(); $object->region = 1; -return array('object' => $object) +return ['object' => $object] --EXPECT-- house.region.s diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test index 269a30571d6acee82d1759ea62e205bbf6ce7fa5..96ca5517a144ff79a17e2b3400a67fc4f03a24a9 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test @@ -4,7 +4,7 @@ Twig allows multi-word tests without a custom node class {{ 'foo' is multi word ? 'yes' : 'no' }} {{ 'foo bar' is multi word ? 'yes' : 'no' }} --DATA-- -return array() +return [] --EXPECT-- no yes diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test index 60c3c51d71188a56acce4626a1bf34b3c77bd6fb..b6e62c8d7e15e67724ebcc28b3850119d6ca99a3 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test @@ -10,7 +10,7 @@ Hello '{{ images.image.0.group }}'! - {{ image.group }} {% endfor %} --DATA-- -return array('images' => new SimpleXMLElement('<images><image><group myattr="example">foo</group></image><image><group>bar</group></image></images>')) +return ['images' => new \SimpleXMLElement('<images><image><group myattr="example">foo</group></image><image><group>bar</group></image></images>')] --EXPECT-- Hello 'foo'! example diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test index e18e110792db3460edeb941a13c62580d318d800..62fe884858740eba24d41661de3486f14538a23a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test @@ -3,6 +3,6 @@ Twig does not confuse strings with integers in getAttribute() --TEMPLATE-- {{ hash['2e2'] }} --DATA-- -return array('hash' => array('2e2' => 'works')) +return ['hash' => ['2e2' => 'works']] --EXPECT-- works diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test index 2f6a3e1a06483886143646e6c03967b126cd07a3..5979725e38d6769695462823add2ee9ea74bb2cf 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test @@ -17,7 +17,7 @@ {{ var }}<br /> {% endautoescape %} --DATA-- -return array('var' => '<br />') +return ['var' => '<br />'] --EXPECT-- <br /><br /> <br /><br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test index 05ab83ce39e3e1f0234162fcb3848033b048ff9b..292e1b4167cef9a545ba9d894b9a153a548b05df 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test @@ -7,6 +7,6 @@ {% endblock %} {% endautoescape %} --DATA-- -return array('var' => '<br />') +return ['var' => '<br />'] --EXPECT-- <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test index 9c0972462b3d3241c5a18b6189731620cbe87d4d..1724b48787fcfdc979f3c5968b4154ade8c88611 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test @@ -5,6 +5,6 @@ {{ var|escape }} {% endautoescape %} --DATA-- -return array('var' => '<br />') +return ['var' => '<br />'] --EXPECT-- <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test index ce7ea789ebb21c77e6b635a8e2bb72e1e2da6d85..170e7074edece9534552efa295a80b56f6be41d3 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test @@ -44,7 +44,7 @@ safe_br {% endautoescape %} --DATA-- -return array() +return [] --EXPECT-- autoescape false @@ -80,4 +80,4 @@ unsafe_br()|escape autoescape js safe_br -\x3Cbr\x20\x2F\x3E +\u003Cbr\u0020\/\u003E diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test index e389d4dd536db703938098edbca5cde7cceb79b6..1ed2bf35a3b3b33f3f702007822c8792e75cf55c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test @@ -23,7 +23,7 @@ {% endautoescape %} --DATA-- -return array() +return [] --EXPECT-- 1. Simple literal diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test index 798e6feaf0220100272c558ee7f461989f35224f..0d88c7e3a2e4779247e27882e7e8e26b22d3ad4e 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test @@ -15,7 +15,7 @@ {% endautoescape %} {{ var }} --DATA-- -return array('var' => '<br />') +return ['var' => '<br />'] --EXPECT-- <br /> <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test index e896aa41cadd2cf6430c86ab6afe9a7a97b7a3ad..9d959b22b4fa5018adcc6eda178812eb90c22b1d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test @@ -19,7 +19,7 @@ class UserForAutoEscapeTest return 'Fabien<br />'; } } -return array('user' => new UserForAutoEscapeTest()) +return ['user' => new UserForAutoEscapeTest()] --EXPECT-- Fabien<br /> fabien<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test index 9f1cedd3abf145ebdd09398aa7f4b7dd8aacb817..187327c8017be5fcaa9cebc00cb447b9e5dff126 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test @@ -5,6 +5,6 @@ {{ var|raw }} {% endautoescape %} --DATA-- -return array('var' => '<br />') +return ['var' => '<br />'] --EXPECT-- <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test index bbf1356e731cd7bcb86453d14e36a32d88ae95c1..289f2b1743327495d75982b0a084898f507df0f9 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.legacy.test @@ -5,7 +5,7 @@ {% autoescape true html %}{{ var }}{% endautoescape %} --DATA-- -return array('var' => '<br />"') +return ['var' => '<br />"'] --EXPECT-- -\x3Cbr\x20\x2F\x3E\x22 +\u003Cbr\u0020\/\u003E\u0022 <br />" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test index e496f60818ec6ef40af21d8a3c86a2d95f3f11d6..9a0137ee27ec67f8fcddafa411780aca1cee10f2 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test @@ -5,7 +5,7 @@ {% autoescape 'html' %}{{ var }}{% endautoescape %} --DATA-- -return array('var' => '<br />"') +return ['var' => '<br />"'] --EXPECT-- -\x3Cbr\x20\x2F\x3E\x22 +\u003Cbr\u0020\/\u003E\u0022 <br />" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test index 4f415201db1e45e066d13de18a740de2936726a1..9ae8d7bf9921e180caf80fc9c3e1874b388c6dab 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test @@ -39,20 +39,20 @@ escape types {% endautoescape %} --DATA-- -return array('msg' => "<>\n'\"") +return ['msg' => "<>\n'\""] --EXPECT-- 1. autoescape 'html' |escape('js') -<a onclick="alert("\x3C\x3E\x0A\x27\x22")"></a> +<a onclick="alert("\u003C\u003E\n\u0027\u0022")"></a> 2. autoescape 'html' |escape('js') -<a onclick="alert("\x3C\x3E\x0A\x27\x22")"></a> +<a onclick="alert("\u003C\u003E\n\u0027\u0022")"></a> 3. autoescape 'js' |escape('js') -<a onclick="alert("\x3C\x3E\x0A\x27\x22")"></a> +<a onclick="alert("\u003C\u003E\n\u0027\u0022")"></a> 4. no escape @@ -61,9 +61,9 @@ return array('msg' => "<>\n'\"") 5. |escape('js')|escape('html') -<a onclick="alert("\x3C\x3E\x0A\x27\x22")"></a> +<a onclick="alert("\u003C\u003E\n\u0027\u0022")"></a> 6. autoescape 'html' |escape('js')|escape('html') -<a onclick="alert("\x3C\x3E\x0A\x27\x22")"></a> +<a onclick="alert("\u003C\u003E\n\u0027\u0022")"></a> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test index 7821a9aafd7e06a11dcb84879a01ac16e7ac94fc..f97105bbd1b009a7f2f08d4c6f1d2d9d66df9553 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test @@ -61,7 +61,7 @@ {% endautoescape %} --DATA-- -return array('var' => "<Fabien>\nTwig") +return ['var' => "<Fabien>\nTwig"] --EXPECT-- (escape_and_nl2br is an escaper filter) diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test index f58a1e09c69a616de7d3784356c95f0a0ba6301a..50f72d83a1ee7888446673bdb7c722ecb2571dc8 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test @@ -9,7 +9,7 @@ {{ var|nl2br(sep|escape) }} {% endautoescape %} --DATA-- -return array('var' => "<Fabien>\nTwig", 'sep' => '<br />') +return ['var' => "<Fabien>\nTwig", 'sep' => '<br />'] --EXPECT-- <Fabien><br /> Twig diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test index 134c77ea815b4f39c1c9a22b1ffe462e0d89470a..c9c738055dfcef96e635fa6f75b84c97bf7d43ce 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test @@ -31,7 +31,7 @@ {% endautoescape %} --DATA-- -return array('var' => "<Fabien>\nTwig") +return ['var' => "<Fabien>\nTwig"] --EXPECT-- (nl2br is pre_escaped for "html" and declared safe for "html") diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test index 32d3943b5733464303ddf11187c4bba4cb70fb0a..c764d434b099903c4347838017a69d15f43c853a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test @@ -23,7 +23,7 @@ {% endautoescape %} --DATA-- -return array('var' => "<Fabien>\nTwig") +return ['var' => "<Fabien>\nTwig"] --EXPECT-- (preserves_safety is preserving safety for "html") diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test index 360dcf0302ee2f66929f5237e61bbeafbb8995cb..988b09ce863a8a22883d1bf03222508a1fb78a1b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test @@ -6,6 +6,6 @@ --TEMPLATE(foo.twig)-- {% block content %}{% endblock %} --DATA-- -return array('foo' => 'bar') +return ['foo' => 'bar'] --EXPECT-- FOObar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test index bc89ec820258ef1821f789cf04035077da58c1e4..3009f8b4201eb5f6f0d859f85bbd92d7e8ed5d4a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test @@ -6,6 +6,6 @@ {% endblock %} {% endblock %} --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Syntax: The block 'content' has already been defined line 2 in "index.twig" at line 3. +Twig\Error\SyntaxError: The block 'content' has already been defined line 2 in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test index be17fedf3721c1f4446aa9077c5f5c7907c47823..e8e240eb77e0d35a4e2055863f9755962b150273 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test @@ -5,6 +5,6 @@ § {% endblock § %} --DATA-- -return array() +return [] --EXPECT-- § diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/block.legacy.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/block.legacy.test new file mode 100644 index 0000000000000000000000000000000000000000..53729dd1f70043190c05037a6e4f26be70d288f2 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/block.legacy.test @@ -0,0 +1,20 @@ +--TEST-- +Deprecating a block with "deprecated" tag +--TEMPLATE-- +{% use 'greeting.twig' %} + +{{ block('welcome') }} + +--TEMPLATE(greeting.twig)-- +{% block welcome %} + {% deprecated 'The "welcome" block is deprecated, use "hello" instead.' %} + {{ block('hello') }} +{% endblock %} + +{% block hello %} +Hello Fabien +{% endblock %} +--DATA-- +return [] +--EXPECT-- + Hello Fabien diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/macro.legacy.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/macro.legacy.test new file mode 100644 index 0000000000000000000000000000000000000000..5cc48dd873baf587edf45a579d4d43bf44181e60 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/macro.legacy.test @@ -0,0 +1,21 @@ +--TEST-- +Deprecating a macro with "deprecated" tag +--TEMPLATE-- +{% import 'greeting.twig' as greeting %} + +{{ greeting.welcome('Fabien') }} + +--TEMPLATE(greeting.twig)-- +{% macro welcome(name) %} + {% deprecated 'The "welcome" macro is deprecated, use "hello" instead.' %} + {% import _self as self %} + {{ self.hello(name) }} +{% endmacro %} + +{% macro hello(name) %} +Hello {{ name }} +{% endmacro %} +--DATA-- +return [] +--EXPECT-- + Hello Fabien diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/template.legacy.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/template.legacy.test new file mode 100644 index 0000000000000000000000000000000000000000..7f786d57fc3555b7bbe8834d413e8d3a9a52ebda --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/deprecated/template.legacy.test @@ -0,0 +1,12 @@ +--TEST-- +Deprecating a template with "deprecated" tag +--TEMPLATE-- +{% extends 'greeting.twig' %} + +{% deprecated 'The "index.twig" template is deprecated, use "greeting.twig" instead.' %} +--TEMPLATE(greeting.twig)-- +Hello Fabien +--DATA-- +return [] +--EXPECT-- +Hello Fabien diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test index f44296ea01740d4f86a41f2b95aea4034f275ef4..16781e4186abdf2554d885b620d2326fb26ee290 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test @@ -21,7 +21,7 @@ B {% endblock %} C --DATA-- -return array() +return [] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test index de5ea7eea3d8c5530f32ed091382b1eab9e73a62..b799a8c95f8cc2ec4898b51f1acf8c20e91ee92b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test @@ -21,7 +21,7 @@ B {% endblock %} C --DATA-- -return array('foo' => 'foo') +return ['foo' => 'foo'] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test index 2a125e6b588b06e36b213ee71d40756e4211258d..6f0879e28dce54d1f44db6e235cd5714138b0a16 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test @@ -21,7 +21,7 @@ B {% endblock %} C --DATA-- -return array('foo' => 'foo.twig') +return ['foo' => 'foo.twig'] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test index 431473707b7267d627c71babeb7402e93d2ef19e..b1c6c85e6112d165b81436eb39d9ff2c04854c01 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test @@ -11,6 +11,6 @@ BAR --TEMPLATE(foo.twig)-- {% block c1 %}{% endblock %} --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Runtime: Variable "nothing" does not exist in "index.twig" at line 5. +Twig\Error\RuntimeError: Variable "nothing" does not exist in "index.twig" at line 5. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test index da161e6d4387737fa7836d33d32b52f30fff6c03..9f7b52f1d827be751059a540e9db446576505363 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test @@ -28,7 +28,7 @@ B {% endblock %} C --DATA-- -return array() +return [] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test index 81563dcef7a2c9a15fdf1f68f539ccde85eee1b2..9f33723366d939962e855d2b666ff6bf60ced730 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test @@ -24,7 +24,7 @@ B {% endblock %} C --DATA-- -return array() +return [] --EXPECT-- A block1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test index 2c1dd584cbb011f72f1dd9a4a32c51b927aed1f0..ce726ac00927ec91b137dc66ed42ef35736732e9 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test @@ -39,7 +39,7 @@ B {% endblock %} C --DATA-- -return array() +return [] --EXPECT-- A blockc1base diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test index 82094f2f02c76cfc9927fb7b5c32ff4bb90f11ce..866171ecc5ded2e1b14df5fa9cc1a9f06108f80c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test @@ -5,6 +5,6 @@ Some text with a {{ var }} {% endfilter %} --DATA-- -return array('var' => 'var') +return ['var' => 'var'] --EXPECT-- SOME TEXT WITH A VAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test index 3e7148bf41ba5dc73c2a5af630dff1247714aa49..a2562b995be01b417994f6b5a83d61f5ba2fb4d6 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test @@ -3,6 +3,6 @@ --TEMPLATE-- {% filter json_encode|raw %}test{% endfilter %} --DATA-- -return array() +return [] --EXPECT-- "test" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test index 75512ef96564f1571e234f706b7e3cf5f72aa105..8eb3cbdd7d28e8f76fbfe99e7ed7eda4976e1c8d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test @@ -5,6 +5,6 @@ {{ var }} {% endfilter %} --DATA-- -return array('var' => 'VAR') +return ['var' => 'VAR'] --EXPECT-- Var diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test index 7e4e4eb33b2f6017b06d6b3a72713db931142b59..6d18e1af08cbdf35d8cd9b2150a9deea24f504e8 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test @@ -9,7 +9,7 @@ {{ var }} {% endfilter %} --DATA-- -return array('var' => 'var') +return ['var' => 'var'] --EXPECT-- Var Var diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test index 22745eadf322441a89be879b1472db6af6ff8a79..d2d87cfda38a9d847e882d8ac7335a897fdd1fed 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test @@ -7,7 +7,7 @@ {% endfor %} {% endfilter %} --DATA-- -return array('items' => array('a', 'b')) +return ['items' => ['a', 'b']] --EXPECT-- A B diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test index afd95b2962198c39cec93ef15a4e57be976283f1..f2e804bfb105bff4875fa50af30fb0362424e897 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test @@ -20,7 +20,7 @@ FOO {% endfilter %} --DATA-- -return array('items' => array('a', 'b')) +return ['items' => ['a', 'b']] --EXPECT-- A, B diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test index 380531f7809ee0ab546b609bc26ba140e41eeebc..b1ad22fd53fa11e82b50fca04a53ce013e99c342 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test @@ -5,9 +5,9 @@ {{ loop.index }}.{{ i }}{{ foo.bar }} {% endfor %} --DATA-- -return array('foo' => array('bar' => 'X')) +return ['foo' => ['bar' => 'X']] --CONFIG-- -return array('strict_variables' => false) +return ['strict_variables' => false] --EXPECT-- 1.1X 2.3X diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test index ddc69307b33c8163025eaa3bf45ad1bdd6f6437c..3cdd575c83e68113802756b381fb478e456adcdc 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test @@ -8,7 +8,7 @@ * {{ item }} {% endfor %} --DATA-- -return array('items' => array('a', 'b')) +return ['items' => ['a', 'b']] --EXPECT-- * a * b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test index 20ccc880c5ed97188dd51277714e9045206a7439..86ec9c28d3ea952d83306579e24b54c91eb75799 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test @@ -7,17 +7,17 @@ no item {% endfor %} --DATA-- -return array('items' => array('a', 'b')) +return ['items' => ['a', 'b']] --EXPECT-- * a * b --DATA-- -return array('items' => array()) +return ['items' => []] --EXPECT-- no item --DATA-- -return array() +return [] --CONFIG-- -return array('strict_variables' => false) +return ['strict_variables' => false] --EXPECT-- no item diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test index 49fb9ca6f6f4b88b02b5bc4b0ed7cd685ef82567..e1ad3c73567c9756719329b441ceaacc32422325 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test @@ -7,7 +7,7 @@ {% endfor %} {% endfor %} --DATA-- -return array('k' => 0) +return ['k' => 0] --EXPECT-- 0 1 1 1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test index 4e22cb473f9ccce9be856b1197ca709440a0365c..92135575f630427fad458861536d0f2dec292ea9 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test @@ -5,7 +5,7 @@ * {{ key }} {% endfor %} --DATA-- -return array('items' => array('a', 'b')) +return ['items' => ['a', 'b']] --EXPECT-- * 0 * 1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test index 4c211689d7ecf37c8e7ede916df0928928aa356c..ab39ddf210c31e8b4ceb9e9c1c00d8d95e47c7a3 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test @@ -5,7 +5,7 @@ * {{ key }}/{{ item }} {% endfor %} --DATA-- -return array('items' => array('a', 'b')) +return ['items' => ['a', 'b']] --EXPECT-- * 0/a * 1/b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test index 93bc76a1f80596e357d8273eafee792618261642..56a60c2e6eefe1922e1b25940645964d9dd95dbb 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test @@ -8,7 +8,7 @@ {% endfor %} --DATA-- -return array('items' => array('a', 'b')) +return ['items' => ['a', 'b']] --EXPECT-- * 1/0 * 2/1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test index 58af2c3269ee66e447e244880c06176302546a36..58e5a9b34511fbaa64f350192a38ab8f07704830 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test @@ -5,6 +5,6 @@ {% endfor %} {% if loop is not defined %}WORKS{% endif %} --DATA-- -return array('items' => array()) +return ['items' => []] --EXPECT-- WORKS diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test index 6a2af63b617e7b4e7127f3cfda599698b3757064..2d8c0b87389f7f8dc67ab6e6e1e13d77a48a2dee 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test @@ -5,6 +5,6 @@ {{ loop.last }} {% endfor %} --DATA-- -return array('items' => array('a', 'b')) +return ['items' => ['a', 'b']] --EXCEPTION-- -Twig_Error_Syntax: The "loop.last" variable is not defined when looping with a condition in "index.twig" at line 3. +Twig\Error\SyntaxError: The "loop.last" variable is not defined when looping with a condition in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test index 1e819ca0a135f16ed3540e350b3218cc1a6d43b3..e90e96b4ae2b6502e469b1c6f35561f7c107337f 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test @@ -4,6 +4,6 @@ {% for i, item in items if loop.last > 0 %} {% endfor %} --DATA-- -return array('items' => array('a', 'b')) +return ['items' => ['a', 'b']] --EXCEPTION-- -Twig_Error_Syntax: The "loop" variable cannot be used in a looping condition in "index.twig" at line 2. +Twig\Error\SyntaxError: The "loop" variable cannot be used in a looping condition in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test index f8b9f6bc181cbe01ada06ed49db757a9e734be97..df1bb07ac04a81ea22e3b55c493f020f2b3988e8 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test @@ -11,7 +11,7 @@ no item1 {% endfor %} --DATA-- -return array('items' => array('a', 'b'), 'items1' => array()) +return ['items' => ['a', 'b'], 'items1' => []] --EXPECT-- no a no b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test index 5034437921563a5a3cb8acce1d46c73a9f054a59..2ba2d92c2cc2bc8ecc4a8a9adb6d8b309d806f39 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test @@ -18,14 +18,14 @@ --DATA-- class ItemsIterator implements Iterator { - protected $values = array('foo' => 'bar', 'bar' => 'foo'); + protected $values = ['foo' => 'bar', 'bar' => 'foo']; public function current() { return current($this->values); } public function key() { return key($this->values); } public function next() { return next($this->values); } public function rewind() { return reset($this->values); } public function valid() { return false !== current($this->values); } } -return array('items' => new ItemsIterator()) +return ['items' => new ItemsIterator()] --EXPECT-- * bar * 1/0 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test index 4a1ff6119088a6f399eb0fb100e48cd2ad2fb3ac..99146bde36fd3845993997a87ce0fc85d07dbcd6 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test @@ -17,9 +17,9 @@ * {{ key }} {% endfor %} --DATA-- -class ItemsIteratorCountable implements Iterator, Countable +class ItemsIteratorCountable implements Iterator, \Countable { - protected $values = array('foo' => 'bar', 'bar' => 'foo'); + protected $values = ['foo' => 'bar', 'bar' => 'foo']; public function current() { return current($this->values); } public function key() { return key($this->values); } public function next() { return next($this->values); } @@ -27,7 +27,7 @@ class ItemsIteratorCountable implements Iterator, Countable public function valid() { return false !== current($this->values); } public function count() { return count($this->values); } } -return array('items' => new ItemsIteratorCountable()) +return ['items' => new ItemsIteratorCountable()] --EXPECT-- * bar * 1/0 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test index 17b2e222390d9906cb93cb558c76e74dda9e2a50..3b677d60ffb9a3be25aa27fcf5d83359b8c05621 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test @@ -8,7 +8,7 @@ {% endfor %} {% endfor %} --DATA-- -return array('items' => array('a' => array('a1', 'a2', 'a3'), 'b' => array('b1'))) +return ['items' => ['a' => ['a1', 'a2', 'a3'], 'b' => ['b1']]] --EXPECT-- * a (2): * a1 (3) diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test index 82f2ae8a44d43e33f39796d5a01a3408fbb6d051..384c41b288678702d6dc8688b2de55fe50d0bdf5 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test @@ -5,7 +5,7 @@ * {{ item }} {% endfor %} --DATA-- -return array('items' => array('a', 'b')) +return ['items' => ['a', 'b']] --EXPECT-- * a * b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test index 5f5da0ec158f1369f4987cfc9a4b40f630556de7..1d3c9e2b58ccb8a884256ee3c6cea9133944d705 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test @@ -9,6 +9,6 @@ global variables called foobar {% endmacro %} --DATA-- -return array(); +return [] --EXPECT-- called foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test index c1c3d27681fc80b0ea4b2eebceba54529a2c6f68..a02165e539e92943f2363462e27802679f6add87 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test @@ -9,14 +9,14 @@ NOTHING {% endif %} --DATA-- -return array('a' => 'a') +return ['a' => 'a'] --EXPECT-- a --DATA-- -return array('b' => 'b') +return ['b' => 'b'] --EXPECT-- b --DATA-- -return array() +return [] --EXPECT-- NOTHING diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test index edfb73df4fecf7c2c7b025d64ef1bc67e664cd92..eb65083c615e01d80a01056ddf5b988c9911e499 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test @@ -9,14 +9,14 @@ A3 {% endif %} --DATA-- -return array('a' => 1) +return ['a' => 1] --EXPECT-- A1 --DATA-- -return array('a' => 12) +return ['a' => 12] --EXPECT-- A2 --DATA-- -return array('a' => 7) +return ['a' => 7] --EXPECT-- A3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test index 8fe1a6c1355b7daa7e04f417bdd7ccf6ac125c91..9982b039d02ee8bfbfe88050150932ac46408673 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test @@ -8,7 +8,7 @@ BAR --TEMPLATE(foo.twig)-- FOOBAR --DATA-- -return array() +return [] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test index eaeeb112e95fbb02bb8c42cad4b8a7db46b20ca3..23db181238909af98abaa2138ab73fa01ca8cd90 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test @@ -8,7 +8,7 @@ BAR --TEMPLATE(foo.twig)-- FOOBAR --DATA-- -return array('foo' => 'foo.twig') +return ['foo' => 'foo.twig'] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test index 24aed06de2c110ced37d2ec4b4e96cfa8304ee40..6c8bdb1e92b37a6ca6c96be98219caf09ed8d74e 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test @@ -6,5 +6,5 @@ {% include "foo.twig" ignore missing with {} %} {% include "foo.twig" ignore missing with {} only %} --DATA-- -return array() +return [] --EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test index f25e8715517bae404a6d30a0feb5fe7fbd534631..ac72838e8493e65fbddf4658fe19b89bb0278bcd 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test @@ -3,6 +3,6 @@ --TEMPLATE-- {% include "foo.twig" %} --DATA-- -return array(); +return [] --EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "index.twig" at line 2. +Twig\Error\LoaderError: Template "foo.twig" is not defined in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test index 86c1864446859fb542a7aa660cad72fbc1a37cbd..0ee51b78622a90580798a17ff4c7174c66245776 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test @@ -11,6 +11,6 @@ {% include "foo.twig" %} {% endblock %} --DATA-- -return array(); +return [] --EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "base.twig" at line 3. +Twig\Error\LoaderError: Template "foo.twig" is not defined in "base.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test index 77760a09eb9ffb6f14cea8cf2f7edff510f89ee2..d595f8061be9202e0c14029f866e4a6eb6714ace 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test @@ -8,7 +8,7 @@ --TEMPLATE(foo.twig)-- {% for k, v in _context %}{{ k }},{% endfor %} --DATA-- -return array('foo' => 'bar') +return ['foo' => 'bar'] --EXPECT-- foo,global,_parent, global,_parent, diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test index 6ba064a388398b221795bd17eb3c38d1269426a9..4fb862a175c195b7d747194cafc75646c18c2636 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test @@ -1,10 +1,10 @@ --TEST-- -"include" tag accepts Twig_Template instance +"include" tag accepts \Twig\TemplateWrapper instance --TEMPLATE-- {% include foo %} FOO --TEMPLATE(foo.twig)-- BAR --DATA-- -return array('foo' => $twig->loadTemplate('foo.twig')) +return ['foo' => $twig->load('foo.twig')] --EXPECT-- BAR FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test index ab670ee06d049467103d04f9373500fdcadf07a8..38063952d41aa60a74e5318e43bedf1cb0d0b7d2 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test @@ -6,7 +6,7 @@ --TEMPLATE(foo.twig)-- foo --DATA-- -return array() +return [] --EXPECT-- foo foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test index 41384ac7c4a30d43ef8f80281479f4d1415cbb3e..3b192aeb2640ee0ed788c3a373f6f04f62a9948b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test @@ -6,7 +6,7 @@ --TEMPLATE(foo.twig)-- {{ foo }} --DATA-- -return array('vars' => array('foo' => 'bar')) +return ['vars' => ['foo' => 'bar']] --EXPECT-- bar bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test index 0778a4b49be13516b2e1f0db9e1c16d93d8230cb..703b61be176557b82a769ecc098c2d8e1c1e0eff 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test @@ -9,6 +9,6 @@ FOO --TEMPLATE(foo.twig)-- {% block content %}{% endblock %} --DATA-- -return array() +return [] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test index 9a81499ab3cd56a3071712f3144132fe657b76e5..0b82d4cf2ddb24de10ba92a8162d812fe36001af 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test @@ -8,7 +8,6 @@ block_expr {{- parent() -}} {% endblock %} --TEMPLATE(base.twig)-- -{% spaceless %} {% block element -%} <div> {%- if item.children is defined %} @@ -18,15 +17,14 @@ block_expr {%- endif -%} </div> {%- endblock %} -{% endspaceless %} --DATA-- -return array( - 'item' => array( - 'children' => array( +return [ + 'item' => [ + 'children' => [ null, null, - ) - ) -) + ] + ] +] --EXPECT-- Element:<div>Element:<div></div>Element:<div></div></div> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test index 3e868c0da7d51df9b873d1d11d9a22d88b698e5e..18f6604113e8650b79a26c19a893fed8115b544c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test @@ -10,7 +10,6 @@ block_expr2 --TEMPLATE(base2.twig)-- {% extends "base.twig" %} --TEMPLATE(base.twig)-- -{% spaceless %} {% block element -%} <div> {%- if item.children is defined %} @@ -20,15 +19,14 @@ block_expr2 {%- endif -%} </div> {%- endblock %} -{% endspaceless %} --DATA-- -return array( - 'item' => array( - 'children' => array( +return [ + 'item' => [ + 'children' => [ null, null, - ) - ) -) + ] + ] +] --EXPECT-- Element:<div>Element:<div></div>Element:<div></div></div> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test index 8576e773a9f9cced374b2e79e15539dae290344e..bd28248d137731dd99d25b0dad05ba6124e535cc 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test @@ -9,6 +9,6 @@ --TEMPLATE(bar.twig)-- {% block content %}BAR{% endblock %} --DATA-- -return array('foo' => 'foo.twig', 'standalone' => true) +return ['foo' => 'foo.twig', 'standalone' => true] --EXPECT-- FOOFOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test index ee06ddce31184fd2f969b6df7dd64806fc6b766d..e6a0f017280fa58e20d22ba45026e5401f14897d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test @@ -9,6 +9,6 @@ FOO --TEMPLATE(foo.twig)-- {% block content %}{% endblock %} --DATA-- -return array('foo' => 'foo.twig') +return ['foo' => 'foo.twig'] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test index 784f35718c95dd5798948d26ffd203223d5e6287..ca11bf20d1b2109d22c9a779ae7d55890a6c1f7e 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test @@ -5,6 +5,6 @@ --TEMPLATE(foo.twig)-- {% block content %}FOO{% endblock %} --DATA-- -return array() +return [] --EXPECT-- FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test index a1cb1ce8a34541bf86e2c7b62f0d798a2224fa78..4d2cb6c65724d30c3d95ddc27388a124329377b3 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test @@ -7,6 +7,6 @@ foo {% endblock %} --DATA-- -return array() +return [] --EXPECT-- foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test index acc74f6a148dacc741a06ff757ed05508c25b478..5108651103bcb5b4954e538559529e5c1d050b59 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test @@ -7,6 +7,6 @@ foo {% endblock %} --DATA-- -return array() +return [] --EXPECT-- foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test index cfa648d419ea8255a28b22da69457cafba4c54c0..c5ee6f193b7d77a47eaa23cbcc378d17cfd6e72a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test @@ -7,6 +7,6 @@ foo {% endblock %} --DATA-- -return array() +return [] --EXPECT-- foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test index dfc2b6c4943b0f717b480fce87e9a72daaf41fb3..fc25badd34f1d4c35dacd728d2ee8c471b62e9aa 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test @@ -7,6 +7,6 @@ --TEMPLATE(base.twig)-- {% block content %}base {% endblock %} --DATA-- -return array() +return [] --EXPECT-- base layout index diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test index 1d3e639ca0b06cea01dacdfae9e1b4ce1e0affb7..fa887177bd31aca407c2385fdabb74d1d0079479 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test @@ -13,7 +13,7 @@ --TEMPLATE(2_parent.twig)-- {% block content %}2{% endblock %} --DATA-- -return array() +return [] --EXPECT-- 1 parent diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test index faca92591391b8b260974ec2f9759f8ff4d8cecc..abea2e9d4730ba1aad960001d8efd72ef361d757 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test @@ -17,6 +17,6 @@ {% endblock %} {% endblock %} --DATA-- -return array() +return [] --EXPECT-- SUBSUBCONTENT diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test index 0ad11d0c025e27af1e18f177be38f18760a4f71e..20b7848f8d329776d1c8d2d40b775852c4ce6aaa 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test @@ -10,6 +10,6 @@ {% endblock %} --TEMPLATE(foo.twig)-- --DATA-- -return array() +return [] --EXPECT-- CONTENTSUBCONTENTENDCONTENT diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test index 71e3cdfd4f90af5f5db089df5034e13159fcb990..0b585b4809cbeba1935d04ea2080edee72aa7774 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test @@ -11,6 +11,6 @@ --TEMPLATE(base.twig)-- {% block body '' %} --DATA-- -return array() +return [] --EXPECT-- INSIDE diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test index 4f975db80d4c96383fa3fca132bc84b8bb1363ac..73f4c0ec5eb54b323b3e4cbb81cd964abf541792 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test @@ -7,6 +7,6 @@ --TEMPLATE(foo.twig)-- {% block content %}BAR{% endblock %} --DATA-- -return array() +return [] --EXPECT-- BARFOOBAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_as_template_wrapper.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_as_template_wrapper.test new file mode 100644 index 0000000000000000000000000000000000000000..1aaed556c5761bfe4f6032cb9a717f4d6472fb08 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_as_template_wrapper.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag with a parent as a Twig_TemplateWrapper instance +--TEMPLATE-- +{% extends foo %} + +{% block content %}New{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}Default{% endblock %} +--DATA-- +return ['foo' => $twig->load('foo.twig')] +--EXPECT-- +New diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test index a8bc90cefd171fcb08e10bb58e3c676cddab9adb..01bd544f83c21e00b76fe7695ad18b767fe1c8b0 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test @@ -7,10 +7,10 @@ FOO --TEMPLATE(bar.twig)-- BAR --DATA-- -return array('foo' => true) +return ['foo' => true] --EXPECT-- FOO --DATA-- -return array('foo' => false) +return ['foo' => false] --EXPECT-- BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test index cca6dbc9b86b692e2eac84a4a9fb621ff0df4af4..1d1987d5b9987b655d07b4afd3f38ee62bfffcd0 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test @@ -5,4 +5,4 @@ {% extends "foo.twig" %} {% endblock %} --EXCEPTION-- -Twig_Error_Syntax: Cannot extend from a block in "index.twig" at line 3. +Twig\Error\SyntaxError: Cannot extend from a block in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test index 628167135220e187538de97cf354429bba7f1e6d..58a37bd9021a6b4ad58d4155f26b4136d4665ecb 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test @@ -13,7 +13,7 @@ {% block footer %}Default Footer{% endblock %} --DATA-- -return array() +return [] --EXPECT-- Included Content Default Footer diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test index 71e7c2080ab29ea47c3edd2f179a6e1456978f4b..d4347bac4f8b4bd54c154bd2d4b12218652657d4 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test @@ -17,7 +17,7 @@ BAR {% endblock %} --DATA-- -return array() +return [] --EXPECT-- INSIDE OVERRIDDEN diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test index e29b1ac4b5bb73177b019ef2f517b7f2843b4e6b..6d98891553d07630f4cb015f23c73bb12ae8b954 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test @@ -5,4 +5,4 @@ {{ parent() }} {% endblock %} --EXCEPTION-- -Twig_Error_Syntax: Calling "parent" on a template that does not extend nor "use" another template is forbidden in "index.twig" at line 3. +Twig\Error\SyntaxError: Calling "parent" on a template that does not extend nor "use" another template is forbidden in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test index 63c730550b8bb5d99be0d51b32b579fe60d9a051..39882b8b39d3714e35d1a87eca28505e97742ffd 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test @@ -9,6 +9,6 @@ --TEMPLATE(foo.twig)-- {% block content %}BAR{% endblock %} --DATA-- -return array() +return [] --EXPECT-- BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test index d1876a52df6546918df18ece470fdc4159f448c2..a5a223886dc640742a579ff9326c3c061b6e4b5c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test @@ -9,6 +9,6 @@ --TEMPLATE(foo.twig)-- {% block content %}BAR{% endblock %} --DATA-- -return array('foo' => $twig->loadTemplate('foo.twig')) +return ['foo' => $twig->load('foo.twig')] --EXPECT-- BARFOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test index 8f9ece7ce91f8170ac96b28a534bb1b342386e46..4df32ee9d3f24b8d0aecc96f843adec898c36d58 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test @@ -35,7 +35,7 @@ {% block content_use2 'content_use2' %} {% block content_use2_only 'content_use2_only' %} --DATA-- -return array() +return [] --EXPECT-- content_parent content_use1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test index eef0c10d591a7607b669762ce718d1a5a20f390c..ae090f9a06911e925230150cc5294e874e0f44fe 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test @@ -10,7 +10,7 @@ <input type="{{ type|default("text") }}" name="{{ name }}" value="{{ value|e|default('') }}" size="{{ size|default(20) }}"> {% endmacro %} --DATA-- -return array() +return [] --EXPECT-- <input type="text" name="username" value="" size="20"> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test index ae6203bb64f2c547387a91fc370dedaf59a6c1d3..3f3caf7773b30878d21152a594d0efbb66dc096e 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test @@ -9,7 +9,7 @@ {% macro foo() %}foo{% endmacro %} {% macro bar() %}bar{% endmacro bar %} --DATA-- -return array() +return [] --EXPECT-- foo bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test index 5cd3dae66e662319e468af65bc7c75da5738392e..b28ca19f029ebe1f945cde0c8584197f0bb886b3 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test @@ -10,7 +10,7 @@ <input type="{{ type|default("text") }}" name="{{ name }}" value="{{ value|e|default('') }}" size="{{ size|default(20) }}"> {% endmacro %} --DATA-- -return array() +return [] --EXPECT-- <input type="text" name="username" value="" size="20"> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test index 205f59182aa9590865f00fb3fe577bf531239f2e..8b9aae87890f34e791425ac62b42bfcb743addd8 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test @@ -11,7 +11,7 @@ {% macro foo(name) %}foo{{ name }}{% endmacro %} {% macro bar(name) %}bar{{ name }}{% endmacro %} --DATA-- -return array() +return [] --EXPECT-- foofoo foofoo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test index 2de9765ff0398aa5ca23f6a596f4958e1af20a16..c844ae3b0b97bf59bf00bc19b6525b8fab501caa 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from_with_reserved_name.test @@ -4,6 +4,6 @@ {% from 'forms.twig' import templateName %} --TEMPLATE(forms.twig)-- --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Syntax: "templateName" cannot be an imported macro as it is a reserved keyword in "index.twig" at line 2. +Twig\Error\SyntaxError: "templateName" cannot be an imported macro as it is a reserved keyword in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test index 6b371768e0ac6e52e57d2e3d4dd66d945cf63d55..832740eac5612f57ea35e9ef0de43c0fb8162014 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test @@ -8,7 +8,7 @@ --TEMPLATE(forms.twig)-- {% macro foo(name) %}{{ name|default('foo') }}{{ global }}{% endmacro %} --DATA-- -return array() +return [] --EXPECT-- fooglobal fooglobal diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test index 7bd93c62dff6b45d82894b76a2672c6b6c7bbd7c..dc7a810015b5e9f1a847bf260e4c1fef250e1661 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_with_reserved_nam.test @@ -6,6 +6,6 @@ {{ macros.parent() }} --TEMPLATE(forms.twig)-- --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Syntax: "parent" cannot be called as macro as it is a reserved keyword in "index.twig" at line 4. +Twig\Error\SyntaxError: "parent" cannot be called as macro as it is a reserved keyword in "index.twig" at line 4. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test index f7c102f0292ff97420dc1d0111013c87c331b18b..e58dd7caccbc18162ac9e5ac56e3907d3dd09bcc 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/reserved_name.test @@ -5,6 +5,6 @@ parent {% endmacro %} --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Syntax: "parent" cannot be used as a macro name as it is a reserved keyword in "index.twig" at line 2. +Twig\Error\SyntaxError: "parent" cannot be used as a macro name as it is a reserved keyword in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test index 17756cb6c6a4449df36b98b3545276a8a985a08c..ca3157dd88451a0a605e7b16a2d45d2a9b90aa11 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test @@ -10,7 +10,7 @@ <input type="{{ type|default("text") }}" name="{{ name }}" value="{{ value|e|default('') }}" size="{{ size|default(20) }}"> {% endmacro %} --DATA-- -return array() +return [] --EXPECT-- <input type="text" name="username" value="" size="20"> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test index 3721770730d00cb5ede96b7849235ed71e291f62..491e91e80d70c1659455a13d72602bfe26c6a647 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test @@ -9,6 +9,6 @@ §{{ foo }}§ {% endmacro %} --DATA-- -return array() +return [] --EXPECT-- §foo§ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test index 5679462819dfb1d326142b10cdb88a5465bda74f..643697ce28cabfee458c56229a6b50d69c197361 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test @@ -9,6 +9,6 @@ Super globals as macro arguments {{ GET }} {% endmacro %} --DATA-- -return array() +return [] --EXPECT-- foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test index 0445e853057d489e36fdaddbb20c8899549aaf72..7875b2af72331d977a5cd9decb386c8c1686d028 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.legacy.test @@ -5,6 +5,6 @@ {{ foo }} {% endraw %} --DATA-- -return array() +return [] --EXPECT-- {{ foo }} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test index 99deefc32a6ac89c1d9cb1e75342a344432943b2..d4c8dd2cd1fc07fea17a0446ce6e078d864771d7 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/mixed_usage_with_raw.legacy.test @@ -5,6 +5,6 @@ {{ foo }} {% endverbatim %} --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Syntax: Unexpected end of file: Unclosed "raw" block in "index.twig" at line 2. +Twig\Error\SyntaxError: Unexpected end of file: Unclosed "raw" block in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test index 352bb1876e678a124e4d51a01f775e06a31b184a..11f42025e13d2c08680a017cd6a42a0a1d5815db 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.legacy.test @@ -37,7 +37,7 @@ 5*** --DATA-- -return array() +return [] --EXPECT-- 1*** {{ 'bla' }} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test index dfddc1513bb271b81d1bd0aa3591fcd9c3a8fc5d..e26a78bc1576df3d70fc79230ab2a2b52246573d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test @@ -8,4 +8,4 @@ sandbox tag --TEMPLATE(foo.twig)-- foo --EXCEPTION-- -Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 4. +Twig\Error\SyntaxError: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 4. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test index a33a13ee6e1e2d393cfd24d9ffc040c80437a7e5..bb2a329715aa20d74484396ef9afc9fa9b430279 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test @@ -11,4 +11,4 @@ sandbox tag --TEMPLATE(foo.twig)-- foo --EXCEPTION-- -Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 5. +Twig\Error\SyntaxError: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 5. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test index de20f3dba711923149ba8cc37ab401fc54812cfa..4d232d8bbd2447d00d79dcb7a0edc2c4a144ab1f 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test @@ -14,7 +14,7 @@ sandbox tag --TEMPLATE(foo.twig)-- foo --DATA-- -return array() +return [] --EXPECT-- foo foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test index a5a9f830ec5a3d93d9235b837ababbb96c061b3f..aae1427e8103cd7617a82c53b5d7e74ce29f9d08 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test @@ -11,7 +11,7 @@ {{ foo }}{{ bar }} --DATA-- -return array() +return [] --EXPECT-- foo foo<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test index ec657f0058a0bb8c5a86985ce389cd2a83abcee4..97fc43cc2ab57f7a01b0599776d5c06ab9a70c9d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test @@ -5,5 +5,5 @@ {% if foo %}FAIL{% endif %} --DATA-- -return array() +return [] --EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test index f156a1a7f3c3e0c8bb70c79a2b4a0d004ac7d0df..c3faf250038f5b20b6b7a175de4d332dcd2f0791 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test @@ -5,6 +5,6 @@ {{ foo }} --DATA-- -return array() +return [] --EXPECT-- f<br />o<br />o diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test index 8ff434a013c49d259f9939e18d0da06f42ce3f05..bd472771a66c69311c06a4d94ab227bec8e4aaae 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test @@ -6,7 +6,7 @@ {{ foo }} {{ bar }} --DATA-- -return array() +return [] --EXPECT-- foobar barfoo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test index dd06dec25a048b0ac6f14840b79cf4bcfd23b5f7..98bd27a13a7bf460c1e730ea8f2dcbc6a8e27434 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test @@ -7,6 +7,6 @@ {% endspaceless %} --DATA-- -return array() +return [] --EXPECT-- <div><div> foo </div></div> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test index 789b4ba8052fd30be3a2fd142161bf1ac7b0bd65..64ffd1d76bf70c56809c91c0435bea52b4b00f7c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test @@ -3,6 +3,6 @@ --TEMPLATE-- {% § %} --DATA-- -return array() +return [] --EXPECT-- § diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test index 1d2273f88a7e1420934e37125a82a9d76dab13f3..f1a1310ad95839bc11d5f39c936cf86e2fa6a508 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test @@ -51,7 +51,7 @@ Combined: end --DATA-- -return array('leading' => 'leading space', 'trailing' => 'trailing space', 'both' => 'both') +return ['leading' => 'leading space', 'trailing' => 'trailing space', 'both' => 'both'] --EXPECT-- 15 18 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test index f887006f666313f441db39ca7bd5a2332bff2f98..b6b1d5c668894281f540162e4e79409b19344438 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test @@ -7,6 +7,6 @@ --TEMPLATE(blocks.twig)-- {% block content 'foo' %} --DATA-- -return array() +return [] --EXPECT-- foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test index 7364d76de2de57f18872539958872af0b677141d..be622a10e20424baa57ea56cefbfa309eaa2541f 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test @@ -7,6 +7,6 @@ --TEMPLATE(blocks.twig)-- {% block content 'foo' %} --DATA-- -return array() +return [] --EXPECT-- foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test index b551a1e60d3ce6df7da0a6406401ce6cae04adc6..771ba642b905dfeefffe4ea2ec0d2111b6bd3039 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test @@ -15,7 +15,7 @@ {% block content 'bar' %} {% block bar 'bar' %} --DATA-- -return array() +return [] --EXPECT-- foo foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test index 05cca682effc589120c6f405fb4aab4b4862efbd..f14ce83de5e7e75b1a6eec7ddd620f710604b471 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test @@ -6,5 +6,5 @@ {% use "bar.twig" %} --TEMPLATE(bar.twig)-- --DATA-- -return array() +return [] --EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test index 0d0d470ee652701a4ab079e29e0831d02f6abb33..1edeaa1115d06f632796b8b80c216b1ff66fb801 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test @@ -19,7 +19,7 @@ <div class="sub_container">sub_container</div> {% endblock %} --DATA-- -return array() +return [] --EXPECT-- <div class="container"> <div class="overridden_sub_container">overridden sub_container</div> </div> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test index df95599ce15a6ae2f319dab13203a9e3477d16f6..accec5094b1aae0c68a0975ecc98135d31962c5a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test @@ -18,7 +18,7 @@ <div class="sub_container">sub_container</div> {% endblock %} --DATA-- -return array() +return [] --EXPECT-- <div class="container"> <div class="overridden_sub_container">overridden sub_container</div> </div> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test index 198be0c5cda3fa2ee55c590447225660fc604265..85a63958dfc46b6474f0a5c43c3d2d5a20476a40 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test @@ -14,7 +14,7 @@ {% block content 'bar' %} {% block bar 'bar' %} --DATA-- -return array() +return [] --EXPECT-- bar foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test index 8de871a8a55527255d7ade373fd5a260c9196e76..413bdfa4ddf33657c870cfaf2ae5edc05f207657 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test @@ -15,7 +15,7 @@ {% block content 'bar' %} {% block bar 'bar' %} --DATA-- -return array() +return [] --EXPECT-- bar foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test index 59db23d955f975072776a3a42c8b6d69d14fcfe7..49328f6e87b0bca7d4f14b8ca8acf6df16740c43 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test @@ -17,7 +17,7 @@ Content of block {% endblock foobar %} --DATA-- -return array() +return [] --EXPECT-- Content of block Content of block (first override) diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test index d3f302df042d77c989b59124cd9dd4b0861717ca..274baa82166ab99704d66b93a69fef40a6803348 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test @@ -17,7 +17,7 @@ Content of block {% endblock foobar %} --DATA-- -return array() +return [] --EXPECT-- Content of block Content of block (first override) diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test index 95b55a4690eaaa5a9961e23dbc9260e4aff8ea41..f6f221273f2b65c450284f4197c36e8219048a1c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test @@ -29,7 +29,7 @@ Content of bar {% endblock bar %} --DATA-- -return array() +return [] --EXPECT-- Content of foo Content of foo (first override) diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test index 3fe2ad83cf3c59114d8c81fb4d3b790687dd01eb..fad9a2d18964989910271ac57eb6db61e7c60baf 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test @@ -17,7 +17,7 @@ --TEMPLATE(blocks.twig)-- {% block content 'BLOCK' %} --DATA-- -return array() +return [] --EXPECT-- PARENT CHILD diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test index a95be5572adfaa1d56feaa6c3a7cc138ad685582..9b60abc49fd79e11e2cd3331a36879f77a30ac24 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test @@ -5,6 +5,6 @@ {{ foo }} {% endverbatim %} --DATA-- -return array() +return [] --EXPECT-- {{ foo }} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test index 28626a816afdea01f9e3f2e6d15c77643d69f7e6..2177538d51b40f88ab26e1e90b042ff2cfa95af3 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/mixed_usage_with_raw.test @@ -5,6 +5,6 @@ {{ foo }} {% endraw %} --DATA-- -return array() +return [] --EXCEPTION-- -Twig_Error_Syntax: Unexpected end of file: Unclosed "verbatim" block in "index.twig" at line 2. +Twig\Error\SyntaxError: Unexpected end of file: Unclosed "verbatim" block in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test index eb610444604beeff3f1e963f16b8d0f399b9ae28..501922bddd29eca528ccc8dae049e60bf2f3f526 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test @@ -37,7 +37,7 @@ 5*** --DATA-- -return array() +return [] --EXPECT-- 1*** {{ 'bla' }} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test index 264ca5e7e3f476534d86c5f2f69980ff52f57133..7c2abd0f9bb20e194a80a24383df28f7a8c013fd 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test @@ -7,7 +7,7 @@ {% endwith %} {{ foo }}{{ bar }} --DATA-- -return array('foo' => 'foo', 'bar' => 'bar') +return ['foo' => 'foo', 'bar' => 'bar'] --EXPECT-- fooBAZ foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test index 32ed0916c97f8e465d2e772cc7bb328bdf4e6c02..e4433d44c8c614e8f3ed48b271d7e3f270057c39 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test @@ -5,6 +5,6 @@ {{ foo }}{{ bar }} {% endwith %} --DATA-- -return array('foo' => 'baz') +return ['foo' => 'baz'] --EXPECT-- fooBAZ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test index 98e3aef43d112bf4bda9bdd01fd1650c0243d3d7..33ca390b2a8c034bb59206748b5f0c794199c146 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test @@ -9,7 +9,7 @@ nested "with" tags {% endwith %} {{ foo }}{{ bar }} --DATA-- -return array() +return [] --EXPECT-- FOOBAZ foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test index 93689f42c1e7c7acbb13e853af82f6e73923883e..7083050b42e08ab997234fb7eabbd2418f555857 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test @@ -5,6 +5,6 @@ {{ foo }}{{ bar }} {% endwith %} --DATA-- -return array('vars' => 'no-hash') +return ['vars' => 'no-hash'] --EXCEPTION-- -Twig_Error_Runtime: Variables passed to the "with" tag must be a hash in "index.twig" at line 2. +Twig\Error\RuntimeError: Variables passed to the "with" tag must be a hash in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test index 6247617e3be25e3dba740562cd8c3628ee938f59..1aca34fc15572ae3082d0da98371b1b1d229d224 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test @@ -5,6 +5,6 @@ {{ foo }}{{ bar }}{{ baz }} {% endwith %} --DATA-- -return array('foo' => 'baz', 'baz' => 'baz') +return ['foo' => 'baz', 'baz' => 'baz'] --EXCEPTION-- -Twig_Error_Runtime: Variable "baz" does not exist in "index.twig" at line 3. +Twig\Error\RuntimeError: Variable "baz" does not exist in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test index 1429d3753c974e13bde2f533041226dcb89d0b9e..7c9a6c80aa9fa992ba0e92fd4d9e25cbbd728a03 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test @@ -5,15 +5,15 @@ array index test {{ key }} {% endfor %} --DATA-- -return array('days' => array( - 1 => array('money' => 9), - 2 => array('money' => 21), - 3 => array('money' => 38), - 4 => array('money' => 6), - 18 => array('money' => 6), - 19 => array('money' => 3), - 31 => array('money' => 11), -)); +return ['days' => [ + 1 => ['money' => 9], + 2 => ['money' => 21], + 3 => ['money' => 38], + 4 => ['money' => 6], + 18 => ['money' => 6], + 19 => ['money' => 3], + 31 => ['money' => 11], +]] --EXPECT-- 1 2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test index 60218ac04c0c72655368ffd31186a2a7eaa911d8..0fa4b37040dda0863319d5df61274c511e807a5d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test @@ -6,7 +6,7 @@ {{ value is constant('TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }} {{ 2 is constant('ARRAY_AS_PROPS', object) ? 'ok' : 'no' }} --DATA-- -return array('value' => 'bar', 'object' => new ArrayObject(array('hi'))); +return ['value' => 'bar', 'object' => new \ArrayObject(['hi'])] --EXPECT-- ok ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test index d4e204efa766d85868e4c10627565affcb167142..879c651e1598bea169c726c5fed7f576b2bc6f92 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test @@ -34,18 +34,18 @@ {{ [1, 2] is defined ? 'ok' : 'ko' }} {{ { foo: "bar" } is defined ? 'ok' : 'ko' }} --DATA-- -return array( +return [ 'definedVar' => 'defined', 'zeroVar' => 0, 'nullVar' => null, - 'nested' => array( + 'nested' => [ 'definedVar' => 'defined', 'zeroVar' => 0, 'nullVar' => null, - 'definedArray' => array(0), - ), + 'definedArray' => [0], + ], 'object' => new TwigTestFoo(), -); +] --EXPECT-- ok ok @@ -80,20 +80,20 @@ ok ok ok --DATA-- -return array( +return [ 'definedVar' => 'defined', 'zeroVar' => 0, 'nullVar' => null, - 'nested' => array( + 'nested' => [ 'definedVar' => 'defined', 'zeroVar' => 0, 'nullVar' => null, - 'definedArray' => array(0), - ), + 'definedArray' => [0], + ], 'object' => new TwigTestFoo(), -); +] --CONFIG-- -return array('strict_variables' => false) +return ['strict_variables' => false] --EXPECT-- ok ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test index 4a5b8dcdbadee367bf4266c342d53f3a499997d0..5fd2fe3f2d2c601d0dd9d942a2acc813da3eeab2 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test @@ -6,28 +6,28 @@ {{ attribute(nested, definedVarName) is defined ? 'ok' : 'ko' }} {{ attribute(nested, undefinedVarName) is not defined ? 'ok' : 'ko' }} --DATA-- -return array( - 'nested' => array( +return [ + 'nested' => [ 'definedVar' => 'defined', - ), + ], 'definedVarName' => 'definedVar', 'undefinedVarName' => 'undefinedVar', -); +] --EXPECT-- ok ok ok ok --DATA-- -return array( - 'nested' => array( +return [ + 'nested' => [ 'definedVar' => 'defined', - ), + ], 'definedVarName' => 'definedVar', 'undefinedVarName' => 'undefinedVar', -); +] --CONFIG-- -return array('strict_variables' => false) +return ['strict_variables' => false] --EXPECT-- ok ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test index 64d7d0431b21f397799ffa72ac75d07f863e13df..c8b90f8c9c421738db103af758378c59a8f557a0 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test @@ -26,7 +26,7 @@ --TEMPLATE(blocks)-- {% block block1 %}{%endblock %} --DATA-- -return array() +return [] --EXPECT-- ok ko diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test index 2c651657e3bccce111a6341e8254b0d3abdc6a05..68540de7aa364f3865ba4ba2be43182b4be74cb7 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test @@ -7,10 +7,10 @@ --TEMPLATE(included.twig)-- {% block foo %}FOO{% endblock %} --DATA-- -return array( +return [ 'included_loaded' => $twig->load('included.twig'), - 'included_loaded_internal' => $twig->loadTemplate('included.twig'), -) + 'included_loaded_internal' => $twig->load('included.twig'), +] --EXPECT-- ok ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test index 2fa9929d35eace0ec548f898374cd2f6c4593c6a..62172e4f1f5e6153d11e1a22d2c9d4ff14dce1ab 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test @@ -6,7 +6,7 @@ {{ constant('FOOBAR') is not defined ? 'ok' : 'ko' }} {{ constant('FOOBAR', object) is not defined ? 'ok' : 'ko' }} --DATA-- -return array('expect' => DATE_W3C, 'object' => new ArrayObject(array('hi'))); +return ['expect' => DATE_W3C, 'object' => new \ArrayObject(['hi'])] --EXPECT-- ok ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/dynamic_test.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/dynamic_test.test new file mode 100644 index 0000000000000000000000000000000000000000..41625f6af1e71af15d36c83a3a7a815311d532df --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/dynamic_test.test @@ -0,0 +1,14 @@ +--TEST-- +dynamic test +--TEMPLATE-- +{{ 'bar' is test_bar ? '1' :'0' }} +{{ 'foo' is test_foo ? '1' :'0' }} +{{ 'bar' is test_foo ? '1' :'0' }} +{{ 'foo' is test_bar ? '1' :'0' }} +--DATA-- +return [] +--EXPECT-- +1 +1 +0 +0 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test index 807c0ed4ae13db7e3cc2d794352024e4e6bec021..3e7fcf01837d74b825a744fdb5fce9f8febd4212 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test @@ -16,15 +16,15 @@ {{ markup_empty is empty ? 'ok' : 'ko' }} {{ markup_not_empty is empty ? 'ko' : 'ok' }} --DATA-- -return array( +return [ 'string_empty' => '', 'string_zero' => '0', 'value_null' => null, 'value_false' => false, 'value_int_zero' => 0, - 'array_empty' => array(), 'array_not_empty' => array(1, 2), + 'array_empty' => [], 'array_not_empty' => [1, 2], 'magically_callable' => new MagicCallStub(), - 'countable_empty' => new CountableStub(array()), 'countable_not_empty' => new CountableStub(array(1, 2)), + 'countable_empty' => new CountableStub([]), 'countable_not_empty' => new CountableStub([1, 2]), 'tostring_empty' => new ToStringStub(''), 'tostring_not_empty' => new ToStringStub('0' /* edge case of using "0" as the string */), - 'markup_empty' => new Twig_Markup('', 'UTF-8'), 'markup_not_empty' => new Twig_Markup('test', 'UTF-8'), -); + 'markup_empty' => new \Twig\Markup('', 'UTF-8'), 'markup_not_empty' => new \Twig\Markup('test', 'UTF-8'), +] --EXPECT-- ok ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test index 695b4c2f8430926ec7f283751a348f869016c0cd..5c73b01e908feb6c8b10a1a8f263113ced04da2b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test @@ -6,7 +6,7 @@ {{ 1 is not even ? 'ok' : 'ko' }} {{ 2 is not even ? 'ko' : 'ok' }} --DATA-- -return array() +return [] --EXPECT-- ok 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 545f51f81fefea98647f55ac7a856eb7f7648eeb..5c3071d5d9502c594f3bd6a43d2198f79ad9e29f 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test @@ -74,7 +74,7 @@ TRUE {{ 5.5 in '125.5' ? 'TRUE' : 'FALSE' }} {{ '5.5' in 125.5 ? 'TRUE' : 'FALSE' }} --DATA-- -return array('bar' => 'bar', 'foo' => array('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__))] --EXPECT-- TRUE TRUE diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test index 8e08061bb58042bbc322788c7f6e315fbad5443a..b53eb067bd94e0f38d9a9e135ac43c1062d7c960 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test @@ -11,9 +11,9 @@ $foo1 = new TwigTestFoo(); $foo->position = $foo1; $foo1->position = $foo; -return array( +return [ 'object' => $foo, - 'object_list' => array($foo1, $foo), -); + 'object_list' => [$foo1, $foo], +] --EXPECT-- TRUE diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test index ec52550134808fa51865eb035549838aa8a9b4ed..75b5756e1e64a651ed02156ea63c2a091fc6f013 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test @@ -6,12 +6,12 @@ {{ obj is iterable ? 'ok' : 'ko' }} {{ val is iterable ? 'ok' : 'ko' }} --DATA-- -return array( - 'foo' => array(), - 'traversable' => new ArrayIterator(array()), - 'obj' => new stdClass(), +return [ + 'foo' => [], + 'traversable' => new \ArrayIterator([]), + 'obj' => new \stdClass(), 'val' => 'test', -); +] --EXPECT-- ok ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test index 3d148c893da9b453957ded2fb35834cdbcf5ec51..7af3255d61d3b5e9552f49261d0722af36ced0bd 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test @@ -14,7 +14,7 @@ Twig supports the ?? operator {{ 1 + nope ?? nada ?? 2 }} {{ 1 + nope ?? 3 + nada ?? 2 }} --DATA-- -return array('bar' => 'OK', 'foo' => array('bar' => 'OK')) +return ['bar' => 'OK', 'foo' => ['bar' => 'OK']] --EXPECT-- OK OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test index 1b8311e3dc356210af249ee9f2790bea71c50dc0..ec88bb519c1f6ac42c15ff62b584e346ef30fad2 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test @@ -4,7 +4,7 @@ {{ 1 is odd ? 'ok' : 'ko' }} {{ 2 is odd ? 'ko' : 'ok' }} --DATA-- -return array() +return [] --EXPECT-- ok ok \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php b/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php index 9cbb15904b119d26a975038b30b603b433a2ed2c..be25047c8a97c67a764105848fac7bead8569311 100644 --- a/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php +++ b/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php @@ -9,6 +9,20 @@ * file that was distributed with this source code. */ +use Twig\Extension\AbstractExtension; +use Twig\Extension\DebugExtension; +use Twig\Extension\SandboxExtension; +use Twig\Extension\StringLoaderExtension; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\PrintNode; +use Twig\Sandbox\SecurityPolicy; +use Twig\Test\IntegrationTestCase; +use Twig\Token; +use Twig\TokenParser\AbstractTokenParser; +use Twig\TwigFilter; +use Twig\TwigFunction; +use Twig\TwigTest; + // This function is defined to check that escaping strategies // like html works even if a function with the same name is defined. function html() @@ -16,23 +30,23 @@ function html() return 'foo'; } -class Twig_Tests_IntegrationTest extends Twig_Test_IntegrationTestCase +class Twig_Tests_IntegrationTest extends IntegrationTestCase { public function getExtensions() { - $policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(), array(), array()); + $policy = new SecurityPolicy([], [], [], [], []); - return array( - new Twig_Extension_Debug(), - new Twig_Extension_Sandbox($policy, false), - new Twig_Extension_StringLoader(), + return [ + new DebugExtension(), + new SandboxExtension($policy, false), + new StringLoaderExtension(), new TwigTestExtension(), - ); + ]; } public function getFixturesDir() { - return dirname(__FILE__).'/Fixtures/'; + return __DIR__.'/Fixtures/'; } } @@ -46,7 +60,7 @@ class TwigTestFoo implements Iterator const BAR_NAME = 'bar'; public $position = 0; - public $array = array(1, 2); + public $array = [1, 2]; public function bar($param1 = null, $param2 = null) { @@ -109,13 +123,13 @@ public function valid() } } -class TwigTestTokenParser_§ extends Twig_TokenParser +class TwigTestTokenParser_§ extends AbstractTokenParser { - public function parse(Twig_Token $token) + public function parse(Token $token) { - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); - return new Twig_Node_Print(new Twig_Node_Expression_Constant('§', -1), -1); + return new PrintNode(new ConstantExpression('§', -1), -1); } public function getTag() @@ -124,51 +138,52 @@ public function getTag() } } -class TwigTestExtension extends Twig_Extension +class TwigTestExtension extends AbstractExtension { public function getTokenParsers() { - return array( + return [ new TwigTestTokenParser_§(), - ); + ]; } public function getFilters() { - return array( - new Twig_SimpleFilter('§', array($this, '§Filter')), - new Twig_SimpleFilter('escape_and_nl2br', array($this, 'escape_and_nl2br'), array('needs_environment' => true, 'is_safe' => array('html'))), - new Twig_SimpleFilter('nl2br', array($this, 'nl2br'), array('pre_escape' => 'html', 'is_safe' => array('html'))), - new Twig_SimpleFilter('escape_something', array($this, 'escape_something'), array('is_safe' => array('something'))), - new Twig_SimpleFilter('preserves_safety', array($this, 'preserves_safety'), array('preserves_safety' => array('html'))), - new Twig_SimpleFilter('static_call_string', 'TwigTestExtension::staticCall'), - new Twig_SimpleFilter('static_call_array', array('TwigTestExtension', 'staticCall')), - new Twig_SimpleFilter('magic_call', array($this, 'magicCall')), - new Twig_SimpleFilter('magic_call_string', 'TwigTestExtension::magicStaticCall'), - new Twig_SimpleFilter('magic_call_array', array('TwigTestExtension', 'magicStaticCall')), - new Twig_SimpleFilter('*_path', array($this, 'dynamic_path')), - new Twig_SimpleFilter('*_foo_*_bar', array($this, 'dynamic_foo')), - ); + return [ + new TwigFilter('§', [$this, '§Filter']), + new TwigFilter('escape_and_nl2br', [$this, 'escape_and_nl2br'], ['needs_environment' => true, 'is_safe' => ['html']]), + new TwigFilter('nl2br', [$this, 'nl2br'], ['pre_escape' => 'html', 'is_safe' => ['html']]), + new TwigFilter('escape_something', [$this, 'escape_something'], ['is_safe' => ['something']]), + new TwigFilter('preserves_safety', [$this, 'preserves_safety'], ['preserves_safety' => ['html']]), + new TwigFilter('static_call_string', 'TwigTestExtension::staticCall'), + new TwigFilter('static_call_array', ['TwigTestExtension', 'staticCall']), + new TwigFilter('magic_call', [$this, 'magicCall']), + new TwigFilter('magic_call_string', 'TwigTestExtension::magicStaticCall'), + new TwigFilter('magic_call_array', ['TwigTestExtension', 'magicStaticCall']), + new TwigFilter('*_path', [$this, 'dynamic_path']), + new TwigFilter('*_foo_*_bar', [$this, 'dynamic_foo']), + ]; } public function getFunctions() { - return array( - new Twig_SimpleFunction('§', array($this, '§Function')), - new Twig_SimpleFunction('safe_br', array($this, 'br'), array('is_safe' => array('html'))), - new Twig_SimpleFunction('unsafe_br', array($this, 'br')), - new Twig_SimpleFunction('static_call_string', 'TwigTestExtension::staticCall'), - new Twig_SimpleFunction('static_call_array', array('TwigTestExtension', 'staticCall')), - new Twig_SimpleFunction('*_path', array($this, 'dynamic_path')), - new Twig_SimpleFunction('*_foo_*_bar', array($this, 'dynamic_foo')), - ); + return [ + new TwigFunction('§', [$this, '§Function']), + new TwigFunction('safe_br', [$this, 'br'], ['is_safe' => ['html']]), + new TwigFunction('unsafe_br', [$this, 'br']), + new TwigFunction('static_call_string', 'TwigTestExtension::staticCall'), + new TwigFunction('static_call_array', ['TwigTestExtension', 'staticCall']), + new TwigFunction('*_path', [$this, 'dynamic_path']), + new TwigFunction('*_foo_*_bar', [$this, 'dynamic_foo']), + ]; } public function getTests() { - return array( - new Twig_SimpleTest('multi word', array($this, 'is_multi_word')), - ); + return [ + new TwigTest('multi word', [$this, 'is_multi_word']), + new TwigTest('test_*', [$this, 'dynamic_test']), + ]; } public function §Filter($value) @@ -209,6 +224,11 @@ public function dynamic_foo($foo, $bar, $item) return $foo.'/'.$bar.'/'.$item; } + public function dynamic_test($element, $item) + { + return $element === $item; + } + public function escape_something($value) { return strtoupper($value); @@ -237,7 +257,7 @@ public function is_multi_word($value) public function __call($method, $arguments) { if ('magicCall' !== $method) { - throw new BadMethodCallException('Unexpected call to __call'); + throw new \BadMethodCallException('Unexpected call to __call'); } return 'magic_'.$arguments[0]; @@ -246,7 +266,7 @@ public function __call($method, $arguments) public static function __callStatic($method, $arguments) { if ('magicStaticCall' !== $method) { - throw new BadMethodCallException('Unexpected call to __callStatic'); + throw new \BadMethodCallException('Unexpected call to __callStatic'); } return 'static_magic_'.$arguments[0]; @@ -261,7 +281,7 @@ class MagicCallStub { public function __call($name, $args) { - throw new Exception('__call shall not be called'); + throw new \Exception('__call shall not be called'); } } @@ -304,7 +324,7 @@ public function count() public function __toString() { - throw new Exception('__toString shall not be called on \Countables'); + throw new \Exception('__toString shall not be called on \Countables'); } } @@ -322,6 +342,6 @@ public function __construct(array $data) public function getIterator() { - return new ArrayIterator($this->data); + return new \ArrayIterator($this->data); } } diff --git a/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test b/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test index b091ad34d3173b2a973961b8739a526217a1dbd1..d25f75e8ee0ae0242b28fe86804867013cbf058f 100644 --- a/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test +++ b/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test @@ -9,9 +9,9 @@ --TEMPLATE(index.txt.twig)-- {{ br -}} --DATA-- -return array('br' => '<br />') +return ['br' => '<br />'] --CONFIG-- -return array('autoescape' => 'filename') +return ['autoescape' => 'filename'] --EXPECT-- <br /> <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test b/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test index 62e24f0f468936846597d9f37483f8784e86b5d9..e52c3b259239b7478720f5d7169c3a5b38977415 100644 --- a/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test +++ b/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test @@ -7,6 +7,6 @@ {% block foo %}Foo{% endblock %} {% block bar %}Bar{% endblock %} --DATA-- -return array() +return [] --EXPECT-- FooBarBar diff --git a/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test b/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test index d9c1d5085169e2b59b9db1716341b1434b58acea..4bd1f6ac0a5e288dd050ba1e95e829e3c69093fc 100644 --- a/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test +++ b/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/test.legacy.test @@ -3,6 +3,6 @@ Old test classes usage --TEMPLATE-- {{ 'foo' is multi word ? 'yes' : 'no' }} --DATA-- -return array() +return [] --EXPECT-- no diff --git a/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php b/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php index 2ed75803843bba32063308d5fa41f0024885a0dd..92cac3f8adf9cbaf30954460e3201a9ac75ba86f 100644 --- a/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php +++ b/vendor/twig/twig/test/Twig/Tests/LegacyIntegrationTest.php @@ -9,37 +9,40 @@ * file that was distributed with this source code. */ -class Twig_Tests_LegacyIntegrationTest extends Twig_Test_IntegrationTestCase +use Twig\Extension\AbstractExtension; +use Twig\Test\IntegrationTestCase; + +class Twig_Tests_LegacyIntegrationTest extends IntegrationTestCase { public function getExtensions() { - return array( + return [ new LegacyTwigTestExtension(), - ); + ]; } public function getFixturesDir() { - return dirname(__FILE__).'/LegacyFixtures/'; + return __DIR__.'/LegacyFixtures/'; } public function getTests($name, $legacyTests = false) { if (!$legacyTests) { - return array(array('', '', '', array(), '', array())); + return [['', '', '', [], '', []]]; } return parent::getTests($name, true); } } -class LegacyTwigTestExtension extends Twig_Extension +class LegacyTwigTestExtension extends AbstractExtension { public function getTests() { - return array( + return [ 'multi word' => new Twig_Test_Method($this, 'is_multi_word'), - ); + ]; } public function is_multi_word($value) diff --git a/vendor/twig/twig/test/Twig/Tests/LexerTest.php b/vendor/twig/twig/test/Twig/Tests/LexerTest.php index ffe9a235bf39077609cce3e408cd0a7093883e05..4055719d95a0da14d9a19d7cf4e51e8fd020c70f 100644 --- a/vendor/twig/twig/test/Twig/Tests/LexerTest.php +++ b/vendor/twig/twig/test/Twig/Tests/LexerTest.php @@ -8,6 +8,12 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + +use Twig\Environment; +use Twig\Lexer; +use Twig\Source; +use Twig\Token; + class Twig_Tests_LexerTest extends \PHPUnit\Framework\TestCase { /** @@ -15,7 +21,7 @@ class Twig_Tests_LexerTest extends \PHPUnit\Framework\TestCase */ public function testLegacyConstructorSignature() { - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); $stream = $lexer->tokenize('{{ foo }}', 'foo'); $this->assertEquals('foo', $stream->getFilename()); $this->assertEquals('{{ foo }}', $stream->getSource()); @@ -25,36 +31,36 @@ public function testNameLabelForTag() { $template = '{% § %}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); - $stream->expect(Twig_Token::BLOCK_START_TYPE); - $this->assertSame('§', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); + $stream->expect(Token::BLOCK_START_TYPE); + $this->assertSame('§', $stream->expect(Token::NAME_TYPE)->getValue()); } public function testNameLabelForFunction() { $template = '{{ §() }}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); - $stream->expect(Twig_Token::VAR_START_TYPE); - $this->assertSame('§', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); + $stream->expect(Token::VAR_START_TYPE); + $this->assertSame('§', $stream->expect(Token::NAME_TYPE)->getValue()); } public function testBracketsNesting() { $template = '{{ {"a":{"b":"c"}} }}'; - $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '{')); - $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '}')); + $this->assertEquals(2, $this->countToken($template, Token::PUNCTUATION_TYPE, '{')); + $this->assertEquals(2, $this->countToken($template, Token::PUNCTUATION_TYPE, '}')); } protected function countToken($template, $type, $value = null) { - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); $count = 0; while (!$stream->isEOF()) { @@ -78,17 +84,17 @@ public function testLineDirective() ."baz\n" ."}}\n"; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); // foo\nbar\n - $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + $this->assertSame(1, $stream->expect(Token::TEXT_TYPE)->getLine()); // \n (after {% line %}) - $this->assertSame(10, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + $this->assertSame(10, $stream->expect(Token::TEXT_TYPE)->getLine()); // {{ - $this->assertSame(11, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); + $this->assertSame(11, $stream->expect(Token::VAR_START_TYPE)->getLine()); // baz - $this->assertSame(12, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); + $this->assertSame(12, $stream->expect(Token::NAME_TYPE)->getLine()); } public function testLineDirectiveInline() @@ -98,23 +104,23 @@ public function testLineDirectiveInline() ."baz\n" ."}}\n"; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); // foo\nbar - $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + $this->assertSame(1, $stream->expect(Token::TEXT_TYPE)->getLine()); // {{ - $this->assertSame(10, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); + $this->assertSame(10, $stream->expect(Token::VAR_START_TYPE)->getLine()); // baz - $this->assertSame(11, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); + $this->assertSame(11, $stream->expect(Token::NAME_TYPE)->getLine()); } public function testLongComments() { $template = '{# '.str_repeat('*', 100000).' #}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); // 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 @@ -125,8 +131,8 @@ public function testLongVerbatim() { $template = '{% verbatim %}'.str_repeat('*', 100000).'{% endverbatim %}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); // 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 @@ -137,8 +143,8 @@ public function testLongVar() { $template = '{{ '.str_repeat('x', 100000).' }}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); // 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 @@ -149,8 +155,8 @@ public function testLongBlock() { $template = '{% '.str_repeat('x', 100000).' %}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); // 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 @@ -161,8 +167,8 @@ public function testBigNumbers() { $template = '{{ 922337203685477580700 }}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); $stream->next(); $node = $stream->next(); $this->assertEquals('922337203685477580700', $node->getValue()); @@ -170,15 +176,15 @@ public function testBigNumbers() public function testStringWithEscapedDelimiter() { - $tests = array( + $tests = [ "{{ 'foo \' bar' }}" => 'foo \' bar', '{{ "foo \" bar" }}' => 'foo " bar', - ); - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); + ]; + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); foreach ($tests as $template => $expected) { - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, $expected); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::STRING_TYPE, $expected); // 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 @@ -190,17 +196,17 @@ public function testStringWithInterpolation() { $template = 'foo {{ "bar #{ baz + 1 }" }}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::TEXT_TYPE, 'foo '); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar '); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'baz'); - $stream->expect(Twig_Token::OPERATOR_TYPE, '+'); - $stream->expect(Twig_Token::NUMBER_TYPE, '1'); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::VAR_END_TYPE); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::TEXT_TYPE, 'foo '); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'bar '); + $stream->expect(Token::INTERPOLATION_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'baz'); + $stream->expect(Token::OPERATOR_TYPE, '+'); + $stream->expect(Token::NUMBER_TYPE, '1'); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $stream->expect(Token::VAR_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 @@ -211,11 +217,11 @@ public function testStringWithEscapedInterpolation() { $template = '{{ "bar \#{baz+1}" }}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar #{baz+1}'); - $stream->expect(Twig_Token::VAR_END_TYPE); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'bar #{baz+1}'); + $stream->expect(Token::VAR_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 @@ -226,11 +232,11 @@ public function testStringWithHash() { $template = '{{ "bar # baz" }}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar # baz'); - $stream->expect(Twig_Token::VAR_END_TYPE); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'bar # baz'); + $stream->expect(Token::VAR_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 @@ -238,32 +244,32 @@ public function testStringWithHash() } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unclosed """ */ public function testStringWithUnterminatedInterpolation() { $template = '{{ "bar #{x" }}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); } public function testStringWithNestedInterpolations() { $template = '{{ "bar #{ "foo#{bar}" }" }}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar '); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'foo'); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'bar'); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::VAR_END_TYPE); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'bar '); + $stream->expect(Token::INTERPOLATION_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'foo'); + $stream->expect(Token::INTERPOLATION_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'bar'); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $stream->expect(Token::VAR_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 @@ -274,18 +280,18 @@ public function testStringWithNestedInterpolationsInBlock() { $template = '{% foo "bar #{ "foo#{bar}" }" %}'; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::BLOCK_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'foo'); - $stream->expect(Twig_Token::STRING_TYPE, 'bar '); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'foo'); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'bar'); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::BLOCK_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'foo'); + $stream->expect(Token::STRING_TYPE, 'bar '); + $stream->expect(Token::INTERPOLATION_START_TYPE); + $stream->expect(Token::STRING_TYPE, 'foo'); + $stream->expect(Token::INTERPOLATION_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'bar'); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $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 @@ -296,11 +302,11 @@ public function testOperatorEndingWithALetterAtTheEndOfALine() { $template = "{{ 1 and\n0}}"; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::NUMBER_TYPE, 1); - $stream->expect(Twig_Token::OPERATOR_TYPE, 'and'); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::NUMBER_TYPE, 1); + $stream->expect(Token::OPERATOR_TYPE, 'and'); // 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 @@ -308,7 +314,7 @@ public function testOperatorEndingWithALetterAtTheEndOfALine() } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unclosed "variable" in "index" at line 3 */ public function testUnterminatedVariable() @@ -322,12 +328,12 @@ public function testUnterminatedVariable() '; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unclosed "block" in "index" at line 3 */ public function testUnterminatedBlock() @@ -341,7 +347,7 @@ public function testUnterminatedBlock() '; - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $lexer->tokenize(new Source($template, 'index')); } } diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php b/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php index 593063933e52e5026c30247f416e9ff7972f7b93..6f308f597b56b0ec6cd003ae948a5b0c1e278444 100644 --- a/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php @@ -9,6 +9,8 @@ * file that was distributed with this source code. */ +use Twig\Loader\ArrayLoader; + class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase { /** @@ -16,45 +18,45 @@ class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase */ public function testGetSource() { - $loader = new Twig_Loader_Array(array('foo' => 'bar')); + $loader = new ArrayLoader(['foo' => 'bar']); $this->assertEquals('bar', $loader->getSource('foo')); } /** * @group legacy - * @expectedException Twig_Error_Loader + * @expectedException \Twig\Error\LoaderError */ public function testGetSourceWhenTemplateDoesNotExist() { - $loader = new Twig_Loader_Array(array()); + $loader = new ArrayLoader([]); $loader->getSource('foo'); } /** - * @expectedException Twig_Error_Loader + * @expectedException \Twig\Error\LoaderError */ public function testGetSourceContextWhenTemplateDoesNotExist() { - $loader = new Twig_Loader_Array(array()); + $loader = new ArrayLoader([]); $loader->getSourceContext('foo'); } public function testGetCacheKey() { - $loader = new Twig_Loader_Array(array('foo' => 'bar')); + $loader = new ArrayLoader(['foo' => 'bar']); $this->assertEquals('foo:bar', $loader->getCacheKey('foo')); } public function testGetCacheKeyWhenTemplateHasDuplicateContent() { - $loader = new Twig_Loader_Array(array( + $loader = new ArrayLoader([ 'foo' => 'bar', 'baz' => 'bar', - )); + ]); $this->assertEquals('foo:bar', $loader->getCacheKey('foo')); $this->assertEquals('baz:bar', $loader->getCacheKey('baz')); @@ -62,28 +64,28 @@ public function testGetCacheKeyWhenTemplateHasDuplicateContent() public function testGetCacheKeyIsProtectedFromEdgeCollisions() { - $loader = new Twig_Loader_Array(array( + $loader = new ArrayLoader([ 'foo__' => 'bar', 'foo' => '__bar', - )); + ]); $this->assertEquals('foo__:bar', $loader->getCacheKey('foo__')); $this->assertEquals('foo:__bar', $loader->getCacheKey('foo')); } /** - * @expectedException Twig_Error_Loader + * @expectedException \Twig\Error\LoaderError */ public function testGetCacheKeyWhenTemplateDoesNotExist() { - $loader = new Twig_Loader_Array(array()); + $loader = new ArrayLoader([]); $loader->getCacheKey('foo'); } public function testSetTemplate() { - $loader = new Twig_Loader_Array(array()); + $loader = new ArrayLoader([]); $loader->setTemplate('foo', 'bar'); $this->assertEquals('bar', $loader->getSourceContext('foo')->getCode()); @@ -91,16 +93,16 @@ public function testSetTemplate() public function testIsFresh() { - $loader = new Twig_Loader_Array(array('foo' => 'bar')); + $loader = new ArrayLoader(['foo' => 'bar']); $this->assertTrue($loader->isFresh('foo', time())); } /** - * @expectedException Twig_Error_Loader + * @expectedException \Twig\Error\LoaderError */ public function testIsFreshWhenTemplateDoesNotExist() { - $loader = new Twig_Loader_Array(array()); + $loader = new ArrayLoader([]); $loader->isFresh('foo', time()); } @@ -108,7 +110,7 @@ public function testIsFreshWhenTemplateDoesNotExist() public function testTemplateReference() { $name = new Twig_Test_Loader_TemplateReference('foo'); - $loader = new Twig_Loader_Array(array('foo' => 'bar')); + $loader = new ArrayLoader(['foo' => 'bar']); $loader->getCacheKey($name); $loader->getSourceContext($name); diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php b/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php index 8a8a84a5a03101c3440de405ae78513c801ed8d1..c486eeeeedbd07dbc189e6b83581cee5b8ea3d70 100644 --- a/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php @@ -9,6 +9,14 @@ * file that was distributed with this source code. */ +use Twig\Loader\ArrayLoader; +use Twig\Loader\ChainLoader; +use Twig\Loader\ExistsLoaderInterface; +use Twig\Loader\FilesystemLoader; +use Twig\Loader\LoaderInterface; +use Twig\Loader\SourceContextLoaderInterface; +use Twig\Source; + class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase { /** @@ -16,10 +24,10 @@ class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase */ public function testGetSource() { - $loader = new Twig_Loader_Chain(array( - new Twig_Loader_Array(array('foo' => 'bar')), - new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')), - )); + $loader = new ChainLoader([ + new ArrayLoader(['foo' => 'bar']), + new ArrayLoader(['foo' => 'foobar', 'bar' => 'foo']), + ]); $this->assertEquals('bar', $loader->getSource('foo')); $this->assertEquals('foo', $loader->getSource('bar')); @@ -27,12 +35,12 @@ public function testGetSource() public function testGetSourceContext() { - $path = dirname(__FILE__).'/../Fixtures'; - $loader = new Twig_Loader_Chain(array( - new Twig_Loader_Array(array('foo' => 'bar')), - new Twig_Loader_Array(array('errors/index.html' => 'baz')), - new Twig_Loader_Filesystem(array($path)), - )); + $path = __DIR__.'/../Fixtures'; + $loader = new ChainLoader([ + new ArrayLoader(['foo' => 'bar']), + new ArrayLoader(['errors/index.html' => 'baz']), + new FilesystemLoader([$path]), + ]); $this->assertEquals('foo', $loader->getSourceContext('foo')->getName()); $this->assertSame('', $loader->getSourceContext('foo')->getPath()); @@ -47,51 +55,51 @@ public function testGetSourceContext() } /** - * @expectedException Twig_Error_Loader + * @expectedException \Twig\Error\LoaderError */ public function testGetSourceContextWhenTemplateDoesNotExist() { - $loader = new Twig_Loader_Chain(array()); + $loader = new ChainLoader([]); $loader->getSourceContext('foo'); } /** * @group legacy - * @expectedException Twig_Error_Loader + * @expectedException \Twig\Error\LoaderError */ public function testGetSourceWhenTemplateDoesNotExist() { - $loader = new Twig_Loader_Chain(array()); + $loader = new ChainLoader([]); $loader->getSource('foo'); } public function testGetCacheKey() { - $loader = new Twig_Loader_Chain(array( - new Twig_Loader_Array(array('foo' => 'bar')), - new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')), - )); + $loader = new ChainLoader([ + new ArrayLoader(['foo' => 'bar']), + new ArrayLoader(['foo' => 'foobar', 'bar' => 'foo']), + ]); $this->assertEquals('foo:bar', $loader->getCacheKey('foo')); $this->assertEquals('bar:foo', $loader->getCacheKey('bar')); } /** - * @expectedException Twig_Error_Loader + * @expectedException \Twig\Error\LoaderError */ public function testGetCacheKeyWhenTemplateDoesNotExist() { - $loader = new Twig_Loader_Chain(array()); + $loader = new ChainLoader([]); $loader->getCacheKey('foo'); } public function testAddLoader() { - $loader = new Twig_Loader_Chain(); - $loader->addLoader(new Twig_Loader_Array(array('foo' => 'bar'))); + $loader = new ChainLoader(); + $loader->addLoader(new ArrayLoader(['foo' => 'bar'])); $this->assertEquals('bar', $loader->getSourceContext('foo')->getCode()); } @@ -104,10 +112,10 @@ public function testExists() // can be removed in 2.0 $loader2 = $this->getMockBuilder('Twig_ChainTestLoaderInterface')->getMock(); - //$loader2 = $this->getMockBuilder(array('Twig_LoaderInterface', 'Twig_SourceContextLoaderInterface'))->getMock(); - $loader2->expects($this->once())->method('getSourceContext')->will($this->returnValue(new Twig_Source('content', 'index'))); + //$loader2 = $this->getMockBuilder(['\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface'])->getMock(); + $loader2->expects($this->once())->method('getSourceContext')->will($this->returnValue(new Source('content', 'index'))); - $loader = new Twig_Loader_Chain(); + $loader = new ChainLoader(); $loader->addLoader($loader1); $loader->addLoader($loader2); @@ -115,10 +123,10 @@ public function testExists() } } -interface Twig_ChainTestLoaderInterface extends Twig_LoaderInterface, Twig_SourceContextLoaderInterface +interface Twig_ChainTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface { } -interface Twig_ChainTestLoaderWithExistsInterface extends Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface +interface Twig_ChainTestLoaderWithExistsInterface extends LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface { } diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php b/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php index bd2acbd75f45c83d7e23a6b4eae3e555ad106946..86e58e6da880b95c58d7239df9a94fccecc0be15 100644 --- a/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php @@ -9,12 +9,16 @@ * file that was distributed with this source code. */ +use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Loader\FilesystemLoader; + class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase { public function testGetSourceContext() { - $path = dirname(__FILE__).'/../Fixtures'; - $loader = new Twig_Loader_Filesystem(array($path)); + $path = __DIR__.'/../Fixtures'; + $loader = new FilesystemLoader([$path]); $this->assertEquals('errors/index.html', $loader->getSourceContext('errors/index.html')->getName()); $this->assertEquals(realpath($path.'/errors/index.html'), realpath($loader->getSourceContext('errors/index.html')->getPath())); } @@ -24,39 +28,39 @@ public function testGetSourceContext() */ public function testSecurity($template) { - $loader = new Twig_Loader_Filesystem(array(dirname(__FILE__).'/../Fixtures')); + $loader = new FilesystemLoader([__DIR__.'/../Fixtures']); try { $loader->getCacheKey($template); $this->fail(); - } catch (Twig_Error_Loader $e) { + } catch (LoaderError $e) { $this->assertNotContains('Unable to find template', $e->getMessage()); } } public function getSecurityTests() { - return array( - array("AutoloaderTest\0.php"), - array('..\\AutoloaderTest.php'), - array('..\\\\\\AutoloaderTest.php'), - array('../AutoloaderTest.php'), - array('..////AutoloaderTest.php'), - array('./../AutoloaderTest.php'), - array('.\\..\\AutoloaderTest.php'), - array('././././././../AutoloaderTest.php'), - array('.\\./.\\./.\\./../AutoloaderTest.php'), - array('foo/../../AutoloaderTest.php'), - array('foo\\..\\..\\AutoloaderTest.php'), - array('foo/../bar/../../AutoloaderTest.php'), - array('foo/bar/../../../AutoloaderTest.php'), - array('filters/../../AutoloaderTest.php'), - array('filters//..//..//AutoloaderTest.php'), - array('filters\\..\\..\\AutoloaderTest.php'), - array('filters\\\\..\\\\..\\\\AutoloaderTest.php'), - array('filters\\//../\\/\\..\\AutoloaderTest.php'), - array('/../AutoloaderTest.php'), - ); + return [ + ["AutoloaderTest\0.php"], + ['..\\AutoloaderTest.php'], + ['..\\\\\\AutoloaderTest.php'], + ['../AutoloaderTest.php'], + ['..////AutoloaderTest.php'], + ['./../AutoloaderTest.php'], + ['.\\..\\AutoloaderTest.php'], + ['././././././../AutoloaderTest.php'], + ['.\\./.\\./.\\./../AutoloaderTest.php'], + ['foo/../../AutoloaderTest.php'], + ['foo\\..\\..\\AutoloaderTest.php'], + ['foo/../bar/../../AutoloaderTest.php'], + ['foo/bar/../../../AutoloaderTest.php'], + ['filters/../../AutoloaderTest.php'], + ['filters//..//..//AutoloaderTest.php'], + ['filters\\..\\..\\AutoloaderTest.php'], + ['filters\\\\..\\\\..\\\\AutoloaderTest.php'], + ['filters\\//../\\/\\..\\AutoloaderTest.php'], + ['/../AutoloaderTest.php'], + ]; } /** @@ -64,27 +68,27 @@ public function getSecurityTests() */ public function testPaths($basePath, $cacheKey, $rootPath) { - $loader = new Twig_Loader_Filesystem(array($basePath.'/normal', $basePath.'/normal_bis'), $rootPath); - $loader->setPaths(array($basePath.'/named', $basePath.'/named_bis'), 'named'); + $loader = new FilesystemLoader([$basePath.'/normal', $basePath.'/normal_bis'], $rootPath); + $loader->setPaths([$basePath.'/named', $basePath.'/named_bis'], 'named'); $loader->addPath($basePath.'/named_ter', 'named'); $loader->addPath($basePath.'/normal_ter'); $loader->prependPath($basePath.'/normal_final'); $loader->prependPath($basePath.'/named/../named_quater', 'named'); $loader->prependPath($basePath.'/named_final', 'named'); - $this->assertEquals(array( + $this->assertEquals([ $basePath.'/normal_final', $basePath.'/normal', $basePath.'/normal_bis', $basePath.'/normal_ter', - ), $loader->getPaths()); - $this->assertEquals(array( + ], $loader->getPaths()); + $this->assertEquals([ $basePath.'/named_final', $basePath.'/named/../named_quater', $basePath.'/named', $basePath.'/named_bis', $basePath.'/named_ter', - ), $loader->getPaths('named')); + ], $loader->getPaths('named')); // do not use realpath here as it would make the test unuseful $this->assertEquals($cacheKey, str_replace('\\', '/', $loader->getCacheKey('@named/named_absolute.html'))); @@ -95,70 +99,70 @@ public function testPaths($basePath, $cacheKey, $rootPath) public function getBasePaths() { - return array( - array( - dirname(__FILE__).'/Fixtures', + return [ + [ + __DIR__.'/Fixtures', 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html', null, - ), - array( - dirname(__FILE__).'/Fixtures/../Fixtures', + ], + [ + __DIR__.'/Fixtures/../Fixtures', 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html', null, - ), - array( + ], + [ 'test/Twig/Tests/Loader/Fixtures', 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html', getcwd(), - ), - array( + ], + [ 'Fixtures', 'Fixtures/named_quater/named_absolute.html', getcwd().'/test/Twig/Tests/Loader', - ), - array( + ], + [ 'Fixtures', 'Fixtures/named_quater/named_absolute.html', getcwd().'/test/../test/Twig/Tests/Loader', - ), - ); + ], + ]; } public function testEmptyConstructor() { - $loader = new Twig_Loader_Filesystem(); - $this->assertEquals(array(), $loader->getPaths()); + $loader = new FilesystemLoader(); + $this->assertEquals([], $loader->getPaths()); } public function testGetNamespaces() { - $loader = new Twig_Loader_Filesystem(sys_get_temp_dir()); - $this->assertEquals(array(Twig_Loader_Filesystem::MAIN_NAMESPACE), $loader->getNamespaces()); + $loader = new FilesystemLoader(sys_get_temp_dir()); + $this->assertEquals([FilesystemLoader::MAIN_NAMESPACE], $loader->getNamespaces()); $loader->addPath(sys_get_temp_dir(), 'named'); - $this->assertEquals(array(Twig_Loader_Filesystem::MAIN_NAMESPACE, 'named'), $loader->getNamespaces()); + $this->assertEquals([FilesystemLoader::MAIN_NAMESPACE, 'named'], $loader->getNamespaces()); } public function testFindTemplateExceptionNamespace() { - $basePath = dirname(__FILE__).'/Fixtures'; + $basePath = __DIR__.'/Fixtures'; - $loader = new Twig_Loader_Filesystem(array($basePath.'/normal')); + $loader = new FilesystemLoader([$basePath.'/normal']); $loader->addPath($basePath.'/named', 'named'); try { $loader->getSourceContext('@named/nowhere.html'); - } catch (Exception $e) { - $this->assertInstanceof('Twig_Error_Loader', $e); + } catch (\Exception $e) { + $this->assertInstanceOf('\Twig\Error\LoaderError', $e); $this->assertContains('Unable to find template "@named/nowhere.html"', $e->getMessage()); } } public function testFindTemplateWithCache() { - $basePath = dirname(__FILE__).'/Fixtures'; + $basePath = __DIR__.'/Fixtures'; - $loader = new Twig_Loader_Filesystem(array($basePath.'/normal')); + $loader = new FilesystemLoader([$basePath.'/normal']); $loader->addPath($basePath.'/named', 'named'); // prime the cache for index.html in the named namespace @@ -171,28 +175,28 @@ public function testFindTemplateWithCache() public function testLoadTemplateAndRenderBlockWithCache() { - $loader = new Twig_Loader_Filesystem(array()); - $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme2'); - $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1'); - $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1', 'default_theme'); + $loader = new FilesystemLoader([]); + $loader->addPath(__DIR__.'/Fixtures/themes/theme2'); + $loader->addPath(__DIR__.'/Fixtures/themes/theme1'); + $loader->addPath(__DIR__.'/Fixtures/themes/theme1', 'default_theme'); - $twig = new Twig_Environment($loader); + $twig = new Environment($loader); - $template = $twig->loadTemplate('blocks.html.twig'); - $this->assertSame('block from theme 1', $template->renderBlock('b1', array())); + $template = $twig->load('blocks.html.twig'); + $this->assertSame('block from theme 1', $template->renderBlock('b1', [])); - $template = $twig->loadTemplate('blocks.html.twig'); - $this->assertSame('block from theme 2', $template->renderBlock('b2', array())); + $template = $twig->load('blocks.html.twig'); + $this->assertSame('block from theme 2', $template->renderBlock('b2', [])); } public function getArrayInheritanceTests() { - return array( - 'valid array inheritance' => array('array_inheritance_valid_parent.html.twig'), - 'array inheritance with null first template' => array('array_inheritance_null_parent.html.twig'), - 'array inheritance with empty first template' => array('array_inheritance_empty_parent.html.twig'), - 'array inheritance with non-existent first template' => array('array_inheritance_nonexistent_parent.html.twig'), - ); + return [ + 'valid array inheritance' => ['array_inheritance_valid_parent.html.twig'], + 'array inheritance with null first template' => ['array_inheritance_null_parent.html.twig'], + 'array inheritance with empty first template' => ['array_inheritance_empty_parent.html.twig'], + 'array inheritance with non-existent first template' => ['array_inheritance_nonexistent_parent.html.twig'], + ]; } /** @@ -202,13 +206,13 @@ public function getArrayInheritanceTests() */ public function testArrayInheritance($templateName) { - $loader = new Twig_Loader_Filesystem(array()); - $loader->addPath(dirname(__FILE__).'/Fixtures/inheritance'); + $loader = new FilesystemLoader([]); + $loader->addPath(__DIR__.'/Fixtures/inheritance'); - $twig = new Twig_Environment($loader); + $twig = new Environment($loader); - $template = $twig->loadTemplate($templateName); - $this->assertSame('VALID Child', $template->renderBlock('body', array())); + $template = $twig->load($templateName); + $this->assertSame('VALID Child', $template->renderBlock('body', [])); } /** @@ -216,11 +220,26 @@ public function testArrayInheritance($templateName) */ public function testLoadTemplateFromPhar() { - $loader = new Twig_Loader_Filesystem(array()); + $loader = new FilesystemLoader([]); // phar-sample.phar was created with the following script: // $f = new Phar('phar-test.phar'); // $f->addFromString('hello.twig', 'hello from phar'); - $loader->addPath('phar://'.dirname(__FILE__).'/Fixtures/phar/phar-sample.phar'); + $loader->addPath('phar://'.__DIR__.'/Fixtures/phar/phar-sample.phar'); $this->assertSame('hello from phar', $loader->getSourceContext('hello.twig')->getCode()); } + + public function testTemplateExistsAlwaysReturnsBool() + { + $loader = new FilesystemLoader([]); + $this->assertFalse($loader->exists("foo\0.twig")); + $this->assertFalse($loader->exists('../foo.twig')); + $this->assertFalse($loader->exists('@foo')); + $this->assertFalse($loader->exists('foo')); + $this->assertFalse($loader->exists('@foo/bar.twig')); + + $loader->addPath(__DIR__.'/Fixtures/normal'); + $this->assertTrue($loader->exists('index.html')); + $loader->addPath(__DIR__.'/Fixtures/normal', 'foo'); + $this->assertTrue($loader->exists('@foo/index.html')); + } } diff --git a/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php b/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php index 50736dc22df78a45298c0b21ffa2b321ccab079f..6a122fa7f76fea7e5b9ed8d8315002402d555aae 100644 --- a/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php +++ b/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php @@ -9,6 +9,9 @@ * file that was distributed with this source code. */ +use Twig\Environment; +use Twig\Loader\ArrayLoader; + class Twig_Tests_NativeExtensionTest extends \PHPUnit\Framework\TestCase { /** @@ -16,14 +19,18 @@ class Twig_Tests_NativeExtensionTest extends \PHPUnit\Framework\TestCase */ public function testGetProperties() { - $twig = new Twig_Environment(new Twig_Loader_Array(array('index' => '{{ d1.date }}{{ d2.date }}')), array( + if (PHP_VERSION_ID >= 70000) { + $this->markTestSkipped('Extension is not available on PHP 7+'); + } + + $twig = new Environment(new ArrayLoader(['index' => '{{ d1.date }}{{ d2.date }}']), [ 'debug' => true, 'cache' => false, 'autoescape' => false, - )); + ]); - $d1 = new DateTime(); - $d2 = new DateTime(); + $d1 = new \DateTime(); + $d2 = new \DateTime(); $output = $twig->render('index', compact('d1', 'd2')); // If it fails, PHP will crash. diff --git a/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php b/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php index 25d16023f2790c4c218c38d831fbd1acddd993b4..1633e06046fc8b8025cc014fad4396b79ff65666 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php @@ -9,12 +9,17 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_AutoEscapeTest extends Twig_Test_NodeTestCase +use Twig\Node\AutoEscapeNode; +use Twig\Node\Node; +use Twig\Node\TextNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_AutoEscapeTest extends NodeTestCase { public function testConstructor() { - $body = new Twig_Node(array(new Twig_Node_Text('foo', 1))); - $node = new Twig_Node_AutoEscape(true, $body, 1); + $body = new Node([new TextNode('foo', 1)]); + $node = new AutoEscapeNode(true, $body, 1); $this->assertEquals($body, $node->getNode('body')); $this->assertTrue($node->getAttribute('value')); @@ -22,11 +27,11 @@ public function testConstructor() public function getTests() { - $body = new Twig_Node(array(new Twig_Node_Text('foo', 1))); - $node = new Twig_Node_AutoEscape(true, $body, 1); + $body = new Node([new TextNode('foo', 1)]); + $node = new AutoEscapeNode(true, $body, 1); - return array( - array($node, "// line 1\necho \"foo\";"), - ); + return [ + [$node, "// line 1\necho \"foo\";"], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php b/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php index 84dac9bfa8326df8f1f1dab1050a92cc085add3a..ff021ff76fe1e08a3813ea79e568c0a12a5d9773 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php @@ -9,23 +9,26 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_BlockReferenceTest extends Twig_Test_NodeTestCase +use Twig\Node\BlockReferenceNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_BlockReferenceTest extends NodeTestCase { public function testConstructor() { - $node = new Twig_Node_BlockReference('foo', 1); + $node = new BlockReferenceNode('foo', 1); $this->assertEquals('foo', $node->getAttribute('name')); } public function getTests() { - return array( - array(new Twig_Node_BlockReference('foo', 1), <<<EOF + return [ + [new BlockReferenceNode('foo', 1), <<<EOF // line 1 \$this->displayBlock('foo', \$context, \$blocks); EOF - ), - ); + ], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php b/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php index e7246dcc360d86357dbb56b8b8cd87529368a31d..8b4a1eca4a5f870912ece2624c4bf0170bdd37ff 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php @@ -9,12 +9,16 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_BlockTest extends Twig_Test_NodeTestCase +use Twig\Node\BlockNode; +use Twig\Node\TextNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_BlockTest extends NodeTestCase { public function testConstructor() { - $body = new Twig_Node_Text('foo', 1); - $node = new Twig_Node_Block('foo', $body, 1); + $body = new TextNode('foo', 1); + $node = new BlockNode('foo', $body, 1); $this->assertEquals($body, $node->getNode('body')); $this->assertEquals('foo', $node->getAttribute('name')); @@ -22,18 +26,18 @@ public function testConstructor() public function getTests() { - $body = new Twig_Node_Text('foo', 1); - $node = new Twig_Node_Block('foo', $body, 1); + $body = new TextNode('foo', 1); + $node = new BlockNode('foo', $body, 1); - return array( - array($node, <<<EOF + return [ + [$node, <<<EOF // line 1 -public function block_foo(\$context, array \$blocks = array()) +public function block_foo(\$context, array \$blocks = []) { echo "foo"; } EOF - ), - ); + ], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/DeprecatedTest.php b/vendor/twig/twig/test/Twig/Tests/Node/DeprecatedTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2fb6f9621c731715951d60c2b8e2cd642fb609eb --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/DeprecatedTest.php @@ -0,0 +1,80 @@ +<?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\Environment; +use Twig\Node\DeprecatedNode; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FunctionExpression; +use Twig\Node\IfNode; +use Twig\Node\Node; +use Twig\Test\NodeTestCase; +use Twig\TwigFunction; + +class Twig_Tests_Node_DeprecatedTest extends NodeTestCase +{ + public function testConstructor() + { + $expr = new ConstantExpression('foo', 1); + $node = new DeprecatedNode($expr, 1); + + $this->assertEquals($expr, $node->getNode('expr')); + } + + public function getTests() + { + $tests = []; + + $expr = new ConstantExpression('This section is deprecated', 1); + $node = new DeprecatedNode($expr, 1, 'deprecated'); + $node->setTemplateName('foo.twig'); + + $tests[] = [$node, <<<EOF +// line 1 +@trigger_error("This section is deprecated"." (\"foo.twig\" at line 1).", E_USER_DEPRECATED); +EOF + ]; + + $t = new Node([ + new ConstantExpression(true, 1), + new DeprecatedNode($expr, 2, 'deprecated'), + ], [], 1); + $node = new IfNode($t, null, 1); + $node->setTemplateName('foo.twig'); + + $tests[] = [$node, <<<EOF +// line 1 +if (true) { + // line 2 + @trigger_error("This section is deprecated"." (\"foo.twig\" at line 2).", E_USER_DEPRECATED); +} +EOF + ]; + + $environment = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $environment->addFunction(new TwigFunction('foo', 'foo', [])); + + $expr = new FunctionExpression('foo', new Node(), 1); + $node = new DeprecatedNode($expr, 1, 'deprecated'); + $node->setTemplateName('foo.twig'); + + $compiler = $this->getCompiler($environment); + $varName = $compiler->getVarName(); + + $tests[] = [$node, <<<EOF +// line 1 +\$$varName = foo(); +@trigger_error(\$$varName." (\"foo.twig\" at line 1).", E_USER_DEPRECATED); +EOF + , $environment]; + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/DoTest.php b/vendor/twig/twig/test/Twig/Tests/Node/DoTest.php index aa33d1a2dc7d99285422bfc695a82ca6b4d45f67..ffddda4885248041d12612fc8bd61cc2eae286ff 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/DoTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/DoTest.php @@ -9,23 +9,27 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_DoTest extends Twig_Test_NodeTestCase +use Twig\Node\DoNode; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_DoTest extends NodeTestCase { public function testConstructor() { - $expr = new Twig_Node_Expression_Constant('foo', 1); - $node = new Twig_Node_Do($expr, 1); + $expr = new ConstantExpression('foo', 1); + $node = new DoNode($expr, 1); $this->assertEquals($expr, $node->getNode('expr')); } public function getTests() { - $tests = array(); + $tests = []; - $expr = new Twig_Node_Expression_Constant('foo', 1); - $node = new Twig_Node_Do($expr, 1); - $tests[] = array($node, "// line 1\n\"foo\";"); + $expr = new ConstantExpression('foo', 1); + $node = new DoNode($expr, 1); + $tests[] = [$node, "// line 1\n\"foo\";"]; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php index 4f83ab176f3238d0ccbb7fd61b997095668ed102..842dac40ca797c48b124fd36559f67ae3c22ce8d 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php @@ -9,29 +9,33 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_ArrayTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_ArrayTest extends NodeTestCase { public function testConstructor() { - $elements = array(new Twig_Node_Expression_Constant('foo', 1), $foo = new Twig_Node_Expression_Constant('bar', 1)); - $node = new Twig_Node_Expression_Array($elements, 1); + $elements = [new ConstantExpression('foo', 1), $foo = new ConstantExpression('bar', 1)]; + $node = new ArrayExpression($elements, 1); $this->assertEquals($foo, $node->getNode(1)); } public function getTests() { - $elements = array( - new Twig_Node_Expression_Constant('foo', 1), - new Twig_Node_Expression_Constant('bar', 1), + $elements = [ + new ConstantExpression('foo', 1), + new ConstantExpression('bar', 1), - new Twig_Node_Expression_Constant('bar', 1), - new Twig_Node_Expression_Constant('foo', 1), - ); - $node = new Twig_Node_Expression_Array($elements, 1); + new ConstantExpression('bar', 1), + new ConstantExpression('foo', 1), + ]; + $node = new ArrayExpression($elements, 1); - return array( - array($node, 'array("foo" => "bar", "bar" => "foo")'), - ); + return [ + [$node, '["foo" => "bar", "bar" => "foo"]'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php index bf365de497f483713c74a256531740d143a079d6..47fddcae1631e76f3a64ce649e7dcf2a1afe18fa 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php @@ -9,21 +9,24 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_AssignNameTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\AssignNameExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_AssignNameTest extends NodeTestCase { public function testConstructor() { - $node = new Twig_Node_Expression_AssignName('foo', 1); + $node = new AssignNameExpression('foo', 1); $this->assertEquals('foo', $node->getAttribute('name')); } public function getTests() { - $node = new Twig_Node_Expression_AssignName('foo', 1); + $node = new AssignNameExpression('foo', 1); - return array( - array($node, '$context["foo"]'), - ); + return [ + [$node, '$context["foo"]'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php index 02310a1b03f698c44cb83dab48ed7402cc608459..d91ee8e5c5b99320a02ca1d8cc0ef74d974e1cce 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php @@ -9,13 +9,17 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Binary_AddTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\Binary\AddBinary; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Binary_AddTest extends NodeTestCase { public function testConstructor() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Add($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new AddBinary($left, $right, 1); $this->assertEquals($left, $node->getNode('left')); $this->assertEquals($right, $node->getNode('right')); @@ -23,12 +27,12 @@ public function testConstructor() public function getTests() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Add($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new AddBinary($left, $right, 1); - return array( - array($node, '(1 + 2)'), - ); + return [ + [$node, '(1 + 2)'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php index 2df3c8e459663697e947e3eef8ea18c895ec6076..61cc1c935bd130c59778be3bfc2d36fd575f2b2c 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php @@ -9,13 +9,17 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Binary_AndTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\Binary\AndBinary; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Binary_AndTest extends NodeTestCase { public function testConstructor() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_And($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new AndBinary($left, $right, 1); $this->assertEquals($left, $node->getNode('left')); $this->assertEquals($right, $node->getNode('right')); @@ -23,12 +27,12 @@ public function testConstructor() public function getTests() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_And($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new AndBinary($left, $right, 1); - return array( - array($node, '(1 && 2)'), - ); + return [ + [$node, '(1 && 2)'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php index 759e482898cc779589b2803abe59b371841c78ce..f8d4c6e6feb8cbdf4b5d484ccdff887e959b73fb 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php @@ -9,13 +9,17 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Binary_ConcatTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\Binary\ConcatBinary; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Binary_ConcatTest extends NodeTestCase { public function testConstructor() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Concat($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new ConcatBinary($left, $right, 1); $this->assertEquals($left, $node->getNode('left')); $this->assertEquals($right, $node->getNode('right')); @@ -23,12 +27,12 @@ public function testConstructor() public function getTests() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Concat($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new ConcatBinary($left, $right, 1); - return array( - array($node, '(1 . 2)'), - ); + return [ + [$node, '(1 . 2)'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php index 0e54b10a39c328293f6c2791d5afb0678a84afd1..b6054239c084f2f9e076a5ab785e46c548255051 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php @@ -9,13 +9,17 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Binary_DivTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\Binary\DivBinary; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Binary_DivTest extends NodeTestCase { public function testConstructor() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Div($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new DivBinary($left, $right, 1); $this->assertEquals($left, $node->getNode('left')); $this->assertEquals($right, $node->getNode('right')); @@ -23,12 +27,12 @@ public function testConstructor() public function getTests() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Div($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new DivBinary($left, $right, 1); - return array( - array($node, '(1 / 2)'), - ); + return [ + [$node, '(1 / 2)'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php index 5813dce6ee94b651a275fcbd59b8b5077a5d3f21..cb27e007d51f9d576f7fbf445d371c23bdf98a37 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php @@ -9,13 +9,17 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Binary_FloorDivTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\Binary\FloorDivBinary; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Binary_FloorDivTest extends NodeTestCase { public function testConstructor() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new FloorDivBinary($left, $right, 1); $this->assertEquals($left, $node->getNode('left')); $this->assertEquals($right, $node->getNode('right')); @@ -23,12 +27,12 @@ public function testConstructor() public function getTests() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new FloorDivBinary($left, $right, 1); - return array( - array($node, '(int) floor((1 / 2))'), - ); + return [ + [$node, '(int) floor((1 / 2))'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php index 4c663c7877b2f3ba5859c78da938a6bed3d9e38a..c5497cd6ff2415478c7c51fe9f199de5e76c25ba 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php @@ -9,13 +9,17 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Binary_ModTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\Binary\ModBinary; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Binary_ModTest extends NodeTestCase { public function testConstructor() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Mod($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new ModBinary($left, $right, 1); $this->assertEquals($left, $node->getNode('left')); $this->assertEquals($right, $node->getNode('right')); @@ -23,12 +27,12 @@ public function testConstructor() public function getTests() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Mod($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new ModBinary($left, $right, 1); - return array( - array($node, '(1 % 2)'), - ); + return [ + [$node, '(1 % 2)'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php index e92c95e640132aa82c308ddb2e3efb7a0491c26c..3b19b05857f81b9ae7062984e6c2a8905936e396 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php @@ -9,13 +9,17 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Binary_MulTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\Binary\MulBinary; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Binary_MulTest extends NodeTestCase { public function testConstructor() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Mul($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new MulBinary($left, $right, 1); $this->assertEquals($left, $node->getNode('left')); $this->assertEquals($right, $node->getNode('right')); @@ -23,12 +27,12 @@ public function testConstructor() public function getTests() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Mul($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new MulBinary($left, $right, 1); - return array( - array($node, '(1 * 2)'), - ); + return [ + [$node, '(1 * 2)'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php index ec37c83ebbfaf48a2ef5d6ea1c8662908daed5e8..0f1c3bf4319265ed6af4987fb3a66c2e0cdfadbe 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php @@ -9,13 +9,17 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Binary_OrTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\Binary\OrBinary; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Binary_OrTest extends NodeTestCase { public function testConstructor() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Or($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new OrBinary($left, $right, 1); $this->assertEquals($left, $node->getNode('left')); $this->assertEquals($right, $node->getNode('right')); @@ -23,12 +27,12 @@ public function testConstructor() public function getTests() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Or($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new OrBinary($left, $right, 1); - return array( - array($node, '(1 || 2)'), - ); + return [ + [$node, '(1 || 2)'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php index 061cb270f459057aae8a23a3a9aa8367f07382f3..9955c4be4fd14cc33abc53afd62f7a79c09748cd 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php @@ -9,13 +9,17 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Binary_SubTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\Binary\SubBinary; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Binary_SubTest extends NodeTestCase { public function testConstructor() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Sub($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new SubBinary($left, $right, 1); $this->assertEquals($left, $node->getNode('left')); $this->assertEquals($right, $node->getNode('right')); @@ -23,12 +27,12 @@ public function testConstructor() public function getTests() { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Sub($left, $right, 1); + $left = new ConstantExpression(1, 1); + $right = new ConstantExpression(2, 1); + $node = new SubBinary($left, $right, 1); - return array( - array($node, '(1 - 2)'), - ); + return [ + [$node, '(1 - 2)'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php index 883bb61273ccacda639eb2f5808d4f95d8f25e62..32b5d19a7aff8e6805e7d8a91eb237f1083c56c4 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php @@ -9,92 +9,94 @@ * file that was distributed with this source code. */ +use Twig\Node\Expression\CallExpression; + class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase { public function testGetArguments() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $this->assertEquals(array('U', null), $node->getArguments('date', array('format' => 'U', 'timestamp' => null))); + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']); + $this->assertEquals(['U', null], $node->getArguments('date', ['format' => 'U', 'timestamp' => null])); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Positional arguments cannot be used after named arguments for function "date". */ public function testGetArgumentsWhenPositionalArgumentsAfterNamedArguments() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $node->getArguments('date', array('timestamp' => 123456, 'Y-m-d')); + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']); + $node->getArguments('date', ['timestamp' => 123456, 'Y-m-d']); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Argument "format" is defined twice for function "date". */ public function testGetArgumentsWhenArgumentIsDefinedTwice() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $node->getArguments('date', array('Y-m-d', 'format' => 'U')); + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']); + $node->getArguments('date', ['Y-m-d', 'format' => 'U']); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unknown argument "unknown" for function "date(format, timestamp)". */ public function testGetArgumentsWithWrongNamedArgumentName() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $node->getArguments('date', array('Y-m-d', 'timestamp' => null, 'unknown' => '')); + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']); + $node->getArguments('date', ['Y-m-d', 'timestamp' => null, 'unknown' => '']); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unknown arguments "unknown1", "unknown2" for function "date(format, timestamp)". */ public function testGetArgumentsWithWrongNamedArgumentNames() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $node->getArguments('date', array('Y-m-d', 'timestamp' => null, 'unknown1' => '', 'unknown2' => '')); + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'date']); + $node->getArguments('date', ['Y-m-d', 'timestamp' => null, 'unknown1' => '', 'unknown2' => '']); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Argument "case_sensitivity" could not be assigned for function "substr_compare(main_str, str, offset, length, case_sensitivity)" because it is mapped to an internal PHP function which cannot determine default value for optional argument "length". */ public function testResolveArgumentsWithMissingValueForOptionalArgument() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'substr_compare')); - $node->getArguments('substr_compare', array('abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true)); + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'substr_compare']); + $node->getArguments('substr_compare', ['abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true]); } public function testResolveArgumentsOnlyNecessaryArgumentsForCustomFunction() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'custom_function')); + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'custom_function']); - $this->assertEquals(array('arg1'), $node->getArguments(array($this, 'customFunction'), array('arg1' => 'arg1'))); + $this->assertEquals(['arg1'], $node->getArguments([$this, 'customFunction'], ['arg1' => 'arg1'])); } public function testGetArgumentsForStaticMethod() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'custom_static_function')); - $this->assertEquals(array('arg1'), $node->getArguments(__CLASS__.'::customStaticFunction', array('arg1' => 'arg1'))); + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'custom_static_function']); + $this->assertEquals(['arg1'], $node->getArguments(__CLASS__.'::customStaticFunction', ['arg1' => 'arg1'])); } /** - * @expectedException LogicException - * @expectedExceptionMessage The last parameter of "Twig_Tests_Node_Expression_CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = array()". + * @expectedException \LogicException + * @expectedExceptionMessage The last parameter of "Twig_Tests_Node_Expression_CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = []". */ public function testResolveArgumentsWithMissingParameterForArbitraryArguments() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'foo', 'is_variadic' => true)); - $node->getArguments(array($this, 'customFunctionWithArbitraryArguments'), array()); + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]); + $node->getArguments([$this, 'customFunctionWithArbitraryArguments'], []); } - public static function customStaticFunction($arg1, $arg2 = 'default', $arg3 = array()) + public static function customStaticFunction($arg1, $arg2 = 'default', $arg3 = []) { } - public function customFunction($arg1, $arg2 = 'default', $arg3 = array()) + public function customFunction($arg1, $arg2 = 'default', $arg3 = []) { } @@ -103,27 +105,27 @@ public function customFunctionWithArbitraryArguments() } /** - * @expectedException LogicException - * @expectedExceptionMessageRegExp #^The last parameter of "custom_Twig_Tests_Node_Expression_CallTest_function" for function "foo" must be an array with default value, eg\. "array \$arg \= array\(\)"\.$# + * @expectedException \LogicException + * @expectedExceptionMessageRegExp #^The last parameter of "custom_Twig_Tests_Node_Expression_CallTest_function" for function "foo" must be an array with default value, eg\. "array \$arg \= \[\]"\.$# */ public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnFunction() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'foo', 'is_variadic' => true)); - $node->getArguments('custom_Twig_Tests_Node_Expression_CallTest_function', array()); + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]); + $node->getArguments('custom_Twig_Tests_Node_Expression_CallTest_function', []); } /** - * @expectedException LogicException - * @expectedExceptionMessageRegExp #^The last parameter of "CallableTestClass\:\:__invoke" for function "foo" must be an array with default value, eg\. "array \$arg \= array\(\)"\.$# + * @expectedException \LogicException + * @expectedExceptionMessageRegExp #^The last parameter of "CallableTestClass\:\:__invoke" for function "foo" must be an array with default value, eg\. "array \$arg \= \[\]"\.$# */ public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnObject() { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'foo', 'is_variadic' => true)); - $node->getArguments(new CallableTestClass(), array()); + $node = new Twig_Tests_Node_Expression_Call([], ['type' => 'function', 'name' => 'foo', 'is_variadic' => true]); + $node->getArguments(new CallableTestClass(), []); } } -class Twig_Tests_Node_Expression_Call extends Twig_Node_Expression_Call +class Twig_Tests_Node_Expression_Call extends CallExpression { public function getArguments($callable, $arguments) { diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php index a3e8badffa21fc677a9bfec7caa858739b73a299..32be4d0e5ec804b047ae8d732650e4b342312948 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php @@ -9,14 +9,18 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_ConditionalTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ConditionalExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_ConditionalTest extends NodeTestCase { public function testConstructor() { - $expr1 = new Twig_Node_Expression_Constant(1, 1); - $expr2 = new Twig_Node_Expression_Constant(2, 1); - $expr3 = new Twig_Node_Expression_Constant(3, 1); - $node = new Twig_Node_Expression_Conditional($expr1, $expr2, $expr3, 1); + $expr1 = new ConstantExpression(1, 1); + $expr2 = new ConstantExpression(2, 1); + $expr3 = new ConstantExpression(3, 1); + $node = new ConditionalExpression($expr1, $expr2, $expr3, 1); $this->assertEquals($expr1, $node->getNode('expr1')); $this->assertEquals($expr2, $node->getNode('expr2')); @@ -25,13 +29,13 @@ public function testConstructor() public function getTests() { - $tests = array(); + $tests = []; - $expr1 = new Twig_Node_Expression_Constant(1, 1); - $expr2 = new Twig_Node_Expression_Constant(2, 1); - $expr3 = new Twig_Node_Expression_Constant(3, 1); - $node = new Twig_Node_Expression_Conditional($expr1, $expr2, $expr3, 1); - $tests[] = array($node, '((1) ? (2) : (3))'); + $expr1 = new ConstantExpression(1, 1); + $expr2 = new ConstantExpression(2, 1); + $expr3 = new ConstantExpression(3, 1); + $node = new ConditionalExpression($expr1, $expr2, $expr3, 1); + $tests[] = [$node, '((1) ? (2) : (3))']; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php index 2ff9318229e6f8c8f3721e744d0675278fe9caca..ae38101b58a0d7fcab4bd385e46027529366f58b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php @@ -9,21 +9,24 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_ConstantTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ConstantExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_ConstantTest extends NodeTestCase { public function testConstructor() { - $node = new Twig_Node_Expression_Constant('foo', 1); + $node = new ConstantExpression('foo', 1); $this->assertEquals('foo', $node->getAttribute('value')); } public function getTests() { - $tests = array(); + $tests = []; - $node = new Twig_Node_Expression_Constant('foo', 1); - $tests[] = array($node, '"foo"'); + $node = new ConstantExpression('foo', 1); + $tests[] = [$node, '"foo"']; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php index 773375c941634dd51f0db0b3ecb2db65e327f5b3..1cca1a57a9a2696433b0dca1baa4d203ef83d835 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php @@ -9,14 +9,21 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_FilterTest extends Twig_Test_NodeTestCase +use Twig\Environment; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FilterExpression; +use Twig\Node\Node; +use Twig\Test\NodeTestCase; +use Twig\TwigFilter; + +class Twig_Tests_Node_Expression_FilterTest extends NodeTestCase { public function testConstructor() { - $expr = new Twig_Node_Expression_Constant('foo', 1); - $name = new Twig_Node_Expression_Constant('upper', 1); - $args = new Twig_Node(); - $node = new Twig_Node_Expression_Filter($expr, $name, $args, 1); + $expr = new ConstantExpression('foo', 1); + $name = new ConstantExpression('upper', 1); + $args = new Node(); + $node = new FilterExpression($expr, $name, $args, 1); $this->assertEquals($expr, $node->getNode('node')); $this->assertEquals($name, $node->getNode('filter')); @@ -25,118 +32,118 @@ public function testConstructor() public function getTests() { - $environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $environment->addFilter(new Twig_SimpleFilter('bar', 'bar', array('needs_environment' => true))); - $environment->addFilter(new Twig_SimpleFilter('barbar', 'twig_tests_filter_barbar', array('needs_context' => true, 'is_variadic' => true))); + $environment = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $environment->addFilter(new TwigFilter('bar', 'bar', ['needs_environment' => true])); + $environment->addFilter(new TwigFilter('barbar', 'twig_tests_filter_barbar', ['needs_context' => true, 'is_variadic' => true])); - $tests = array(); + $tests = []; - $expr = new Twig_Node_Expression_Constant('foo', 1); + $expr = new ConstantExpression('foo', 1); $node = $this->createFilter($expr, 'upper'); - $node = $this->createFilter($node, 'number_format', array(new Twig_Node_Expression_Constant(2, 1), new Twig_Node_Expression_Constant('.', 1), new Twig_Node_Expression_Constant(',', 1))); + $node = $this->createFilter($node, 'number_format', [new ConstantExpression(2, 1), new ConstantExpression('.', 1), new ConstantExpression(',', 1)]); - if (function_exists('mb_get_info')) { - $tests[] = array($node, 'twig_number_format_filter($this->env, twig_upper_filter($this->env, "foo"), 2, ".", ",")'); + if (\function_exists('mb_get_info')) { + $tests[] = [$node, 'twig_number_format_filter($this->env, twig_upper_filter($this->env, "foo"), 2, ".", ",")']; } else { - $tests[] = array($node, 'twig_number_format_filter($this->env, strtoupper("foo"), 2, ".", ",")'); + $tests[] = [$node, 'twig_number_format_filter($this->env, strtoupper("foo"), 2, ".", ",")']; } // named arguments - $date = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($date, 'date', array( - 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), - 'format' => new Twig_Node_Expression_Constant('d/m/Y H:i:s P', 1), - )); - $tests[] = array($node, 'twig_date_format_filter($this->env, 0, "d/m/Y H:i:s P", "America/Chicago")'); + $date = new ConstantExpression(0, 1); + $node = $this->createFilter($date, 'date', [ + 'timezone' => new ConstantExpression('America/Chicago', 1), + 'format' => new ConstantExpression('d/m/Y H:i:s P', 1), + ]); + $tests[] = [$node, 'twig_date_format_filter($this->env, 0, "d/m/Y H:i:s P", "America/Chicago")']; // skip an optional argument - $date = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($date, 'date', array( - 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), - )); - $tests[] = array($node, 'twig_date_format_filter($this->env, 0, null, "America/Chicago")'); + $date = new ConstantExpression(0, 1); + $node = $this->createFilter($date, 'date', [ + 'timezone' => new ConstantExpression('America/Chicago', 1), + ]); + $tests[] = [$node, 'twig_date_format_filter($this->env, 0, null, "America/Chicago")']; // underscores vs camelCase for named arguments - $string = new Twig_Node_Expression_Constant('abc', 1); - $node = $this->createFilter($string, 'reverse', array( - 'preserve_keys' => new Twig_Node_Expression_Constant(true, 1), - )); - $tests[] = array($node, 'twig_reverse_filter($this->env, "abc", true)'); - $node = $this->createFilter($string, 'reverse', array( - 'preserveKeys' => new Twig_Node_Expression_Constant(true, 1), - )); - $tests[] = array($node, 'twig_reverse_filter($this->env, "abc", true)'); + $string = new ConstantExpression('abc', 1); + $node = $this->createFilter($string, 'reverse', [ + 'preserve_keys' => new ConstantExpression(true, 1), + ]); + $tests[] = [$node, 'twig_reverse_filter($this->env, "abc", true)']; + $node = $this->createFilter($string, 'reverse', [ + 'preserveKeys' => new ConstantExpression(true, 1), + ]); + $tests[] = [$node, 'twig_reverse_filter($this->env, "abc", true)']; // filter as an anonymous function if (PHP_VERSION_ID >= 50300) { - $node = $this->createFilter(new Twig_Node_Expression_Constant('foo', 1), 'anonymous'); - $tests[] = array($node, 'call_user_func_array($this->env->getFilter(\'anonymous\')->getCallable(), array("foo"))'); + $node = $this->createFilter(new ConstantExpression('foo', 1), 'anonymous'); + $tests[] = [$node, 'call_user_func_array($this->env->getFilter(\'anonymous\')->getCallable(), ["foo"])']; } // needs environment $node = $this->createFilter($string, 'bar'); - $tests[] = array($node, 'bar($this->env, "abc")', $environment); + $tests[] = [$node, 'bar($this->env, "abc")', $environment]; - $node = $this->createFilter($string, 'bar', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'bar($this->env, "abc", "bar")', $environment); + $node = $this->createFilter($string, 'bar', [new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'bar($this->env, "abc", "bar")', $environment]; // arbitrary named arguments $node = $this->createFilter($string, 'barbar'); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc")', $environment); + $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc")', $environment]; - $node = $this->createFilter($string, 'barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", null, null, array("foo" => "bar"))', $environment); + $node = $this->createFilter($string, 'barbar', ['foo' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc", null, null, ["foo" => "bar"])', $environment]; - $node = $this->createFilter($string, 'barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", null, "bar")', $environment); + $node = $this->createFilter($string, 'barbar', ['arg2' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc", null, "bar")', $environment]; - $node = $this->createFilter($string, 'barbar', array( - new Twig_Node_Expression_Constant('1', 1), - new Twig_Node_Expression_Constant('2', 1), - new Twig_Node_Expression_Constant('3', 1), - 'foo' => new Twig_Node_Expression_Constant('bar', 1), - )); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", "1", "2", array(0 => "3", "foo" => "bar"))', $environment); + $node = $this->createFilter($string, 'barbar', [ + new ConstantExpression('1', 1), + new ConstantExpression('2', 1), + new ConstantExpression('3', 1), + 'foo' => new ConstantExpression('bar', 1), + ]); + $tests[] = [$node, 'twig_tests_filter_barbar($context, "abc", "1", "2", [0 => "3", "foo" => "bar"])', $environment]; return $tests; } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unknown argument "foobar" for filter "date(format, timezone)" at line 1. */ public function testCompileWithWrongNamedArgumentName() { - $date = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($date, 'date', array( - 'foobar' => new Twig_Node_Expression_Constant('America/Chicago', 1), - )); + $date = new ConstantExpression(0, 1); + $node = $this->createFilter($date, 'date', [ + 'foobar' => new ConstantExpression('America/Chicago', 1), + ]); $compiler = $this->getCompiler(); $compiler->compile($node); } /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Value for argument "from" is required for filter "replace". + * @expectedException \Twig\Error\SyntaxError + * @expectedExceptionMessage Value for argument "from" is required for filter "replace" at line 1. */ public function testCompileWithMissingNamedArgument() { - $value = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($value, 'replace', array( - 'to' => new Twig_Node_Expression_Constant('foo', 1), - )); + $value = new ConstantExpression(0, 1); + $node = $this->createFilter($value, 'replace', [ + 'to' => new ConstantExpression('foo', 1), + ]); $compiler = $this->getCompiler(); $compiler->compile($node); } - protected function createFilter($node, $name, array $arguments = array()) + protected function createFilter($node, $name, array $arguments = []) { - $name = new Twig_Node_Expression_Constant($name, 1); - $arguments = new Twig_Node($arguments); + $name = new ConstantExpression($name, 1); + $arguments = new Node($arguments); - return new Twig_Node_Expression_Filter($node, $name, $arguments, 1); + return new FilterExpression($node, $name, $arguments, 1); } protected function getEnvironment() @@ -149,6 +156,6 @@ protected function getEnvironment() } } -function twig_tests_filter_barbar($context, $string, $arg1 = null, $arg2 = null, array $args = array()) +function twig_tests_filter_barbar($context, $string, $arg1 = null, $arg2 = null, array $args = []) { } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php index 2e82e2f11527429a5d4d8a6a6283f84c2636211a..51001a63f274d909549d1fa80d871bd195f94787 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php @@ -9,13 +9,20 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_FunctionTest extends Twig_Test_NodeTestCase +use Twig\Environment; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FunctionExpression; +use Twig\Node\Node; +use Twig\Test\NodeTestCase; +use Twig\TwigFunction; + +class Twig_Tests_Node_Expression_FunctionTest extends NodeTestCase { public function testConstructor() { $name = 'function'; - $args = new Twig_Node(); - $node = new Twig_Node_Expression_Function($name, $args, 1); + $args = new Node(); + $node = new FunctionExpression($name, $args, 1); $this->assertEquals($name, $node->getAttribute('name')); $this->assertEquals($args, $node->getNode('arguments')); @@ -23,76 +30,76 @@ public function testConstructor() public function getTests() { - $environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $environment->addFunction(new Twig_SimpleFunction('foo', 'foo', array())); - $environment->addFunction(new Twig_SimpleFunction('bar', 'bar', array('needs_environment' => true))); - $environment->addFunction(new Twig_SimpleFunction('foofoo', 'foofoo', array('needs_context' => true))); - $environment->addFunction(new Twig_SimpleFunction('foobar', 'foobar', array('needs_environment' => true, 'needs_context' => true))); - $environment->addFunction(new Twig_SimpleFunction('barbar', 'twig_tests_function_barbar', array('is_variadic' => true))); + $environment = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $environment->addFunction(new TwigFunction('foo', 'foo', [])); + $environment->addFunction(new TwigFunction('bar', 'bar', ['needs_environment' => true])); + $environment->addFunction(new TwigFunction('foofoo', 'foofoo', ['needs_context' => true])); + $environment->addFunction(new TwigFunction('foobar', 'foobar', ['needs_environment' => true, 'needs_context' => true])); + $environment->addFunction(new TwigFunction('barbar', 'twig_tests_function_barbar', ['is_variadic' => true])); - $tests = array(); + $tests = []; $node = $this->createFunction('foo'); - $tests[] = array($node, 'foo()', $environment); + $tests[] = [$node, 'foo()', $environment]; - $node = $this->createFunction('foo', array(new Twig_Node_Expression_Constant('bar', 1), new Twig_Node_Expression_Constant('foobar', 1))); - $tests[] = array($node, 'foo("bar", "foobar")', $environment); + $node = $this->createFunction('foo', [new ConstantExpression('bar', 1), new ConstantExpression('foobar', 1)]); + $tests[] = [$node, 'foo("bar", "foobar")', $environment]; $node = $this->createFunction('bar'); - $tests[] = array($node, 'bar($this->env)', $environment); + $tests[] = [$node, 'bar($this->env)', $environment]; - $node = $this->createFunction('bar', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'bar($this->env, "bar")', $environment); + $node = $this->createFunction('bar', [new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'bar($this->env, "bar")', $environment]; $node = $this->createFunction('foofoo'); - $tests[] = array($node, 'foofoo($context)', $environment); + $tests[] = [$node, 'foofoo($context)', $environment]; - $node = $this->createFunction('foofoo', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'foofoo($context, "bar")', $environment); + $node = $this->createFunction('foofoo', [new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'foofoo($context, "bar")', $environment]; $node = $this->createFunction('foobar'); - $tests[] = array($node, 'foobar($this->env, $context)', $environment); + $tests[] = [$node, 'foobar($this->env, $context)', $environment]; - $node = $this->createFunction('foobar', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'foobar($this->env, $context, "bar")', $environment); + $node = $this->createFunction('foobar', [new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'foobar($this->env, $context, "bar")', $environment]; // named arguments - $node = $this->createFunction('date', array( - 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), - 'date' => new Twig_Node_Expression_Constant(0, 1), - )); - $tests[] = array($node, 'twig_date_converter($this->env, 0, "America/Chicago")'); + $node = $this->createFunction('date', [ + 'timezone' => new ConstantExpression('America/Chicago', 1), + 'date' => new ConstantExpression(0, 1), + ]); + $tests[] = [$node, 'twig_date_converter($this->env, 0, "America/Chicago")']; // arbitrary named arguments $node = $this->createFunction('barbar'); - $tests[] = array($node, 'twig_tests_function_barbar()', $environment); + $tests[] = [$node, 'twig_tests_function_barbar()', $environment]; - $node = $this->createFunction('barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_function_barbar(null, null, array("foo" => "bar"))', $environment); + $node = $this->createFunction('barbar', ['foo' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_function_barbar(null, null, ["foo" => "bar"])', $environment]; - $node = $this->createFunction('barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_function_barbar(null, "bar")', $environment); + $node = $this->createFunction('barbar', ['arg2' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_function_barbar(null, "bar")', $environment]; - $node = $this->createFunction('barbar', array( - new Twig_Node_Expression_Constant('1', 1), - new Twig_Node_Expression_Constant('2', 1), - new Twig_Node_Expression_Constant('3', 1), - 'foo' => new Twig_Node_Expression_Constant('bar', 1), - )); - $tests[] = array($node, 'twig_tests_function_barbar("1", "2", array(0 => "3", "foo" => "bar"))', $environment); + $node = $this->createFunction('barbar', [ + new ConstantExpression('1', 1), + new ConstantExpression('2', 1), + new ConstantExpression('3', 1), + 'foo' => new ConstantExpression('bar', 1), + ]); + $tests[] = [$node, 'twig_tests_function_barbar("1", "2", [0 => "3", "foo" => "bar"])', $environment]; // function as an anonymous function if (PHP_VERSION_ID >= 50300) { - $node = $this->createFunction('anonymous', array(new Twig_Node_Expression_Constant('foo', 1))); - $tests[] = array($node, 'call_user_func_array($this->env->getFunction(\'anonymous\')->getCallable(), array("foo"))'); + $node = $this->createFunction('anonymous', [new ConstantExpression('foo', 1)]); + $tests[] = [$node, 'call_user_func_array($this->env->getFunction(\'anonymous\')->getCallable(), ["foo"])']; } return $tests; } - protected function createFunction($name, array $arguments = array()) + protected function createFunction($name, array $arguments = []) { - return new Twig_Node_Expression_Function($name, new Twig_Node($arguments), 1); + return new FunctionExpression($name, new Node($arguments), 1); } protected function getEnvironment() @@ -105,6 +112,6 @@ protected function getEnvironment() } } -function twig_tests_function_barbar($arg1 = null, $arg2 = null, array $args = array()) +function twig_tests_function_barbar($arg1 = null, $arg2 = null, array $args = []) { } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php index 2764478c413d18b39f28a68fd109a9db1e535d21..036b421941480aa9b1529ce2d50b110a5ecad8e4 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php @@ -9,41 +9,48 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_GetAttrTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\GetAttrExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Template; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_GetAttrTest extends NodeTestCase { public function testConstructor() { - $expr = new Twig_Node_Expression_Name('foo', 1); - $attr = new Twig_Node_Expression_Constant('bar', 1); - $args = new Twig_Node_Expression_Array(array(), 1); - $args->addElement(new Twig_Node_Expression_Name('foo', 1)); - $args->addElement(new Twig_Node_Expression_Constant('bar', 1)); - $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ARRAY_CALL, 1); + $expr = new NameExpression('foo', 1); + $attr = new ConstantExpression('bar', 1); + $args = new ArrayExpression([], 1); + $args->addElement(new NameExpression('foo', 1)); + $args->addElement(new ConstantExpression('bar', 1)); + $node = new GetAttrExpression($expr, $attr, $args, Template::ARRAY_CALL, 1); $this->assertEquals($expr, $node->getNode('node')); $this->assertEquals($attr, $node->getNode('attribute')); $this->assertEquals($args, $node->getNode('arguments')); - $this->assertEquals(Twig_Template::ARRAY_CALL, $node->getAttribute('type')); + $this->assertEquals(Template::ARRAY_CALL, $node->getAttribute('type')); } public function getTests() { - $tests = array(); - - $expr = new Twig_Node_Expression_Name('foo', 1); - $attr = new Twig_Node_Expression_Constant('bar', 1); - $args = new Twig_Node_Expression_Array(array(), 1); - $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ANY_CALL, 1); - $tests[] = array($node, sprintf('%s%s, "bar", array())', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))); - - $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ARRAY_CALL, 1); - $tests[] = array($node, sprintf('%s%s, "bar", array(), "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))); - - $args = new Twig_Node_Expression_Array(array(), 1); - $args->addElement(new Twig_Node_Expression_Name('foo', 1)); - $args->addElement(new Twig_Node_Expression_Constant('bar', 1)); - $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::METHOD_CALL, 1); - $tests[] = array($node, sprintf('%s%s, "bar", array(0 => %s, 1 => "bar"), "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1), $this->getVariableGetter('foo'))); + $tests = []; + + $expr = new NameExpression('foo', 1); + $attr = new ConstantExpression('bar', 1); + $args = new ArrayExpression([], 1); + $node = new GetAttrExpression($expr, $attr, $args, Template::ANY_CALL, 1); + $tests[] = [$node, sprintf('%s%s, "bar", [])', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))]; + + $node = new GetAttrExpression($expr, $attr, $args, Template::ARRAY_CALL, 1); + $tests[] = [$node, sprintf('%s%s, "bar", [], "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))]; + + $args = new ArrayExpression([], 1); + $args->addElement(new NameExpression('foo', 1)); + $args->addElement(new ConstantExpression('bar', 1)); + $node = new GetAttrExpression($expr, $attr, $args, Template::METHOD_CALL, 1); + $tests[] = [$node, sprintf('%s%s, "bar", [0 => %s, 1 => "bar"], "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1), $this->getVariableGetter('foo'))]; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php index 70721a8bf6679b1918b239f0b88b39a8ce045592..269c04b4c105bdf31ff2c6d2f4cb5da71983bf10 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php @@ -9,22 +9,26 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_NameTest extends Twig_Test_NodeTestCase +use Twig\Environment; +use Twig\Node\Expression\NameExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_NameTest extends NodeTestCase { public function testConstructor() { - $node = new Twig_Node_Expression_Name('foo', 1); + $node = new NameExpression('foo', 1); $this->assertEquals('foo', $node->getAttribute('name')); } public function getTests() { - $node = new Twig_Node_Expression_Name('foo', 1); - $context = new Twig_Node_Expression_Name('_context', 1); + $node = new NameExpression('foo', 1); + $context = new NameExpression('_context', 1); - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true)); - $env1 = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => false)); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true]); + $env1 = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => false]); if (PHP_VERSION_ID >= 70000) { $output = '($context["foo"] ?? $this->getContext($context, "foo"))'; @@ -34,10 +38,10 @@ public function getTests() $output = '$this->getContext($context, "foo")'; } - return array( - array($node, "// line 1\n".$output, $env), - array($node, $this->getVariableGetter('foo', 1), $env1), - array($context, "// line 1\n\$context"), - ); + return [ + [$node, "// line 1\n".$output, $env], + [$node, $this->getVariableGetter('foo', 1), $env1], + [$context, "// line 1\n\$context"], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php index a37490baf2946430032c3be87c6a2b1699882e5b..eb7c33573d88f4ac940701e7a320db2b1af14812 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php @@ -9,21 +9,26 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_NullCoalesceTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\Expression\NullCoalesceExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_NullCoalesceTest extends NodeTestCase { public function getTests() { - $tests = array(); + $tests = []; - $left = new Twig_Node_Expression_Name('foo', 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_NullCoalesce($left, $right, 1); + $left = new NameExpression('foo', 1); + $right = new ConstantExpression(2, 1); + $node = new NullCoalesceExpression($left, $right, 1); if (PHP_VERSION_ID >= 70000) { - $tests[] = array($node, "((// line 1\n\$context[\"foo\"]) ?? (2))"); + $tests[] = [$node, "((// line 1\n\$context[\"foo\"]) ?? (2))"]; } elseif (PHP_VERSION_ID >= 50400) { - $tests[] = array($node, "(((// line 1\narray_key_exists(\"foo\", \$context) && !(null === (isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)))) ? ((isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)) : (2))"); + $tests[] = [$node, "(((// line 1\n(isset(\$context[\"foo\"]) || array_key_exists(\"foo\", \$context)) && !(null === (isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)))) ? ((isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)) : (2))"]; } else { - $tests[] = array($node, "(((// line 1\narray_key_exists(\"foo\", \$context) && !(null === \$this->getContext(\$context, \"foo\")))) ? (\$this->getContext(\$context, \"foo\")) : (2))"); + $tests[] = [$node, "(((// line 1\n(isset(\$context[\"foo\"]) || array_key_exists(\"foo\", \$context)) && !(null === \$this->getContext(\$context, \"foo\")))) ? (\$this->getContext(\$context, \"foo\")) : (2))"]; } return $tests; diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php index b5394bcf42656b8085447bab6efc641d65a0ca47..5ea41d80bba3cd2aa6820ee6e3084fcbd54fcd7e 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php @@ -1,6 +1,6 @@ <?php -$env = new Twig_Environment(new Twig_Loader_Array(array())); -$env->addFilter(new Twig_SimpleFilter('anonymous', function () {})); +$env = new \Twig\Environment(new \Twig\Loader\ArrayLoader([])); +$env->addFilter(new \Twig\TwigFilter('anonymous', function () {})); return $env; diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php index e8f68c7288c32607e219df0a48f193e8c3dacd09..44cd979974e4671cbff429128fe9e2c8764aefc9 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FunctionInclude.php @@ -1,6 +1,6 @@ <?php -$env = new Twig_Environment(new Twig_Loader_Array(array())); -$env->addFunction(new Twig_SimpleFunction('anonymous', function () {})); +$env = new \Twig\Environment(new \Twig\Loader\ArrayLoader([])); +$env->addFunction(new \Twig\TwigFunction('anonymous', function () {})); return $env; diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php index 9f818bc411aa619e457d000e5565d58f1eef5fd0..1f30a71ecf36c65b020b90dda24b648c5775bdc5 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/TestInclude.php @@ -1,6 +1,6 @@ <?php -$env = new Twig_Environment(new Twig_Loader_Array(array())); -$env->addTest(new Twig_SimpleTest('anonymous', function () {})); +$env = new \Twig\Environment(new \Twig\Loader\ArrayLoader([])); +$env->addTest(new \Twig\TwigTest('anonymous', function () {})); return $env; diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php index ab2bbe07485775f51bcc6aecc109ecf70f967648..0c3a9aafb1811648a176eee17622b2b10cf3854e 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php @@ -9,19 +9,22 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_ParentTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ParentExpression; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_ParentTest extends NodeTestCase { public function testConstructor() { - $node = new Twig_Node_Expression_Parent('foo', 1); + $node = new ParentExpression('foo', 1); $this->assertEquals('foo', $node->getAttribute('name')); } public function getTests() { - $tests = array(); - $tests[] = array(new Twig_Node_Expression_Parent('foo', 1), '$this->renderParentBlock("foo", $context, $blocks)'); + $tests = []; + $tests[] = [new ParentExpression('foo', 1), '$this->renderParentBlock("foo", $context, $blocks)']; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php index a5f96d245113ec8362c2e498311fa21d7f397892..ef7fb66ef3022a350ce05068b3651be2fe83bde4 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php @@ -9,14 +9,22 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_TestTest extends Twig_Test_NodeTestCase +use Twig\Environment; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\Test\NullTest; +use Twig\Node\Expression\TestExpression; +use Twig\Node\Node; +use Twig\Test\NodeTestCase; +use Twig\TwigTest; + +class Twig_Tests_Node_Expression_TestTest extends NodeTestCase { public function testConstructor() { - $expr = new Twig_Node_Expression_Constant('foo', 1); - $name = new Twig_Node_Expression_Constant('null', 1); - $args = new Twig_Node(); - $node = new Twig_Node_Expression_Test($expr, $name, $args, 1); + $expr = new ConstantExpression('foo', 1); + $name = new ConstantExpression('null', 1); + $args = new Node(); + $node = new TestExpression($expr, $name, $args, 1); $this->assertEquals($expr, $node->getNode('node')); $this->assertEquals($args, $node->getNode('arguments')); @@ -25,46 +33,46 @@ public function testConstructor() public function getTests() { - $environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $environment->addTest(new Twig_SimpleTest('barbar', 'twig_tests_test_barbar', array('is_variadic' => true, 'need_context' => true))); + $environment = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $environment->addTest(new TwigTest('barbar', 'twig_tests_test_barbar', ['is_variadic' => true, 'need_context' => true])); - $tests = array(); + $tests = []; - $expr = new Twig_Node_Expression_Constant('foo', 1); - $node = new Twig_Node_Expression_Test_Null($expr, 'null', new Twig_Node(array()), 1); - $tests[] = array($node, '(null === "foo")'); + $expr = new ConstantExpression('foo', 1); + $node = new NullTest($expr, 'null', new Node([]), 1); + $tests[] = [$node, '(null === "foo")']; // test as an anonymous function if (PHP_VERSION_ID >= 50300) { - $node = $this->createTest(new Twig_Node_Expression_Constant('foo', 1), 'anonymous', array(new Twig_Node_Expression_Constant('foo', 1))); - $tests[] = array($node, 'call_user_func_array($this->env->getTest(\'anonymous\')->getCallable(), array("foo", "foo"))'); + $node = $this->createTest(new ConstantExpression('foo', 1), 'anonymous', [new ConstantExpression('foo', 1)]); + $tests[] = [$node, 'call_user_func_array($this->env->getTest(\'anonymous\')->getCallable(), ["foo", "foo"])']; } // arbitrary named arguments - $string = new Twig_Node_Expression_Constant('abc', 1); + $string = new ConstantExpression('abc', 1); $node = $this->createTest($string, 'barbar'); - $tests[] = array($node, 'twig_tests_test_barbar("abc")', $environment); + $tests[] = [$node, 'twig_tests_test_barbar("abc")', $environment]; - $node = $this->createTest($string, 'barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_test_barbar("abc", null, null, array("foo" => "bar"))', $environment); + $node = $this->createTest($string, 'barbar', ['foo' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_test_barbar("abc", null, null, ["foo" => "bar"])', $environment]; - $node = $this->createTest($string, 'barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_test_barbar("abc", null, "bar")', $environment); + $node = $this->createTest($string, 'barbar', ['arg2' => new ConstantExpression('bar', 1)]); + $tests[] = [$node, 'twig_tests_test_barbar("abc", null, "bar")', $environment]; - $node = $this->createTest($string, 'barbar', array( - new Twig_Node_Expression_Constant('1', 1), - new Twig_Node_Expression_Constant('2', 1), - new Twig_Node_Expression_Constant('3', 1), - 'foo' => new Twig_Node_Expression_Constant('bar', 1), - )); - $tests[] = array($node, 'twig_tests_test_barbar("abc", "1", "2", array(0 => "3", "foo" => "bar"))', $environment); + $node = $this->createTest($string, 'barbar', [ + new ConstantExpression('1', 1), + new ConstantExpression('2', 1), + new ConstantExpression('3', 1), + 'foo' => new ConstantExpression('bar', 1), + ]); + $tests[] = [$node, 'twig_tests_test_barbar("abc", "1", "2", [0 => "3", "foo" => "bar"])', $environment]; return $tests; } - protected function createTest($node, $name, array $arguments = array()) + protected function createTest($node, $name, array $arguments = []) { - return new Twig_Node_Expression_Test($node, $name, new Twig_Node($arguments), 1); + return new TestExpression($node, $name, new Node($arguments), 1); } protected function getEnvironment() @@ -77,6 +85,6 @@ protected function getEnvironment() } } -function twig_tests_test_barbar($string, $arg1 = null, $arg2 = null, array $args = array()) +function twig_tests_test_barbar($string, $arg1 = null, $arg2 = null, array $args = []) { } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php index b63337117d9edd10f9966638e7012dc759c3d25f..6c976ad4ca8ecb9df2d39ed953279b2ba0025b49 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php @@ -9,24 +9,28 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Unary_NegTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\Unary\NegUnary; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Unary_NegTest extends NodeTestCase { public function testConstructor() { - $expr = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Neg($expr, 1); + $expr = new ConstantExpression(1, 1); + $node = new NegUnary($expr, 1); $this->assertEquals($expr, $node->getNode('node')); } public function getTests() { - $node = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Neg($node, 1); + $node = new ConstantExpression(1, 1); + $node = new NegUnary($node, 1); - return array( - array($node, '-1'), - array(new Twig_Node_Expression_Unary_Neg($node, 1), '- -1'), - ); + return [ + [$node, '-1'], + [new NegUnary($node, 1), '- -1'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php index d7c6f85e789b273afdff3b7f4988858773fe62f2..493a37e5504c31df4bb4786201687e3d5a9166d0 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php @@ -9,23 +9,27 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Unary_NotTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\Unary\NotUnary; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Unary_NotTest extends NodeTestCase { public function testConstructor() { - $expr = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Not($expr, 1); + $expr = new ConstantExpression(1, 1); + $node = new NotUnary($expr, 1); $this->assertEquals($expr, $node->getNode('node')); } public function getTests() { - $node = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Not($node, 1); + $node = new ConstantExpression(1, 1); + $node = new NotUnary($node, 1); - return array( - array($node, '!1'), - ); + return [ + [$node, '!1'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php index 057250f376565d12cdec00f0c638208e4fe29f69..015446d437831f2d79b18f56b08705a2c0fbad0a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php @@ -9,23 +9,27 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_Expression_Unary_PosTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\Unary\PosUnary; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_Expression_Unary_PosTest extends NodeTestCase { public function testConstructor() { - $expr = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Pos($expr, 1); + $expr = new ConstantExpression(1, 1); + $node = new PosUnary($expr, 1); $this->assertEquals($expr, $node->getNode('node')); } public function getTests() { - $node = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Pos($node, 1); + $node = new ConstantExpression(1, 1); + $node = new PosUnary($node, 1); - return array( - array($node, '+1'), - ); + return [ + [$node, '+1'], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php b/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php index 2bf4c7b436d5a0ccdfcd0e9c8d008157b12046ce..44b986e46f3733a2f88265c16fbfbceb000223f1 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php @@ -9,47 +9,55 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_ForTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\ForNode; +use Twig\Node\Node; +use Twig\Node\PrintNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_ForTest extends NodeTestCase { public function testConstructor() { - $keyTarget = new Twig_Node_Expression_AssignName('key', 1); - $valueTarget = new Twig_Node_Expression_AssignName('item', 1); - $seq = new Twig_Node_Expression_Name('items', 1); - $ifexpr = new Twig_Node_Expression_Constant(true, 1); - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); + $keyTarget = new AssignNameExpression('key', 1); + $valueTarget = new AssignNameExpression('item', 1); + $seq = new NameExpression('items', 1); + $ifexpr = new ConstantExpression(true, 1); + $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1); $else = null; - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); $node->setAttribute('with_loop', false); $this->assertEquals($keyTarget, $node->getNode('key_target')); $this->assertEquals($valueTarget, $node->getNode('value_target')); $this->assertEquals($seq, $node->getNode('seq')); $this->assertTrue($node->getAttribute('ifexpr')); - $this->assertEquals('Twig_Node_If', get_class($node->getNode('body'))); + $this->assertInstanceOf('\Twig\Node\IfNode', $node->getNode('body')); $this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0)); $this->assertFalse($node->hasNode('else')); - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1); - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $else = new PrintNode(new NameExpression('foo', 1), 1); + $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); $node->setAttribute('with_loop', false); $this->assertEquals($else, $node->getNode('else')); } public function getTests() { - $tests = array(); + $tests = []; - $keyTarget = new Twig_Node_Expression_AssignName('key', 1); - $valueTarget = new Twig_Node_Expression_AssignName('item', 1); - $seq = new Twig_Node_Expression_Name('items', 1); + $keyTarget = new AssignNameExpression('key', 1); + $valueTarget = new AssignNameExpression('item', 1); + $seq = new NameExpression('items', 1); $ifexpr = null; - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); + $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1); $else = null; - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); $node->setAttribute('with_loop', false); - $tests[] = array($node, <<<EOF + $tests[] = [$node, <<<EOF // line 1 \$context['_parent'] = \$context; \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('items')}); @@ -60,28 +68,28 @@ public function getTests() unset(\$context['_seq'], \$context['_iterated'], \$context['key'], \$context['item'], \$context['_parent'], \$context['loop']); \$context = array_intersect_key(\$context, \$_parent) + \$_parent; EOF - ); + ]; - $keyTarget = new Twig_Node_Expression_AssignName('k', 1); - $valueTarget = new Twig_Node_Expression_AssignName('v', 1); - $seq = new Twig_Node_Expression_Name('values', 1); + $keyTarget = new AssignNameExpression('k', 1); + $valueTarget = new AssignNameExpression('v', 1); + $seq = new NameExpression('values', 1); $ifexpr = null; - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); + $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1); $else = null; - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); $node->setAttribute('with_loop', true); - $tests[] = array($node, <<<EOF + $tests[] = [$node, <<<EOF // line 1 \$context['_parent'] = \$context; \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')}); -\$context['loop'] = array( +\$context['loop'] = [ 'parent' => \$context['_parent'], 'index0' => 0, 'index' => 1, 'first' => true, -); -if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { +]; +if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \Countable)) { \$length = count(\$context['_seq']); \$context['loop']['revindex0'] = \$length - 1; \$context['loop']['revindex'] = \$length; @@ -103,27 +111,27 @@ public function getTests() unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); \$context = array_intersect_key(\$context, \$_parent) + \$_parent; EOF - ); + ]; - $keyTarget = new Twig_Node_Expression_AssignName('k', 1); - $valueTarget = new Twig_Node_Expression_AssignName('v', 1); - $seq = new Twig_Node_Expression_Name('values', 1); - $ifexpr = new Twig_Node_Expression_Constant(true, 1); - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); + $keyTarget = new AssignNameExpression('k', 1); + $valueTarget = new AssignNameExpression('v', 1); + $seq = new NameExpression('values', 1); + $ifexpr = new ConstantExpression(true, 1); + $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1); $else = null; - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); $node->setAttribute('with_loop', true); - $tests[] = array($node, <<<EOF + $tests[] = [$node, <<<EOF // line 1 \$context['_parent'] = \$context; \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')}); -\$context['loop'] = array( +\$context['loop'] = [ 'parent' => \$context['_parent'], 'index0' => 0, 'index' => 1, 'first' => true, -); +]; foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { if (true) { echo {$this->getVariableGetter('foo')}; @@ -136,29 +144,29 @@ public function getTests() unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); \$context = array_intersect_key(\$context, \$_parent) + \$_parent; EOF - ); + ]; - $keyTarget = new Twig_Node_Expression_AssignName('k', 1); - $valueTarget = new Twig_Node_Expression_AssignName('v', 1); - $seq = new Twig_Node_Expression_Name('values', 1); + $keyTarget = new AssignNameExpression('k', 1); + $valueTarget = new AssignNameExpression('v', 1); + $seq = new NameExpression('values', 1); $ifexpr = null; - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1); - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); + $body = new Node([new PrintNode(new NameExpression('foo', 1), 1)], [], 1); + $else = new PrintNode(new NameExpression('foo', 1), 1); + $node = new ForNode($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); $node->setAttribute('with_loop', true); - $tests[] = array($node, <<<EOF + $tests[] = [$node, <<<EOF // line 1 \$context['_parent'] = \$context; \$context['_seq'] = twig_ensure_traversable({$this->getVariableGetter('values')}); \$context['_iterated'] = false; -\$context['loop'] = array( +\$context['loop'] = [ 'parent' => \$context['_parent'], 'index0' => 0, 'index' => 1, 'first' => true, -); -if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { +]; +if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \Countable)) { \$length = count(\$context['_seq']); \$context['loop']['revindex0'] = \$length - 1; \$context['loop']['revindex'] = \$length; @@ -184,7 +192,7 @@ public function getTests() unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); \$context = array_intersect_key(\$context, \$_parent) + \$_parent; EOF - ); + ]; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php b/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php index 4ab0e4cc71c970eb04e13d699eb7fcb0f5a1518e..82a6959319090a9a61f2a8c4fe4b39abf772afa2 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php @@ -9,54 +9,61 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_IfTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\IfNode; +use Twig\Node\Node; +use Twig\Node\PrintNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_IfTest extends NodeTestCase { public function testConstructor() { - $t = new Twig_Node(array( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), - ), array(), 1); + $t = new Node([ + new ConstantExpression(true, 1), + new PrintNode(new NameExpression('foo', 1), 1), + ], [], 1); $else = null; - $node = new Twig_Node_If($t, $else, 1); + $node = new IfNode($t, $else, 1); $this->assertEquals($t, $node->getNode('tests')); $this->assertFalse($node->hasNode('else')); - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1); - $node = new Twig_Node_If($t, $else, 1); + $else = new PrintNode(new NameExpression('bar', 1), 1); + $node = new IfNode($t, $else, 1); $this->assertEquals($else, $node->getNode('else')); } public function getTests() { - $tests = array(); + $tests = []; - $t = new Twig_Node(array( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), - ), array(), 1); + $t = new Node([ + new ConstantExpression(true, 1), + new PrintNode(new NameExpression('foo', 1), 1), + ], [], 1); $else = null; - $node = new Twig_Node_If($t, $else, 1); + $node = new IfNode($t, $else, 1); - $tests[] = array($node, <<<EOF + $tests[] = [$node, <<<EOF // line 1 if (true) { echo {$this->getVariableGetter('foo')}; } EOF - ); + ]; - $t = new Twig_Node(array( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), - new Twig_Node_Expression_Constant(false, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1), - ), array(), 1); + $t = new Node([ + new ConstantExpression(true, 1), + new PrintNode(new NameExpression('foo', 1), 1), + new ConstantExpression(false, 1), + new PrintNode(new NameExpression('bar', 1), 1), + ], [], 1); $else = null; - $node = new Twig_Node_If($t, $else, 1); + $node = new IfNode($t, $else, 1); - $tests[] = array($node, <<<EOF + $tests[] = [$node, <<<EOF // line 1 if (true) { echo {$this->getVariableGetter('foo')}; @@ -64,16 +71,16 @@ public function getTests() echo {$this->getVariableGetter('bar')}; } EOF - ); + ]; - $t = new Twig_Node(array( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), - ), array(), 1); - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1); - $node = new Twig_Node_If($t, $else, 1); + $t = new Node([ + new ConstantExpression(true, 1), + new PrintNode(new NameExpression('foo', 1), 1), + ], [], 1); + $else = new PrintNode(new NameExpression('bar', 1), 1); + $node = new IfNode($t, $else, 1); - $tests[] = array($node, <<<EOF + $tests[] = [$node, <<<EOF // line 1 if (true) { echo {$this->getVariableGetter('foo')}; @@ -81,7 +88,7 @@ public function getTests() echo {$this->getVariableGetter('bar')}; } EOF - ); + ]; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php b/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php index 36525b251f88eea2ed88c0778bd49ab6afe2dc47..56e56e688e6c9ca9b46852a9b86c34d606fa8c8a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php @@ -9,13 +9,18 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_ImportTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\ImportNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_ImportTest extends NodeTestCase { public function testConstructor() { - $macro = new Twig_Node_Expression_Constant('foo.twig', 1); - $var = new Twig_Node_Expression_AssignName('macro', 1); - $node = new Twig_Node_Import($macro, $var, 1); + $macro = new ConstantExpression('foo.twig', 1); + $var = new AssignNameExpression('macro', 1); + $node = new ImportNode($macro, $var, 1); $this->assertEquals($macro, $node->getNode('expr')); $this->assertEquals($var, $node->getNode('var')); @@ -23,17 +28,17 @@ public function testConstructor() public function getTests() { - $tests = array(); + $tests = []; - $macro = new Twig_Node_Expression_Constant('foo.twig', 1); - $var = new Twig_Node_Expression_AssignName('macro', 1); - $node = new Twig_Node_Import($macro, $var, 1); + $macro = new ConstantExpression('foo.twig', 1); + $var = new AssignNameExpression('macro', 1); + $node = new ImportNode($macro, $var, 1); - $tests[] = array($node, <<<EOF + $tests[] = [$node, <<<EOF // line 1 \$context["macro"] = \$this->loadTemplate("foo.twig", null, 1); EOF - ); + ]; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php b/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php index d801f3387eb7bf714e97c92e5ab34c030603146b..bdb9d0a99598006a2fbcd0231d7edc08ae8b721f 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php @@ -9,74 +9,80 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_IncludeTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Expression\ConditionalExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\IncludeNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_IncludeTest extends NodeTestCase { public function testConstructor() { - $expr = new Twig_Node_Expression_Constant('foo.twig', 1); - $node = new Twig_Node_Include($expr, null, false, false, 1); + $expr = new ConstantExpression('foo.twig', 1); + $node = new IncludeNode($expr, null, false, false, 1); $this->assertFalse($node->hasNode('variables')); $this->assertEquals($expr, $node->getNode('expr')); $this->assertFalse($node->getAttribute('only')); - $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Constant(true, 1)), 1); - $node = new Twig_Node_Include($expr, $vars, true, false, 1); + $vars = new ArrayExpression([new ConstantExpression('foo', 1), new ConstantExpression(true, 1)], 1); + $node = new IncludeNode($expr, $vars, true, false, 1); $this->assertEquals($vars, $node->getNode('variables')); $this->assertTrue($node->getAttribute('only')); } public function getTests() { - $tests = array(); + $tests = []; - $expr = new Twig_Node_Expression_Constant('foo.twig', 1); - $node = new Twig_Node_Include($expr, null, false, false, 1); - $tests[] = array($node, <<<EOF + $expr = new ConstantExpression('foo.twig', 1); + $node = new IncludeNode($expr, null, false, false, 1); + $tests[] = [$node, <<<EOF // line 1 \$this->loadTemplate("foo.twig", null, 1)->display(\$context); EOF - ); + ]; - $expr = new Twig_Node_Expression_Conditional( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Expression_Constant('foo', 1), - new Twig_Node_Expression_Constant('foo', 1), + $expr = new ConditionalExpression( + new ConstantExpression(true, 1), + new ConstantExpression('foo', 1), + new ConstantExpression('foo', 1), 0 ); - $node = new Twig_Node_Include($expr, null, false, false, 1); - $tests[] = array($node, <<<EOF + $node = new IncludeNode($expr, null, false, false, 1); + $tests[] = [$node, <<<EOF // line 1 \$this->loadTemplate(((true) ? ("foo") : ("foo")), null, 1)->display(\$context); EOF - ); + ]; - $expr = new Twig_Node_Expression_Constant('foo.twig', 1); - $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Constant(true, 1)), 1); - $node = new Twig_Node_Include($expr, $vars, false, false, 1); - $tests[] = array($node, <<<EOF + $expr = new ConstantExpression('foo.twig', 1); + $vars = new ArrayExpression([new ConstantExpression('foo', 1), new ConstantExpression(true, 1)], 1); + $node = new IncludeNode($expr, $vars, false, false, 1); + $tests[] = [$node, <<<EOF // line 1 -\$this->loadTemplate("foo.twig", null, 1)->display(array_merge(\$context, array("foo" => true))); +\$this->loadTemplate("foo.twig", null, 1)->display(array_merge(\$context, ["foo" => true])); EOF - ); + ]; - $node = new Twig_Node_Include($expr, $vars, true, false, 1); - $tests[] = array($node, <<<EOF + $node = new IncludeNode($expr, $vars, true, false, 1); + $tests[] = [$node, <<<EOF // line 1 -\$this->loadTemplate("foo.twig", null, 1)->display(array("foo" => true)); +\$this->loadTemplate("foo.twig", null, 1)->display(["foo" => true]); EOF - ); + ]; - $node = new Twig_Node_Include($expr, $vars, true, true, 1); - $tests[] = array($node, <<<EOF + $node = new IncludeNode($expr, $vars, true, true, 1); + $tests[] = [$node, <<<EOF // line 1 try { - \$this->loadTemplate("foo.twig", null, 1)->display(array("foo" => true)); -} catch (Twig_Error_Loader \$e) { + \$this->loadTemplate("foo.twig", null, 1)->display(["foo" => true]); +} catch (LoaderError \$e) { // ignore missing template } EOF - ); + ]; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php b/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php index c7edfa251641d7b52a118af2ebbd179902683ae2..429fa6e1194e6eb2482b49ae35fad0628eb6dd47 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php @@ -9,13 +9,20 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_MacroTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\MacroNode; +use Twig\Node\Node; +use Twig\Node\TextNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_MacroTest extends NodeTestCase { public function testConstructor() { - $body = new Twig_Node_Text('foo', 1); - $arguments = new Twig_Node(array(new Twig_Node_Expression_Name('foo', 1)), array(), 1); - $node = new Twig_Node_Macro('foo', $body, $arguments, 1); + $body = new TextNode('foo', 1); + $arguments = new Node([new NameExpression('foo', 1)], [], 1); + $node = new MacroNode('foo', $body, $arguments, 1); $this->assertEquals($body, $node->getNode('body')); $this->assertEquals($arguments, $node->getNode('arguments')); @@ -24,51 +31,51 @@ public function testConstructor() public function getTests() { - $body = new Twig_Node_Text('foo', 1); - $arguments = new Twig_Node(array( - 'foo' => new Twig_Node_Expression_Constant(null, 1), - 'bar' => new Twig_Node_Expression_Constant('Foo', 1), - ), array(), 1); - $node = new Twig_Node_Macro('foo', $body, $arguments, 1); + $body = new TextNode('foo', 1); + $arguments = new Node([ + 'foo' => new ConstantExpression(null, 1), + 'bar' => new ConstantExpression('Foo', 1), + ], [], 1); + $node = new MacroNode('foo', $body, $arguments, 1); if (PHP_VERSION_ID >= 50600) { $declaration = ', ...$__varargs__'; $varargs = '$__varargs__'; } else { $declaration = ''; - $varargs = 'func_num_args() > 2 ? array_slice(func_get_args(), 2) : array()'; + $varargs = 'func_num_args() > 2 ? array_slice(func_get_args(), 2) : []'; } - return array( - array($node, <<<EOF + return [ + [$node, <<<EOF // line 1 public function getfoo(\$__foo__ = null, \$__bar__ = "Foo"$declaration) { - \$context = \$this->env->mergeGlobals(array( + \$context = \$this->env->mergeGlobals([ "foo" => \$__foo__, "bar" => \$__bar__, "varargs" => $varargs, - )); + ]); - \$blocks = array(); + \$blocks = []; ob_start(); try { echo "foo"; - } catch (Exception \$e) { + } catch (\Exception \$e) { ob_end_clean(); throw \$e; - } catch (Throwable \$e) { + } catch (\Throwable \$e) { ob_end_clean(); throw \$e; } - return ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset()); + return ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset()); } EOF - ), - ); + ], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php b/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php index 54a8989c73c9f433692aee80a2f280c5471f4f22..875bea20401f04f3a6a8433fae8677f7ffbc2eed 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php @@ -9,17 +9,29 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_ModuleTest extends Twig_Test_NodeTestCase +use Twig\Environment; +use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\Expression\ConditionalExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\ImportNode; +use Twig\Node\ModuleNode; +use Twig\Node\Node; +use Twig\Node\SetNode; +use Twig\Node\TextNode; +use Twig\Source; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_ModuleTest extends NodeTestCase { public function testConstructor() { - $body = new Twig_Node_Text('foo', 1); - $parent = new Twig_Node_Expression_Constant('layout.twig', 1); - $blocks = new Twig_Node(); - $macros = new Twig_Node(); - $traits = new Twig_Node(); - $source = new Twig_Source('{{ foo }}', 'foo.twig'); - $node = new Twig_Node_Module($body, $parent, $blocks, $macros, $traits, new Twig_Node(array()), $source); + $body = new TextNode('foo', 1); + $parent = new ConstantExpression('layout.twig', 1); + $blocks = new Node(); + $macros = new Node(); + $traits = new Node(); + $source = new Source('{{ foo }}', 'foo.twig'); + $node = new ModuleNode($body, $parent, $blocks, $macros, $traits, new Node([]), $source); $this->assertEquals($body, $node->getNode('body')); $this->assertEquals($blocks, $node->getNode('blocks')); @@ -30,35 +42,46 @@ public function testConstructor() public function getTests() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); - $tests = array(); + $tests = []; - $body = new Twig_Node_Text('foo', 1); + $body = new TextNode('foo', 1); $extends = null; - $blocks = new Twig_Node(); - $macros = new Twig_Node(); - $traits = new Twig_Node(); - $source = new Twig_Source('{{ foo }}', 'foo.twig'); + $blocks = new Node(); + $macros = new Node(); + $traits = new Node(); + $source = new Source('{{ foo }}', 'foo.twig'); - $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $source); - $tests[] = array($node, <<<EOF + $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source); + $tests[] = [$node, <<<EOF <?php +use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Markup; +use Twig\Sandbox\SecurityError; +use Twig\Sandbox\SecurityNotAllowedTagError; +use Twig\Sandbox\SecurityNotAllowedFilterError; +use Twig\Sandbox\SecurityNotAllowedFunctionError; +use Twig\Source; +use Twig\Template; + /* foo.twig */ -class __TwigTemplate_%x extends Twig_Template +class __TwigTemplate_%x extends \Twig\Template { - public function __construct(Twig_Environment \$env) + public function __construct(Environment \$env) { parent::__construct(\$env); \$this->parent = false; - \$this->blocks = array( - ); + \$this->blocks = [ + ]; } - protected function doDisplay(array \$context, array \$blocks = array()) + protected function doDisplay(array \$context, array \$blocks = []) { // line 1 echo "foo"; @@ -71,7 +94,7 @@ public function getTemplateName() public function getDebugInfo() { - return array ( 19 => 1,); + return array ( 30 => 1,); } /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */ @@ -84,32 +107,43 @@ public function getSource() public function getSourceContext() { - return new Twig_Source("", "foo.twig", ""); + return new Source("", "foo.twig", ""); } } EOF - , $twig, true); + , $twig, true]; - $import = new Twig_Node_Import(new Twig_Node_Expression_Constant('foo.twig', 1), new Twig_Node_Expression_AssignName('macro', 1), 2); + $import = new ImportNode(new ConstantExpression('foo.twig', 1), new AssignNameExpression('macro', 1), 2); - $body = new Twig_Node(array($import)); - $extends = new Twig_Node_Expression_Constant('layout.twig', 1); + $body = new Node([$import]); + $extends = new ConstantExpression('layout.twig', 1); - $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $source); - $tests[] = array($node, <<<EOF + $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source); + $tests[] = [$node, <<<EOF <?php +use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Markup; +use Twig\Sandbox\SecurityError; +use Twig\Sandbox\SecurityNotAllowedTagError; +use Twig\Sandbox\SecurityNotAllowedFilterError; +use Twig\Sandbox\SecurityNotAllowedFunctionError; +use Twig\Source; +use Twig\Template; + /* foo.twig */ -class __TwigTemplate_%x extends Twig_Template +class __TwigTemplate_%x extends \Twig\Template { - public function __construct(Twig_Environment \$env) + public function __construct(Environment \$env) { parent::__construct(\$env); // line 1 \$this->parent = \$this->loadTemplate("layout.twig", "foo.twig", 1); - \$this->blocks = array( - ); + \$this->blocks = [ + ]; } protected function doGetParent(array \$context) @@ -117,7 +151,7 @@ protected function doGetParent(array \$context) return "layout.twig"; } - protected function doDisplay(array \$context, array \$blocks = array()) + protected function doDisplay(array \$context, array \$blocks = []) { // line 2 \$context["macro"] = \$this->loadTemplate("foo.twig", "foo.twig", 2); @@ -137,7 +171,7 @@ public function isTraitable() public function getDebugInfo() { - return array ( 26 => 1, 24 => 2, 11 => 1,); + return array ( 37 => 1, 35 => 2, 22 => 1,); } /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */ @@ -150,28 +184,39 @@ public function getSource() public function getSourceContext() { - return new Twig_Source("", "foo.twig", ""); + return new Source("", "foo.twig", ""); } } EOF - , $twig, true); - - $set = new Twig_Node_Set(false, new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 4))), new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 4))), 4); - $body = new Twig_Node(array($set)); - $extends = new Twig_Node_Expression_Conditional( - new Twig_Node_Expression_Constant(true, 2), - new Twig_Node_Expression_Constant('foo', 2), - new Twig_Node_Expression_Constant('foo', 2), + , $twig, true]; + + $set = new SetNode(false, new Node([new AssignNameExpression('foo', 4)]), new Node([new ConstantExpression('foo', 4)]), 4); + $body = new Node([$set]); + $extends = new ConditionalExpression( + new ConstantExpression(true, 2), + new ConstantExpression('foo', 2), + new ConstantExpression('foo', 2), 2 ); - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('debug' => true)); - $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $source); - $tests[] = array($node, <<<EOF + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['debug' => true]); + $node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source); + $tests[] = [$node, <<<EOF <?php +use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Markup; +use Twig\Sandbox\SecurityError; +use Twig\Sandbox\SecurityNotAllowedTagError; +use Twig\Sandbox\SecurityNotAllowedFilterError; +use Twig\Sandbox\SecurityNotAllowedFunctionError; +use Twig\Source; +use Twig\Template; + /* foo.twig */ -class __TwigTemplate_%x extends Twig_Template +class __TwigTemplate_%x extends \Twig\Template { protected function doGetParent(array \$context) { @@ -179,7 +224,7 @@ protected function doGetParent(array \$context) return \$this->loadTemplate(((true) ? ("foo") : ("foo")), "foo.twig", 2); } - protected function doDisplay(array \$context, array \$blocks = array()) + protected function doDisplay(array \$context, array \$blocks = []) { // line 4 \$context["foo"] = "foo"; @@ -199,7 +244,7 @@ public function isTraitable() public function getDebugInfo() { - return array ( 17 => 2, 15 => 4, 9 => 2,); + return array ( 28 => 2, 26 => 4, 20 => 2,); } /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */ @@ -212,11 +257,11 @@ public function getSource() public function getSourceContext() { - return new Twig_Source("{{ foo }}", "foo.twig", ""); + return new Source("{{ foo }}", "foo.twig", ""); } } EOF - , $twig, true); + , $twig, true]; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php b/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php index 4e0990facce6cb53dc5ded191fb6d4f829f224d9..efb5ebafcbd91fa3a07f6b9df2255e891cde767a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php @@ -9,20 +9,24 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_PrintTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\PrintNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_PrintTest extends NodeTestCase { public function testConstructor() { - $expr = new Twig_Node_Expression_Constant('foo', 1); - $node = new Twig_Node_Print($expr, 1); + $expr = new ConstantExpression('foo', 1); + $node = new PrintNode($expr, 1); $this->assertEquals($expr, $node->getNode('expr')); } public function getTests() { - $tests = array(); - $tests[] = array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 1), 1), "// line 1\necho \"foo\";"); + $tests = []; + $tests[] = [new PrintNode(new ConstantExpression('foo', 1), 1), "// line 1\necho \"foo\";"]; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php index 56f48773027707a7be099fa8c2c3008d49c2a749..7dd3e08f0b198e392e59d1e62f8699c1edc40b90 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php @@ -9,35 +9,38 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_SandboxTest extends Twig_Test_NodeTestCase +use Twig\Node\SandboxNode; +use Twig\Node\TextNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_SandboxTest extends NodeTestCase { public function testConstructor() { - $body = new Twig_Node_Text('foo', 1); - $node = new Twig_Node_Sandbox($body, 1); + $body = new TextNode('foo', 1); + $node = new SandboxNode($body, 1); $this->assertEquals($body, $node->getNode('body')); } public function getTests() { - $tests = array(); + $tests = []; - $body = new Twig_Node_Text('foo', 1); - $node = new Twig_Node_Sandbox($body, 1); + $body = new TextNode('foo', 1); + $node = new SandboxNode($body, 1); - $tests[] = array($node, <<<EOF + $tests[] = [$node, <<<EOF // line 1 -\$sandbox = \$this->env->getExtension('Twig_Extension_Sandbox'); -if (!\$alreadySandboxed = \$sandbox->isSandboxed()) { - \$sandbox->enableSandbox(); +if (!\$alreadySandboxed = \$this->sandbox->isSandboxed()) { + \$this->sandbox->enableSandbox(); } echo "foo"; if (!\$alreadySandboxed) { - \$sandbox->disableSandbox(); + \$this->sandbox->disableSandbox(); } EOF - ); + ]; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php deleted file mode 100644 index 8bc8a755c1f3668ef28bca09af18b6498cfba9ca..0000000000000000000000000000000000000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php +++ /dev/null @@ -1,33 +0,0 @@ -<?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. - */ - -class Twig_Tests_Node_SandboxedPrintTest extends Twig_Test_NodeTestCase -{ - public function testConstructor() - { - $node = new Twig_Node_SandboxedPrint($expr = new Twig_Node_Expression_Constant('foo', 1), 1); - - $this->assertEquals($expr, $node->getNode('expr')); - } - - public function getTests() - { - $tests = array(); - - $tests[] = array(new Twig_Node_SandboxedPrint(new Twig_Node_Expression_Constant('foo', 1), 1), <<<EOF -// line 1 -echo \$this->env->getExtension('Twig_Extension_Sandbox')->ensureToStringAllowed("foo"); -EOF - ); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php index 62ad2803ea24d7108288448d46dc1c99762d27fd..4f6b942713409616f5c9d69f51df24b8bb9249d3 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php @@ -9,13 +9,22 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_SetTest extends Twig_Test_NodeTestCase +use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\Node; +use Twig\Node\PrintNode; +use Twig\Node\SetNode; +use Twig\Node\TextNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_SetTest extends NodeTestCase { public function testConstructor() { - $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1); - $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1)), array(), 1); - $node = new Twig_Node_Set(false, $names, $values, 1); + $names = new Node([new AssignNameExpression('foo', 1)], [], 1); + $values = new Node([new ConstantExpression('foo', 1)], [], 1); + $node = new SetNode(false, $names, $values, 1); $this->assertEquals($names, $node->getNode('names')); $this->assertEquals($values, $node->getNode('values')); @@ -24,45 +33,45 @@ public function testConstructor() public function getTests() { - $tests = array(); + $tests = []; - $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1); - $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1)), array(), 1); - $node = new Twig_Node_Set(false, $names, $values, 1); - $tests[] = array($node, <<<EOF + $names = new Node([new AssignNameExpression('foo', 1)], [], 1); + $values = new Node([new ConstantExpression('foo', 1)], [], 1); + $node = new SetNode(false, $names, $values, 1); + $tests[] = [$node, <<<EOF // line 1 \$context["foo"] = "foo"; EOF - ); + ]; - $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1); - $values = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 1), 1)), array(), 1); - $node = new Twig_Node_Set(true, $names, $values, 1); - $tests[] = array($node, <<<EOF + $names = new Node([new AssignNameExpression('foo', 1)], [], 1); + $values = new Node([new PrintNode(new ConstantExpression('foo', 1), 1)], [], 1); + $node = new SetNode(true, $names, $values, 1); + $tests[] = [$node, <<<EOF // line 1 ob_start(); echo "foo"; -\$context["foo"] = ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset()); +\$context["foo"] = ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset()); EOF - ); + ]; - $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1); - $values = new Twig_Node_Text('foo', 1); - $node = new Twig_Node_Set(true, $names, $values, 1); - $tests[] = array($node, <<<EOF + $names = new Node([new AssignNameExpression('foo', 1)], [], 1); + $values = new TextNode('foo', 1); + $node = new SetNode(true, $names, $values, 1); + $tests[] = [$node, <<<EOF // line 1 -\$context["foo"] = ('' === \$tmp = "foo") ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset()); +\$context["foo"] = ('' === \$tmp = "foo") ? '' : new Markup(\$tmp, \$this->env->getCharset()); EOF - ); + ]; - $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1), new Twig_Node_Expression_AssignName('bar', 1)), array(), 1); - $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Name('bar', 1)), array(), 1); - $node = new Twig_Node_Set(false, $names, $values, 1); - $tests[] = array($node, <<<EOF + $names = new Node([new AssignNameExpression('foo', 1), new AssignNameExpression('bar', 1)], [], 1); + $values = new Node([new ConstantExpression('foo', 1), new NameExpression('bar', 1)], [], 1); + $node = new SetNode(false, $names, $values, 1); + $tests[] = [$node, <<<EOF // line 1 -list(\$context["foo"], \$context["bar"]) = array("foo", {$this->getVariableGetter('bar')}); +list(\$context["foo"], \$context["bar"]) = ["foo", {$this->getVariableGetter('bar')}]; EOF - ); + ]; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php index 222ca0920730fc68ad112a8012e1f4f30070fd92..c0b7d526a1e5312403898e1be94cb272ce942d28 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php @@ -9,29 +9,34 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_SpacelessTest extends Twig_Test_NodeTestCase +use Twig\Node\Node; +use Twig\Node\SpacelessNode; +use Twig\Node\TextNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_SpacelessTest extends NodeTestCase { public function testConstructor() { - $body = new Twig_Node(array(new Twig_Node_Text('<div> <div> foo </div> </div>', 1))); - $node = new Twig_Node_Spaceless($body, 1); + $body = new Node([new TextNode('<div> <div> foo </div> </div>', 1)]); + $node = new SpacelessNode($body, 1); $this->assertEquals($body, $node->getNode('body')); } public function getTests() { - $body = new Twig_Node(array(new Twig_Node_Text('<div> <div> foo </div> </div>', 1))); - $node = new Twig_Node_Spaceless($body, 1); + $body = new Node([new TextNode('<div> <div> foo </div> </div>', 1)]); + $node = new SpacelessNode($body, 1); - return array( - array($node, <<<EOF + return [ + [$node, <<<EOF // line 1 ob_start(); echo "<div> <div> foo </div> </div>"; echo trim(preg_replace('/>\s+</', '><', ob_get_clean())); EOF - ), - ); + ], + ]; } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php b/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php index ceaf67f4c5bda237db26bd62ace65dc85f5dbf0e..6735083ce2d766d447ae0ba98af12935cbfc41a5 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php @@ -9,19 +9,22 @@ * file that was distributed with this source code. */ -class Twig_Tests_Node_TextTest extends Twig_Test_NodeTestCase +use Twig\Node\TextNode; +use Twig\Test\NodeTestCase; + +class Twig_Tests_Node_TextTest extends NodeTestCase { public function testConstructor() { - $node = new Twig_Node_Text('foo', 1); + $node = new TextNode('foo', 1); $this->assertEquals('foo', $node->getAttribute('data')); } public function getTests() { - $tests = array(); - $tests[] = array(new Twig_Node_Text('foo', 1), "// line 1\necho \"foo\";"); + $tests = []; + $tests[] = [new TextNode('foo', 1), "// line 1\necho \"foo\";"]; return $tests; } diff --git a/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php b/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php index 92c0ecac79d1501f046184c6c42e197c016fabe3..9afdbc603834a01bfda65455203c50b8552cd96e 100644 --- a/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php +++ b/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php @@ -8,29 +8,34 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + +use Twig\Environment; +use Twig\Node\ForNode; +use Twig\Source; + class Twig_Tests_NodeVisitor_OptimizerTest extends \PHPUnit\Framework\TestCase { public function testRenderBlockOptimizer() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); - $stream = $env->parse($env->tokenize(new Twig_Source('{{ block("foo") }}', 'index'))); + $stream = $env->parse($env->tokenize(new Source('{{ block("foo") }}', 'index'))); $node = $stream->getNode('body')->getNode(0); - $this->assertEquals('Twig_Node_Expression_BlockReference', get_class($node)); + $this->assertInstanceOf('\Twig\Node\Expression\BlockReferenceExpression', $node); $this->assertTrue($node->getAttribute('output')); } public function testRenderParentBlockOptimizer() { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); - $stream = $env->parse($env->tokenize(new Twig_Source('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index'))); + $stream = $env->parse($env->tokenize(new Source('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index'))); $node = $stream->getNode('blocks')->getNode('content')->getNode(0)->getNode('body'); - $this->assertEquals('Twig_Node_Expression_Parent', get_class($node)); + $this->assertInstanceOf('\Twig\Node\Expression\ParentExpression', $node); $this->assertTrue($node->getAttribute('output')); } @@ -40,12 +45,12 @@ public function testRenderVariableBlockOptimizer() $this->markTestSkipped('not needed on PHP >= 5.4'); } - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $stream = $env->parse($env->tokenize(new Twig_Source('{{ block(name|lower) }}', 'index'))); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false, 'autoescape' => false]); + $stream = $env->parse($env->tokenize(new Source('{{ block(name|lower) }}', 'index'))); $node = $stream->getNode('body')->getNode(0)->getNode(1); - $this->assertEquals('Twig_Node_Expression_BlockReference', get_class($node)); + $this->assertInstanceOf('\Twig\Node\Expression\BlockReferenceExpression', $node); $this->assertTrue($node->getAttribute('output')); } @@ -54,9 +59,9 @@ public function testRenderVariableBlockOptimizer() */ public function testForOptimizer($template, $expected) { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false)); + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['cache' => false]); - $stream = $env->parse($env->tokenize(new Twig_Source($template, 'index'))); + $stream = $env->parse($env->tokenize(new Source($template, 'index'))); foreach ($expected as $target => $withLoop) { $this->assertTrue($this->checkForConfiguration($stream, $target, $withLoop), sprintf('variable %s is %soptimized', $target, $withLoop ? 'not ' : '')); @@ -65,41 +70,41 @@ public function testForOptimizer($template, $expected) public function getTestsForForOptimizer() { - return array( - array('{% for i in foo %}{% endfor %}', array('i' => false)), + return [ + ['{% for i in foo %}{% endfor %}', ['i' => false]], - array('{% for i in foo %}{{ loop.index }}{% endfor %}', array('i' => true)), + ['{% for i in foo %}{{ loop.index }}{% endfor %}', ['i' => true]], - array('{% for i in foo %}{% for j in foo %}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), + ['{% for i in foo %}{% for j in foo %}{% endfor %}{% endfor %}', ['i' => false, 'j' => false]], - array('{% for i in foo %}{% include "foo" %}{% endfor %}', array('i' => true)), + ['{% for i in foo %}{% include "foo" %}{% endfor %}', ['i' => true]], - array('{% for i in foo %}{% include "foo" only %}{% endfor %}', array('i' => false)), + ['{% for i in foo %}{% include "foo" only %}{% endfor %}', ['i' => false]], - array('{% for i in foo %}{% include "foo" with { "foo": "bar" } only %}{% endfor %}', array('i' => false)), + ['{% for i in foo %}{% include "foo" with { "foo": "bar" } only %}{% endfor %}', ['i' => false]], - array('{% for i in foo %}{% include "foo" with { "foo": loop.index } only %}{% endfor %}', array('i' => true)), + ['{% for i in foo %}{% include "foo" with { "foo": loop.index } only %}{% endfor %}', ['i' => true]], - array('{% for i in foo %}{% for j in foo %}{{ loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => true)), + ['{% for i in foo %}{% for j in foo %}{{ loop.index }}{% endfor %}{% endfor %}', ['i' => false, 'j' => true]], - array('{% for i in foo %}{% for j in foo %}{{ loop.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), + ['{% for i in foo %}{% for j in foo %}{{ loop.parent.loop.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => true]], - array('{% for i in foo %}{% set l = loop %}{% for j in foo %}{{ l.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => false)), + ['{% for i in foo %}{% set l = loop %}{% for j in foo %}{{ l.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => false]], - array('{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), + ['{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}', ['i' => false, 'j' => false]], - array('{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), + ['{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}', ['i' => true, 'j' => true]], - array('{% for i in foo %}{{ include("foo") }}{% endfor %}', array('i' => true)), + ['{% for i in foo %}{{ include("foo") }}{% endfor %}', ['i' => true]], - array('{% for i in foo %}{{ include("foo", with_context = false) }}{% endfor %}', array('i' => false)), + ['{% for i in foo %}{{ include("foo", with_context = false) }}{% endfor %}', ['i' => false]], - array('{% for i in foo %}{{ include("foo", with_context = true) }}{% endfor %}', array('i' => true)), + ['{% for i in foo %}{{ include("foo", with_context = true) }}{% endfor %}', ['i' => true]], - array('{% for i in foo %}{{ include("foo", { "foo": "bar" }, with_context = false) }}{% endfor %}', array('i' => false)), + ['{% for i in foo %}{{ include("foo", { "foo": "bar" }, with_context = false) }}{% endfor %}', ['i' => false]], - array('{% for i in foo %}{{ include("foo", { "foo": loop.index }, with_context = false) }}{% endfor %}', array('i' => true)), - ); + ['{% for i in foo %}{{ include("foo", { "foo": loop.index }, with_context = false) }}{% endfor %}', ['i' => true]], + ]; } public function checkForConfiguration(Twig_NodeInterface $node = null, $target, $withLoop) @@ -109,7 +114,7 @@ public function checkForConfiguration(Twig_NodeInterface $node = null, $target, } foreach ($node as $n) { - if ($n instanceof Twig_Node_For) { + if ($n instanceof ForNode) { if ($target === $n->getNode('value_target')->getAttribute('name')) { return $withLoop == $n->getAttribute('with_loop'); } diff --git a/vendor/twig/twig/test/Twig/Tests/ParserTest.php b/vendor/twig/twig/test/Twig/Tests/ParserTest.php index 342fb7bab78bcd69b3ef09d1ebe5b933f9c53f5f..bb39dc9b97f02a21b241ddb1fdc3204580bc06e9 100644 --- a/vendor/twig/twig/test/Twig/Tests/ParserTest.php +++ b/vendor/twig/twig/test/Twig/Tests/ParserTest.php @@ -8,46 +8,57 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + +use Twig\Environment; +use Twig\Node\Node; +use Twig\Node\SetNode; +use Twig\Node\TextNode; +use Twig\Parser; +use Twig\Source; +use Twig\Token; +use Twig\TokenParser\AbstractTokenParser; +use Twig\TokenStream; + class Twig_Tests_ParserTest extends \PHPUnit\Framework\TestCase { /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError */ public function testSetMacroThrowsExceptionOnReservedMethods() { $parser = $this->getParser(); - $parser->setMacro('parent', $this->getMockBuilder('Twig_Node_Macro')->disableOriginalConstructor()->getMock()); + $parser->setMacro('parent', $this->getMockBuilder('\Twig\Node\MacroNode')->disableOriginalConstructor()->getMock()); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unknown "foo" tag. Did you mean "for" at line 1? */ public function testUnknownTag() { - $stream = new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 1), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), - new Twig_Token(Twig_Token::EOF_TYPE, '', 1), - )); - $parser = new Twig_Parser(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); + $stream = new TokenStream([ + new Token(Token::BLOCK_START_TYPE, '', 1), + new Token(Token::NAME_TYPE, 'foo', 1), + new Token(Token::BLOCK_END_TYPE, '', 1), + new Token(Token::EOF_TYPE, '', 1), + ]); + $parser = new Parser(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); $parser->parse($stream); } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unknown "foobar" tag at line 1. */ public function testUnknownTagWithoutSuggestions() { - $stream = new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'foobar', 1), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), - new Twig_Token(Twig_Token::EOF_TYPE, '', 1), - )); - $parser = new Twig_Parser(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); + $stream = new TokenStream([ + new Token(Token::BLOCK_START_TYPE, '', 1), + new Token(Token::NAME_TYPE, 'foobar', 1), + new Token(Token::BLOCK_END_TYPE, '', 1), + new Token(Token::EOF_TYPE, '', 1), + ]); + $parser = new Parser(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); $parser->parse($stream); } @@ -63,25 +74,25 @@ public function testFilterBodyNodes($input, $expected) public function getFilterBodyNodesData() { - return array( - array( - new Twig_Node(array(new Twig_Node_Text(' ', 1))), - new Twig_Node(array()), - ), - array( - $input = new Twig_Node(array(new Twig_Node_Set(false, new Twig_Node(), new Twig_Node(), 1))), + return [ + [ + new Node([new TextNode(' ', 1)]), + new Node([]), + ], + [ + $input = new Node([new SetNode(false, new Node(), new Node(), 1)]), $input, - ), - array( - $input = new Twig_Node(array(new Twig_Node_Set(true, new Twig_Node(), new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 1))))), 1))), + ], + [ + $input = new Node([new SetNode(true, new Node(), new Node([new Node([new TextNode('foo', 1)])]), 1)]), $input, - ), - ); + ], + ]; } /** * @dataProvider getFilterBodyNodesDataThrowsException - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError */ public function testFilterBodyNodesThrowsException($input) { @@ -92,53 +103,61 @@ public function testFilterBodyNodesThrowsException($input) public function getFilterBodyNodesDataThrowsException() { - return array( - array(new Twig_Node_Text('foo', 1)), - array(new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 1)))))), - ); + return [ + [new TextNode('foo', 1)], + [new Node([new Node([new TextNode('foo', 1)])])], + ]; } /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage A template that extends another one cannot start with a byte order mark (BOM); it must be removed at line 1 + * @dataProvider getFilterBodyNodesWithBOMData */ - public function testFilterBodyNodesWithBOM() + public function testFilterBodyNodesWithBOM($emptyNode) { - $parser = $this->getParser(); - $parser->filterBodyNodes(new Twig_Node_Text(chr(0xEF).chr(0xBB).chr(0xBF), 1)); + $this->assertNull($this->getParser()->filterBodyNodes(new TextNode(\chr(0xEF).\chr(0xBB).\chr(0xBF).$emptyNode, 1))); + } + + public function getFilterBodyNodesWithBOMData() + { + return [ + [' '], + ["\t"], + ["\n"], + ["\n\t\n "], + ]; } public function testParseIsReentrant() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array( + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), [ 'autoescape' => false, 'optimizations' => 0, - )); + ]); $twig->addTokenParser(new TestTokenParser()); - $parser = new Twig_Parser($twig); + $parser = new Parser($twig); - $parser->parse(new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'test', 1), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), - new Twig_Token(Twig_Token::VAR_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 1), - new Twig_Token(Twig_Token::VAR_END_TYPE, '', 1), - new Twig_Token(Twig_Token::EOF_TYPE, '', 1), - ))); + $parser->parse(new TokenStream([ + new Token(Token::BLOCK_START_TYPE, '', 1), + new Token(Token::NAME_TYPE, 'test', 1), + new Token(Token::BLOCK_END_TYPE, '', 1), + new Token(Token::VAR_START_TYPE, '', 1), + new Token(Token::NAME_TYPE, 'foo', 1), + new Token(Token::VAR_END_TYPE, '', 1), + new Token(Token::EOF_TYPE, '', 1), + ])); $this->assertNull($parser->getParent()); } public function testGetVarName() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array( + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), [ 'autoescape' => false, 'optimizations' => 0, - )); + ]); - $twig->parse($twig->tokenize(new Twig_Source(<<<EOF + $twig->parse($twig->tokenize(new Source(<<<EOF {% from _self import foo %} {% macro foo() %} @@ -155,15 +174,15 @@ public function testGetVarName() protected function getParser() { - $parser = new TestParser(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $parser->setParent(new Twig_Node()); - $parser->stream = new Twig_TokenStream(array()); + $parser = new TestParser(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); + $parser->setParent(new Node()); + $parser->stream = new TokenStream([]); return $parser; } } -class TestParser extends Twig_Parser +class TestParser extends Parser { public $stream; @@ -173,22 +192,22 @@ public function filterBodyNodes(Twig_NodeInterface $node) } } -class TestTokenParser extends Twig_TokenParser +class TestTokenParser extends AbstractTokenParser { - public function parse(Twig_Token $token) + public function parse(Token $token) { // simulate the parsing of another template right in the middle of the parsing of the current template - $this->parser->parse(new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'extends', 1), - new Twig_Token(Twig_Token::STRING_TYPE, 'base', 1), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), - new Twig_Token(Twig_Token::EOF_TYPE, '', 1), - ))); + $this->parser->parse(new TokenStream([ + new Token(Token::BLOCK_START_TYPE, '', 1), + new Token(Token::NAME_TYPE, 'extends', 1), + new Token(Token::STRING_TYPE, 'base', 1), + new Token(Token::BLOCK_END_TYPE, '', 1), + new Token(Token::EOF_TYPE, '', 1), + ])); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); - return new Twig_Node(array()); + return new Node([]); } public function getTag() diff --git a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php index a71b97b972d5976a06b2cf7508315a3b2f8ea5e8..508f79ca52a61ab3bb5d2689807543dde9eedf0b 100644 --- a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php @@ -9,66 +9,62 @@ * file that was distributed with this source code. */ +use Twig\Profiler\Profile; + abstract class Twig_Tests_Profiler_Dumper_AbstractTest extends \PHPUnit\Framework\TestCase { protected function getProfile() { - $profile = $this->getMockBuilder('Twig_Profiler_Profile')->disableOriginalConstructor()->getMock(); - - $profile->expects($this->any())->method('isRoot')->will($this->returnValue(true)); - $profile->expects($this->any())->method('getName')->will($this->returnValue('main')); - $profile->expects($this->any())->method('getDuration')->will($this->returnValue(1)); - $profile->expects($this->any())->method('getMemoryUsage')->will($this->returnValue(0)); - $profile->expects($this->any())->method('getPeakMemoryUsage')->will($this->returnValue(0)); - - $subProfiles = array( + $profile = new Profile('main'); + $subProfiles = [ $this->getIndexProfile( - array( + [ $this->getEmbeddedBlockProfile(), $this->getEmbeddedTemplateProfile( - array( + [ $this->getIncludedTemplateProfile(), - ) + ] ), $this->getMacroProfile(), $this->getEmbeddedTemplateProfile( - array( + [ $this->getIncludedTemplateProfile(), - ) + ] ), - ) + ] ), - ); + ]; - $profile->expects($this->any())->method('getProfiles')->will($this->returnValue($subProfiles)); - $profile->expects($this->any())->method('getIterator')->will($this->returnValue(new ArrayIterator($subProfiles))); + $p = new \ReflectionProperty($profile, 'profiles'); + $p->setAccessible(true); + $p->setValue($profile, $subProfiles); return $profile; } - private function getIndexProfile(array $subProfiles = array()) + private function getIndexProfile(array $subProfiles = []) { - return $this->generateProfile('main', 1, true, 'template', 'index.twig', $subProfiles); + return $this->generateProfile('main', 1, 'template', 'index.twig', $subProfiles); } - private function getEmbeddedBlockProfile(array $subProfiles = array()) + private function getEmbeddedBlockProfile(array $subProfiles = []) { - return $this->generateProfile('body', 0.0001, false, 'block', 'embedded.twig', $subProfiles); + return $this->generateProfile('body', 0.0001, 'block', 'embedded.twig', $subProfiles); } - private function getEmbeddedTemplateProfile(array $subProfiles = array()) + private function getEmbeddedTemplateProfile(array $subProfiles = []) { - return $this->generateProfile('main', 0.0001, true, 'template', 'embedded.twig', $subProfiles); + return $this->generateProfile('main', 0.0001, 'template', 'embedded.twig', $subProfiles); } - private function getIncludedTemplateProfile(array $subProfiles = array()) + private function getIncludedTemplateProfile(array $subProfiles = []) { - return $this->generateProfile('main', 0.0001, true, 'template', 'included.twig', $subProfiles); + return $this->generateProfile('main', 0.0001, 'template', 'included.twig', $subProfiles); } - private function getMacroProfile(array $subProfiles = array()) + private function getMacroProfile(array $subProfiles = []) { - return $this->generateProfile('foo', 0.0001, false, 'macro', 'index.twig', $subProfiles); + return $this->generateProfile('foo', 0.0001, 'macro', 'index.twig', $subProfiles); } /** @@ -79,22 +75,30 @@ private function getMacroProfile(array $subProfiles = array()) * @param string $templateName * @param array $subProfiles * - * @return Twig_Profiler_Profile + * @return Profile */ - private function generateProfile($name, $duration, $isTemplate, $type, $templateName, array $subProfiles = array()) + private function generateProfile($name, $duration, $type, $templateName, array $subProfiles = []) { - $profile = $this->getMockBuilder('Twig_Profiler_Profile')->disableOriginalConstructor()->getMock(); + $profile = new Profile($templateName, $type, $name); + + $p = new \ReflectionProperty($profile, 'profiles'); + $p->setAccessible(true); + $p->setValue($profile, $subProfiles); - $profile->expects($this->any())->method('isRoot')->will($this->returnValue(false)); - $profile->expects($this->any())->method('getName')->will($this->returnValue($name)); - $profile->expects($this->any())->method('getDuration')->will($this->returnValue($duration)); - $profile->expects($this->any())->method('getMemoryUsage')->will($this->returnValue(0)); - $profile->expects($this->any())->method('getPeakMemoryUsage')->will($this->returnValue(0)); - $profile->expects($this->any())->method('isTemplate')->will($this->returnValue($isTemplate)); - $profile->expects($this->any())->method('getType')->will($this->returnValue($type)); - $profile->expects($this->any())->method('getTemplate')->will($this->returnValue($templateName)); - $profile->expects($this->any())->method('getProfiles')->will($this->returnValue($subProfiles)); - $profile->expects($this->any())->method('getIterator')->will($this->returnValue(new ArrayIterator($subProfiles))); + $starts = new \ReflectionProperty($profile, 'starts'); + $starts->setAccessible(true); + $starts->setValue($profile, [ + 'wt' => 0, + 'mu' => 0, + 'pmu' => 0, + ]); + $ends = new \ReflectionProperty($profile, 'ends'); + $ends->setAccessible(true); + $ends->setValue($profile, [ + 'wt' => $duration, + 'mu' => 0, + 'pmu' => 0, + ]); return $profile; } diff --git a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php index 1a1b9d299b43786d9f1432639cbc534341211f4f..26ef2dad2ac3e7b28c70c4af49c3e589e0b7d231 100644 --- a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php @@ -9,11 +9,13 @@ * file that was distributed with this source code. */ +use Twig\Profiler\Dumper\BlackfireDumper; + class Twig_Tests_Profiler_Dumper_BlackfireTest extends Twig_Tests_Profiler_Dumper_AbstractTest { public function testDump() { - $dumper = new Twig_Profiler_Dumper_Blackfire(); + $dumper = new BlackfireDumper(); $this->assertStringMatchesFormat(<<<EOF file-format: BlackfireProbe diff --git a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php index 66a68c4beae924478c843ec85dbe30eaae1e4806..e04bbcf2b52f0ec527761279a2a5c0d579119d7a 100644 --- a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php @@ -9,11 +9,13 @@ * file that was distributed with this source code. */ +use Twig\Profiler\Dumper\HtmlDumper; + class Twig_Tests_Profiler_Dumper_HtmlTest extends Twig_Tests_Profiler_Dumper_AbstractTest { public function testDump() { - $dumper = new Twig_Profiler_Dumper_Html(); + $dumper = new HtmlDumper(); $this->assertStringMatchesFormat(<<<EOF <pre>main <span style="color: #d44">%d.%dms/%d%</span> └ <span style="background-color: #ffd">index.twig</span> <span style="color: #d44">%d.%dms/%d%</span> diff --git a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php index e2ea165ace4816987188958f1515d245e4e72e61..e36d0ad600409a0e5c0b0dc5916d45c73f90f1cd 100644 --- a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php @@ -9,11 +9,13 @@ * file that was distributed with this source code. */ +use Twig\Profiler\Dumper\TextDumper; + class Twig_Tests_Profiler_Dumper_TextTest extends Twig_Tests_Profiler_Dumper_AbstractTest { public function testDump() { - $dumper = new Twig_Profiler_Dumper_Text(); + $dumper = new TextDumper(); $this->assertStringMatchesFormat(<<<EOF main %d.%dms/%d% └ index.twig %d.%dms/%d% diff --git a/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php b/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php index 08db96a90ce538d157f08be8f03f4322c3c837ef..18e2a5b564fef95866e89e98a5fe274802f29396 100644 --- a/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php @@ -9,11 +9,13 @@ * file that was distributed with this source code. */ +use Twig\Profiler\Profile; + class Twig_Tests_Profiler_ProfileTest extends \PHPUnit\Framework\TestCase { public function testConstructor() { - $profile = new Twig_Profiler_Profile('template', 'type', 'name'); + $profile = new Profile('template', 'type', 'name'); $this->assertEquals('template', $profile->getTemplate()); $this->assertEquals('type', $profile->getType()); @@ -22,53 +24,53 @@ public function testConstructor() public function testIsRoot() { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); + $profile = new Profile('template', Profile::ROOT); $this->assertTrue($profile->isRoot()); - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::TEMPLATE); + $profile = new Profile('template', Profile::TEMPLATE); $this->assertFalse($profile->isRoot()); } public function testIsTemplate() { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::TEMPLATE); + $profile = new Profile('template', Profile::TEMPLATE); $this->assertTrue($profile->isTemplate()); - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); + $profile = new Profile('template', Profile::ROOT); $this->assertFalse($profile->isTemplate()); } public function testIsBlock() { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::BLOCK); + $profile = new Profile('template', Profile::BLOCK); $this->assertTrue($profile->isBlock()); - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); + $profile = new Profile('template', Profile::ROOT); $this->assertFalse($profile->isBlock()); } public function testIsMacro() { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::MACRO); + $profile = new Profile('template', Profile::MACRO); $this->assertTrue($profile->isMacro()); - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); + $profile = new Profile('template', Profile::ROOT); $this->assertFalse($profile->isMacro()); } public function testGetAddProfile() { - $profile = new Twig_Profiler_Profile(); - $profile->addProfile($a = new Twig_Profiler_Profile()); - $profile->addProfile($b = new Twig_Profiler_Profile()); + $profile = new Profile(); + $profile->addProfile($a = new Profile()); + $profile->addProfile($b = new Profile()); - $this->assertSame(array($a, $b), $profile->getProfiles()); - $this->assertSame(array($a, $b), iterator_to_array($profile)); + $this->assertSame([$a, $b], $profile->getProfiles()); + $this->assertSame([$a, $b], iterator_to_array($profile)); } public function testGetDuration() { - $profile = new Twig_Profiler_Profile(); + $profile = new Profile(); usleep(1); $profile->leave(); @@ -77,8 +79,8 @@ public function testGetDuration() public function testSerialize() { - $profile = new Twig_Profiler_Profile('template', 'type', 'name'); - $profile1 = new Twig_Profiler_Profile('template1', 'type1', 'name1'); + $profile = new Profile('template', 'type', 'name'); + $profile1 = new Profile('template1', 'type1', 'name1'); $profile->addProfile($profile1); $profile->leave(); $profile1->leave(); @@ -100,7 +102,7 @@ public function testSerialize() public function testReset() { - $profile = new Twig_Profiler_Profile(); + $profile = new Profile(); usleep(1); $profile->leave(); $profile->reset(); diff --git a/vendor/twig/twig/test/Twig/Tests/TemplateTest.php b/vendor/twig/twig/test/Twig/Tests/TemplateTest.php index 336fc1f56e772ed28b27db94544368412a6805f7..1b42b93e10db81ea50a4f99f5cf6f468544cb9f6 100644 --- a/vendor/twig/twig/test/Twig/Tests/TemplateTest.php +++ b/vendor/twig/twig/test/Twig/Tests/TemplateTest.php @@ -8,15 +8,28 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + +use Twig\Environment; +use Twig\Error\RuntimeError; +use Twig\Extension\SandboxExtension; +use Twig\Loader\ArrayLoader; +use Twig\Loader\LoaderInterface; +use Twig\Loader\SourceContextLoaderInterface; +use Twig\Node\Expression\GetAttrExpression; +use Twig\NodeVisitor\NodeVisitorInterface; +use Twig\Sandbox\SecurityError; +use Twig\Sandbox\SecurityPolicy; +use Twig\Template; + class Twig_Tests_TemplateTest extends \PHPUnit\Framework\TestCase { /** - * @expectedException LogicException + * @expectedException \LogicException */ public function testDisplayBlocksAcceptTemplateOnlyAsBlocks() { - $template = $this->getMockForAbstractClass('Twig_Template', array(), '', false); - $template->displayBlock('foo', array(), array('foo' => array(new stdClass(), 'foo'))); + $template = $this->getMockForAbstractClass('\Twig\Template', [], '', false); + $template->displayBlock('foo', [], ['foo' => [new \stdClass(), 'foo']]); } /** @@ -24,49 +37,49 @@ public function testDisplayBlocksAcceptTemplateOnlyAsBlocks() */ public function testGetAttributeExceptions($template, $message) { - $templates = array('index' => $template); - $env = new Twig_Environment(new Twig_Loader_Array($templates), array('strict_variables' => true)); - $template = $env->loadTemplate('index'); + $templates = ['index' => $template]; + $env = new Environment(new ArrayLoader($templates), ['strict_variables' => true]); + $template = $env->load('index'); - $context = array( + $context = [ 'string' => 'foo', 'null' => null, - 'empty_array' => array(), - 'array' => array('foo' => 'foo'), + 'empty_array' => [], + 'array' => ['foo' => 'foo'], 'array_access' => new Twig_TemplateArrayAccessObject(), 'magic_exception' => new Twig_TemplateMagicPropertyObjectWithException(), - 'object' => new stdClass(), - ); + 'object' => new \stdClass(), + ]; try { $template->render($context); $this->fail('Accessing an invalid attribute should throw an exception.'); - } catch (Twig_Error_Runtime $e) { + } catch (RuntimeError $e) { $this->assertSame(sprintf($message, 'index'), $e->getMessage()); } } public function getAttributeExceptions() { - return array( - array('{{ string["a"] }}', 'Impossible to access a key ("a") on a string variable ("foo") in "%s" at line 1.'), - array('{{ null["a"] }}', 'Impossible to access a key ("a") on a null variable in "%s" at line 1.'), - array('{{ empty_array["a"] }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'), - array('{{ array["a"] }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'), - array('{{ array_access["a"] }}', 'Key "a" in object with ArrayAccess of class "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1.'), - array('{{ string.a }}', 'Impossible to access an attribute ("a") on a string variable ("foo") in "%s" at line 1.'), - array('{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1.'), - array('{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1.'), - array('{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1.'), - array('{{ array.a() }}', 'Impossible to invoke a method ("a") on an array in "%s" at line 1.'), - array('{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'), - array('{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'), - array('{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1.'), - array('{{ array_access.a }}', 'Neither the property "a" nor one of the methods "a()", "geta()"/"isa()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'), - array('{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Neither the property "missing_method" nor one of the methods "missing_method()", "getmissing_method()"/"ismissing_method()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'), - array('{{ magic_exception.test }}', 'An exception has been thrown during the rendering of a template ("Hey! Don\'t try to isset me!") in "%s" at line 1.'), - array('{{ object["a"] }}', 'Impossible to access a key "a" on an object of class "stdClass" that does not implement ArrayAccess interface in "%s" at line 1.'), - ); + return [ + ['{{ string["a"] }}', 'Impossible to access a key ("a") on a string variable ("foo") in "%s" at line 1.'], + ['{{ null["a"] }}', 'Impossible to access a key ("a") on a null variable in "%s" at line 1.'], + ['{{ empty_array["a"] }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'], + ['{{ array["a"] }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'], + ['{{ array_access["a"] }}', 'Key "a" in object with ArrayAccess of class "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1.'], + ['{{ string.a }}', 'Impossible to access an attribute ("a") on a string variable ("foo") in "%s" at line 1.'], + ['{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1.'], + ['{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1.'], + ['{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1.'], + ['{{ array.a() }}', 'Impossible to invoke a method ("a") on an array in "%s" at line 1.'], + ['{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'], + ['{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'], + ['{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1.'], + ['{{ array_access.a }}', 'Neither the property "a" nor one of the methods "a()", "geta()"/"isa()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'], + ['{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Neither the property "missing_method" nor one of the methods "missing_method()", "getmissing_method()"/"ismissing_method()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'], + ['{{ magic_exception.test }}', 'An exception has been thrown during the rendering of a template ("Hey! Don\'t try to isset me!") in "%s" at line 1.'], + ['{{ object["a"] }}', 'Impossible to access a key "a" on an object of class "stdClass" that does not implement ArrayAccess interface in "%s" at line 1.'], + ]; } /** @@ -74,20 +87,20 @@ public function getAttributeExceptions() */ public function testGetAttributeWithSandbox($object, $item, $allowed) { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(/*method*/), array(/*prop*/), array()); - $twig->addExtension(new Twig_Extension_Sandbox($policy, !$allowed)); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $policy = new SecurityPolicy([], [], [/*method*/], [/*prop*/], []); + $twig->addExtension(new SandboxExtension($policy, !$allowed)); $template = new Twig_TemplateTest($twig); try { - $template->getAttribute($object, $item, array(), 'any'); + $template->getAttribute($object, $item, [], 'any'); if (!$allowed) { $this->fail(); } else { $this->addToAssertionCount(1); } - } catch (Twig_Sandbox_SecurityError $e) { + } catch (SecurityError $e) { if ($allowed) { $this->fail(); } else { @@ -100,12 +113,12 @@ public function testGetAttributeWithSandbox($object, $item, $allowed) public function getGetAttributeWithSandbox() { - return array( - array(new Twig_TemplatePropertyObject(), 'defined', false), - array(new Twig_TemplatePropertyObject(), 'defined', true), - array(new Twig_TemplateMethodObject(), 'defined', false), - array(new Twig_TemplateMethodObject(), 'defined', true), - ); + return [ + [new Twig_TemplatePropertyObject(), 'defined', false], + [new Twig_TemplatePropertyObject(), 'defined', true], + [new Twig_TemplateMethodObject(), 'defined', false], + [new Twig_TemplateMethodObject(), 'defined', true], + ]; } /** @@ -114,28 +127,28 @@ public function getGetAttributeWithSandbox() public function testGetAttributeWithTemplateAsObject() { // to be removed in 2.0 - $twig = new Twig_Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock()); - //$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface', 'Twig_SourceContextLoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock()); + //$twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface')->getMock()); $template = new Twig_TemplateTest($twig, 'index.twig'); $template1 = new Twig_TemplateTest($twig, 'index1.twig'); - $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string')); + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'string')); $this->assertEquals('some_string', $template->getAttribute($template1, 'string')); - $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'true')); + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'true')); $this->assertEquals('1', $template->getAttribute($template1, 'true')); - $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'zero')); + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'zero')); $this->assertEquals('0', $template->getAttribute($template1, 'zero')); - $this->assertNotInstanceof('Twig_Markup', $template->getAttribute($template1, 'empty')); + $this->assertNotInstanceof('\Twig\Markup', $template->getAttribute($template1, 'empty')); $this->assertSame('', $template->getAttribute($template1, 'empty')); - $this->assertFalse($template->getAttribute($template1, 'env', array(), Twig_Template::ANY_CALL, true)); - $this->assertFalse($template->getAttribute($template1, 'environment', array(), Twig_Template::ANY_CALL, true)); - $this->assertFalse($template->getAttribute($template1, 'getEnvironment', array(), Twig_Template::METHOD_CALL, true)); - $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', array(), Twig_Template::METHOD_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'env', [], Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'environment', [], Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'getEnvironment', [], Template::METHOD_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', [], Template::METHOD_CALL, true)); } /** @@ -162,43 +175,43 @@ public function testGetAttributeWithTemplateAsObject() public function testGetAttributeWithTemplateAsObjectForDeprecations() { // to be removed in 2.0 - $twig = new Twig_Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock()); - //$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface', 'Twig_SourceContextLoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock()); + //$twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface', '\Twig\Loader\SourceContextLoaderInterface')->getMock()); $template = new Twig_TemplateTest($twig, 'index.twig'); $template1 = new Twig_TemplateTest($twig, 'index1.twig'); - $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string')); + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'string')); $this->assertEquals('some_string', $template->getAttribute($template1, 'string')); - $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'true')); + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'true')); $this->assertEquals('1', $template->getAttribute($template1, 'true')); - $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'zero')); + $this->assertInstanceOf('\Twig\Markup', $template->getAttribute($template1, 'zero')); $this->assertEquals('0', $template->getAttribute($template1, 'zero')); - $this->assertNotInstanceof('Twig_Markup', $template->getAttribute($template1, 'empty')); + $this->assertNotInstanceof('\Twig\Markup', $template->getAttribute($template1, 'empty')); $this->assertSame('', $template->getAttribute($template1, 'empty')); - $blocks = array('name' => array($template1, 'block_name')); + $blocks = ['name' => [$template1, 'block_name']]; // trigger some deprecation notice messages to check them with @expectedDeprecation - $template->getAttribute($template, 'renderBlock', array('name', array(), $blocks)); - $template->getAttribute($template, 'displayBlock', array('name', array(), $blocks)); - $template->getAttribute($template, 'hasBlock', array('name', array())); - $template->getAttribute($template, 'render', array(array())); - $template->getAttribute($template, 'display', array(array())); + $template->getAttribute($template, 'renderBlock', ['name', [], $blocks]); + $template->getAttribute($template, 'displayBlock', ['name', [], $blocks]); + $template->getAttribute($template, 'hasBlock', ['name', []]); + $template->getAttribute($template, 'render', [[]]); + $template->getAttribute($template, 'display', [[]]); - $template->getAttribute($template1, 'renderBlock', array('name', array(), $blocks)); - $template->getAttribute($template1, 'displayBlock', array('name', array(), $blocks)); - $template->getAttribute($template1, 'hasBlock', array('name', array())); - $template->getAttribute($template1, 'render', array(array())); - $template->getAttribute($template1, 'display', array(array())); + $template->getAttribute($template1, 'renderBlock', ['name', [], $blocks]); + $template->getAttribute($template1, 'displayBlock', ['name', [], $blocks]); + $template->getAttribute($template1, 'hasBlock', ['name', []]); + $template->getAttribute($template1, 'render', [[]]); + $template->getAttribute($template1, 'display', [[]]); - $this->assertFalse($template->getAttribute($template1, 'env', array(), Twig_Template::ANY_CALL, true)); - $this->assertFalse($template->getAttribute($template1, 'environment', array(), Twig_Template::ANY_CALL, true)); - $this->assertFalse($template->getAttribute($template1, 'getEnvironment', array(), Twig_Template::METHOD_CALL, true)); - $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', array(), Twig_Template::METHOD_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'env', [], Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'environment', [], Template::ANY_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'getEnvironment', [], Template::METHOD_CALL, true)); + $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', [], Template::METHOD_CALL, true)); } /** @@ -208,18 +221,18 @@ public function testGetAttributeWithTemplateAsObjectForDeprecations() */ public function testRenderBlockWithUndefinedBlock() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock()); + $twig = new Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock()); $template = new Twig_TemplateTest($twig, 'index.twig'); - $template->renderBlock('unknown', array()); - $template->displayBlock('unknown', array()); + $template->renderBlock('unknown', []); + $template->displayBlock('unknown', []); } public function testGetAttributeOnArrayWithConfusableKey() { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); - $array = array('Zero', 'One', -1 => 'MinusOne', '' => 'EmptyString', '1.5' => 'FloatButString', '01' => 'IntegerButStringWithLeadingZeros'); + $array = ['Zero', 'One', -1 => 'MinusOne', '' => 'EmptyString', '1.5' => 'FloatButString', '01' => 'IntegerButStringWithLeadingZeros']; $this->assertSame('Zero', $array[false]); $this->assertSame('One', $array[true]); @@ -245,7 +258,7 @@ public function testGetAttributeOnArrayWithConfusableKey() */ public function testGetAttribute($defined, $value, $object, $item, $arguments, $type) { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); } @@ -255,18 +268,18 @@ public function testGetAttribute($defined, $value, $object, $item, $arguments, $ */ public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $exceptionMessage = null) { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true))); + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true])); if ($defined) { $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); } else { if (method_exists($this, 'expectException')) { - $this->expectException('Twig_Error_Runtime'); + $this->expectException('\Twig\Error\RuntimeError'); if (null !== $exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); } } else { - $this->setExpectedException('Twig_Error_Runtime', $exceptionMessage); + $this->setExpectedException('\Twig\Error\RuntimeError', $exceptionMessage); } $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); } @@ -277,7 +290,7 @@ public function testGetAttributeStrict($defined, $value, $object, $item, $argume */ public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type) { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); } @@ -287,14 +300,14 @@ public function testGetAttributeDefined($defined, $value, $object, $item, $argum */ public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type) { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true))); + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true])); $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); } public function testGetAttributeCallExceptions() { - $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); $object = new Twig_TemplateMagicMethodExceptionObject(); @@ -303,7 +316,7 @@ public function testGetAttributeCallExceptions() public function getGetAttributeTests() { - $array = array( + $array = [ 'defined' => 'defined', 'zero' => 0, 'null' => null, @@ -312,9 +325,10 @@ public function getGetAttributeTests() 'baz' => 'baz', '09' => '09', '+4' => '+4', - ); + ]; $objectArray = new Twig_TemplateArrayAccessObject(); + $arrayObject = new \ArrayObject($array); $stdObject = (object) $array; $magicPropertyObject = new Twig_TemplateMagicPropertyObject(); $propertyObject = new Twig_TemplatePropertyObject(); @@ -324,42 +338,43 @@ public function getGetAttributeTests() $methodObject = new Twig_TemplateMethodObject(); $magicMethodObject = new Twig_TemplateMagicMethodObject(); - $anyType = Twig_Template::ANY_CALL; - $methodType = Twig_Template::METHOD_CALL; - $arrayType = Twig_Template::ARRAY_CALL; + $anyType = Template::ANY_CALL; + $methodType = Template::METHOD_CALL; + $arrayType = Template::ARRAY_CALL; - $basicTests = array( + $basicTests = [ // array(defined, value, property to fetch) - array(true, 'defined', 'defined'), - array(false, null, 'undefined'), - array(false, null, 'protected'), - array(true, 0, 'zero'), - array(true, 1, 1), - array(true, 1, 1.0), - array(true, null, 'null'), - array(true, true, 'bar'), - array(true, 'baz', 'baz'), - array(true, '09', '09'), - array(true, '+4', '+4'), - ); - $testObjects = array( + [true, 'defined', 'defined'], + [false, null, 'undefined'], + [false, null, 'protected'], + [true, 0, 'zero'], + [true, 1, 1], + [true, 1, 1.0], + [true, null, 'null'], + [true, true, 'bar'], + [true, 'baz', 'baz'], + [true, '09', '09'], + [true, '+4', '+4'], + ]; + $testObjects = [ // array(object, type of fetch) - array($array, $arrayType), - array($objectArray, $arrayType), - array($stdObject, $anyType), - array($magicPropertyObject, $anyType), - array($methodObject, $methodType), - array($methodObject, $anyType), - array($propertyObject, $anyType), - array($propertyObject1, $anyType), - array($propertyObject2, $anyType), - ); - - $tests = array(); + [$array, $arrayType], + [$objectArray, $arrayType], + [$arrayObject, $anyType], + [$stdObject, $anyType], + [$magicPropertyObject, $anyType], + [$methodObject, $methodType], + [$methodObject, $anyType], + [$propertyObject, $anyType], + [$propertyObject1, $anyType], + [$propertyObject2, $anyType], + ]; + + $tests = []; foreach ($testObjects as $testObject) { foreach ($basicTests as $test) { // properties cannot be numbers - if (($testObject[0] instanceof stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) { + if (($testObject[0] instanceof \stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) { continue; } @@ -367,27 +382,27 @@ public function getGetAttributeTests() continue; } - $tests[] = array($test[0], $test[1], $testObject[0], $test[2], array(), $testObject[1]); + $tests[] = [$test[0], $test[1], $testObject[0], $test[2], [], $testObject[1]]; } } // additional properties tests - $tests = array_merge($tests, array( - array(true, null, $propertyObject3, 'foo', array(), $anyType), - )); + $tests = array_merge($tests, [ + [true, null, $propertyObject3, 'foo', [], $anyType], + ]); // additional method tests - $tests = array_merge($tests, array( - array(true, 'defined', $methodObject, 'defined', array(), $methodType), - array(true, 'defined', $methodObject, 'DEFINED', array(), $methodType), - array(true, 'defined', $methodObject, 'getDefined', array(), $methodType), - array(true, 'defined', $methodObject, 'GETDEFINED', array(), $methodType), - array(true, 'static', $methodObject, 'static', array(), $methodType), - array(true, 'static', $methodObject, 'getStatic', array(), $methodType), - - array(true, '__call_undefined', $magicMethodObject, 'undefined', array(), $methodType), - array(true, '__call_UNDEFINED', $magicMethodObject, 'UNDEFINED', array(), $methodType), - )); + $tests = array_merge($tests, [ + [true, 'defined', $methodObject, 'defined', [], $methodType], + [true, 'defined', $methodObject, 'DEFINED', [], $methodType], + [true, 'defined', $methodObject, 'getDefined', [], $methodType], + [true, 'defined', $methodObject, 'GETDEFINED', [], $methodType], + [true, 'static', $methodObject, 'static', [], $methodType], + [true, 'static', $methodObject, 'getStatic', [], $methodType], + + [true, '__call_undefined', $magicMethodObject, 'undefined', [], $methodType], + [true, '__call_UNDEFINED', $magicMethodObject, 'UNDEFINED', [], $methodType], + ]); // add the same tests for the any type foreach ($tests as $test) { @@ -400,39 +415,44 @@ public function getGetAttributeTests() $methodAndPropObject = new Twig_TemplateMethodAndPropObject(); // additional method tests - $tests = array_merge($tests, array( - array(true, 'a', $methodAndPropObject, 'a', array(), $anyType), - array(true, 'a', $methodAndPropObject, 'a', array(), $methodType), - array(false, null, $methodAndPropObject, 'a', array(), $arrayType), - - array(true, 'b_prop', $methodAndPropObject, 'b', array(), $anyType), - array(true, 'b', $methodAndPropObject, 'B', array(), $anyType), - array(true, 'b', $methodAndPropObject, 'b', array(), $methodType), - array(true, 'b', $methodAndPropObject, 'B', array(), $methodType), - array(false, null, $methodAndPropObject, 'b', array(), $arrayType), - - array(false, null, $methodAndPropObject, 'c', array(), $anyType), - array(false, null, $methodAndPropObject, 'c', array(), $methodType), - array(false, null, $methodAndPropObject, 'c', array(), $arrayType), - )); + $tests = array_merge($tests, [ + [true, 'a', $methodAndPropObject, 'a', [], $anyType], + [true, 'a', $methodAndPropObject, 'a', [], $methodType], + [false, null, $methodAndPropObject, 'a', [], $arrayType], + + [true, 'b_prop', $methodAndPropObject, 'b', [], $anyType], + [true, 'b', $methodAndPropObject, 'B', [], $anyType], + [true, 'b', $methodAndPropObject, 'b', [], $methodType], + [true, 'b', $methodAndPropObject, 'B', [], $methodType], + [false, null, $methodAndPropObject, 'b', [], $arrayType], + + [false, null, $methodAndPropObject, 'c', [], $anyType], + [false, null, $methodAndPropObject, 'c', [], $methodType], + [false, null, $methodAndPropObject, 'c', [], $arrayType], + ]); + + $arrayAccess = new Twig_TemplateArrayAccess(); + $tests = array_merge($tests, [ + [true, ['foo' => 'bar'], $arrayAccess, 'vars', [], $anyType], + ]); // tests when input is not an array or object - $tests = array_merge($tests, array( - array(false, null, 42, 'a', array(), $anyType, 'Impossible to access an attribute ("a") on a integer variable ("42") in "index.twig".'), - array(false, null, 'string', 'a', array(), $anyType, 'Impossible to access an attribute ("a") on a string variable ("string") in "index.twig".'), - array(false, null, array(), 'a', array(), $anyType, 'Key "a" does not exist as the array is empty in "index.twig".'), - )); + $tests = array_merge($tests, [ + [false, null, 42, 'a', [], $anyType, 'Impossible to access an attribute ("a") on a integer variable ("42") in "index.twig".'], + [false, null, 'string', 'a', [], $anyType, 'Impossible to access an attribute ("a") on a string variable ("string") in "index.twig".'], + [false, null, [], 'a', [], $anyType, 'Key "a" does not exist as the array is empty in "index.twig".'], + ]); return $tests; } /** - * @expectedException Twig_Error_Runtime + * @expectedException \Twig\Error\RuntimeError */ public function testGetIsMethods() { $getIsObject = new Twig_TemplateGetIsMethods(); - $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true))); + $template = new Twig_TemplateTest(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true])); // first time should not create a cache for "get" $this->assertNull($template->getAttribute($getIsObject, 'get')); // 0 should be in the method cache now, so this should fail @@ -440,14 +460,14 @@ public function testGetIsMethods() } } -class Twig_TemplateTest extends Twig_Template +class Twig_TemplateTest extends Template { private $name; - public function __construct(Twig_Environment $env, $name = 'index.twig') + public function __construct(Environment $env, $name = 'index.twig') { parent::__construct($env); - self::$cache = array(); + self::$cache = []; $this->name = $name; } @@ -478,7 +498,7 @@ public function getTemplateName() public function getDebugInfo() { - return array(); + return []; } protected function doGetParent(array $context) @@ -486,29 +506,29 @@ protected function doGetParent(array $context) return false; } - protected function doDisplay(array $context, array $blocks = array()) + protected function doDisplay(array $context, array $blocks = []) { } - public function getAttribute($object, $item, array $arguments = array(), $type = Twig_Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) + public function getAttribute($object, $item, array $arguments = [], $type = Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) { - if (function_exists('twig_template_get_attributes')) { + if (\function_exists('twig_template_get_attributes')) { return twig_template_get_attributes($this, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); } else { return parent::getAttribute($object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); } } - public function block_name($context, array $blocks = array()) + public function block_name($context, array $blocks = []) { } } -class Twig_TemplateArrayAccessObject implements ArrayAccess +class Twig_TemplateArrayAccessObject implements \ArrayAccess { protected $protected = 'protected'; - public $attributes = array( + public $attributes = [ 'defined' => 'defined', 'zero' => 0, 'null' => null, @@ -517,16 +537,16 @@ class Twig_TemplateArrayAccessObject implements ArrayAccess 'baz' => 'baz', '09' => '09', '+4' => '+4', - ); + ]; public function offsetExists($name) { - return array_key_exists($name, $this->attributes); + return \array_key_exists($name, $this->attributes); } public function offsetGet($name) { - return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; + return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; } public function offsetSet($name, $value) @@ -542,7 +562,7 @@ class Twig_TemplateMagicPropertyObject { public $defined = 'defined'; - public $attributes = array( + public $attributes = [ 'zero' => 0, 'null' => null, '1' => 1, @@ -550,18 +570,18 @@ class Twig_TemplateMagicPropertyObject 'baz' => 'baz', '09' => '09', '+4' => '+4', - ); + ]; protected $protected = 'protected'; public function __isset($name) { - return array_key_exists($name, $this->attributes); + return \array_key_exists($name, $this->attributes); } public function __get($name) { - return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; + return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; } } @@ -569,7 +589,7 @@ class Twig_TemplateMagicPropertyObjectWithException { public function __isset($key) { - throw new Exception('Hey! Don\'t try to isset me!'); + throw new \Exception('Hey! Don\'t try to isset me!'); } } @@ -584,27 +604,29 @@ class Twig_TemplatePropertyObject protected $protected = 'protected'; } -class Twig_TemplatePropertyObjectAndIterator extends Twig_TemplatePropertyObject implements IteratorAggregate +class Twig_TemplatePropertyObjectAndIterator extends Twig_TemplatePropertyObject implements \IteratorAggregate { public function getIterator() { - return new ArrayIterator(array('foo', 'bar')); + return new \ArrayIterator(['foo', 'bar']); } } -class Twig_TemplatePropertyObjectAndArrayAccess extends Twig_TemplatePropertyObject implements ArrayAccess +class Twig_TemplatePropertyObjectAndArrayAccess extends Twig_TemplatePropertyObject implements \ArrayAccess { - private $data = array( + private $data = [ 'defined' => 'defined', 'zero' => 0, 'null' => null, 'bar' => true, + 'foo' => true, 'baz' => 'baz', - ); + 'baf' => 'baf', + ]; public function offsetExists($offset) { - return array_key_exists($offset, $this->data); + return \array_key_exists($offset, $this->data); } public function offsetGet($offset) @@ -718,6 +740,34 @@ private function getC() } } +class Twig_TemplateArrayAccess implements \ArrayAccess +{ + public $vars = [ + 'foo' => 'bar', + ]; + private $children = []; + + public function offsetExists($offset) + { + return \array_key_exists($offset, $this->children); + } + + public function offsetGet($offset) + { + return $this->children[$offset]; + } + + public function offsetSet($offset, $value) + { + $this->children[$offset] = $value; + } + + public function offsetUnset($offset) + { + unset($this->children[$offset]); + } +} + class Twig_TemplateMagicMethodObject { public function __call($method, $arguments) @@ -730,22 +780,22 @@ class Twig_TemplateMagicMethodExceptionObject { public function __call($method, $arguments) { - throw new BadMethodCallException(sprintf('Unknown method "%s".', $method)); + throw new \BadMethodCallException(sprintf('Unknown method "%s".', $method)); } } -class CExtDisablingNodeVisitor implements Twig_NodeVisitorInterface +class CExtDisablingNodeVisitor implements NodeVisitorInterface { - public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) + public function enterNode(Twig_NodeInterface $node, Environment $env) { - if ($node instanceof Twig_Node_Expression_GetAttr) { + if ($node instanceof GetAttrExpression) { $node->setAttribute('disable_c_ext', true); } return $node; } - public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) + public function leaveNode(Twig_NodeInterface $node, Environment $env) { return $node; } @@ -757,6 +807,6 @@ public function getPriority() } // to be removed in 2.0 -interface Twig_TemplateTestLoaderInterface extends Twig_LoaderInterface, Twig_SourceContextLoaderInterface +interface Twig_TemplateTestLoaderInterface extends LoaderInterface, SourceContextLoaderInterface { } diff --git a/vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php b/vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php index cc71052c412604352cbb7ba6115c85a153baa765..74618406c777a6fc4821d09542f6dca8443bad91 100644 --- a/vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php +++ b/vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php @@ -8,56 +8,60 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + +use Twig\Environment; +use Twig\Loader\ArrayLoader; + class Twig_Tests_TemplateWrapperTest extends \PHPUnit\Framework\TestCase { public function testHasGetBlocks() { - $twig = new Twig_Environment(new Twig_Loader_Array(array( + $twig = new Environment(new ArrayLoader([ 'index' => '{% block foo %}{% endblock %}', 'index_with_use' => '{% use "imported" %}{% block foo %}{% endblock %}', 'index_with_extends' => '{% extends "extended" %}{% block foo %}{% endblock %}', 'imported' => '{% block imported %}{% endblock %}', 'extended' => '{% block extended %}{% endblock %}', - ))); + ])); - $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index')); + $wrapper = $twig->load('index'); $this->assertTrue($wrapper->hasBlock('foo')); $this->assertFalse($wrapper->hasBlock('bar')); - $this->assertEquals(array('foo'), $wrapper->getBlockNames()); + $this->assertEquals(['foo'], $wrapper->getBlockNames()); - $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index_with_use')); + $wrapper = $twig->load('index_with_use'); $this->assertTrue($wrapper->hasBlock('foo')); $this->assertTrue($wrapper->hasBlock('imported')); - $this->assertEquals(array('imported', 'foo'), $wrapper->getBlockNames()); + $this->assertEquals(['imported', 'foo'], $wrapper->getBlockNames()); - $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index_with_extends')); + $wrapper = $twig->load('index_with_extends'); $this->assertTrue($wrapper->hasBlock('foo')); $this->assertTrue($wrapper->hasBlock('extended')); - $this->assertEquals(array('foo', 'extended'), $wrapper->getBlockNames()); + $this->assertEquals(['foo', 'extended'], $wrapper->getBlockNames()); } public function testRenderBlock() { - $twig = new Twig_Environment(new Twig_Loader_Array(array( + $twig = new Environment(new ArrayLoader([ 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}', - ))); + ])); $twig->addGlobal('bar', 'BAR'); - $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index')); - $this->assertEquals('FOOBAR', $wrapper->renderBlock('foo', array('foo' => 'FOO'))); + $wrapper = $twig->load('index'); + $this->assertEquals('FOOBAR', $wrapper->renderBlock('foo', ['foo' => 'FOO'])); } public function testDisplayBlock() { - $twig = new Twig_Environment(new Twig_Loader_Array(array( + $twig = new Environment(new ArrayLoader([ 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}', - ))); + ])); $twig->addGlobal('bar', 'BAR'); - $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index')); + $wrapper = $twig->load('index'); ob_start(); - $wrapper->displayBlock('foo', array('foo' => 'FOO')); + $wrapper->displayBlock('foo', ['foo' => 'FOO']); $this->assertEquals('FOOBAR', ob_get_clean()); } diff --git a/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php b/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php index f219c9554b280d510c22c06d9d67af4f35fa9c71..e5cd568b0c3547dc7da2827bc17aa099bf029f76 100644 --- a/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php +++ b/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php @@ -9,22 +9,25 @@ * file that was distributed with this source code. */ +use Twig\Token; +use Twig\TokenStream; + class Twig_Tests_TokenStreamTest extends \PHPUnit\Framework\TestCase { protected static $tokens; protected function setUp() { - self::$tokens = array( - new Twig_Token(Twig_Token::TEXT_TYPE, 1, 1), - new Twig_Token(Twig_Token::TEXT_TYPE, 2, 1), - new Twig_Token(Twig_Token::TEXT_TYPE, 3, 1), - new Twig_Token(Twig_Token::TEXT_TYPE, 4, 1), - new Twig_Token(Twig_Token::TEXT_TYPE, 5, 1), - new Twig_Token(Twig_Token::TEXT_TYPE, 6, 1), - new Twig_Token(Twig_Token::TEXT_TYPE, 7, 1), - new Twig_Token(Twig_Token::EOF_TYPE, 0, 1), - ); + self::$tokens = [ + new Token(Token::TEXT_TYPE, 1, 1), + new Token(Token::TEXT_TYPE, 2, 1), + new Token(Token::TEXT_TYPE, 3, 1), + new Token(Token::TEXT_TYPE, 4, 1), + new Token(Token::TEXT_TYPE, 5, 1), + new Token(Token::TEXT_TYPE, 6, 1), + new Token(Token::TEXT_TYPE, 7, 1), + new Token(Token::EOF_TYPE, 0, 1), + ]; } /** @@ -32,7 +35,7 @@ protected function setUp() */ public function testLegacyConstructorSignature() { - $stream = new Twig_TokenStream(array(), 'foo', '{{ foo }}'); + $stream = new TokenStream([], 'foo', '{{ foo }}'); $this->assertEquals('foo', $stream->getFilename()); $this->assertEquals('{{ foo }}', $stream->getSource()); $this->assertEquals('foo', $stream->getSourceContext()->getName()); @@ -41,8 +44,8 @@ public function testLegacyConstructorSignature() public function testNext() { - $stream = new Twig_TokenStream(self::$tokens); - $repr = array(); + $stream = new TokenStream(self::$tokens); + $repr = []; while (!$stream->isEOF()) { $token = $stream->next(); @@ -52,28 +55,28 @@ public function testNext() } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unexpected end of template */ public function testEndOfTemplateNext() { - $stream = new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, 1, 1), - )); + $stream = new TokenStream([ + new Token(Token::BLOCK_START_TYPE, 1, 1), + ]); while (!$stream->isEOF()) { $stream->next(); } } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig\Error\SyntaxError * @expectedExceptionMessage Unexpected end of template */ public function testEndOfTemplateLook() { - $stream = new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, 1, 1), - )); + $stream = new TokenStream([ + new Token(Token::BLOCK_START_TYPE, 1, 1), + ]); while (!$stream->isEOF()) { $stream->look(); $stream->next(); diff --git a/vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php b/vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php index 887a90afaa1600bdb3a830beb597903581fc853c..0f577c60f5be6d44787c15494f62ddcdafa2f178 100644 --- a/vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php @@ -9,6 +9,10 @@ * file that was distributed with this source code. */ +use Twig\Environment; +use Twig\TwigFunction; +use Twig\Util\DeprecationCollector; + class Twig_Tests_Util_DeprecationCollectorTest extends \PHPUnit\Framework\TestCase { /** @@ -16,13 +20,13 @@ class Twig_Tests_Util_DeprecationCollectorTest extends \PHPUnit\Framework\TestCa */ public function testCollect() { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $twig->addFunction(new Twig_SimpleFunction('deprec', array($this, 'deprec'), array('deprecated' => true))); + $twig = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $twig->addFunction(new TwigFunction('deprec', [$this, 'deprec'], ['deprecated' => true])); - $collector = new Twig_Util_DeprecationCollector($twig); + $collector = new DeprecationCollector($twig); $deprecations = $collector->collect(new Twig_Tests_Util_Iterator()); - $this->assertEquals(array('Twig Function "deprec" is deprecated in deprec.twig at line 1.'), $deprecations); + $this->assertEquals(['Twig Function "deprec" is deprecated in deprec.twig at line 1.'], $deprecations); } public function deprec() @@ -30,13 +34,13 @@ public function deprec() } } -class Twig_Tests_Util_Iterator implements IteratorAggregate +class Twig_Tests_Util_Iterator implements \IteratorAggregate { public function getIterator() { - return new ArrayIterator(array( + return new \ArrayIterator([ 'ok.twig' => '{{ foo }}', 'deprec.twig' => '{{ deprec("foo") }}', - )); + ]); } } diff --git a/vendor/twig/twig/test/Twig/Tests/escapingTest.php b/vendor/twig/twig/test/Twig/Tests/escapingTest.php index 9b98dddcf132379501969c06079524207e83059a..6de31a9354da36f53fe8bfa2f8cf4b13f0d73a55 100644 --- a/vendor/twig/twig/test/Twig/Tests/escapingTest.php +++ b/vendor/twig/twig/test/Twig/Tests/escapingTest.php @@ -3,26 +3,27 @@ /** * This class is adapted from code coming from Zend Framework. * - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://framework.zend.com/license/new-bsd New BSD License */ class Twig_Test_EscapingTest extends \PHPUnit\Framework\TestCase { /** * All character encodings supported by htmlspecialchars(). */ - protected $htmlSpecialChars = array( + protected $htmlSpecialChars = [ '\'' => ''', '"' => '"', '<' => '<', '>' => '>', '&' => '&', - ); + ]; - protected $htmlAttrSpecialChars = array( + protected $htmlAttrSpecialChars = [ '\'' => ''', /* Characters beyond ASCII value 255 to unicode escape */ 'Ā' => 'Ā', + '😀' => '😀', /* Immune chars excluded */ ',' => ',', '.' => '.', @@ -47,17 +48,19 @@ class Twig_Test_EscapingTest extends \PHPUnit\Framework\TestCase '"' => '"', /* Encode spaces for quoteless attribute protection */ ' ' => ' ', - ); + ]; - protected $jsSpecialChars = array( + protected $jsSpecialChars = [ /* HTML special chars - escape without exception to hex */ - '<' => '\\x3C', - '>' => '\\x3E', - '\'' => '\\x27', - '"' => '\\x22', - '&' => '\\x26', + '<' => '\\u003C', + '>' => '\\u003E', + '\'' => '\\u0027', + '"' => '\\u0022', + '&' => '\\u0026', + '/' => '\\/', /* Characters beyond ASCII value 255 to unicode escape */ 'Ā' => '\\u0100', + '😀' => '\\uD83D\\uDE00', /* Immune chars excluded */ ',' => ',', '.' => '.', @@ -70,15 +73,17 @@ class Twig_Test_EscapingTest extends \PHPUnit\Framework\TestCase '0' => '0', '9' => '9', /* Basic control characters and null */ - "\r" => '\\x0D', - "\n" => '\\x0A', - "\t" => '\\x09', - "\0" => '\\x00', + "\r" => '\r', + "\n" => '\n', + "\x08" => '\b', + "\t" => '\t', + "\x0C" => '\f', + "\0" => '\\u0000', /* Encode spaces for quoteless attribute protection */ - ' ' => '\\x20', - ); + ' ' => '\\u0020', + ]; - protected $urlSpecialChars = array( + protected $urlSpecialChars = [ /* HTML special chars - escape without exception to percent encoding */ '<' => '%3C', '>' => '%3E', @@ -111,9 +116,9 @@ class Twig_Test_EscapingTest extends \PHPUnit\Framework\TestCase ' ' => '%20', '~' => '~', '+' => '%2B', - ); + ]; - protected $cssSpecialChars = array( + protected $cssSpecialChars = [ /* HTML special chars - escape without exception to hex */ '<' => '\\3C ', '>' => '\\3E ', @@ -140,13 +145,13 @@ class Twig_Test_EscapingTest extends \PHPUnit\Framework\TestCase "\0" => '\\0 ', /* Encode spaces for quoteless attribute protection */ ' ' => '\\20 ', - ); + ]; protected $env; protected function setUp() { - $this->env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); + $this->env = new \Twig\Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); } public function testHtmlEscapingConvertsSpecialChars() @@ -215,7 +220,7 @@ public function testUrlEscapingConvertsSpecialChars() public function testUnicodeCodepointConversionToUtf8() { $expected = ' ~ޙ'; - $codepoints = array(0x20, 0x7e, 0x799); + $codepoints = [0x20, 0x7e, 0x799]; $result = ''; foreach ($codepoints as $value) { $result .= $this->codepointToUtf8($value); @@ -233,29 +238,29 @@ public function testUnicodeCodepointConversionToUtf8() protected function codepointToUtf8($codepoint) { if ($codepoint < 0x80) { - return chr($codepoint); + return \chr($codepoint); } if ($codepoint < 0x800) { - return chr($codepoint >> 6 & 0x3f | 0xc0) - .chr($codepoint & 0x3f | 0x80); + return \chr($codepoint >> 6 & 0x3f | 0xc0) + .\chr($codepoint & 0x3f | 0x80); } if ($codepoint < 0x10000) { - return chr($codepoint >> 12 & 0x0f | 0xe0) - .chr($codepoint >> 6 & 0x3f | 0x80) - .chr($codepoint & 0x3f | 0x80); + return \chr($codepoint >> 12 & 0x0f | 0xe0) + .\chr($codepoint >> 6 & 0x3f | 0x80) + .\chr($codepoint & 0x3f | 0x80); } if ($codepoint < 0x110000) { - return chr($codepoint >> 18 & 0x07 | 0xf0) - .chr($codepoint >> 12 & 0x3f | 0x80) - .chr($codepoint >> 6 & 0x3f | 0x80) - .chr($codepoint & 0x3f | 0x80); + return \chr($codepoint >> 18 & 0x07 | 0xf0) + .\chr($codepoint >> 12 & 0x3f | 0x80) + .\chr($codepoint >> 6 & 0x3f | 0x80) + .\chr($codepoint & 0x3f | 0x80); } - throw new Exception('Codepoint requested outside of Unicode range.'); + throw new \Exception('Codepoint requested outside of Unicode range.'); } public function testJavascriptEscapingEscapesOwaspRecommendedRanges() { - $immune = array(',', '.', '_'); // Exceptions to escaping ranges + $immune = [',', '.', '_']; // Exceptions to escaping ranges for ($chr = 0; $chr < 0xFF; ++$chr) { if ($chr >= 0x30 && $chr <= 0x39 || $chr >= 0x41 && $chr <= 0x5A @@ -264,7 +269,7 @@ public function testJavascriptEscapingEscapesOwaspRecommendedRanges() $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); } else { $literal = $this->codepointToUtf8($chr); - if (in_array($literal, $immune)) { + if (\in_array($literal, $immune)) { $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); } else { $this->assertNotEquals( @@ -278,7 +283,7 @@ public function testJavascriptEscapingEscapesOwaspRecommendedRanges() public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges() { - $immune = array(',', '.', '-', '_'); // Exceptions to escaping ranges + $immune = [',', '.', '-', '_']; // Exceptions to escaping ranges for ($chr = 0; $chr < 0xFF; ++$chr) { if ($chr >= 0x30 && $chr <= 0x39 || $chr >= 0x41 && $chr <= 0x5A @@ -287,7 +292,7 @@ public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges() $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); } else { $literal = $this->codepointToUtf8($chr); - if (in_array($literal, $immune)) { + if (\in_array($literal, $immune)) { $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); } else { $this->assertNotEquals( diff --git a/vendor/wikimedia/composer-merge-plugin/README.md b/vendor/wikimedia/composer-merge-plugin/README.md deleted file mode 100644 index e63b847b55c0c6b05a99b6d7fbbf9ed6a7991bc5..0000000000000000000000000000000000000000 --- a/vendor/wikimedia/composer-merge-plugin/README.md +++ /dev/null @@ -1,222 +0,0 @@ -[![Latest Stable Version]](https://packagist.org/packages/wikimedia/composer-merge-plugin) [![License]](https://github.com/wikimedia/composer-merge-plugin/blob/master/LICENSE) -[![Build Status]](https://travis-ci.org/wikimedia/composer-merge-plugin) -[![Code Coverage]](https://scrutinizer-ci.com/g/wikimedia/composer-merge-plugin/?branch=master) - -Composer Merge Plugin -===================== - -Merge multiple composer.json files at [Composer] runtime. - -Composer Merge Plugin is intended to allow easier dependency management for -applications which ship a composer.json file and expect some deployments to -install additional Composer managed libraries. It does this by allowing the -application's top level `composer.json` file to provide a list of optional -additional configuration files. When Composer is run it will parse these files -and merge their configuration settings into the base configuration. This -combined configuration will then be used when downloading additional libraries -and generating the autoloader. - -Composer Merge Plugin was created to help with installation of [MediaWiki] -which has core library requirements as well as optional libraries and -extensions which may be managed via Composer. - - -Installation ------------- - -Composer Merge Plugin requires [Composer 1.0.0](https://getcomposer.org/) or -newer. - -``` -$ composer require wikimedia/composer-merge-plugin -``` - - -Usage ------ - -```json -{ - "require": { - "wikimedia/composer-merge-plugin": "dev-master" - }, - "extra": { - "merge-plugin": { - "include": [ - "composer.local.json", - "extensions/*/composer.json" - ], - "require": [ - "submodule/composer.json" - ], - "recurse": true, - "replace": false, - "ignore-duplicates": false, - "merge-dev": true, - "merge-extra": false, - "merge-extra-deep": false, - "merge-scripts": false - } - } -} -``` - - -Plugin configuration --------------------- - -The plugin reads its configuration from the `merge-plugin` section of your -composer.json's `extra` section. An `include` setting is required to tell -Composer Merge Plugin which file(s) to merge. - - -### include - -The `include` setting can specify either a single value or an array of values. -Each value is treated as a PHP `glob()` pattern identifying additional -composer.json style configuration files to merge into the root package -configuration for the current Composer execution. - -The following sections of the found configuration files will be merged into -the Composer root package configuration as though they were directly included -in the top-level composer.json file: - -* [autoload](https://getcomposer.org/doc/04-schema.md#autoload) -* [autoload-dev](https://getcomposer.org/doc/04-schema.md#autoload-dev) - (optional, see [merge-dev](#merge-dev) below) -* [conflict](https://getcomposer.org/doc/04-schema.md#conflict) -* [provide](https://getcomposer.org/doc/04-schema.md#provide) -* [replace](https://getcomposer.org/doc/04-schema.md#replace) -* [repositories](https://getcomposer.org/doc/04-schema.md#repositories) -* [require](https://getcomposer.org/doc/04-schema.md#require) -* [require-dev](https://getcomposer.org/doc/04-schema.md#require-dev) - (optional, see [merge-dev](#merge-dev) below) -* [suggest](https://getcomposer.org/doc/04-schema.md#suggest) -* [extra](https://getcomposer.org/doc/04-schema.md#extra) - (optional, see [merge-extra](#merge-extra) below) -* [scripts](https://getcomposer.org/doc/04-schema.md#scripts) - (optional, see [merge-scripts](#merge-scripts) below) - - -### require - -The `require` setting is identical to [`include`](#include) except when -a pattern fails to match at least one file then it will cause an error. - -### recurse - -By default the merge plugin is recursive; if an included file has -a `merge-plugin` section it will also be processed. This functionality can be -disabled by adding a `"recurse": false` setting. - - -### replace - -By default, Composer's conflict resolution engine is used to determine which -version of a package should be installed when multiple files specify the same -package. A `"replace": true` setting can be provided to change to a "last -version specified wins" conflict resolution strategy. In this mode, duplicate -package declarations found in merged files will overwrite the declarations -made by earlier files. Files are loaded in the order specified by the -`include` setting with globbed files being processed in alphabetical order. - -### ignore-duplicates - -By default, Composer's conflict resolution engine is used to determine which -version of a package should be installed when multiple files specify the same -package. An `"ignore-duplicates": true` setting can be provided to change to -a "first version specified wins" conflict resolution strategy. In this mode, -duplicate package declarations found in merged files will be ignored in favor -of the declarations made by earlier files. Files are loaded in the order -specified by the `include` setting with globbed files being processed in -alphabetical order. - -Note: `"replace": true` and `"ignore-duplicates": true` modes are mutually -exclusive. If both are set, `"ignore-duplicates": true` will be used. - -### merge-dev - -By default, `autoload-dev` and `require-dev` sections of included files are -merged. A `"merge-dev": false` setting will disable this behavior. - - -### merge-extra - -A `"merge-extra": true` setting enables the merging the contents of the -`extra` section of included files as well. The normal merge mode for the extra -section is to accept the first version of any key found (e.g. a key in the -master config wins over the version found in any imported config). If -`replace` mode is active ([see above](#replace)) then this behavior changes -and the last key found will win (e.g. the key in the master config is replaced -by the key in the imported config). If `"merge-extra-deep": true` is specified -then, the sections are merged similar to array_merge_recursive() - however -duplicate string array keys are replaced instead of merged, while numeric -array keys are merged as usual. The usefulness of merging the extra section -will vary depending on the Composer plugins being used and the order in which -they are processed by Composer. - -Note that `merge-plugin` sections are excluded from the merge process, but are -always processed by the plugin unless [recursion](#recurse) is disabled. - -### merge-scripts - -A `"merge-scripts": true` setting enables merging the contents of the -`scripts` section of included files as well. The normal merge mode for the -scripts section is to accept the first version of any key found (e.g. a key in -the master config wins over the version found in any imported config). If -`replace` mode is active ([see above](#replace)) then this behavior changes -and the last key found will win (e.g. the key in the master config is replaced -by the key in the imported config). - -Note: [custom commands][] added by merged configuration will work when invoked -as `composer run-script my-cool-command` but will not be available using the -normal `composer my-cool-command` shortcut. - - -Running tests -------------- - -``` -$ composer install -$ composer test -``` - - -Contributing ------------- - -Bug, feature requests and other issues should be reported to the [GitHub -project]. We accept code and documentation contributions via Pull Requests on -GitHub as well. - -- [PSR-2 Coding Standard][] is used by the project. The included test - configuration uses [PHP Code Sniffer][] to validate the conventions. -- Tests are encouraged. Our test coverage isn't perfect but we'd like it to - get better rather than worse, so please try to include tests with your - changes. -- Keep the documentation up to date. Make sure `README.md` and other - relevant documentation is kept up to date with your changes. -- One pull request per feature. Try to keep your changes focused on solving - a single problem. This will make it easier for us to review the change and - easier for you to make sure you have updated the necessary tests and - documentation. - - -License -------- - -Composer Merge plugin is licensed under the MIT license. See the -[`LICENSE`](LICENSE) file for more details. - - ---- -[Composer]: https://getcomposer.org/ -[MediaWiki]: https://www.mediawiki.org/wiki/MediaWiki -[GitHub project]: https://github.com/wikimedia/composer-merge-plugin -[PSR-2 Coding Standard]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md -[PHP Code Sniffer]: http://pear.php.net/package/PHP_CodeSniffer -[Latest Stable Version]: https://img.shields.io/packagist/v/wikimedia/composer-merge-plugin.svg?style=flat -[License]: https://img.shields.io/packagist/l/wikimedia/composer-merge-plugin.svg?style=flat -[Build Status]: https://img.shields.io/travis/wikimedia/composer-merge-plugin.svg?style=flat -[Code Coverage]: https://img.shields.io/scrutinizer/coverage/g/wikimedia/composer-merge-plugin/master.svg?style=flat -[custom commands]: https://getcomposer.org/doc/articles/scripts.md#writing-custom-commands diff --git a/vendor/wikimedia/composer-merge-plugin/composer.json b/vendor/wikimedia/composer-merge-plugin/composer.json deleted file mode 100644 index e504c91ec4bb351a45ea2531849db0bc22fbdb93..0000000000000000000000000000000000000000 --- a/vendor/wikimedia/composer-merge-plugin/composer.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "wikimedia/composer-merge-plugin", - "description": "Composer plugin to merge multiple composer.json files", - "type": "composer-plugin", - "license": "MIT", - "authors": [ - { - "name": "Bryan Davis", - "email": "bd808@wikimedia.org" - } - ], - "minimum-stability": "dev", - "prefer-stable": true, - "require": { - "composer-plugin-api": "^1.0", - "php": ">=5.3.2" - }, - "require-dev": { - "composer/composer": "~1.0.0", - "jakub-onderka/php-parallel-lint": "~0.8", - "phpunit/phpunit": "~4.8|~5.0", - "squizlabs/php_codesniffer": "~2.1.0" - }, - "autoload": { - "psr-4": { - "Wikimedia\\Composer\\": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - }, - "class": "Wikimedia\\Composer\\MergePlugin" - }, - "config": { - "optimize-autoloader": true - }, - "scripts": { - "test": [ - "composer validate --no-interaction", - "parallel-lint src tests", - "phpunit --log-junit=reports/unitreport.xml --coverage-text --coverage-html=reports/coverage --coverage-clover=reports/coverage.xml", - "phpcs --encoding=utf-8 --standard=PSR2 --report-checkstyle=reports/checkstyle-phpcs.xml --report-full --extensions=php src/* tests/phpunit/*" - ] - } -} diff --git a/vendor/wikimedia/composer-merge-plugin/src/Logger.php b/vendor/wikimedia/composer-merge-plugin/src/Logger.php deleted file mode 100644 index 1635a2b0455150d089df6590070b4eab382f53c6..0000000000000000000000000000000000000000 --- a/vendor/wikimedia/composer-merge-plugin/src/Logger.php +++ /dev/null @@ -1,102 +0,0 @@ -<?php -/** - * This file is part of the Composer Merge plugin. - * - * Copyright (C) 2015 Bryan Davis, Wikimedia Foundation, and contributors - * - * This software may be modified and distributed under the terms of the MIT - * license. See the LICENSE file for details. - */ - -namespace Wikimedia\Composer; - -use Composer\IO\IOInterface; - -/** - * Simple logging wrapper for Composer\IO\IOInterface - * - * @author Bryan Davis <bd808@bd808.com> - */ -class Logger -{ - /** - * @var string $name - */ - protected $name; - - /** - * @var IOInterface $inputOutput - */ - protected $inputOutput; - - /** - * @param string $name - * @param IOInterface $io - */ - public function __construct($name, IOInterface $io) - { - $this->name = $name; - $this->inputOutput = $io; - } - - /** - * Log a debug message - * - * Messages will be output at the "very verbose" logging level (eg `-vv` - * needed on the Composer command). - * - * @param string $message - */ - public function debug($message) - { - if ($this->inputOutput->isVeryVerbose()) { - $message = " <info>[{$this->name}]</info> {$message}"; - $this->log($message); - } - } - - /** - * Log an informative message - * - * Messages will be output at the "verbose" logging level (eg `-v` needed - * on the Composer command). - * - * @param string $message - */ - public function info($message) - { - if ($this->inputOutput->isVerbose()) { - $message = " <info>[{$this->name}]</info> {$message}"; - $this->log($message); - } - } - - /** - * Log a warning message - * - * @param string $message - */ - public function warning($message) - { - $message = " <error>[{$this->name}]</error> {$message}"; - $this->log($message); - } - - /** - * Write a message - * - * @param string $message - */ - protected function log($message) - { - if (method_exists($this->inputOutput, 'writeError')) { - $this->inputOutput->writeError($message); - } else { - // @codeCoverageIgnoreStart - // Backwards compatiblity for Composer before cb336a5 - $this->inputOutput->write($message); - // @codeCoverageIgnoreEnd - } - } -} -// vim:sw=4:ts=4:sts=4:et: diff --git a/vendor/wikimedia/composer-merge-plugin/src/Merge/ExtraPackage.php b/vendor/wikimedia/composer-merge-plugin/src/Merge/ExtraPackage.php deleted file mode 100644 index 85997ae51cd7d48d57730343fa55a4f2941b6c76..0000000000000000000000000000000000000000 --- a/vendor/wikimedia/composer-merge-plugin/src/Merge/ExtraPackage.php +++ /dev/null @@ -1,629 +0,0 @@ -<?php -/** - * This file is part of the Composer Merge plugin. - * - * Copyright (C) 2015 Bryan Davis, Wikimedia Foundation, and contributors - * - * This software may be modified and distributed under the terms of the MIT - * license. See the LICENSE file for details. - */ - -namespace Wikimedia\Composer\Merge; - -use Wikimedia\Composer\Logger; - -use Composer\Composer; -use Composer\Json\JsonFile; -use Composer\Package\BasePackage; -use Composer\Package\CompletePackage; -use Composer\Package\Link; -use Composer\Package\Loader\ArrayLoader; -use Composer\Package\RootAliasPackage; -use Composer\Package\RootPackage; -use Composer\Package\RootPackageInterface; -use Composer\Package\Version\VersionParser; -use UnexpectedValueException; - -/** - * Processing for a composer.json file that will be merged into - * a RootPackageInterface - * - * @author Bryan Davis <bd808@bd808.com> - */ -class ExtraPackage -{ - - /** - * @var Composer $composer - */ - protected $composer; - - /** - * @var Logger $logger - */ - protected $logger; - - /** - * @var string $path - */ - protected $path; - - /** - * @var array $json - */ - protected $json; - - /** - * @var CompletePackage $package - */ - protected $package; - - /** - * @var VersionParser $versionParser - */ - protected $versionParser; - - /** - * @param string $path Path to composer.json file - * @param Composer $composer - * @param Logger $logger - */ - public function __construct($path, Composer $composer, Logger $logger) - { - $this->path = $path; - $this->composer = $composer; - $this->logger = $logger; - $this->json = $this->readPackageJson($path); - $this->package = $this->loadPackage($this->json); - $this->versionParser = new VersionParser(); - } - - /** - * Get list of additional packages to include if precessing recursively. - * - * @return array - */ - public function getIncludes() - { - return isset($this->json['extra']['merge-plugin']['include']) ? - $this->json['extra']['merge-plugin']['include'] : array(); - } - - /** - * Get list of additional packages to require if precessing recursively. - * - * @return array - */ - public function getRequires() - { - return isset($this->json['extra']['merge-plugin']['require']) ? - $this->json['extra']['merge-plugin']['require'] : array(); - } - - /** - * Read the contents of a composer.json style file into an array. - * - * The package contents are fixed up to be usable to create a Package - * object by providing dummy "name" and "version" values if they have not - * been provided in the file. This is consistent with the default root - * package loading behavior of Composer. - * - * @param string $path - * @return array - */ - protected function readPackageJson($path) - { - $file = new JsonFile($path); - $json = $file->read(); - if (!isset($json['name'])) { - $json['name'] = 'merge-plugin/' . - strtr($path, DIRECTORY_SEPARATOR, '-'); - } - if (!isset($json['version'])) { - $json['version'] = '1.0.0'; - } - return $json; - } - - /** - * @param array $json - * @return CompletePackage - */ - protected function loadPackage(array $json) - { - $loader = new ArrayLoader(); - $package = $loader->load($json); - // @codeCoverageIgnoreStart - if (!$package instanceof CompletePackage) { - throw new UnexpectedValueException( - 'Expected instance of CompletePackage, got ' . - get_class($package) - ); - } - // @codeCoverageIgnoreEnd - return $package; - } - - /** - * Merge this package into a RootPackageInterface - * - * @param RootPackageInterface $root - * @param PluginState $state - */ - public function mergeInto(RootPackageInterface $root, PluginState $state) - { - $this->prependRepositories($root); - - $this->mergeRequires('require', $root, $state); - - $this->mergePackageLinks('conflict', $root); - $this->mergePackageLinks('replace', $root); - $this->mergePackageLinks('provide', $root); - - $this->mergeSuggests($root); - - $this->mergeAutoload('autoload', $root); - - $this->mergeExtra($root, $state); - - $this->mergeScripts($root, $state); - - if ($state->isDevMode()) { - $this->mergeDevInto($root, $state); - } else { - $this->mergeReferences($root); - } - } - - /** - * Merge just the dev portion into a RootPackageInterface - * - * @param RootPackageInterface $root - * @param PluginState $state - */ - public function mergeDevInto(RootPackageInterface $root, PluginState $state) - { - $this->mergeRequires('require-dev', $root, $state); - $this->mergeAutoload('devAutoload', $root); - $this->mergeReferences($root); - } - - /** - * Add a collection of repositories described by the given configuration - * to the given package and the global repository manager. - * - * @param RootPackageInterface $root - */ - protected function prependRepositories(RootPackageInterface $root) - { - if (!isset($this->json['repositories'])) { - return; - } - $repoManager = $this->composer->getRepositoryManager(); - $newRepos = array(); - - foreach ($this->json['repositories'] as $repoJson) { - if (!isset($repoJson['type'])) { - continue; - } - $this->logger->info("Prepending {$repoJson['type']} repository"); - $repo = $repoManager->createRepository( - $repoJson['type'], - $repoJson - ); - $repoManager->prependRepository($repo); - $newRepos[] = $repo; - } - - $unwrapped = self::unwrapIfNeeded($root, 'setRepositories'); - $unwrapped->setRepositories(array_merge( - $newRepos, - $root->getRepositories() - )); - } - - /** - * Merge require or require-dev into a RootPackageInterface - * - * @param string $type 'require' or 'require-dev' - * @param RootPackageInterface $root - * @param PluginState $state - */ - protected function mergeRequires( - $type, - RootPackageInterface $root, - PluginState $state - ) { - $linkType = BasePackage::$supportedLinkTypes[$type]; - $getter = 'get' . ucfirst($linkType['method']); - $setter = 'set' . ucfirst($linkType['method']); - - $requires = $this->package->{$getter}(); - if (empty($requires)) { - return; - } - - $this->mergeStabilityFlags($root, $requires); - - $requires = $this->replaceSelfVersionDependencies( - $type, - $requires, - $root - ); - - $root->{$setter}($this->mergeOrDefer( - $type, - $root->{$getter}(), - $requires, - $state - )); - } - - /** - * Merge two collections of package links and collect duplicates for - * subsequent processing. - * - * @param string $type 'require' or 'require-dev' - * @param array $origin Primary collection - * @param array $merge Additional collection - * @param PluginState $state - * @return array Merged collection - */ - protected function mergeOrDefer( - $type, - array $origin, - array $merge, - $state - ) { - if ($state->ignoreDuplicateLinks() && $state->replaceDuplicateLinks()) { - $this->logger->warning("Both replace and ignore-duplicates are true. These are mutually exclusive."); - $this->logger->warning("Duplicate packages will be ignored."); - } - - $dups = array(); - foreach ($merge as $name => $link) { - if (isset($origin[$name]) && $state->ignoreDuplicateLinks()) { - $this->logger->info("Ignoring duplicate <comment>{$name}</comment>"); - continue; - } elseif (!isset($origin[$name]) || $state->replaceDuplicateLinks()) { - $this->logger->info("Merging <comment>{$name}</comment>"); - $origin[$name] = $link; - } else { - // Defer to solver. - $this->logger->info( - "Deferring duplicate <comment>{$name}</comment>" - ); - $dups[] = $link; - } - } - $state->addDuplicateLinks($type, $dups); - return $origin; - } - - /** - * Merge autoload or autoload-dev into a RootPackageInterface - * - * @param string $type 'autoload' or 'devAutoload' - * @param RootPackageInterface $root - */ - protected function mergeAutoload($type, RootPackageInterface $root) - { - $getter = 'get' . ucfirst($type); - $setter = 'set' . ucfirst($type); - - $autoload = $this->package->{$getter}(); - if (empty($autoload)) { - return; - } - - $unwrapped = self::unwrapIfNeeded($root, $setter); - $unwrapped->{$setter}(array_merge_recursive( - $root->{$getter}(), - $this->fixRelativePaths($autoload) - )); - } - - /** - * Fix a collection of paths that are relative to this package to be - * relative to the base package. - * - * @param array $paths - * @return array - */ - protected function fixRelativePaths(array $paths) - { - $base = dirname($this->path); - $base = ($base === '.') ? '' : "{$base}/"; - - array_walk_recursive( - $paths, - function (&$path) use ($base) { - $path = "{$base}{$path}"; - } - ); - return $paths; - } - - /** - * Extract and merge stability flags from the given collection of - * requires and merge them into a RootPackageInterface - * - * @param RootPackageInterface $root - * @param array $requires - */ - protected function mergeStabilityFlags( - RootPackageInterface $root, - array $requires - ) { - $flags = $root->getStabilityFlags(); - $sf = new StabilityFlags($flags, $root->getMinimumStability()); - - $unwrapped = self::unwrapIfNeeded($root, 'setStabilityFlags'); - $unwrapped->setStabilityFlags(array_merge( - $flags, - $sf->extractAll($requires) - )); - } - - /** - * Merge package links of the given type into a RootPackageInterface - * - * @param string $type 'conflict', 'replace' or 'provide' - * @param RootPackageInterface $root - */ - protected function mergePackageLinks($type, RootPackageInterface $root) - { - $linkType = BasePackage::$supportedLinkTypes[$type]; - $getter = 'get' . ucfirst($linkType['method']); - $setter = 'set' . ucfirst($linkType['method']); - - $links = $this->package->{$getter}(); - if (!empty($links)) { - $unwrapped = self::unwrapIfNeeded($root, $setter); - // @codeCoverageIgnoreStart - if ($root !== $unwrapped) { - $this->logger->warning( - 'This Composer version does not support ' . - "'{$type}' merging for aliased packages." - ); - } - // @codeCoverageIgnoreEnd - $unwrapped->{$setter}(array_merge( - $root->{$getter}(), - $this->replaceSelfVersionDependencies($type, $links, $root) - )); - } - } - - /** - * Merge suggested packages into a RootPackageInterface - * - * @param RootPackageInterface $root - */ - protected function mergeSuggests(RootPackageInterface $root) - { - $suggests = $this->package->getSuggests(); - if (!empty($suggests)) { - $unwrapped = self::unwrapIfNeeded($root, 'setSuggests'); - $unwrapped->setSuggests(array_merge( - $root->getSuggests(), - $suggests - )); - } - } - - /** - * Merge extra config into a RootPackageInterface - * - * @param RootPackageInterface $root - * @param PluginState $state - */ - public function mergeExtra(RootPackageInterface $root, PluginState $state) - { - $extra = $this->package->getExtra(); - unset($extra['merge-plugin']); - if (!$state->shouldMergeExtra() || empty($extra)) { - return; - } - - $rootExtra = $root->getExtra(); - $unwrapped = self::unwrapIfNeeded($root, 'setExtra'); - - if ($state->replaceDuplicateLinks()) { - $unwrapped->setExtra( - self::mergeExtraArray($state->shouldMergeExtraDeep(), $rootExtra, $extra) - ); - } else { - if (!$state->shouldMergeExtraDeep()) { - foreach (array_intersect( - array_keys($extra), - array_keys($rootExtra) - ) as $key) { - $this->logger->info( - "Ignoring duplicate <comment>{$key}</comment> in ". - "<comment>{$this->path}</comment> extra config." - ); - } - } - $unwrapped->setExtra( - self::mergeExtraArray($state->shouldMergeExtraDeep(), $extra, $rootExtra) - ); - } - } - - /** - * Merge scripts config into a RootPackageInterface - * - * @param RootPackageInterface $root - * @param PluginState $state - */ - public function mergeScripts(RootPackageInterface $root, PluginState $state) - { - $scripts = $this->package->getScripts(); - if (!$state->shouldMergeScripts() || empty($scripts)) { - return; - } - - $rootScripts = $root->getScripts(); - $unwrapped = self::unwrapIfNeeded($root, 'setScripts'); - - if ($state->replaceDuplicateLinks()) { - $unwrapped->setScripts( - array_merge($rootScripts, $scripts) - ); - } else { - $unwrapped->setScripts( - array_merge($scripts, $rootScripts) - ); - } - } - - /** - * Merges two arrays either via arrayMergeDeep or via array_merge. - * - * @param bool $mergeDeep - * @param array $array1 - * @param array $array2 - * @return array - */ - public static function mergeExtraArray($mergeDeep, $array1, $array2) - { - if ($mergeDeep) { - return NestedArray::mergeDeep($array1, $array2); - } - - return array_merge($array1, $array2); - } - - /** - * Update Links with a 'self.version' constraint with the root package's - * version. - * - * @param string $type Link type - * @param array $links - * @param RootPackageInterface $root - * @return array - */ - protected function replaceSelfVersionDependencies( - $type, - array $links, - RootPackageInterface $root - ) { - $linkType = BasePackage::$supportedLinkTypes[$type]; - $version = $root->getVersion(); - $prettyVersion = $root->getPrettyVersion(); - $vp = $this->versionParser; - - $method = 'get' . ucfirst($linkType['method']); - $packages = $root->$method(); - - return array_map( - function ($link) use ($linkType, $version, $prettyVersion, $vp, $packages) { - if ('self.version' === $link->getPrettyConstraint()) { - if (isset($packages[$link->getSource()])) { - /** @var Link $package */ - $package = $packages[$link->getSource()]; - return new Link( - $link->getSource(), - $link->getTarget(), - $vp->parseConstraints($package->getConstraint()->getPrettyString()), - $linkType['description'], - $package->getPrettyConstraint() - ); - } - - return new Link( - $link->getSource(), - $link->getTarget(), - $vp->parseConstraints($version), - $linkType['description'], - $prettyVersion - ); - } - return $link; - }, - $links - ); - } - - /** - * Get a full featured Package from a RootPackageInterface. - * - * In Composer versions before 599ad77 the RootPackageInterface only - * defines a sub-set of operations needed by composer-merge-plugin and - * RootAliasPackage only implemented those methods defined by the - * interface. Most of the unimplemented methods in RootAliasPackage can be - * worked around because the getter methods that are implemented proxy to - * the aliased package which we can modify by unwrapping. The exception - * being modifying the 'conflicts', 'provides' and 'replaces' collections. - * We have no way to actually modify those collections unfortunately in - * older versions of Composer. - * - * @param RootPackageInterface $root - * @param string $method Method needed - * @return RootPackageInterface|RootPackage - */ - public static function unwrapIfNeeded( - RootPackageInterface $root, - $method = 'setExtra' - ) { - // @codeCoverageIgnoreStart - if ($root instanceof RootAliasPackage && - !method_exists($root, $method) - ) { - // Unwrap and return the aliased RootPackage. - $root = $root->getAliasOf(); - } - // @codeCoverageIgnoreEnd - return $root; - } - - /** - * Update the root packages reference information. - * - * @param RootPackageInterface $root - */ - protected function mergeReferences(RootPackageInterface $root) - { - // Merge source reference information for merged packages. - // @see RootPackageLoader::load - $references = array(); - $unwrapped = $this->unwrapIfNeeded($root, 'setReferences'); - foreach (array('require', 'require-dev') as $linkType) { - $linkInfo = BasePackage::$supportedLinkTypes[$linkType]; - $method = 'get'.ucfirst($linkInfo['method']); - $links = array(); - foreach ($unwrapped->$method() as $link) { - $links[$link->getTarget()] = $link->getConstraint()->getPrettyString(); - } - $references = $this->extractReferences($links, $references); - } - $unwrapped->setReferences($references); - } - - /** - * Extract vcs revision from version constraint (dev-master#abc123. - * - * @param array $requires - * @param array $references - * @return array - * @see RootPackageLoader::extractReferences() - */ - protected function extractReferences(array $requires, array $references) - { - foreach ($requires as $reqName => $reqVersion) { - $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion); - $stabilityName = VersionParser::parseStability($reqVersion); - if ( - preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && - $stabilityName === 'dev' - ) { - $name = strtolower($reqName); - $references[$name] = $match[1]; - } - } - - return $references; - } -} -// vim:sw=4:ts=4:sts=4:et: diff --git a/vendor/wikimedia/composer-merge-plugin/src/Merge/MissingFileException.php b/vendor/wikimedia/composer-merge-plugin/src/Merge/MissingFileException.php deleted file mode 100644 index 873719d7e8df980be02a46b45a86af9272f30511..0000000000000000000000000000000000000000 --- a/vendor/wikimedia/composer-merge-plugin/src/Merge/MissingFileException.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php -/** - * This file is part of the Composer Merge plugin. - * - * Copyright (C) 2015 Bryan Davis, Wikimedia Foundation, and contributors - * - * This software may be modified and distributed under the terms of the MIT - * license. See the LICENSE file for details. - */ - -namespace Wikimedia\Composer\Merge; - -/** - * @author Bryan Davis <bd808@bd808.com> - */ -class MissingFileException extends \RuntimeException -{ -} diff --git a/vendor/wikimedia/composer-merge-plugin/src/Merge/NestedArray.php b/vendor/wikimedia/composer-merge-plugin/src/Merge/NestedArray.php deleted file mode 100644 index 91bd295f3bce2bd9dcbdceb413b9761c7b4102a1..0000000000000000000000000000000000000000 --- a/vendor/wikimedia/composer-merge-plugin/src/Merge/NestedArray.php +++ /dev/null @@ -1,116 +0,0 @@ -<?php -/** - * This file is part of the Composer Merge plugin. - * - * Copyright (C) 2015 Bryan Davis, Wikimedia Foundation, and contributors - * - * This software may be modified and distributed under the terms of the MIT - * license. See the LICENSE file for details. - */ - -namespace Wikimedia\Composer\Merge; - -/** - * Adapted from - * http://cgit.drupalcode.org/drupal/tree/core/lib/Drupal/Component/Utility/NestedArray.php - * @ f86a4d650d5af0b82a3981e09977055fa63f6f2e - */ -class NestedArray -{ - - /** - * Merges multiple arrays, recursively, and returns the merged array. - * - * This function is similar to PHP's array_merge_recursive() function, but - * it handles non-array values differently. When merging values that are - * not both arrays, the latter value replaces the former rather than - * merging with it. - * - * Example: - * - * @code - * $link_options_1 = array('fragment' => 'x', 'attributes' => array('title' => t('X'), 'class' => array('a', 'b'))); - * $link_options_2 = array('fragment' => 'y', 'attributes' => array('title' => t('Y'), 'class' => array('c', 'd'))); - * - * // This results in array('fragment' => array('x', 'y'), 'attributes' => - * // array('title' => array(t('X'), t('Y')), 'class' => array('a', 'b', - * // 'c', 'd'))). - * $incorrect = array_merge_recursive($link_options_1, $link_options_2); - * - * // This results in array('fragment' => 'y', 'attributes' => - * // array('title' => t('Y'), 'class' => array('a', 'b', 'c', 'd'))). - * $correct = NestedArray::mergeDeep($link_options_1, $link_options_2); - * @endcode - * - * @param array ... - * Arrays to merge. - * - * @return array - * The merged array. - * - * @see NestedArray::mergeDeepArray() - */ - public static function mergeDeep() - { - return self::mergeDeepArray(func_get_args()); - } - - /** - * Merges multiple arrays, recursively, and returns the merged array. - * - * This function is equivalent to NestedArray::mergeDeep(), except the - * input arrays are passed as a single array parameter rather than - * a variable parameter list. - * - * The following are equivalent: - * - NestedArray::mergeDeep($a, $b); - * - NestedArray::mergeDeepArray(array($a, $b)); - * - * The following are also equivalent: - * - call_user_func_array('NestedArray::mergeDeep', $arrays_to_merge); - * - NestedArray::mergeDeepArray($arrays_to_merge); - * - * @param array $arrays - * An arrays of arrays to merge. - * @param bool $preserveIntegerKeys - * (optional) If given, integer keys will be preserved and merged - * instead of appended. Defaults to false. - * - * @return array - * The merged array. - * - * @see NestedArray::mergeDeep() - */ - public static function mergeDeepArray( - array $arrays, - $preserveIntegerKeys = false - ) { - $result = array(); - foreach ($arrays as $array) { - foreach ($array as $key => $value) { - // Renumber integer keys as array_merge_recursive() does - // unless $preserveIntegerKeys is set to TRUE. Note that PHP - // automatically converts array keys that are integer strings - // (e.g., '1') to integers. - if (is_integer($key) && !$preserveIntegerKeys) { - $result[] = $value; - } elseif (isset($result[$key]) && - is_array($result[$key]) && - is_array($value) - ) { - // Recurse when both values are arrays. - $result[$key] = self::mergeDeepArray( - array($result[$key], $value), - $preserveIntegerKeys - ); - } else { - // Otherwise, use the latter value, overriding any - // previous value. - $result[$key] = $value; - } - } - } - return $result; - } -} -// vim:sw=4:ts=4:sts=4:et: diff --git a/vendor/wikimedia/composer-merge-plugin/src/Merge/PluginState.php b/vendor/wikimedia/composer-merge-plugin/src/Merge/PluginState.php deleted file mode 100644 index 7aa90ac42eea9be7f72abd073670d0f1c2c700f1..0000000000000000000000000000000000000000 --- a/vendor/wikimedia/composer-merge-plugin/src/Merge/PluginState.php +++ /dev/null @@ -1,417 +0,0 @@ -<?php -/** - * This file is part of the Composer Merge plugin. - * - * Copyright (C) 2015 Bryan Davis, Wikimedia Foundation, and contributors - * - * This software may be modified and distributed under the terms of the MIT - * license. See the LICENSE file for details. - */ - -namespace Wikimedia\Composer\Merge; - -use Composer\Composer; - -/** - * Mutable plugin state - * - * @author Bryan Davis <bd808@bd808.com> - */ -class PluginState -{ - /** - * @var Composer $composer - */ - protected $composer; - - /** - * @var array $includes - */ - protected $includes = array(); - - /** - * @var array $requires - */ - protected $requires = array(); - - /** - * @var array $duplicateLinks - */ - protected $duplicateLinks = array(); - - /** - * @var bool $devMode - */ - protected $devMode = false; - - /** - * @var bool $recurse - */ - protected $recurse = true; - - /** - * @var bool $replace - */ - protected $replace = false; - - /** - * @var bool $ignore - */ - protected $ignore = false; - - /** - * Whether to merge the -dev sections. - * @var bool $mergeDev - */ - protected $mergeDev = true; - - /** - * Whether to merge the extra section. - * - * By default, the extra section is not merged and there will be many - * cases where the merge of the extra section is performed too late - * to be of use to other plugins. When enabled, merging uses one of - * two strategies - either 'first wins' or 'last wins'. When enabled, - * 'first wins' is the default behaviour. If Replace mode is activated - * then 'last wins' is used. - * - * @var bool $mergeExtra - */ - protected $mergeExtra = false; - - /** - * Whether to merge the extra section in a deep / recursive way. - * - * By default the extra section is merged with array_merge() and duplicate - * keys are ignored. When enabled this allows to merge the arrays recursively - * using the following rule: Integer keys are merged, while array values are - * replaced where the later values overwrite the former. - * - * This is useful especially for the extra section when plugins use larger - * structures like a 'patches' key with the packages as sub-keys and the - * patches as values. - * - * When 'replace' mode is activated the order of array merges is exchanged. - * - * @var bool $mergeExtraDeep - */ - protected $mergeExtraDeep = false; - - /** - * Whether to merge the scripts section. - * - * @var bool $mergeScripts - */ - protected $mergeScripts = false; - - /** - * @var bool $firstInstall - */ - protected $firstInstall = false; - - /** - * @var bool $locked - */ - protected $locked = false; - - /** - * @var bool $dumpAutoloader - */ - protected $dumpAutoloader = false; - - /** - * @var bool $optimizeAutoloader - */ - protected $optimizeAutoloader = false; - - /** - * @param Composer $composer - */ - public function __construct(Composer $composer) - { - $this->composer = $composer; - } - - /** - * Load plugin settings - */ - public function loadSettings() - { - $extra = $this->composer->getPackage()->getExtra(); - $config = array_merge( - array( - 'include' => array(), - 'require' => array(), - 'recurse' => true, - 'replace' => false, - 'ignore-duplicates' => false, - 'merge-dev' => true, - 'merge-extra' => false, - 'merge-extra-deep' => false, - 'merge-scripts' => false, - ), - isset($extra['merge-plugin']) ? $extra['merge-plugin'] : array() - ); - - $this->includes = (is_array($config['include'])) ? - $config['include'] : array($config['include']); - $this->requires = (is_array($config['require'])) ? - $config['require'] : array($config['require']); - $this->recurse = (bool)$config['recurse']; - $this->replace = (bool)$config['replace']; - $this->ignore = (bool)$config['ignore-duplicates']; - $this->mergeDev = (bool)$config['merge-dev']; - $this->mergeExtra = (bool)$config['merge-extra']; - $this->mergeExtraDeep = (bool)$config['merge-extra-deep']; - $this->mergeScripts = (bool)$config['merge-scripts']; - } - - /** - * Get list of filenames and/or glob patterns to include - * - * @return array - */ - public function getIncludes() - { - return $this->includes; - } - - /** - * Get list of filenames and/or glob patterns to require - * - * @return array - */ - public function getRequires() - { - return $this->requires; - } - - /** - * Set the first install flag - * - * @param bool $flag - */ - public function setFirstInstall($flag) - { - $this->firstInstall = (bool)$flag; - } - - /** - * Is this the first time that the plugin has been installed? - * - * @return bool - */ - public function isFirstInstall() - { - return $this->firstInstall; - } - - /** - * Set the locked flag - * - * @param bool $flag - */ - public function setLocked($flag) - { - $this->locked = (bool)$flag; - } - - /** - * Was a lockfile present when the plugin was installed? - * - * @return bool - */ - public function isLocked() - { - return $this->locked; - } - - /** - * Should an update be forced? - * - * @return true If packages are not locked - */ - public function forceUpdate() - { - return !$this->locked; - } - - /** - * Set the devMode flag - * - * @param bool $flag - */ - public function setDevMode($flag) - { - $this->devMode = (bool)$flag; - } - - /** - * Should devMode settings be processed? - * - * @return bool - */ - public function isDevMode() - { - return $this->shouldMergeDev() && $this->devMode; - } - - /** - * Should devMode settings be merged? - * - * @return bool - */ - public function shouldMergeDev() - { - return $this->mergeDev; - } - - /** - * Set the dumpAutoloader flag - * - * @param bool $flag - */ - public function setDumpAutoloader($flag) - { - $this->dumpAutoloader = (bool)$flag; - } - - /** - * Is the autoloader file supposed to be written out? - * - * @return bool - */ - public function shouldDumpAutoloader() - { - return $this->dumpAutoloader; - } - - /** - * Set the optimizeAutoloader flag - * - * @param bool $flag - */ - public function setOptimizeAutoloader($flag) - { - $this->optimizeAutoloader = (bool)$flag; - } - - /** - * Should the autoloader be optimized? - * - * @return bool - */ - public function shouldOptimizeAutoloader() - { - return $this->optimizeAutoloader; - } - - /** - * Add duplicate packages - * - * @param string $type Package type - * @param array $packages - */ - public function addDuplicateLinks($type, array $packages) - { - if (!isset($this->duplicateLinks[$type])) { - $this->duplicateLinks[$type] = array(); - } - $this->duplicateLinks[$type] = - array_merge($this->duplicateLinks[$type], $packages); - } - - /** - * Get duplicate packages - * - * @param string $type Package type - * @return array - */ - public function getDuplicateLinks($type) - { - return isset($this->duplicateLinks[$type]) ? - $this->duplicateLinks[$type] : array(); - } - - /** - * Should includes be recursively processed? - * - * @return bool - */ - public function recurseIncludes() - { - return $this->recurse; - } - - /** - * Should duplicate links be replaced in a 'last definition wins' order? - * - * @return bool - */ - public function replaceDuplicateLinks() - { - return $this->replace; - } - - /** - * Should duplicate links be ignored? - * - * @return bool - */ - public function ignoreDuplicateLinks() - { - return $this->ignore; - } - - /** - * Should the extra section be merged? - * - * By default, the extra section is not merged and there will be many - * cases where the merge of the extra section is performed too late - * to be of use to other plugins. When enabled, merging uses one of - * two strategies - either 'first wins' or 'last wins'. When enabled, - * 'first wins' is the default behaviour. If Replace mode is activated - * then 'last wins' is used. - * - * @return bool - */ - public function shouldMergeExtra() - { - return $this->mergeExtra; - } - - /** - * Should the extra section be merged deep / recursively? - * - * By default the extra section is merged with array_merge() and duplicate - * keys are ignored. When enabled this allows to merge the arrays recursively - * using the following rule: Integer keys are merged, while array values are - * replaced where the later values overwrite the former. - * - * This is useful especially for the extra section when plugins use larger - * structures like a 'patches' key with the packages as sub-keys and the - * patches as values. - * - * When 'replace' mode is activated the order of array merges is exchanged. - * - * @return bool - */ - public function shouldMergeExtraDeep() - { - return $this->mergeExtraDeep; - } - - - /** - * Should the scripts section be merged? - * - * By default, the scripts section is not merged. - * - * @return bool - */ - public function shouldMergeScripts() - { - return $this->mergeScripts; - } -} -// vim:sw=4:ts=4:sts=4:et: diff --git a/vendor/wikimedia/composer-merge-plugin/src/Merge/StabilityFlags.php b/vendor/wikimedia/composer-merge-plugin/src/Merge/StabilityFlags.php deleted file mode 100644 index 1c106e028bed968e3a956409928f642e3c5ff603..0000000000000000000000000000000000000000 --- a/vendor/wikimedia/composer-merge-plugin/src/Merge/StabilityFlags.php +++ /dev/null @@ -1,181 +0,0 @@ -<?php -/** - * This file is part of the Composer Merge plugin. - * - * Copyright (C) 2015 Bryan Davis, Wikimedia Foundation, and contributors - * - * This software may be modified and distributed under the terms of the MIT - * license. See the LICENSE file for details. - */ - -namespace Wikimedia\Composer\Merge; - -use Composer\Package\BasePackage; -use Composer\Package\Version\VersionParser; - -/** - * Adapted from Composer's RootPackageLoader::extractStabilityFlags - * @author Bryan Davis <bd808@bd808.com> - */ -class StabilityFlags -{ - - /** - * @var array Current package name => stability mappings - */ - protected $stabilityFlags; - - /** - * @var int Current default minimum stability - */ - protected $minimumStability; - - /** - * @var string Regex to extract an explict stability flag (eg '@dev') - */ - protected $explicitStabilityRe; - - - /** - * @param array $stabilityFlags Current package name => stability mappings - * @param int $minimumStability Current default minimum stability - */ - public function __construct( - array $stabilityFlags = array(), - $minimumStability = BasePackage::STABILITY_STABLE - ) { - $this->stabilityFlags = $stabilityFlags; - $this->minimumStability = $this->getStabilityInt($minimumStability); - $this->explicitStabilityRe = '/^[^@]*?@(' . - implode('|', array_keys(BasePackage::$stabilities)) . - ')$/i'; - } - - /** - * Get the stability value for a given string. - * - * @param string $name Stability name - * @return int Stability value - */ - protected function getStabilityInt($name) - { - $name = VersionParser::normalizeStability($name); - return isset(BasePackage::$stabilities[$name]) ? - BasePackage::$stabilities[$name] : - BasePackage::STABILITY_STABLE; - } - - /** - * Extract and merge stability flags from the given collection of - * requires with another collection of stability flags. - * - * @param array $requires New package name => link mappings - * @return array Unified package name => stability mappings - */ - public function extractAll(array $requires) - { - $flags = array(); - - foreach ($requires as $name => $link) { - $name = strtolower($name); - $version = $link->getPrettyConstraint(); - - $stability = $this->getExplicitStability($version); - - if ($stability === null) { - $stability = $this->getParsedStability($version); - } - - $flags[$name] = max($stability, $this->getCurrentStability($name)); - } - - // Filter out null stability values - return array_filter($flags, function ($v) { - return $v !== null; - }); - } - - - /** - * Extract the most unstable explicit stability (eg '@dev') from a version - * specification. - * - * @param string $version - * @return int|null Stability or null if no explict stability found - */ - protected function getExplicitStability($version) - { - $found = null; - $constraints = $this->splitConstraints($version); - foreach ($constraints as $constraint) { - if (preg_match($this->explicitStabilityRe, $constraint, $match)) { - $stability = $this->getStabilityInt($match[1]); - $found = max($stability, $found); - } - } - return $found; - } - - - /** - * Split a version specification into a list of version constraints. - * - * @param string $version - * @return array - */ - protected function splitConstraints($version) - { - $found = array(); - $orConstraints = preg_split('/\s*\|\|?\s*/', trim($version)); - foreach ($orConstraints as $constraints) { - $andConstraints = preg_split( - '/(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)/', - $constraints - ); - foreach ($andConstraints as $constraint) { - $found[] = $constraint; - } - } - return $found; - } - - - /** - * Get the stability of a version - * - * @param string $version - * @return int|null Stability or null if STABLE or less than minimum - */ - protected function getParsedStability($version) - { - // Drop aliasing if used - $version = preg_replace('/^([^,\s@]+) as .+$/', '$1', $version); - $stability = $this->getStabilityInt( - VersionParser::parseStability($version) - ); - - if ($stability === BasePackage::STABILITY_STABLE || - $this->minimumStability > $stability - ) { - // Ignore if 'stable' or more stable than the global - // minimum - $stability = null; - } - - return $stability; - } - - - /** - * Get the current stability of a given package. - * - * @param string $name - * @return int|null Stability of null if not set - */ - protected function getCurrentStability($name) - { - return isset($this->stabilityFlags[$name]) ? - $this->stabilityFlags[$name] : null; - } -} -// vim:sw=4:ts=4:sts=4:et: diff --git a/vendor/wikimedia/composer-merge-plugin/src/MergePlugin.php b/vendor/wikimedia/composer-merge-plugin/src/MergePlugin.php deleted file mode 100644 index 7eab0460e7df1a875cbda78883222c46dc9a3f45..0000000000000000000000000000000000000000 --- a/vendor/wikimedia/composer-merge-plugin/src/MergePlugin.php +++ /dev/null @@ -1,381 +0,0 @@ -<?php -/** - * This file is part of the Composer Merge plugin. - * - * Copyright (C) 2015 Bryan Davis, Wikimedia Foundation, and contributors - * - * This software may be modified and distributed under the terms of the MIT - * license. See the LICENSE file for details. - */ - -namespace Wikimedia\Composer; - -use Wikimedia\Composer\Merge\ExtraPackage; -use Wikimedia\Composer\Merge\MissingFileException; -use Wikimedia\Composer\Merge\PluginState; - -use Composer\Composer; -use Composer\DependencyResolver\Operation\InstallOperation; -use Composer\EventDispatcher\Event as BaseEvent; -use Composer\EventDispatcher\EventSubscriberInterface; -use Composer\Factory; -use Composer\Installer; -use Composer\Installer\InstallerEvent; -use Composer\Installer\InstallerEvents; -use Composer\Installer\PackageEvent; -use Composer\Installer\PackageEvents; -use Composer\IO\IOInterface; -use Composer\Package\RootPackageInterface; -use Composer\Plugin\PluginInterface; -use Composer\Script\Event as ScriptEvent; -use Composer\Script\ScriptEvents; - -/** - * Composer plugin that allows merging multiple composer.json files. - * - * When installed, this plugin will look for a "merge-plugin" key in the - * composer configuration's "extra" section. The value for this key is - * a set of options configuring the plugin. - * - * An "include" setting is required. The value of this setting can be either - * a single value or an array of values. Each value is treated as a glob() - * pattern identifying additional composer.json style configuration files to - * merge into the configuration for the current compser execution. - * - * The "autoload", "autoload-dev", "conflict", "provide", "replace", - * "repositories", "require", "require-dev", and "suggest" sections of the - * found configuration files will be merged into the root package - * configuration as though they were directly included in the top-level - * composer.json file. - * - * If included files specify conflicting package versions for "require" or - * "require-dev", the normal Composer dependency solver process will be used - * to attempt to resolve the conflict. Specifying the 'replace' key as true will - * change this default behaviour so that the last-defined version of a package - * will win, allowing for force-overrides of package defines. - * - * By default the "extra" section is not merged. This can be enabled by - * setitng the 'merge-extra' key to true. In normal mode, when the same key is - * found in both the original and the imported extra section, the version in - * the original config is used and the imported version is skipped. If - * 'replace' mode is active, this behaviour changes so the imported version of - * the key is used, replacing the version in the original config. - * - * - * @code - * { - * "require": { - * "wikimedia/composer-merge-plugin": "dev-master" - * }, - * "extra": { - * "merge-plugin": { - * "include": [ - * "composer.local.json" - * ] - * } - * } - * } - * @endcode - * - * @author Bryan Davis <bd808@bd808.com> - */ -class MergePlugin implements PluginInterface, EventSubscriberInterface -{ - - /** - * Offical package name - */ - const PACKAGE_NAME = 'wikimedia/composer-merge-plugin'; - - /** - * Name of the composer 1.1 init event. - */ - const COMPAT_PLUGINEVENTS_INIT = 'init'; - - /** - * Priority that plugin uses to register callbacks. - */ - const CALLBACK_PRIORITY = 50000; - - /** - * @var Composer $composer - */ - protected $composer; - - /** - * @var PluginState $state - */ - protected $state; - - /** - * @var Logger $logger - */ - protected $logger; - - /** - * Files that have already been fully processed - * - * @var string[] $loaded - */ - protected $loaded = array(); - - /** - * Files that have already been partially processed - * - * @var string[] $loadedNoDev - */ - protected $loadedNoDev = array(); - - /** - * {@inheritdoc} - */ - public function activate(Composer $composer, IOInterface $io) - { - $this->composer = $composer; - $this->state = new PluginState($this->composer); - $this->logger = new Logger('merge-plugin', $io); - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() - { - return array( - // Use our own constant to make this event optional. Once - // composer-1.1 is required, this can use PluginEvents::INIT - // instead. - self::COMPAT_PLUGINEVENTS_INIT => - array('onInit', self::CALLBACK_PRIORITY), - InstallerEvents::PRE_DEPENDENCIES_SOLVING => - array('onDependencySolve', self::CALLBACK_PRIORITY), - PackageEvents::POST_PACKAGE_INSTALL => - array('onPostPackageInstall', self::CALLBACK_PRIORITY), - ScriptEvents::POST_INSTALL_CMD => - array('onPostInstallOrUpdate', self::CALLBACK_PRIORITY), - ScriptEvents::POST_UPDATE_CMD => - array('onPostInstallOrUpdate', self::CALLBACK_PRIORITY), - ScriptEvents::PRE_AUTOLOAD_DUMP => - array('onInstallUpdateOrDump', self::CALLBACK_PRIORITY), - ScriptEvents::PRE_INSTALL_CMD => - array('onInstallUpdateOrDump', self::CALLBACK_PRIORITY), - ScriptEvents::PRE_UPDATE_CMD => - array('onInstallUpdateOrDump', self::CALLBACK_PRIORITY), - ); - } - - /** - * Handle an event callback for initialization. - * - * @param \Composer\EventDispatcher\Event $event - */ - public function onInit(BaseEvent $event) - { - $this->state->loadSettings(); - // It is not possible to know if the user specified --dev or --no-dev - // so assume it is false. The dev section will be merged later when - // the other events fire. - $this->state->setDevMode(false); - $this->mergeFiles($this->state->getIncludes(), false); - $this->mergeFiles($this->state->getRequires(), true); - } - - /** - * Handle an event callback for an install, update or dump command by - * checking for "merge-plugin" in the "extra" data and merging package - * contents if found. - * - * @param ScriptEvent $event - */ - public function onInstallUpdateOrDump(ScriptEvent $event) - { - $this->state->loadSettings(); - $this->state->setDevMode($event->isDevMode()); - $this->mergeFiles($this->state->getIncludes(), false); - $this->mergeFiles($this->state->getRequires(), true); - - if ($event->getName() === ScriptEvents::PRE_AUTOLOAD_DUMP) { - $this->state->setDumpAutoloader(true); - $flags = $event->getFlags(); - if (isset($flags['optimize'])) { - $this->state->setOptimizeAutoloader($flags['optimize']); - } - } - } - - /** - * Find configuration files matching the configured glob patterns and - * merge their contents with the master package. - * - * @param array $patterns List of files/glob patterns - * @param bool $required Are the patterns required to match files? - * @throws MissingFileException when required and a pattern returns no - * results - */ - protected function mergeFiles(array $patterns, $required = false) - { - $root = $this->composer->getPackage(); - - $files = array_map( - function ($files, $pattern) use ($required) { - if ($required && !$files) { - throw new MissingFileException( - "merge-plugin: No files matched required '{$pattern}'" - ); - } - return $files; - }, - array_map('glob', $patterns), - $patterns - ); - - foreach (array_reduce($files, 'array_merge', array()) as $path) { - $this->mergeFile($root, $path); - } - } - - /** - * Read a JSON file and merge its contents - * - * @param RootPackageInterface $root - * @param string $path - */ - protected function mergeFile(RootPackageInterface $root, $path) - { - if (isset($this->loaded[$path]) || - (isset($this->loadedNoDev[$path]) && !$this->state->isDevMode()) - ) { - $this->logger->debug( - "Already merged <comment>$path</comment> completely" - ); - return; - } - - $package = new ExtraPackage($path, $this->composer, $this->logger); - - if (isset($this->loadedNoDev[$path])) { - $this->logger->info( - "Loading -dev sections of <comment>{$path}</comment>..." - ); - $package->mergeDevInto($root, $this->state); - } else { - $this->logger->info("Loading <comment>{$path}</comment>..."); - $package->mergeInto($root, $this->state); - } - - if ($this->state->isDevMode()) { - $this->loaded[$path] = true; - } else { - $this->loadedNoDev[$path] = true; - } - - if ($this->state->recurseIncludes()) { - $this->mergeFiles($package->getIncludes(), false); - $this->mergeFiles($package->getRequires(), true); - } - } - - /** - * Handle an event callback for pre-dependency solving phase of an install - * or update by adding any duplicate package dependencies found during - * initial merge processing to the request that will be processed by the - * dependency solver. - * - * @param InstallerEvent $event - */ - public function onDependencySolve(InstallerEvent $event) - { - $request = $event->getRequest(); - foreach ($this->state->getDuplicateLinks('require') as $link) { - $this->logger->info( - "Adding dependency <comment>{$link}</comment>" - ); - $request->install($link->getTarget(), $link->getConstraint()); - } - - // Issue #113: Check devMode of event rather than our global state. - // Composer fires the PRE_DEPENDENCIES_SOLVING event twice for - // `--no-dev` operations to decide which packages are dev only - // requirements. - if ($this->state->shouldMergeDev() && $event->isDevMode()) { - foreach ($this->state->getDuplicateLinks('require-dev') as $link) { - $this->logger->info( - "Adding dev dependency <comment>{$link}</comment>" - ); - $request->install($link->getTarget(), $link->getConstraint()); - } - } - } - - /** - * Handle an event callback following installation of a new package by - * checking to see if the package that was installed was our plugin. - * - * @param PackageEvent $event - */ - public function onPostPackageInstall(PackageEvent $event) - { - $op = $event->getOperation(); - if ($op instanceof InstallOperation) { - $package = $op->getPackage()->getName(); - if ($package === self::PACKAGE_NAME) { - $this->logger->info('composer-merge-plugin installed'); - $this->state->setFirstInstall(true); - $this->state->setLocked( - $event->getComposer()->getLocker()->isLocked() - ); - } - } - } - - /** - * Handle an event callback following an install or update command. If our - * plugin was installed during the run then trigger an update command to - * process any merge-patterns in the current config. - * - * @param ScriptEvent $event - */ - public function onPostInstallOrUpdate(ScriptEvent $event) - { - // @codeCoverageIgnoreStart - if ($this->state->isFirstInstall()) { - $this->state->setFirstInstall(false); - $this->logger->info( - '<comment>' . - 'Running additional update to apply merge settings' . - '</comment>' - ); - - $config = $this->composer->getConfig(); - - $preferSource = $config->get('preferred-install') == 'source'; - $preferDist = $config->get('preferred-install') == 'dist'; - - $installer = Installer::create( - $event->getIO(), - // Create a new Composer instance to ensure full processing of - // the merged files. - Factory::create($event->getIO(), null, false) - ); - - $installer->setPreferSource($preferSource); - $installer->setPreferDist($preferDist); - $installer->setDevMode($event->isDevMode()); - $installer->setDumpAutoloader($this->state->shouldDumpAutoloader()); - $installer->setOptimizeAutoloader( - $this->state->shouldOptimizeAutoloader() - ); - - if ($this->state->forceUpdate()) { - // Force update mode so that new packages are processed rather - // than just telling the user that composer.json and - // composer.lock don't match. - $installer->setUpdate(true); - } - - $installer->run(); - } - // @codeCoverageIgnoreEnd - } -} -// vim:sw=4:ts=4:sts=4:et: diff --git a/vendor/zendframework/zend-diactoros/CHANGELOG.md b/vendor/zendframework/zend-diactoros/CHANGELOG.md index fc65b32a067d8dff6b16aa8206c562a28d1a9bef..4ea9683b81b880404a0d656457405601f6b1076a 100644 --- a/vendor/zendframework/zend-diactoros/CHANGELOG.md +++ b/vendor/zendframework/zend-diactoros/CHANGELOG.md @@ -2,6 +2,501 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. +## 1.8.6 - 2018-09-05 + +### Added + +- Nothing. + +### Changed + +- [#325](https://github.com/zendframework/zend-diactoros/pull/325) changes the behavior of `ServerRequest::withParsedBody()`. Per +- PSR-7, it now no longer allows values other than `null`, arrays, or objects. + +- [#325](https://github.com/zendframework/zend-diactoros/pull/325) changes the behavior of each of `Request`, `ServerRequest`, and + `Response` in relation to the validation of header values. Previously, we + allowed empty arrays to be provided via `withHeader()`; however, this was + contrary to the PSR-7 specification. Empty arrays are no longer allowed. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#325](https://github.com/zendframework/zend-diactoros/pull/325) ensures that `Uri::withUserInfo()` no longer ignores values of + `0` (numeric zero). + +- [#325](https://github.com/zendframework/zend-diactoros/pull/325) fixes how header values are merged when calling + `withAddedHeader()`, ensuring that array keys are ignored. + +## 1.8.5 - 2018-08-10 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#324](https://github.com/zendframework/zend-diactoros/pull/324) fixes a reference + to an undefined variable in the `ServerRequestFactory`, which made it + impossible to fetch a specific header by name. + +## 1.8.4 - 2018-08-01 + +### Added + +- Nothing. + +### Changed + +- This release modifies how `ServerRequestFactory` marshals the request URI. In + prior releases, we would attempt to inspect the `X-Rewrite-Url` and + `X-Original-Url` headers, using their values, if present. These headers are + issued by the ISAPI_Rewrite module for IIS (developed by HeliconTech). + However, we have no way of guaranteeing that the module is what issued the + headers, making it an unreliable source for discovering the URI. As such, we + have removed this feature in this release of Diactoros. + + If you are developing a middleware application, you can mimic the + functionality via middleware as follows: + + ```php + use Psr\Http\Message\ResponseInterface; + use Psr\Http\Message\ServerRequestInterface; + use Psr\Http\Server\RequestHandlerInterface; + use Zend\Diactoros\Uri; + + public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface + { + $requestUri = null; + + $httpXRewriteUrl = $request->getHeaderLine('X-Rewrite-Url'); + if ($httpXRewriteUrl !== null) { + $requestUri = $httpXRewriteUrl; + } + + $httpXOriginalUrl = $request->getHeaderLine('X-Original-Url'); + if ($httpXOriginalUrl !== null) { + $requestUri = $httpXOriginalUrl; + } + + if ($requestUri !== null) { + $request = $request->withUri(new Uri($requestUri)); + } + + return $handler->handle($request); + } + ``` + + If you use middleware such as the above, make sure you also instruct your web + server to strip any incoming headers of the same name so that you can + guarantee they are issued by the ISAPI_Rewrite module. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.8.3 - 2018-07-24 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#321](https://github.com/zendframework/zend-diactoros/pull/321) updates the logic in `Uri::withPort()` to ensure that it checks that the + value provided is either an integer or a string integer, as only those values + may be cast to integer without data loss. + +- [#320](https://github.com/zendframework/zend-diactoros/pull/320) adds checking within `Response` to ensure that the provided reason + phrase is a string; an `InvalidArgumentException` is now raised if it is not. This change + ensures the class adheres strictly to the PSR-7 specification. + +- [#319](https://github.com/zendframework/zend-diactoros/pull/319) provides a fix to `Zend\Diactoros\Response` that ensures that the status + code returned is _always_ an integer (and never a string containing an + integer), thus ensuring it strictly adheres to the PSR-7 specification. + +## 1.8.2 - 2018-07-19 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#318](https://github.com/zendframework/zend-diactoros/pull/318) fixes the logic for discovering whether an HTTPS scheme is in play + to be case insensitive when comparing header and SAPI values, ensuring no + false negative lookups occur. + +- [#314](https://github.com/zendframework/zend-diactoros/pull/314) modifies error handling around opening a file resource within + `Zend\Diactoros\Stream::setStream()` to no longer use the second argument to + `set_error_handler()`, and instead check the error type in the handler itself; + this fixes an issue when the handler is nested inside another error handler, + which currently has buggy behavior within the PHP engine. + +## 1.8.1 - 2018-07-09 + +### Added + +- Nothing. + +### Changed + +- [#313](https://github.com/zendframework/zend-diactoros/pull/313) changes the reason phrase associated with the status code 425 + to "Too Early", corresponding to a new definition of the code as specified by the IANA. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#312](https://github.com/zendframework/zend-diactoros/pull/312) fixes how the `normalizeUploadedFiles()` utility function handles nested trees of + uploaded files, ensuring it detects them properly. + +## 1.8.0 - 2018-06-27 + +### Added + +- [#307](https://github.com/zendframework/zend-diactoros/pull/307) adds the following functions under the `Zend\Diactoros` namespace, each of + which may be used to derive artifacts from SAPI supergloabls for the purposes + of generating a `ServerRequest` instance: + - `normalizeServer(array $server, callable $apacheRequestHeaderCallback = null) : array` + (main purpose is to aggregate the `Authorization` header in the SAPI params + when under Apache) + - `marshalProtocolVersionFromSapi(array $server) : string` + - `marshalMethodFromSapi(array $server) : string` + - `marshalUriFromSapi(array $server, array $headers) : Uri` + - `marshalHeadersFromSapi(array $server) : array` + - `parseCookieHeader(string $header) : array` + - `createUploadedFile(array $spec) : UploadedFile` (creates the instance from + a normal `$_FILES` entry) + - `normalizeUploadedFiles(array $files) : UploadedFileInterface[]` (traverses + a potentially nested array of uploaded file instances and/or `$_FILES` + entries, including those aggregated under mod_php, php-fpm, and php-cgi in + order to create a flat array of `UploadedFileInterface` instances to use in a + request) + +### Changed + +- Nothing. + +### Deprecated + +- [#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::normalizeServer()`; the method is + no longer used internally, and users should instead use `Zend\Diactoros\normalizeServer()`, + to which it proxies. + +- [#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::marshalHeaders()`; the method is + no longer used internally, and users should instead use `Zend\Diactoros\marshalHeadersFromSapi()`, + to which it proxies. + +- [#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::marshalUriFromServer()`; the method + is no longer used internally. Users should use `marshalUriFromSapi()` instead. + +- [#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::marshalRequestUri()`. the method is no longer + used internally, and currently proxies to `marshalUriFromSapi()`, pulling the + discovered path from the `Uri` instance returned by that function. Users + should use `marshalUriFromSapi()` instead. + +- [#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::marshalHostAndPortFromHeaders()`; the method + is no longer used internally, and currently proxies to `marshalUriFromSapi()`, + pulling the discovered host and port from the `Uri` instance returned by that + function. Users should use `marshalUriFromSapi()` instead. + +- [#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::getHeader()`; the method is no longer + used internally. Users should copy and paste the functionality into their own + applications if needed, or rely on headers from a fully-populated `Uri` + instance instead. + +- [#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::stripQueryString()`; the method is no longer + used internally, and users can mimic the functionality via the expression + `$path = explode('?', $path, 2)[0];`. + +- [#307](https://github.com/zendframework/zend-diactoros/pull/307) deprecates `ServerRequestFactory::normalizeFiles()`; the functionality + is no longer used internally, and users can use `normalizeUploadedFiles()` as + a replacement. + +- [#303](https://github.com/zendframework/zend-diactoros/pull/303) deprecates `Zend\Diactoros\Response\EmitterInterface` and its various implementations. These are now provided via the + [zendframework/zend-httphandlerrunner](https://docs.zendframework.com/zend-httphandlerrunner) package as 1:1 substitutions. + +- [#303](https://github.com/zendframework/zend-diactoros/pull/303) deprecates the `Zend\Diactoros\Server` class. Users are directed to the `RequestHandlerRunner` class from the + [zendframework/zend-httphandlerrunner](https://docs.zendframework.com/zend-httphandlerrunner) package as an alternative. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.7.2 - 2018-05-29 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#301](https://github.com/zendframework/zend-diactoros/pull/301) adds stricter comparisons within the `uri` class to ensure non-empty + values are not treated as empty. + +## 1.7.1 - 2018-02-26 + +### Added + +- Nothing. + +### Changed + +- [#293](https://github.com/zendframework/zend-diactoros/pull/293) updates + `Uri::getHost()` to cast the value via `strtolower()` before returning it. + While this represents a change, it is fixing a bug in our implementation: + the PSR-7 specification for the method, which follows IETF RFC 3986 section + 3.2.2, requires that the host name be normalized to lowercase. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#290](https://github.com/zendframework/zend-diactoros/pull/290) fixes + `Stream::getSize()` such that it checks that the result of `fstat` was + succesful before attempting to return its `size` member; in the case of an + error, it now returns `null`. + +## 1.7.0 - 2018-01-04 + +### Added + +- [#285](https://github.com/zendframework/zend-diactoros/pull/285) adds a new + custom response type, `Zend\Diactoros\Response\XmlResponse`, for generating + responses representing XML. Usage is the same as with the `HtmlResponse` or + `TextResponse`; the response generated will have a `Content-Type: + application/xml` header by default. + +- [#280](https://github.com/zendframework/zend-diactoros/pull/280) adds the + response status code/phrase pairing "103 Early Hints" to the + `Response::$phrases` property. This is a new status proposed via + [RFC 8297](https://datatracker.ietf.org/doc/rfc8297/). + +- [#279](https://github.com/zendframework/zend-diactoros/pull/279) adds explicit + support for PHP 7.2; previously, we'd allowed build failures, though none + occured; we now require PHP 7.2 builds to pass. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.6.1 - 2017-10-12 + +### Added + +- Nothing. + +### Changed + +- [#273](https://github.com/zendframework/zend-diactoros/pull/273) updates each + of the SAPI emitter implementations to emit the status line after emitting + other headers; this is done to ensure that the status line is not overridden + by PHP. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#273](https://github.com/zendframework/zend-diactoros/pull/273) modifies how + the `SapiEmitterTrait` calls `header()` to ensure that a response code is + _always_ passed as the third argument; this is done to prevent PHP from + silently overriding it. + +## 1.6.0 - 2017-09-13 + +### Added + +- Nothing. + +### Changed + +- [#270](https://github.com/zendframework/zend-diactoros/pull/270) changes the + behavior of `Zend\Diactoros\Server`: it no longer creates an output buffer. + +- [#270](https://github.com/zendframework/zend-diactoros/pull/270) changes the + behavior of the two SAPI emitters in two backwards-incompatible ways: + + - They no longer auto-inject a `Content-Length` header. If you need this + functionality, zendframework/zend-expressive-helpers 4.1+ provides it via + `Zend\Expressive\Helper\ContentLengthMiddleware`. + + - They no longer flush the output buffer. Instead, if headers have been sent, + or the output buffer exists and has a non-zero length, the emitters raise an + exception, as mixed PSR-7/output buffer content creates a blocking issue. + If you are emitting content via `echo`, `print`, `var_dump`, etc., or not + catching PHP errors or exceptions, you will need to either fix your + application to always work with a PSR-7 response, or provide your own + emitters that allow mixed output mechanisms. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.5.0 - 2017-08-22 + +### Added + +- [#205](https://github.com/zendframework/zend-diactoros/pull/205) adds support + for PHP 7.2. + +- [#250](https://github.com/zendframework/zend-diactoros/pull/250) adds a new + API to `JsonResponse` to avoid the need for decoding the response body in + order to make changes to the underlying content. New methods include: + - `getPayload()`: retrieve the unencoded payload. + - `withPayload($data)`: create a new instance with the given data. + - `getEncodingOptions()`: retrieve the flags to use when encoding the payload + to JSON. + - `withEncodingOptions(int $encodingOptions)`: create a new instance that uses + the provided flags when encoding the payload to JSON. + +### Changed + +- [#249](https://github.com/zendframework/zend-diactoros/pull/249) changes the + behavior of the various `Uri::with*()` methods slightly: if the value + represents no change, these methods will return the same instance instead of a + new one. + +- [#248](https://github.com/zendframework/zend-diactoros/pull/248) changes the + behavior of `Uri::getUserInfo()` slightly: it now (correctly) returns the + percent-encoded values for the user and/or password, per RFC 3986 Section + 3.2.1. `withUserInfo()` will percent-encode values, using a mechanism that + prevents double-encoding. + +- [#243](https://github.com/zendframework/zend-diactoros/pull/243) changes the + exception messages thrown by `UploadedFile::getStream()` and `moveTo()` when + an upload error exists to include details about the upload error. + +- [#233](https://github.com/zendframework/zend-diactoros/pull/233) adds a new + argument to `SapiStreamEmitter::emit`, `$maxBufferLevel` **between** the + `$response` and `$maxBufferLength` arguments. This was done because the + `Server::listen()` method passes only the response and `$maxBufferLevel` to + emitters; previously, this often meant that streams were being chunked 2 bytes + at a time versus the expected default of 8kb. + + If you were calling the `SapiStreamEmitter::emit()` method manually + previously, you will need to update your code. + +### Deprecated + +- Nothing. + +### Removed + +- [#205](https://github.com/zendframework/zend-diactoros/pull/205) and + [#243](https://github.com/zendframework/zend-diactoros/pull/243) **remove + support for PHP versions prior to 5.6 as well as HHVM**. + +### Fixed + +- [#248](https://github.com/zendframework/zend-diactoros/pull/248) fixes how the + `Uri` class provides user-info within the URI authority; the value is now + correctly percent-encoded , per RFC 3986 Section 3.2.1. + ## 1.4.1 - 2017-08-17 ### Added diff --git a/vendor/zendframework/zend-diactoros/composer.json b/vendor/zendframework/zend-diactoros/composer.json index 12e4a9f33e2fd6ff2fae1fb6163fde8fd8c9e72a..ddb91d9645253f9e05eccf62eef7a772fb858ea5 100644 --- a/vendor/zendframework/zend-diactoros/composer.json +++ b/vendor/zendframework/zend-diactoros/composer.json @@ -13,26 +13,41 @@ "issues": "https://github.com/zendframework/zend-diactoros/issues", "source": "https://github.com/zendframework/zend-diactoros" }, + "config": { + "sort-packages": true + }, "extra": { "branch-alias": { - "dev-master": "1.4-dev", - "dev-develop": "1.5-dev" + "dev-master": "1.8.x-dev", + "dev-develop": "1.9.x-dev", + "dev-release-2.0": "2.0.x-dev" } }, "require": { - "php": "^5.4 || ^7.0", - "psr/http-message": "~1.0" + "php": "^5.6 || ^7.0", + "psr/http-message": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^4.6 || ^5.5", - "zendframework/zend-coding-standard": "~1.0.0", "ext-dom": "*", - "ext-libxml": "*" + "ext-libxml": "*", + "php-http/psr7-integration-tests": "dev-master", + "phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7", + "zendframework/zend-coding-standard": "~1.0" }, "provide": { "psr/http-message-implementation": "1.0" }, "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php" + ], "psr-4": { "Zend\\Diactoros\\": "src/" } @@ -51,7 +66,6 @@ "@cs-check", "@test" ], - "upload-coverage": "coveralls -v", "cs-check": "phpcs", "cs-fix": "phpcbf", "test": "phpunit --colors=always", diff --git a/vendor/zendframework/zend-diactoros/composer.lock b/vendor/zendframework/zend-diactoros/composer.lock index c73430e4212da18dbd90dabdc7a524303baaf136..261ae10c65a8696b13ab98368f1eb87a75cc8d03 100644 --- a/vendor/zendframework/zend-diactoros/composer.lock +++ b/vendor/zendframework/zend-diactoros/composer.lock @@ -1,11 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "hash": "287996fa611f46eb393c625c762f709f", - "content-hash": "3efa62db7f378a4802a4cf729875f3aa", + "content-hash": "7ca0087aabf01eb8dbf67e0ae741f2f2", "packages": [ { "name": "psr/http-message", @@ -55,7 +54,7 @@ "request", "response" ], - "time": "2016-08-06 14:39:51" + "time": "2016-08-06T14:39:51+00:00" } ], "packages-dev": [ @@ -111,41 +110,346 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-10-19T19:58:43+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" + }, + { + "name": "php-http/psr7-integration-tests", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-http/psr7-integration-tests.git", + "reference": "5dfefb2da33ca24ae20c971b725c9a6fe7403008" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/psr7-integration-tests/zipball/5dfefb2da33ca24ae20c971b725c9a6fe7403008", + "reference": "5dfefb2da33ca24ae20c971b725c9a6fe7403008", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0", + "phpunit/phpunit": "^5.4 || ^6.0 || ^7.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "guzzlehttp/psr7": "^1.4", + "nyholm/psr7": "dev-master", + "ringcentral/psr7": "^1.2", + "slim/http": "^0.3", + "zendframework/zend-diactoros": "^1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Psr7Test\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com" + } + ], + "description": "Test suite for PSR7", + "homepage": "http://php-http.org", + "keywords": [ + "psr-7", + "test" + ], + "time": "2018-09-02T10:01:55+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", + "version": "4.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-30T07:14:17+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "phpDocumentor": [ + "psr-4": { + "phpDocumentor\\Reflection\\": [ "src/" ] } @@ -157,40 +461,40 @@ "authors": [ { "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "email": "me@mikevanriel.com" } ], - "time": "2015-02-03 12:10:50" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.7.0", + "version": "1.7.6", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1|^2.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -223,43 +527,44 @@ "spy", "stub" ], - "time": "2017-03-02 20:05:34" + "time": "2018-04-18T13:57:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "2.2.4", + "version": "5.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "reference": "c89677919c5dd6d3b3852f230a663118762218ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac", "shasum": "" }, "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^2.0.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" + "phpunit/phpunit": "^6.0" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.5.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "5.3.x-dev" } }, "autoload": { @@ -274,7 +579,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -285,20 +590,20 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2018-04-06T15:36:58+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -332,7 +637,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03 07:40:28" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -373,7 +678,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -422,33 +727,33 @@ "keywords": [ "timer" ], - "time": "2017-02-26 11:10:40" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.11", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" + "reference": "791198a2c6254db10131eecfe8c06670700904db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.2.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -471,45 +776,57 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-27 10:12:30" + "time": "2017-11-27T05:48:46+00:00" }, { "name": "phpunit/phpunit", - "version": "4.8.35", + "version": "6.5.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87" + "reference": "093ca5508174cd8ab8efe44fd1dde447adfdec8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/791b1a67c25af50e230f841ee7a9c6eba507dc87", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/093ca5508174cd8ab8efe44fd1dde447adfdec8f", + "reference": "093ca5508174cd8ab8efe44fd1dde447adfdec8f", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^5.3", + "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^1.0.9", + "phpunit/phpunit-mock-objects": "^5.0.5", + "sebastian/comparator": "^2.1", + "sebastian/diff": "^2.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" }, "suggest": { - "phpunit/php-invoker": "~1.1" + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" }, "bin": [ "phpunit" @@ -517,7 +834,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.8.x-dev" + "dev-master": "6.5.x-dev" } }, "autoload": { @@ -543,30 +860,33 @@ "testing", "xunit" ], - "time": "2017-02-06 05:18:07" + "time": "2018-07-03T06:40:40+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "version": "5.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "reference": "6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f", + "reference": "6f9a3c8bf34188a2b53ce2ae7a126089c53e0a9f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "doctrine/instantiator": "^1.0.5", + "php": "^7.0", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.1" + }, + "conflict": { + "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.5" }, "suggest": { "ext-soap": "*" @@ -574,7 +894,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { @@ -589,7 +909,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -599,34 +919,79 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2018-07-13T03:27:23+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.4", + "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": "^7.0", + "sebastian/diff": "^2.0 || ^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { @@ -657,38 +1022,38 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-01-29 09:50:25" + "time": "2018-02-01T13:46:46+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^6.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -715,32 +1080,32 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2017-08-03T08:09:46+00:00" }, { "name": "sebastian/environment", - "version": "1.3.8", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" + "phpunit/phpunit": "^6.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -765,34 +1130,34 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:49:44" + "time": "2017-07-01T08:51:00+00:00" }, { "name": "sebastian/exporter", - "version": "1.2.2", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -832,27 +1197,27 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2017-04-03T13:19:02+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-uopz": "*" @@ -860,7 +1225,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -883,32 +1248,124 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", - "version": "1.0.5", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -936,23 +1393,73 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03 07:41:43" + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", - "version": "1.0.6", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, + "require": { + "php": ">=5.6" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -971,20 +1478,20 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "2.8.1", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "d7cf0d894e8aa4c73712ee4a331cc1eaa37cdc7d" + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d7cf0d894e8aa4c73712ee4a331cc1eaa37cdc7d", - "reference": "d7cf0d894e8aa4c73712ee4a331cc1eaa37cdc7d", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", "shasum": "" }, "require": { @@ -1049,38 +1556,79 @@ "phpcs", "standards" ], - "time": "2017-03-01 22:17:45" + "time": "2017-05-22T02:43:20+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" }, { - "name": "symfony/yaml", - "version": "v2.8.19", + "name": "webmozart/assert", + "version": "1.3.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "286d84891690b0e2515874717e49360d1c98a703" + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/286d84891690b0e2515874717e49360d1c98a703", - "reference": "286d84891690b0e2515874717e49360d1c98a703", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "1.3-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Webmozart\\Assert\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1088,17 +1636,17 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2017-03-20 09:41:44" + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-01-29T19:49:41+00:00" }, { "name": "zendframework/zend-coding-standard", @@ -1127,16 +1675,18 @@ "Coding Standard", "zf" ], - "time": "2016-11-09 21:30:43" + "time": "2016-11-09T21:30:43+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "php-http/psr7-integration-tests": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^5.4 || ^7.0" + "php": "^5.6 || ^7.0" }, "platform-dev": { "ext-dom": "*", diff --git a/vendor/zendframework/zend-diactoros/src/AbstractSerializer.php b/vendor/zendframework/zend-diactoros/src/AbstractSerializer.php index 9ee9afd0c59f0c611d7501192dc0f15018630a18..cd07fa6df91c0c1316f4e01e81c49778e77805f6 100644 --- a/vendor/zendframework/zend-diactoros/src/AbstractSerializer.php +++ b/vendor/zendframework/zend-diactoros/src/AbstractSerializer.php @@ -12,6 +12,14 @@ use Psr\Http\Message\StreamInterface; use UnexpectedValueException; +use function array_pop; +use function implode; +use function ltrim; +use function preg_match; +use function sprintf; +use function str_replace; +use function ucwords; + /** * Provides base functionality for request and response de/serialization * strategies, including functionality for retrieving a line at a time from diff --git a/vendor/zendframework/zend-diactoros/src/CallbackStream.php b/vendor/zendframework/zend-diactoros/src/CallbackStream.php index c8e6bc6fc4f4b06a8fbd92140c0fdb7a31a8bc79..9537a34967185d56e841ff8eaeff137adeb32d09 100644 --- a/vendor/zendframework/zend-diactoros/src/CallbackStream.php +++ b/vendor/zendframework/zend-diactoros/src/CallbackStream.php @@ -10,8 +10,12 @@ namespace Zend\Diactoros; use InvalidArgumentException; -use RuntimeException; use Psr\Http\Message\StreamInterface; +use RuntimeException; + +use function array_key_exists; + +use const SEEK_SET; /** * Implementation of PSR HTTP streams diff --git a/vendor/zendframework/zend-diactoros/src/HeaderSecurity.php b/vendor/zendframework/zend-diactoros/src/HeaderSecurity.php index ecca716b10013f0de338a8a5a46a0f1dffa15d39..72e83e14a51d34580cb53836a96284293a1d0c1f 100644 --- a/vendor/zendframework/zend-diactoros/src/HeaderSecurity.php +++ b/vendor/zendframework/zend-diactoros/src/HeaderSecurity.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -11,6 +9,17 @@ use InvalidArgumentException; +use function get_class; +use function gettype; +use function in_array; +use function is_numeric; +use function is_object; +use function is_string; +use function ord; +use function preg_match; +use function sprintf; +use function strlen; + /** * Provide security tools around HTTP headers to prevent common injection vectors. * diff --git a/vendor/zendframework/zend-diactoros/src/MessageTrait.php b/vendor/zendframework/zend-diactoros/src/MessageTrait.php index 1c9768b54e1a84191d7bc0f0eb25c0bb0986850d..6b83be4655a8d5584656469ad4b502b53a176d5d 100644 --- a/vendor/zendframework/zend-diactoros/src/MessageTrait.php +++ b/vendor/zendframework/zend-diactoros/src/MessageTrait.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -12,6 +10,19 @@ use InvalidArgumentException; use Psr\Http\Message\StreamInterface; +use function array_map; +use function array_merge; +use function get_class; +use function gettype; +use function implode; +use function is_array; +use function is_object; +use function is_resource; +use function is_string; +use function preg_match; +use function sprintf; +use function strtolower; + /** * Trait implementing the various methods defined in MessageInterface. * @@ -343,9 +354,9 @@ private function setHeaders(array $originalHeaders) private function validateProtocolVersion($version) { if (empty($version)) { - throw new InvalidArgumentException(sprintf( + throw new InvalidArgumentException( 'HTTP protocol version can not be empty' - )); + ); } if (! is_string($version)) { throw new InvalidArgumentException(sprintf( @@ -374,11 +385,18 @@ private function filterHeaderValue($values) $values = [$values]; } + if ([] === $values) { + throw new InvalidArgumentException( + 'Invalid header value: must be a string or array of strings; ' + . 'cannot be an empty array' + ); + } + return array_map(function ($value) { HeaderSecurity::assertValid($value); return (string) $value; - }, $values); + }, array_values($values)); } /** diff --git a/vendor/zendframework/zend-diactoros/src/PhpInputStream.php b/vendor/zendframework/zend-diactoros/src/PhpInputStream.php index eee973b65ce90ba8e1922c865766d5614414075a..8713d027033ff95ec5218f12f3ae67181c73ebd6 100644 --- a/vendor/zendframework/zend-diactoros/src/PhpInputStream.php +++ b/vendor/zendframework/zend-diactoros/src/PhpInputStream.php @@ -1,14 +1,14 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ namespace Zend\Diactoros; +use function stream_get_contents; + /** * Caching version of php://input */ diff --git a/vendor/zendframework/zend-diactoros/src/RelativeStream.php b/vendor/zendframework/zend-diactoros/src/RelativeStream.php index 819f4fd9433286d5c51903de89dd0af702c6de4f..5f2eb915e12a9838548f454b4e4878d2d55ac394 100644 --- a/vendor/zendframework/zend-diactoros/src/RelativeStream.php +++ b/vendor/zendframework/zend-diactoros/src/RelativeStream.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -12,6 +10,8 @@ use Psr\Http\Message\StreamInterface; use RuntimeException; +use const SEEK_SET; + /** * Class RelativeStream * diff --git a/vendor/zendframework/zend-diactoros/src/Request.php b/vendor/zendframework/zend-diactoros/src/Request.php index 7680513602bf032bd5c5ce9c5838ebd4d8755ff8..422862ec697906358c092f4ef9d5a66d61723893 100644 --- a/vendor/zendframework/zend-diactoros/src/Request.php +++ b/vendor/zendframework/zend-diactoros/src/Request.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -13,6 +11,8 @@ use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UriInterface; +use function strtolower; + /** * HTTP Request encapsulation * diff --git a/vendor/zendframework/zend-diactoros/src/Request/ArraySerializer.php b/vendor/zendframework/zend-diactoros/src/Request/ArraySerializer.php index f48db37e02ca8300c973bfe4915c583c70cbced8..f5e25eba2b86090fdae25f235ff235813f6d8078 100644 --- a/vendor/zendframework/zend-diactoros/src/Request/ArraySerializer.php +++ b/vendor/zendframework/zend-diactoros/src/Request/ArraySerializer.php @@ -12,6 +12,8 @@ use Zend\Diactoros\Request; use Zend\Diactoros\Stream; +use function sprintf; + /** * Serialize or deserialize request messages to/from arrays. * diff --git a/vendor/zendframework/zend-diactoros/src/Request/Serializer.php b/vendor/zendframework/zend-diactoros/src/Request/Serializer.php index 8f45e5edf2cedec3de1fbc8c1e7f70e1a698f0d7..201486317d54bd2c270ecaeacd870d1f38d94b27 100644 --- a/vendor/zendframework/zend-diactoros/src/Request/Serializer.php +++ b/vendor/zendframework/zend-diactoros/src/Request/Serializer.php @@ -18,6 +18,9 @@ use Zend\Diactoros\Stream; use Zend\Diactoros\Uri; +use function preg_match; +use function sprintf; + /** * Serialize (cast to string) or deserialize (cast string to Request) messages. * diff --git a/vendor/zendframework/zend-diactoros/src/RequestTrait.php b/vendor/zendframework/zend-diactoros/src/RequestTrait.php index 6117b98a7bbcb8108158e219ace777f6ad6498d3..a1bdc3de0af4454495207e5a5feba6f471a5c659 100644 --- a/vendor/zendframework/zend-diactoros/src/RequestTrait.php +++ b/vendor/zendframework/zend-diactoros/src/RequestTrait.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -13,6 +11,15 @@ use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UriInterface; +use function array_keys; +use function get_class; +use function gettype; +use function is_object; +use function is_string; +use function preg_match; +use function sprintf; +use function strtolower; + /** * Trait with common request behaviors. * diff --git a/vendor/zendframework/zend-diactoros/src/Response.php b/vendor/zendframework/zend-diactoros/src/Response.php index cd22b5dbc0c80d6b8c0bbc4c56224c78c1c41d0e..17cae64e556798d141d7007ae2cc87f151eac33f 100644 --- a/vendor/zendframework/zend-diactoros/src/Response.php +++ b/vendor/zendframework/zend-diactoros/src/Response.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -13,6 +11,12 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; +use function gettype; +use function is_float; +use function is_numeric; +use function is_scalar; +use function sprintf; + /** * HTTP response encapsulation. * @@ -37,6 +41,7 @@ class Response implements ResponseInterface 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', + 103 => 'Early Hints', // SUCCESS CODES 200 => 'OK', 201 => 'Created', @@ -82,7 +87,7 @@ class Response implements ResponseInterface 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', - 425 => 'Unordered Collection', + 425 => 'Too Early', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', @@ -108,7 +113,7 @@ class Response implements ResponseInterface /** * @var string */ - private $reasonPhrase = ''; + private $reasonPhrase; /** * @var int @@ -141,12 +146,6 @@ public function getStatusCode() */ public function getReasonPhrase() { - if (! $this->reasonPhrase - && isset($this->phrases[$this->statusCode]) - ) { - $this->reasonPhrase = $this->phrases[$this->statusCode]; - } - return $this->reasonPhrase; } @@ -156,8 +155,7 @@ public function getReasonPhrase() public function withStatus($code, $reasonPhrase = '') { $new = clone $this; - $new->setStatusCode($code); - $new->reasonPhrase = $reasonPhrase; + $new->setStatusCode($code, $reasonPhrase); return $new; } @@ -165,9 +163,10 @@ public function withStatus($code, $reasonPhrase = '') * Set a valid status code. * * @param int $code + * @param string $reasonPhrase * @throws InvalidArgumentException on an invalid status code. */ - private function setStatusCode($code) + private function setStatusCode($code, $reasonPhrase = '') { if (! is_numeric($code) || is_float($code) @@ -176,11 +175,24 @@ private function setStatusCode($code) ) { throw new InvalidArgumentException(sprintf( 'Invalid status code "%s"; must be an integer between %d and %d, inclusive', - (is_scalar($code) ? $code : gettype($code)), + is_scalar($code) ? $code : gettype($code), static::MIN_STATUS_CODE_VALUE, static::MAX_STATUS_CODE_VALUE )); } - $this->statusCode = $code; + + if (! is_string($reasonPhrase)) { + throw new InvalidArgumentException(sprintf( + 'Unsupported response reason phrase; must be a string, received %s', + is_object($reasonPhrase) ? get_class($reasonPhrase) : gettype($reasonPhrase) + )); + } + + if ($reasonPhrase === '' && isset($this->phrases[$code])) { + $reasonPhrase = $this->phrases[$code]; + } + + $this->reasonPhrase = $reasonPhrase; + $this->statusCode = (int) $code; } } diff --git a/vendor/zendframework/zend-diactoros/src/Response/ArraySerializer.php b/vendor/zendframework/zend-diactoros/src/Response/ArraySerializer.php index be4ab3e75566b360dbf21310b15418ec311220a3..7afe419473ba022c718939cce40e32694aa90f9b 100644 --- a/vendor/zendframework/zend-diactoros/src/Response/ArraySerializer.php +++ b/vendor/zendframework/zend-diactoros/src/Response/ArraySerializer.php @@ -12,6 +12,8 @@ use Zend\Diactoros\Response; use Zend\Diactoros\Stream; +use function sprintf; + /** * Serialize or deserialize response messages to/from arrays. * diff --git a/vendor/zendframework/zend-diactoros/src/Response/EmitterInterface.php b/vendor/zendframework/zend-diactoros/src/Response/EmitterInterface.php index f27b4a9ceb78f65afd565e82283f384bdd3556f5..0441486428b03e38ac3704e3793c401802500b2f 100644 --- a/vendor/zendframework/zend-diactoros/src/Response/EmitterInterface.php +++ b/vendor/zendframework/zend-diactoros/src/Response/EmitterInterface.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (https://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -11,6 +9,10 @@ use Psr\Http\Message\ResponseInterface; +/** + * @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner + * now provides this functionality. + */ interface EmitterInterface { /** diff --git a/vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php b/vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php index 1e1f032a97edd01fb6f3b3ef72a33ed309e95155..ad5ec8e19e0a420aff410bfa0796fbea4212c3be 100644 --- a/vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php +++ b/vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php @@ -14,6 +14,12 @@ use Zend\Diactoros\Response; use Zend\Diactoros\Stream; +use function get_class; +use function gettype; +use function is_object; +use function is_string; +use function sprintf; + /** * HTML response. * diff --git a/vendor/zendframework/zend-diactoros/src/Response/InjectContentTypeTrait.php b/vendor/zendframework/zend-diactoros/src/Response/InjectContentTypeTrait.php index 4f2caf842f681959b6b51b206ee7895ff16fdf3b..445e1324b3876fee4f9aa277230788321d00b11d 100644 --- a/vendor/zendframework/zend-diactoros/src/Response/InjectContentTypeTrait.php +++ b/vendor/zendframework/zend-diactoros/src/Response/InjectContentTypeTrait.php @@ -9,6 +9,10 @@ namespace Zend\Diactoros\Response; +use function array_keys; +use function array_reduce; +use function strtolower; + trait InjectContentTypeTrait { /** diff --git a/vendor/zendframework/zend-diactoros/src/Response/JsonResponse.php b/vendor/zendframework/zend-diactoros/src/Response/JsonResponse.php index c8af7c4c2aba23b013456788352e64c6b2b78f2f..b8a032a3b2738a5dbe6ba0c923cf1342e0b49d6b 100644 --- a/vendor/zendframework/zend-diactoros/src/Response/JsonResponse.php +++ b/vendor/zendframework/zend-diactoros/src/Response/JsonResponse.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -13,6 +11,15 @@ use Zend\Diactoros\Response; use Zend\Diactoros\Stream; +use function is_object; +use function is_resource; +use function json_encode; +use function json_last_error; +use function json_last_error_msg; +use function sprintf; + +use const JSON_ERROR_NONE; + /** * JSON response. * @@ -35,6 +42,16 @@ class JsonResponse extends Response */ const DEFAULT_JSON_FLAGS = 79; + /** + * @var mixed + */ + private $payload; + + /** + * @var int + */ + private $encodingOptions; + /** * Create a JSON response with the given data. * @@ -59,15 +76,71 @@ public function __construct( array $headers = [], $encodingOptions = self::DEFAULT_JSON_FLAGS ) { - $body = new Stream('php://temp', 'wb+'); - $body->write($this->jsonEncode($data, $encodingOptions)); - $body->rewind(); + $this->setPayload($data); + $this->encodingOptions = $encodingOptions; + + $json = $this->jsonEncode($data, $this->encodingOptions); + $body = $this->createBodyFromJson($json); $headers = $this->injectContentType('application/json', $headers); parent::__construct($body, $status, $headers); } + /** + * @return mixed + */ + public function getPayload() + { + return $this->payload; + } + + /** + * @param $data + * + * @return JsonResponse + */ + public function withPayload($data) + { + $new = clone $this; + $new->setPayload($data); + return $this->updateBodyFor($new); + } + + /** + * @return int + */ + public function getEncodingOptions() + { + return $this->encodingOptions; + } + + /** + * @param int $encodingOptions + * + * @return JsonResponse + */ + public function withEncodingOptions($encodingOptions) + { + $new = clone $this; + $new->encodingOptions = $encodingOptions; + return $this->updateBodyFor($new); + } + + /** + * @param string $json + * + * @return Stream + */ + private function createBodyFromJson($json) + { + $body = new Stream('php://temp', 'wb+'); + $body->write($json); + $body->rewind(); + + return $body; + } + /** * Encode the provided data to JSON. * @@ -97,4 +170,29 @@ private function jsonEncode($data, $encodingOptions) return $json; } + + /** + * @param $data + */ + private function setPayload($data) + { + if (is_object($data)) { + $data = clone $data; + } + + $this->payload = $data; + } + + /** + * Update the response body for the given instance. + * + * @param self $toUpdate Instance to update. + * @return JsonResponse Returns a new instance with an updated body. + */ + private function updateBodyFor(self $toUpdate) + { + $json = $this->jsonEncode($toUpdate->payload, $toUpdate->encodingOptions); + $body = $this->createBodyFromJson($json); + return $toUpdate->withBody($body); + } } diff --git a/vendor/zendframework/zend-diactoros/src/Response/RedirectResponse.php b/vendor/zendframework/zend-diactoros/src/Response/RedirectResponse.php index bce824992f8a46989c66ee705250ae78754a2f7f..800428cdb1f900dd6dfffabb35d23934ace4c540 100644 --- a/vendor/zendframework/zend-diactoros/src/Response/RedirectResponse.php +++ b/vendor/zendframework/zend-diactoros/src/Response/RedirectResponse.php @@ -13,6 +13,12 @@ use Psr\Http\Message\UriInterface; use Zend\Diactoros\Response; +use function get_class; +use function gettype; +use function is_object; +use function is_string; +use function sprintf; + /** * Produce a redirect response. */ diff --git a/vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php b/vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php index a961342935b07a86aa39565ad2ae9e43c41e6a02..0db003f6677c7734908c654e82c29dc6ffdf2698 100644 --- a/vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php +++ b/vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php @@ -1,17 +1,18 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ namespace Zend\Diactoros\Response; use Psr\Http\Message\ResponseInterface; -use RuntimeException; +/** + * @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner + * now provides this functionality. + */ class SapiEmitter implements EmitterInterface { use SapiEmitterTrait; @@ -23,19 +24,13 @@ class SapiEmitter implements EmitterInterface * body content via the output buffer. * * @param ResponseInterface $response - * @param null|int $maxBufferLevel Maximum output buffering level to unwrap. */ - public function emit(ResponseInterface $response, $maxBufferLevel = null) + public function emit(ResponseInterface $response) { - if (headers_sent()) { - throw new RuntimeException('Unable to emit response; headers already sent'); - } - - $response = $this->injectContentLength($response); + $this->assertNoPreviousOutput(); - $this->emitStatusLine($response); $this->emitHeaders($response); - $this->flush($maxBufferLevel); + $this->emitStatusLine($response); $this->emitBody($response); } diff --git a/vendor/zendframework/zend-diactoros/src/Response/SapiEmitterTrait.php b/vendor/zendframework/zend-diactoros/src/Response/SapiEmitterTrait.php index 1e1667aed440ff52535527b10515d2a2e827defb..a0c1107bbda67cda487bc81ab6e99d9d8f5011ef 100644 --- a/vendor/zendframework/zend-diactoros/src/Response/SapiEmitterTrait.php +++ b/vendor/zendframework/zend-diactoros/src/Response/SapiEmitterTrait.php @@ -1,35 +1,45 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ namespace Zend\Diactoros\Response; use Psr\Http\Message\ResponseInterface; +use RuntimeException; +use function ob_get_length; +use function ob_get_level; +use function sprintf; +use function str_replace; +use function ucwords; + +/** + * @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner + * now provides this functionality. + */ trait SapiEmitterTrait { /** - * Inject the Content-Length header if is not already present. + * Checks to see if content has previously been sent. * - * @param ResponseInterface $response - * @return ResponseInterface + * If either headers have been sent or the output buffer contains content, + * raises an exception. + * + * @throws RuntimeException if headers have already been sent. + * @throws RuntimeException if output is present in the output buffer. */ - private function injectContentLength(ResponseInterface $response) + private function assertNoPreviousOutput() { - if (! $response->hasHeader('Content-Length')) { - // PSR-7 indicates int OR null for the stream size; for null values, - // we will not auto-inject the Content-Length. - if (null !== $response->getBody()->getSize()) { - return $response->withHeader('Content-Length', (string) $response->getBody()->getSize()); - } + if (headers_sent()) { + throw new RuntimeException('Unable to emit response; headers already sent'); } - return $response; + if (ob_get_level() > 0 && ob_get_length() > 0) { + throw new RuntimeException('Output has been emitted previously; cannot emit response'); + } } /** @@ -38,17 +48,25 @@ private function injectContentLength(ResponseInterface $response) * Emits the status line using the protocol version and status code from * the response; if a reason phrase is available, it, too, is emitted. * + * It is important to mention that this method should be called after + * `emitHeaders()` in order to prevent PHP from changing the status code of + * the emitted response. + * * @param ResponseInterface $response + * + * @see \Zend\Diactoros\Response\SapiEmitterTrait::emitHeaders() */ private function emitStatusLine(ResponseInterface $response) { $reasonPhrase = $response->getReasonPhrase(); + $statusCode = $response->getStatusCode(); + header(sprintf( 'HTTP/%s %d%s', $response->getProtocolVersion(), - $response->getStatusCode(), + $statusCode, ($reasonPhrase ? ' ' . $reasonPhrase : '') - )); + ), true, $statusCode); } /** @@ -63,6 +81,8 @@ private function emitStatusLine(ResponseInterface $response) */ private function emitHeaders(ResponseInterface $response) { + $statusCode = $response->getStatusCode(); + foreach ($response->getHeaders() as $header => $values) { $name = $this->filterHeader($header); $first = $name === 'Set-Cookie' ? false : true; @@ -71,29 +91,12 @@ private function emitHeaders(ResponseInterface $response) '%s: %s', $name, $value - ), $first); + ), $first, $statusCode); $first = false; } } } - /** - * Loops through the output buffer, flushing each, before emitting - * the response. - * - * @param int|null $maxBufferLevel Flush up to this buffer level. - */ - private function flush($maxBufferLevel = null) - { - if (null === $maxBufferLevel) { - $maxBufferLevel = ob_get_level(); - } - - while (ob_get_level() > $maxBufferLevel) { - ob_end_flush(); - } - } - /** * Filter a header name to wordcase * diff --git a/vendor/zendframework/zend-diactoros/src/Response/SapiStreamEmitter.php b/vendor/zendframework/zend-diactoros/src/Response/SapiStreamEmitter.php index 02095e50b41162806cd57fe06b3746eae9d2aeda..9da36ff8439da7bc1c999c3e329cc02ef66652e0 100644 --- a/vendor/zendframework/zend-diactoros/src/Response/SapiStreamEmitter.php +++ b/vendor/zendframework/zend-diactoros/src/Response/SapiStreamEmitter.php @@ -1,18 +1,23 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ namespace Zend\Diactoros\Response; use Psr\Http\Message\ResponseInterface; -use RuntimeException; -use Zend\Diactoros\RelativeStream; +use function is_array; +use function preg_match; +use function strlen; +use function substr; + +/** + * @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner + * now provides this functionality. + */ class SapiStreamEmitter implements EmitterInterface { use SapiEmitterTrait; @@ -28,15 +33,9 @@ class SapiStreamEmitter implements EmitterInterface */ public function emit(ResponseInterface $response, $maxBufferLength = 8192) { - if (headers_sent()) { - throw new RuntimeException('Unable to emit response; headers already sent'); - } - - $response = $this->injectContentLength($response); - - $this->emitStatusLine($response); + $this->assertNoPreviousOutput(); $this->emitHeaders($response); - $this->flush(); + $this->emitStatusLine($response); $range = $this->parseContentRange($response->getHeaderLine('Content-Range')); diff --git a/vendor/zendframework/zend-diactoros/src/Response/Serializer.php b/vendor/zendframework/zend-diactoros/src/Response/Serializer.php index 1d48dc106a79a5abb950ac77920781c67a0a9a1f..918643c6b70f34b13a8e11e4bd0058bf47e44221 100644 --- a/vendor/zendframework/zend-diactoros/src/Response/Serializer.php +++ b/vendor/zendframework/zend-diactoros/src/Response/Serializer.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -17,6 +15,9 @@ use Zend\Diactoros\Response; use Zend\Diactoros\Stream; +use function preg_match; +use function sprintf; + final class Serializer extends AbstractSerializer { /** diff --git a/vendor/zendframework/zend-diactoros/src/Response/TextResponse.php b/vendor/zendframework/zend-diactoros/src/Response/TextResponse.php index 13df29d88e8901d8b0f41dc6e47120aadbb6477c..6ed2a601eef82de3d50bac2d6e6d08dd21a84cb8 100644 --- a/vendor/zendframework/zend-diactoros/src/Response/TextResponse.php +++ b/vendor/zendframework/zend-diactoros/src/Response/TextResponse.php @@ -14,6 +14,12 @@ use Zend\Diactoros\Response; use Zend\Diactoros\Stream; +use function get_class; +use function gettype; +use function is_object; +use function is_string; +use function sprintf; + /** * Plain text response. * diff --git a/vendor/zendframework/zend-diactoros/src/Response/XmlResponse.php b/vendor/zendframework/zend-diactoros/src/Response/XmlResponse.php new file mode 100644 index 0000000000000000000000000000000000000000..5f81e9eeb8377cbc0c35ac5e98866b286518ee27 --- /dev/null +++ b/vendor/zendframework/zend-diactoros/src/Response/XmlResponse.php @@ -0,0 +1,80 @@ +<?php +/** + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) + * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Diactoros\Response; + +use InvalidArgumentException; +use Psr\Http\Message\StreamInterface; +use Zend\Diactoros\Response; +use Zend\Diactoros\Stream; + +use function get_class; +use function gettype; +use function is_object; +use function is_string; +use function sprintf; + +/** + * XML response. + * + * Allows creating a response by passing an XML string to the constructor; by default, + * sets a status code of 200 and sets the Content-Type header to application/xml. + */ +class XmlResponse extends Response +{ + use InjectContentTypeTrait; + + /** + * Create an XML response. + * + * Produces an XML response with a Content-Type of application/xml and a default + * status of 200. + * + * @param string|StreamInterface $xml String or stream for the message body. + * @param int $status Integer status code for the response; 200 by default. + * @param array $headers Array of headers to use at initialization. + * @throws InvalidArgumentException if $text is neither a string or stream. + */ + public function __construct( + $xml, + $status = 200, + array $headers = [] + ) { + parent::__construct( + $this->createBody($xml), + $status, + $this->injectContentType('application/xml; charset=utf-8', $headers) + ); + } + + /** + * Create the message body. + * + * @param string|StreamInterface $xml + * @return StreamInterface + * @throws InvalidArgumentException if $xml is neither a string or stream. + */ + private function createBody($xml) + { + if ($xml instanceof StreamInterface) { + return $xml; + } + + if (! is_string($xml)) { + throw new InvalidArgumentException(sprintf( + 'Invalid content (%s) provided to %s', + (is_object($xml) ? get_class($xml) : gettype($xml)), + __CLASS__ + )); + } + + $body = new Stream('php://temp', 'wb+'); + $body->write($xml); + $body->rewind(); + return $body; + } +} diff --git a/vendor/zendframework/zend-diactoros/src/Server.php b/vendor/zendframework/zend-diactoros/src/Server.php index 768d7f38059145a822af11e2d017a8bbd74080e8..cca3917aa5cee9922584e69521f3ca3e5553226a 100644 --- a/vendor/zendframework/zend-diactoros/src/Server.php +++ b/vendor/zendframework/zend-diactoros/src/Server.php @@ -1,23 +1,26 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ namespace Zend\Diactoros; use OutOfBoundsException; -use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\ServerRequestInterface; + +use function property_exists; /** * "Serve" incoming HTTP requests * * Given a callback, takes an incoming request, dispatches it to the * callback, and then sends a response. + * + * @deprecated since 1.8.0. We recommend using the `RequestHandlerRunner` class + * from the zendframework/zend-httphandlerrunner package instead. */ class Server { @@ -150,24 +153,18 @@ public static function createServerFromRequest( * If provided a $finalHandler, that callable will be used for * incomplete requests. * - * Output buffering is enabled prior to invoking the attached - * callback; any output buffered will be sent prior to any - * response body content. - * * @param null|callable $finalHandler */ public function listen(callable $finalHandler = null) { $callback = $this->callback; - ob_start(); - $bufferLevel = ob_get_level(); - $response = $callback($this->request, $this->response, $finalHandler); if (! $response instanceof ResponseInterface) { $response = $this->response; } - $this->getEmitter()->emit($response, $bufferLevel); + + $this->getEmitter()->emit($response); } /** diff --git a/vendor/zendframework/zend-diactoros/src/ServerRequest.php b/vendor/zendframework/zend-diactoros/src/ServerRequest.php index ecd52b0dfab21871abf4e9725749bcdd04a4e560..8523d59e1a5ea8dd5267d4d6da1cb7d34f60719b 100644 --- a/vendor/zendframework/zend-diactoros/src/ServerRequest.php +++ b/vendor/zendframework/zend-diactoros/src/ServerRequest.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -15,6 +13,9 @@ use Psr\Http\Message\UploadedFileInterface; use Psr\Http\Message\UriInterface; +use function array_key_exists; +use function is_array; + /** * Server-side HTTP request * @@ -179,6 +180,14 @@ public function getParsedBody() */ public function withParsedBody($data) { + if (! is_array($data) && ! is_object($data) && null !== $data) { + throw new InvalidArgumentException(sprintf( + '%s expects a null, array, or object argument; received %s', + __METHOD__, + gettype($data) + )); + } + $new = clone $this; $new->parsedBody = $data; return $new; diff --git a/vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php b/vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php index e2ac59b668ea31561a06c4721f2c200437339aa5..b56a0deee5b7bcd9ce55084a6c55cb5b68472dd6 100644 --- a/vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php +++ b/vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -14,6 +12,16 @@ use stdClass; use UnexpectedValueException; +use function array_change_key_case; +use function array_key_exists; +use function explode; +use function implode; +use function is_array; +use function is_callable; +use function strtolower; + +use const CASE_LOWER; + /** * Class for marshaling a request object from the current PHP environment. * @@ -56,33 +64,35 @@ public static function fromGlobals( array $cookies = null, array $files = null ) { - $server = static::normalizeServer($server ?: $_SERVER); - $files = static::normalizeFiles($files ?: $_FILES); - $headers = static::marshalHeaders($server); + $server = normalizeServer( + $server ?: $_SERVER, + is_callable(self::$apacheRequestHeaders) ? self::$apacheRequestHeaders : null + ); + $files = normalizeUploadedFiles($files ?: $_FILES); + $headers = marshalHeadersFromSapi($server); if (null === $cookies && array_key_exists('cookie', $headers)) { - $cookies = self::parseCookieHeader($headers['cookie']); + $cookies = parseCookieHeader($headers['cookie']); } return new ServerRequest( $server, $files, - static::marshalUriFromServer($server, $headers), - static::get('REQUEST_METHOD', $server, 'GET'), + marshalUriFromSapi($server, $headers), + marshalMethodFromSapi($server), 'php://input', $headers, $cookies ?: $_COOKIE, $query ?: $_GET, $body ?: $_POST, - static::marshalProtocolVersion($server) + marshalProtocolVersionFromSapi($server) ); } /** * Access a value in an array, returning a default value if not found * - * Will also do a case-insensitive search if a case sensitive search fails. - * + * @deprecated since 1.8.0; no longer used internally. * @param string $key * @param array $values * @param mixed $default @@ -106,6 +116,7 @@ public static function get($key, array $values, $default = null) * * If not, the $default is returned. * + * @deprecated since 1.8.0; no longer used internally. * @param string $header * @param array $headers * @param mixed $default @@ -128,31 +139,16 @@ public static function getHeader($header, array $headers, $default = null) * * Pre-processes and returns the $_SERVER superglobal. * + * @deprected since 1.8.0; use Zend\Diactoros\normalizeServer() instead. * @param array $server * @return array */ public static function normalizeServer(array $server) { - // This seems to be the only way to get the Authorization header on Apache - $apacheRequestHeaders = self::$apacheRequestHeaders; - if (isset($server['HTTP_AUTHORIZATION']) - || ! is_callable($apacheRequestHeaders) - ) { - return $server; - } - - $apacheRequestHeaders = $apacheRequestHeaders(); - if (isset($apacheRequestHeaders['Authorization'])) { - $server['HTTP_AUTHORIZATION'] = $apacheRequestHeaders['Authorization']; - return $server; - } - - if (isset($apacheRequestHeaders['authorization'])) { - $server['HTTP_AUTHORIZATION'] = $apacheRequestHeaders['authorization']; - return $server; - } - - return $server; + return normalizeServer( + $server ?: $_SERVER, + is_callable(self::$apacheRequestHeaders) ? self::$apacheRequestHeaders : null + ); } /** @@ -161,159 +157,56 @@ public static function normalizeServer(array $server) * Transforms each value into an UploadedFileInterface instance, and ensures * that nested arrays are normalized. * + * @deprecated since 1.8.0; use \Zend\Diactoros\normalizeUploadedFiles instead. * @param array $files * @return array * @throws InvalidArgumentException for unrecognized values */ public static function normalizeFiles(array $files) { - $normalized = []; - foreach ($files as $key => $value) { - if ($value instanceof UploadedFileInterface) { - $normalized[$key] = $value; - continue; - } - - if (is_array($value) && isset($value['tmp_name'])) { - $normalized[$key] = self::createUploadedFileFromSpec($value); - continue; - } - - if (is_array($value)) { - $normalized[$key] = self::normalizeFiles($value); - continue; - } - - throw new InvalidArgumentException('Invalid value in files specification'); - } - return $normalized; + return normalizeUploadedFiles($files); } /** * Marshal headers from $_SERVER * + * @deprecated since 1.8.0; use Zend\Diactoros\marshalHeadersFromSapi(). * @param array $server * @return array */ public static function marshalHeaders(array $server) { - $headers = []; - foreach ($server as $key => $value) { - // Apache prefixes environment variables with REDIRECT_ - // if they are added by rewrite rules - if (strpos($key, 'REDIRECT_') === 0) { - $key = substr($key, 9); - - // We will not overwrite existing variables with the - // prefixed versions, though - if (array_key_exists($key, $server)) { - continue; - } - } - - if ($value && strpos($key, 'HTTP_') === 0) { - $name = strtr(strtolower(substr($key, 5)), '_', '-'); - $headers[$name] = $value; - continue; - } - - if ($value && strpos($key, 'CONTENT_') === 0) { - $name = 'content-' . strtolower(substr($key, 8)); - $headers[$name] = $value; - continue; - } - } - - return $headers; + return marshalHeadersFromSapi($server); } /** * Marshal the URI from the $_SERVER array and headers * + * @deprecated since 1.8.0; use Zend\Diactoros\marshalUriFromSapi() instead. * @param array $server * @param array $headers * @return Uri */ public static function marshalUriFromServer(array $server, array $headers) { - $uri = new Uri(''); - - // URI scheme - $scheme = 'http'; - $https = self::get('HTTPS', $server); - if (($https && 'off' !== $https) - || self::getHeader('x-forwarded-proto', $headers, false) === 'https' - ) { - $scheme = 'https'; - } - if (! empty($scheme)) { - $uri = $uri->withScheme($scheme); - } - - // Set the host - $accumulator = (object) ['host' => '', 'port' => null]; - self::marshalHostAndPortFromHeaders($accumulator, $server, $headers); - $host = $accumulator->host; - $port = $accumulator->port; - if (! empty($host)) { - $uri = $uri->withHost($host); - if (! empty($port)) { - $uri = $uri->withPort($port); - } - } - - // URI path - $path = self::marshalRequestUri($server); - $path = self::stripQueryString($path); - - // URI query - $query = ''; - if (isset($server['QUERY_STRING'])) { - $query = ltrim($server['QUERY_STRING'], '?'); - } - - // URI fragment - $fragment = ''; - if (strpos($path, '#') !== false) { - list($path, $fragment) = explode('#', $path, 2); - } - - return $uri - ->withPath($path) - ->withFragment($fragment) - ->withQuery($query); + return marshalUriFromSapi($server, $headers); } /** * Marshal the host and port from HTTP headers and/or the PHP environment * + * @deprecated since 1.8.0; use Zend\Diactoros\marshalUriFromSapi() instead, + * and pull the host and port from the Uri instance that function + * returns. * @param stdClass $accumulator * @param array $server * @param array $headers */ public static function marshalHostAndPortFromHeaders(stdClass $accumulator, array $server, array $headers) { - if (self::getHeader('host', $headers, false)) { - self::marshalHostAndPortFromHeader($accumulator, self::getHeader('host', $headers)); - return; - } - - if (! isset($server['SERVER_NAME'])) { - return; - } - - $accumulator->host = $server['SERVER_NAME']; - if (isset($server['SERVER_PORT'])) { - $accumulator->port = (int) $server['SERVER_PORT']; - } - - if (! isset($server['SERVER_ADDR']) || ! preg_match('/^\[[0-9a-fA-F\:]+\]$/', $accumulator->host)) { - return; - } - - // Misinterpreted IPv6-Address - // Reported for Safari on Windows - self::marshalIpv6HostAndPort($accumulator, $server); + $uri = marshalUriFromSapi($server, $headers); + $accumulator->host = $uri->getHost(); + $accumulator->port = $uri->getPort(); } /** @@ -322,201 +215,26 @@ public static function marshalHostAndPortFromHeaders(stdClass $accumulator, arra * Looks at a variety of criteria in order to attempt to autodetect a base * URI, including rewrite URIs, proxy URIs, etc. * - * From ZF2's Zend\Http\PhpEnvironment\Request class - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * + * @deprecated since 1.8.0; use Zend\Diactoros\marshalUriFromSapi() instead, + * and pull the path from the Uri instance that function returns. * @param array $server * @return string */ public static function marshalRequestUri(array $server) { - // IIS7 with URL Rewrite: make sure we get the unencoded url - // (double slash problem). - $iisUrlRewritten = self::get('IIS_WasUrlRewritten', $server); - $unencodedUrl = self::get('UNENCODED_URL', $server, ''); - if ('1' == $iisUrlRewritten && ! empty($unencodedUrl)) { - return $unencodedUrl; - } - - $requestUri = self::get('REQUEST_URI', $server); - - // Check this first so IIS will catch. - $httpXRewriteUrl = self::get('HTTP_X_REWRITE_URL', $server); - if ($httpXRewriteUrl !== null) { - $requestUri = $httpXRewriteUrl; - } - - // Check for IIS 7.0 or later with ISAPI_Rewrite - $httpXOriginalUrl = self::get('HTTP_X_ORIGINAL_URL', $server); - if ($httpXOriginalUrl !== null) { - $requestUri = $httpXOriginalUrl; - } - - if ($requestUri !== null) { - return preg_replace('#^[^/:]+://[^/]+#', '', $requestUri); - } - - $origPathInfo = self::get('ORIG_PATH_INFO', $server); - if (empty($origPathInfo)) { - return '/'; - } - - return $origPathInfo; + $uri = marshalUriFromSapi($server, []); + return $uri->getPath(); } /** * Strip the query string from a path * + * @deprecated since 1.8.0; no longer used internally. * @param mixed $path * @return string */ public static function stripQueryString($path) { - if (($qpos = strpos($path, '?')) !== false) { - return substr($path, 0, $qpos); - } - return $path; - } - - /** - * Marshal the host and port from the request header - * - * @param stdClass $accumulator - * @param string|array $host - * @return void - */ - private static function marshalHostAndPortFromHeader(stdClass $accumulator, $host) - { - if (is_array($host)) { - $host = implode(', ', $host); - } - - $accumulator->host = $host; - $accumulator->port = null; - - // works for regname, IPv4 & IPv6 - if (preg_match('|\:(\d+)$|', $accumulator->host, $matches)) { - $accumulator->host = substr($accumulator->host, 0, -1 * (strlen($matches[1]) + 1)); - $accumulator->port = (int) $matches[1]; - } - } - - /** - * Marshal host/port from misinterpreted IPv6 address - * - * @param stdClass $accumulator - * @param array $server - */ - private static function marshalIpv6HostAndPort(stdClass $accumulator, array $server) - { - $accumulator->host = '[' . $server['SERVER_ADDR'] . ']'; - $accumulator->port = $accumulator->port ?: 80; - if ($accumulator->port . ']' === substr($accumulator->host, strrpos($accumulator->host, ':') + 1)) { - // The last digit of the IPv6-Address has been taken as port - // Unset the port so the default port can be used - $accumulator->port = null; - } - } - - /** - * Create and return an UploadedFile instance from a $_FILES specification. - * - * If the specification represents an array of values, this method will - * delegate to normalizeNestedFileSpec() and return that return value. - * - * @param array $value $_FILES struct - * @return array|UploadedFileInterface - */ - private static function createUploadedFileFromSpec(array $value) - { - if (is_array($value['tmp_name'])) { - return self::normalizeNestedFileSpec($value); - } - - return new UploadedFile( - $value['tmp_name'], - $value['size'], - $value['error'], - $value['name'], - $value['type'] - ); - } - - /** - * Normalize an array of file specifications. - * - * Loops through all nested files and returns a normalized array of - * UploadedFileInterface instances. - * - * @param array $files - * @return UploadedFileInterface[] - */ - private static function normalizeNestedFileSpec(array $files = []) - { - $normalizedFiles = []; - foreach (array_keys($files['tmp_name']) as $key) { - $spec = [ - 'tmp_name' => $files['tmp_name'][$key], - 'size' => $files['size'][$key], - 'error' => $files['error'][$key], - 'name' => $files['name'][$key], - 'type' => $files['type'][$key], - ]; - $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); - } - return $normalizedFiles; - } - - /** - * Return HTTP protocol version (X.Y) - * - * @param array $server - * @return string - */ - private static function marshalProtocolVersion(array $server) - { - if (! isset($server['SERVER_PROTOCOL'])) { - return '1.1'; - } - - if (! preg_match('#^(HTTP/)?(?P<version>[1-9]\d*(?:\.\d)?)$#', $server['SERVER_PROTOCOL'], $matches)) { - throw new UnexpectedValueException(sprintf( - 'Unrecognized protocol version (%s)', - $server['SERVER_PROTOCOL'] - )); - } - - return $matches['version']; - } - - /** - * Parse a cookie header according to RFC 6265. - * - * PHP will replace special characters in cookie names, which results in other cookies not being available due to - * overwriting. Thus, the server request should take the cookies from the request header instead. - * - * @param $cookieHeader - * @return array - */ - private static function parseCookieHeader($cookieHeader) - { - preg_match_all('( - (?:^\\n?[ \t]*|;[ ]) - (?P<name>[!#$%&\'*+-.0-9A-Z^_`a-z|~]+) - = - (?P<DQUOTE>"?) - (?P<value>[\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]*) - (?P=DQUOTE) - (?=\\n?[ \t]*$|;[ ]) - )x', $cookieHeader, $matches, PREG_SET_ORDER); - - $cookies = []; - - foreach ($matches as $match) { - $cookies[$match['name']] = urldecode($match['value']); - } - - return $cookies; + return explode('?', $path, 2)[0]; } } diff --git a/vendor/zendframework/zend-diactoros/src/Stream.php b/vendor/zendframework/zend-diactoros/src/Stream.php index f9aaa4166b56fcd8e028e27922d7f175012d8aee..20ee0577a132701bc9ab4f3229398026b6d553fb 100644 --- a/vendor/zendframework/zend-diactoros/src/Stream.php +++ b/vendor/zendframework/zend-diactoros/src/Stream.php @@ -1,17 +1,37 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ namespace Zend\Diactoros; use InvalidArgumentException; -use RuntimeException; use Psr\Http\Message\StreamInterface; +use RuntimeException; + +use function array_key_exists; +use function fclose; +use function feof; +use function fopen; +use function fread; +use function fseek; +use function fstat; +use function ftell; +use function fwrite; +use function get_resource_type; +use function is_int; +use function is_resource; +use function is_string; +use function restore_error_handler; +use function set_error_handler; +use function stream_get_contents; +use function stream_get_meta_data; +use function strstr; + +use const E_WARNING; +use const SEEK_SET; /** * Implementation of PSR HTTP streams @@ -105,7 +125,11 @@ public function getSize() } $stats = fstat($this->resource); - return $stats['size']; + if ($stats !== false) { + return $stats['size']; + } + + return null; } /** @@ -306,8 +330,12 @@ private function setStream($stream, $mode = 'r') if (is_string($stream)) { set_error_handler(function ($e) use (&$error) { + if ($e !== E_WARNING) { + return; + } + $error = $e; - }, E_WARNING); + }); $resource = fopen($stream, $mode); restore_error_handler(); } diff --git a/vendor/zendframework/zend-diactoros/src/UploadedFile.php b/vendor/zendframework/zend-diactoros/src/UploadedFile.php index 767724b8a9a9174a340facf8c5db3003a525b7c2..c260b0c13c21eba22d43fd5e5029cffb3f2ad1e8 100644 --- a/vendor/zendframework/zend-diactoros/src/UploadedFile.php +++ b/vendor/zendframework/zend-diactoros/src/UploadedFile.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -14,15 +12,50 @@ use Psr\Http\Message\UploadedFileInterface; use RuntimeException; +use function dirname; +use function fclose; +use function fopen; +use function fwrite; +use function is_dir; +use function is_int; +use function is_resource; +use function is_string; +use function is_writable; +use function move_uploaded_file; +use function sprintf; +use function strpos; + +use const PHP_SAPI; +use const UPLOAD_ERR_CANT_WRITE; +use const UPLOAD_ERR_EXTENSION; +use const UPLOAD_ERR_FORM_SIZE; +use const UPLOAD_ERR_INI_SIZE; +use const UPLOAD_ERR_NO_FILE; +use const UPLOAD_ERR_NO_TMP_DIR; +use const UPLOAD_ERR_OK; +use const UPLOAD_ERR_PARTIAL; + class UploadedFile implements UploadedFileInterface { + const ERROR_MESSAGES = [ + UPLOAD_ERR_OK => 'There is no error, the file uploaded with success', + UPLOAD_ERR_INI_SIZE => 'The uploaded file exceeds the upload_max_filesize directive in php.ini', + UPLOAD_ERR_FORM_SIZE => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was ' + . 'specified in the HTML form', + UPLOAD_ERR_PARTIAL => 'The uploaded file was only partially uploaded', + UPLOAD_ERR_NO_FILE => 'No file was uploaded', + UPLOAD_ERR_NO_TMP_DIR => 'Missing a temporary folder', + UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk', + UPLOAD_ERR_EXTENSION => 'A PHP extension stopped the file upload.', + ]; + /** - * @var string + * @var string|null */ private $clientFilename; /** - * @var string + * @var string|null */ private $clientMediaType; @@ -114,7 +147,10 @@ public function __construct($streamOrFile, $size, $errorStatus, $clientFilename public function getStream() { if ($this->error !== UPLOAD_ERR_OK) { - throw new RuntimeException('Cannot retrieve stream due to upload error'); + throw new RuntimeException(sprintf( + 'Cannot retrieve stream due to upload error: %s', + self::ERROR_MESSAGES[$this->error] + )); } if ($this->moved) { @@ -147,7 +183,10 @@ public function moveTo($targetPath) } if ($this->error !== UPLOAD_ERR_OK) { - throw new RuntimeException('Cannot retrieve stream due to upload error'); + throw new RuntimeException(sprintf( + 'Cannot retrieve stream due to upload error: %s', + self::ERROR_MESSAGES[$this->error] + )); } if (! is_string($targetPath) || empty($targetPath)) { diff --git a/vendor/zendframework/zend-diactoros/src/Uri.php b/vendor/zendframework/zend-diactoros/src/Uri.php index 0db8ca18b4e1e20211bfbd0f64941c4d71e4f0c1..5dcfb0e235253f4e17f6f78422a24ae4bf77618b 100644 --- a/vendor/zendframework/zend-diactoros/src/Uri.php +++ b/vendor/zendframework/zend-diactoros/src/Uri.php @@ -1,9 +1,7 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License */ @@ -12,6 +10,26 @@ use InvalidArgumentException; use Psr\Http\Message\UriInterface; +use function array_key_exists; +use function array_keys; +use function count; +use function explode; +use function get_class; +use function gettype; +use function implode; +use function is_numeric; +use function is_object; +use function is_string; +use function ltrim; +use function parse_url; +use function preg_replace; +use function preg_replace_callback; +use function rawurlencode; +use function sprintf; +use function strpos; +use function strtolower; +use function substr; + /** * Implementation of Psr\Http\UriInterface. * @@ -25,14 +43,14 @@ class Uri implements UriInterface { /** - * Sub-delimiters used in query strings and fragments. + * Sub-delimiters used in user info, query strings and fragments. * * @const string */ const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;='; /** - * Unreserved characters used in paths, query strings, and fragments. + * Unreserved characters used in user info, paths, query strings, and fragments. * * @const string */ @@ -93,16 +111,18 @@ class Uri implements UriInterface */ public function __construct($uri = '') { + if ('' === $uri) { + return; + } + if (! is_string($uri)) { throw new InvalidArgumentException(sprintf( 'URI passed to constructor must be a string; received "%s"', - (is_object($uri) ? get_class($uri) : gettype($uri)) + is_object($uri) ? get_class($uri) : gettype($uri) )); } - if (! empty($uri)) { - $this->parseUri($uri); - } + $this->parseUri($uri); } /** @@ -149,12 +169,12 @@ public function getScheme() */ public function getAuthority() { - if (empty($this->host)) { + if ('' === $this->host) { return ''; } $authority = $this->host; - if (! empty($this->userInfo)) { + if ('' !== $this->userInfo) { $authority = $this->userInfo . '@' . $authority; } @@ -166,6 +186,10 @@ public function getAuthority() } /** + * Retrieve the user-info part of the URI. + * + * This value is percent-encoded, per RFC 3986 Section 3.2.1. + * * {@inheritdoc} */ public function getUserInfo() @@ -224,7 +248,7 @@ public function withScheme($scheme) throw new InvalidArgumentException(sprintf( '%s expects a string argument; received %s', __METHOD__, - (is_object($scheme) ? get_class($scheme) : gettype($scheme)) + is_object($scheme) ? get_class($scheme) : gettype($scheme) )); } @@ -232,7 +256,7 @@ public function withScheme($scheme) if ($scheme === $this->scheme) { // Do nothing if no change was made. - return clone $this; + return $this; } $new = clone $this; @@ -242,6 +266,11 @@ public function withScheme($scheme) } /** + * Create and return a new instance containing the provided user credentials. + * + * The value will be percent-encoded in the new instance, but with measures + * taken to prevent double-encoding. + * * {@inheritdoc} */ public function withUserInfo($user, $password = null) @@ -250,25 +279,25 @@ public function withUserInfo($user, $password = null) throw new InvalidArgumentException(sprintf( '%s expects a string user argument; received %s', __METHOD__, - (is_object($user) ? get_class($user) : gettype($user)) + is_object($user) ? get_class($user) : gettype($user) )); } if (null !== $password && ! is_string($password)) { throw new InvalidArgumentException(sprintf( - '%s expects a string password argument; received %s', + '%s expects a string or null password argument; received %s', __METHOD__, - (is_object($password) ? get_class($password) : gettype($password)) + is_object($password) ? get_class($password) : gettype($password) )); } - $info = $user; - if ($password) { - $info .= ':' . $password; + $info = $this->filterUserInfoPart($user); + if (null !== $password) { + $info .= ':' . $this->filterUserInfoPart($password); } if ($info === $this->userInfo) { // Do nothing if no change was made. - return clone $this; + return $this; } $new = clone $this; @@ -286,17 +315,17 @@ public function withHost($host) throw new InvalidArgumentException(sprintf( '%s expects a string argument; received %s', __METHOD__, - (is_object($host) ? get_class($host) : gettype($host)) + is_object($host) ? get_class($host) : gettype($host) )); } if ($host === $this->host) { // Do nothing if no change was made. - return clone $this; + return $this; } $new = clone $this; - $new->host = $host; + $new->host = strtolower($host); return $new; } @@ -306,23 +335,23 @@ public function withHost($host) */ public function withPort($port) { - if (! is_numeric($port) && $port !== null) { - throw new InvalidArgumentException(sprintf( - 'Invalid port "%s" specified; must be an integer, an integer string, or null', - (is_object($port) ? get_class($port) : gettype($port)) - )); - } - if ($port !== null) { + if (! is_numeric($port) || is_float($port)) { + throw new InvalidArgumentException(sprintf( + 'Invalid port "%s" specified; must be an integer, an integer string, or null', + is_object($port) ? get_class($port) : gettype($port) + )); + } + $port = (int) $port; } if ($port === $this->port) { // Do nothing if no change was made. - return clone $this; + return $this; } - if ($port !== null && $port < 1 || $port > 65535) { + if ($port !== null && ($port < 1 || $port > 65535)) { throw new InvalidArgumentException(sprintf( 'Invalid port "%d" specified; must be a valid TCP/UDP port', $port @@ -362,7 +391,7 @@ public function withPath($path) if ($path === $this->path) { // Do nothing if no change was made. - return clone $this; + return $this; } $new = clone $this; @@ -392,7 +421,7 @@ public function withQuery($query) if ($query === $this->query) { // Do nothing if no change was made. - return clone $this; + return $this; } $new = clone $this; @@ -410,7 +439,7 @@ public function withFragment($fragment) throw new InvalidArgumentException(sprintf( '%s expects a string argument; received %s', __METHOD__, - (is_object($fragment) ? get_class($fragment) : gettype($fragment)) + is_object($fragment) ? get_class($fragment) : gettype($fragment) )); } @@ -418,7 +447,7 @@ public function withFragment($fragment) if ($fragment === $this->fragment) { // Do nothing if no change was made. - return clone $this; + return $this; } $new = clone $this; @@ -443,8 +472,8 @@ private function parseUri($uri) } $this->scheme = isset($parts['scheme']) ? $this->filterScheme($parts['scheme']) : ''; - $this->userInfo = isset($parts['user']) ? $parts['user'] : ''; - $this->host = isset($parts['host']) ? $parts['host'] : ''; + $this->userInfo = isset($parts['user']) ? $this->filterUserInfoPart($parts['user']) : ''; + $this->host = isset($parts['host']) ? strtolower($parts['host']) : ''; $this->port = isset($parts['port']) ? $parts['port'] : null; $this->path = isset($parts['path']) ? $this->filterPath($parts['path']) : ''; $this->query = isset($parts['query']) ? $this->filterQuery($parts['query']) : ''; @@ -469,27 +498,26 @@ private static function createUriString($scheme, $authority, $path, $query, $fra { $uri = ''; - if (! empty($scheme)) { + if ('' !== $scheme) { $uri .= sprintf('%s:', $scheme); } - if (! empty($authority)) { + if ('' !== $authority) { $uri .= '//' . $authority; } - if ($path) { - if (empty($path) || '/' !== substr($path, 0, 1)) { - $path = '/' . $path; - } - - $uri .= $path; + if ('' !== $path && '/' !== substr($path, 0, 1)) { + $path = '/' . $path; } - if ($query) { + $uri .= $path; + + + if ('' !== $query) { $uri .= sprintf('?%s', $query); } - if ($fragment) { + if ('' !== $fragment) { $uri .= sprintf('#%s', $fragment); } @@ -506,14 +534,11 @@ private static function createUriString($scheme, $authority, $path, $query, $fra */ private function isNonStandardPort($scheme, $host, $port) { - if (! $scheme) { - if ($host && ! $port) { - return false; - } - return true; + if ('' === $scheme) { + return '' === $host || null !== $port; } - if (! $host || ! $port) { + if ('' === $host || null === $port) { return false; } @@ -532,11 +557,11 @@ private function filterScheme($scheme) $scheme = strtolower($scheme); $scheme = preg_replace('#:(//)?$#', '', $scheme); - if (empty($scheme)) { + if ('' === $scheme) { return ''; } - if (! array_key_exists($scheme, $this->allowedSchemes)) { + if (! isset($this->allowedSchemes[$scheme])) { throw new InvalidArgumentException(sprintf( 'Unsupported scheme "%s"; must be any empty string or in the set (%s)', $scheme, @@ -547,6 +572,23 @@ private function filterScheme($scheme) return $scheme; } + /** + * Filters a part of user info in a URI to ensure it is properly encoded. + * + * @param string $part + * @return string + */ + private function filterUserInfoPart($part) + { + // Note the addition of `%` to initial charset; this allows `|` portion + // to match and thus prevent double-encoding. + return preg_replace_callback( + '/(?:[^%' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ']+|%(?![A-Fa-f0-9]{2}))/u', + [$this, 'urlEncodeChar'], + $part + ); + } + /** * Filters the path of a URI to ensure it is properly encoded. * @@ -561,7 +603,7 @@ private function filterPath($path) $path ); - if (empty($path)) { + if ('' === $path) { // No path return $path; } @@ -585,7 +627,7 @@ private function filterPath($path) */ private function filterQuery($query) { - if (! empty($query) && strpos($query, '?') === 0) { + if ('' !== $query && strpos($query, '?') === 0) { $query = substr($query, 1); } @@ -615,7 +657,7 @@ private function filterQuery($query) private function splitQueryValue($value) { $data = explode('=', $value, 2); - if (1 === count($data)) { + if (! isset($data[1])) { $data[] = null; } return $data; @@ -624,12 +666,12 @@ private function splitQueryValue($value) /** * Filter a fragment value to ensure it is properly encoded. * - * @param null|string $fragment + * @param string $fragment * @return string */ private function filterFragment($fragment) { - if (! empty($fragment) && strpos($fragment, '#') === 0) { + if ('' !== $fragment && strpos($fragment, '#') === 0) { $fragment = '%23' . substr($fragment, 1); } diff --git a/vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php b/vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php new file mode 100644 index 0000000000000000000000000000000000000000..7b41a425e5368c824b6d6dc364b08ba3f7f342f9 --- /dev/null +++ b/vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php @@ -0,0 +1,40 @@ +<?php +/** + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Diactoros; + +use InvalidArgumentException; + +/** + * Create an uploaded file instance from an array of values. + * + * @param array $spec A single $_FILES entry. + * @return UploadedFile + * @throws InvalidArgumentException if one or more of the tmp_name, size, + * or error keys are missing from $spec. + */ +function createUploadedFile(array $spec) +{ + if (! isset($spec['tmp_name']) + || ! isset($spec['size']) + || ! isset($spec['error']) + ) { + throw new InvalidArgumentException(sprintf( + '$spec provided to %s MUST contain each of the keys "tmp_name",' + . ' "size", and "error"; one or more were missing', + __FUNCTION__ + )); + } + + return new UploadedFile( + $spec['tmp_name'], + $spec['size'], + $spec['error'], + isset($spec['name']) ? $spec['name'] : null, + isset($spec['type']) ? $spec['type'] : null + ); +} diff --git a/vendor/zendframework/zend-diactoros/src/functions/marshal_headers_from_sapi.php b/vendor/zendframework/zend-diactoros/src/functions/marshal_headers_from_sapi.php new file mode 100644 index 0000000000000000000000000000000000000000..abb75afedeefd86a9d124b3d2c0b49590611639d --- /dev/null +++ b/vendor/zendframework/zend-diactoros/src/functions/marshal_headers_from_sapi.php @@ -0,0 +1,50 @@ +<?php +/** + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Diactoros; + +use function array_key_exists; +use function strpos; +use function strtolower; +use function strtr; +use function substr; + +/** + * @param array $server Values obtained from the SAPI (generally `$_SERVER`). + * @return array Header/value pairs + */ +function marshalHeadersFromSapi(array $server) +{ + $headers = []; + foreach ($server as $key => $value) { + // Apache prefixes environment variables with REDIRECT_ + // if they are added by rewrite rules + if (strpos($key, 'REDIRECT_') === 0) { + $key = substr($key, 9); + + // We will not overwrite existing variables with the + // prefixed versions, though + if (array_key_exists($key, $server)) { + continue; + } + } + + if ($value && strpos($key, 'HTTP_') === 0) { + $name = strtr(strtolower(substr($key, 5)), '_', '-'); + $headers[$name] = $value; + continue; + } + + if ($value && strpos($key, 'CONTENT_') === 0) { + $name = 'content-' . strtolower(substr($key, 8)); + $headers[$name] = $value; + continue; + } + } + + return $headers; +} diff --git a/vendor/zendframework/zend-diactoros/src/functions/marshal_method_from_sapi.php b/vendor/zendframework/zend-diactoros/src/functions/marshal_method_from_sapi.php new file mode 100644 index 0000000000000000000000000000000000000000..c666e4e0abb6312a405b9dd74153d9955250bc80 --- /dev/null +++ b/vendor/zendframework/zend-diactoros/src/functions/marshal_method_from_sapi.php @@ -0,0 +1,19 @@ +<?php +/** + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Diactoros; + +/** + * Retrieve the request method from the SAPI parameters. + * + * @param array $server + * @return string + */ +function marshalMethodFromSapi(array $server) +{ + return isset($server['REQUEST_METHOD']) ? $server['REQUEST_METHOD'] : 'GET'; +} diff --git a/vendor/zendframework/zend-diactoros/src/functions/marshal_protocol_version_from_sapi.php b/vendor/zendframework/zend-diactoros/src/functions/marshal_protocol_version_from_sapi.php new file mode 100644 index 0000000000000000000000000000000000000000..915b6da2873bb8e57c4f0f0928dd11b3026d65fe --- /dev/null +++ b/vendor/zendframework/zend-diactoros/src/functions/marshal_protocol_version_from_sapi.php @@ -0,0 +1,36 @@ +<?php +/** + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Diactoros; + +use UnexpectedValueException; + +use function preg_match; + +/** + * Return HTTP protocol version (X.Y) as discovered within a `$_SERVER` array. + * + * @param array $server + * @return string + * @throws UnexpectedValueException if the $server['SERVER_PROTOCOL'] value is + * malformed. + */ +function marshalProtocolVersionFromSapi(array $server) +{ + if (! isset($server['SERVER_PROTOCOL'])) { + return '1.1'; + } + + if (! preg_match('#^(HTTP/)?(?P<version>[1-9]\d*(?:\.\d)?)$#', $server['SERVER_PROTOCOL'], $matches)) { + throw new UnexpectedValueException(sprintf( + 'Unrecognized protocol version (%s)', + $server['SERVER_PROTOCOL'] + )); + } + + return $matches['version']; +} diff --git a/vendor/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php b/vendor/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php new file mode 100644 index 0000000000000000000000000000000000000000..decaafb835b55cb5abe83374f73919fee1e9d15f --- /dev/null +++ b/vendor/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php @@ -0,0 +1,212 @@ +<?php +/** + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Diactoros; + +use function array_change_key_case; +use function array_key_exists; +use function explode; +use function implode; +use function is_array; +use function ltrim; +use function preg_match; +use function preg_replace; +use function strlen; +use function strpos; +use function strtolower; +use function substr; + +/** + * Marshal a Uri instance based on the values presnt in the $_SERVER array and headers. + * + * @param array $server SAPI parameters + * @param array $headers HTTP request headers + * @return Uri + */ +function marshalUriFromSapi(array $server, array $headers) +{ + /** + * Retrieve a header value from an array of headers using a case-insensitive lookup. + * + * @param string $name + * @param array $headers Key/value header pairs + * @param mixed $default Default value to return if header not found + * @return mixed + */ + $getHeaderFromArray = function ($name, array $headers, $default = null) { + $header = strtolower($name); + $headers = array_change_key_case($headers, CASE_LOWER); + if (array_key_exists($header, $headers)) { + $value = is_array($headers[$header]) ? implode(', ', $headers[$header]) : $headers[$header]; + return $value; + } + + return $default; + }; + + /** + * Marshal the host and port from HTTP headers and/or the PHP environment. + * + * @param array $headers + * @param array $server + * @return array Array of two items, host and port, in that order (can be + * passed to a list() operation). + */ + $marshalHostAndPort = function (array $headers, array $server) use ($getHeaderFromArray) { + /** + * @param string|array $host + * @return array Array of two items, host and port, in that order (can be + * passed to a list() operation). + */ + $marshalHostAndPortFromHeader = function ($host) { + if (is_array($host)) { + $host = implode(', ', $host); + } + + $port = null; + + // works for regname, IPv4 & IPv6 + if (preg_match('|\:(\d+)$|', $host, $matches)) { + $host = substr($host, 0, -1 * (strlen($matches[1]) + 1)); + $port = (int) $matches[1]; + } + + return [$host, $port]; + }; + + /** + * @param array $server + * @param string $host + * @param null|int $port + * @return array Array of two items, host and port, in that order (can be + * passed to a list() operation). + */ + $marshalIpv6HostAndPort = function (array $server, $host, $port) { + $host = '[' . $server['SERVER_ADDR'] . ']'; + $port = $port ?: 80; + if ($port . ']' === substr($host, strrpos($host, ':') + 1)) { + // The last digit of the IPv6-Address has been taken as port + // Unset the port so the default port can be used + $port = null; + } + return [$host, $port]; + }; + + static $defaults = ['', null]; + + if ($getHeaderFromArray('host', $headers, false)) { + return $marshalHostAndPortFromHeader($getHeaderFromArray('host', $headers)); + } + + if (! isset($server['SERVER_NAME'])) { + return $defaults; + } + + $host = $server['SERVER_NAME']; + $port = isset($server['SERVER_PORT']) ? (int) $server['SERVER_PORT'] : null; + + if (! isset($server['SERVER_ADDR']) + || ! preg_match('/^\[[0-9a-fA-F\:]+\]$/', $host) + ) { + return [$host, $port]; + } + + // Misinterpreted IPv6-Address + // Reported for Safari on Windows + return $marshalIpv6HostAndPort($server, $host, $port); + }; + + /** + * Detect the path for the request + * + * Looks at a variety of criteria in order to attempt to autodetect the base + * request path, including: + * + * - IIS7 UrlRewrite environment + * - REQUEST_URI + * - ORIG_PATH_INFO + * + * From ZF2's Zend\Http\PhpEnvironment\Request class + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * + * @param array $server SAPI environment array (typically `$_SERVER`) + * @return string Discovered path + */ + $marshalRequestPath = function (array $server) { + // IIS7 with URL Rewrite: make sure we get the unencoded url + // (double slash problem). + $iisUrlRewritten = array_key_exists('IIS_WasUrlRewritten', $server) ? $server['IIS_WasUrlRewritten'] : null; + $unencodedUrl = array_key_exists('UNENCODED_URL', $server) ? $server['UNENCODED_URL'] : ''; + if ('1' === $iisUrlRewritten && ! empty($unencodedUrl)) { + return $unencodedUrl; + } + + $requestUri = array_key_exists('REQUEST_URI', $server) ? $server['REQUEST_URI'] : null; + + if ($requestUri !== null) { + return preg_replace('#^[^/:]+://[^/]+#', '', $requestUri); + } + + $origPathInfo = array_key_exists('ORIG_PATH_INFO', $server) ? $server['ORIG_PATH_INFO'] : null; + if (empty($origPathInfo)) { + return '/'; + } + + return $origPathInfo; + }; + + $uri = new Uri(''); + + // URI scheme + $scheme = 'http'; + if (array_key_exists('HTTPS', $server)) { + $https = $server['HTTPS']; + } elseif (array_key_exists('https', $server)) { + $https = $server['https']; + } else { + $https = false; + } + if (($https && 'off' !== strtolower($https)) + || strtolower($getHeaderFromArray('x-forwarded-proto', $headers, false)) === 'https' + ) { + $scheme = 'https'; + } + $uri = $uri->withScheme($scheme); + + // Set the host + list($host, $port) = $marshalHostAndPort($headers, $server); + if (! empty($host)) { + $uri = $uri->withHost($host); + if (! empty($port)) { + $uri = $uri->withPort($port); + } + } + + // URI path + $path = $marshalRequestPath($server); + + // Strip query string + $path = explode('?', $path, 2)[0]; + + // URI query + $query = ''; + if (isset($server['QUERY_STRING'])) { + $query = ltrim($server['QUERY_STRING'], '?'); + } + + // URI fragment + $fragment = ''; + if (strpos($path, '#') !== false) { + list($path, $fragment) = explode('#', $path, 2); + } + + return $uri + ->withPath($path) + ->withFragment($fragment) + ->withQuery($query); +} diff --git a/vendor/zendframework/zend-diactoros/src/functions/normalize_server.php b/vendor/zendframework/zend-diactoros/src/functions/normalize_server.php new file mode 100644 index 0000000000000000000000000000000000000000..2db4a4a0103facc62a8cde50b2cbdd2ee81a3dc2 --- /dev/null +++ b/vendor/zendframework/zend-diactoros/src/functions/normalize_server.php @@ -0,0 +1,51 @@ +<?php +/** + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Diactoros; + +use function is_callable; + +/** + * Marshal the $_SERVER array + * + * Pre-processes and returns the $_SERVER superglobal. In particularly, it + * attempts to detect the Authorization header, which is often not aggregated + * correctly under various SAPI/httpd combinations. + * + * @param array $server + * @param null|callable $apacheRequestHeaderCallback Callback that can be used to + * retrieve Apache request headers. This defaults to + * `apache_request_headers` under the Apache mod_php. + * @return array Either $server verbatim, or with an added HTTP_AUTHORIZATION header. + */ +function normalizeServer(array $server, callable $apacheRequestHeaderCallback = null) +{ + if (null === $apacheRequestHeaderCallback && is_callable('apache_request_headers')) { + $apacheRequestHeaderCallback = 'apache_request_headers'; + } + + // If the HTTP_AUTHORIZATION value is already set, or the callback is not + // callable, we return verbatim + if (isset($server['HTTP_AUTHORIZATION']) + || ! is_callable($apacheRequestHeaderCallback) + ) { + return $server; + } + + $apacheRequestHeaders = $apacheRequestHeaderCallback(); + if (isset($apacheRequestHeaders['Authorization'])) { + $server['HTTP_AUTHORIZATION'] = $apacheRequestHeaders['Authorization']; + return $server; + } + + if (isset($apacheRequestHeaders['authorization'])) { + $server['HTTP_AUTHORIZATION'] = $apacheRequestHeaders['authorization']; + return $server; + } + + return $server; +} diff --git a/vendor/zendframework/zend-diactoros/src/functions/normalize_uploaded_files.php b/vendor/zendframework/zend-diactoros/src/functions/normalize_uploaded_files.php new file mode 100644 index 0000000000000000000000000000000000000000..fb33500593648852211d25b58128f73df61e8e68 --- /dev/null +++ b/vendor/zendframework/zend-diactoros/src/functions/normalize_uploaded_files.php @@ -0,0 +1,129 @@ +<?php +/** + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Diactoros; + +use InvalidArgumentException; +use Psr\Http\Message\UploadedFileInterface; + +use function is_array; + +/** + * Normalize uploaded files + * + * Transforms each value into an UploadedFile instance, and ensures that nested + * arrays are normalized. + * + * @param array $files + * @return UploadedFileInterface[] + * @throws InvalidArgumentException for unrecognized values + */ +function normalizeUploadedFiles(array $files) +{ + /** + * Traverse a nested tree of uploaded file specifications. + * + * @param string[]|array[] $tmpNameTree + * @param int[]|array[] $sizeTree + * @param int[]|array[] $errorTree + * @param string[]|array[]|null $nameTree + * @param string[]|array[]|null $typeTree + * @return UploadedFile[]|array[] + */ + $recursiveNormalize = function ( + array $tmpNameTree, + array $sizeTree, + array $errorTree, + array $nameTree = null, + array $typeTree = null + ) use (&$recursiveNormalize) { + $normalized = []; + foreach ($tmpNameTree as $key => $value) { + if (is_array($value)) { + // Traverse + $normalized[$key] = $recursiveNormalize( + $tmpNameTree[$key], + $sizeTree[$key], + $errorTree[$key], + isset($nameTree[$key]) ? $nameTree[$key] : null, + isset($typeTree[$key]) ? $typeTree[$key] : null + ); + continue; + } + $normalized[$key] = createUploadedFile([ + 'tmp_name' => $tmpNameTree[$key], + 'size' => $sizeTree[$key], + 'error' => $errorTree[$key], + 'name' => isset($nameTree[$key]) ? $nameTree[$key] : null, + 'type' => isset($typeTree[$key]) ? $typeTree[$key] : null + ]); + } + return $normalized; + }; + + /** + * Normalize an array of file specifications. + * + * Loops through all nested files (as determined by receiving an array to the + * `tmp_name` key of a `$_FILES` specification) and returns a normalized array + * of UploadedFile instances. + * + * This function normalizes a `$_FILES` array representing a nested set of + * uploaded files as produced by the php-fpm SAPI, CGI SAPI, or mod_php + * SAPI. + * + * @param array $files + * @return UploadedFile[] + */ + $normalizeUploadedFileSpecification = function (array $files = []) use (&$recursiveNormalize) { + if (! isset($files['tmp_name']) || ! is_array($files['tmp_name']) + || ! isset($files['size']) || ! is_array($files['size']) + || ! isset($files['error']) || ! is_array($files['error']) + ) { + throw new InvalidArgumentException(sprintf( + '$files provided to %s MUST contain each of the keys "tmp_name",' + . ' "size", and "error", with each represented as an array;' + . ' one or more were missing or non-array values', + __FUNCTION__ + )); + } + + return $recursiveNormalize( + $files['tmp_name'], + $files['size'], + $files['error'], + isset($files['name']) ? $files['name'] : null, + isset($files['type']) ? $files['type'] : null + ); + }; + + $normalized = []; + foreach ($files as $key => $value) { + if ($value instanceof UploadedFileInterface) { + $normalized[$key] = $value; + continue; + } + + if (is_array($value) && isset($value['tmp_name']) && is_array($value['tmp_name'])) { + $normalized[$key] = $normalizeUploadedFileSpecification($value); + continue; + } + + if (is_array($value) && isset($value['tmp_name'])) { + $normalized[$key] = createUploadedFile($value); + continue; + } + + if (is_array($value)) { + $normalized[$key] = normalizeUploadedFiles($value); + continue; + } + + throw new InvalidArgumentException('Invalid value in files specification'); + } + return $normalized; +} diff --git a/vendor/zendframework/zend-diactoros/src/functions/parse_cookie_header.php b/vendor/zendframework/zend-diactoros/src/functions/parse_cookie_header.php new file mode 100644 index 0000000000000000000000000000000000000000..b3b565147f2c4810f6f7f9cf572a6e98dac375a5 --- /dev/null +++ b/vendor/zendframework/zend-diactoros/src/functions/parse_cookie_header.php @@ -0,0 +1,41 @@ +<?php +/** + * @see https://github.com/zendframework/zend-diactoros for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Diactoros; + +use function preg_match_all; +use function urldecode; + +/** + * Parse a cookie header according to RFC 6265. + * + * PHP will replace special characters in cookie names, which results in other cookies not being available due to + * overwriting. Thus, the server request should take the cookies from the request header instead. + * + * @param string $cookieHeader A string cookie header value. + * @return array key/value cookie pairs. + */ +function parseCookieHeader($cookieHeader) +{ + preg_match_all('( + (?:^\\n?[ \t]*|;[ ]) + (?P<name>[!#$%&\'*+-.0-9A-Z^_`a-z|~]+) + = + (?P<DQUOTE>"?) + (?P<value>[\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]*) + (?P=DQUOTE) + (?=\\n?[ \t]*$|;[ ]) + )x', $cookieHeader, $matches, PREG_SET_ORDER); + + $cookies = []; + + foreach ($matches as $match) { + $cookies[$match['name']] = urldecode($match['value']); + } + + return $cookies; +} diff --git a/vendor/zendframework/zend-escaper/CHANGELOG.md b/vendor/zendframework/zend-escaper/CHANGELOG.md index de6a08b3e1210fcaf8db9f51c958ec78137eeb7e..aa99334989940b21ab88492fe64c26a235f826df 100644 --- a/vendor/zendframework/zend-escaper/CHANGELOG.md +++ b/vendor/zendframework/zend-escaper/CHANGELOG.md @@ -2,6 +2,31 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. +## 2.6.0 - 2018-04-25 + +### Added + +- [#28](https://github.com/zendframework/zend-escaper/pull/28) adds support for PHP 7.1 and 7.2. + +### Changed + +- [#25](https://github.com/zendframework/zend-escaper/pull/25) changes the behavior of the `Escaper` constructor; it now raises an + exception for non-null, non-string `$encoding` arguments. + +### Deprecated + +- Nothing. + +### Removed + +- [#28](https://github.com/zendframework/zend-escaper/pull/28) removes support for PHP 5.5. + +- [#28](https://github.com/zendframework/zend-escaper/pull/28) removes support for HHVM. + +### Fixed + +- Nothing. + ## 2.5.2 - 2016-06-30 ### Added diff --git a/vendor/zendframework/zend-escaper/CONDUCT.md b/vendor/zendframework/zend-escaper/CONDUCT.md deleted file mode 100644 index c663d2be9302139a32da7386de101ecae97b185b..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/CONDUCT.md +++ /dev/null @@ -1,43 +0,0 @@ -# Contributor Code of Conduct - -The Zend Framework project adheres to [The Code Manifesto](http://codemanifesto.com) -as its guidelines for contributor interactions. - -## The Code Manifesto - -We want to work in an ecosystem that empowers developers to reach their -potential — one that encourages growth and effective collaboration. A space that -is safe for all. - -A space such as this benefits everyone that participates in it. It encourages -new developers to enter our field. It is through discussion and collaboration -that we grow, and through growth that we improve. - -In the effort to create such a place, we hold to these values: - -1. **Discrimination limits us.** This includes discrimination on the basis of - race, gender, sexual orientation, gender identity, age, nationality, technology - and any other arbitrary exclusion of a group of people. -2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort - levels. Remember that, and if brought to your attention, heed it. -3. **We are our biggest assets.** None of us were born masters of our trade. - Each of us has been helped along the way. Return that favor, when and where - you can. -4. **We are resources for the future.** As an extension of #3, share what you - know. Make yourself a resource to help those that come after you. -5. **Respect defines us.** Treat others as you wish to be treated. Make your - discussions, criticisms and debates from a position of respectfulness. Ask - yourself, is it true? Is it necessary? Is it constructive? Anything less is - unacceptable. -6. **Reactions require grace.** Angry responses are valid, but abusive language - and vindictive actions are toxic. When something happens that offends you, - handle it assertively, but be respectful. Escalate reasonably, and try to - allow the offender an opportunity to explain themselves, and possibly correct - the issue. -7. **Opinions are just that: opinions.** Each and every one of us, due to our - background and upbringing, have varying opinions. The fact of the matter, is - that is perfectly acceptable. Remember this: if you respect your own - opinions, you should respect the opinions of others. -8. **To err is human.** You might not intend it, but mistakes do happen and - contribute to build experience. Tolerate honest mistakes, and don't hesitate - to apologize if you make one yourself. diff --git a/vendor/zendframework/zend-escaper/CONTRIBUTING.md b/vendor/zendframework/zend-escaper/CONTRIBUTING.md deleted file mode 100644 index 8eb4657f9c8a49defae6ff72a5b44ad6c8ee4c00..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/CONTRIBUTING.md +++ /dev/null @@ -1,234 +0,0 @@ -# CONTRIBUTING - -## RESOURCES - -If you wish to contribute to Zend Framework, please be sure to -read/subscribe to the following resources: - - - [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards) - - [Contributor's Guide](http://framework.zend.com/participate/contributor-guide) - - ZF Contributor's mailing list: - Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html - Subscribe: zf-contributors-subscribe@lists.zend.com - - ZF Contributor's IRC channel: - #zftalk.dev on Freenode.net - -If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-escaper/issues/new). - -## Reporting Potential Security Issues - -If you have encountered a potential security vulnerability, please **DO NOT** report it on the public -issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead. -We will work with you to verify the vulnerability and patch it as soon as possible. - -When reporting issues, please provide the following information: - -- Component(s) affected -- A description indicating how to reproduce the issue -- A summary of the security vulnerability and impact - -We request that you contact us via the email address above and give the project -contributors a chance to resolve the vulnerability and issue a new release prior -to any public exposure; this helps protect users and provides them with a chance -to upgrade and/or update in order to protect their applications. - -For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc). - -## RUNNING TESTS - -> ### Note: testing versions prior to 2.4 -> -> This component originates with Zend Framework 2. During the lifetime of ZF2, -> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no -> changes were necessary. However, due to the migration, tests may not run on -> versions < 2.4. As such, you may need to change the PHPUnit dependency if -> attempting a fix on such a version. - -To run tests: - -- Clone the repository: - - ```console - $ git clone git@github.com:zendframework/zend-escaper.git - $ cd - ``` - -- Install dependencies via composer: - - ```console - $ curl -sS https://getcomposer.org/installer | php -- - $ ./composer.phar install - ``` - - If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/ - -- Run the tests via `phpunit` and the provided PHPUnit config, like in this example: - - ```console - $ ./vendor/bin/phpunit - ``` - -You can turn on conditional tests with the phpunit.xml file. -To do so: - - - Copy `phpunit.xml.dist` file to `phpunit.xml` - - Edit `phpunit.xml` to enable any specific functionality you - want to test, as well as to provide test values to utilize. - -## Running Coding Standards Checks - -This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding -standards checks, and provides configuration for our selected checks. -`php-cs-fixer` is installed by default via Composer. - -To run checks only: - -```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs -``` - -To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run` -flag: - -```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs -``` - -If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure -they pass, and make sure you add and commit the changes after verification. - -## Recommended Workflow for Contributions - -Your first step is to establish a public repository from which we can -pull your work into the master repository. We recommend using -[GitHub](https://github.com), as that is where the component is already hosted. - -1. Setup a [GitHub account](http://github.com/), if you haven't yet -2. Fork the repository (http://github.com/zendframework/zend-escaper) -3. Clone the canonical repository locally and enter it. - - ```console - $ git clone git://github.com:zendframework/zend-escaper.git - $ cd zend-escaper - ``` - -4. Add a remote to your fork; substitute your GitHub username in the command - below. - - ```console - $ git remote add {username} git@github.com:{username}/zend-escaper.git - $ git fetch {username} - ``` - -### Keeping Up-to-Date - -Periodically, you should update your fork or personal repository to -match the canonical ZF repository. Assuming you have setup your local repository -per the instructions above, you can do the following: - - -```console -$ git checkout master -$ git fetch origin -$ git rebase origin/master -# OPTIONALLY, to keep your remote up-to-date - -$ git push {username} master:master -``` - -If you're tracking other branches -- for example, the "develop" branch, where -new feature development occurs -- you'll want to do the same operations for that -branch; simply substitute "develop" for "master". - -### Working on a patch - -We recommend you do each new feature or bugfix in a new branch. This simplifies -the task of code review as well as the task of merging your changes into the -canonical repository. - -A typical workflow will then consist of the following: - -1. Create a new local branch based off either your master or develop branch. -2. Switch to your new local branch. (This step can be combined with the - previous step with the use of `git checkout -b`.) -3. Do some work, commit, repeat as necessary. -4. Push the local branch to your remote repository. -5. Send a pull request. - -The mechanics of this process are actually quite trivial. Below, we will -create a branch for fixing an issue in the tracker. - -```console -$ git checkout -b hotfix/9295 -Switched to a new branch 'hotfix/9295' -``` - -... do some work ... - - -```console -$ git commit -``` - -... write your log message ... - - -```console -$ git push {username} hotfix/9295:hotfix/9295 -Counting objects: 38, done. -Delta compression using up to 2 threads. -Compression objects: 100% (18/18), done. -Writing objects: 100% (20/20), 8.19KiB, done. -Total 20 (delta 12), reused 0 (delta 0) -To ssh://git@github.com/{username}/zend-escaper.git - b5583aa..4f51698 HEAD -> master -``` - -To send a pull request, you have two options. - -If using GitHub, you can do the pull request from there. Navigate to -your repository, select the branch you just created, and then select the -"Pull Request" button in the upper right. Select the user/organization -"zendframework" as the recipient. - -If using your own repository - or even if using GitHub - you can use `git -format-patch` to create a patchset for us to apply; in fact, this is -**recommended** for security-related patches. If you use `format-patch`, please -send the patches as attachments to: - -- zf-devteam@zend.com for patches without security implications -- zf-security@zend.com for security patches - -#### What branch to issue the pull request against? - -Which branch should you issue a pull request against? - -- For fixes against the stable release, issue the pull request against the - "master" branch. -- For new features, or fixes that introduce new elements to the public API (such - as new public methods or properties), issue the pull request against the - "develop" branch. - -### Branch Cleanup - -As you might imagine, if you are a frequent contributor, you'll start to -get a ton of branches both locally and on your remote. - -Once you know that your changes have been accepted to the master -repository, we suggest doing some cleanup of these branches. - -- Local branch cleanup - - ```console - $ git branch -d <branchname> - ``` - -- Remote branch removal - - ```console - $ git push {username} :<branchname> - ``` - - -## Conduct - -Please see our [CONDUCT.md](CONDUCT.md) to understand expected behavior when interacting with others in the project. diff --git a/vendor/zendframework/zend-escaper/LICENSE.md b/vendor/zendframework/zend-escaper/LICENSE.md index dbb1b49c01421e18478507a9ef40b8087317c306..d44ab5dc72bf4cbca7c9ddc4c8334a929c2185de 100644 --- a/vendor/zendframework/zend-escaper/LICENSE.md +++ b/vendor/zendframework/zend-escaper/LICENSE.md @@ -1,16 +1,15 @@ -Copyright (c) 2005-2015, Zend Technologies USA, Inc. - +Copyright (c) 2005-2018, Zend Technologies USA, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. +- Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. - Neither the name of Zend Technologies USA, Inc. nor the names of its contributors may be used to endorse or promote products derived from this diff --git a/vendor/zendframework/zend-escaper/README.md b/vendor/zendframework/zend-escaper/README.md index 4124bdd02df61ad99440db97d200ccea296a6e31..4e8b563d50ad91b936f1634912537512b31d7507 100644 --- a/vendor/zendframework/zend-escaper/README.md +++ b/vendor/zendframework/zend-escaper/README.md @@ -1,7 +1,7 @@ # zend-escaper [](https://secure.travis-ci.org/zendframework/zend-escaper) -[](https://coveralls.io/r/zendframework/zend-escaper?branch=master) +[](https://coveralls.io/github/zendframework/zend-escaper?branch=master) The OWASP Top 10 web security risks study lists Cross-Site Scripting (XSS) in second place. PHP’s sole functionality against XSS is limited to two functions @@ -10,4 +10,4 @@ It offers developers a way to escape output and defend from XSS and related vulnerabilities by introducing contextual escaping based on peer-reviewed rules. - File issues at https://github.com/zendframework/zend-escaper/issues -- Documentation is at https://zendframework.github.io/zend-escaper/ +- Documentation is at https://docs.zendframework.com/zend-escaper/ diff --git a/vendor/zendframework/zend-escaper/composer.json b/vendor/zendframework/zend-escaper/composer.json index 2abc6288fbc5bbf2814170318f8ed386f63c5cb9..890d03aded4aeacf0a75452b8eb36d2cd697d48b 100644 --- a/vendor/zendframework/zend-escaper/composer.json +++ b/vendor/zendframework/zend-escaper/composer.json @@ -1,26 +1,30 @@ { "name": "zendframework/zend-escaper", - "description": " ", + "description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs", "license": "BSD-3-Clause", "keywords": [ - "zf2", + "zf", + "zendframework", "escaper" ], - "homepage": "https://github.com/zendframework/zend-escaper", - "autoload": { - "psr-4": { - "Zend\\Escaper\\": "src/" - } + "support": { + "docs": "https://docs.zendframework.com/zend-escaper/", + "issues": "https://github.com/zendframework/zend-escaper/issues", + "source": "https://github.com/zendframework/zend-escaper", + "rss": "https://github.com/zendframework/zend-escaper/releases.atom", + "chat": "https://zendframework-slack.herokuapp.com", + "forum": "https://discourse.zendframework.com/c/questions/components" }, "require": { - "php": ">=5.5" + "php": "^5.6 || ^7.0" }, - "minimum-stability": "dev", - "prefer-stable": true, - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" + "require-dev": { + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0" + }, + "autoload": { + "psr-4": { + "Zend\\Escaper\\": "src/" } }, "autoload-dev": { @@ -28,8 +32,23 @@ "ZendTest\\Escaper\\": "test/" } }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/PHPUnit": "~4.0" + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev", + "dev-develop": "2.7.x-dev" + } + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" } } diff --git a/vendor/zendframework/zend-escaper/doc/book/configuration.md b/vendor/zendframework/zend-escaper/doc/book/configuration.md deleted file mode 100644 index b1932667ae3f6704e346de10c27243a73d63cb53..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/doc/book/configuration.md +++ /dev/null @@ -1,21 +0,0 @@ -# Configuration - -`Zend\Escaper\Escaper` has only one configuration option available, and that is -the encoding to be used by the `Escaper` instance. - -The default encoding is **utf-8**. Other supported encodings are: - -- iso-8859-1 -- iso-8859-5 -- iso-8859-15 -- cp866, ibm866, 866 -- cp1251, windows-1251 -- cp1252, windows-1252 -- koi8-r, koi8-ru -- big5, big5-hkscs, 950, gb2312, 936 -- shift\_jis, sjis, sjis-win, cp932 -- eucjp, eucjp-win -- macroman - -If an unsupported encoding is passed to `Zend\Escaper\Escaper`, a -`Zend\Escaper\Exception\InvalidArgumentException` will be thrown. diff --git a/vendor/zendframework/zend-escaper/doc/book/escaping-css.md b/vendor/zendframework/zend-escaper/doc/book/escaping-css.md deleted file mode 100644 index 63b554bd441ce161738ec31ef56adede78a71d70..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/doc/book/escaping-css.md +++ /dev/null @@ -1,74 +0,0 @@ -# Escaping Cascading Style Sheets - -CSS is similar to [escaping Javascript](escaping-javascript.md). CSS escaping -excludes only basic alphanumeric characters and escapes all other characters -into valid CSS hexadecimal escapes. - -## Example of Bad CSS Escaping - -In most cases developers forget to escape CSS completely: - -```php -<?php header('Content-Type: application/xhtml+xml; charset=UTF-8'); ?> -<!DOCTYPE html> -<?php -$input = <<<INPUT -body { - background-image: url('http://example.com/foo.jpg?</style><script>alert(1)</script>'); -} -INPUT; -?> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <title>Unescaped CSS</title> - <meta charset="UTF-8"/> - <style> - <?= $input ?> - </style> -</head> -<body> - <p>User controlled CSS needs to be properly escaped!</p> -</body> -</html> -``` - -In the above example, by failing to escape the user provided CSS, an attacker -can execute an XSS attack fairly easily. - -## Example of Good CSS Escaping - -By using `escapeCss()` method in the CSS context, such attacks can be prevented: - -```php -<?php header('Content-Type: application/xhtml+xml; charset=UTF-8'); ?> -<!DOCTYPE html> -<?php -$input = <<<INPUT -body { - background-image: url('http://example.com/foo.jpg?</style><script>alert(1)</script>'); -} -INPUT; - -$escaper = new Zend\Escaper\Escaper('utf-8'); -$output = $escaper->escapeCss($input); -?> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <title>Escaped CSS</title> - <meta charset="UTF-8"/> - <style> - <?php - // output will look something like - // body\20 \7B \A \20 \20 \20 \20 background\2D image\3A \20 url\28 ... - echo $output; - ?> - </style> -</head> -<body> - <p>User controlled CSS needs to be properly escaped!</p> -</body> -</html> -``` - -By properly escaping user controlled CSS, we can prevent XSS attacks in our web -applications. diff --git a/vendor/zendframework/zend-escaper/doc/book/escaping-html-attributes.md b/vendor/zendframework/zend-escaper/doc/book/escaping-html-attributes.md deleted file mode 100644 index d4987794a0895021f4f33aa668c87f33381e141e..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/doc/book/escaping-html-attributes.md +++ /dev/null @@ -1,128 +0,0 @@ -# Escaping HTML Attributes - -Escaping data in **HTML Attribute** contexts is most often done incorrectly, if -not overlooked completely by developers. Regular [HTML -escaping](escaping-html.md) can be used for escaping HTML attributes *only* if -the attribute value can be **guaranteed as being properly quoted**! To avoid -confusion, we recommend always using the HTML Attribute escaper method when -dealing with HTTP attributes specifically. - -To escape data for an HTML Attribute, use `Zend\Escaper\Escaper`'s -`escapeHtmlAttr()` method. Internally it will convert the data to UTF-8, check -for its validity, and use an extended set of characters to escape that are not -covered by `htmlspecialchars()` to cover the cases where an attribute might be -unquoted or quoted illegally. - -## Examples of Bad HTML Attribute Escaping - -An example of incorrect HTML attribute escaping: - -```php -<?php header('Content-Type: text/html; charset=UTF-8'); ?> -<!DOCTYPE html> -<?php -$input = <<<INPUT -' onmouseover='alert(/ZF2!/); -INPUT; - -/** - * NOTE: This is equivalent to using htmlspecialchars($input, ENT_COMPAT) - */ -$output = htmlspecialchars($input); -?> -<html> -<head> - <title>Single Quoted Attribute</title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -</head> -<body> - <div> - <?php - // the span tag will look like: - // <span title='' onmouseover='alert(/ZF2!/);'> - ?> - <span title='<?= $output ?>'> - What framework are you using? - </span> - </div> -</body> -</html> -``` - -In the above example, the default `ENT_COMPAT` flag is being used, which does -not escape single quotes, thus resulting in an alert box popping up when the -`onmouseover` event happens on the `span` element. - -Another example of incorrect HTML attribute escaping can happen when unquoted -attributes are used (which is, by the way, perfectly valid HTML5): - -```php -<?php header('Content-Type: text/html; charset=UTF-8'); ?> -<!DOCTYPE html> -<?php -$input = <<<INPUT -faketitle onmouseover=alert(/ZF2!/); -INPUT; - -// Tough luck using proper flags when the title attribute is unquoted! -$output = htmlspecialchars($input, ENT_QUOTES); -?> -<html> -<head> - <title>Quoteless Attribute</title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -</head> -<body> - <div> - <?php - // the span tag will look like: - // <span title=faketitle onmouseover=alert(/ZF2!/);> - ?> - <span title=<?= $output ?>> - What framework are you using? - </span> - </div> -</body> -</html> -``` - -The above example shows how it is easy to break out from unquoted attributes in -HTML5. - -## Example of Good HTML Attribute Escaping - -Both of the previous examples can be avoided by simply using the -`escapeHtmlAttr()` method: - -```php -<?php header('Content-Type: text/html; charset=UTF-8'); ?> -<!DOCTYPE html> -<?php -$input = <<<INPUT -faketitle onmouseover=alert(/ZF2!/); -INPUT; - -$escaper = new Zend\Escaper\Escaper('utf-8'); -$output = $escaper->escapeHtmlAttr($input); -?> -<html> -<head> - <title>Quoteless Attribute</title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -</head> -<body> - <div> - <?php - // the span tag will look like: - // <span title=faketitle onmouseover=alert(/ZF2!/);> - ?> - <span title=<?= $output ?>> - What framework are you using? - </span> - </div> -</body> -</html> -``` - -In the above example, the malicious input from the attacker becomes completely -harmless as we used proper HTML attribute escaping! diff --git a/vendor/zendframework/zend-escaper/doc/book/escaping-html.md b/vendor/zendframework/zend-escaper/doc/book/escaping-html.md deleted file mode 100644 index 7a88023f4824e835ea490c248a48617dbde211cd..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/doc/book/escaping-html.md +++ /dev/null @@ -1,74 +0,0 @@ -# Escaping HTML - -Probably the most common escaping happens for **HTML body** contexts. There are -very few characters with special meaning in this context, yet it is quite common -to escape data incorrectly, namely by setting the wrong flags and character -encoding. - -For escaping data to use within an HTML body context, use -`Zend\Escaper\Escaper`'s `escapeHtml()` method. Internally it uses PHP's -`htmlspecialchars()`, correctly setting the flags and encoding for you. - -```php -// Outputting this without escaping would be a bad idea! -$input = '<script>alert("zf2")</script>'; - -$escaper = new Zend\Escaper\Escaper('utf-8'); - -// somewhere in an HTML template -<div class="user-provided-input"> - <?= $escaper->escapeHtml($input) // all safe! ?> -</div> -``` - -One thing a developer needs to pay special attention to is the encoding in which -the document is served to the client, as it **must be the same** as the encoding -used for escaping! - -## Example of Bad HTML Escaping - -An example of incorrect usage: - -```php -<?php -$input = '<script>alert("zf2")</script>'; -$escaper = new Zend\Escaper\Escaper('utf-8'); -?> -<?php header('Content-Type: text/html; charset=ISO-8859-1'); ?> -<!DOCTYPE html> -<html> -<head> - <title>Encodings set incorrectly!</title> - <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> -</head> -<body> -<?php - // Bad! The escaper's and the document's encodings are different! - echo $escaper->escapeHtml($input); -?> -</body> -``` - -## Example of Good HTML Escaping - -An example of correct usage: - -```php -<?php -$input = '<script>alert("zf2")</script>'; -$escaper = new Zend\Escaper\Escaper('utf-8'); -?> -<?php header('Content-Type: text/html; charset=UTF-8'); ?> -<!DOCTYPE html> -<html> -<head> - <title>Encodings set correctly!</title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -</head> -<body> -<?php - // Good! The escaper's and the document's encodings are same! - echo $escaper->escapeHtml($input); -?> -</body> -``` diff --git a/vendor/zendframework/zend-escaper/doc/book/escaping-javascript.md b/vendor/zendframework/zend-escaper/doc/book/escaping-javascript.md deleted file mode 100644 index f40efa646f39574097aa21db27048a52a0655f73..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/doc/book/escaping-javascript.md +++ /dev/null @@ -1,93 +0,0 @@ -# Escaping Javascript - -Javascript string literals in HTML are subject to significant restrictions due -to the potential for unquoted attributes and uncertainty as to whether -Javascript will be viewed as being `CDATA` or `PCDATA` by the browser. To -eliminate any possible XSS vulnerabilities, Javascript escaping for HTML extends -the escaping rules of both ECMAScript and JSON to include any potentially -dangerous character. Very similar to HTML attribute value escaping, this means -escaping everything except basic alphanumeric characters and the comma, period, -and underscore characters as hexadecimal or unicode escapes. - -Javascript escaping applies to all literal strings and digits. It is not -possible to safely escape other Javascript markup. - -To escape data in the **Javascript context**, use `Zend\Escaper\Escaper`'s -`escapeJs()` method. An extended set of characters are escaped beyond -ECMAScript's rules for Javascript literal string escaping in order to prevent -misinterpretation of Javascript as HTML leading to the injection of special -characters and entities. - -## Example of Bad Javascript Escaping - -An example of incorrect Javascript escaping: - -```php -<?php header('Content-Type: application/xhtml+xml; charset=UTF-8'); ?> -<!DOCTYPE html> -<?php -$input = <<<INPUT -bar"; alert("Meow!"); var xss="true -INPUT; - -$output = json_encode($input); -?> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <title>Unescaped Entities</title> - <meta charset="UTF-8"/> - <script type="text/javascript"> - <?php - // this will result in - // var foo = "bar"; alert("Meow!"); var xss="true"; - ?> - var foo = <?= $output ?>; - </script> -</head> -<body> - <p>json_encode() is not good for escaping javascript!</p> -</body> -</html> -``` - -The above example will show an alert popup box as soon as the page is loaded, -because the data is not properly escaped for the Javascript context. - -## Example of Good Javascript Escaping - -By using the `escapeJs()` method in the Javascript context, such attacks can be -prevented: - -```php -<?php header('Content-Type: text/html; charset=UTF-8'); ?> -<!DOCTYPE html> -<?php -$input = <<<INPUT -bar"; alert("Meow!"); var xss="true -INPUT; - -$escaper = new Zend\Escaper\Escaper('utf-8'); -$output = $escaper->escapeJs($input); -?> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <title>Escaped Entities</title> - <meta charset="UTF-8"/> - <script type="text/javascript"> - <?php - // this will look like - // var foo = -bar\x26quot\x3B\x3B\x20alert\x28\x26quot\x3BMeow\x21\x26quot\x3B\x29\x3B\x20var\x20xss\x3D\x26quot\x3Btrue; - ?> - var foo = <?= $output ?>; - </script> -</head> -<body> - <p>Zend\Escaper\Escaper::escapeJs() is good for escaping javascript!</p> -</body> -</html> -``` - -In the above example, the Javascript parser will most likely report a -`SyntaxError`, but at least the targeted application remains safe from such -attacks. diff --git a/vendor/zendframework/zend-escaper/doc/book/escaping-url.md b/vendor/zendframework/zend-escaper/doc/book/escaping-url.md deleted file mode 100644 index 4dc13e1432ef840ce7c63217a038a61941260082..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/doc/book/escaping-url.md +++ /dev/null @@ -1,57 +0,0 @@ -# Escaping URLs - -This method is basically an alias for PHP's `rawurlencode()` which has applied -RFC 3986 since PHP 5.3. It is included primarily for consistency. - -URL escaping applies to data being inserted into a URL and not to the whole URL -itself. - -## Example of Bad URL Escaping - -XSS attacks are easy if data inserted into URLs is not escaped properly: - -```php -<?php header('Content-Type: application/xhtml+xml; charset=UTF-8'); ?> -<!DOCTYPE html> -<?php -$input = <<<INPUT -" onmouseover="alert('zf2') -INPUT; -?> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <title>Unescaped URL data</title> - <meta charset="UTF-8"/> -</head> -<body> - <a href="http://example.com/?name=<?= $input ?>">Click here!</a> -</body> -</html> -``` - -## Example of Good URL Escaping - -By properly escaping data in URLs by using `escapeUrl()`, we can prevent XSS -attacks: - -```php -<?php header('Content-Type: application/xhtml+xml; charset=UTF-8'); ?> -<!DOCTYPE html> -<?php -$input = <<<INPUT -" onmouseover="alert('zf2') -INPUT; - -$escaper = new Zend\Escaper\Escaper('utf-8'); -$output = $escaper->escapeUrl($input); -?> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <title>Unescaped URL data</title> - <meta charset="UTF-8"/> -</head> -<body> - <a href="http://example.com/?name=<?= $output ?>">Click here!</a> -</body> -</html> -``` diff --git a/vendor/zendframework/zend-escaper/doc/book/index.html b/vendor/zendframework/zend-escaper/doc/book/index.html deleted file mode 100644 index 7263c45bac595b66adf08ba4b4758b8b267eefd3..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/doc/book/index.html +++ /dev/null @@ -1,10 +0,0 @@ -<div class="container"> - <div class="jumbotron"> - <h1>zend-escaper</h1> - - <p>Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs.</p> - - <pre><code class="language-bash">$ composer require zendframework/zend-escaper</code></pre> - </div> -</div> - diff --git a/vendor/zendframework/zend-escaper/doc/book/index.md b/vendor/zendframework/zend-escaper/doc/book/index.md deleted file mode 100644 index 4124bdd02df61ad99440db97d200ccea296a6e31..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/doc/book/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# zend-escaper - -[](https://secure.travis-ci.org/zendframework/zend-escaper) -[](https://coveralls.io/r/zendframework/zend-escaper?branch=master) - -The OWASP Top 10 web security risks study lists Cross-Site Scripting (XSS) in -second place. PHP’s sole functionality against XSS is limited to two functions -of which one is commonly misapplied. Thus, the zend-escaper component was written. -It offers developers a way to escape output and defend from XSS and related -vulnerabilities by introducing contextual escaping based on peer-reviewed rules. - -- File issues at https://github.com/zendframework/zend-escaper/issues -- Documentation is at https://zendframework.github.io/zend-escaper/ diff --git a/vendor/zendframework/zend-escaper/doc/book/intro.md b/vendor/zendframework/zend-escaper/doc/book/intro.md deleted file mode 100644 index 0820456290472b8b7effb54faf38d5e5029ce810..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/doc/book/intro.md +++ /dev/null @@ -1,51 +0,0 @@ -# Introduction - -The [OWASP Top 10 web security risks](https://www.owasp.org/index.php/Top_10_2010-Main) -study lists Cross-Site Scripting (XSS) in second place. PHP's sole functionality -against XSS is limited to two functions of which one is commonly misapplied. -Thus, the zend-escaper component was written. It offers developers a way to -escape output and defend from XSS and related vulnerabilities by introducing -**contextual escaping based on peer-reviewed rules**. - -zend-escaper was written with ease of use in mind, so it can be used completely stand-alone from -the rest of the framework, and as such can be installed with Composer: - -```bash -$ composer install zendframework/zend-escaper -``` - -Several Zend Framework components provide integrations for consuming -zend-escaper, including [zend-view](https://github.com/zendframework/zend-view), -which provides a set of helpers that consume it. - -> ### Security -> -> zend-escaper is a security related component. As such, if you believe you have -> found an issue, we ask that you follow our [Security Policy](http://framework.zend.com/security/) -> and report security issues accordingly. The Zend Framework team and the -> contributors thank you in advance. - -## Overview - -zend-escaper provides one class, `Zend\Escaper\Escaper`, which in turn provides -five methods for escaping output. Which method to use depends on the context in -which the output is used. It is up to the developer to use the right methods in -the right context. - -`Zend\Escaper\Escaper` has the following escaping methods available for each context: - -- `escapeHtml`: escape a string for an HTML body context. -- `escapeHtmlAttr`: escape a string for an HTML attribute context. -- `escapeJs`: escape a string for a Javascript context. -- `escapeCss`: escape a string for a CSS context. -- `escapeUrl`: escape a string for a URI or URI parameter context. - -Usage of each method will be discussed in detail in later chapters. - -## What zend-Escaper is not - -zend-escaper is meant to be used only for *escaping data for output*, and as -such should not be misused for *filtering input data*. For such tasks, use -[zend-filter](https://zendframework.github.io/zend-filter/), -[HTMLPurifier](http://htmlpurifier.org/) or PHP's -[Filter](http://php.net/filter) functionality should be used. diff --git a/vendor/zendframework/zend-escaper/doc/book/theory-of-operation.md b/vendor/zendframework/zend-escaper/doc/book/theory-of-operation.md deleted file mode 100644 index 9a769b079291494242761c37836ede1ea63538e0..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/doc/book/theory-of-operation.md +++ /dev/null @@ -1,147 +0,0 @@ -# Theory of Operation - -zend-escaper provides methods for escaping output data, dependent on the context -in which the data will be used. Each method is based on peer-reviewed rules and -is in compliance with the current OWASP recommendations. - -The escaping follows a well-known and fixed set of encoding rules defined by -OWASP for each key HTML context. These rules cannot be impacted or negated by -browser quirks or edge-case HTML parsing unless the browser suffers a -catastrophic bug in its HTML parser or Javascript interpreter — both of -these are unlikely. - -The contexts in which zend-escaper should be used are **HTML Body**, **HTML -Attribute**, **Javascript**, **CSS**, and **URL/URI** contexts. - -Every escaper method will take the data to be escaped, make sure it is utf-8 -encoded data (or try to convert it to utf-8), perform context-based escaping, -encode the escaped data back to its original encoding, and return the data to -the caller. - -The actual escaping of the data differs between each method; they all have their -own set of rules according to which escaping is performed. An example will allow -us to clearly demonstrate the difference, and how the same characters are being -escaped differently between contexts: - -```php -$escaper = new Zend\Escaper\Escaper('utf-8'); - -// <script>alert("zf2")</script> -echo $escaper->escapeHtml('<script>alert("zf2")</script>'); - -// <script>alert("zf2")</script> -echo $escaper->escapeHtmlAttr('<script>alert("zf2")</script>'); - -// \x3Cscript\x3Ealert\x28\x22zf2\x22\x29\x3C\x2Fscript\x3E -echo $escaper->escapeJs('<script>alert("zf2")</script>'); - -// \3C script\3E alert\28 \22 zf2\22 \29 \3C \2F script\3E -echo $escaper->escapeCss('<script>alert("zf2")</script>'); - -// %3Cscript%3Ealert%28%22zf2%22%29%3C%2Fscript%3E -echo $escaper->escapeUrl('<script>alert("zf2")</script>'); -``` - -More detailed examples will be given in later chapters. - -## The Problem with Inconsistent Functionality - -At present, programmers orient towards the following PHP functions for each -common HTML context: - -- **HTML Body**: `htmlspecialchars()` or `htmlentities()` -- **HTML Attribute**: `htmlspecialchars()` or `htmlentities()` -- **Javascript**: `addslashes()` or `json_encode()` -- **CSS**: n/a -- **URL/URI**: `rawurlencode()` or `urlencode()` - -In practice, these decisions appear to depend more on what PHP offers, and if it -can be interpreted as offering sufficient escaping safety, than it does on what -is recommended in reality to defend against XSS. While these functions can -prevent some forms of XSS, they do not cover all use cases or risks and are -therefore insufficient defenses. - -Using `htmlspecialchars()` in a perfectly valid HTML5 unquoted attribute value, -for example, is completely useless since the value can be terminated by a space -(among other things), which is never escaped. Thus, in this instance, we have a -conflict between a widely used HTML escaper and a modern HTML specification, -with no specific function available to cover this use case. While it's tempting -to blame users, or the HTML specification authors, escaping just needs to deal -with whatever HTML and browsers allow. - -Using `addslashes()`, custom backslash escaping, or `json_encode()` will -typically ignore HTML special characters such as ampersands, which may be used -to inject entities into Javascript. Under the right circumstances, the browser -will convert these entities into their literal equivalents before interpreting -Javascript, thus allowing attackers to inject arbitrary code. - -Inconsistencies with valid HTML, insecure default parameters, lack of character -encoding awareness, and misrepresentations of what functions are capable of by -some programmers — these all make escaping in PHP an unnecessarily -convoluted quest. - -To circumvent the lack of escaping methods in PHP, zend-escaper addresses the -need to apply context-specific escaping in web applications. It implements -methods that specifically target XSS and offers programmers a tool to secure -their applications without misusing other inadequate methods, or using, most -likely incomplete, home-grown solutions. - -## Why Contextual Escaping? - -To understand why multiple standardised escaping methods are needed, what -follows are several quick points; they are by no means a complete set of -reasons, however! - -### HTML escaping of unquoted HTML attribute values still allows XSS - -This is probably the best known way to defeat `htmlspecialchars()` when used on -attribute values, since any space (or character interpreted as a space — -there are a lot) lets you inject new attributes whose content can't be -neutralised by HTML escaping. The solution (where this is possible) is -additional escaping as defined by the OWASP ESAPI codecs. The point here can be -extended further — escaping only works if a programmer or designer knows -what they're doing. In many contexts, there are additional practices and gotchas -that need to be carefully monitored since escaping sometimes needs a little -extra help to protect against XSS — even if that means ensuring all -attribute values are properly double quoted despite this not being required for -valid HTML. - -### HTML escaping of CSS, Javascript or URIs is often reversed when passed to non-HTML interpreters by the browser - -HTML escaping is just that &mdsash; it's designed to escape a string for HTML -(i.e. prevent tag or attribute insertion), but not alter the underlying meaning -of the content, whether it be text, Javascript, CSS, or URIs. For that purpose, -a fully HTML-escaped version of any other context may still have its unescaped -form extracted before it's interpreted or executed. For this reason we need -separate escapers for Javascript, CSS, and URIs, and developers or designers -writing templates **must** know which escaper to apply to which context. Of -course, this means you need to be able to identify the correct context before -selecting the right escaper! - -### DOM-based XSS requires a defence using at least two levels of different escaping in many cases - -DOM-based XSS has become increasingly common as Javascript has taken off in -popularity for large scale client-side coding. A simple example is Javascript -defined in a template which inserts a new piece of HTML text into the DOM. If -the string is only HTML escaped, it may still contain Javascript that will -execute in that context. If the string is only Javascript-escaped, it may -contain HTML markup (new tags and attributes) which will be injected into the -DOM and parsed once the inserting Javascript executes. Damned either way? The -solution is to escape twice — first escape the string for HTML (make it -safe for DOM insertion), and then for Javascript (make it safe for the current -Javascript context). Nested contexts are a common means of bypassing naive -escaping habits (e.g. you can inject Javascript into a CSS expression within an -HTML attribute). - -### PHP has no known anti-XSS escape functions (only those kidnapped from their original purposes) - -A simple example, widely used, is when you see `json_encode()` used to escape -Javascript, or worse, some kind of mutant `addslashes()` implementation. These -were never designed to eliminate XSS, yet PHP programmers use them as such. For -example, `json_encode()` does not escape the ampersand or semi-colon characters -by default. That means you can easily inject HTML entities which could then be -decoded before the Javascript is evaluated in a HTML document. This lets you -break out of strings, add new JS statements, close tags, etc. In other words, -using `json_encode()` is insufficient and naive. The same, arguably, could be -said for `htmlspecialchars()` which has its own well known limitations that make -a singular reliance on it a questionable practice. diff --git a/vendor/zendframework/zend-escaper/mkdocs.yml b/vendor/zendframework/zend-escaper/mkdocs.yml deleted file mode 100644 index 48e7b311f147ff5778310913dbf24c0b9b991d78..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-escaper/mkdocs.yml +++ /dev/null @@ -1,17 +0,0 @@ -docs_dir: doc/book -site_dir: doc/html -pages: - - index.md - - Intro: intro.md - - Reference: - - "Theory of Operation": theory-of-operation.md - - Configuration: configuration.md - - "Escaping HTML": escaping-html.md - - "Escaping HTML Attributes": escaping-html-attributes.md - - "Escaping Javascript": escaping-javascript.md - - "Escaping CSS": escaping-css.md - - "Escaping URLs": escaping-url.md -site_name: zend-escaper -site_description: zend-escaper -repo_url: 'https://github.com/zendframework/zend-escaper' -copyright: 'Copyright (c) 2016 <a href="http://www.zend.com/">Zend Technologies USA Inc.</a>' diff --git a/vendor/zendframework/zend-escaper/src/Escaper.php b/vendor/zendframework/zend-escaper/src/Escaper.php index e68e32b05d5cc4126f9a3a9ccce1b06e995e3da9..5cec9684ef4695d74c0e56806dc3cacb4b63db87 100644 --- a/vendor/zendframework/zend-escaper/src/Escaper.php +++ b/vendor/zendframework/zend-escaper/src/Escaper.php @@ -95,7 +95,11 @@ class Escaper public function __construct($encoding = null) { if ($encoding !== null) { - $encoding = (string) $encoding; + if (! is_string($encoding)) { + throw new Exception\InvalidArgumentException( + get_class($this) . ' constructor parameter must be a string, received ' . gettype($encoding) + ); + } if ($encoding === '') { throw new Exception\InvalidArgumentException( get_class($this) . ' constructor parameter does not allow a blank value' @@ -103,7 +107,7 @@ public function __construct($encoding = null) } $encoding = strtolower($encoding); - if (!in_array($encoding, $this->supportedEncodings)) { + if (! in_array($encoding, $this->supportedEncodings)) { throw new Exception\InvalidArgumentException( 'Value of \'' . $encoding . '\' passed to ' . get_class($this) . ' constructor parameter is invalid. Provide an encoding supported by htmlspecialchars()' @@ -321,7 +325,7 @@ protected function toUtf8($string) $result = $this->convertEncoding($string, 'UTF-8', $this->getEncoding()); } - if (!$this->isUtf8($result)) { + if (! $this->isUtf8($result)) { throw new Exception\RuntimeException( sprintf('String to be escaped was not valid UTF-8 or could not be converted: %s', $result) ); diff --git a/vendor/zendframework/zend-feed/CHANGELOG.md b/vendor/zendframework/zend-feed/CHANGELOG.md index 55fa7cd5e592f14bd9b8e3d30f293cdc4c99f0ec..ec89110b132d8c925d903fbcf0ca8768ff790c97 100644 --- a/vendor/zendframework/zend-feed/CHANGELOG.md +++ b/vendor/zendframework/zend-feed/CHANGELOG.md @@ -2,6 +2,387 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. +## 2.12.0 - 2019-03-05 + +### Added + +- [#96](https://github.com/zendframework/zend-feed/pull/96) adds the methods `Zend\Feed\Reader\Extension\Podcast\Entry::getTitle() : string` + and `Zend\Feed\Writer\Extension\ITunes\Entry::setTitle(string $value)`; these + provide the ability to read and manipulate `<itunes:title>` tags in feeds. + +### Changed + +- Nothing. + +### Deprecated + +- [#101](https://github.com/zendframework/zend-feed/pull/101) deprecates the method `Zend\Feed\Writer\Writer::lcfirst()`; use the PHP + built-in function instead. + +- [#97](https://github.com/zendframework/zend-feed/pull/97) deprecates the classes `Zend\Feed\Reader\AbstractEntry` (use + `Zend\Feed\Reader\Entry\AbstractEntry` instead), `Zend\Feed\Reader\AbstractFeed` (use `Zend\Feed\Reader\Feed\AbstractFeed` instead), and + `Zend\Feed\Reader\Collection` (use Zend\Feed\Reader\Collection\Author`, `Zend\Feed\Reader\Collection\Category`, or + `Zend\Feed\Reader\Collection\Collection` instead, based on context). + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 2.11.1 - 2019-03-05 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#99](https://github.com/zendframework/zend-feed/pull/99) provides a fix to `Zend\Feed\Writer\Renderer\Entry\Rss` to ensure that + relative URIs provided for the feed disable the `isPermalink` flag. + +- [#100](https://github.com/zendframework/zend-feed/pull/100) fixes parameter and return value annotations for a number of classes to + specify the correct types. + +## 2.11.0 - 2019-01-29 + +### Added + +- [#94](https://github.com/zendframework/zend-feed/pull/94) adds support for PHP 7.3. + +- [#91](https://github.com/zendframework/zend-feed/pull/91) adds explicit requirements for both ext-dom and ext-libxml to the package. + +### Changed + +- [#93](https://github.com/zendframework/zend-feed/pull/93) `Writer\Feed`, `Writer\Entry` and `Writer\Deleted` all now accept + `DateTimeImmutable` instances as an arguments to methods that previously only + accepted `DateTime` or Unix Timestamps, such as `Writer\Feed::setDateModified()`. + +### Deprecated + +- Nothing. + +### Removed + +- [#94](https://github.com/zendframework/zend-feed/pull/94) removes support for zend-stdlib v2 releases. + +### Fixed + +- Nothing. + +## 2.10.3 - 2018-08-01 + +### Added + +- Nothing. + +### Changed + +- This release modifies how `Zend\Feed\Pubsubhubbub\AbstractCallback::_detectCallbackUrl()` + marshals the request URI. In prior releases, we would attempt to inspect the + `X-Rewrite-Url` and `X-Original-Url` headers, using their values, if present. + These headers are issued by the ISAPI_Rewrite module for IIS (developed by + HeliconTech). However, we have no way of guaranteeing that the module is what + issued the headers, making it an unreliable source for discovering the URI. As + such, we have removed this feature in this release. + + The method is not called internally. If you are calling the method from your + own extension and need support for ISAPI_Rewrite, you will need to override + the method as follows: + + ```php + protected function _detectCallbackUrl() + { + $callbackUrl = null; + if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { + $callbackUrl = $_SERVER['HTTP_X_REWRITE_URL']; + } + if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { + $callbackUrl = $_SERVER['HTTP_X_ORIGINAL_URL']; + } + + return $callbackUrl ?: parent::__detectCallbackUrl(); + } + ``` + + If you use an approach such as the above, make sure you also instruct your web + server to strip any incoming headers of the same name so that you can + guarantee they are issued by the ISAPI_Rewrite module. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 2.10.2 - 2018-06-18 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#81](https://github.com/zendframework/zend-feed/pull/81) updates the `Zend\Feed\Reader\Reader` and `Zend\Feed\Writer\Writer` classes to + conditionally register their respective "GooglePlayPodcast" extensions only if + their extension managers are aware of it. This is done due to the fact that + existing `ExtensionManagerInterface` implementations may not register it by + default as the extension did not exist in releases prior to 2.10.0. By having + the registration conditional, we prevent an exception from being raised; users + are not impacted by its absence, as the extension features were not exposed + previously. + + Both `Reader` and `Writer` emit an `E_USER_NOTICE` when the extension is not + found in the extension manager, indicating that the + `ExtensionManagerInterface` implementation should be updated to add entries + for the "GooglePlayPodcast" entry, feed, and/or renderer classes. + +## 2.10.1 - 2018-06-05 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#79](https://github.com/zendframework/zend-feed/pull/79) fixes an issue in the `setType()` method of the iTunes feed renderer whereby it was setting + the DOM content with an uninitialized variable. + +## 2.10.0 - 2018-05-24 + +### Added + +- [#78](https://github.com/zendframework/zend-feed/pull/78) adds support for the Google Play Podcasts 1.0 DTD in both the Reader and + Writer subcomponents. The following new classes provide the support: + + - `Zend\Feed\Reader\Extension\GooglePlayPodcast\Entry` + - `Zend\Feed\Reader\Extension\GooglePlayPodcast\Feed` + - `Zend\Feed\Writer\Extension\GooglePlayPodcast\Entry` + - `Zend\Feed\Writer\Extension\GooglePlayPodcast\Feed` + - `Zend\Feed\Writer\Extension\GooglePlayPodcast\Renderer\Entry` + - `Zend\Feed\Writer\Extension\GooglePlayPodcast\Renderer\Feed` + + The extensions are registered by default with both `Zend\Feed\Reader\Reader` + and `Zend\Feed\Writer\Writer`. + +- [#77](https://github.com/zendframework/zend-feed/pull/77) adds support for `itunes:image` for each of: + - `Zend\Feed\Reader\Extension\Podcast\Entry`, via `getItunesImage()`; previously only the `Feed` supported it. + - `Zend\Feed\Writer\Extension\ITunes\Entry`, via `setItunesImage()`; previously only the `Feed` supported it. + - `Zend\Feed\Writer\Extension\ITunes\Renderer\Entry`; previously on the `Feed` supported it. + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Writer\Extension\ITunes\Entry::setItunesSeason()`, corresponding to the + `itunes:season` tag, and allowing setting the season number of the episode the + entry represents. + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Writer\Extension\ITunes\Entry::setItunesIsClosedCaptioned()`, corresponding to the + `itunes:isClosedCaptioned` tag, and allowing setting the status of closed + captioning support in the episode the entry represents. + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Writer\Extension\ITunes\Entry::setItunesEpisodeType()`, corresponding to the + `itunes:episodeType` tag, and allowing setting the type of episode the entry represents + (one of "full", "trailer", or "bonus", and defaulting to "full"). + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Writer\Extension\ITunes\Entry::setEpisode()`, corresponding to the + `itunes:episode` tag, and allowing setting the number of the episode the entry represents. + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Writer\Extension\ITunes\Feed::setItunesComplete()`, corresponding to the + `itunes:complete` tag. It allows setting a boolean flag, indicating whether or not the + podcast is complete (will not air new episodes). + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Writer\Extension\ITunes\Feed::setItunesType()`, corresponding to the + `itunes:type` tag, and allowing setting the podcast type (one of "serial" or "episodic"). + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Reader\Extension\Podcast\Entry::getEpisodeType()`, corresponding to the + `itunes:episodeType` tag, and returning the type of episode the entry represents + (one of "full", "trailer", or "bonus", and defaulting to "full"). + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Reader\Extension\Podcast\Entry::getSeason()`, corresponding to the + `itunes:season` tag, and returning the season number of the episode the entry represents. + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Reader\Extension\Podcast\Entry::isClsoedCaptioned()`, corresponding to the + `itunes:isClosedCaptioned` tag, and returning the status of closed captioning + in the episode the entry represents. + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Reader\Extension\Podcast\Entry::getEpisode()`, corresponding to the + `itunes:episode` tag, and returning the number of the episode the entry represents. + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Reader\Extension\Podcast\Feed::isComplete()`, corresponding to the + `itunes:complete` tag. It returns a boolean, indicating whether or not the podcast is + complete (will not air new episodes). + +- [#75](https://github.com/zendframework/zend-feed/pull/75) adds `Zend\Feed\Reader\Extension\Podcast\Feed::getPodcastType()`, corresponding to the + `itunes:type` tag, and providing the podcast type (one of "serial" or "episodic", defaulting + to the latter). + +### Changed + +- [#77](https://github.com/zendframework/zend-feed/pull/77) updates URI validation for `Zend\Feed\Writer\Extension\ITunes\Feed::setItunesImage()` to + first check that we have received a string value before proceeding. + +### Deprecated + +- [#75](https://github.com/zendframework/zend-feed/pull/75) deprecates each of: + - `Zend\Feed\Reader\Extension\Podcast\Entry::getKeywords()` + - `Zend\Feed\Reader\Extension\Podcast\Feed::getKeywords()` + - `Zend\Feed\Writer\Extension\ITunes\Entry::setKeywords()` + - `Zend\Feed\Writer\Extension\ITunes\Feed::setKeywords()` + as the iTunes Podcast RSS specification no longer supports keywords. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 2.9.1 - 2018-05-14 + +### Added + +- Nothing. + +### Changed + +- [#16](https://github.com/zendframework/zend-feed/pull/16) updates the `Zend\Feed\Pubsubhubbub\AbstractCallback` to no longer use the + `$GLOBALS['HTTP_RAW_POST_DATA']` value as a fallback when `php://input` is + empty. The fallback existed because, prior to PHP 5.6, `php://input` could + only be read once. As we now require PHP 5.6, the fallback is unnecessary, + and best removed as the globals value is deprecated. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#68](https://github.com/zendframework/zend-feed/pull/68) fixes the behavior of `Zend\Feed\Writer\AbstractFeed::setTitle()` and + `Zend\Feed\Writer\Entry::setTitle()` to accept the string `"0"`. + +- [#68](https://github.com/zendframework/zend-feed/pull/68) updates both `Zend\Feed\Writer\AbstractFeed` and `Zend\Feed\Writer\Entry` + to no longer throw an exception for entry titles which have a string value of `0`. + +## 2.9.0 - 2017-12-04 + +### Added + +- [#52](https://github.com/zendframework/zend-feed/pull/52) adds support for PHP + 7.2 + +- [#53](https://github.com/zendframework/zend-feed/pull/53) adds a number of + additional aliases to the `Writer\ExtensionPluginManager` to ensure plugins + will be pulled as expected. + +- [#63](https://github.com/zendframework/zend-feed/pull/63) adds the feed title + to the attributes incorporated in the `FeedSet` instance, per what was already + documented. + +- [#55](https://github.com/zendframework/zend-feed/pull/55) makes two API + additions to the `StandaloneExtensionManager` implementations of both the reader + and writer subcomponents: + + - `$manager->add($name, $class)` will add an extension class using the + provided name. + - `$manager->remove($name)` will remove an existing extension by the provided + name. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- [#52](https://github.com/zendframework/zend-feed/pull/52) removes support for + HHVM. + +### Fixed + +- [#50](https://github.com/zendframework/zend-feed/pull/50) fixes a few issues + in the PubSubHubbub `Subscription` model where counting was being performed on + uncountable data; this ensures the subcomponent will work correctly under PHP + 7.2. + +## 2.8.0 - 2017-04-02 + +### Added + +- [#27](https://github.com/zendframework/zend-feed/pull/27) adds a documentation + chapter demonstrating wrapping a PSR-7 client to use with `Zend\Feed\Reader`. +- [#22](https://github.com/zendframework/zend-feed/pull/22) adds missing + ExtensionManagerInterface on Writer\ExtensionPluginManager. +- [#32](https://github.com/zendframework/zend-feed/pull/32) adds missing + ExtensionManagerInterface on Reader\ExtensionPluginManager. + +### Deprecated + +- Nothing. + +### Removed + +- [#38](https://github.com/zendframework/zend-feed/pull/38) dropped php 5.5 + support + +### Fixed + +- [#35](https://github.com/zendframework/zend-feed/pull/35) fixed + "A non-numeric value encountered" in php 7.1 +- [#39](https://github.com/zendframework/zend-feed/pull/39) fixed protocol + relative link absolutisation +- [#40](https://github.com/zendframework/zend-feed/pull/40) fixed service + manager v3 compatibility aliases in extension plugin managers + ## 2.7.0 - 2016-02-11 ### Added diff --git a/vendor/zendframework/zend-feed/CONTRIBUTING.md b/vendor/zendframework/zend-feed/CONTRIBUTING.md deleted file mode 100644 index e964373fc18b2a9bbcf3ab1ae81d7af7a1d8d7d3..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/CONTRIBUTING.md +++ /dev/null @@ -1,229 +0,0 @@ -# CONTRIBUTING - -## RESOURCES - -If you wish to contribute to Zend Framework, please be sure to -read/subscribe to the following resources: - - - [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards) - - [Contributor's Guide](http://framework.zend.com/participate/contributor-guide) - - ZF Contributor's mailing list: - Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html - Subscribe: zf-contributors-subscribe@lists.zend.com - - ZF Contributor's IRC channel: - #zftalk.dev on Freenode.net - -If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-feed/issues/new). - -## Reporting Potential Security Issues - -If you have encountered a potential security vulnerability, please **DO NOT** report it on the public -issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead. -We will work with you to verify the vulnerability and patch it as soon as possible. - -When reporting issues, please provide the following information: - -- Component(s) affected -- A description indicating how to reproduce the issue -- A summary of the security vulnerability and impact - -We request that you contact us via the email address above and give the project -contributors a chance to resolve the vulnerability and issue a new release prior -to any public exposure; this helps protect users and provides them with a chance -to upgrade and/or update in order to protect their applications. - -For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc). - -## RUNNING TESTS - -> ### Note: testing versions prior to 2.4 -> -> This component originates with Zend Framework 2. During the lifetime of ZF2, -> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no -> changes were necessary. However, due to the migration, tests may not run on -> versions < 2.4. As such, you may need to change the PHPUnit dependency if -> attempting a fix on such a version. - -To run tests: - -- Clone the repository: - - ```console - $ git clone git@github.com:zendframework/zend-feed.git - $ cd - ``` - -- Install dependencies via composer: - - ```console - $ curl -sS https://getcomposer.org/installer | php -- - $ ./composer.phar install - ``` - - If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/ - -- Run the tests via `phpunit` and the provided PHPUnit config, like in this example: - - ```console - $ ./vendor/bin/phpunit - ``` - -You can turn on conditional tests with the phpunit.xml file. -To do so: - - - Copy `phpunit.xml.dist` file to `phpunit.xml` - - Edit `phpunit.xml` to enable any specific functionality you - want to test, as well as to provide test values to utilize. - -## Running Coding Standards Checks - -This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding -standards checks, and provides configuration for our selected checks. -`php-cs-fixer` is installed by default via Composer. - -To run checks only: - -```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs -``` - -To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run` -flag: - -```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs -``` - -If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure -they pass, and make sure you add and commit the changes after verification. - -## Recommended Workflow for Contributions - -Your first step is to establish a public repository from which we can -pull your work into the master repository. We recommend using -[GitHub](https://github.com), as that is where the component is already hosted. - -1. Setup a [GitHub account](http://github.com/), if you haven't yet -2. Fork the repository (http://github.com/zendframework/zend-feed) -3. Clone the canonical repository locally and enter it. - - ```console - $ git clone git://github.com:zendframework/zend-feed.git - $ cd zend-feed - ``` - -4. Add a remote to your fork; substitute your GitHub username in the command - below. - - ```console - $ git remote add {username} git@github.com:{username}/zend-feed.git - $ git fetch {username} - ``` - -### Keeping Up-to-Date - -Periodically, you should update your fork or personal repository to -match the canonical ZF repository. Assuming you have setup your local repository -per the instructions above, you can do the following: - - -```console -$ git checkout master -$ git fetch origin -$ git rebase origin/master -# OPTIONALLY, to keep your remote up-to-date - -$ git push {username} master:master -``` - -If you're tracking other branches -- for example, the "develop" branch, where -new feature development occurs -- you'll want to do the same operations for that -branch; simply substitute "develop" for "master". - -### Working on a patch - -We recommend you do each new feature or bugfix in a new branch. This simplifies -the task of code review as well as the task of merging your changes into the -canonical repository. - -A typical workflow will then consist of the following: - -1. Create a new local branch based off either your master or develop branch. -2. Switch to your new local branch. (This step can be combined with the - previous step with the use of `git checkout -b`.) -3. Do some work, commit, repeat as necessary. -4. Push the local branch to your remote repository. -5. Send a pull request. - -The mechanics of this process are actually quite trivial. Below, we will -create a branch for fixing an issue in the tracker. - -```console -$ git checkout -b hotfix/9295 -Switched to a new branch 'hotfix/9295' -``` - -... do some work ... - - -```console -$ git commit -``` - -... write your log message ... - - -```console -$ git push {username} hotfix/9295:hotfix/9295 -Counting objects: 38, done. -Delta compression using up to 2 threads. -Compression objects: 100% (18/18), done. -Writing objects: 100% (20/20), 8.19KiB, done. -Total 20 (delta 12), reused 0 (delta 0) -To ssh://git@github.com/{username}/zend-feed.git - b5583aa..4f51698 HEAD -> master -``` - -To send a pull request, you have two options. - -If using GitHub, you can do the pull request from there. Navigate to -your repository, select the branch you just created, and then select the -"Pull Request" button in the upper right. Select the user/organization -"zendframework" as the recipient. - -If using your own repository - or even if using GitHub - you can use `git -format-patch` to create a patchset for us to apply; in fact, this is -**recommended** for security-related patches. If you use `format-patch`, please -send the patches as attachments to: - -- zf-devteam@zend.com for patches without security implications -- zf-security@zend.com for security patches - -#### What branch to issue the pull request against? - -Which branch should you issue a pull request against? - -- For fixes against the stable release, issue the pull request against the - "master" branch. -- For new features, or fixes that introduce new elements to the public API (such - as new public methods or properties), issue the pull request against the - "develop" branch. - -### Branch Cleanup - -As you might imagine, if you are a frequent contributor, you'll start to -get a ton of branches both locally and on your remote. - -Once you know that your changes have been accepted to the master -repository, we suggest doing some cleanup of these branches. - -- Local branch cleanup - - ```console - $ git branch -d <branchname> - ``` - -- Remote branch removal - - ```console - $ git push {username} :<branchname> - ``` diff --git a/vendor/zendframework/zend-feed/LICENSE.md b/vendor/zendframework/zend-feed/LICENSE.md index dbb1b49c01421e18478507a9ef40b8087317c306..63df4102cd87e667fe362772cae2e2da82ab174a 100644 --- a/vendor/zendframework/zend-feed/LICENSE.md +++ b/vendor/zendframework/zend-feed/LICENSE.md @@ -1,16 +1,15 @@ -Copyright (c) 2005-2015, Zend Technologies USA, Inc. - +Copyright (c) 2005-2017, Zend Technologies USA, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. +- Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. - Neither the name of Zend Technologies USA, Inc. nor the names of its contributors may be used to endorse or promote products derived from this diff --git a/vendor/zendframework/zend-feed/README.md b/vendor/zendframework/zend-feed/README.md index 3e2afd557273c7fb9e6e3fad65908dfdc5001bef..1c4bd38909b14450dbc18441d86064ef7addd5bc 100644 --- a/vendor/zendframework/zend-feed/README.md +++ b/vendor/zendframework/zend-feed/README.md @@ -1,13 +1,12 @@ # zend-feed [](https://secure.travis-ci.org/zendframework/zend-feed) -[](https://coveralls.io/r/zendframework/zend-feed?branch=master) +[](https://coveralls.io/github/zendframework/zend-feed?branch=master) `Zend\Feed` provides functionality for consuming RSS and Atom feeds. It provides a natural syntax for accessing elements of feeds, feed attributes, and entry attributes. `Zend\Feed` also has extensive support for modifying feed and entry structure with the same natural syntax, and turning the result back into XML. - - File issues at https://github.com/zendframework/zend-feed/issues -- Documentation is at https://zendframework.github.io/zend-feed/ +- Documentation is at https://docs.zendframework.com/zend-feed/ diff --git a/vendor/zendframework/zend-feed/composer.json b/vendor/zendframework/zend-feed/composer.json index 0183b5d72dd13b594f8a9dc063413b3436fe256e..aa16a63fa6412b7603d5c3cb76066d938f2518e9 100644 --- a/vendor/zendframework/zend-feed/composer.json +++ b/vendor/zendframework/zend-feed/composer.json @@ -3,49 +3,70 @@ "description": "provides functionality for consuming RSS and Atom feeds", "license": "BSD-3-Clause", "keywords": [ - "zf2", + "zf", + "zendframework", "feed" ], - "homepage": "https://github.com/zendframework/zend-feed", - "autoload": { - "psr-4": { - "Zend\\Feed\\": "src/" - } + "support": { + "docs": "https://docs.zendframework.com/zend-feed/", + "issues": "https://github.com/zendframework/zend-feed/issues", + "source": "https://github.com/zendframework/zend-feed", + "rss": "https://github.com/zendframework/zend-feed/releases.atom", + "slack": "https://zendframework-slack.herokuapp.com", + "forum": "https://discourse.zendframework.com/c/questions/components" }, "require": { - "php": "^5.5 || ^7.0", - "zendframework/zend-escaper": "^2.5", - "zendframework/zend-stdlib": "^2.7 || ^3.0" + "php": "^5.6 || ^7.0", + "ext-dom": "*", + "ext-libxml": "*", + "zendframework/zend-escaper": "^2.5.2", + "zendframework/zend-stdlib": "^3.2.1" }, "require-dev": { - "zendframework/zend-db": "^2.5", - "zendframework/zend-cache": "^2.5", - "zendframework/zend-http": "^2.5", - "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", - "zendframework/zend-validator": "^2.5", - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/PHPUnit": "~4.0", - "psr/http-message": "^1.0" + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "psr/http-message": "^1.0.1", + "zendframework/zend-cache": "^2.7.2", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-db": "^2.8.2", + "zendframework/zend-http": "^2.7", + "zendframework/zend-servicemanager": "^2.7.8 || ^3.3", + "zendframework/zend-validator": "^2.10.1" }, "suggest": { - "psr/http-message": "PSR-7 ^1.0, if you wish to use Zend\\Feed\\Reader\\Http\\Psr7ResponseDecorator", + "psr/http-message": "PSR-7 ^1.0.1, if you wish to use Zend\\Feed\\Reader\\Http\\Psr7ResponseDecorator", "zendframework/zend-cache": "Zend\\Cache component, for optionally caching feeds between requests", "zendframework/zend-db": "Zend\\Db component, for use with PubSubHubbub", "zendframework/zend-http": "Zend\\Http for PubSubHubbub, and optionally for use with Zend\\Feed\\Reader", "zendframework/zend-servicemanager": "Zend\\ServiceManager component, for easily extending ExtensionManager implementations", - "zendframework/zend-validator": "Zend\\Validator component, for validating email addresses used in Atom feeds and entries ehen using the Writer subcomponent" + "zendframework/zend-validator": "Zend\\Validator component, for validating email addresses used in Atom feeds and entries when using the Writer subcomponent" }, - "minimum-stability": "dev", - "prefer-stable": true, - "extra": { - "branch-alias": { - "dev-master": "2.7-dev", - "dev-develop": "2.8-dev" + "autoload": { + "psr-4": { + "Zend\\Feed\\": "src/" } }, "autoload-dev": { "psr-4": { "ZendTest\\Feed\\": "test/" } + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "2.12.x-dev", + "dev-develop": "2.13.x-dev" + } + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" } } diff --git a/vendor/zendframework/zend-feed/doc/book/consuming-atom-entry.md b/vendor/zendframework/zend-feed/doc/book/consuming-atom-entry.md deleted file mode 100644 index 280e32bd7785c480fbd367a4f4315febb790e7e3..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/consuming-atom-entry.md +++ /dev/null @@ -1,23 +0,0 @@ -# Consuming a Single Atom Entry - -Single Atom `<entry>` elements are also valid by themselves. Usually the URL for -an entry is the feed's URL followed by `/<entryId>`, such as -`http://atom.example.com/feed/1`, using the example URL we used above. This -pattern may exist for some web services which use Atom as a container syntax. - -If you read a single entry, you will have a `Zend\Feed\Reader\Entry\Atom` object. - -## Reading a Single-Entry Atom Feed - -```php -$entry = Zend\Feed\Reader\Reader::import('http://atom.example.com/feed/1'); -echo 'Entry title: ' . $entry->getTitle(); -``` - -> ## Importing requires an HTTP client -> -> To import a feed, you will need to have an [HTTP client](zend.feed.http-clients) -> available. -> -> If you are not using zend-http, you will need to inject `Reader` with the HTTP -> client. See the [section on providing a client to Reader](http-clients.md#providing-a-client-to-reader). diff --git a/vendor/zendframework/zend-feed/doc/book/consuming-atom.md b/vendor/zendframework/zend-feed/doc/book/consuming-atom.md deleted file mode 100644 index fdee05ac191a0abbc9395e4dfe4961aec5a54b05..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/consuming-atom.md +++ /dev/null @@ -1,62 +0,0 @@ -# Consuming Atom Feeds - -`Zend\Feed\Reader\Feed\Atom` is used in much the same way as -`Zend\Feed\Reader\Feed\Rss`. It provides the same access to feed-level -properties and iteration over entries in the feed. The main difference is in the -structure of the Atom protocol itself. Atom is a successor to RSS; it is a -more generalized protocol and it is designed to deal more easily with feeds that -provide their full content inside the feed, splitting RSS' `description` tag -into two elements, `summary` and `content`, for that purpose. - -## Basic Use of an Atom Feed - -Read an Atom feed and print the `title` and `summary` of each entry: - -```php -$feed = Zend\Feed\Reader\Reader::import('http://atom.example.com/feed/'); -echo 'The feed contains ' . $feed->count() . ' entries.' . "\n\n"; -foreach ($feed as $entry) { - echo 'Title: ' . $entry->getTitle() . "\n"; - echo 'Description: ' . $entry->getDescription() . "\n"; - echo 'URL: ' . $entry->getLink() . "\n\n"; -} -``` - -> ## Importing requires an HTTP client -> -> To import a feed, you will need to have an [HTTP client](zend.feed.http-clients) -> available. -> -> If you are not using zend-http, you will need to inject `Reader` with the HTTP -> client. See the [section on providing a client to Reader](http-clients.md#providing-a-client-to-reader). - -In an Atom feed, you can expect to find the following feed properties: - -- `title`: The feed's title, same as RSS' channel title. -- `id`: Every feed and entry in Atom has a unique identifier. -- `link`: Feeds can have multiple links, which are distinguished by a `type` - attribute. The equivalent to RSS's channel link would be `type="text/html"`. - If the link is to an alternate version of the same content that's in the feed, - it would have a `rel="alternate"` attribute. -- `subtitle`: The feed's description, equivalent to RSS' channel description. -- `author`: The feed's author, with `name` and `email` sub-tags. - -Atom entries commonly have the following properties: - -- `id`: The entry's unique identifier. -- `title`: The entry's title, same as RSS item titles. -- `link`: A link to another format or an alternate view of this entry. - The link property of an atom entry typically has an `href` attribute. -- `summary`: A summary of this entry's content. -- `content`: The full content of the entry; can be skipped if the feed just - contains summaries. -- `author`: with `name` and `email` sub-tags like feeds have. -- `published`: the date the entry was published, in RFC 3339 format. -- `updated`: the date the entry was last updated, in RFC 3339 format. - -Where relevant, `Zend\Feed` supports a number of common RSS extensions including -Dublin Core; Content, Slash, Syndication, and Syndication/Thread; and several -others in common use on blogs. - -For more information on Atom and plenty of resources, see -[http://www.atomenabled.org/](http://www.atomenabled.org/). diff --git a/vendor/zendframework/zend-feed/doc/book/consuming-rss.md b/vendor/zendframework/zend-feed/doc/book/consuming-rss.md deleted file mode 100644 index f965a0c4fe25e09fa641933526179171aa7b790a..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/consuming-rss.md +++ /dev/null @@ -1,99 +0,0 @@ -# Consuming RSS Feeds - -## Reading a feed - -To read an RSS feed, pass its URL to `Zend\Feed\Reader\Reader::import()`: - -```php -$channel = Zend\Feed\Reader\Reader::import('http://rss.example.com/channelName'); -``` - -> ## Importing requires an HTTP client -> -> To import a feed, you will need to have an [HTTP client](zend.feed.http-clients) -> available. -> -> If you are not using zend-http, you will need to inject `Reader` with the HTTP -> client. See the [section on providing a client to Reader](http-clients.md#providing-a-client-to-reader). - -If any errors occur fetching the feed, a -`Zend\Feed\Reader\Exception\RuntimeException` will be thrown. - -## Get properties - -Once you have a feed object, you can access any of the standard RSS channel -properties via the various instance getter methods: - -```php -echo $channel->getTitle(); -echo $channel->getAuthor(); -// etc. -``` - -If channel properties have attributes, the getter method will return a key/value -pair, where the key is the attribute name, and the value is the attribute value. - -```php -$author = $channel->getAuthor(); -echo $author['name']; -``` - -Most commonly, you'll want to loop through the feed and do something with its -entries. `Zend\Feed\Reader\Feed\Rss` internally converts all entries to a -`Zend\Feed\Reader\Entry\Rss` instance. Entry properties, similarly to channel -properties, can be accessed via getter methods, such as `getTitle`, -`getDescription`, etc. - -An example of printing all titles of articles in a channel is: - -```php -foreach ($channel as $item) { - echo $item->getTitle() . "\n"; -} -``` - -If you are not familiar with RSS, here are the standard elements you can expect -to be available in an RSS channel and in individual RSS items (entries). - -Required channel elements: - -- `title`: The name of the channel. -- `link`: The URL of the web site corresponding to the channel. -- `description`: A sentence (or more) describing the channel. - -Common optional channel elements: - -- `pubDate`: The publication date of this set of content, in RFC 822 date - format. -- `language`: The language the channel is written in. -- `category`: One or more (specified by multiple tags) categories the channel - belongs to. - -RSS `<item>` elements do not have any strictly required elements. However, -either `title` or `description` must be present. - -Common item elements: - -- `title`: The title of the item. -- `link`: The URL of the item. -- `description`: A synopsis of the item. -- `author`: The author's email address. -- `category`: One more categories that the item belongs to. -- `comments`: URL of comments relating to this item. -- `pubDate`: The date the item was published, in RFC 822 date format. - -In your code you can always test to see if an element is non-empty by calling -the getter: - -```php -if ($item->getPropname()) { - // ... proceed. -} -``` - -Where relevant, `Zend\Feed` supports a number of common RSS extensions including -Dublin Core, Atom (inside RSS); the Content, Slash, Syndication, -Syndication/Thread extensions; as well as several others. - -Please see the official [RSS 2.0 specification](http://cyber.law.harvard.edu/rss/rss.html) -for further information. diff --git a/vendor/zendframework/zend-feed/doc/book/find-feeds.md b/vendor/zendframework/zend-feed/doc/book/find-feeds.md deleted file mode 100644 index 0f934072bb616eaeb6bc6f90d439a78814840ff1..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/find-feeds.md +++ /dev/null @@ -1,48 +0,0 @@ -# Feed Discovery from Web Pages - -Web pages often contain `<link>` tags that refer to feeds with content relevant -to the particular page. `Zend\Feed\Reader\Reader` enables you to retrieve all -feeds referenced by a web page with one method call: - -```php -$feedLinks = Zend\Feed\Reader\Reader::findFeedLinks('http://www.example.com/news.html'); -``` - -> ## Finding feed links requires an HTTP client -> -> To find feed links, you will need to have an [HTTP client](zend.feed.http-clients) -> available. -> -> If you are not using zend-http, you will need to inject `Reader` with the HTTP -> client. See the [section on providing a client to Reader](http-clients.md#providing-a-client-to-reader). - -Here the `findFeedLinks()` method returns a `Zend\Feed\Reader\FeedSet` object, -which is in turn a collection of other `Zend\Feed\Reader\FeedSet` objects, each -referenced by `<link>` tags on the `news.html` web page. -`Zend\Feed\Reader\Reader` will throw a -`Zend\Feed\Reader\Exception\RuntimeException` upon failure, such as an HTTP -404 response code or a malformed feed. - -You can examine all feed links located by iterating across the collection: - -```php -$rssFeed = null; -$feedLinks = Zend\Feed\Reader\Reader::findFeedLinks('http://www.example.com/news.html'); -foreach ($feedLinks as $link) { - if (stripos($link['type'], 'application/rss+xml') !== false) { - $rssFeed = $link['href']; - break; -} -``` - -Each `Zend\Feed\Reader\FeedSet` object will expose the `rel`, `href`, `type`, -and `title` properties of detected links for all RSS, Atom, or RDF feeds. You -can always select the first encountered link of each type by using a shortcut: -the first encountered link of a given type is assigned to a property named after -the feed type. - -```php -$rssFeed = null; -$feedLinks = Zend\Feed\Reader\Reader::findFeedLinks('http://www.example.com/news.html'); -$firstAtomFeed = $feedLinks->atom; -``` diff --git a/vendor/zendframework/zend-feed/doc/book/http-clients.md b/vendor/zendframework/zend-feed/doc/book/http-clients.md deleted file mode 100644 index 9b93634980e1ed19545d3cf6cd6534c9c26a88ad..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/http-clients.md +++ /dev/null @@ -1,236 +0,0 @@ -# HTTP Clients and zend-feed - -Several operations in zend-feed's Reader subcomponent require an HTTP client: - -- importing a feed -- finding links in a feed - -In order to allow developers a choice in HTTP clients, the subcomponent defines -several interfaces and classes. Elsewhere in the documentation, we reference -where an HTTP client may be used; this document details what constitutes an HTTP -client and its behavior, and some of the concrete classes available within the -component for implementing this behavior. - -## ClientInterface and HeaderAwareClientInterface - -First, we define two interfaces for clients, -`Zend\Feed\Reader\Http\ClientInterface` and `HeaderAwareClientInterface`: - -```php -namespace Zend\Feed\Reader\Http; - -interface ClientInterface -{ - /** - * Make a GET request to a given URL. - * - * @param string $url - * @return ResponseInterface - */ - public function get($url); -} - -interface HeaderAwareClientInterface extends ClientInterface -{ - /** - * Make a GET request to a given URL. - * - * @param string $url - * @param array $headers - * @return ResponseInterface - */ - public function get($url, array $headers = []); -} -``` - -The first is header-agnostic, and assumes that the client will simply perform an -HTTP GET request. The second allows providing headers to the client; typically, -these are used for HTTP caching headers. `$headers` must be in the following -structure: - -```php -$headers = [ - 'X-Header-Name' => [ - 'header', - 'values', - ], -]; -``` - -i.e., each key is a header name, and each value is an array of values for that -header. If the header represents only a single value, it should be an array with -that value: - -```php -$headers = [ - 'Accept' => [ 'application/rss+xml' ], -]; -``` - -A call to `get()` should yield a *response*. - -## ResponseInterface and HeaderAwareResponseInterface - -Responses are modeled using `Zend\Feed\Reader\Http\ResponseInterface` and -`HeaderAwareResponseInterface`: - -```php -namespace Zend\Feed\Reader\Http; - -class ResponseInterface -{ - /** - * Retrieve the status code. - * - * @return int - */ - public function getStatusCode(); - - /** - * Retrieve the response body contents. - * - * @return string - */ - public function getBody(); -} - -class HeaderAwareResponseInterface extends ResponseInterface -{ - /** - * Retrieve a named header line. - * - * Retrieve a header by name; all values MUST be concatenated to a single - * line. If no matching header is found, return the $default value. - * - * @param string $name - * @param null|string $default - * @return string - public function getHeaderLine($name, $default = null); -} -``` - -Internally, `Reader` will typehint against `ClientInterface` for the bulk of -operations. In some cases, however, certain capabilities are only possible if -the response can provide headers (e.g., for caching); in such cases, it will -check the instance against `HeaderAwareResponseInterface`, and only call -`getHeaderLine()` if it matches. - -## Response - -zend-feed ships with a generic `ResponseInterface` implementation, -`Zend\Feed\Http\Response`. It implements `HeaderAwareResponseInterface`, and -defines the following constructor: - -```php -namespace Zend\Feed\Reader\Http; - -class Response implements HeaderAwareResponseInterface -{ - /** - * Constructor - * - * @param int $statusCode Response status code - * @param string $body Response body - * @param array $headers Response headers, if available - */ - public function __construct($statusCode, $body, array $headers = []); -} -``` - -## PSR-7 Response - -[PSR-7](http://www.php-fig.org/psr/psr-7/) defines a set of HTTP message -interfaces, but not a client interface. To facilitate wrapping an HTTP client -that uses PSR-7 messages, we provide `Zend\Feed\Reader\Psr7ResponseDecorator`: - -```php -namespace Zend\Feed\Reader\Http; - -use Psr\Http\Message\ResponseInterface as PsrResponseInterface; - -class Psr7ResponseDecorator implements HeaderAwareResponseInterface -{ - /** - * @param PsrResponseInterface $response - */ - public function __construct(PsrResponseInterface $response); - - /** - * @return PsrResponseInterface - */ - public function getDecoratedResponse(); -} -``` - -Clients can then take the PSR-7 response they receive, pass it to the decorator, -and return the decorator. - -To use the PSR-7 response, you will need to add the PSR-7 interfaces to your -application, if they are not already installed by the client of your choice: - -```bash -$ composer require psr/http-message -``` - -## zend-http - -We also provide a zend-http client decorator, -`Zend\Feed\Reader\Http\ZendHttpClientDecorator`: - -```php -namespace Zend\Feed\Reader\Http; - -use Zend\Http\Client as HttpClient; - -class ZendHttpClientDecorator implements HeaderAwareClientInterface -{ - /** - * @param HttpClient $client - */ - public function __construct(HttpClient $client); - - /** - * @return HttpClient - */ - public function getDecoratedClient(); -} -``` - -Its `get()` implementation returns a `Response` instance seeded from the -zend-http response returned, including status, body, and headers. - -zend-http is the default implementation assumed by `Zend\Feed\Reader\Reader`, -but *is not installed by default*. You may install it using composer: - -```bash -$ composer require zendframework/zend-http -``` - -## Providing a client to Reader - -By default, `Zend\Feed\Reader\Reader` will lazy load a zend-http client. If you -have not installed zend-http, however, PHP will raise an error indicating the -class is not found! - -As such, you have two options: - -1. Install zend-http: `composer require zendframework/zend-http`. -2. Inject the `Reader` with your own HTTP client. - -To accomplish the second, you will need an implementation of -`Zend\Feed\Reader\Http\ClientInterface` or `HeaderAwareClientInterface`, and an -instance of that implementation. Once you do, you can use the static method -`setHttpClient()` to inject it. - -As an example, let's say you've created a PSR-7-based implementation named -`My\Http\Psr7FeedClient`. You could then do the following: - -```php -use My\Http\Psr7FeedClient; -use Zend\Feed\Reader\Reader; - -Reader::setHttpClient(new Psr7FeedClient()); -``` - -Your client will then be used for all `import()` and `findFeedLinks()` -operations. diff --git a/vendor/zendframework/zend-feed/doc/book/importing.md b/vendor/zendframework/zend-feed/doc/book/importing.md deleted file mode 100644 index 52b58936def80e37aabcba3d41de22708cca955f..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/importing.md +++ /dev/null @@ -1,49 +0,0 @@ -# Importing Feeds - -`Zend\Feed` enables developers to retrieve feeds via `Zend\Feader\Reader`. If -you know the URI of a feed, use the `Zend\Feed\Reader\Reader::import()` method -to consume it: - -```php -$feed = Zend\Feed\Reader\Reader::import('http://feeds.example.com/feedName'); -``` - -> ## Importing requires an HTTP client -> -> To import a feed, you will need to have an [HTTP client](zend.feed.http-clients) -> available. -> -> If you are not using zend-http, you will need to inject `Reader` with the HTTP -> client. See the [section on providing a client to Reader](http-clients.md#providing-a-client-to-reader). - -You can also use `Zend\Feed\Reader\Reader` to fetch the contents of a feed from -a file or the contents of a PHP string variable: - -```php -// importing a feed from a text file -$feedFromFile = Zend\Feed\Reader\Reader::importFile('feed.xml'); - -// importing a feed from a PHP string variable -$feedFromPHP = Zend\Feed\Reader\Reader::importString($feedString); -``` - -In each of the examples above, an object of a class that extends -`Zend\Feed\Reader\Feed\AbstractFeed` is returned upon success, depending on the -type of the feed. If an RSS feed were retrieved via one of the import methods -above, then a `Zend\Feed\Reader\Feed\Rss` object would be returned. On the other -hand, if an Atom feed were imported, then a `Zend\Feed\Reader\Feed\Atom` object -is returned. The import methods will also throw a -`Zend\Feed\Exception\Reader\RuntimeException` object upon failure, such as an -unreadable or malformed feed. - -## Dumping the contents of a feed - -To dump the contents of a `Zend\Feed\Reader\Feed\AbstractFeed` instance, you may -use the `saveXml()` method. - -```php -assert($feed instanceof Zend\Feed\Reader\Feed\AbstractFeed); - -// dump the feed to standard output -print $feed->saveXml(); -``` diff --git a/vendor/zendframework/zend-feed/doc/book/index.html b/vendor/zendframework/zend-feed/doc/book/index.html deleted file mode 100644 index f05b9c1100ae77e41ef829c5afd34a23e64677dd..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/index.html +++ /dev/null @@ -1,10 +0,0 @@ -<div class="container"> - <div class="jumbotron"> - <h1>zend-feed</h1> - - <p>Consume and generate Atom and RSS feeds, and interact with Pubsubhubbub.</p> - - <pre><code class="language-bash">$ composer require zendframework/zend-feed</code></pre> - </div> -</div> - diff --git a/vendor/zendframework/zend-feed/doc/book/index.md b/vendor/zendframework/zend-feed/doc/book/index.md deleted file mode 100644 index 3e2afd557273c7fb9e6e3fad65908dfdc5001bef..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# zend-feed - -[](https://secure.travis-ci.org/zendframework/zend-feed) -[](https://coveralls.io/r/zendframework/zend-feed?branch=master) - -`Zend\Feed` provides functionality for consuming RSS and Atom feeds. It provides -a natural syntax for accessing elements of feeds, feed attributes, and entry -attributes. `Zend\Feed` also has extensive support for modifying feed and entry -structure with the same natural syntax, and turning the result back into XML. - - -- File issues at https://github.com/zendframework/zend-feed/issues -- Documentation is at https://zendframework.github.io/zend-feed/ diff --git a/vendor/zendframework/zend-feed/doc/book/intro.md b/vendor/zendframework/zend-feed/doc/book/intro.md deleted file mode 100644 index 784aac8f5a36322db5ed2a331e3704772393994c..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/intro.md +++ /dev/null @@ -1,62 +0,0 @@ -# Introduction - -`Zend\Feed` provides functionality for consuming RSS and Atom feeds. It provides -a natural syntax for accessing elements of feeds, feed attributes, and entry -attributes. `Zend\Feed` also has extensive support for modifying feed and entry -structure with the same natural syntax, and turning the result back into XML. -In the future, this modification support could provide support for the Atom -Publishing Protocol. - -`Zend\Feed` consists of `Zend\Feed\Reader` for reading RSS and Atom feeds, -`Zend\Feed\Writer` for writing RSS and Atom feeds, and `Zend\Feed\PubSubHubbub` -for working with Hub servers. Furthermore, both `Zend\Feed\Reader` and -`Zend\Feed\Writer` support extensions which allows for working with additional -data in feeds, not covered in the core API but used in conjunction with RSS and -Atom feeds. - -In the example below, we demonstrate a simple use case of retrieving an RSS feed -and saving relevant portions of the feed data to a simple PHP array, which could -then be used for printing the data, storing to a database, etc. - -> ## RSS optional properties -> -> Many *RSS* feeds have different channel and item properties available. The -> *RSS* specification provides for many optional properties, so be aware of this -> when writing code to work with *RSS* data. `Zend\Feed` supports all optional -> properties of the core *RSS* and *Atom* specifications. - -## Reading RSS Feed Data - -```php -// Fetch the latest Slashdot headlines -try { - $slashdotRss = - Zend\Feed\Reader\Reader::import('http://rss.slashdot.org/Slashdot/slashdot'); -} catch (Zend\Feed\Reader\Exception\RuntimeException $e) { - // feed import failed - echo "Exception caught importing feed: {$e->getMessage()}\n"; - exit; -} - -// Initialize the channel/feed data array -$channel = [ - 'title' => $slashdotRss->getTitle(), - 'link' => $slashdotRss->getLink(), - 'description' => $slashdotRss->getDescription(), - 'items' => [], -]; - -// Loop over each channel item/entry and store relevant data for each -foreach ($slashdotRss as $item) { - $channel['items'][] = [ - 'title' => $item->getTitle(), - 'link' => $item->getLink(), - 'description' => $item->getDescription(), - ]; -} -``` - -Your `$channel` array now contains the basic meta-information for the RSS -channel and all items that it contained. The process is identical for Atom -feeds since `Zend\Feed` provides a common feed API; i.e. all getters and -setters are the same regardless of feed format. diff --git a/vendor/zendframework/zend-feed/doc/book/pubsubhubbub.md b/vendor/zendframework/zend-feed/doc/book/pubsubhubbub.md deleted file mode 100644 index c5719fa44a8bbc26a842db0676cd5e3d8384b002..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/pubsubhubbub.md +++ /dev/null @@ -1,452 +0,0 @@ -# Zend\\Feed\\PubSubHubbub - -`Zend\Feed\PubSubHubbub` is an implementation of the [PubSubHubbub Core 0.2/0.3 -Specification (Working Draft)](http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.3.html). -It offers implementations of a Pubsubhubbub Publisher and Subscriber suited to -PHP applications. - -## What is PubSubHubbub? - -Pubsubhubbub is an open, simple, web-scale, pubsub protocol. A common use case -to enable blogs (Publishers) to "push" updates from their RSS or Atom feeds -(Topics) to end Subscribers. These Subscribers will have subscribed to the -blog's RSS or Atom feed via a Hub, a central server which is notified of any -updates by the Publisher, and which then distributes these updates to all -Subscribers. Any feed may advertise that it supports one or more Hubs using an -Atom namespaced link element with a rel attribute of "hub" (i.e., `rel="hub"`). - -Pubsubhubbub has garnered attention because it is a pubsub protocol which is -easy to implement and which operates over HTTP. Its philosophy is to replace the -traditional model where blog feeds have been polled at regular intervals to -detect and retrieve updates. Depending on the frequency of polling, this can -take a lot of time to propagate updates to interested parties from planet -aggregators to desktop readers. With a pubsub system in place, updates are not -simply polled by Subscribers, they are pushed to Subscribers, eliminating any -delay. For this reason, Pubsubhubbub forms part of what has been dubbed the -real-time web. - -The protocol does not exist in isolation. Pubsub systems have been around for a -while, such as the familiar Jabber Publish-Subscribe protocol, -[XEP-0060](http://www.xmpp.org/extensions/xep-0060.html), or the less well-known -[rssCloud](http://www.rssboard.org/rsscloud-interface) (described in 2001). -However, these have not achieved widespread adoption due to either their -complexity, poor timing, or lack of suitability for web applications. rssCloud, -which was recently revived as a response to the appearance of Pubsubhubbub, has -also seen its usage increase significantly, though it lacks a formal -specification and currently does not support Atom 1.0 feeds. - -Perhaps surprisingly given its relative early age, Pubsubhubbub is already in -use including in Google Reader and Feedburner, and there are plugins available -for Wordpress blogs. - -## Architecture - -`Zend\Feed\PubSubHubbub` implements two sides of the Pubsubhubbub 0.2/0.3 -Specification: a Publisher and a Subscriber. It does not currently implement a -Hub Server. - -A Publisher is responsible for notifying all supported Hubs (many can be -supported to add redundancy to the system) of any updates to its feeds, whether -they be Atom or RSS based. This is achieved by pinging the supported Hub Servers -with the URL of the updated feed. In Pubsubhubbub terminology, any updatable -resource capable of being subscribed to is referred to as a Topic. Once a ping -is received, the Hub will request the updated feed, process it for updated -items, and forward all updates to all Subscribers subscribed to that feed. - -A Subscriber is any party or application which subscribes to one or more Hubs to -receive updates from a Topic hosted by a Publisher. The Subscriber never -directly communicates with the Publisher since the Hub acts as an intermediary, -accepting subscriptions and sending updates to Subscribers. The Subscriber -therefore communicates only with the Hub, either to subscribe or unsubscribe to -Topics, or when it receives updates from the Hub. This communication design -("Fat Pings") effectively removes the possibility of a "Thundering Herd" issue. -(Thundering Herds occur in a pubsub system where the Hub merely informs -Subscribers that an update is available, prompting all Subscribers to -immediately retrieve the feed from the Publisher, giving rise to a traffic -spike.) In Pubsubhubbub, the Hub distributes the actual update in a "Fat Ping" -so the Publisher is not subjected to any traffic spike. - -`Zend\Feed\PubSubHubbub` implements Pubsubhubbub Publishers and Subscribers with -the classes `Zend\Feed\PubSubHubbub\Publisher` and -`Zend\Feed\PubSubHubbub\Subscriber`. In addition, the Subscriber implementation -may handle any feed updates forwarded from a Hub by using -`Zend\Feed\PubSubHubbub\Subscriber\Callback`. These classes, their use cases, -and etheir APIs are covered in subsequent sections. - -## Zend\\Feed\\PubSubHubbub\\Publisher - -In Pubsubhubbub, the Publisher is the party publishing a live feed with content -updates. This may be a blog, an aggregator, or even a web service with a public -feed based API. In order for these updates to be pushed to Subscribers, the -Publisher must notify all of its supported Hubs that an update has occurred -using a simple HTTP POST request containing the URI of the updated Topic (i.e., -the updated RSS or Atom feed). The Hub will confirm receipt of the notification, -fetch the updated feed, and forward any updates to any Subscribers who have -subscribed to that Hub for updates from the relevant feed. - -By design, this means the Publisher has very little to do except send these Hub -pings whenever its feeds change. As a result, the Publisher implementation is -extremely simple to use and requires very little work to setup and use when -feeds are updated. - -`Zend\Feed\PubSubHubbub\Publisher` implements a full Pubsubhubbub Publisher. Its -setup for use primarily requires that it is configured with the URI endpoint for -all Hubs to be notified of updates, and the URIs of all Topics to be included in -the notifications. - -The following example shows a Publisher notifying a collection of Hubs about -updates to a pair of local RSS and Atom feeds. The class retains a collection of -errors which include the Hub URLs, so that notification can be attempted again -later and/or logged if any notifications happen to fail. Each resulting error -array also includes a "response" key containing the related HTTP response -object. In the event of any errors, it is strongly recommended to attempt the -operation for failed Hub Endpoints at least once more at a future time. This may -require the use of either a scheduled task for this purpose or a job queue, -though such extra steps are optional. - -```php -use Zend\Feed\PubSubHubbub\Publisher; - -$publisher = Publisher; -$publisher->addHubUrls([ - 'http://pubsubhubbub.appspot.com/', - 'http://hubbub.example.com', -]); -$publisher->addUpdatedTopicUrls([ - 'http://www.example.net/rss', - 'http://www.example.net/atom', -]); -$publisher->notifyAll(); - -if (! $publisher->isSuccess()) { - // check for errors - $errors = $publisher->getErrors(); - $failedHubs = []; - foreach ($errors as $error) { - $failedHubs[] = $error['hubUrl']; - } -} - -// reschedule notifications for the failed Hubs in $failedHubs -``` - -If you prefer having more concrete control over the Publisher, the methods -`addHubUrls()` and `addUpdatedTopicUrls()` pass each array value to the singular -`addHubUrl()` and `addUpdatedTopicUrl()` public methods. There are also matching -`removeUpdatedTopicUrl()` and `removeHubUrl()` methods. - -You can also skip setting Hub URIs, and notify each in turn using the -`notifyHub()` method which accepts the URI of a Hub endpoint as its only -argument. - -There are no other tasks to cover. The Publisher implementation is very simple -since most of the feed processing and distribution is handled by the selected -Hubs. It is, however, important to detect errors and reschedule notifications as -soon as possible (with a reasonable maximum number of retries) to ensure -notifications reach all Subscribers. In many cases, as a final alternative, Hubs -may frequently poll your feeds to offer some additional tolerance for failures -both in terms of their own temporary downtime or Publisher errors or downtime. - -## Zend\\Feed\\PubSubHubbub\\Subscriber - -In Pubsubhubbub, the Subscriber is the party who wishes to receive updates to -any Topic (RSS or Atom feed). They achieve this by subscribing to one or more of -the Hubs advertised by that Topic, usually as a set of one or more Atom 1.0 -links with a rel attribute of "hub" (i.e., `rel="hub"`). The Hub from that point -forward will send an Atom or RSS feed containing all updates to that -Subscriber's callback URL when it receives an update notification from the -Publisher. In this way, the Subscriber need never actually visit the original -feed (though it's still recommended at some level to ensure updates are -retrieved if ever a Hub goes offline). All subscription requests must contain -the URI of the Topic being subscribed and a callback URL which the Hub will use -to confirm the subscription and to forward updates. - -The Subscriber therefore has two roles. The first is to *create* and *manage* -subscriptions, including subscribing for new Topics with a Hub, unsubscribing -(if necessary), and periodically renewing subscriptions, since they may have an -expiry set by the Hub. This is handled by `Zend\Feed\PubSubHubbub\Subscriber`. - -The second role is to *accept updates* sent by a Hub to the Subscriber's -callback URL, i.e. the URI the Subscriber has assigned to handle updates. The -callback URL also handles events where the Hub contacts the Subscriber to -confirm all subscriptions and unsubscriptions. This is handled by using an -instance of `Zend\Feed\PubSubHubbub\Subscriber\Callback` when the callback URL -is accessed. - -> ### Query strings in callback URLs -> -> `Zend\Feed\PubSubHubbub\Subscriber` implements the Pubsubhubbub 0.2/0.3 -> specification. As this is a new specification version, not all Hubs currently -> implement it. The new specification allows the callback URL to include a query -> string which is used by this class, but not supported by all Hubs. In the -> interests of maximising compatibility, it is therefore recommended that the -> query string component of the Subscriber callback URI be presented as a path -> element, i.e. recognised as a parameter in the route associated with the -> callback URI and used by the application's router. - -### Subscribing and Unsubscribing - -`Zend\Feed\PubSubHubbub\Subscriber` implements a full Pubsubhubbub Subscriber -capable of subscribing to, or unsubscribing from, any Topic via any Hub -advertised by that Topic. It operates in conjunction with -`Zend\Feed\PubSubHubbub\Subscriber\Callback`, which accepts requests from a Hub -to confirm all subscription or unsubscription attempts (to prevent third-party -misuse). - -Any subscription (or unsubscription) requires the relevant information before -proceeding, i.e. the URI of the Topic (Atom or RSS feed) to be subscribed to for -updates, and the URI of the endpoint for the Hub which will handle the -subscription and forwarding of the updates. The lifetime of a subscription may -be determined by the Hub, but most Hubs should support automatic subscription -refreshes by checking with the Subscriber. This is supported by -`Zend\Feed\PubSubHubbub\Subscriber\Callback` and requires no other work on your -part. It is still strongly recommended that you use the Hub-sourced subscription -time-to.live (ttl) to schedule the creation of new subscriptions (the process is -identical to that for any new subscription) to refresh it with the Hub. While it -should not be necessary per se, it covers cases where a Hub may not support -automatic subscription refreshing, and rules out Hub errors for additional -redundancy. - -With the relevant information to hand, a subscription can be attempted as -demonstrated below: - -```php -use Zend\Feed\PubSubHubbub\Model\Subscription; -use Zend\Feed\PubSubHubbub\Subscriber; - -$storage = new Subscription; -$subscriber = new Subscriber; -$subscriber->setStorage($storage); -$subscriber->addHubUrl('http://hubbub.example.com'); -$subscriber->setTopicUrl('http://www.example.net/rss.xml'); -$subscriber->setCallbackUrl('http://www.mydomain.com/hubbub/callback'); -$subscriber->subscribeAll(); -``` - -In order to store subscriptions and offer access to this data for general use, -the component requires a database (a schema is provided later in this section). -By default, it is assumed the table name is "subscription", and it utilises -`Zend\Db\TableGateway\TableGateway` in the background, meaning it will use the -default adapter you have set for your application. You may also pass a specific -custom `Zend\Db\TableGateway\TableGateway` instance into the associated model -`Zend\Feed\PubSubHubbub\Model\Subscription`. This custom adapter may be as -simple in intent as changing the table name to use or as complex as you deem -necessary. - -While this model is offered as a default ready-to-roll solution, you may create -your own model using any other backend or database layer (e.g. Doctrine) so long -as the resulting class implements the interface -`Zend\Feed\PubSubHubbub\Model\SubscriptionInterface`. - -An example schema (MySQL) for a subscription table accessible by the provided -model may look similar to: - -```sql -CREATE TABLE IF NOT EXISTS `subscription` ( - `id` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `topic_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `hub_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `created_time` datetime DEFAULT NULL, - `lease_seconds` bigint(20) DEFAULT NULL, - `verify_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `secret` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `expiration_time` datetime DEFAULT NULL, - `subscription_state` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -``` - -Behind the scenes, the Subscriber above will send a request to the Hub endpoint -containing the following parameters (based on the previous example): - -Parameter | Value | Explanation ---------- | ----- | ----------- -`hub.callback` | `http://www.mydomain.com/hubbub/callback?xhub.subscription=5536df06b5dcb966edab3a4c4d56213c16a8184` | The URI used by a Hub to contact the Subscriber and either request confirmation of a (un)subscription request, or send updates from subscribed feeds. The appended query string contains a custom parameter (hence the xhub designation). It is a query string parameter preserved by the Hub and re-sent with all Subscriber requests. Its purpose is to allow the Subscriber to identify and look up the subscription associated with any Hub request in a backend storage medium. This is a non-standard parameter used by this component in preference to encoding a subscription key in the URI path, which is difficult to enforce generically. Nevertheless, since not all Hubs support query string parameters, we still strongly recommend adding the subscription key as a path component in the form `http://www.mydomain.com/hubbub/callback/5536df06b5dcb966edab3a4c4d56213c16a8184`. This requires defining a route capable of parsing out the final value of the key, retrieving the value, and passing it to the Subscriber callback object. The value should be passed into the method `Zend\PubSubHubbub\Subscriber\Callback::setSubscriptionKey()`. A detailed example is offered later. -`hub.lease_seconds` | `2592000` | The number of seconds for which the Subscriber would like a new subscription to remain valid (i.e. a TTL). Hubs may enforce their own maximum subscription period. All subscriptions should be renewed by re-subscribing before the subscription period ends to ensure continuity of updates. Hubs should additionally attempt to automatically refresh subscriptions before they expire by contacting Subscribers (handled automatically by the `Callback` class). -`hub.mode` | `subscribe` | Value indicating this is a subscription request. Unsubscription requests would use the "unsubscribe" value. -`hub.topic` | `http://www.example.net/rss.xml` | The URI of the Topic (i.e. Atom or RSS feed) which the Subscriber wishes to subscribe to for updates. -`hub.verify` | `sync` or `async` | Indicates to the Hub the preferred mode of verifying subscriptions or unsubscriptions. It is repeated twice in order of preference. Technically this component does not distinguish between the two modes and treats both equally. -`hub.verify_token` | `3065919804abcaa7212ae89.879827871253878386` | A verification token returned to the Subscriber by the Hub when it is confirming a subscription or unsubscription. Offers a measure of reliance that the confirmation request originates from the correct Hub to prevent misuse. - -You can modify several of these parameters to indicate a different preference. -For example, you can set a different lease seconds value using -`Zend\Feed\PubSubHubbub\Subscriber::setLeaseSeconds(),` or show a preference for -the `async` verify mode by using `setPreferredVerificationMode(Zend\Feed\PubSubHubbub\PubSubHubbub::VERIFICATION_MODE_ASYNC)`. -However, the Hubs retain the capability to enforce their own preferences, and -for this reason the component is deliberately designed to work across almost any -set of options with minimum end-user configuration required. Conventions are -great when they work! - -> ### Verification modes -> -> While Hubs may require the use of a specific verification mode (both are -> supported by `Zend\Feed\PubSubHubbub`), you may indicate a specific preference -> using the `setPreferredVerificationMode()` method. In `sync` (synchronous) -> mode, the Hub attempts to confirm a subscription as soon as it is received, -> and before responding to the subscription request. In `async` (asynchronous) -> mode, the Hub will return a response to the subscription request immediately, -> and its verification request may occur at a later time. Since -> `Zend\Feed\PubSubHubbub` implements the Subscriber verification role as a -> separate callback class and requires the use of a backend storage medium, it -> actually supports both transparently. In terms of end-user performance, -> asynchronous verification is very much preferred to eliminate the impact of a -> poorly performing Hub tying up end-user server resources and connections for -> too long. - -Unsubscribing from a Topic follows the exact same pattern as the previous -example, with the exception that we should call `unsubscribeAll()` instead. The -parameters included are identical to a subscription request with the exception -that `hub.mode` is set to "unsubscribe". - -By default, a new instance of `Zend\PubSubHubbub\Subscriber` will attempt to use -a database backed storage medium which defaults to using the default zend-db -adapter with a table name of "subscription". It is recommended to set a custom -storage solution where these defaults are not apt either by passing in a new -model supporting the required interface or by passing a new instance of -`Zend\Db\TableGateway\TableGateway` to the default model's constructor to change -the used table name. - -### Handling Subscriber Callbacks - -Whenever a subscription or unsubscription request is made, the Hub must verify -the request by forwarding a new verification request to the callback URL set in -the subscription or unsubscription parameters. To handle these Hub requests, -which will include all future communications containing Topic (feed) updates, -the callback URL should trigger the execution of an instance of -`Zend\Feed\PubSubHubbub\Subscriber\Callback` to handle the request. - -The `Callback` class should be configured to use the same storage medium as the -`Subscriber` class. The bulk of the work is handled internal to these classes. - -```php -use Zend\Feed\PubSubHubbub\Model\Subscription; -use Zend\Feed\PubSubHubbub\Subscriber\Callback; - -$storage = new Subscription(); -$callback = new Callback(); -$callback->setStorage($storage); -$callback->handle(); -$callback->sendResponse(); - -/* - * Check if the callback resulting in the receipt of a feed update. - * Otherwise it was either a (un)sub verification request or invalid request. - * Typically we need do nothing other than add feed update handling; the rest - * is handled internally by the class. - */ -if ($callback->hasFeedUpdate()) { - $feedString = $callback->getFeedUpdate(); - /* - * Process the feed update asynchronously to avoid a Hub timeout. - */ -} -``` - -> #### Query and body parameters -> -> It should be noted that `Zend\Feed\PubSubHubbub\Subscriber\Callback` may -> independently parse any incoming query string and other parameters. This is -> necessary since PHP alters the structure and keys of a query string when it is -> parsed into the `$_GET` or `$_POST` superglobals; for example, all duplicate -> keys are ignored and periods are converted to underscores. Pubsubhubbub -> features both of these in the query strings it generates. - -> #### Always delay feed processing -> -> It is essential that developers recognise that Hubs are only concerned with -> sending requests and receiving a response which verifies its receipt. If a -> feed update is received, it should never be processed on the spot since this -> leaves the Hub waiting for a response. Rather, any processing should be -> offloaded to another process or deferred until after a response has been -> returned to the Hub. One symptom of a failure to promptly complete Hub -> requests is that a Hub may continue to attempt delivery of the update or -> verification request leading to duplicated update attempts being processed by -> the Subscriber. This appears problematic, but in reality a Hub may apply a -> timeout of just a few seconds, and if no response is received within that time -> it may disconnect (assuming a delivery failure) and retry later. Note that -> Hubs are expected to distribute vast volumes of updates so their resources are -> stretched; please process feeds asynchronously (e.g. in a separate process or -> a job queue or even a cronjob) as much as possible. - -### Setting Up And Using A Callback URL Route - -As noted earlier, the `Zend\Feed\PubSubHubbub\Subscriber\Callback` class -receives the combined key associated with any subscription from the Hub via one -of two methods. The technically preferred method is to add this key to the -callback URL employed by the Hub in all future requests using a query string -parameter with the key `xhub.subscription`. However, for historical reasons -(primarily that this was not supported in Pubsubhubbub 0.1, and a late addition -to 0.2 ), it is strongly recommended to use the most compatible means of adding -this key to the callback URL by appending it to the URL's path. - -Thus the URL `http://www.example.com/callback?xhub.subscription=key` would become -`http://www.example.com/callback/key`. - -Since the query string method is the default in anticipation of a greater level -of future support for the full 0.2/0.3 specification, this requires some -additional work to implement. - -The first step is to make the `Zend\Feed\PubSubHubbub\Subscriber\Callback` class -aware of the path contained subscription key. It's manually injected; therefore -it also requires manually defining a route for this purpose. This is achieved by -called the method `Zend\Feed\PubSubHubbub\Subscriber\Callback::setSubscriptionKey()` -with the parameter being the key value available from the router. The example -below demonstrates this using a zend-mvc controller. - -```php -use Zend\Feed\PubSubHubbub\Model\Subscription; -use Zend\Feed\PubSubHubbub\Subscriber\Callback; -use Zend\Mvc\Controller\AbstractActionController; - -class CallbackController extends AbstractActionController -{ - - public function indexAction() - { - $storage = new Subscription(); - $callback = new Callback(); - $callback->setStorage($storage); - - /* - * Inject subscription key parsing from URL path using - * a parameter from the router. - */ - $subscriptionKey = $this->params()->fromRoute('subkey'); - $callback->setSubscriptionKey($subscriptionKey); - $callback->handle(); - $callback->sendResponse(); - - /* - * Check if the callback resulting in the receipt of a feed update. - * Otherwise it was either a (un)sub verification request or invalid - * request. Typically we need do nothing other than add feed update - * handling; the rest is handled internally by the class. - */ - if ($callback->hasFeedUpdate()) { - $feedString = $callback->getFeedUpdate(); - /* - * Process the feed update asynchronously to avoid a Hub timeout. - */ - } - } -} -``` - -The example below illustrates adding a route mapping the path segment to a route -parameter, using zend-mvc: - -```php -use Zend\Mvc\Router\Http\Segment as SegmentRoute;; - -// Route defininition for enabling appending of a PuSH Subscription's lookup key -$route = SegmentRoute::factory([ - 'route' => '/callback/:subkey', - 'constraints' => [ - 'subkey' => '[a-z0-9]+', - ], - 'defaults' => [ - 'controller' => 'application-index', - 'action' => 'index', - ] -]); -``` diff --git a/vendor/zendframework/zend-feed/doc/book/reader.md b/vendor/zendframework/zend-feed/doc/book/reader.md deleted file mode 100644 index ec1038ba4680ef00907fd89d6b434c2a41e58e07..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/reader.md +++ /dev/null @@ -1,825 +0,0 @@ -# Zend\\Feed\\Reader - -`Zend\Feed\Reader` is a component used to consume RSS and Atom feeds of -any version, including RDF/RSS 1.0, RSS 2.0, Atom 0.3, and Atom 1.0. The API for -retrieving feed data is deliberately simple since `Zend\Feed\Reader` is capable -of searching any feed of any type for the information requested through the API. -If the typical elements containing this information are not present, it will -adapt and fall back on a variety of alternative elements instead. This ability -to choose from alternatives removes the need for users to create their own -abstraction layer on top of the component to make it useful or have any in-depth -knowledge of the underlying standards, current alternatives, and namespaced -extensions. - -Internally, the `Zend\Feed\Reader\Reader` class works almost entirely on the -basis of making XPath queries against the feed XML's Document Object Model. This -singular approach to parsing is consistent, and the component offers a plugin -system to add to the Feed and Entry APIs by writing extensions on a similar -basis. - -Performance is assisted in three ways. First of all, `Zend\Feed\Reader\Reader` -supports caching using [zend-cache](https://github.com/zendframework/zend-cache) -to maintain a copy of the original feed XML. This allows you to skip network -requests for a feed URI if the cache is valid. Second, the Feed and Entry APIs -are backed by an internal cache (non-persistent) so repeat API calls for the -same feed will avoid additional DOM or XPath use. Thirdly, importing feeds from -a URI can take advantage of HTTP Conditional `GET` requests which allow servers -to issue an empty 304 response when the requested feed has not changed since the -last time you requested it. In the final case, an zend-cache storage instance -will hold the last received feed along with the ETag and Last-Modified header -values sent in the HTTP response. - -`Zend\Feed\Reader\Reader` is not capable of constructing feeds, and delegates -this responsibility to `Zend\Feed\Writer\Writer`. - -## Importing Feeds - -Feeds can be imported from a string, file or a URI. Importing from a URI can -additionally utilise an HTTP Conditional `GET` request. If importing fails, an -exception will be raised. The end result will be an object of type -`Zend\Feed\Reader\Feed\AbstractFeed`, the core implementations of which are -`Zend\Feed\Reader\Feed\Rss` and `Zend\Feed\Reader\Feed\Atom`. Both objects -support multiple (all existing) versions of these broad feed types. - -In the following example, we import an RDF/RSS 1.0 feed and extract some basic -information that can be saved to a database or elsewhere. - -```php -$feed = Zend\Feed\Reader\Reader::import('http://www.planet-php.net/rdf/'); -$data = [ - 'title' => $feed->getTitle(), - 'link' => $feed->getLink(), - 'dateModified' => $feed->getDateModified(), - 'description' => $feed->getDescription(), - 'language' => $feed->getLanguage(), - 'entries' => [], -]; - -foreach ($feed as $entry) { - $edata = [ - 'title' => $entry->getTitle(), - 'description' => $entry->getDescription(), - 'dateModified' => $entry->getDateModified(), - 'authors' => $entry->getAuthors(), - 'link' => $entry->getLink(), - 'content' => $entry->getContent(), - ]; - $data['entries'][] = $edata; -} -``` - -> ## Importing requires an HTTP client -> -> To import a feed, you will need to have an [HTTP client](zend.feed.http-clients) -> available. -> -> If you are not using zend-http, you will need to inject `Reader` with the HTTP -> client. See the [section on providing a client to Reader](http-clients.md#providing-a-client-to-reader). - -The example above demonstrates `Zend\Feed\Reader\Reader`'s API, and it also -demonstrates some of its internal operation. In reality, the RDF feed selected -does not have any native date or author elements; however it does utilise the -Dublin Core 1.1 module which offers namespaced creator and date elements. -`Zend\Feed\Reader\Reader` falls back on these and similar options if no relevant -native elements exist. If it absolutely cannot find an alternative it will -return `NULL`, indicating the information could not be found in the feed. You -should note that classes implementing `Zend\Feed\Reader\Feed\AbstractFeed` also -implement the SPL `Iterator` and `Countable` interfaces. - -Feeds can also be imported from strings or files. - -```php -// from a URI -$feed = Zend\Feed\Reader\Reader::import('http://www.planet-php.net/rdf/'); - -// from a String -$feed = Zend\Feed\Reader\Reader::importString($feedXmlString); - -// from a file -$feed = Zend\Feed\Reader\Reader::importFile('./feed.xml'); -``` - -## Retrieving Underlying Feed and Entry Sources - -`Zend\Feed\Reader\Reader` does its best not to stick you in a narrow confine. If -you need to work on a feed outside of `Zend\Feed\Reader\Reader`, you can extract -the base DOMDocument or DOMElement objects from any class, or even an XML -string containing these. Also provided are methods to extract the current -DOMXPath object (with all core and extension namespaces registered) and the -correct prefix used in all XPath queries for the current feed or entry. The -basic methods to use (on any object) are `saveXml()`, `getDomDocument()`, -`getElement()`, `getXpath()` and `getXpathPrefix()`. These will let you break -free of `Zend\Feed\Reader` and do whatever else you want. - -- `saveXml()` returns an XML string containing only the element representing the - current object. -- `getDomDocument()` returns the DOMDocument object representing the entire feed - (even if called from an entry object). -- `getElement()` returns the DOMElement of the current object (i.e. the feed or - current entry). -- `getXpath()` returns the DOMXPath object for the current feed (even if called - from an entry object) with the namespaces of the current feed type and all - loaded extensions pre-registered. -- `getXpathPrefix()` returns the query prefix for the current object (i.e. the - feed or current entry) which includes the correct XPath query path for that - specific feed or entry. - -Let's look at an example where a feed might include an RSS extension not -supported by `Zend\Feed\Reader\Reader` out of the box. Notably, you could write -and register an extension (covered later) to do this, but that's not always -warranted for a quick check. You must register any new namespaces on the -DOMXPath object before use unless they are registered by `Zend\Feed\Reader` or -an extension beforehand. - -```php -$feed = Zend\Feed\Reader\Reader::import('http://www.planet-php.net/rdf/'); -$xpathPrefix = $feed->getXpathPrefix(); -$xpath = $feed->getXpath(); -$xpath->registerNamespace('admin', 'http://webns.net/mvcb/'); -$reportErrorsTo = $xpath->evaluate( - 'string(' . $xpathPrefix . '/admin:errorReportsTo)' -); -``` - -> ### Do not register duplicate namespaces -> -> If you register an already registered namespace with a different prefix name -> to that used internally by `Zend\Feed\Reader\Reader`, it will break the -> internal operation of this component. - -## Cache Support and Intelligent Requests - -### Adding Cache Support to Zend\\Feed\\Reader\\Reader - -`Zend\Feed\Reader\Reader` supports using a -[zend-cache](https://github.com/zendframework/zend-cache) storage instance to -cache feeds (as XML) to avoid unnecessary network requests. To add a cache, -create and configure your cache instance, and then tell -`Zend\Feed\Reader\Reader` to use it. The cache key used is -"`Zend\Feed\Reader\\`" followed by the MD5 hash of the feed's URI. - -```php -$cache = Zend\Cache\StorageFactory::adapterFactory('Memory'); -Zend\Feed\Reader\Reader::setCache($cache); -``` - -### HTTP Conditional GET Support - -The big question often asked when importing a feed frequently is if it has even -changed. With a cache enabled, you can add HTTP Conditional `GET` support to -your arsenal to answer that question. - -Using this method, you can request feeds from URIs and include their last known -ETag and Last-Modified response header values with the request (using the -If-None-Match and If-Modified-Since headers). If the feed on the server remains -unchanged, you should receive a 304 response which tells -`Zend\Feed\Reader\Reader` to use the cached version. If a full feed is sent in a -response with a status code of 200, this means the feed has changed and -`Zend\Feed\Reader\Reader` will parse the new version and save it to the cache. -It will also cache the new ETag and Last-Modified header values for future use. - -> #### Conditional GET requires a HeaderAwareClientInterface -> -> Conditional GET support only works for `Zend\Feed\Reader\Http\HeaderAwareClientInterface` -> client implementations, as it requires the ability to send HTTP headers. - -These "conditional" requests are not guaranteed to be supported by the server -you request a *URI* of, but can be attempted regardless. Most common feed -sources like blogs should however have this supported. To enable conditional -requests, you will need to provide a cache to `Zend\Feed\Reader\Reader`. - -```php -$cache = Zend\Cache\StorageFactory::adapterFactory('Memory'); - -Zend\Feed\Reader\Reader::setCache($cache); -Zend\Feed\Reader\Reader::useHttpConditionalGet(); - -$feed = Zend\Feed\Reader\Reader::import('http://www.planet-php.net/rdf/'); -``` - -In the example above, with HTTP Conditional `GET` requests enabled, the response -header values for ETag and Last-Modified will be cached along with the feed. For -the the cache's lifetime, feeds will only be updated on the cache if a non-304 -response is received containing a valid RSS or Atom XML document. - -If you intend on managing request headers from outside -`Zend\Feed\Reader\Reader`, you can set the relevant If-None-Matches and -If-Modified-Since request headers via the URI import method. - -```php -$lastEtagReceived = '5e6cefe7df5a7e95c8b1ba1a2ccaff3d'; -$lastModifiedDateReceived = 'Wed, 08 Jul 2009 13:37:22 GMT'; -$feed = Zend\Feed\Reader\Reader::import( - $uri, $lastEtagReceived, $lastModifiedDateReceived -); -``` - -## Locating Feed URIs from Websites - -These days, many websites are aware that the location of their XML feeds is not -always obvious. A small RDF, RSS, or Atom graphic helps when the user is reading -the page, but what about when a machine visits trying to identify where your -feeds are located? To assist in this, websites may point to their feeds using -`<link>` tags in the `<head>` section of their HTML. To take advantage -of this, you can use `Zend\Feed\Reader\Reader` to locate these feeds using the -static `findFeedLinks()` method. - -This method calls any URI and searches for the location of RSS, RDF, and Atom -feeds assuming, the website's HTML contains the relevant links. It then returns -a value object where you can check for the existence of a RSS, RDF or Atom feed -URI. - -The returned object is an `ArrayObject` subclass called -`Zend\Feed\Reader\FeedSet`, so you can cast it to an array or iterate over it to -access all the detected links. However, as a simple shortcut, you can just grab -the first RSS, RDF, or Atom link using its public properties as in the example -below. Otherwise, each element of the `ArrayObject` is a simple array with the -keys `type` and `uri` where the type is one of "rdf", "rss", or "atom". - -```php -$links = Zend\Feed\Reader\Reader::findFeedLinks('http://www.planet-php.net'); - -if (isset($links->rdf)) { - echo $links->rdf, "\n"; // http://www.planet-php.org/rdf/ -} -if (isset($links->rss)) { - echo $links->rss, "\n"; // http://www.planet-php.org/rss/ -} -if (isset($links->atom)) { - echo $links->atom, "\n"; // http://www.planet-php.org/atom/ -} -``` - -Based on these links, you can then import from whichever source you wish in the usual manner. - -> ### Finding feed links requires an HTTP client -> -> To find feed links, you will need to have an [HTTP client](zend.feed.http-clients) -> available. -> -> If you are not using zend-http, you will need to inject `Reader` with the HTTP -> client. See the [section on providing a client to Reader](http-clients.md#providing-a-client-to-reader). - -This quick method only gives you one link for each feed type, but websites may -indicate many links of any type. Perhaps it's a news site with a RSS feed for -each news category. You can iterate over all links using the ArrayObject's -iterator. - -```php -$links = Zend\Feed\Reader::findFeedLinks('http://www.planet-php.net'); - -foreach ($links as $link) { - echo $link['href'], "\n"; -} -``` - -## Attribute Collections - -In an attempt to simplify return types, return types from the various feed and -entry level methods may include an object of type -`Zend\Feed\Reader\Collection\AbstractCollection`. Despite the special class name -which I'll explain below, this is just a simple subclass of SPL's `ArrayObject`. - -The main purpose here is to allow the presentation of as much data as possible -from the requested elements, while still allowing access to the most relevant -data as a simple array. This also enforces a standard approach to returning such -data which previously may have wandered between arrays and objects. - -The new class type acts identically to `ArrayObject` with the sole addition -being a new method `getValues()` which returns a simple flat array containing -the most relevant information. - -A simple example of this is `Zend\Feed\Reader\Reader\FeedInterface::getCategories()`. -When used with any RSS or Atom feed, this method will return category data as a -container object called `Zend\Feed\Reader\Collection\Category`. The container -object will contain, per category, three fields of data: term, scheme, and label. -The "term" is the basic category name, often machine readable (i.e. plays nice -with URIs). The scheme represents a categorisation scheme (usually a URI -identifier) also known as a "domain" in RSS 2.0. The "label" is a human readable -category name which supports HTML entities. In RSS 2.0, there is no label -attribute so it is always set to the same value as the term for convenience. - -To access category labels by themselves in a simple value array, you might -commit to something like: - -```php -$feed = Zend\Feed\Reader\Reader::import('http://www.example.com/atom.xml'); -$categories = $feed->getCategories(); -$labels = []; -foreach ($categories as $cat) { - $labels[] = $cat['label'] -} -``` - -It's a contrived example, but the point is that the labels are tied up with -other information. - -However, the container class allows you to access the "most relevant" data as a -simple array using the `getValues()` method. The concept of "most relevant" is -obviously a judgement call. For categories it means the category labels (not the -terms or schemes) while for authors it would be the authors' names (not their -email addresses or URIs). The simple array is flat (just values) and passed -through `array_unique()` to remove duplication. - -```php -$feed = Zend\Feed\Reader\Reader::import('http://www.example.com/atom.xml'); -$categories = $feed->getCategories(); -$labels = $categories->getValues(); -``` - -The above example shows how to extract only labels and nothing else thus giving -simple access to the category labels without any additional work to extract that -data by itself. - -## Retrieving Feed Information - -Retrieving information from a feed (we'll cover entries and items in the next -section though they follow identical principals) uses a clearly defined API -which is exactly the same regardless of whether the feed in question is RSS, -RDF, or Atom. The same goes for sub-versions of these standards and we've tested -every single RSS and Atom version. While the underlying feed XML can differ -substantially in terms of the tags and elements they present, they nonetheless -are all trying to convey similar information and to reflect this all the -differences and wrangling over alternative tags are handled internally by -`Zend\Feed\Reader\Reader` presenting you with an identical interface for each. -Ideally, you should not have to care whether a feed is RSS or Atom so long as -you can extract the information you want. - -> ### RSS feeds vary widely -> -> While determining common ground between feed types is itself complex, it -> should be noted that *RSS* in particular is a constantly disputed -> "specification". This has its roots in the original RSS 2.0 document, which -> contains ambiguities and does not detail the correct treatment of all -> elements. As a result, this component rigorously applies the RSS 2.0.11 -> Specification published by the RSS Advisory Board and its accompanying RSS -> Best Practices Profile. No other interpretation of RSS -> 2.0 will be supported, though exceptions may be allowed where it does not -> directly prevent the application of the two documents mentioned above. - -Of course, we don't live in an ideal world, so there may be times the API just -does not cover what you're looking for. To assist you, `Zend\Feed\Reader\Reader` -offers a plugin system which allows you to write extensions to expand the core -API and cover any additional data you are trying to extract from feeds. If -writing another extension is too much trouble, you can simply grab the -underlying DOM or XPath objects and do it by hand in your application. Of -course, we really do encourage writing an extension simply to make it more -portable and reusable, and useful extensions may be proposed to the component -for formal addition. - -Below is a summary of the Core API for feeds. You should note it comprises not -only the basic RSS and Atom standards, but also accounts for a number of -included extensions bundled with `Zend\Feed\Reader\Reader`. The naming of these -extension sourced methods remain fairly generic; all Extension methods operate -at the same level as the Core API though we do allow you to retrieve any -specific extension object separately if required. - -### Feed Level API Methods - -Method | Description ------- | ----------- -`getId()` | Returns a unique ID associated with this feed -`getTitle()` | Returns the title of the feed -`getDescription()` | Returns the text description of the feed. -`getLink()` | Returns a URI to the HTML website containing the same or similar information as this feed (i.e. if the feed is from a blog, it should provide the blog's URI where the HTML version of the entries can be read). -`getFeedLink()` | Returns the URI of this feed, which may be the same as the URI used to import the feed. There are important cases where the feed link may differ because the source URI is being updated and is intended to be removed in the future. -`getAuthors()` | Returns an object of type `Zend\Feed\Reader\Collection\Author` which is an `ArrayObject` whose elements are each simple arrays containing any combination of the keys "name", "email" and "uri". Where irrelevant to the source data, some of these keys may be omitted. -`getAuthor(integer $index = 0)` | Returns either the first author known, or with the optional $index parameter any specific index on the array of authors as described above (returning `NULL` if an invalid index). -`getDateCreated()` | Returns the date on which this feed was created. Generally only applicable to Atom, where it represents the date the resource described by an Atom 1.0 document was created. The returned date will be a `DateTime` object. -`getDateModified()` | Returns the date on which this feed was last modified. The returned date will be a `DateTime` object. -`getLastBuildDate()` | Returns the date on which this feed was last built. The returned date will be a `DateTime` object. This is only supported by RSS; Atom feeds will always return `NULL`. -`getLanguage()` | Returns the language of the feed (if defined) or simply the language noted in the XML document. -`getGenerator()` | Returns the generator of the feed, e.g. the software which generated it. This may differ between RSS and Atom since Atom defines a different notation. -`getCopyright()` | Returns any copyright notice associated with the feed. -`getHubs()` | Returns an array of all Hub Server URI endpoints which are advertised by the feed for use with the Pubsubhubbub Protocol, allowing subscriptions to the feed for real-time updates. -`getCategories()` | Returns a `Zend\Feed\Reader\Collection\Category` object containing the details of any categories associated with the overall feed. The supported fields include "term" (the machine readable category name), "scheme" (the categorisation scheme and domain for this category), and "label" (a HTML decoded human readable category name). Where any of the three fields are absent from the field, they are either set to the closest available alternative or, in the case of "scheme", set to `NULL`. -`getImage()` | Returns an array containing data relating to any feed image or logo, or `NULL` if no image found. The resulting array may contain the following keys: uri, link, title, description, height, and width. Atom logos only contain a URI so the remaining metadata is drawn from RSS feeds only. - -Given the variety of feeds in the wild, some of these methods will undoubtedly -return `NULL` indicating the relevant information couldn't be located. Where -possible, `Zend\Feed\Reader\Reader` will fall back on alternative elements -during its search. For example, searching an RSS feed for a modification date is -more complicated than it looks. RSS 2.0 feeds should include a `<lastBuildDate>` -tag and/or a `<pubDate>` element. But what if it doesn't? Maybe this is an RSS -1.0 feed? Perhaps it instead has an `<atom:updated>` element with identical -information (Atom may be used to supplement RSS syntax)? Failing that, we -could simply look at the entries, pick the most recent, and use its `<pubDate>` -element. Assuming it exists, that is. Many feeds also use Dublin Core 1.0 or 1.1 -`<dc:date>` elements for feeds and entries. Or we could find Atom lurking again. - -The point is, `Zend\Feed\Reader\Reader` was designed to know this. When you ask -for the modification date (or anything else), it will run off and search for all -these alternatives until it either gives up and returns `NULL`, or finds an -alternative that should have the right answer. - -In addition to the above methods, all feed objects implement methods for -retrieving the DOM and XPath objects for the current feeds as described -earlier. Feed objects also implement the SPL Iterator and Countable -interfaces. The extended API is summarised below. - -### Extended Feed API Methods - -Method | Description ------- | ----------- -`getDomDocument()` | Returns the parent DOMDocument object for the entire source XML document. -`getElement()` | Returns the current feed level DOMElement object. -`saveXml()` | Returns a string containing an XML document of the entire feed element (this is not the original document, but a rebuilt version). -`getXpath()` | Returns the DOMXPath object used internally to run queries on the DOMDocument object (this includes core and extension namespaces pre-registered). -`getXpathPrefix()` | Returns the valid DOM path prefix prepended to all XPath queries matching the feed being queried. -`getEncoding()` | Returns the encoding of the source XML document (note: this cannot account for errors such as the server sending documents in a different encoding). Where not defined, the default UTF-8 encoding of Unicode is applied. -`count()` | Returns a count of the entries or items this feed contains (implements SPL `Countable` interface) -`current()` | Returns either the current entry (using the current index from `key()`). -`key()` | Returns the current entry index. -`next()` | Increments the entry index value by one. -`rewind()` | Resets the entry index to 0. -`valid()` | Checks that the current entry index is valid, i.e. it does not fall below 0 and does not exceed the number of entries existing. -`getExtensions()` | Returns an array of all extension objects loaded for the current feed (note: both feed-level and entry-level extensions exist, and only feed-level extensions are returned here). The array keys are of the form `{ExtensionName}_Feed`. -`getExtension(string $name)` | Returns an extension object for the feed registered under the provided name. This allows more fine-grained access to extensions which may otherwise be hidden within the implementation of the standard API methods. -`getType()` | Returns a static class constant (e.g. `Zend\Feed\Reader\Reader::TYPE_ATOM_03`, i.e. "Atom 0.3"), indicating exactly what kind of feed is being consumed. - -## Retrieving Entry/Item Information - -Retrieving information for specific entries or items (depending on whether you -speak Atom or RSS) is identical to feed level data. Accessing entries is -simply a matter of iterating over a feed object or using the SPL `Iterator` -interface feed objects implement, and calling the appropriate method on each. - -### Entry API Methods - -Method | Description ------- | ----------- -`getId()` | Returns a unique ID for the current entry. -`getTitle()` | Returns the title of the current entry. -`getDescription()` | Returns a description of the current entry. -`getLink()` | Returns a URI to the HTML version of the current entry. -`getPermaLink()` | Returns the permanent link to the current entry. In most cases, this is the same as using `getLink()`. -`getAuthors()` | Returns an object of type `Zend\Feed\Reader\Collection\Author`, which is an `ArrayObject` whose elements are each simple arrays containing any combination of the keys "name", "email" and "uri". Where irrelevant to the source data, some of these keys may be omitted. -`getAuthor(integer $index = 0)` | Returns either the first author known, or, with the optional `$index` parameter, any specific index on the array of Authors as described above (returning `NULL` if an invalid index). -`getDateCreated()` | Returns the date on which the current entry was created. Generally only applicable to Atom where it represents the date the resource described by an Atom 1.0 document was created. -`getDateModified()` | Returns the date on which the current entry was last modified. -`getContent()` | Returns the content of the current entry (this has any entities reversed if possible, assuming the content type is HTML). The description is returned if a separate content element does not exist. -`getEnclosure()` | Returns an array containing the value of all attributes from a multi-media `<enclosure>` element including as array keys: url, length, type. In accordance with the RSS Best Practices Profile of the RSS Advisory Board, no support is offers for multiple enclosures since such support forms no part of the RSS specification. -`getCommentCount()` | Returns the number of comments made on this entry at the time the feed was last generated. -`getCommentLink()` | Returns a URI pointing to the HTML page where comments can be made on this entry. -`getCommentFeedLink([string $type = ‘atom'|'rss'])` | Returns a URI pointing to a feed of the provided type containing all comments for this entry (type defaults to Atom/RSS depending on current feed type). -`getCategories()` | Returns a `Zend\Feed\Reader\Collection\Category` object containing the details of any categories associated with the entry. The supported fields include "term" (the machine readable category name), "scheme" (the categorisation scheme and domain for this category), and "label" (an HTML-decoded human readable category name). Where any of the three fields are absent from the field, they are either set to the closest available alternative or, in the case of "scheme", set to `NULL`. - -The extended API for entries is identical to that for feeds with the exception -of the `Iterator` methods, which are not needed here. - -> ### Modified vs Created dates -> -> There is often confusion over the concepts of *modified* and *created* dates. -> In Atom, these are two clearly defined concepts (so knock yourself out) but in -> RSS they are vague. RSS 2.0 defines a single `<pubDate>` element which -> typically refers to the date this entry was published, i.e. a creation date of -> sorts. This is not always the case, and it may change with updates or not. As a -> result, if you really want to check whether an entry has changed, don't rely on -> the results of `getDateModified()`. Instead, consider tracking the MD5 hash of -> three other elements concatenated, e.g. using `getTitle()`, `getDescription()`, -> and `getContent()`. If the entry was truly updated, this hash computation will -> give a different result than previously saved hashes for the same entry. This -> is obviously content oriented, and will not assist in detecting changes to -> other relevant elements. Atom feeds should not require such steps. - -> Further muddying the waters, dates in feeds may follow different standards. -> Atom and Dublin Core dates should follow ISO 8601, and RSS dates should -> follow RFC 822 or RFC 2822 (which is also common). Date methods will throw an -> exception if `DateTime` cannot load the date string using one of the above -> standards, or the PHP recognised possibilities for RSS dates. - -> ### Validation -> -> The values returned from these methods are not validated. This means users -> must perform validation on all retrieved data including the filtering of any -> HTML such as from `getContent()` before it is output from your application. -> Remember that most feeds come from external sources, and therefore the default -> assumption should be that they cannot be trusted. - -### Extended Entry Level API Methods - -Method | Description ------- | ----------- -`getDomDocument()` | Returns the parent DOMDocument object for the entire feed (not just the current entry). -`getElement()` | Returns the current entry level DOMElement object. -`getXpath()` | Returns the DOMXPath object used internally to run queries on the DOMDocument object (this includes core and extension namespaces pre-registered). -`getXpathPrefix()` | Returns the valid DOM path prefix prepended to all XPath queries matching the entry being queried. -`getEncoding()` | Returns the encoding of the source XML document (note: this cannot account for errors such as the server sending documents in a different encoding). The default encoding applied in the absence of any other is the UTF-8 encoding of Unicode. -`getExtensions()` | Returns an array of all extension objects loaded for the current entry (note: both feed-level and entry-level extensions exist, and only entry-level extensions are returned here). The array keys are in the form `{ExtensionName}Entry`. -`getExtension(string $name)` | Returns an extension object for the entry registered under the provided name. This allows more fine-grained access to extensions which may otherwise be hidden within the implementation of the standard API methods. -`getType()` | Returns a static class constant (e.g. `Zend\Feed\Reader\Reader::TYPE_ATOM_03`, i.e. "Atom 0.3") indicating exactly what kind of feed is being consumed. - -## Extending Feed and Entry APIs - -Extending `Zend\Feed\Reader\Reader` allows you to add methods at both the feed -and entry level which cover the retrieval of information not already supported -by `Zend\Feed\Reader\Reader`. Given the number of RSS and Atom extensions that -exist, this is a good thing, since `Zend\Feed\Reader\Reader` couldn't possibly -add everything. - -There are two types of extensions possible, those which retrieve information -from elements which are immediate children of the root element (e.g. -`<channel>` for RSS or `<feed>` for Atom), and those who retrieve information -from child elements of an entry (e.g. `<item>` for RSS or `<entry>` for Atom). -On the filesystem, these are grouped as classes within a namespace based on the -extension standard's name. For example, internally we have -`Zend\Feed\Reader\Extension\DublinCore\Feed` and -`Zend\Feed\Reader\Extension\DublinCore\Entry` classes which are two extensions -implementing Dublin Core 1.0 and 1.1 support. - -Extensions are loaded into `Zend\Feed\Reader\Reader` using an "extension -manager". Extension managers must implement `Zend\Feed\Reader\ExtensionManagerInterface`. -Three implementations exist: - -- `Zend\Feed\Reader\StandaloneExtensionManager` is a hard-coded implementation - seeded with all feed and entry implementations. You can extend it to add - extensions, though it's likely easier to copy and paste it, adding your - changes. -- `Zend\Feed\Reader\ExtensionPluginManager` is a `Zend\ServiceManager\AbstractPluginManager` - implementation, `Zend\Feed\Reader\ExtensionManager`; as such, you can extend - it to add more extensions, use a `Zend\ServiceManager\ConfigInterface` instance - to inject it with more extensions, or use its public API for adding services - (e.g., `setService()`, `setFactory()`, etc.). This implementation *does not* - implement `ExtensionManagerInterface`, and must be used with `ExtensionManager`. -- `Zend\Feed\Reader\ExtensionManager` exists for legacy purposes; prior to 2.3, - this was an `AbstractPluginManager` implementation, and the only provided - extension manager. It now implements `ExtensionManagerInterface`, and acts as - a decorator for `ExtensionPluginManager`. - -By default, `Zend\Feed\Reader\Reader` composes a `StandaloneExtensionManager`. You -can inject an alternate implementation using `Reader::setExtensionManager()`: - -```php -$extensions = new Zend\Feed\Reader\ExtensionPluginManager(); -Zend\Feed\Reader\Reader::setExtensionManager( - new ExtensionManager($extensions) -); -``` - -The shipped implementations all provide the default extensions (so-called -"Core Extensions") used internally by `Zend\Feed\Reader\Reader`. These -include: - -Extension | Description ---------- | ----------- -DublinCore (Feed and Entry) | Implements support for Dublin Core Metadata Element Set 1.0 and 1.1. -Content (Entry only) | Implements support for Content 1.0. -Atom (Feed and Entry) | Implements support for Atom 0.3 and Atom 1.0. -Slash | Implements support for the Slash RSS 1.0 module. -WellFormedWeb | Implements support for the Well Formed Web CommentAPI 1.0. -Thread | Implements support for Atom Threading Extensions as described in RFC 4685. -Podcast | Implements support for the Podcast 1.0 DTD from Apple. - -The core extensions are somewhat special since they are extremely common and -multi-faceted. For example, we have a core extension for Atom. Atom is -implemented as an extension (not just a base class) because it doubles as a -valid RSS module; you can insert Atom elements into RSS feeds. I've even seen -RDF feeds which use a lot of Atom in place of more common extensions like -Dublin Core. - -The following is a list of non-Core extensions that are offered, but not registered -by default. If you want to use them, you'll need to -tell `Zend\Feed\Reader\Reader` to load them in advance of importing a feed. -Additional non-Core extensions will be included in future iterations of the -component. - -Extension | Description ---------- | ----------- -Syndication | Implements Syndication 1.0 support for RSS feeds. -CreativeCommons | An RSS module that adds an element at the `<channel>` or `<item>` level that specifies which Creative Commons license applies. - -`Zend\Feed\Reader\Reader` requires you to explicitly register non-Core -extensions in order to expose their API to feed and entry objects. Below, we -register the optional Syndication extension, and discover that it can be -directly called from the entry API without any effort. (Note that -extension names are case sensitive and use camelCasing for multiple terms.) - -```php -use Zend\Feed\Reader\Reader; - -Reader::registerExtension('Syndication'); -$feed = Reader::import('http://rss.slashdot.org/Slashdot/slashdot'); -$updatePeriod = $feed->getUpdatePeriod(); -``` - -In the simple example above, we checked how frequently a feed is being updated -using the `getUpdatePeriod()` method. Since it's not part of -`Zend\Feed\Reader\Reader`'s core API, it could only be a method supported by -the newly registered Syndication extension. - -As you can also notice, methods provided by extensions are accessible from the -main API using method overloading. As an alternative, you can also directly -access any extension object for a similar result as seen below. - -```php -use Zend\Feed\Reader\Reader; - -Reader::registerExtension('Syndication'); -$feed = Reader::import('http://rss.slashdot.org/Slashdot/slashdot'); -$syndication = $feed->getExtension('Syndication'); -$updatePeriod = $syndication->getUpdatePeriod(); -``` - -### Writing Zend\\Feed\\Reader Extensions - -Inevitably, there will be times when the `Zend\Feed\Reader` API is just -not capable of getting something you need from a feed or entry. You can use the -underlying source objects, like DOMDocument, to get these by hand; however, there -is a more reusable method available: you can write extensions supporting these new -queries. - -As an example, let's take the case of a purely fictitious corporation named -Jungle Books. Jungle Books have been publishing a lot of reviews on books they -sell (from external sources and customers), which are distributed as an RSS 2.0 -feed. Their marketing department realises that web applications using this feed -cannot currently figure out exactly what book is being reviewed. To make life -easier for everyone, they determine that the geek department needs to extend -RSS 2.0 to include a new element per entry supplying the ISBN-10 or ISBN-13 -number of the publication the entry concerns. They define the new `<isbn>` -element quite simply with a standard name and namespace URI: - -- Name: JungleBooks 1.0 -- Namespace URI: http://example.com/junglebooks/rss/module/1.0/ - -A snippet of RSS containing this extension in practice could be something -similar to: - -```xml -<?xml version="1.0" encoding="utf-8" ?> -<rss version="2.0" - xmlns:content="http://purl.org/rss/1.0/modules/content/" - xmlns:jungle="http://example.com/junglebooks/rss/module/1.0/"> -<channel> - <title>Jungle Books Customer Reviews</title> - <link>http://example.com/junglebooks</link> - <description>Many book reviews!</description> - <pubDate>Fri, 26 Jun 2009 19:15:10 GMT</pubDate> - <jungle:dayPopular> - http://example.com/junglebooks/book/938 - </jungle:dayPopular> - <item> - <title>Review Of Flatland: A Romance of Many Dimensions</title> - <link>http://example.com/junglebooks/review/987</link> - <author>Confused Physics Student</author> - <content:encoded> - A romantic square?! - </content:encoded> - <pubDate>Thu, 25 Jun 2009 20:03:28 -0700</pubDate> - <jungle:isbn>048627263X</jungle:isbn> - </item> -</channel> -</rss> -``` - -Implementing this new ISBN element as a simple entry level extension would -require the following class (using your own namespace). - -```php -namespace My\FeedReader\Extension\JungleBooks; - -use Zend\Feed\Reader\Extension\AbstractEntry; - -class Entry extends AbstractEntry -{ - public function getIsbn() - { - if (isset($this->data['isbn'])) { - return $this->data['isbn']; - } - - $isbn = $this->xpath->evaluate( - 'string(' . $this->getXpathPrefix() . '/jungle:isbn)' - ); - - if (! $isbn) { - $isbn = null; - } - - $this->data['isbn'] = $isbn; - return $this->data['isbn']; - } - - protected function registerNamespaces() - { - $this->xpath->registerNamespace( - 'jungle', - 'http://example.com/junglebooks/rss/module/1.0/' - ); - } -} -``` - -This extension creates a new method `getIsbn()`, which runs an XPath query on -the current entry to extract the ISBN number enclosed by the `<jungle:isbn>` -element. It can optionally store this to the internal non-persistent cache (no -need to keep querying the DOM if it's called again on the same entry). The -value is returned to the caller. At the end we have a protected method (it's -abstract, making it required by implementations) which registers the Jungle -Books namespace for their custom RSS module. While we call this an RSS module, -there's nothing to prevent the same element being used in Atom feeds; all -extensions which use the prefix provided by `getXpathPrefix()` are actually -neutral and work on RSS or Atom feeds with no extra code. - -Since this extension is stored outside of zend-feed, you'll need to ensure your -application can autoload it. Once that's in place, you will also need to ensure -your extension manager knows about it, and then register the extension with -`Zend\Feed\Reader\Reader`. - -The following example uses `Zend\Feed\Reader\ExtensionPluginManager` to manage -extensions, as it provides the ability to register new extensions without -requiring extension of the plugin manager itself. To use it, first intall -zend-servicemanager: - -```bash -$ composer require zendframework/zend-servicemanager -``` - -From there: - -```php -use My\FeedReader\Extension\JungleBooks; -use Zend\Feed\Reader\ExtensionManager; -use Zend\Feed\Reader\ExtensionPluginManager; -use Zend\Feed\Reader\Reader; - -$extensions = new ExtensionPluginManager(); -$extensions->setInvokableClass('JungleBooksEntry', JungleBooks\Entry::class); -Reader::setExtensionManager(new ExtensionManager($extensions)); -Reader::registerExtension('JungleBooks'); - -$feed = Reader::import('http://example.com/junglebooks/rss'); - -// ISBN for whatever book the first entry in the feed was concerned with -$firstIsbn = $feed->current()->getIsbn(); -``` - -Writing a feed extension is not much different. The example feed from earlier -included an unmentioned `<jungle:dayPopular>` element which Jungle Books have -added to their standard to include a link to the day's most popular book (in -terms of visitor traffic). Here's an extension which adds a -`getDaysPopularBookLink()` method to the feel level API. - -```php -namespace My\FeedReader\Extension\JungleBooks; - -use Zend\Feed\Reader\Extension\AbstractFeed; - -class Feed extends AbstractFeed -{ - public function getDaysPopularBookLink() - { - if (isset($this->data['dayPopular'])) { - return $this->data['dayPopular']; - } - - $dayPopular = $this->xpath->evaluate( - 'string(' . $this->getXpathPrefix() . '/jungle:dayPopular)' - ); - - if (!$dayPopular) { - $dayPopular = null; - } - - $this->data['dayPopular'] = $dayPopular; - return $this->data['dayPopular']; - } - - protected function registerNamespaces() - { - $this->xpath->registerNamespace( - 'jungle', - 'http://example.com/junglebooks/rss/module/1.0/' - ); - } -} -``` - -Let's add to the previous example; we'll register the new class with the -extension manager, and then demonstrate using the newly exposed method: - -```php -use My\FeedReader\Extension\JungleBooks; -use Zend\Feed\Reader\ExtensionManager; -use Zend\Feed\Reader\ExtensionPluginManager; -use Zend\Feed\Reader\Reader; - -$extensions = new ExtensionPluginManager(); -$extensions->setInvokableClass('JungleBooksEntry', JungleBooks\Entry::class); -$extensions->setInvokableClass('JungleBooksFeed', JungleBooks\Feed::class); -Reader::setExtensionManager(new ExtensionManager($extensions)); -Reader::registerExtension('JungleBooks'); - -$feed = Reader::import('http://example.com/junglebooks/rss'); - -// URI to the information page of the day's most popular book with visitors -$daysPopularBookLink = $feed->getDaysPopularBookLink(); -``` - -Going through these examples, you'll note that while we need to register the -feed and entry classes separately with the plugin manager, we don't register -them separately when registering the extension with the `Reader`. Extensions -within the same standard may or may not include both a feed and entry class, so -`Zend\Feed\Reader\Reader` only requires you to register the overall parent name, -e.g. JungleBooks, DublinCore, Slash. Internally, it can check at what level -extensions exist and load them up if found. In our case, we have a complete -extension now, spanning the classes `JungleBooks\Feed` and `JungleBooks\Entry`. diff --git a/vendor/zendframework/zend-feed/doc/book/security.md b/vendor/zendframework/zend-feed/doc/book/security.md deleted file mode 100644 index bc6ccd2c0b331e576d420f9c2a96b83f64d66ce7..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/security.md +++ /dev/null @@ -1,161 +0,0 @@ -# Zend\\Feed\\Reader and Security - -As with any data coming from a source that is beyond the developer's control, -special attention needs to be given to securing, validating and filtering that -data. Similar to data input to our application by users, data coming from RSS -and Atom feeds should also be considered unsafe and potentially dangerous, as it -allows the delivery of HTML and [xHTML](http://tools.ietf.org/html/rfc4287#section-8.1). -Because data validation and filtration is out of `Zend\Feed`'s scope, this task -is left for implementation by the developer, by using libraries such as -zend-escaper for escaping and [HTMLPurifier](http://www.htmlpurifier.org/) for -validating and filtering feed data. - -Escaping and filtering of potentially insecure data is highly recommended before -outputting it anywhere in our application or before storing that data in some -storage engine (be it a simple file or a database.). - -## Filtering data using HTMLPurifier - -Currently, the best available library for filtering and validating (x)HTML data -in PHP is [HTMLPurifier](http://www.htmlpurifier.org/), and, as such, is the -recommended tool for this task. HTMLPurifier works by filtering out all (x)HTML -from the data, except for the tags and attributes specifically allowed in a -whitelist, and by checking and fixing nesting of tags, ensuring -standards-compliant output. - -The following examples will show a basic usage of HTMLPurifier, but developers -are urged to go through and read [HTMLPurifier's documentation](http://www.htmlpurifier.org/docs). - -```php -// Setting HTMLPurifier's options -$options = [ - // Allow only paragraph tags - // and anchor tags wit the href attribute - [ - 'HTML.Allowed', - 'p,a[href]' - ], - // Format end output with Tidy - [ - 'Output.TidyFormat', - true - ], - // Assume XHTML 1.0 Strict Doctype - [ - 'HTML.Doctype', - 'XHTML 1.0 Strict' - ], - // Disable cache, but see note after the example - [ - 'Cache.DefinitionImpl', - null - ] -]; - -// Configuring HTMLPurifier -$config = HTMLPurifier_Config::createDefault(); -foreach ($options as $option) { - $config->set($option[0], $option[1]); -} - -// Creating a HTMLPurifier with it's config -$purifier = new HTMLPurifier($config); - -// Fetch the RSS -try { - $rss = Zend\Feed\Reader\Reader::import('http://www.planet-php.net/rss/'); -} catch (Zend\Feed\Exception\Reader\RuntimeException $e) { - // feed import failed - echo "Exception caught importing feed: {$e->getMessage()}\n"; - exit; -} - -// Initialize the channel data array -// See that we're cleaning the description with HTMLPurifier -$channel = [ - 'title' => $rss->getTitle(), - 'link' => $rss->getLink(), - 'description' => $purifier->purify($rss->getDescription()), - 'items' => [], -]; - -// Loop over each channel item and store relevant data -// See that we're cleaning the descriptions with HTMLPurifier -foreach ($rss as $item) { - $channel['items'][] = [ - 'title' => $item->getTitle(), - 'link' => $item->getLink(), - 'description' => $purifier->purify($item->getDescription()), - ]; -} -``` - -> ### Tidy is required -> -> HTMLPurifier is using the PHP [Tidy extension](http://php.net/tidy) to clean -> and repair the final output. If this extension is not available, it will -> silently fail, but its availability has no impact on the library's security. - -> ### Caching -> -> For the sake of this example, the HTMLPurifier's cache is disabled, but it is -> recommended to configure caching and use its standalone include file as it can -> improve the performance of HTMLPurifier substantially. - -## Escaping data using zend-escaper - -To help prevent XSS attacks, Zend Framework provides the [zend-escaper component](https://github.com/zendframework/zend-escaper), -which complies to the current [OWASP recommendations](https://www.owasp.org/index.php/XSS_Prevention_Cheat_Sheet), -and as such, is the recommended tool for escaping HTML tags and attributes, -Javascript, CSS and URLs before outputing any potentially insecure data to the -users. - -```php -try { - $rss = Zend\Feed\Reader\Reader::import('http://www.planet-php.net/rss/'); -} catch (Zend\Feed\Exception\Reader\RuntimeException $e) { - // feed import failed - echo "Exception caught importing feed: {$e->getMessage()}\n"; - exit; -} - -// Validate all URIs -$linkValidator = new Zend\Validator\Uri; -$link = null; -if ($linkValidator->isValid($rss->getLink())) { - $link = $rss->getLink(); -} - -// Escaper used for escaping data -$escaper = new Zend\Escaper\Escaper('utf-8'); - -// Initialize the channel data array -$channel = [ - 'title' => $escaper->escapeHtml($rss->getTitle()), - 'link' => $escaper->escapeUrl($link), - 'description' => $escaper->escapeHtml($rss->getDescription()), - 'items' => [], -]; - -// Loop over each channel item and store relevant data -foreach ($rss as $item) { - $link = null; - if ($linkValidator->isValid($rss->getLink())) { - $link = $item->getLink(); - } - $channel['items'][] = [ - 'title' => $escaper->escapeHtml($item->getTitle()), - 'link' => $escaper->escapeUrl($link), - 'description' => $escaper->escapeHtml($item->getDescription()), - ]; -} -``` - -The feed data is now safe for output to HTML templates. You can, of course, skip -escaping when simply storing the data persistently, but remember to escape it on -output later! - -Of course, these are just basic examples, and cannot cover all possible -scenarios that you, as a developer, can, and most likely will, encounter. Your -responsibility is to learn what libraries and tools are at your disposal, and -when and how to use them to secure your web applications. diff --git a/vendor/zendframework/zend-feed/doc/book/writer.md b/vendor/zendframework/zend-feed/doc/book/writer.md deleted file mode 100644 index 749b0e69d1ebc64780da47c1e3587f87ea5dacdb..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/doc/book/writer.md +++ /dev/null @@ -1,280 +0,0 @@ -# Zend\\Feed\\Writer - -`Zend\Feed\Writer` is the sibling component to `Zend\Feed\Reader` responsible -for *generating* feeds. It supports the Atom 1.0 specification (RFC 4287) and -RSS 2.0 as specified by the RSS Advisory Board (RSS 2.0.11). It does not deviate -from these standards. It does, however, offer a simple extension system which -allows for any extension and module for either of these two specifications to be -implemented if they are not provided out of the box. - -In many ways, `Zend\Feed\Writer` is the inverse of `Zend\Feed\Reader`. Where -`Zend\Reader\Reader` focuses on providing an easy to use architecture fronted by -getter methods, `Zend\Feed\Writer` is fronted by similarly named setters or -mutators. This ensures the API won't pose a learning curve to anyone familiar -with `Zend\Feed\Reader`. - -As a result of this design, the rest may even be obvious. Behind the scenes, -data set on any `Zend\Feed\Writer\Writer` instance is translated at render time -onto a DOMDocument object using the necessary feed elements. For each supported -feed type there is both an Atom 1.0 and RSS 2.0 renderer. Using a DOMDocument -class rather than a templating solution has numerous advantages, the most -obvious being the ability to export the DOMDocument for additional processing -and relying on PHP DOM for correct and valid rendering. - -## Architecture - -The architecture of `Zend\Feed\Writer` is very simple. It has two core sets of -classes: data containers and renderers. - -The containers include the `Zend\Feed\Writer\Feed` and `Zend\Feed\Writer\Entry` -classes. The Entry classes can be attached to any Feed class. The sole purpose -of these containers is to collect data about the feed to generate using a simple -interface of setter methods. These methods perform some data validity testing. -For example, it will validate any passed URIs, dates, etc. These checks are not -tied to any of the feed standards definitions. The container objects also -contain methods to allow for fast rendering and export of the final feed, and -these can be reused at will. - -In addition to the main data container classes, there are two additional Atom -2.0-specific classes: `Zend\Feed\Writer\Source` and `Zend\Feed\Writer\Deleted`. -The former implements Atom 2.0 source elements which carry source feed metadata -for a specific entry within an aggregate feed (i.e. the current feed is not the -entry's original source). The latter implements the [Atom Tombstones RFC](https://tools.ietf.org/html/rfc6721), -allowing feeds to carry references to entries which have been deleted. - -While there are two main data container types, there are four renderers: two -matching container renderers per supported feed type. Each renderer accepts a -container, and, based on its content, attempts to generate valid feed markup. If -the renderer is unable to generate valid feed markup (perhaps due to the -container missing an obligatory data point), it will report this by throwing an -exception. While it is possible to ignore exceptions, this removes the default -safeguard of ensuring you have sufficient data set to render a wholly valid -feed. - -To explain this more clearly: you may construct a set of data containers for a -feed where there is a Feed container, into which has been added some Entry -containers and a Deleted container. This forms a data hierarchy resembling a -normal feed. When rendering is performed, this hierarchy has its pieces passed -to relevant renderers, and the partial feeds (all DOMDocuments) are then pieced -together to create a complete feed. In the case of Source or Deleted (Tombstone) -containers, these are rendered only for Atom 2.0 and ignored for RSS. - -Due to the system being divided between data containers and renderers, -extensions have more mandatory requirements than their equivalents in the -`Zend\Feed\Reader` subcomponent. A typical extension offering namespaced feed -and entry level elements must itself reflect the exact same architecture: i.e. -it must offer both feed and entry level data containers, and matching renderers. -There is, fortunately, no complex integration work required since all extension -classes are simply registered and automatically used by the core classes. We -cover extensions in more detail at the end of this chapter. - -## Getting Started - -To use `Zend\Feed\Writer\Writer`, you will provide it with data, and then -trigger the renderer. What follows is an example demonstrating generation of a -minimal Atom 1.0 feed. Each feed or entry uses a separate data container. - -```php -use Zend\Feed\Writer\Feed; - -/** - * Create the parent feed - */ -$feed = new Feed; -$feed->setTitle("Paddy's Blog"); -$feed->setLink('http://www.example.com'); -$feed->setFeedLink('http://www.example.com/atom', 'atom'); -$feed->addAuthor([ - 'name' => 'Paddy', - 'email' => 'paddy@example.com', - 'uri' => 'http://www.example.com', -]); -$feed->setDateModified(time()); -$feed->addHub('http://pubsubhubbub.appspot.com/'); - -/** - * Add one or more entries. Note that entries must - * be manually added once created. - */ -$entry = $feed->createEntry(); -$entry->setTitle('All Your Base Are Belong To Us'); -$entry->setLink('http://www.example.com/all-your-base-are-belong-to-us'); -$entry->addAuthor([ - 'name' => 'Paddy', - 'email' => 'paddy@example.com', - 'uri' => 'http://www.example.com', -]); -$entry->setDateModified(time()); -$entry->setDateCreated(time()); -$entry->setDescription('Exposing the difficulty of porting games to English.'); -$entry->setContent( - 'I am not writing the article. The example is long enough as is ;).' -); -$feed->addEntry($entry); - -/** - * Render the resulting feed to Atom 1.0 and assign to $out. - * You can substitute "atom" with "rss" to generate an RSS 2.0 feed. - */ -$out = $feed->export('atom'); -``` - -The output rendered should be as follows: - -```xml -<?xml version="1.0" encoding="utf-8"?> -<feed xmlns="http://www.w3.org/2005/Atom"> - <title type="text">Paddy's Blog</title> - <subtitle type="text">Writing about PC Games since 176 BC.</subtitle> - <updated>2009-12-14T20:28:18+00:00</updated> - <generator uri="http://framework.zend.com" version="1.10.0alpha"> - Zend\Feed\Writer - </generator> - <link rel="alternate" type="text/html" href="http://www.example.com"/> - <link rel="self" type="application/atom+xml" - href="http://www.example.com/atom"/> - <id>http://www.example.com</id> - <author> - <name>Paddy</name> - <email>paddy@example.com</email> - <uri>http://www.example.com</uri> - </author> - <link rel="hub" href="http://pubsubhubbub.appspot.com/"/> - <entry> - <title type="html"><![CDATA[All Your Base Are Belong To - Us]]></title> - <summary type="html"> - <![CDATA[Exposing the difficultly of porting games to - English.]]> - </summary> - <published>2009-12-14T20:28:18+00:00</published> - <updated>2009-12-14T20:28:18+00:00</updated> - <link rel="alternate" type="text/html" - href="http://www.example.com/all-your-base-are-belong-to-us"/> - <id>http://www.example.com/all-your-base-are-belong-to-us</id> - <author> - <name>Paddy</name> - <email>paddy@example.com</email> - <uri>http://www.example.com</uri> - </author> - <content type="html"> - <![CDATA[I am not writing the article. - The example is long enough as is ;).]]> - </content> - </entry> -</feed> -``` - -This is a perfectly valid Atom 1.0 example. It should be noted that omitting an -obligatory point of data, such as a title, will trigger an exception when -rendering as Atom 1.0. This will differ for RSS 2.0, since a title may be -omitted so long as a description is present. This gives rise to exceptions that -differ between the two standards depending on the renderer in use. By design, -`Zend\Feed\Writer` will not render an invalid feed for either standard -unless the end-user deliberately elects to ignore all exceptions. This built in -safeguard was added to ensure users without in-depth knowledge of the relevant -specifications have a bit less to worry about. - -## Setting Feed Data Points - -Before you can render a feed, you must first setup the data necessary for the -feed being rendered. This utilises a simple setter style API, which doubles as -a method for validating the data being set. By design, the API closely matches -that for `Zend\Feed\Reader` to avoid undue confusion and uncertainty. - -`Zend\Feed\Writer` offers this API via its data container classes -`Zend\Feed\Writer\Feed` and `Zend\Feed\Writer\Entry` (not to mention the Atom -2.0 specific and extension classes). These classes merely store all feed data in -a type-agnostic manner, meaning you may reuse any data container with any -renderer without requiring additional work. Both classes are also amenable to -extensions, meaning that an extension may define its own container classes which -are registered to the base container classes as extensions, and are checked when -any method call triggers the base container's `__call()` method, allowing method -overloading to the extension classes. - -Here's a summary of the Core API for Feeds. You should note it comprises not -only the basic RSS and Atom standards, but also accounts for a number of -included extensions bundled with `Zend\Feed\Writer`. The naming of these -extension sourced methods remain fairly generic; all extension methods operate -at the same level as the Core API, though we do allow you to retrieve any -specific extension object separately if required. - -The Feed API for data is contained in `Zend\Feed\Writer\Feed`. In addition to the API -detailed below, the class also implements the `Countable` and `Iterator` interfaces. - -### Feed API Methods - -Method | Description ------- | ----------- -`setId()` | Set a unique identifier associated with this feed. For Atom 1.0 this is an `atom:id` element, whereas for RSS 2.0 it is added as a `guid` element. These are optional so long as a link is added; i.e. if no identifier is provided, the link is used. -`setTitle()` | Set the title of the feed. -`setDescription()` | Set the text description of the feed. -`setLink()` | Set a URI to the HTML website containing the same or similar information as this feed (i.e. if the feed is from a blog, it should provide the blog's URI where the HTML version of the entries can be read). -`setFeedLinks()` | Add a link to an XML feed, whether it is to the feed being generated, or an alternate URI pointing to the same feed but in a different format. At a minimum, it is recommended to include a link to the feed being generated so it has an identifiable final URI allowing a client to track its location changes without necessitating constant redirects. The parameter is an array of arrays, where each sub-array contains the keys "type" and "uri". The type should be one of "atom", "rss", or "rdf". -`addAuthors()` | Sets the data for authors. The parameter is an array of array,s where each sub-array may contain the keys "name", "email", and "uri". The "uri" value is only applicable for Atom feeds, since RSS contains no facility to show it. For RSS 2.0, rendering will create two elements: an author element containing the email reference with the name in brackets, and a Dublin Core creator element only containing the name. -`addAuthor()` | Sets the data for a single author following the same array format as described above for a single sub-array. -`setDateCreated()` | Sets the date on which this feed was created. Generally only applicable to Atom, where it represents the date the resource described by an Atom 1.0 document was created. The expected parameter may be a UNIX timestamp or a `DateTime` object. -`setDateModified()` | Sets the date on which this feed was last modified. The expected parameter may be a UNIX timestamp or a `DateTime` object. -`setLastBuildDate()` | Sets the date on which this feed was last build. The expected parameter may be a UNIX timestamp or a `DateTime` object. This will only be rendered for RSS 2.0 feeds, and is automatically rendered as the current date by default when not explicitly set. -`setLanguage()` | Sets the language of the feed. This will be omitted unless set. -`setGenerator()` | Allows the setting of a generator. The parameter should be an array containing the keys "name", "version", and "uri". If omitted a default generator will be added referencing `Zend\Feed\Writer`, the current zend-version version, and the Framework's URI. -`setCopyright()` | Sets a copyright notice associated with the feed. -`addHubs()` | Accepts an array of Pubsubhubbub Hub Endpoints to be rendered in the feed as Atom links so that PuSH Subscribers may subscribe to your feed. Note that you must implement a Pubsubhubbub Publisher in order for real-time updates to be enabled. A Publisher may be implemented using `Zend\Feed\Pubsubhubbub\Publisher`. The method `addHub()` allows adding a single hub at a time. -`addCategories()` | Accepts an array of categories for rendering, where each element is itself an array whose possible keys include "term", "label", and "scheme". The "term" is a typically a category name suitable for inclusion in a URI. The "label" may be a human readable category name supporting special characters (it is HTML encoded during rendering) and is a required key. The "scheme" (called the domain in RSS) is optional, but must be a valid URI. The method `addCategory()` allows adding a single category at a time. -`setImage()` | Accepts an array of image metadata for an RSS image or Atom logo. Atom 1.0 only requires a URI. RSS 2.0 requires a URI, HTML link, and an image title. RSS 2.0 optionally may send a width, height, and image description. To provide these, use an array argument with the following keys: "uri", "link", "title", "description", "height", and "width". The RSS 2.0 HTML link should point to the feed source's HTML page. -`createEntry()` | Returns a new instance of `Zend\Feed\Writer\Entry`. This is the Entry data container. New entries are not automatically assigned to the current feed, so you must explicitly call `addEntry()` to add the entry for rendering. -`addEntry()` | Adds an instance of `Zend\Feed\Writer\Entry` to the current feed container for rendering. -`createTombstone()` | Returns a new instance of `Zend\Feed\Writer\Deleted`. This is the Atom 2.0 Tombstone data container. New entries are not automatically assigned to the current feed, so you must explicitly call `addTombstone()` to add the deleted entry for rendering. -`addTombstone()` | Adds an instance of `Zend\Feed\Writer\Deleted` to the current feed container for rendering. -`removeEntry()` | Accepts a parameter indicating an array index of the entry to remove from the feed. -`export()` | Exports the entire data hierarchy to an XML feed. The method has two parameters. The first is the feed type, one of "atom" or "rss". The second is an optional boolean to set indicating whether or not Exceptions are thrown. The default is `TRUE`. - -> #### Retrieval methods -> -> In addition to the setters listed above, `Feed` instances also provide -> matching getters to retrieve data from the `Feed` data container. For -> example, `setImage()` is matched with a `getImage()` method. - -## Setting Entry Data Points - -Below is a summary of the Core API for entries and items. You should note that -it covers not only the basic RSS and Atom standards, but also a number of -included extensions bundled with `Zend\Feed\Writer`. The naming of these -extension sourced methods remain fairly generic; all extension methods operate -at the same level as the Core API, though we do allow you to retrieve any -specific extension object separately if required. - -The Entry *API* for data is contained in `Zend\Feed\Writer\Entry`. - -### Entry API Methods - -Method | Description ------- | ----------- -`setId()` | Set a unique identifier associated with this entry. For Atom 1.0 this is an `atom:id` element, whereas for RSS 2.0 it is added as a `guid` element. These are optional so long as a link is added; i.e. if no identifier is provided, the link is used. -`setTitle()` | Set the title of the entry. -`setDescription()` | Set the text description of the entry. -`setContent()` | Set the content of the entry. -`setLink()` | Set a URI to the HTML website containing the same or similar information as this entry (i.e. if the feed is from a blog, it should provide the blog article's URI where the HTML version of the entry can be read). -`setFeedLinks()` | Add a link to an XML feed, whether it is to the feed being generated, or an alternate URI pointing to the same feed but in a different format. At a minimum, it is recommended to include a link to the feed being generated so it has an identifiable final URI allowing a client to track its location changes without necessitating constant redirects. The parameter is an array of arrays, where each sub-array contains the keys "type" and "uri". The type should be one of "atom", "rss", or "rdf". If a type is omitted, it defaults to the type used when rendering the feed. -`addAuthors()` | Sets the data for authors. The parameter is an array of array,s where each sub-array may contain the keys "name", "email", and "uri". The "uri" value is only applicable for Atom feeds, since RSS contains no facility to show it. For RSS 2.0, rendering will create two elements: an author element containing the email reference with the name in brackets, and a Dublin Core creator element only containing the name. -`addAuthor()` | Sets the data for a single author following the same format as described above for a single sub-array. -`setDateCreated()` | Sets the date on which this entry was created. Generally only applicable to Atom where it represents the date the resource described by an Atom 1.0 document was created. The expected parameter may be a UNIX timestamp or a `DateTime` object. If omitted, the date used will be the current date and time. -`setDateModified()` | Sets the date on which this entry was last modified. The expected parameter may be a UNIX timestamp or a `DateTime` object. If omitted, the date used will be the current date and time. -`setCopyright()` | Sets a copyright notice associated with the entry. -`addCategories()` | Accepts an array of categories for rendering, where each element is itself an array whose possible keys include "term", "label", and "scheme". The "term" is a typically a category name suitable for inclusion in a URI. The "label" may be a human readable category name supporting special characters (it is encoded during rendering) and is a required key. The "scheme" (called the domain in RSS) is optional but must be a valid URI. -`addCategory()` | Sets the data for a single category following the same format as described above for a single sub-array. -`setCommentCount()` | Sets the number of comments associated with this entry. Rendering differs between RSS and Atom 2.0 depending on the element or attribute needed. -`setCommentLink()` | Sets a link to an HTML page containing comments associated with this entry. -`setCommentFeedLink()` | Sets a link to an XML feed containing comments associated with this entry. The parameter is an array containing the keys "uri" and "type", where the type is one of "rdf", "rss", or "atom". -`setCommentFeedLinks()` | Same as `setCommentFeedLink()`, except it accepts an array of arrays, where each subarray contains the expected parameters of `setCommentFeedLink()`. -`setEncoding()` | Sets the encoding of entry text. This will default to UTF-8, which is the preferred encoding. - -> #### Retrieval methods -> -> In addition to the setters listed above, `Entry` instances also provide -> matching getters to retrieve data from the `Entry` data container. For -> example, `setContent()` is matched with a `getContent()` method. - -## Extensions - -- TODO diff --git a/vendor/zendframework/zend-feed/mkdocs.yml b/vendor/zendframework/zend-feed/mkdocs.yml deleted file mode 100644 index 609957c1f69a7ac9df8301b3057e6e20ffe4aa08..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-feed/mkdocs.yml +++ /dev/null @@ -1,20 +0,0 @@ -docs_dir: doc/book -site_dir: doc/html -pages: - - index.md - - Introduction: intro.md - - Reader: - - "Zend\\Feed\\Reader": reader.md - - 'HTTP Clients': http-clients.md - - 'Importing Feeds': importing.md - - 'Feed Discovery': find-feeds.md - - 'Consuming RSS Feeds': consuming-rss.md - - 'Consuming Atom Feeds': consuming-atom.md - - 'Consuming Atom Entries': consuming-atom-entry.md - - Security: security.md - - Writer: writer.md - - Pubsubhubbub: pubsubhubbub.md -site_name: zend-feed -site_description: Zend\Feed -repo_url: 'https://github.com/zendframework/zend-feed' -copyright: 'Copyright (c) 2016 <a href="http://www.zend.com/">Zend Technologies USA Inc.</a>' diff --git a/vendor/zendframework/zend-feed/src/PubSubHubbub/AbstractCallback.php b/vendor/zendframework/zend-feed/src/PubSubHubbub/AbstractCallback.php index 7321c9625df4b318023006c8250b2eb36e4665e9..80624f752998e8ccbe3d77a2355683095fab2b23 100644 --- a/vendor/zendframework/zend-feed/src/PubSubHubbub/AbstractCallback.php +++ b/vendor/zendframework/zend-feed/src/PubSubHubbub/AbstractCallback.php @@ -33,6 +33,17 @@ abstract class AbstractCallback implements CallbackInterface */ protected $httpResponse = null; + /** + * The input stream to use when retrieving the request body. Defaults to + * php://input, but can be set to another value in order to force usage + * of another input method. This should primarily be used for testing + * purposes. + * + * @var string|resource String indicates a filename or stream to open; + * resource indicates an already created stream to use. + */ + protected $inputStream = 'php://input'; + /** * The number of Subscribers for which any updates are on behalf of. * @@ -67,7 +78,7 @@ public function setOptions($options) $options = ArrayUtils::iteratorToArray($options); } - if (!is_array($options)) { + if (! is_array($options)) { throw new Exception\InvalidArgumentException('Array or Traversable object' . 'expected, got ' . gettype($options)); } @@ -137,7 +148,7 @@ public function getStorage() */ public function setHttpResponse($httpResponse) { - if (!$httpResponse instanceof HttpResponse && !$httpResponse instanceof PhpResponse) { + if (! $httpResponse instanceof HttpResponse && ! $httpResponse instanceof PhpResponse) { throw new Exception\InvalidArgumentException('HTTP Response object must' . ' implement one of Zend\Feed\Pubsubhubbub\HttpResponse or' . ' Zend\Http\PhpEnvironment\Response'); @@ -196,30 +207,35 @@ public function getSubscriberCount() * Attempt to detect the callback URL (specifically the path forward) * @return string */ + // @codingStandardsIgnoreStart protected function _detectCallbackUrl() { - $callbackUrl = ''; - if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { - $callbackUrl = $_SERVER['HTTP_X_ORIGINAL_URL']; - } elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) { - $callbackUrl = $_SERVER['HTTP_X_REWRITE_URL']; - } elseif (isset($_SERVER['REQUEST_URI'])) { - $callbackUrl = $_SERVER['REQUEST_URI']; - $scheme = 'http'; - if ($_SERVER['HTTPS'] == 'on') { - $scheme = 'https'; - } - $schemeAndHttpHost = $scheme . '://' . $this->_getHttpHost(); - if (strpos($callbackUrl, $schemeAndHttpHost) === 0) { - $callbackUrl = substr($callbackUrl, strlen($schemeAndHttpHost)); - } - } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { - $callbackUrl= $_SERVER['ORIG_PATH_INFO']; - if (!empty($_SERVER['QUERY_STRING'])) { - $callbackUrl .= '?' . $_SERVER['QUERY_STRING']; - } + // @codingStandardsIgnoreEnd + $callbackUrl = null; + + // IIS7 with URL Rewrite: make sure we get the unencoded url + // (double slash problem). + $iisUrlRewritten = isset($_SERVER['IIS_WasUrlRewritten']) ? $_SERVER['IIS_WasUrlRewritten'] : null; + $unencodedUrl = isset($_SERVER['UNENCODED_URL']) ? $_SERVER['UNENCODED_URL'] : null; + if ('1' == $iisUrlRewritten && ! empty($unencodedUrl)) { + return $unencodedUrl; } - return $callbackUrl; + + // HTTP proxy requests setup request URI with scheme and host [and port] + // + the URL path, only use URL path. + if (isset($_SERVER['REQUEST_URI'])) { + $callbackUrl = $this->buildCallbackUrlFromRequestUri(); + } + + if (null !== $callbackUrl) { + return $callbackUrl; + } + + if (isset($_SERVER['ORIG_PATH_INFO'])) { + return $this->buildCallbackUrlFromOrigPathInfo(); + } + + return ''; } /** @@ -227,24 +243,26 @@ protected function _detectCallbackUrl() * * @return string */ + // @codingStandardsIgnoreStart protected function _getHttpHost() { - if (!empty($_SERVER['HTTP_HOST'])) { + // @codingStandardsIgnoreEnd + if (! empty($_SERVER['HTTP_HOST'])) { return $_SERVER['HTTP_HOST']; } - $scheme = 'http'; - if ($_SERVER['HTTPS'] == 'on') { - $scheme = 'https'; - } - $name = $_SERVER['SERVER_NAME']; - $port = $_SERVER['SERVER_PORT']; - if (($scheme == 'http' && $port == 80) - || ($scheme == 'https' && $port == 443) + + $https = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : null; + $scheme = $https === 'on' ? 'https' : 'http'; + $name = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : ''; + $port = isset($_SERVER['SERVER_PORT']) ? (int) $_SERVER['SERVER_PORT'] : 80; + + if (($scheme === 'http' && $port === 80) + || ($scheme === 'https' && $port === 443) ) { return $name; } - return $name . ':' . $port; + return sprintf('%s:%d', $name, $port); } /** @@ -253,19 +271,21 @@ protected function _getHttpHost() * @param string $header * @return bool|string */ + // @codingStandardsIgnoreStart protected function _getHeader($header) { + // @codingStandardsIgnoreEnd $temp = strtoupper(str_replace('-', '_', $header)); - if (!empty($_SERVER[$temp])) { + if (! empty($_SERVER[$temp])) { return $_SERVER[$temp]; } $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header)); - if (!empty($_SERVER[$temp])) { + if (! empty($_SERVER[$temp])) { return $_SERVER[$temp]; } if (function_exists('apache_request_headers')) { $headers = apache_request_headers(); - if (!empty($headers[$header])) { + if (! empty($headers[$header])) { return $headers[$header]; } } @@ -277,15 +297,48 @@ protected function _getHeader($header) * * @return string|false Raw body, or false if not present */ + // @codingStandardsIgnoreStart protected function _getRawBody() { - $body = file_get_contents('php://input'); - if (strlen(trim($body)) == 0 && isset($GLOBALS['HTTP_RAW_POST_DATA'])) { - $body = $GLOBALS['HTTP_RAW_POST_DATA']; + // @codingStandardsIgnoreEnd + $body = is_resource($this->inputStream) + ? stream_get_contents($this->inputStream) + : file_get_contents($this->inputStream); + + return strlen(trim($body)) > 0 ? $body : false; + } + + /** + * Build the callback URL from the REQUEST_URI server parameter. + * + * @return string + */ + private function buildCallbackUrlFromRequestUri() + { + $callbackUrl = $_SERVER['REQUEST_URI']; + $https = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : null; + $scheme = $https === 'on' ? 'https' : 'http'; + if ($https === 'on') { + $scheme = 'https'; } - if (strlen(trim($body)) > 0) { - return $body; + $schemeAndHttpHost = $scheme . '://' . $this->_getHttpHost(); + if (strpos($callbackUrl, $schemeAndHttpHost) === 0) { + $callbackUrl = substr($callbackUrl, strlen($schemeAndHttpHost)); } - return false; + return $callbackUrl; + } + + /** + * Build the callback URL from the ORIG_PATH_INFO server parameter. + * + * @return string + */ + private function buildCallbackUrlFromOrigPathInfo() + { + $callbackUrl = $_SERVER['ORIG_PATH_INFO']; + if (! empty($_SERVER['QUERY_STRING'])) { + $callbackUrl .= '?' . $_SERVER['QUERY_STRING']; + } + return $callbackUrl; } } diff --git a/vendor/zendframework/zend-feed/src/PubSubHubbub/HttpResponse.php b/vendor/zendframework/zend-feed/src/PubSubHubbub/HttpResponse.php index 972296879ca6ccd10ede1ff2ef6b6186e03697cb..b658affada7c99e50338f3e5930da110adc43799 100644 --- a/vendor/zendframework/zend-feed/src/PubSubHubbub/HttpResponse.php +++ b/vendor/zendframework/zend-feed/src/PubSubHubbub/HttpResponse.php @@ -53,21 +53,21 @@ public function send() */ public function sendHeaders() { - if (count($this->headers) || (200 != $this->statusCode)) { + if ($this->headers || (200 != $this->statusCode)) { $this->canSendHeaders(true); } elseif (200 == $this->statusCode) { return; } $httpCodeSent = false; foreach ($this->headers as $header) { - if (!$httpCodeSent && $this->statusCode) { + if (! $httpCodeSent && $this->statusCode) { header($header['name'] . ': ' . $header['value'], $header['replace'], $this->statusCode); $httpCodeSent = true; } else { header($header['name'] . ': ' . $header['value'], $header['replace']); } } - if (!$httpCodeSent) { + if (! $httpCodeSent) { header('HTTP/1.1 ' . $this->statusCode); } } @@ -133,16 +133,18 @@ public function getHeaders() * Can we send headers? * * @param bool $throw Whether or not to throw an exception if headers have been sent; defaults to false - * @return HttpResponse + * @return bool * @throws Exception\RuntimeException */ public function canSendHeaders($throw = false) { $ok = headers_sent($file, $line); if ($ok && $throw) { - throw new Exception\RuntimeException('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); + throw new Exception\RuntimeException( + 'Cannot send headers; headers already sent in ' . $file . ', line ' . $line + ); } - return !$ok; + return ! $ok; } /** @@ -154,7 +156,7 @@ public function canSendHeaders($throw = false) */ public function setStatusCode($code) { - if (!is_int($code) || (100 > $code) || (599 < $code)) { + if (! is_int($code) || (100 > $code) || (599 < $code)) { throw new Exception\InvalidArgumentException('Invalid HTTP response' . ' code:' . $code); } @@ -201,8 +203,10 @@ public function getContent() * @param string $name * @return string */ + // @codingStandardsIgnoreStart protected function _normalizeHeader($name) { + // @codingStandardsIgnoreEnd $filtered = str_replace(['-', '_'], ' ', (string) $name); $filtered = ucwords(strtolower($filtered)); $filtered = str_replace(' ', '-', $filtered); diff --git a/vendor/zendframework/zend-feed/src/PubSubHubbub/Model/Subscription.php b/vendor/zendframework/zend-feed/src/PubSubHubbub/Model/Subscription.php index a2086163d59fd5805e9eca3a84d192e4ebd98e61..9780b6a8d889ca1199f554c916dd33b475f10a70 100644 --- a/vendor/zendframework/zend-feed/src/PubSubHubbub/Model/Subscription.php +++ b/vendor/zendframework/zend-feed/src/PubSubHubbub/Model/Subscription.php @@ -31,7 +31,7 @@ class Subscription extends AbstractModel implements SubscriptionPersistenceInter */ public function setSubscription(array $data) { - if (!isset($data['id'])) { + if (! isset($data['id'])) { throw new PubSubHubbub\Exception\InvalidArgumentException( 'ID must be set before attempting a save' ); @@ -66,12 +66,12 @@ public function setSubscription(array $data) */ public function getSubscription($key) { - if (empty($key) || !is_string($key)) { + if (empty($key) || ! is_string($key)) { throw new PubSubHubbub\Exception\InvalidArgumentException('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } $result = $this->db->select(['id' => $key]); - if (count($result)) { + if ($result && count($result)) { return $result->current()->getArrayCopy(); } return false; @@ -86,12 +86,12 @@ public function getSubscription($key) */ public function hasSubscription($key) { - if (empty($key) || !is_string($key)) { + if (empty($key) || ! is_string($key)) { throw new PubSubHubbub\Exception\InvalidArgumentException('Invalid parameter "key"' .' of "' . $key . '" must be a non-empty string'); } $result = $this->db->select(['id' => $key]); - if (count($result)) { + if ($result && count($result)) { return true; } return false; @@ -106,7 +106,7 @@ public function hasSubscription($key) public function deleteSubscription($key) { $result = $this->db->select(['id' => $key]); - if (count($result)) { + if ($result && count($result)) { $this->db->delete( ['id' => $key] ); diff --git a/vendor/zendframework/zend-feed/src/PubSubHubbub/PubSubHubbub.php b/vendor/zendframework/zend-feed/src/PubSubHubbub/PubSubHubbub.php index a930a70bed640bde8e6cff876a5e8c624752c385..d7922aca64e7721467224b518f2663743a5ed3f6 100644 --- a/vendor/zendframework/zend-feed/src/PubSubHubbub/PubSubHubbub.php +++ b/vendor/zendframework/zend-feed/src/PubSubHubbub/PubSubHubbub.php @@ -85,7 +85,7 @@ public static function setHttpClient(Http\Client $httpClient) */ public static function getHttpClient() { - if (!isset(static::$httpClient)) { + if (! isset(static::$httpClient)) { static::$httpClient = new Http\Client; } else { static::$httpClient->resetParameters(); diff --git a/vendor/zendframework/zend-feed/src/PubSubHubbub/Publisher.php b/vendor/zendframework/zend-feed/src/PubSubHubbub/Publisher.php index aed9c8fe28418c94293d362fe92a55b07a04a40c..1ebe2a6cd18402bd5c95757dd5113e3e6a547ec7 100644 --- a/vendor/zendframework/zend-feed/src/PubSubHubbub/Publisher.php +++ b/vendor/zendframework/zend-feed/src/PubSubHubbub/Publisher.php @@ -75,7 +75,7 @@ public function setOptions($options) $options = ArrayUtils::iteratorToArray($options); } - if (!is_array($options)) { + if (! is_array($options)) { throw new Exception\InvalidArgumentException('Array or Traversable object' . 'expected, got ' . gettype($options)); } @@ -100,7 +100,7 @@ public function setOptions($options) */ public function addHubUrl($url) { - if (empty($url) || !is_string($url) || !Uri::factory($url)->isValid()) { + if (empty($url) || ! is_string($url) || ! Uri::factory($url)->isValid()) { throw new Exception\InvalidArgumentException('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . 'URL'); @@ -131,7 +131,7 @@ public function addHubUrls(array $urls) */ public function removeHubUrl($url) { - if (!in_array($url, $this->getHubUrls())) { + if (! in_array($url, $this->getHubUrls())) { return $this; } $key = array_search($url, $this->hubUrls); @@ -159,7 +159,7 @@ public function getHubUrls() */ public function addUpdatedTopicUrl($url) { - if (empty($url) || !is_string($url) || !Uri::factory($url)->isValid()) { + if (empty($url) || ! is_string($url) || ! Uri::factory($url)->isValid()) { throw new Exception\InvalidArgumentException('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . 'URL'); @@ -190,7 +190,7 @@ public function addUpdatedTopicUrls(array $urls) */ public function removeUpdatedTopicUrl($url) { - if (!in_array($url, $this->getUpdatedTopicUrls())) { + if (! in_array($url, $this->getUpdatedTopicUrls())) { return $this; } $key = array_search($url, $this->updatedTopicUrls); @@ -219,7 +219,7 @@ public function getUpdatedTopicUrls() */ public function notifyHub($url) { - if (empty($url) || !is_string($url) || !Uri::factory($url)->isValid()) { + if (empty($url) || ! is_string($url) || ! Uri::factory($url)->isValid()) { throw new Exception\InvalidArgumentException('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . 'URL'); @@ -281,7 +281,7 @@ public function setParameter($name, $value = null) $this->setParameters($name); return $this; } - if (empty($name) || !is_string($name)) { + if (empty($name) || ! is_string($name)) { throw new Exception\InvalidArgumentException('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } @@ -289,7 +289,7 @@ public function setParameter($name, $value = null) $this->removeParameter($name); return $this; } - if (empty($value) || (!is_string($value) && $value !== null)) { + if (empty($value) || (! is_string($value) && $value !== null)) { throw new Exception\InvalidArgumentException('Invalid parameter "value"' . ' of "' . $value . '" must be a non-empty string'); } @@ -320,7 +320,7 @@ public function setParameters(array $parameters) */ public function removeParameter($name) { - if (empty($name) || !is_string($name)) { + if (empty($name) || ! is_string($name)) { throw new Exception\InvalidArgumentException('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } @@ -348,7 +348,7 @@ public function getParameters() */ public function isSuccess() { - return !(count($this->errors) != 0); + return ! $this->errors; } /** @@ -369,8 +369,10 @@ public function getErrors() * @return \Zend\Http\Client * @throws Exception\RuntimeException */ + // @codingStandardsIgnoreStart protected function _getHttpClient() { + // @codingStandardsIgnoreEnd $client = PubSubHubbub::getHttpClient(); $client->setMethod(HttpRequest::METHOD_POST); $client->setOptions([ diff --git a/vendor/zendframework/zend-feed/src/PubSubHubbub/Subscriber.php b/vendor/zendframework/zend-feed/src/PubSubHubbub/Subscriber.php index 802a00192e61e5d6a510d9ebab360aa6c4468e4f..0f4cdfc69d0ad3d36b5db68f1282035293d15925 100644 --- a/vendor/zendframework/zend-feed/src/PubSubHubbub/Subscriber.php +++ b/vendor/zendframework/zend-feed/src/PubSubHubbub/Subscriber.php @@ -147,7 +147,7 @@ public function setOptions($options) $options = ArrayUtils::iteratorToArray($options); } - if (!is_array($options)) { + if (! is_array($options)) { throw new Exception\InvalidArgumentException('Array or Traversable object' . 'expected, got ' . gettype($options)); } @@ -193,7 +193,7 @@ public function setOptions($options) */ public function setTopicUrl($url) { - if (empty($url) || !is_string($url) || !Uri::factory($url)->isValid()) { + if (empty($url) || ! is_string($url) || ! Uri::factory($url)->isValid()) { throw new Exception\InvalidArgumentException('Invalid parameter "url"' .' of "' . $url . '" must be a non-empty string and a valid' .' URL'); @@ -256,7 +256,7 @@ public function getLeaseSeconds() */ public function setCallbackUrl($url) { - if (empty($url) || !is_string($url) || !Uri::factory($url)->isValid()) { + if (empty($url) || ! is_string($url) || ! Uri::factory($url)->isValid()) { throw new Exception\InvalidArgumentException('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); @@ -326,7 +326,7 @@ public function getPreferredVerificationMode() */ public function addHubUrl($url) { - if (empty($url) || !is_string($url) || !Uri::factory($url)->isValid()) { + if (empty($url) || ! is_string($url) || ! Uri::factory($url)->isValid()) { throw new Exception\InvalidArgumentException('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); @@ -357,7 +357,7 @@ public function addHubUrls(array $urls) */ public function removeHubUrl($url) { - if (!in_array($url, $this->getHubUrls())) { + if (! in_array($url, $this->getHubUrls())) { return $this; } $key = array_search($url, $this->hubUrls); @@ -386,7 +386,7 @@ public function getHubUrls() */ public function addAuthentication($url, array $authentication) { - if (empty($url) || !is_string($url) || !Uri::factory($url)->isValid()) { + if (empty($url) || ! is_string($url) || ! Uri::factory($url)->isValid()) { throw new Exception\InvalidArgumentException('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . ' URL'); @@ -445,7 +445,7 @@ public function setParameter($name, $value = null) $this->setParameters($name); return $this; } - if (empty($name) || !is_string($name)) { + if (empty($name) || ! is_string($name)) { throw new Exception\InvalidArgumentException('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } @@ -453,7 +453,7 @@ public function setParameter($name, $value = null) $this->removeParameter($name); return $this; } - if (empty($value) || (!is_string($value) && $value !== null)) { + if (empty($value) || (! is_string($value) && $value !== null)) { throw new Exception\InvalidArgumentException('Invalid parameter "value"' . ' of "' . $value . '" must be a non-empty string'); } @@ -484,7 +484,7 @@ public function setParameters(array $parameters) */ public function removeParameter($name) { - if (empty($name) || !is_string($name)) { + if (empty($name) || ! is_string($name)) { throw new Exception\InvalidArgumentException('Invalid parameter "name"' . ' of "' . $name . '" must be a non-empty string'); } @@ -564,10 +564,7 @@ public function unsubscribeAll() */ public function isSuccess() { - if (count($this->errors) > 0) { - return false; - } - return true; + return ! $this->errors; } /** @@ -602,8 +599,10 @@ public function getAsyncHubs() * @return void * @throws Exception\RuntimeException */ + // @codingStandardsIgnoreStart protected function _doRequest($mode) { + // @codingStandardsIgnoreEnd $client = $this->_getHttpClient(); $hubs = $this->getHubUrls(); if (empty($hubs)) { @@ -648,8 +647,10 @@ protected function _doRequest($mode) * * @return \Zend\Http\Client */ + // @codingStandardsIgnoreStart protected function _getHttpClient() { + // @codingStandardsIgnoreEnd $client = PubSubHubbub::getHttpClient(); $client->setMethod(HttpRequest::METHOD_POST); $client->setOptions(['useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' @@ -663,12 +664,14 @@ protected function _getHttpClient() * * @param string $hubUrl * @param string $mode - * @return string + * @return array * @throws Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _getRequestParameters($hubUrl, $mode) { - if (!in_array($mode, ['subscribe', 'unsubscribe'])) { + // @codingStandardsIgnoreEnd + if (! in_array($mode, ['subscribe', 'unsubscribe'])) { throw new Exception\InvalidArgumentException('Invalid mode specified: "' . $mode . '" which should have been "subscribe" or "unsubscribe"'); } @@ -705,7 +708,7 @@ protected function _getRequestParameters($hubUrl, $mode) $params['hub.verify_token'] = $token; // Note: query string only usable with PuSH 0.2 Hubs - if (!$this->usePathParameter) { + if (! $this->usePathParameter) { $params['hub.callback'] = $this->getCallbackUrl() . '?xhub.subscription=' . PubSubHubbub::urlencode($key); } else { @@ -738,7 +741,9 @@ protected function _getRequestParameters($hubUrl, $mode) 'verify_token' => hash('sha256', $params['hub.verify_token']), 'secret' => null, 'expiration_time' => $expires, - 'subscription_state' => ($mode == 'unsubscribe')? PubSubHubbub::SUBSCRIPTION_TODELETE : PubSubHubbub::SUBSCRIPTION_NOTVERIFIED, + // @codingStandardsIgnoreStart + 'subscription_state' => ($mode == 'unsubscribe') ? PubSubHubbub::SUBSCRIPTION_TODELETE : PubSubHubbub::SUBSCRIPTION_NOTVERIFIED, + // @codingStandardsIgnoreEnd ]; $this->getStorage()->setSubscription($data); @@ -754,9 +759,11 @@ protected function _getRequestParameters($hubUrl, $mode) * * @return string */ + // @codingStandardsIgnoreStart protected function _generateVerifyToken() { - if (!empty($this->testStaticToken)) { + // @codingStandardsIgnoreEnd + if (! empty($this->testStaticToken)) { return $this->testStaticToken; } return uniqid(rand(), true) . time(); @@ -770,8 +777,10 @@ protected function _generateVerifyToken() * @param string $hubUrl The Hub Server URL for which this token will apply * @return string */ + // @codingStandardsIgnoreStart protected function _generateSubscriptionKey(array $params, $hubUrl) { + // @codingStandardsIgnoreEnd $keyBase = $params['hub.topic'] . $hubUrl; $key = md5($keyBase); @@ -784,8 +793,10 @@ protected function _generateSubscriptionKey(array $params, $hubUrl) * @param array $params * @return array */ + // @codingStandardsIgnoreStart protected function _urlEncode(array $params) { + // @codingStandardsIgnoreEnd $encoded = []; foreach ($params as $key => $value) { if (is_array($value)) { @@ -809,8 +820,10 @@ protected function _urlEncode(array $params) * @param array $params * @return array */ + // @codingStandardsIgnoreStart protected function _toByteValueOrderedString(array $params) { + // @codingStandardsIgnoreEnd $return = []; uksort($params, 'strnatcmp'); foreach ($params as $key => $value) { diff --git a/vendor/zendframework/zend-feed/src/PubSubHubbub/Subscriber/Callback.php b/vendor/zendframework/zend-feed/src/PubSubHubbub/Subscriber/Callback.php index 56c06c7dfe5bfce4e0d163ccb07662ec8f8d24e2..a6bffef2170a0e85a23631062b15ce87980b5ddf 100644 --- a/vendor/zendframework/zend-feed/src/PubSubHubbub/Subscriber/Callback.php +++ b/vendor/zendframework/zend-feed/src/PubSubHubbub/Subscriber/Callback.php @@ -147,7 +147,7 @@ public function isValidHubVerification(array $httpGetData) 'hub_verify_token', ]; foreach ($required as $key) { - if (!array_key_exists($key, $httpGetData)) { + if (! array_key_exists($key, $httpGetData)) { return false; } } @@ -157,11 +157,11 @@ public function isValidHubVerification(array $httpGetData) return false; } if ($httpGetData['hub_mode'] == 'subscribe' - && !array_key_exists('hub_lease_seconds', $httpGetData) + && ! array_key_exists('hub_lease_seconds', $httpGetData) ) { return false; } - if (!Uri::factory($httpGetData['hub_topic'])->isValid()) { + if (! Uri::factory($httpGetData['hub_topic'])->isValid()) { return false; } @@ -169,7 +169,7 @@ public function isValidHubVerification(array $httpGetData) * Attempt to retrieve any Verification Token Key attached to Callback * URL's path by our Subscriber implementation */ - if (!$this->_hasValidVerifyToken($httpGetData)) { + if (! $this->_hasValidVerifyToken($httpGetData)) { return false; } return true; @@ -220,14 +220,16 @@ public function getFeedUpdate() * @param bool $checkValue * @return bool */ + // @codingStandardsIgnoreStart protected function _hasValidVerifyToken(array $httpGetData = null, $checkValue = true) { + // @codingStandardsIgnoreEnd $verifyTokenKey = $this->_detectVerifyTokenKey($httpGetData); if (empty($verifyTokenKey)) { return false; } $verifyTokenExists = $this->getStorage()->hasSubscription($verifyTokenKey); - if (!$verifyTokenExists) { + if (! $verifyTokenExists) { return false; } if ($checkValue) { @@ -250,8 +252,10 @@ protected function _hasValidVerifyToken(array $httpGetData = null, $checkValue = * @param null|array $httpGetData * @return false|string */ + // @codingStandardsIgnoreStart protected function _detectVerifyTokenKey(array $httpGetData = null) { + // @codingStandardsIgnoreEnd /** * Available when sub keys encoding in Callback URL path */ @@ -286,8 +290,10 @@ protected function _detectVerifyTokenKey(array $httpGetData = null) * * @return array|void */ + // @codingStandardsIgnoreStart protected function _parseQueryString() { + // @codingStandardsIgnoreEnd $params = []; $queryString = ''; if (isset($_SERVER['QUERY_STRING'])) { diff --git a/vendor/zendframework/zend-feed/src/Reader/AbstractEntry.php b/vendor/zendframework/zend-feed/src/Reader/AbstractEntry.php index a706ff82ef6a2b98d9dbeb1db2103883c6d305ac..0e75da7bb502f578c9ad7d50140a3474e9717a98 100644 --- a/vendor/zendframework/zend-feed/src/Reader/AbstractEntry.php +++ b/vendor/zendframework/zend-feed/src/Reader/AbstractEntry.php @@ -13,6 +13,9 @@ use DOMElement; use DOMXPath; +/** + * @deprecated This (abstract) class is deprecated. Use Zend\Feed\Reader\Entry\AbstractEntry instead. + */ abstract class AbstractEntry { /** @@ -121,7 +124,7 @@ public function saveXml() $dom = new DOMDocument('1.0', $this->getEncoding()); $entry = $dom->importNode($this->getElement(), true); $dom->appendChild($entry); - return $dom->saveXml(); + return $dom->saveXML(); } /** @@ -141,7 +144,7 @@ public function getType() */ public function getXpath() { - if (!$this->xpath) { + if (! $this->xpath) { $this->setXpath(new DOMXPath($this->getDomDocument())); } return $this->xpath; @@ -207,8 +210,10 @@ public function __call($method, $args) * * @return void */ + // @codingStandardsIgnoreStart protected function _loadExtensions() { + // @codingStandardsIgnoreEnd $all = Reader::getExtensions(); $feed = $all['entry']; foreach ($feed as $extension) { diff --git a/vendor/zendframework/zend-feed/src/Reader/AbstractFeed.php b/vendor/zendframework/zend-feed/src/Reader/AbstractFeed.php index 8cc234717c101d0f242493ba531d3eaf1541fe96..b2110d1c6bce6061dd1d53ca387f68299eb8e4e3 100644 --- a/vendor/zendframework/zend-feed/src/Reader/AbstractFeed.php +++ b/vendor/zendframework/zend-feed/src/Reader/AbstractFeed.php @@ -13,6 +13,9 @@ use DOMElement; use DOMXPath; +/** + * @deprecated This (abstract) class is deprecated. Use \Zend\Feed\Reader\Feed\AbstractFeed instead. + */ abstract class AbstractFeed implements Feed\FeedInterface { /** @@ -122,11 +125,11 @@ public function count() /** * Return the current entry * - * @return \Zend\Feed\Reader\AbstractEntry + * @return \Zend\Feed\Reader\Entry\AbstractEntry */ public function current() { - if (substr($this->getType(), 0, 3) == 'rss') { + if (0 === strpos($this->getType(), 'rss')) { $reader = new Entry\RSS($this->entries[$this->key()], $this->key(), $this->getType()); } else { $reader = new Entry\Atom($this->entries[$this->key()], $this->key(), $this->getType()); @@ -168,7 +171,7 @@ public function getEncoding() */ public function saveXml() { - return $this->getDomDocument()->saveXml(); + return $this->getDomDocument()->saveXML(); } /** diff --git a/vendor/zendframework/zend-feed/src/Reader/Collection.php b/vendor/zendframework/zend-feed/src/Reader/Collection.php index f50c1bc2f2f934c0fe9291649efd4362ee99c184..b6ee93a8719334c3b43e5a0dd67bb634eaea5704 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Collection.php +++ b/vendor/zendframework/zend-feed/src/Reader/Collection.php @@ -3,7 +3,7 @@ * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2019 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -11,6 +11,11 @@ use ArrayObject; +/** + * @deprecated This class is deprecated. Use the concrete collection classes + * \Zend\Feed\Reader\Collection\Author and \Zend\Feed\Reader\Collection\Category + * or the generic class \Zend\Feed\Reader\Collection\Collection instead. + */ class Collection extends ArrayObject { } diff --git a/vendor/zendframework/zend-feed/src/Reader/Collection/Category.php b/vendor/zendframework/zend-feed/src/Reader/Collection/Category.php index 2f43a071828c58a5c2342c2140b34ec44b2945f5..46d64829f5ea1f6aa7f020db89526edab5b3f010 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Collection/Category.php +++ b/vendor/zendframework/zend-feed/src/Reader/Collection/Category.php @@ -23,7 +23,7 @@ public function getValues() { $categories = []; foreach ($this->getIterator() as $element) { - if (isset($element['label']) && !empty($element['label'])) { + if (isset($element['label']) && ! empty($element['label'])) { $categories[] = $element['label']; } else { $categories[] = $element['term']; diff --git a/vendor/zendframework/zend-feed/src/Reader/Entry/AbstractEntry.php b/vendor/zendframework/zend-feed/src/Reader/Entry/AbstractEntry.php index 1342431a3f5b2d486adabb3dba86dc5176b60371..fa8c3f0f018f6497194c355b2f72944e09868ae9 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Entry/AbstractEntry.php +++ b/vendor/zendframework/zend-feed/src/Reader/Entry/AbstractEntry.php @@ -126,7 +126,7 @@ public function saveXml() $deep = version_compare(PHP_VERSION, '7', 'ge') ? 1 : true; $entry = $dom->importNode($this->getElement(), $deep); $dom->appendChild($entry); - return $dom->saveXml(); + return $dom->saveXML(); } /** @@ -146,7 +146,7 @@ public function getType() */ public function getXpath() { - if (!$this->xpath) { + if (! $this->xpath) { $this->setXpath(new DOMXPath($this->getDomDocument())); } return $this->xpath; diff --git a/vendor/zendframework/zend-feed/src/Reader/Entry/Atom.php b/vendor/zendframework/zend-feed/src/Reader/Entry/Atom.php index 84efaadda579b9df0d787343093c0c2a60d4de04..b60126609fb26b7ada9cc6c7f19570902c85ab4d 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Entry/Atom.php +++ b/vendor/zendframework/zend-feed/src/Reader/Entry/Atom.php @@ -49,10 +49,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) } /** - * Get the specified author - * - * @param int $index - * @return string|null + * @inheritdoc */ public function getAuthor($index = 0) { @@ -199,7 +196,7 @@ public function getId() */ public function getLink($index = 0) { - if (!array_key_exists('links', $this->data)) { + if (! array_key_exists('links', $this->data)) { $this->getLinks(); } @@ -269,7 +266,7 @@ public function getCommentCount() $commentcount = $this->getExtension('Thread')->getCommentCount(); - if (!$commentcount) { + if (! $commentcount) { $commentcount = $this->getExtension('Atom')->getCommentCount(); } diff --git a/vendor/zendframework/zend-feed/src/Reader/Entry/EntryInterface.php b/vendor/zendframework/zend-feed/src/Reader/Entry/EntryInterface.php index 250f4b6e037dbd210375fa8bf30f2eda45eb0178..b0a445ba4b395265f291d3eed67b97796e94a662 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Entry/EntryInterface.php +++ b/vendor/zendframework/zend-feed/src/Reader/Entry/EntryInterface.php @@ -17,7 +17,7 @@ interface EntryInterface * Get the specified author * * @param int $index - * @return string|null + * @return array<string, string>|null */ public function getAuthor($index = 0); diff --git a/vendor/zendframework/zend-feed/src/Reader/Entry/Rss.php b/vendor/zendframework/zend-feed/src/Reader/Entry/Rss.php index 0832ba36932fc92eb8192b87bc78816bcab0ef1a..9094a13c5728ccfa75c687be6ba7dfed7cc582f5 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Entry/Rss.php +++ b/vendor/zendframework/zend-feed/src/Reader/Entry/Rss.php @@ -41,8 +41,8 @@ class Rss extends AbstractEntry implements EntryInterface public function __construct(DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); - $this->xpathQueryRss = '//item[' . ($this->entryKey+1) . ']'; - $this->xpathQueryRdf = '//rss:item[' . ($this->entryKey+1) . ']'; + $this->xpathQueryRss = '//item[' . ($this->entryKey + 1) . ']'; + $this->xpathQueryRdf = '//rss:item[' . ($this->entryKey + 1) . ']'; $manager = Reader\Reader::getExtensionManager(); $extensions = [ @@ -63,10 +63,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null) } /** - * Get an author entry - * - * @param int $index - * @return string + * @inheritdoc */ public function getAuthor($index = 0) { @@ -92,7 +89,7 @@ public function getAuthors() $authors = []; $authorsDc = $this->getExtension('DublinCore')->getAuthors(); - if (!empty($authorsDc)) { + if (! empty($authorsDc)) { foreach ($authorsDc as $author) { $authors[] = [ 'name' => $author['name'] @@ -151,7 +148,7 @@ public function getContent() $content = $this->getExtension('Content')->getContent(); - if (!$content) { + if (! $content) { $content = $this->getDescription(); } @@ -209,7 +206,8 @@ public function getDateModified() 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), - 0, $e + 0, + $e ); } } @@ -218,15 +216,15 @@ public function getDateModified() } } - if (!$date) { + if (! $date) { $date = $this->getExtension('DublinCore')->getDate(); } - if (!$date) { + if (! $date) { $date = $this->getExtension('Atom')->getDateModified(); } - if (!$date) { + if (! $date) { $date = null; } @@ -256,7 +254,7 @@ public function getDescription() $description = $this->xpath->evaluate('string(' . $this->xpathQueryRdf . '/rss:description)'); } - if (!$description) { + if (! $description) { $description = $this->getExtension('DublinCore')->getDescription(); } @@ -264,7 +262,7 @@ public function getDescription() $description = $this->getExtension('Atom')->getDescription(); } - if (!$description) { + if (! $description) { $description = null; } @@ -296,7 +294,7 @@ public function getEnclosure() } } - if (!$enclosure) { + if (! $enclosure) { $enclosure = $this->getExtension('Atom')->getEnclosure(); } @@ -324,7 +322,7 @@ public function getId() $id = $this->xpath->evaluate('string(' . $this->xpathQueryRss . '/guid)'); } - if (!$id) { + if (! $id) { $id = $this->getExtension('DublinCore')->getId(); } @@ -332,7 +330,7 @@ public function getId() $id = $this->getExtension('Atom')->getId(); } - if (!$id) { + if (! $id) { if ($this->getPermalink()) { $id = $this->getPermalink(); } elseif ($this->getTitle()) { @@ -355,7 +353,7 @@ public function getId() */ public function getLink($index = 0) { - if (!array_key_exists('links', $this->data)) { + if (! array_key_exists('links', $this->data)) { $this->getLinks(); } @@ -386,7 +384,7 @@ public function getLinks() $list = $this->xpath->query($this->xpathQueryRdf . '//rss:link'); } - if (!$list->length) { + if (! $list->length) { $links = $this->getExtension('Atom')->getLinks(); } else { foreach ($list as $link) { @@ -470,15 +468,15 @@ public function getTitle() $title = $this->xpath->evaluate('string(' . $this->xpathQueryRdf . '/rss:title)'); } - if (!$title) { + if (! $title) { $title = $this->getExtension('DublinCore')->getTitle(); } - if (!$title) { + if (! $title) { $title = $this->getExtension('Atom')->getTitle(); } - if (!$title) { + if (! $title) { $title = null; } @@ -500,15 +498,15 @@ public function getCommentCount() $commentcount = $this->getExtension('Slash')->getCommentCount(); - if (!$commentcount) { + if (! $commentcount) { $commentcount = $this->getExtension('Thread')->getCommentCount(); } - if (!$commentcount) { + if (! $commentcount) { $commentcount = $this->getExtension('Atom')->getCommentCount(); } - if (!$commentcount) { + if (! $commentcount) { $commentcount = null; } @@ -536,11 +534,11 @@ public function getCommentLink() $commentlink = $this->xpath->evaluate('string(' . $this->xpathQueryRss . '/comments)'); } - if (!$commentlink) { + if (! $commentlink) { $commentlink = $this->getExtension('Atom')->getCommentLink(); } - if (!$commentlink) { + if (! $commentlink) { $commentlink = null; } @@ -562,15 +560,15 @@ public function getCommentFeedLink() $commentfeedlink = $this->getExtension('WellFormedWeb')->getCommentFeedLink(); - if (!$commentfeedlink) { + if (! $commentfeedlink) { $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rss'); } - if (!$commentfeedlink) { + if (! $commentfeedlink) { $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rdf'); } - if (!$commentfeedlink) { + if (! $commentfeedlink) { $commentfeedlink = null; } diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/AbstractEntry.php b/vendor/zendframework/zend-feed/src/Reader/Extension/AbstractEntry.php index c589146ae64d423e0fca55497f886c6a0feb3218..54df33e4c6c75c90fd5a1f3d6cad395dcfd72267 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/AbstractEntry.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/AbstractEntry.php @@ -135,18 +135,18 @@ public function setType($type) if ($type === Reader\Reader::TYPE_RSS_10 || $type === Reader\Reader::TYPE_RSS_090 ) { - $this->setXpathPrefix('//rss:item[' . ($this->entryKey + 1) . ']'); + $this->setXpathPrefix('//rss:item[' . ((int)$this->entryKey + 1) . ']'); return $this; } if ($type === Reader\Reader::TYPE_ATOM_10 || $type === Reader\Reader::TYPE_ATOM_03 ) { - $this->setXpathPrefix('//atom:entry[' . ($this->entryKey + 1) . ']'); + $this->setXpathPrefix('//atom:entry[' . ((int)$this->entryKey + 1) . ']'); return $this; } - $this->setXpathPrefix('//item[' . ($this->entryKey + 1) . ']'); + $this->setXpathPrefix('//item[' . ((int)$this->entryKey + 1) . ']'); return $this; } @@ -186,7 +186,7 @@ public function setXpath(DOMXPath $xpath) */ public function getXpath() { - if (!$this->xpath) { + if (! $this->xpath) { $this->setXpath(new DOMXPath($this->getDomDocument())); } return $this->xpath; diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/AbstractFeed.php b/vendor/zendframework/zend-feed/src/Reader/Extension/AbstractFeed.php index d61414a210bca44b2bc607875c46a703daf2649f..1af1de20026e3de63146c615b5853a563749891c 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/AbstractFeed.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/AbstractFeed.php @@ -119,7 +119,7 @@ public function toArray() // untested * Set the XPath query * * @param DOMXPath $xpath - * @return AbstractEntry + * @return AbstractFeed */ public function setXpath(DOMXPath $xpath = null) { diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php b/vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php index 9d06ad3b96e32dd34eaa942f6d005b3f520c8cfa..9ded6aa98caee716dce6b9c054f5a05016f897c8 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php @@ -51,7 +51,7 @@ public function getAuthors() $authors = []; $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:author'); - if (!$list->length) { + if (! $list->length) { /** * TODO: Limit query to feed level els only! */ @@ -61,7 +61,7 @@ public function getAuthors() if ($list->length) { foreach ($list as $author) { $author = $this->getAuthorFromElement($author); - if (!empty($author)) { + if (! empty($author)) { $authors[] = $author; } } @@ -121,7 +121,7 @@ public function getContent() } } - if (!$content) { + if (! $content) { $content = $this->getDescription(); } @@ -139,7 +139,7 @@ public function getContent() */ protected function collectXhtml($xhtml, $prefix) { - if (!empty($prefix)) { + if (! empty($prefix)) { $prefix = $prefix . ':'; } $matches = [ @@ -147,7 +147,7 @@ protected function collectXhtml($xhtml, $prefix) "/<\/" . $prefix . "div>\s*$/" ]; $xhtml = preg_replace($matches, '', $xhtml); - if (!empty($prefix)) { + if (! empty($prefix)) { $xhtml = preg_replace("/(<[\/]?)" . $prefix . "([a-zA-Z]+)/", '$1$2', $xhtml); } return $xhtml; @@ -222,7 +222,7 @@ public function getDescription() $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:summary)'); - if (!$description) { + if (! $description) { $description = null; } @@ -271,7 +271,7 @@ public function getId() $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); - if (!$id) { + if (! $id) { if ($this->getPermalink()) { $id = $this->getPermalink(); } elseif ($this->getTitle()) { @@ -304,11 +304,11 @@ public function getBaseUrl() . ')' ); - if (!$baseUrl) { + if (! $baseUrl) { $baseUrl = $this->getXpath()->evaluate('string(//@xml:base[1])'); } - if (!$baseUrl) { + if (! $baseUrl) { $baseUrl = null; } @@ -325,7 +325,7 @@ public function getBaseUrl() */ public function getLink($index = 0) { - if (!array_key_exists('links', $this->data)) { + if (! array_key_exists('links', $this->data)) { $this->getLinks(); } @@ -388,7 +388,7 @@ public function getTitle() $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); - if (!$title) { + if (! $title) { $title = null; } @@ -554,10 +554,10 @@ public function getSource() */ protected function absolutiseUri($link) { - if (!Uri::factory($link)->isAbsolute()) { + if (! Uri::factory($link)->isAbsolute()) { if ($this->getBaseUrl() !== null) { $link = $this->getBaseUrl() . $link; - if (!Uri::factory($link)->isValid()) { + if (! Uri::factory($link)->isValid()) { $link = null; } } @@ -623,11 +623,11 @@ protected function getAtomType() $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); $prefixAtom10 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_10); if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_03) - || !empty($prefixAtom03)) { + || ! empty($prefixAtom03)) { return Reader\Reader::TYPE_ATOM_03; } if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_10) - || !empty($prefixAtom10)) { + || ! empty($prefixAtom10)) { return Reader\Reader::TYPE_ATOM_10; } } diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Feed.php b/vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Feed.php index dc5a59f7ff1fd2d337342052e5f6242eff59a6dd..a0783d35628d9a62b19c9f794c64e5c15f018b22 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Feed.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Feed.php @@ -53,7 +53,7 @@ public function getAuthors() if ($list->length) { foreach ($list as $author) { $author = $this->getAuthorFromElement($author); - if (!empty($author)) { + if (! empty($author)) { $authors[] = $author; } } @@ -91,7 +91,7 @@ public function getCopyright() $copyright = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:rights)'); } - if (!$copyright) { + if (! $copyright) { $copyright = null; } @@ -175,7 +175,7 @@ public function getDescription() $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:subtitle)'); } - if (!$description) { + if (! $description) { $description = null; } @@ -197,7 +197,7 @@ public function getGenerator() // TODO: Add uri support $generator = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:generator)'); - if (!$generator) { + if (! $generator) { $generator = null; } @@ -219,7 +219,7 @@ public function getId() $id = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); - if (!$id) { + if (! $id) { if ($this->getLink()) { $id = $this->getLink(); } elseif ($this->getTitle()) { @@ -247,11 +247,11 @@ public function getLanguage() $language = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:lang)'); - if (!$language) { + if (! $language) { $language = $this->xpath->evaluate('string(//@xml:lang[1])'); } - if (!$language) { + if (! $language) { $language = null; } @@ -273,7 +273,7 @@ public function getImage() $imageUrl = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:logo)'); - if (!$imageUrl) { + if (! $imageUrl) { $image = null; } else { $image = ['uri' => $imageUrl]; @@ -297,7 +297,7 @@ public function getBaseUrl() $baseUrl = $this->xpath->evaluate('string(//@xml:base[1])'); - if (!$baseUrl) { + if (! $baseUrl) { $baseUrl = null; } $this->data['baseUrl'] = $baseUrl; @@ -394,7 +394,7 @@ public function getTitle() $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); - if (!$title) { + if (! $title) { $title = null; } @@ -479,13 +479,16 @@ protected function getAuthorFromElement(DOMElement $element) /** * Attempt to absolutise the URI, i.e. if a relative URI apply the * xml:base value as a prefix to turn into an absolute URI. + * + * @param string $link + * @return string|null */ protected function absolutiseUri($link) { - if (!Uri::factory($link)->isAbsolute()) { + if (! Uri::factory($link)->isAbsolute()) { if ($this->getBaseUrl() !== null) { $link = $this->getBaseUrl() . $link; - if (!Uri::factory($link)->isValid()) { + if (! Uri::factory($link)->isValid()) { $link = null; } } @@ -523,12 +526,12 @@ protected function getAtomType() $prefixAtom03 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_03); $prefixAtom10 = $dom->lookupPrefix(Reader\Reader::NAMESPACE_ATOM_10); if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_10) - || !empty($prefixAtom10) + || ! empty($prefixAtom10) ) { return Reader\Reader::TYPE_ATOM_10; } if ($dom->isDefaultNamespace(Reader\Reader::NAMESPACE_ATOM_03) - || !empty($prefixAtom03) + || ! empty($prefixAtom03) ) { return Reader\Reader::TYPE_ATOM_03; } diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Entry.php b/vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Entry.php index 1b42f581a2bbf5bff2f3bbcd83929fd255cc96e3..4da435b355ccfd75047a370152782b1721e406f0 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Entry.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Entry.php @@ -47,13 +47,13 @@ public function getAuthors() $authors = []; $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc11:creator'); - if (!$list->length) { + if (! $list->length) { $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc10:creator'); } - if (!$list->length) { + if (! $list->length) { $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc11:publisher'); - if (!$list->length) { + if (! $list->length) { $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc10:publisher'); } } @@ -89,7 +89,7 @@ public function getCategories() $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc11:subject'); - if (!$list->length) { + if (! $list->length) { $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc10:subject'); } @@ -133,11 +133,11 @@ public function getDescription() $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)'); - if (!$description) { + if (! $description) { $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)'); } - if (!$description) { + if (! $description) { $description = null; } @@ -159,7 +159,7 @@ public function getId() $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)'); - if (!$id) { + if (! $id) { $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)'); } @@ -181,11 +181,11 @@ public function getTitle() $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)'); - if (!$title) { + if (! $title) { $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)'); } - if (!$title) { + if (! $title) { $title = null; } @@ -208,7 +208,7 @@ public function getDate() $d = null; $date = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)'); - if (!$date) { + if (! $date) { $date = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)'); } diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Feed.php b/vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Feed.php index 9e3395881dc34e73070681c750b18b913416bd1d..11fc68d68d0218cb35ebd975aa88bb774d74fb4c 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Feed.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Feed.php @@ -47,13 +47,13 @@ public function getAuthors() $authors = []; $list = $this->getXpath()->query('//dc11:creator'); - if (!$list->length) { + if (! $list->length) { $list = $this->getXpath()->query('//dc10:creator'); } - if (!$list->length) { + if (! $list->length) { $list = $this->getXpath()->query('//dc11:publisher'); - if (!$list->length) { + if (! $list->length) { $list = $this->getXpath()->query('//dc10:publisher'); } } @@ -89,11 +89,11 @@ public function getCopyright() $copyright = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:rights)'); - if (!$copyright) { + if (! $copyright) { $copyright = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:rights)'); } - if (!$copyright) { + if (! $copyright) { $copyright = null; } @@ -115,11 +115,11 @@ public function getDescription() $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)'); - if (!$description) { + if (! $description) { $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)'); } - if (!$description) { + if (! $description) { $description = null; } @@ -141,7 +141,7 @@ public function getId() $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)'); - if (!$id) { + if (! $id) { $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)'); } @@ -163,11 +163,11 @@ public function getLanguage() $language = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:language)'); - if (!$language) { + if (! $language) { $language = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:language)'); } - if (!$language) { + if (! $language) { $language = null; } @@ -189,11 +189,11 @@ public function getTitle() $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)'); - if (!$title) { + if (! $title) { $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)'); } - if (!$title) { + if (! $title) { $title = null; } @@ -216,7 +216,7 @@ public function getDate() $d = null; $date = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)'); - if (!$date) { + if (! $date) { $date = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)'); } @@ -242,7 +242,7 @@ public function getCategories() $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc11:subject'); - if (!$list->length) { + if (! $list->length) { $list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc10:subject'); } diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/GooglePlayPodcast/Entry.php b/vendor/zendframework/zend-feed/src/Reader/Extension/GooglePlayPodcast/Entry.php new file mode 100644 index 0000000000000000000000000000000000000000..0ce6cda7a8ba30aa9740fa8d11b62a89fa3649d5 --- /dev/null +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/GooglePlayPodcast/Entry.php @@ -0,0 +1,90 @@ +<?php +/** + * @see https://github.com/zendframework/zend-feed for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-feed/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Feed\Reader\Extension\GooglePlayPodcast; + +use Zend\Feed\Reader\Extension; + +class Entry extends Extension\AbstractEntry +{ + /** + * Get the entry block + * + * @return string + */ + public function getPlayPodcastBlock() + { + if (isset($this->data['block'])) { + return $this->data['block']; + } + + $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:block)'); + + if (! $block) { + $block = null; + } + + $this->data['block'] = $block; + + return $this->data['block']; + } + + /** + * Get the entry explicit + * + * @return string + */ + public function getPlayPodcastExplicit() + { + if (isset($this->data['explicit'])) { + return $this->data['explicit']; + } + + $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:explicit)'); + + if (! $explicit) { + $explicit = null; + } + + $this->data['explicit'] = $explicit; + + return $this->data['explicit']; + } + + /** + * Get the episode summary/description + * + * Uses verbiage so it does not conflict with base entry. + * + * @return string + */ + public function getPlayPodcastDescription() + { + if (isset($this->data['description'])) { + return $this->data['description']; + } + + $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:description)'); + + if (! $description) { + $description = null; + } + + $this->data['description'] = $description; + + return $this->data['description']; + } + + /** + * Register googleplay namespace + * + */ + protected function registerNamespaces() + { + $this->xpath->registerNamespace('googleplay', 'http://www.google.com/schemas/play-podcasts/1.0'); + } +} diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/GooglePlayPodcast/Feed.php b/vendor/zendframework/zend-feed/src/Reader/Extension/GooglePlayPodcast/Feed.php new file mode 100644 index 0000000000000000000000000000000000000000..94fef58f9c4c0ce0411fd59d616b5c12cd1ed276 --- /dev/null +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/GooglePlayPodcast/Feed.php @@ -0,0 +1,175 @@ +<?php +/** + * @see https://github.com/zendframework/zend-feed for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-feed/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Feed\Reader\Extension\GooglePlayPodcast; + +use DOMText; +use Zend\Feed\Reader\Extension; + +class Feed extends Extension\AbstractFeed +{ + /** + * Get the entry author + * + * @return string + */ + public function getPlayPodcastAuthor() + { + if (isset($this->data['author'])) { + return $this->data['author']; + } + + $author = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:author)'); + + if (! $author) { + $author = null; + } + + $this->data['author'] = $author; + + return $this->data['author']; + } + + /** + * Get the entry block + * + * @return string + */ + public function getPlayPodcastBlock() + { + if (isset($this->data['block'])) { + return $this->data['block']; + } + + $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:block)'); + + if (! $block) { + $block = null; + } + + $this->data['block'] = $block; + + return $this->data['block']; + } + + /** + * Get the entry category + * + * @return array|null + */ + public function getPlayPodcastCategories() + { + if (isset($this->data['categories'])) { + return $this->data['categories']; + } + + $categoryList = $this->xpath->query($this->getXpathPrefix() . '/googleplay:category'); + + $categories = []; + + if ($categoryList->length > 0) { + foreach ($categoryList as $node) { + $children = null; + + if ($node->childNodes->length > 0) { + $children = []; + + foreach ($node->childNodes as $childNode) { + if (! ($childNode instanceof DOMText)) { + $children[$childNode->getAttribute('text')] = null; + } + } + } + + $categories[$node->getAttribute('text')] = $children; + } + } + + if (! $categories) { + $categories = null; + } + + $this->data['categories'] = $categories; + + return $this->data['categories']; + } + + /** + * Get the entry explicit + * + * @return string + */ + public function getPlayPodcastExplicit() + { + if (isset($this->data['explicit'])) { + return $this->data['explicit']; + } + + $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:explicit)'); + + if (! $explicit) { + $explicit = null; + } + + $this->data['explicit'] = $explicit; + + return $this->data['explicit']; + } + + /** + * Get the feed/podcast image + * + * @return string + */ + public function getPlayPodcastImage() + { + if (isset($this->data['image'])) { + return $this->data['image']; + } + + $image = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:image/@href)'); + + if (! $image) { + $image = null; + } + + $this->data['image'] = $image; + + return $this->data['image']; + } + + /** + * Get the entry description + * + * @return string + */ + public function getPlayPodcastDescription() + { + if (isset($this->data['description'])) { + return $this->data['description']; + } + + $description = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:description)'); + + if (! $description) { + $description = null; + } + + $this->data['description'] = $description; + + return $this->data['description']; + } + + /** + * Register googleplay namespace + * + */ + protected function registerNamespaces() + { + $this->xpath->registerNamespace('googleplay', 'http://www.google.com/schemas/play-podcasts/1.0'); + } +} diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/Podcast/Entry.php b/vendor/zendframework/zend-feed/src/Reader/Extension/Podcast/Entry.php index 5aec2fd9ccc10ba0a890d4bb0eb0542d6881cffe..2a8c2aa6fc25360f93f3b60a4427f64017943006 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/Podcast/Entry.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/Podcast/Entry.php @@ -1,18 +1,14 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @link http://github.com/zendframework/zf2 for the canonical source repository - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License + * @see https://github.com/zendframework/zend-feed for the canonical source repository + * @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-feed/blob/master/LICENSE.md New BSD License */ namespace Zend\Feed\Reader\Extension\Podcast; use Zend\Feed\Reader\Extension; -/** -*/ class Entry extends Extension\AbstractEntry { /** @@ -28,7 +24,7 @@ public function getCastAuthor() $author = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); - if (!$author) { + if (! $author) { $author = null; } @@ -50,7 +46,7 @@ public function getBlock() $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); - if (!$block) { + if (! $block) { $block = null; } @@ -72,7 +68,7 @@ public function getDuration() $duration = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:duration)'); - if (!$duration) { + if (! $duration) { $duration = null; } @@ -94,7 +90,7 @@ public function getExplicit() $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); - if (!$explicit) { + if (! $explicit) { $explicit = null; } @@ -106,17 +102,25 @@ public function getExplicit() /** * Get the entry keywords * + * @deprecated since 2.10.0; itunes:keywords is no longer part of the + * iTunes podcast RSS specification. * @return string */ public function getKeywords() { + trigger_error( + 'itunes:keywords has been deprecated in the iTunes podcast RSS specification,' + . ' and should not be relied on.', + \E_USER_DEPRECATED + ); + if (isset($this->data['keywords'])) { return $this->data['keywords']; } $keywords = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); - if (!$keywords) { + if (! $keywords) { $keywords = null; } @@ -125,6 +129,28 @@ public function getKeywords() return $this->data['keywords']; } + /** + * Get the entry title + * + * @return string + */ + public function getTitle() + { + if (isset($this->data['title'])) { + return $this->data['title']; + } + + $title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:title)'); + + if (! $title) { + $title = null; + } + + $this->data['title'] = $title; + + return $this->data['title']; + } + /** * Get the entry subtitle * @@ -138,7 +164,7 @@ public function getSubtitle() $subtitle = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); - if (!$subtitle) { + if (! $subtitle) { $subtitle = null; } @@ -160,7 +186,7 @@ public function getSummary() $summary = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); - if (!$summary) { + if (! $summary) { $summary = null; } @@ -169,6 +195,114 @@ public function getSummary() return $this->data['summary']; } + /** + * Get the entry image + * + * @return string + */ + public function getItunesImage() + { + if (isset($this->data['image'])) { + return $this->data['image']; + } + + $image = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:image/@href)'); + + if (! $image) { + $image = null; + } + + $this->data['image'] = $image; + + return $this->data['image']; + } + + /** + * Get the episode number + * + * @return null|int + */ + public function getEpisode() + { + if (isset($this->data['episode'])) { + return $this->data['episode']; + } + + $episode = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:episode)'); + + if (! $episode) { + $episode = null; + } + + $this->data['episode'] = null === $episode ? $episode : (int) $episode; + + return $this->data['episode']; + } + + /** + * Get the episode number + * + * @return string One of "full", "trailer", or "bonus"; defaults to "full". + */ + public function getEpisodeType() + { + if (isset($this->data['episodeType'])) { + return $this->data['episodeType']; + } + + $type = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:episodeType)'); + + if (! $type) { + $type = 'full'; + } + + $this->data['episodeType'] = (string) $type; + + return $this->data['episodeType']; + } + + /** + * Is the episode closed captioned? + * + * Returns true only if itunes:isClosedCaptioned has the value 'Yes'. + * + * @return bool + */ + public function isClosedCaptioned() + { + if (isset($this->data['isClosedCaptioned'])) { + return $this->data['isClosedCaptioned']; + } + + $status = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:isClosedCaptioned)'); + + $this->data['isClosedCaptioned'] = $status === 'Yes'; + + return $this->data['isClosedCaptioned']; + } + + /** + * Get the season number + * + * @return null|int + */ + public function getSeason() + { + if (isset($this->data['season'])) { + return $this->data['season']; + } + + $season = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:season)'); + + if (! $season) { + $season = null; + } + + $this->data['season'] = null === $season ? $season : (int) $season; + + return $this->data['season']; + } + /** * Register iTunes namespace * diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/Podcast/Feed.php b/vendor/zendframework/zend-feed/src/Reader/Extension/Podcast/Feed.php index 4ae7bf3ac30822b826c3bd89fa984652e439b10c..987fc6927163353bb8c90e0da039b1f6033eea23 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/Podcast/Feed.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/Podcast/Feed.php @@ -1,10 +1,8 @@ <?php /** - * Zend Framework (http://framework.zend.com/) - * - * @link http://github.com/zendframework/zf2 for the canonical source repository - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License + * @see https://github.com/zendframework/zend-feed for the canonical source repository + * @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-feed/blob/master/LICENSE.md New BSD License */ namespace Zend\Feed\Reader\Extension\Podcast; @@ -12,8 +10,6 @@ use DOMText; use Zend\Feed\Reader\Extension; -/** -*/ class Feed extends Extension\AbstractFeed { /** @@ -29,7 +25,7 @@ public function getCastAuthor() $author = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); - if (!$author) { + if (! $author) { $author = null; } @@ -51,7 +47,7 @@ public function getBlock() $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); - if (!$block) { + if (! $block) { $block = null; } @@ -83,7 +79,7 @@ public function getItunesCategories() $children = []; foreach ($node->childNodes as $childNode) { - if (!($childNode instanceof DOMText)) { + if (! ($childNode instanceof DOMText)) { $children[$childNode->getAttribute('text')] = null; } } @@ -93,7 +89,7 @@ public function getItunesCategories() } } - if (!$categories) { + if (! $categories) { $categories = null; } @@ -115,7 +111,7 @@ public function getExplicit() $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); - if (!$explicit) { + if (! $explicit) { $explicit = null; } @@ -125,7 +121,7 @@ public function getExplicit() } /** - * Get the entry image + * Get the feed/podcast image * * @return string */ @@ -137,7 +133,7 @@ public function getItunesImage() $image = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:image/@href)'); - if (!$image) { + if (! $image) { $image = null; } @@ -149,17 +145,25 @@ public function getItunesImage() /** * Get the entry keywords * + * @deprecated since 2.10.0; itunes:keywords is no longer part of the + * iTunes podcast RSS specification. * @return string */ public function getKeywords() { + trigger_error( + 'itunes:keywords has been deprecated in the iTunes podcast RSS specification,' + . ' and should not be relied on.', + \E_USER_DEPRECATED + ); + if (isset($this->data['keywords'])) { return $this->data['keywords']; } $keywords = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); - if (!$keywords) { + if (! $keywords) { $keywords = null; } @@ -181,7 +185,7 @@ public function getNewFeedUrl() $newFeedUrl = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:new-feed-url)'); - if (!$newFeedUrl) { + if (! $newFeedUrl) { $newFeedUrl = null; } @@ -206,13 +210,13 @@ public function getOwner() $email = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:email)'); $name = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:name)'); - if (!empty($email)) { + if (! empty($email)) { $owner = $email . (empty($name) ? '' : ' (' . $name . ')'); - } elseif (!empty($name)) { + } elseif (! empty($name)) { $owner = $name; } - if (!$owner) { + if (! $owner) { $owner = null; } @@ -234,7 +238,7 @@ public function getSubtitle() $subtitle = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); - if (!$subtitle) { + if (! $subtitle) { $subtitle = null; } @@ -256,7 +260,7 @@ public function getSummary() $summary = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); - if (!$summary) { + if (! $summary) { $summary = null; } @@ -265,6 +269,51 @@ public function getSummary() return $this->data['summary']; } + /** + * Get the type of podcast + * + * @return string One of "episodic" or "serial". Defaults to "episodic" + * if no itunes:type tag is encountered. + */ + public function getPodcastType() + { + if (isset($this->data['podcastType'])) { + return $this->data['podcastType']; + } + + $type = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:type)'); + + if (! $type) { + $type = 'episodic'; + } + + $this->data['podcastType'] = (string) $type; + + return $this->data['podcastType']; + } + + /** + * Is the podcast complete (no more episodes will post)? + * + * @return bool + */ + public function isComplete() + { + if (isset($this->data['complete'])) { + return $this->data['complete']; + } + + $complete = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:complete)'); + + if (! $complete) { + $complete = false; + } + + $this->data['complete'] = $complete === 'Yes'; + + return $this->data['complete']; + } + /** * Register iTunes namespace * diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/Slash/Entry.php b/vendor/zendframework/zend-feed/src/Reader/Extension/Slash/Entry.php index 4bd01fe7fe590cbf3f0528ee90ca035ab2ccacf5..93cd54a15ae7f30b81569170b0b0584f16383aa9 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/Slash/Entry.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/Slash/Entry.php @@ -51,7 +51,7 @@ public function getHitParade() $stringParade = $this->getData($name); $hitParade = []; - if (!empty($stringParade)) { + if (! empty($stringParade)) { $stringParade = explode(',', $stringParade); foreach ($stringParade as $hit) { @@ -78,7 +78,7 @@ public function getCommentCount() $comments = $this->getData($name, 'string'); - if (!$comments) { + if (! $comments) { $this->data[$name] = null; return $this->data[$name]; } @@ -101,7 +101,7 @@ protected function getData($name, $type = 'string') $data = $this->xpath->evaluate($type . '(' . $this->getXpathPrefix() . '/slash10:' . $name . ')'); - if (!$data) { + if (! $data) { $data = null; } diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/Syndication/Feed.php b/vendor/zendframework/zend-feed/src/Reader/Extension/Syndication/Feed.php index 09f12ddea251b1600d5c6775d698b0cd1926a52d..e126c6d082c90f3ed259608f1676ee6eb1f478ea 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/Syndication/Feed.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/Syndication/Feed.php @@ -39,8 +39,7 @@ public function getUpdatePeriod() return $period; default: throw new Reader\Exception\InvalidArgumentException("Feed specified invalid update period: '$period'." - . " Must be one of hourly, daily, weekly or yearly" - ); + . " Must be one of hourly, daily, weekly or yearly"); } } @@ -54,7 +53,7 @@ public function getUpdateFrequency() $name = 'updateFrequency'; $freq = $this->getData($name, 'number'); - if (!$freq || $freq < 1) { + if (! $freq || $freq < 1) { $this->data[$name] = 1; return 1; } @@ -72,7 +71,7 @@ public function getUpdateFrequencyAsTicks() $name = 'updateFrequency'; $freq = $this->getData($name, 'number'); - if (!$freq || $freq < 1) { + if (! $freq || $freq < 1) { $this->data[$name] = 1; $freq = 1; } @@ -130,7 +129,7 @@ private function getData($name, $type = 'string') $data = $this->xpath->evaluate($type . '(' . $this->getXpathPrefix() . '/syn10:' . $name . ')'); - if (!$data) { + if (! $data) { $data = null; } diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/Thread/Entry.php b/vendor/zendframework/zend-feed/src/Reader/Extension/Thread/Entry.php index e5de5bb1cd94a0ea0dd3b3a7ab634c9dbc01b644..e378d4b8827e4cdb0ed56848f4fb1e7139610b0f 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/Thread/Entry.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/Thread/Entry.php @@ -51,7 +51,7 @@ protected function getData($name) $data = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/thread10:' . $name . ')'); - if (!$data) { + if (! $data) { $data = null; } diff --git a/vendor/zendframework/zend-feed/src/Reader/Extension/WellFormedWeb/Entry.php b/vendor/zendframework/zend-feed/src/Reader/Extension/WellFormedWeb/Entry.php index 42fafb4aa4a429330035f979b84fcb08929a6cf0..ff19d0e16784133e6bb3a84f28922c8f51a5ff48 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Extension/WellFormedWeb/Entry.php +++ b/vendor/zendframework/zend-feed/src/Reader/Extension/WellFormedWeb/Entry.php @@ -29,7 +29,7 @@ public function getCommentFeedLink() $data = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/wfw:' . $name . ')'); - if (!$data) { + if (! $data) { $data = null; } diff --git a/vendor/zendframework/zend-feed/src/Reader/ExtensionManager.php b/vendor/zendframework/zend-feed/src/Reader/ExtensionManager.php index 6740cc92bc56a1150f47a347ebb4e3975b355c15..f7946b7914eb32ce58fe0bec9f6469f37b75c05b 100644 --- a/vendor/zendframework/zend-feed/src/Reader/ExtensionManager.php +++ b/vendor/zendframework/zend-feed/src/Reader/ExtensionManager.php @@ -46,7 +46,7 @@ public function __construct(ExtensionPluginManager $pluginManager = null) */ public function __call($method, $args) { - if (!method_exists($this->pluginManager, $method)) { + if (! method_exists($this->pluginManager, $method)) { throw new Exception\BadMethodCallException(sprintf( 'Method by name of %s does not exist in %s', $method, diff --git a/vendor/zendframework/zend-feed/src/Reader/ExtensionPluginManager.php b/vendor/zendframework/zend-feed/src/Reader/ExtensionPluginManager.php index cbfc4c1561e5b52596ff4feb84294ddbb3156059..e09c3176517d9d4ae5ee16344bd0221838ae5dae 100644 --- a/vendor/zendframework/zend-feed/src/Reader/ExtensionPluginManager.php +++ b/vendor/zendframework/zend-feed/src/Reader/ExtensionPluginManager.php @@ -20,7 +20,7 @@ * Validation checks that we have an Extension\AbstractEntry or * Extension\AbstractFeed. */ -class ExtensionPluginManager extends AbstractPluginManager +class ExtensionPluginManager extends AbstractPluginManager implements ExtensionManagerInterface { /** * Aliases for default set of extension classes @@ -31,42 +31,63 @@ class ExtensionPluginManager extends AbstractPluginManager 'atomentry' => Extension\Atom\Entry::class, 'atomEntry' => Extension\Atom\Entry::class, 'AtomEntry' => Extension\Atom\Entry::class, + 'Atom\Entry' => Extension\Atom\Entry::class, 'atomfeed' => Extension\Atom\Feed::class, 'atomFeed' => Extension\Atom\Feed::class, 'AtomFeed' => Extension\Atom\Feed::class, + 'Atom\Feed' => Extension\Atom\Feed::class, 'contententry' => Extension\Content\Entry::class, 'contentEntry' => Extension\Content\Entry::class, 'ContentEntry' => Extension\Content\Entry::class, + 'Content\Entry' => Extension\Content\Entry::class, 'creativecommonsentry' => Extension\CreativeCommons\Entry::class, 'creativeCommonsEntry' => Extension\CreativeCommons\Entry::class, 'CreativeCommonsEntry' => Extension\CreativeCommons\Entry::class, + 'CreativeCommons\Entry' => Extension\CreativeCommons\Entry::class, 'creativecommonsfeed' => Extension\CreativeCommons\Feed::class, 'creativeCommonsFeed' => Extension\CreativeCommons\Feed::class, 'CreativeCommonsFeed' => Extension\CreativeCommons\Feed::class, + 'CreativeCommons\Feed' => Extension\CreativeCommons\Feed::class, 'dublincoreentry' => Extension\DublinCore\Entry::class, 'dublinCoreEntry' => Extension\DublinCore\Entry::class, 'DublinCoreEntry' => Extension\DublinCore\Entry::class, + 'DublinCore\Entry' => Extension\DublinCore\Entry::class, 'dublincorefeed' => Extension\DublinCore\Feed::class, 'dublinCoreFeed' => Extension\DublinCore\Feed::class, 'DublinCoreFeed' => Extension\DublinCore\Feed::class, + 'DublinCore\Feed' => Extension\DublinCore\Feed::class, + 'googleplaypodcastentry' => Extension\GooglePlayPodcast\Entry::class, + 'googlePlayPodcastEntry' => Extension\GooglePlayPodcast\Entry::class, + 'GooglePlayPodcastEntry' => Extension\GooglePlayPodcast\Entry::class, + 'GooglePlayPodcast\Entry' => Extension\GooglePlayPodcast\Entry::class, + 'googleplaypodcastfeed' => Extension\GooglePlayPodcast\Feed::class, + 'googlePlayPodcastFeed' => Extension\GooglePlayPodcast\Feed::class, + 'GooglePlayPodcastFeed' => Extension\GooglePlayPodcast\Feed::class, + 'GooglePlayPodcast\Feed' => Extension\GooglePlayPodcast\Feed::class, 'podcastentry' => Extension\Podcast\Entry::class, 'podcastEntry' => Extension\Podcast\Entry::class, 'PodcastEntry' => Extension\Podcast\Entry::class, + 'Podcast\Entry' => Extension\Podcast\Entry::class, 'podcastfeed' => Extension\Podcast\Feed::class, 'podcastFeed' => Extension\Podcast\Feed::class, 'PodcastFeed' => Extension\Podcast\Feed::class, + 'Podcast\Feed' => Extension\Podcast\Feed::class, 'slashentry' => Extension\Slash\Entry::class, 'slashEntry' => Extension\Slash\Entry::class, 'SlashEntry' => Extension\Slash\Entry::class, + 'Slash\Entry' => Extension\Slash\Entry::class, 'syndicationfeed' => Extension\Syndication\Feed::class, 'syndicationFeed' => Extension\Syndication\Feed::class, 'SyndicationFeed' => Extension\Syndication\Feed::class, + 'Syndication\Feed' => Extension\Syndication\Feed::class, 'threadentry' => Extension\Thread\Entry::class, 'threadEntry' => Extension\Thread\Entry::class, 'ThreadEntry' => Extension\Thread\Entry::class, + 'Thread\Entry' => Extension\Thread\Entry::class, 'wellformedwebentry' => Extension\WellFormedWeb\Entry::class, 'wellFormedWebEntry' => Extension\WellFormedWeb\Entry::class, 'WellFormedWebEntry' => Extension\WellFormedWeb\Entry::class, + 'WellFormedWeb\Entry' => Extension\WellFormedWeb\Entry::class, ]; /** @@ -82,6 +103,8 @@ class ExtensionPluginManager extends AbstractPluginManager Extension\CreativeCommons\Feed::class => InvokableFactory::class, Extension\DublinCore\Entry::class => InvokableFactory::class, Extension\DublinCore\Feed::class => InvokableFactory::class, + Extension\GooglePlayPodcast\Entry::class => InvokableFactory::class, + Extension\GooglePlayPodcast\Feed::class => InvokableFactory::class, Extension\Podcast\Entry::class => InvokableFactory::class, Extension\Podcast\Feed::class => InvokableFactory::class, Extension\Slash\Entry::class => InvokableFactory::class, @@ -98,6 +121,8 @@ class ExtensionPluginManager extends AbstractPluginManager 'zendfeedreaderextensioncreativecommonsfeed' => InvokableFactory::class, 'zendfeedreaderextensiondublincoreentry' => InvokableFactory::class, 'zendfeedreaderextensiondublincorefeed' => InvokableFactory::class, + 'zendfeedreaderextensiongoogleplaypodcastentry' => InvokableFactory::class, + 'zendfeedreaderextensiongoogleplaypodcastfeed' => InvokableFactory::class, 'zendfeedreaderextensionpodcastentry' => InvokableFactory::class, 'zendfeedreaderextensionpodcastfeed' => InvokableFactory::class, 'zendfeedreaderextensionslashentry' => InvokableFactory::class, diff --git a/vendor/zendframework/zend-feed/src/Reader/Feed/AbstractFeed.php b/vendor/zendframework/zend-feed/src/Reader/Feed/AbstractFeed.php index 78b671dd4e24605434c0748bfe94027732aa114e..ea0a7a1cd203e012c162e1f5f02dfe80c0577017 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Feed/AbstractFeed.php +++ b/vendor/zendframework/zend-feed/src/Reader/Feed/AbstractFeed.php @@ -130,7 +130,7 @@ public function count() */ public function current() { - if (substr($this->getType(), 0, 3) == 'rss') { + if (0 === strpos($this->getType(), 'rss')) { $reader = new Reader\Entry\Rss($this->entries[$this->key()], $this->key(), $this->getType()); } else { $reader = new Reader\Entry\Atom($this->entries[$this->key()], $this->key(), $this->getType()); @@ -172,7 +172,7 @@ public function getEncoding() */ public function saveXml() { - return $this->getDomDocument()->saveXml(); + return $this->getDomDocument()->saveXML(); } /** @@ -263,7 +263,7 @@ public function __call($method, $args) * Return an Extension object with the matching name (postfixed with _Feed) * * @param string $name - * @return \Zend\Feed\Reader\Extension\AbstractFeed + * @return \Zend\Feed\Reader\Extension\AbstractFeed|null */ public function getExtension($name) { @@ -282,8 +282,10 @@ protected function loadExtensions() if (in_array($extension, $all['core'])) { continue; } - if (!$manager->has($extension)) { - throw new Exception\RuntimeException(sprintf('Unable to load extension "%s"; cannot find class', $extension)); + if (! $manager->has($extension)) { + throw new Exception\RuntimeException( + sprintf('Unable to load extension "%s"; cannot find class', $extension) + ); } $plugin = $manager->get($extension); $plugin->setDomDocument($this->getDomDocument()); diff --git a/vendor/zendframework/zend-feed/src/Reader/Feed/Atom.php b/vendor/zendframework/zend-feed/src/Reader/Feed/Atom.php index 37064701c7cc18f9fe71e514607cec8c7dd9eb33..f0c5c2e917a179dde1bffb97c8c8a5b9c059f1e1 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Feed/Atom.php +++ b/vendor/zendframework/zend-feed/src/Reader/Feed/Atom.php @@ -92,7 +92,7 @@ public function getCopyright() $copyright = $this->getExtension('Atom')->getCopyright(); - if (!$copyright) { + if (! $copyright) { $copyright = null; } @@ -104,7 +104,7 @@ public function getCopyright() /** * Get the feed creation date * - * @return string|null + * @return \DateTime|null */ public function getDateCreated() { @@ -114,7 +114,7 @@ public function getDateCreated() $dateCreated = $this->getExtension('Atom')->getDateCreated(); - if (!$dateCreated) { + if (! $dateCreated) { $dateCreated = null; } @@ -126,7 +126,7 @@ public function getDateCreated() /** * Get the feed modification date * - * @return string|null + * @return \DateTime|null */ public function getDateModified() { @@ -136,7 +136,7 @@ public function getDateModified() $dateModified = $this->getExtension('Atom')->getDateModified(); - if (!$dateModified) { + if (! $dateModified) { $dateModified = null; } @@ -168,7 +168,7 @@ public function getDescription() $description = $this->getExtension('Atom')->getDescription(); - if (!$description) { + if (! $description) { $description = null; } @@ -226,11 +226,11 @@ public function getLanguage() $language = $this->getExtension('Atom')->getLanguage(); - if (!$language) { + if (! $language) { $language = $this->xpath->evaluate('string(//@xml:lang[1])'); } - if (!$language) { + if (! $language) { $language = null; } diff --git a/vendor/zendframework/zend-feed/src/Reader/Feed/FeedInterface.php b/vendor/zendframework/zend-feed/src/Reader/Feed/FeedInterface.php index 441ba9269c553f19019a87ab47ec5767ab94a2a9..875482e266655c1cdccd96f002e17bdfd0c646b4 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Feed/FeedInterface.php +++ b/vendor/zendframework/zend-feed/src/Reader/Feed/FeedInterface.php @@ -41,14 +41,14 @@ public function getCopyright(); /** * Get the feed creation date * - * @return string|null + * @return \DateTime|null */ public function getDateCreated(); /** * Get the feed modification date * - * @return string|null + * @return \DateTime|null */ public function getDateModified(); diff --git a/vendor/zendframework/zend-feed/src/Reader/Feed/Rss.php b/vendor/zendframework/zend-feed/src/Reader/Feed/Rss.php index 1a148b219baff64f000c04db71c82fa297db2b75..1275bda544636296b9d20c9e63faa2eb96ddd39f 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Feed/Rss.php +++ b/vendor/zendframework/zend-feed/src/Reader/Feed/Rss.php @@ -85,7 +85,7 @@ public function getAuthors() $authors = []; $authorsDc = $this->getExtension('DublinCore')->getAuthors(); - if (!empty($authorsDc)) { + if (! empty($authorsDc)) { foreach ($authorsDc as $author) { $authors[] = [ 'name' => $author['name'] @@ -153,7 +153,7 @@ public function getCopyright() $copyright = $this->xpath->evaluate('string(/rss/channel/copyright)'); } - if (!$copyright && $this->getExtension('DublinCore') !== null) { + if (! $copyright && $this->getExtension('DublinCore') !== null) { $copyright = $this->getExtension('DublinCore')->getCopyright(); } @@ -161,7 +161,7 @@ public function getCopyright() $copyright = $this->getExtension('Atom')->getCopyright(); } - if (!$copyright) { + if (! $copyright) { $copyright = null; } @@ -173,7 +173,7 @@ public function getCopyright() /** * Get the feed creation date * - * @return string|null + * @return DateTime|null */ public function getDateCreated() { @@ -197,7 +197,7 @@ public function getDateModified() if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { $dateModified = $this->xpath->evaluate('string(/rss/channel/pubDate)'); - if (!$dateModified) { + if (! $dateModified) { $dateModified = $this->xpath->evaluate('string(/rss/channel/lastBuildDate)'); } if ($dateModified) { @@ -217,7 +217,8 @@ public function getDateModified() 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), - 0, $e + 0, + $e ); } } @@ -226,15 +227,15 @@ public function getDateModified() } } - if (!$date) { + if (! $date) { $date = $this->getExtension('DublinCore')->getDate(); } - if (!$date) { + if (! $date) { $date = $this->getExtension('Atom')->getDateModified(); } - if (!$date) { + if (! $date) { $date = null; } @@ -277,7 +278,8 @@ public function getLastBuildDate() 'Could not load date due to unrecognised' .' format (should follow RFC 822 or 2822):' . $e->getMessage(), - 0, $e + 0, + $e ); } } @@ -286,7 +288,7 @@ public function getLastBuildDate() } } - if (!$date) { + if (! $date) { $date = null; } @@ -313,7 +315,7 @@ public function getDescription() $description = $this->xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); } - if (!$description && $this->getExtension('DublinCore') !== null) { + if (! $description && $this->getExtension('DublinCore') !== null) { $description = $this->getExtension('DublinCore')->getDescription(); } @@ -321,7 +323,7 @@ public function getDescription() $description = $this->getExtension('Atom')->getDescription(); } - if (!$description) { + if (! $description) { $description = null; } @@ -348,7 +350,7 @@ public function getId() $id = $this->xpath->evaluate('string(/rss/channel/guid)'); } - if (!$id && $this->getExtension('DublinCore') !== null) { + if (! $id && $this->getExtension('DublinCore') !== null) { $id = $this->getExtension('DublinCore')->getId(); } @@ -356,7 +358,7 @@ public function getId() $id = $this->getExtension('Atom')->getId(); } - if (!$id) { + if (! $id) { if ($this->getLink()) { $id = $this->getLink(); } elseif ($this->getTitle()) { @@ -443,7 +445,7 @@ public function getLanguage() $language = $this->xpath->evaluate('string(/rss/channel/language)'); } - if (!$language && $this->getExtension('DublinCore') !== null) { + if (! $language && $this->getExtension('DublinCore') !== null) { $language = $this->getExtension('DublinCore')->getLanguage(); } @@ -451,11 +453,11 @@ public function getLanguage() $language = $this->getExtension('Atom')->getLanguage(); } - if (!$language) { + if (! $language) { $language = $this->xpath->evaluate('string(//@xml:lang[1])'); } - if (!$language) { + if (! $language) { $language = null; } @@ -486,7 +488,7 @@ public function getLink() $link = $this->getExtension('Atom')->getLink(); } - if (!$link) { + if (! $link) { $link = null; } @@ -535,7 +537,7 @@ public function getGenerator() $generator = $this->xpath->evaluate('string(/rss/channel/generator)'); } - if (!$generator) { + if (! $generator) { if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { $generator = $this->xpath->evaluate('string(/rss/channel/atom:generator)'); @@ -548,7 +550,7 @@ public function getGenerator() $generator = $this->getExtension('Atom')->getGenerator(); } - if (!$generator) { + if (! $generator) { $generator = null; } @@ -575,15 +577,15 @@ public function getTitle() $title = $this->xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); } - if (!$title && $this->getExtension('DublinCore') !== null) { + if (! $title && $this->getExtension('DublinCore') !== null) { $title = $this->getExtension('DublinCore')->getTitle(); } - if (!$title) { + if (! $title) { $title = $this->getExtension('Atom')->getTitle(); } - if (!$title) { + if (! $title) { $title = null; } diff --git a/vendor/zendframework/zend-feed/src/Reader/FeedSet.php b/vendor/zendframework/zend-feed/src/Reader/FeedSet.php index d890532830c6d49bfbe39e7a22948ab29b057567..ad5ac5b795a2e366080a24fb2444f41d95fc4a00 100644 --- a/vendor/zendframework/zend-feed/src/Reader/FeedSet.php +++ b/vendor/zendframework/zend-feed/src/Reader/FeedSet.php @@ -41,55 +41,99 @@ public function addLinks(DOMNodeList $links, $uri) { foreach ($links as $link) { if (strtolower($link->getAttribute('rel')) !== 'alternate' - || !$link->getAttribute('type') || !$link->getAttribute('href')) { + || ! $link->getAttribute('type') || ! $link->getAttribute('href')) { continue; } - if (!isset($this->rss) && $link->getAttribute('type') == 'application/rss+xml') { + if (! isset($this->rss) && $link->getAttribute('type') == 'application/rss+xml') { $this->rss = $this->absolutiseUri(trim($link->getAttribute('href')), $uri); - } elseif (!isset($this->atom) && $link->getAttribute('type') == 'application/atom+xml') { + } elseif (! isset($this->atom) && $link->getAttribute('type') == 'application/atom+xml') { $this->atom = $this->absolutiseUri(trim($link->getAttribute('href')), $uri); - } elseif (!isset($this->rdf) && $link->getAttribute('type') == 'application/rdf+xml') { + } elseif (! isset($this->rdf) && $link->getAttribute('type') == 'application/rdf+xml') { $this->rdf = $this->absolutiseUri(trim($link->getAttribute('href')), $uri); } $this[] = new static([ 'rel' => 'alternate', 'type' => $link->getAttribute('type'), 'href' => $this->absolutiseUri(trim($link->getAttribute('href')), $uri), + 'title' => $link->getAttribute('title'), ]); } } /** * Attempt to turn a relative URI into an absolute URI + * + * @param string $link + * @param string $uri OPTIONAL + * @return string|null absolutised link or null if invalid */ protected function absolutiseUri($link, $uri = null) { $linkUri = Uri::factory($link); - if (!$linkUri->isAbsolute() or !$linkUri->isValid()) { - if ($uri !== null) { - $uri = Uri::factory($uri); + if ($linkUri->isAbsolute()) { + // invalid absolute link can not be recovered + return $linkUri->isValid() ? $link : null; + } - if ($link[0] !== '/') { - $link = $uri->getPath() . '/' . $link; - } + $scheme = 'http'; + if ($uri !== null) { + $uri = Uri::factory($uri); + $scheme = $uri->getScheme() ?: $scheme; + } - $link = sprintf( - '%s://%s/%s', - ($uri->getScheme() ?: 'http'), - $uri->getHost(), - $this->canonicalizePath($link) - ); + if ($linkUri->getHost()) { + $link = $this->resolveSchemeRelativeUri($link, $scheme); + } elseif ($uri !== null) { + $link = $this->resolveRelativeUri($link, $scheme, $uri->getHost(), $uri->getPath()); + } - if (!Uri::factory($link)->isValid()) { - $link = null; - } - } + if (! Uri::factory($link)->isValid()) { + return null; } + return $link; } + /** + * Resolves scheme relative link to absolute + * + * @param string $link + * @param string $scheme + * @return string + */ + private function resolveSchemeRelativeUri($link, $scheme) + { + $link = ltrim($link, '/'); + return sprintf('%s://%s', $scheme, $link); + } + + /** + * Resolves relative link to absolute + * + * @param string $link + * @param string $scheme + * @param string $host + * @param string $uriPath + * @return string + */ + private function resolveRelativeUri($link, $scheme, $host, $uriPath) + { + if ($link[0] !== '/') { + $link = $uriPath . '/' . $link; + } + return sprintf( + '%s://%s/%s', + $scheme, + $host, + $this->canonicalizePath($link) + ); + } + /** * Canonicalize relative path + * + * @param string $path + * @return string */ protected function canonicalizePath($path) { @@ -117,8 +161,8 @@ protected function canonicalizePath($path) */ public function offsetGet($offset) { - if ($offset == 'feed' && !$this->offsetExists('feed')) { - if (!$this->offsetExists('href')) { + if ($offset == 'feed' && ! $this->offsetExists('feed')) { + if (! $this->offsetExists('href')) { return; } $feed = Reader::import($this->offsetGet('href')); diff --git a/vendor/zendframework/zend-feed/src/Reader/Http/Response.php b/vendor/zendframework/zend-feed/src/Reader/Http/Response.php index 482c33e1f8950bee850c1de22696037b43cab4c2..ef8f1cfb464f264712e7f07650d5028ce1545006 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Http/Response.php +++ b/vendor/zendframework/zend-feed/src/Reader/Http/Response.php @@ -75,7 +75,7 @@ public function getHeaderLine($name, $default = null) /** * Validate that we have a status code argument that will work for our context. * - * @param mixed $body + * @param int $statusCode * @throws Exception\InvalidArgumentException for arguments not castable * to integer HTTP status codes. */ diff --git a/vendor/zendframework/zend-feed/src/Reader/Http/ZendHttpClientDecorator.php b/vendor/zendframework/zend-feed/src/Reader/Http/ZendHttpClientDecorator.php index dbff9932e21233db43244540f251cb0edc6c93c8..6ff23cd139fdb99affef9f1b5118ab02b902dfcb 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Http/ZendHttpClientDecorator.php +++ b/vendor/zendframework/zend-feed/src/Reader/Http/ZendHttpClientDecorator.php @@ -9,9 +9,9 @@ namespace Zend\Feed\Reader\Http; +use Zend\Feed\Reader\Exception; use Zend\Http\Client as ZendHttpClient; use Zend\Http\Headers; -use Zend\Feed\Reader\Exception; class ZendHttpClientDecorator implements HeaderAwareClientInterface { diff --git a/vendor/zendframework/zend-feed/src/Reader/Reader.php b/vendor/zendframework/zend-feed/src/Reader/Reader.php index 693a3e2eaf817270af53d89f6bc3b931e1cd3a68..8763ca1f2bcaeaf1c2420836211eea629bb56bd3 100644 --- a/vendor/zendframework/zend-feed/src/Reader/Reader.php +++ b/vendor/zendframework/zend-feed/src/Reader/Reader.php @@ -12,9 +12,9 @@ use DOMDocument; use DOMXPath; use Zend\Cache\Storage\StorageInterface as CacheStorage; +use Zend\Feed\Reader\Exception\InvalidHttpClientException; use Zend\Http as ZendHttp; use Zend\Stdlib\ErrorHandler; -use Zend\Feed\Reader\Exception\InvalidHttpClientException; /** */ @@ -222,7 +222,9 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->get($uri, $headers); if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 304) { - throw new Exception\RuntimeException('Feed failed to load, got response code ' . $response->getStatusCode()); + throw new Exception\RuntimeException( + 'Feed failed to load, got response code ' . $response->getStatusCode() + ); } if ($response->getStatusCode() == 304) { $responseXml = $data; @@ -247,7 +249,9 @@ public static function import($uri, $etag = null, $lastModified = null) } $response = $client->get($uri); if ((int) $response->getStatusCode() !== 200) { - throw new Exception\RuntimeException('Feed failed to load, got response code ' . $response->getStatusCode()); + throw new Exception\RuntimeException( + 'Feed failed to load, got response code ' . $response->getStatusCode() + ); } $responseXml = $response->getBody(); $cache->setItem($cacheId, $responseXml); @@ -255,7 +259,9 @@ public static function import($uri, $etag = null, $lastModified = null) } else { $response = $client->get($uri); if ((int) $response->getStatusCode() !== 200) { - throw new Exception\RuntimeException('Feed failed to load, got response code ' . $response->getStatusCode()); + throw new Exception\RuntimeException( + 'Feed failed to load, got response code ' . $response->getStatusCode() + ); } $reader = static::importString($response->getBody()); $reader->setOriginalSourceUri($uri); @@ -274,7 +280,7 @@ public static function import($uri, $etag = null, $lastModified = null) * * @param string $uri * @param Http\ClientInterface $client - * @return self + * @return Feed\FeedInterface * @throws Exception\RuntimeException if response is not an Http\ResponseInterface */ public static function importRemoteFeed($uri, Http\ClientInterface $client) @@ -289,7 +295,9 @@ public static function importRemoteFeed($uri, Http\ClientInterface $client) } if ((int) $response->getStatusCode() !== 200) { - throw new Exception\RuntimeException('Feed failed to load, got response code ' . $response->getStatusCode()); + throw new Exception\RuntimeException( + 'Feed failed to load, got response code ' . $response->getStatusCode() + ); } $reader = static::importString($response->getBody()); $reader->setOriginalSourceUri($uri); @@ -307,7 +315,7 @@ public static function importRemoteFeed($uri, Http\ClientInterface $client) public static function importString($string) { $trimmed = trim($string); - if (!is_string($string) || empty($trimmed)) { + if (! is_string($string) || empty($trimmed)) { throw new Exception\InvalidArgumentException('Only non empty strings are allowed as input'); } @@ -325,7 +333,7 @@ public static function importString($string) libxml_disable_entity_loader($oldValue); libxml_use_internal_errors($libxmlErrflag); - if (!$status) { + if (! $status) { // Build error message $error = libxml_get_last_error(); if ($error && $error->message) { @@ -341,11 +349,11 @@ public static function importString($string) static::registerCoreExtensions(); - if (substr($type, 0, 3) == 'rss') { + if (0 === strpos($type, 'rss')) { $reader = new Feed\Rss($dom, $type); - } elseif (substr($type, 8, 5) == 'entry') { + } elseif (8 === strpos($type, 'entry')) { $reader = new Entry\Atom($dom->documentElement, 0, self::TYPE_ATOM_10); - } elseif (substr($type, 0, 4) == 'atom') { + } elseif (0 === strpos($type, 'atom')) { $reader = new Feed\Atom($dom, $type); } else { throw new Exception\RuntimeException('The URI used does not point to a ' @@ -384,7 +392,9 @@ public static function findFeedLinks($uri) $client = static::getHttpClient(); $response = $client->get($uri); if ($response->getStatusCode() !== 200) { - throw new Exception\RuntimeException("Failed to access $uri, got response code " . $response->getStatusCode()); + throw new Exception\RuntimeException( + "Failed to access $uri, got response code " . $response->getStatusCode() + ); } $responseHtml = $response->getBody(); $libxmlErrflag = libxml_use_internal_errors(true); @@ -393,7 +403,7 @@ public static function findFeedLinks($uri) $status = $dom->loadHTML(trim($responseHtml)); libxml_disable_entity_loader($oldValue); libxml_use_internal_errors($libxmlErrflag); - if (!$status) { + if (! $status) { // Build error message $error = libxml_get_last_error(); if ($error && $error->message) { @@ -425,8 +435,8 @@ public static function detectType($feed, $specOnly = false) $dom = $feed->getDomDocument(); } elseif ($feed instanceof DOMDocument) { $dom = $feed; - } elseif (is_string($feed) && !empty($feed)) { - ErrorHandler::start(E_NOTICE|E_WARNING); + } elseif (is_string($feed) && ! empty($feed)) { + ErrorHandler::start(E_NOTICE | E_WARNING); ini_set('track_errors', 1); $oldValue = libxml_disable_entity_loader(true); $dom = new DOMDocument; @@ -441,8 +451,8 @@ public static function detectType($feed, $specOnly = false) libxml_disable_entity_loader($oldValue); ini_restore('track_errors'); ErrorHandler::stop(); - if (!$status) { - if (!isset($phpErrormsg)) { + if (! $status) { + if (! isset($phpErrormsg)) { if (function_exists('xdebug_is_enabled')) { $phpErrormsg = '(error message not available, when XDebug is running)'; } else { @@ -552,7 +562,7 @@ public static function setExtensionManager(ExtensionManagerInterface $extensionM */ public static function getExtensionManager() { - if (!isset(static::$extensionManager)) { + if (! isset(static::$extensionManager)) { static::setExtensionManager(new StandaloneExtensionManager()); } return static::$extensionManager; @@ -567,22 +577,27 @@ public static function getExtensionManager() */ public static function registerExtension($name) { - $feedName = $name . '\Feed'; - $entryName = $name . '\Entry'; - $manager = static::getExtensionManager(); - if (static::isRegistered($name)) { - if ($manager->has($feedName) || $manager->has($entryName)) { - return; - } + if (! static::hasExtension($name)) { + throw new Exception\RuntimeException(sprintf( + 'Could not load extension "%s" using Plugin Loader.' + . ' Check prefix paths are configured and extension exists.', + $name + )); } - if (!$manager->has($feedName) && !$manager->has($entryName)) { - throw new Exception\RuntimeException('Could not load extension: ' . $name - . ' using Plugin Loader. Check prefix paths are configured and extension exists.'); + // Return early if already registered. + if (static::isRegistered($name)) { + return; } + + $manager = static::getExtensionManager(); + + $feedName = $name . '\Feed'; if ($manager->has($feedName)) { static::$extensions['feed'][] = $feedName; } + + $entryName = $name . '\Entry'; if ($manager->has($entryName)) { static::$extensions['entry'][] = $entryName; } @@ -662,6 +677,18 @@ protected static function registerCoreExtensions() static::registerExtension('WellFormedWeb'); static::registerExtension('Thread'); static::registerExtension('Podcast'); + + // Added in 2.10.0; check for it conditionally + static::hasExtension('GooglePlayPodcast') + ? static::registerExtension('GooglePlayPodcast') + : trigger_error( + sprintf( + 'Please update your %1$s\ExtensionManagerInterface implementation to add entries for' + . ' %1$s\Extension\GooglePlayPodcast\Entry and %1$s\Extension\GooglePlayPodcast\Feed.', + __NAMESPACE__ + ), + \E_USER_NOTICE + ); } /** @@ -682,4 +709,28 @@ public static function arrayUnique(array $array) } return $array; } + + /** + * Does the extension manager have the named extension? + * + * This method exists to allow us to test if an extension is present in the + * extension manager. It may be used by registerExtension() to determine if + * the extension has items present in the manager, or by + * registerCoreExtension() to determine if the core extension has entries + * in the extension manager. In the latter case, this can be useful when + * adding new extensions in a minor release, as custom extension manager + * implementations may not yet have an entry for the extension, which would + * then otherwise cause registerExtension() to fail. + * + * @param string $name + * @return bool + */ + protected static function hasExtension($name) + { + $feedName = $name . '\Feed'; + $entryName = $name . '\Entry'; + $manager = static::getExtensionManager(); + + return $manager->has($feedName) || $manager->has($entryName); + } } diff --git a/vendor/zendframework/zend-feed/src/Reader/StandaloneExtensionManager.php b/vendor/zendframework/zend-feed/src/Reader/StandaloneExtensionManager.php index 9d9fcad9ff5b2e23a52a966e060068ab000c3087..3babc2958357db6d36cb38909b2a86e85c10b921 100644 --- a/vendor/zendframework/zend-feed/src/Reader/StandaloneExtensionManager.php +++ b/vendor/zendframework/zend-feed/src/Reader/StandaloneExtensionManager.php @@ -9,22 +9,26 @@ namespace Zend\Feed\Reader; +use Zend\Feed\Reader\Exception\InvalidArgumentException; + class StandaloneExtensionManager implements ExtensionManagerInterface { private $extensions = [ - 'Atom\Entry' => 'Zend\Feed\Reader\Extension\Atom\Entry', - 'Atom\Feed' => 'Zend\Feed\Reader\Extension\Atom\Feed', - 'Content\Entry' => 'Zend\Feed\Reader\Extension\Content\Entry', - 'CreativeCommons\Entry' => 'Zend\Feed\Reader\Extension\CreativeCommons\Entry', - 'CreativeCommons\Feed' => 'Zend\Feed\Reader\Extension\CreativeCommons\Feed', - 'DublinCore\Entry' => 'Zend\Feed\Reader\Extension\DublinCore\Entry', - 'DublinCore\Feed' => 'Zend\Feed\Reader\Extension\DublinCore\Feed', - 'Podcast\Entry' => 'Zend\Feed\Reader\Extension\Podcast\Entry', - 'Podcast\Feed' => 'Zend\Feed\Reader\Extension\Podcast\Feed', - 'Slash\Entry' => 'Zend\Feed\Reader\Extension\Slash\Entry', - 'Syndication\Feed' => 'Zend\Feed\Reader\Extension\Syndication\Feed', - 'Thread\Entry' => 'Zend\Feed\Reader\Extension\Thread\Entry', - 'WellFormedWeb\Entry' => 'Zend\Feed\Reader\Extension\WellFormedWeb\Entry', + 'Atom\Entry' => Extension\Atom\Entry::class, + 'Atom\Feed' => Extension\Atom\Feed::class, + 'Content\Entry' => Extension\Content\Entry::class, + 'CreativeCommons\Entry' => Extension\CreativeCommons\Entry::class, + 'CreativeCommons\Feed' => Extension\CreativeCommons\Feed::class, + 'DublinCore\Entry' => Extension\DublinCore\Entry::class, + 'DublinCore\Feed' => Extension\DublinCore\Feed::class, + 'GooglePlayPodcast\Entry' => Extension\GooglePlayPodcast\Entry::class, + 'GooglePlayPodcast\Feed' => Extension\GooglePlayPodcast\Feed::class, + 'Podcast\Entry' => Extension\Podcast\Entry::class, + 'Podcast\Feed' => Extension\Podcast\Feed::class, + 'Slash\Entry' => Extension\Slash\Entry::class, + 'Syndication\Feed' => Extension\Syndication\Feed::class, + 'Thread\Entry' => Extension\Thread\Entry::class, + 'WellFormedWeb\Entry' => Extension\WellFormedWeb\Entry::class, ]; /** @@ -49,4 +53,40 @@ public function get($extension) $class = $this->extensions[$extension]; return new $class(); } + + /** + * Add an extension. + * + * @param string $name + * @param string $class + */ + public function add($name, $class) + { + if (is_string($class) + && ( + is_a($class, Extension\AbstractEntry::class, true) + || is_a($class, Extension\AbstractFeed::class, true) + ) + ) { + $this->extensions[$name] = $class; + return; + } + + throw new InvalidArgumentException(sprintf( + 'Plugin of type %s is invalid; must implement %2$s\Extension\AbstractFeed ' + . 'or %2$s\Extension\AbstractEntry', + $class, + __NAMESPACE__ + )); + } + + /** + * Remove an extension. + * + * @param string $name + */ + public function remove($name) + { + unset($this->extensions[$name]); + } } diff --git a/vendor/zendframework/zend-feed/src/Uri.php b/vendor/zendframework/zend-feed/src/Uri.php index 818433f668b06e70b005ff6cffcfe915970ad69a..5fe2f80b4d30fc3cf06d08c82c84a948a2ae3e84 100644 --- a/vendor/zendframework/zend-feed/src/Uri.php +++ b/vendor/zendframework/zend-feed/src/Uri.php @@ -76,13 +76,13 @@ public function __construct($uri) return; } - $this->scheme = isset($parsed['scheme']) ? $parsed['scheme'] : null; - $this->host = isset($parsed['host']) ? $parsed['host'] : null; - $this->port = isset($parsed['port']) ? $parsed['port'] : null; - $this->user = isset($parsed['user']) ? $parsed['user'] : null; - $this->pass = isset($parsed['pass']) ? $parsed['pass'] : null; - $this->path = isset($parsed['path']) ? $parsed['path'] : null; - $this->query = isset($parsed['query']) ? $parsed['query'] : null; + $this->scheme = isset($parsed['scheme']) ? $parsed['scheme'] : null; + $this->host = isset($parsed['host']) ? $parsed['host'] : null; + $this->port = isset($parsed['port']) ? $parsed['port'] : null; + $this->user = isset($parsed['user']) ? $parsed['user'] : null; + $this->pass = isset($parsed['pass']) ? $parsed['pass'] : null; + $this->path = isset($parsed['path']) ? $parsed['path'] : null; + $this->query = isset($parsed['query']) ? $parsed['query'] : null; $this->fragment = isset($parsed['fragment']) ? $parsed['fragment'] : null; } @@ -140,12 +140,12 @@ public function isValid() return false; } - if ($this->scheme && !in_array($this->scheme, $this->validSchemes)) { + if ($this->scheme && ! in_array($this->scheme, $this->validSchemes)) { return false; } if ($this->host) { - if ($this->path && substr($this->path, 0, 1) != '/') { + if ($this->path && 0 !== strpos($this->path, '/')) { return false; } return true; @@ -158,7 +158,7 @@ public function isValid() if ($this->path) { // Check path-only (no host) URI - if (substr($this->path, 0, 2) == '//') { + if (0 === strpos($this->path, '//')) { return false; } return true; diff --git a/vendor/zendframework/zend-feed/src/Writer/AbstractFeed.php b/vendor/zendframework/zend-feed/src/Writer/AbstractFeed.php index 5659b47ea856bc08e2b353dff2ca430d200b192e..9d865bf9860040e2126242d507d10e38d09d267c 100644 --- a/vendor/zendframework/zend-feed/src/Writer/AbstractFeed.php +++ b/vendor/zendframework/zend-feed/src/Writer/AbstractFeed.php @@ -10,6 +10,7 @@ namespace Zend\Feed\Writer; use DateTime; +use DateTimeInterface; use Zend\Feed\Uri; use Zend\Validator; @@ -61,26 +62,29 @@ public function __construct() public function addAuthor(array $author) { // Check array values - if (!array_key_exists('name', $author) + if (! array_key_exists('name', $author) || empty($author['name']) - || !is_string($author['name']) + || ! is_string($author['name']) ) { throw new Exception\InvalidArgumentException( - 'Invalid parameter: author array must include a "name" key with a non-empty string value'); + 'Invalid parameter: author array must include a "name" key with a non-empty string value' + ); } if (isset($author['email'])) { - if (empty($author['email']) || !is_string($author['email'])) { + if (empty($author['email']) || ! is_string($author['email'])) { throw new Exception\InvalidArgumentException( - 'Invalid parameter: "email" array value must be a non-empty string'); + 'Invalid parameter: "email" array value must be a non-empty string' + ); } } if (isset($author['uri'])) { - if (empty($author['uri']) || !is_string($author['uri']) || - !Uri::factory($author['uri'])->isValid() + if (empty($author['uri']) || ! is_string($author['uri']) || + ! Uri::factory($author['uri'])->isValid() ) { throw new Exception\InvalidArgumentException( - 'Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + 'Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI' + ); } } @@ -114,7 +118,7 @@ public function addAuthors(array $authors) */ public function setCopyright($copyright) { - if (empty($copyright) || !is_string($copyright)) { + if (empty($copyright) || ! is_string($copyright)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['copyright'] = $copyright; @@ -125,7 +129,7 @@ public function setCopyright($copyright) /** * Set the feed creation date * - * @param null|int|DateTime + * @param null|int|DateTimeInterface * @throws Exception\InvalidArgumentException * @return AbstractFeed */ @@ -133,9 +137,11 @@ public function setDateCreated($date = null) { if ($date === null) { $date = new DateTime(); - } elseif (is_int($date)) { + } + if (is_int($date)) { $date = new DateTime('@' . $date); - } elseif (!$date instanceof DateTime) { + } + if (! $date instanceof DateTimeInterface) { throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' . ' passed as parameter'); } @@ -147,7 +153,7 @@ public function setDateCreated($date = null) /** * Set the feed modification date * - * @param null|int|DateTime + * @param null|int|DateTimeInterface * @throws Exception\InvalidArgumentException * @return AbstractFeed */ @@ -155,9 +161,11 @@ public function setDateModified($date = null) { if ($date === null) { $date = new DateTime(); - } elseif (is_int($date)) { + } + if (is_int($date)) { $date = new DateTime('@' . $date); - } elseif (!$date instanceof DateTime) { + } + if (! $date instanceof DateTimeInterface) { throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' . ' passed as parameter'); } @@ -169,7 +177,7 @@ public function setDateModified($date = null) /** * Set the feed last-build date. Ignored for Atom 1.0. * - * @param null|int|DateTime + * @param null|int|DateTimeInterface * @throws Exception\InvalidArgumentException * @return AbstractFeed */ @@ -177,9 +185,11 @@ public function setLastBuildDate($date = null) { if ($date === null) { $date = new DateTime(); - } elseif (is_int($date)) { + } + if (is_int($date)) { $date = new DateTime('@' . $date); - } elseif (!$date instanceof DateTime) { + } + if (! $date instanceof DateTimeInterface) { throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' . ' passed as parameter'); } @@ -197,7 +207,7 @@ public function setLastBuildDate($date = null) */ public function setDescription($description) { - if (empty($description) || !is_string($description)) { + if (empty($description) || ! is_string($description)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['description'] = $description; @@ -218,36 +228,44 @@ public function setGenerator($name, $version = null, $uri = null) { if (is_array($name)) { $data = $name; - if (empty($data['name']) || !is_string($data['name'])) { + if (empty($data['name']) || ! is_string($data['name'])) { throw new Exception\InvalidArgumentException('Invalid parameter: "name" must be a non-empty string'); } $generator = ['name' => $data['name']]; if (isset($data['version'])) { - if (empty($data['version']) || !is_string($data['version'])) { - throw new Exception\InvalidArgumentException('Invalid parameter: "version" must be a non-empty string'); + if (empty($data['version']) || ! is_string($data['version'])) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "version" must be a non-empty string' + ); } $generator['version'] = $data['version']; } if (isset($data['uri'])) { - if (empty($data['uri']) || !is_string($data['uri']) || !Uri::factory($data['uri'])->isValid()) { - throw new Exception\InvalidArgumentException('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + if (empty($data['uri']) || ! is_string($data['uri']) || ! Uri::factory($data['uri'])->isValid()) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI' + ); } $generator['uri'] = $data['uri']; } } else { - if (empty($name) || !is_string($name)) { + if (empty($name) || ! is_string($name)) { throw new Exception\InvalidArgumentException('Invalid parameter: "name" must be a non-empty string'); } $generator = ['name' => $name]; if (isset($version)) { - if (empty($version) || !is_string($version)) { - throw new Exception\InvalidArgumentException('Invalid parameter: "version" must be a non-empty string'); + if (empty($version) || ! is_string($version)) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "version" must be a non-empty string' + ); } $generator['version'] = $version; } if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Uri::factory($uri)->isValid()) { - throw new Exception\InvalidArgumentException('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); + if (empty($uri) || ! is_string($uri) || ! Uri::factory($uri)->isValid()) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI' + ); } $generator['uri'] = $uri; } @@ -266,11 +284,15 @@ public function setGenerator($name, $version = null, $uri = null) */ public function setId($id) { - if ((empty($id) || !is_string($id) || !Uri::factory($id)->isValid()) - && !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id) - && !$this->_validateTagUri($id) + // @codingStandardsIgnoreStart + if ((empty($id) || ! is_string($id) || ! Uri::factory($id)->isValid()) + && ! preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id) + && ! $this->_validateTagUri($id) ) { - throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + // @codingStandardsIgnoreEnd + throw new Exception\InvalidArgumentException( + 'Invalid parameter: parameter must be a non-empty string and valid URI/IRI' + ); } $this->data['id'] = $id; @@ -283,9 +305,15 @@ public function setId($id) * @param string $id * @return bool */ + // @codingStandardsIgnoreStart protected function _validateTagUri($id) { - if (preg_match('/^tag:(?P<name>.*),(?P<date>\d{4}-?\d{0,2}-?\d{0,2}):(?P<specific>.*)(.*:)*$/', $id, $matches)) { + // @codingStandardsIgnoreEnd + if (preg_match( + '/^tag:(?P<name>.*),(?P<date>\d{4}-?\d{0,2}-?\d{0,2}):(?P<specific>.*)(.*:)*$/', + $id, + $matches + )) { $dvalid = false; $date = $matches['date']; $d6 = strtotime($date); @@ -319,8 +347,8 @@ protected function _validateTagUri($id) */ public function setImage(array $data) { - if (empty($data['uri']) || !is_string($data['uri']) - || !Uri::factory($data['uri'])->isValid() + if (empty($data['uri']) || ! is_string($data['uri']) + || ! Uri::factory($data['uri'])->isValid() ) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter \'uri\'' . ' must be a non-empty string and valid URI/IRI'); @@ -339,7 +367,7 @@ public function setImage(array $data) */ public function setLanguage($language) { - if (empty($language) || !is_string($language)) { + if (empty($language) || ! is_string($language)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['language'] = $language; @@ -356,8 +384,10 @@ public function setLanguage($language) */ public function setLink($link) { - if (empty($link) || !is_string($link) || !Uri::factory($link)->isValid()) { - throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + if (empty($link) || ! is_string($link) || ! Uri::factory($link)->isValid()) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: parameter must be a non-empty string and valid URI/IRI' + ); } $this->data['link'] = $link; @@ -374,11 +404,15 @@ public function setLink($link) */ public function setFeedLink($link, $type) { - if (empty($link) || !is_string($link) || !Uri::factory($link)->isValid()) { - throw new Exception\InvalidArgumentException('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); + if (empty($link) || ! is_string($link) || ! Uri::factory($link)->isValid()) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "link"" must be a non-empty string and valid URI/IRI' + ); } - if (!in_array(strtolower($type), ['rss', 'rdf', 'atom'])) { - throw new Exception\InvalidArgumentException('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); + if (! in_array(strtolower($type), ['rss', 'rdf', 'atom'])) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom' + ); } $this->data['feedLinks'][strtolower($type)] = $link; @@ -394,7 +428,7 @@ public function setFeedLink($link, $type) */ public function setTitle($title) { - if (empty($title) || !is_string($title)) { + if ((empty($title) && ! is_numeric($title)) || ! is_string($title)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['title'] = $title; @@ -411,7 +445,7 @@ public function setTitle($title) */ public function setEncoding($encoding) { - if (empty($encoding) || !is_string($encoding)) { + if (empty($encoding) || ! is_string($encoding)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['encoding'] = $encoding; @@ -428,7 +462,7 @@ public function setEncoding($encoding) */ public function setBaseUrl($url) { - if (empty($url) || !is_string($url) || !Uri::factory($url)->isValid()) { + if (empty($url) || ! is_string($url) || ! Uri::factory($url)->isValid()) { throw new Exception\InvalidArgumentException('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } @@ -446,11 +480,11 @@ public function setBaseUrl($url) */ public function addHub($url) { - if (empty($url) || !is_string($url) || !Uri::factory($url)->isValid()) { + if (empty($url) || ! is_string($url) || ! Uri::factory($url)->isValid()) { throw new Exception\InvalidArgumentException('Invalid parameter: "url" array value' . ' must be a non-empty string and valid URI/IRI'); } - if (!isset($this->data['hubs'])) { + if (! isset($this->data['hubs'])) { $this->data['hubs'] = []; } $this->data['hubs'][] = $url; @@ -482,21 +516,21 @@ public function addHubs(array $urls) */ public function addCategory(array $category) { - if (!isset($category['term'])) { + if (! isset($category['term'])) { throw new Exception\InvalidArgumentException('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); } if (isset($category['scheme'])) { if (empty($category['scheme']) - || !is_string($category['scheme']) - || !Uri::factory($category['scheme'])->isValid() + || ! is_string($category['scheme']) + || ! Uri::factory($category['scheme'])->isValid() ) { throw new Exception\InvalidArgumentException('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } } - if (!isset($this->data['categories'])) { + if (! isset($this->data['categories'])) { $this->data['categories'] = []; } $this->data['categories'][] = $category; @@ -537,11 +571,11 @@ public function getAuthor($index = 0) /** * Get an array with feed authors * - * @return array + * @return array|null */ public function getAuthors() { - if (!array_key_exists('authors', $this->data)) { + if (! array_key_exists('authors', $this->data)) { return; } return $this->data['authors']; @@ -554,7 +588,7 @@ public function getAuthors() */ public function getCopyright() { - if (!array_key_exists('copyright', $this->data)) { + if (! array_key_exists('copyright', $this->data)) { return; } return $this->data['copyright']; @@ -567,7 +601,7 @@ public function getCopyright() */ public function getDateCreated() { - if (!array_key_exists('dateCreated', $this->data)) { + if (! array_key_exists('dateCreated', $this->data)) { return; } return $this->data['dateCreated']; @@ -580,7 +614,7 @@ public function getDateCreated() */ public function getDateModified() { - if (!array_key_exists('dateModified', $this->data)) { + if (! array_key_exists('dateModified', $this->data)) { return; } return $this->data['dateModified']; @@ -593,7 +627,7 @@ public function getDateModified() */ public function getLastBuildDate() { - if (!array_key_exists('lastBuildDate', $this->data)) { + if (! array_key_exists('lastBuildDate', $this->data)) { return; } return $this->data['lastBuildDate']; @@ -606,7 +640,7 @@ public function getLastBuildDate() */ public function getDescription() { - if (!array_key_exists('description', $this->data)) { + if (! array_key_exists('description', $this->data)) { return; } return $this->data['description']; @@ -619,7 +653,7 @@ public function getDescription() */ public function getGenerator() { - if (!array_key_exists('generator', $this->data)) { + if (! array_key_exists('generator', $this->data)) { return; } return $this->data['generator']; @@ -632,7 +666,7 @@ public function getGenerator() */ public function getId() { - if (!array_key_exists('id', $this->data)) { + if (! array_key_exists('id', $this->data)) { return; } return $this->data['id']; @@ -645,7 +679,7 @@ public function getId() */ public function getImage() { - if (!array_key_exists('image', $this->data)) { + if (! array_key_exists('image', $this->data)) { return; } return $this->data['image']; @@ -658,7 +692,7 @@ public function getImage() */ public function getLanguage() { - if (!array_key_exists('language', $this->data)) { + if (! array_key_exists('language', $this->data)) { return; } return $this->data['language']; @@ -671,7 +705,7 @@ public function getLanguage() */ public function getLink() { - if (!array_key_exists('link', $this->data)) { + if (! array_key_exists('link', $this->data)) { return; } return $this->data['link']; @@ -684,7 +718,7 @@ public function getLink() */ public function getFeedLinks() { - if (!array_key_exists('feedLinks', $this->data)) { + if (! array_key_exists('feedLinks', $this->data)) { return; } return $this->data['feedLinks']; @@ -697,7 +731,7 @@ public function getFeedLinks() */ public function getTitle() { - if (!array_key_exists('title', $this->data)) { + if (! array_key_exists('title', $this->data)) { return; } return $this->data['title']; @@ -710,7 +744,7 @@ public function getTitle() */ public function getEncoding() { - if (!array_key_exists('encoding', $this->data)) { + if (! array_key_exists('encoding', $this->data)) { return 'UTF-8'; } return $this->data['encoding']; @@ -723,7 +757,7 @@ public function getEncoding() */ public function getBaseUrl() { - if (!array_key_exists('baseUrl', $this->data)) { + if (! array_key_exists('baseUrl', $this->data)) { return; } return $this->data['baseUrl']; @@ -736,7 +770,7 @@ public function getBaseUrl() */ public function getHubs() { - if (!array_key_exists('hubs', $this->data)) { + if (! array_key_exists('hubs', $this->data)) { return; } return $this->data['hubs']; @@ -749,7 +783,7 @@ public function getHubs() */ public function getCategories() { - if (!array_key_exists('categories', $this->data)) { + if (! array_key_exists('categories', $this->data)) { return; } return $this->data['categories']; @@ -830,14 +864,18 @@ public function __call($method, $args) * @throws Exception\RuntimeException * @return void */ + // @codingStandardsIgnoreStart protected function _loadExtensions() { + // @codingStandardsIgnoreEnd $all = Writer::getExtensions(); $manager = Writer::getExtensionManager(); $exts = $all['feed']; foreach ($exts as $ext) { - if (!$manager->has($ext)) { - throw new Exception\RuntimeException(sprintf('Unable to load extension "%s"; could not resolve to class', $ext)); + if (! $manager->has($ext)) { + throw new Exception\RuntimeException( + sprintf('Unable to load extension "%s"; could not resolve to class', $ext) + ); } $this->extensions[$ext] = $manager->get($ext); $this->extensions[$ext]->setEncoding($this->getEncoding()); diff --git a/vendor/zendframework/zend-feed/src/Writer/Deleted.php b/vendor/zendframework/zend-feed/src/Writer/Deleted.php index 321102669802c9894701fbb017c91e47e353f664..118355f479480ebc97dc9ad2a80353ea01ac6b34 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Deleted.php +++ b/vendor/zendframework/zend-feed/src/Writer/Deleted.php @@ -10,6 +10,7 @@ namespace Zend\Feed\Writer; use DateTime; +use DateTimeInterface; use Zend\Feed\Uri; /** @@ -41,7 +42,7 @@ class Deleted */ public function setEncoding($encoding) { - if (empty($encoding) || !is_string($encoding)) { + if (empty($encoding) || ! is_string($encoding)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['encoding'] = $encoding; @@ -56,7 +57,7 @@ public function setEncoding($encoding) */ public function getEncoding() { - if (!array_key_exists('encoding', $this->data)) { + if (! array_key_exists('encoding', $this->data)) { return 'UTF-8'; } return $this->data['encoding']; @@ -110,7 +111,7 @@ public function getType() */ public function setReference($reference) { - if (empty($reference) || !is_string($reference)) { + if (empty($reference) || ! is_string($reference)) { throw new Exception\InvalidArgumentException('Invalid parameter: reference must be a non-empty string'); } $this->data['reference'] = $reference; @@ -123,7 +124,7 @@ public function setReference($reference) */ public function getReference() { - if (!array_key_exists('reference', $this->data)) { + if (! array_key_exists('reference', $this->data)) { return; } return $this->data['reference']; @@ -132,7 +133,7 @@ public function getReference() /** * Set when * - * @param null|string|DateTime $date + * @param null|int|DateTimeInterface $date * @throws Exception\InvalidArgumentException * @return Deleted */ @@ -140,9 +141,11 @@ public function setWhen($date = null) { if ($date === null) { $date = new DateTime(); - } elseif (is_int($date)) { + } + if (is_int($date)) { $date = new DateTime('@' . $date); - } elseif (!$date instanceof DateTime) { + } + if (! $date instanceof DateTimeInterface) { throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' . ' passed as parameter'); } @@ -156,7 +159,7 @@ public function setWhen($date = null) */ public function getWhen() { - if (!array_key_exists('when', $this->data)) { + if (! array_key_exists('when', $this->data)) { return; } return $this->data['when']; @@ -172,16 +175,16 @@ public function getWhen() public function setBy(array $by) { $author = []; - if (!array_key_exists('name', $by) + if (! array_key_exists('name', $by) || empty($by['name']) - || !is_string($by['name']) + || ! is_string($by['name']) ) { throw new Exception\InvalidArgumentException('Invalid parameter: author array must include a' . ' "name" key with a non-empty string value'); } $author['name'] = $by['name']; if (isset($by['email'])) { - if (empty($by['email']) || !is_string($by['email'])) { + if (empty($by['email']) || ! is_string($by['email'])) { throw new Exception\InvalidArgumentException('Invalid parameter: "email" array' . ' value must be a non-empty string'); } @@ -189,8 +192,8 @@ public function setBy(array $by) } if (isset($by['uri'])) { if (empty($by['uri']) - || !is_string($by['uri']) - || !Uri::factory($by['uri'])->isValid() + || ! is_string($by['uri']) + || ! Uri::factory($by['uri'])->isValid() ) { throw new Exception\InvalidArgumentException('Invalid parameter: "uri" array value must' . ' be a non-empty string and valid URI/IRI'); @@ -207,7 +210,7 @@ public function setBy(array $by) */ public function getBy() { - if (!array_key_exists('by', $this->data)) { + if (! array_key_exists('by', $this->data)) { return; } return $this->data['by']; @@ -228,7 +231,7 @@ public function setComment($comment) */ public function getComment() { - if (!array_key_exists('comment', $this->data)) { + if (! array_key_exists('comment', $this->data)) { return; } return $this->data['comment']; diff --git a/vendor/zendframework/zend-feed/src/Writer/Entry.php b/vendor/zendframework/zend-feed/src/Writer/Entry.php index a802ffa05a01167bd7bf68a96f563f1a084a0f84..b8ec25c708bcb4bbeda36a2257e0c98e6cb2a7d1 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Entry.php +++ b/vendor/zendframework/zend-feed/src/Writer/Entry.php @@ -10,6 +10,7 @@ namespace Zend\Feed\Writer; use DateTime; +use DateTimeInterface; use Zend\Feed\Uri; /** @@ -64,26 +65,29 @@ public function __construct() public function addAuthor(array $author) { // Check array values - if (!array_key_exists('name', $author) + if (! array_key_exists('name', $author) || empty($author['name']) - || !is_string($author['name']) + || ! is_string($author['name']) ) { throw new Exception\InvalidArgumentException( - 'Invalid parameter: author array must include a "name" key with a non-empty string value'); + 'Invalid parameter: author array must include a "name" key with a non-empty string value' + ); } if (isset($author['email'])) { - if (empty($author['email']) || !is_string($author['email'])) { + if (empty($author['email']) || ! is_string($author['email'])) { throw new Exception\InvalidArgumentException( - 'Invalid parameter: "email" array value must be a non-empty string'); + 'Invalid parameter: "email" array value must be a non-empty string' + ); } } if (isset($author['uri'])) { - if (empty($author['uri']) || !is_string($author['uri']) || - !Uri::factory($author['uri'])->isValid() + if (empty($author['uri']) || ! is_string($author['uri']) || + ! Uri::factory($author['uri'])->isValid() ) { throw new Exception\InvalidArgumentException( - 'Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); + 'Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI' + ); } } @@ -117,7 +121,7 @@ public function addAuthors(array $authors) */ public function setEncoding($encoding) { - if (empty($encoding) || !is_string($encoding)) { + if (empty($encoding) || ! is_string($encoding)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['encoding'] = $encoding; @@ -132,7 +136,7 @@ public function setEncoding($encoding) */ public function getEncoding() { - if (!array_key_exists('encoding', $this->data)) { + if (! array_key_exists('encoding', $this->data)) { return 'UTF-8'; } return $this->data['encoding']; @@ -147,7 +151,7 @@ public function getEncoding() */ public function setCopyright($copyright) { - if (empty($copyright) || !is_string($copyright)) { + if (empty($copyright) || ! is_string($copyright)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['copyright'] = $copyright; @@ -164,7 +168,7 @@ public function setCopyright($copyright) */ public function setContent($content) { - if (empty($content) || !is_string($content)) { + if (empty($content) || ! is_string($content)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['content'] = $content; @@ -175,7 +179,7 @@ public function setContent($content) /** * Set the feed creation date * - * @param null|int|DateTime $date + * @param null|int|DateTimeInterface $date * @throws Exception\InvalidArgumentException * @return Entry */ @@ -183,10 +187,14 @@ public function setDateCreated($date = null) { if ($date === null) { $date = new DateTime(); - } elseif (is_int($date)) { + } + if (is_int($date)) { $date = new DateTime('@' . $date); - } elseif (!$date instanceof DateTime) { - throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp passed as parameter'); + } + if (! $date instanceof DateTimeInterface) { + throw new Exception\InvalidArgumentException( + 'Invalid DateTime object or UNIX Timestamp passed as parameter' + ); } $this->data['dateCreated'] = $date; @@ -196,7 +204,7 @@ public function setDateCreated($date = null) /** * Set the feed modification date * - * @param null|int|DateTime $date + * @param null|int|DateTimeInterface $date * @throws Exception\InvalidArgumentException * @return Entry */ @@ -204,10 +212,14 @@ public function setDateModified($date = null) { if ($date === null) { $date = new DateTime(); - } elseif (is_int($date)) { + } + if (is_int($date)) { $date = new DateTime('@' . $date); - } elseif (!$date instanceof DateTime) { - throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp passed as parameter'); + } + if (! $date instanceof DateTimeInterface) { + throw new Exception\InvalidArgumentException( + 'Invalid DateTime object or UNIX Timestamp passed as parameter' + ); } $this->data['dateModified'] = $date; @@ -223,7 +235,7 @@ public function setDateModified($date = null) */ public function setDescription($description) { - if (empty($description) || !is_string($description)) { + if (empty($description) || ! is_string($description)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['description'] = $description; @@ -240,7 +252,7 @@ public function setDescription($description) */ public function setId($id) { - if (empty($id) || !is_string($id)) { + if (empty($id) || ! is_string($id)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['id'] = $id; @@ -257,8 +269,10 @@ public function setId($id) */ public function setLink($link) { - if (empty($link) || !is_string($link) || !Uri::factory($link)->isValid()) { - throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); + if (empty($link) || ! is_string($link) || ! Uri::factory($link)->isValid()) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: parameter must be a non-empty string and valid URI/IRI' + ); } $this->data['link'] = $link; @@ -274,8 +288,10 @@ public function setLink($link) */ public function setCommentCount($count) { - if (!is_numeric($count) || (int) $count != $count || (int) $count < 0) { - throw new Exception\InvalidArgumentException('Invalid parameter: "count" must be a positive integer number or zero'); + if (! is_numeric($count) || (int) $count != $count || (int) $count < 0) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "count" must be a positive integer number or zero' + ); } $this->data['commentCount'] = (int) $count; @@ -291,8 +307,10 @@ public function setCommentCount($count) */ public function setCommentLink($link) { - if (empty($link) || !is_string($link) || !Uri::factory($link)->isValid()) { - throw new Exception\InvalidArgumentException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + if (empty($link) || ! is_string($link) || ! Uri::factory($link)->isValid()) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "link" must be a non-empty string and valid URI/IRI' + ); } $this->data['commentLink'] = $link; @@ -308,14 +326,16 @@ public function setCommentLink($link) */ public function setCommentFeedLink(array $link) { - if (!isset($link['uri']) || !is_string($link['uri']) || !Uri::factory($link['uri'])->isValid()) { - throw new Exception\InvalidArgumentException('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); + if (! isset($link['uri']) || ! is_string($link['uri']) || ! Uri::factory($link['uri'])->isValid()) { + throw new Exception\InvalidArgumentException( + 'Invalid parameter: "link" must be a non-empty string and valid URI/IRI' + ); } - if (!isset($link['type']) || !in_array($link['type'], ['atom', 'rss', 'rdf'])) { + if (! isset($link['type']) || ! in_array($link['type'], ['atom', 'rss', 'rdf'])) { throw new Exception\InvalidArgumentException('Invalid parameter: "type" must be one' . ' of "atom", "rss" or "rdf"'); } - if (!isset($this->data['commentFeedLinks'])) { + if (! isset($this->data['commentFeedLinks'])) { $this->data['commentFeedLinks'] = []; } $this->data['commentFeedLinks'][] = $link; @@ -349,7 +369,7 @@ public function setCommentFeedLinks(array $links) */ public function setTitle($title) { - if (empty($title) || !is_string($title)) { + if ((empty($title) && ! is_numeric($title)) || ! is_string($title)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); } $this->data['title'] = $title; @@ -364,7 +384,7 @@ public function setTitle($title) */ public function getAuthors() { - if (!array_key_exists('authors', $this->data)) { + if (! array_key_exists('authors', $this->data)) { return; } return $this->data['authors']; @@ -377,7 +397,7 @@ public function getAuthors() */ public function getContent() { - if (!array_key_exists('content', $this->data)) { + if (! array_key_exists('content', $this->data)) { return; } return $this->data['content']; @@ -390,7 +410,7 @@ public function getContent() */ public function getCopyright() { - if (!array_key_exists('copyright', $this->data)) { + if (! array_key_exists('copyright', $this->data)) { return; } return $this->data['copyright']; @@ -403,7 +423,7 @@ public function getCopyright() */ public function getDateCreated() { - if (!array_key_exists('dateCreated', $this->data)) { + if (! array_key_exists('dateCreated', $this->data)) { return; } return $this->data['dateCreated']; @@ -416,7 +436,7 @@ public function getDateCreated() */ public function getDateModified() { - if (!array_key_exists('dateModified', $this->data)) { + if (! array_key_exists('dateModified', $this->data)) { return; } return $this->data['dateModified']; @@ -429,7 +449,7 @@ public function getDateModified() */ public function getDescription() { - if (!array_key_exists('description', $this->data)) { + if (! array_key_exists('description', $this->data)) { return; } return $this->data['description']; @@ -442,7 +462,7 @@ public function getDescription() */ public function getId() { - if (!array_key_exists('id', $this->data)) { + if (! array_key_exists('id', $this->data)) { return; } return $this->data['id']; @@ -455,7 +475,7 @@ public function getId() */ public function getLink() { - if (!array_key_exists('link', $this->data)) { + if (! array_key_exists('link', $this->data)) { return; } return $this->data['link']; @@ -469,7 +489,7 @@ public function getLink() */ public function getLinks() { - if (!array_key_exists('links', $this->data)) { + if (! array_key_exists('links', $this->data)) { return; } return $this->data['links']; @@ -482,7 +502,7 @@ public function getLinks() */ public function getTitle() { - if (!array_key_exists('title', $this->data)) { + if (! array_key_exists('title', $this->data)) { return; } return $this->data['title']; @@ -495,7 +515,7 @@ public function getTitle() */ public function getCommentCount() { - if (!array_key_exists('commentCount', $this->data)) { + if (! array_key_exists('commentCount', $this->data)) { return; } return $this->data['commentCount']; @@ -508,7 +528,7 @@ public function getCommentCount() */ public function getCommentLink() { - if (!array_key_exists('commentLink', $this->data)) { + if (! array_key_exists('commentLink', $this->data)) { return; } return $this->data['commentLink']; @@ -522,7 +542,7 @@ public function getCommentLink() */ public function getCommentFeedLinks() { - if (!array_key_exists('commentFeedLinks', $this->data)) { + if (! array_key_exists('commentFeedLinks', $this->data)) { return; } return $this->data['commentFeedLinks']; @@ -537,21 +557,21 @@ public function getCommentFeedLinks() */ public function addCategory(array $category) { - if (!isset($category['term'])) { + if (! isset($category['term'])) { throw new Exception\InvalidArgumentException('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name'); } if (isset($category['scheme'])) { if (empty($category['scheme']) - || !is_string($category['scheme']) - || !Uri::factory($category['scheme'])->isValid() + || ! is_string($category['scheme']) + || ! Uri::factory($category['scheme'])->isValid() ) { throw new Exception\InvalidArgumentException('The Atom scheme or RSS domain of' . ' a category must be a valid URI'); } } - if (!isset($this->data['categories'])) { + if (! isset($this->data['categories'])) { $this->data['categories'] = []; } $this->data['categories'][] = $category; @@ -581,7 +601,7 @@ public function addCategories(array $categories) */ public function getCategories() { - if (!array_key_exists('categories', $this->data)) { + if (! array_key_exists('categories', $this->data)) { return; } return $this->data['categories']; @@ -599,10 +619,10 @@ public function getCategories() */ public function setEnclosure(array $enclosure) { - if (!isset($enclosure['uri'])) { + if (! isset($enclosure['uri'])) { throw new Exception\InvalidArgumentException('Enclosure "uri" is not set'); } - if (!Uri::factory($enclosure['uri'])->isValid()) { + if (! Uri::factory($enclosure['uri'])->isValid()) { throw new Exception\InvalidArgumentException('Enclosure "uri" is not a valid URI/IRI'); } $this->data['enclosure'] = $enclosure; @@ -617,7 +637,7 @@ public function setEnclosure(array $enclosure) */ public function getEnclosure() { - if (!array_key_exists('enclosure', $this->data)) { + if (! array_key_exists('enclosure', $this->data)) { return; } return $this->data['enclosure']; @@ -752,8 +772,10 @@ public function getSource() * * @return void */ + // @codingStandardsIgnoreStart protected function _loadExtensions() { + // @codingStandardsIgnoreEnd $all = Writer::getExtensions(); $manager = Writer::getExtensionManager(); $exts = $all['entry']; diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/AbstractRenderer.php b/vendor/zendframework/zend-feed/src/Writer/Extension/AbstractRenderer.php index 1a32b4756293e56d0eda7732df350313ec3db284..856e714104dbbd05bb6e4b50dfecaaf22dc4fd20 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/AbstractRenderer.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/AbstractRenderer.php @@ -160,5 +160,7 @@ public function getRootElement() * * @return void */ + // @codingStandardsIgnoreStart abstract protected function _appendNamespaces(); + // @codingStandardsIgnoreEnd } diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/Atom/Renderer/Feed.php b/vendor/zendframework/zend-feed/src/Writer/Extension/Atom/Renderer/Feed.php index 25571c0e0d63185a1e8e844700c60b070c09fcbe..e066ab8a097a0b3c93a0859cf14183502ff965de 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/Atom/Renderer/Feed.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/Atom/Renderer/Feed.php @@ -52,10 +52,14 @@ public function render() * * @return void */ + // @codingStandardsIgnoreStart protected function _appendNamespaces() { - $this->getRootElement()->setAttribute('xmlns:atom', - 'http://www.w3.org/2005/Atom'); + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:atom', + 'http://www.w3.org/2005/Atom' + ); } /** @@ -65,10 +69,12 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $flinks = $this->getDataContainer()->getFeedLinks(); - if (!$flinks || empty($flinks)) { + if (! $flinks || empty($flinks)) { return; } foreach ($flinks as $type => $href) { @@ -91,10 +97,12 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setHubs(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $hubs = $this->getDataContainer()->getHubs(); - if (!$hubs || empty($hubs)) { + if (! $hubs || empty($hubs)) { return; } foreach ($hubs as $hubUrl) { diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/Content/Renderer/Entry.php b/vendor/zendframework/zend-feed/src/Writer/Extension/Content/Renderer/Entry.php index 939b2492bc921533b9e9fe801f2090da5a9b1828..c7f44d4fa2ffe036f49bae149f306b939ad7f5f9 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/Content/Renderer/Entry.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/Content/Renderer/Entry.php @@ -47,10 +47,14 @@ public function render() * * @return void */ + // @codingStandardsIgnoreStart protected function _appendNamespaces() { - $this->getRootElement()->setAttribute('xmlns:content', - 'http://purl.org/rss/1.0/modules/content/'); + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:content', + 'http://purl.org/rss/1.0/modules/content/' + ); } /** @@ -60,10 +64,12 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setContent(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $content = $this->getDataContainer()->getContent(); - if (!$content) { + if (! $content) { return; } $element = $dom->createElement('content:encoded'); diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Entry.php b/vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Entry.php index 5cc86cd6b8bdb6b174cfc2a6e78f2b675d5db8f5..598f228c878f77ea0f0e3d36caa7fa2084804025 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Entry.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Entry.php @@ -47,10 +47,14 @@ public function render() * * @return void */ + // @codingStandardsIgnoreStart protected function _appendNamespaces() { - $this->getRootElement()->setAttribute('xmlns:dc', - 'http://purl.org/dc/elements/1.1/'); + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:dc', + 'http://purl.org/dc/elements/1.1/' + ); } /** @@ -60,10 +64,12 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setAuthors(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $authors = $this->getDataContainer()->getAuthors(); - if (!$authors || empty($authors)) { + if (! $authors || empty($authors)) { return; } foreach ($authors as $data) { diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php b/vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php index 160b5a48481fecd03e5d13a9bbe89479ec1eba74..e69f95056089639f026f3c0a0f9d582bba0a777d 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -47,10 +47,14 @@ public function render() * * @return void */ + // @codingStandardsIgnoreStart protected function _appendNamespaces() { - $this->getRootElement()->setAttribute('xmlns:dc', - 'http://purl.org/dc/elements/1.1/'); + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:dc', + 'http://purl.org/dc/elements/1.1/' + ); } /** @@ -60,10 +64,12 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setAuthors(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $authors = $this->getDataContainer()->getAuthors(); - if (!$authors || empty($authors)) { + if (! $authors || empty($authors)) { return; } foreach ($authors as $data) { diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Entry.php b/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Entry.php new file mode 100644 index 0000000000000000000000000000000000000000..f5b6a3af0611dd5bac849848abab08ff1d957f12 --- /dev/null +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Entry.php @@ -0,0 +1,148 @@ +<?php +/** + * @see https://github.com/zendframework/zend-feed for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-feed/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Feed\Writer\Extension\GooglePlayPodcast; + +use Zend\Feed\Writer; +use Zend\Stdlib\StringUtils; +use Zend\Stdlib\StringWrapper\StringWrapperInterface; + +class Entry +{ + /** + * Array of Feed data for rendering by Extension's renderers + * + * @var array + */ + protected $data = []; + + /** + * Encoding of all text values + * + * @var string + */ + protected $encoding = 'UTF-8'; + + /** + * The used string wrapper supporting encoding + * + * @var StringWrapperInterface + */ + protected $stringWrapper; + + public function __construct() + { + $this->stringWrapper = StringUtils::getWrapper($this->encoding); + } + + /** + * Set feed encoding + * + * @param string $enc + * @return Entry + */ + public function setEncoding($enc) + { + $this->stringWrapper = StringUtils::getWrapper($enc); + $this->encoding = $enc; + return $this; + } + + /** + * Get feed encoding + * + * @return string + */ + public function getEncoding() + { + return $this->encoding; + } + + /** + * Set a block value of "yes" or "no". You may also set an empty string. + * + * @param string + * @throws Writer\Exception\InvalidArgumentException + */ + public function setPlayPodcastBlock($value) + { + if (! ctype_alpha($value) && strlen($value) > 0) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "block" may only contain alphabetic characters' + ); + } + + if ($this->stringWrapper->strlen($value) > 255) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "block" may only contain a maximum of 255 characters' + ); + } + $this->data['block'] = $value; + } + + /** + * Set "explicit" flag + * + * @param bool $value + * @return Entry + * @throws Writer\Exception\InvalidArgumentException + */ + public function setPlayPodcastExplicit($value) + { + if (! in_array($value, ['yes', 'no', 'clean'], true)) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "explicit" may only be one of "yes", "no" or "clean"' + ); + } + $this->data['explicit'] = $value; + return $this; + } + + /** + * Set episode description + * + * @param string $value + * @return Entry + * @throws Writer\Exception\InvalidArgumentException + */ + public function setPlayPodcastDescription($value) + { + if ($this->stringWrapper->strlen($value) > 4000) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "description" may only contain a maximum of 4000 characters' + ); + } + $this->data['description'] = $value; + return $this; + } + + /** + * Overloading to itunes specific setters + * + * @param string $method + * @param array $params + * @throws Writer\Exception\BadMethodCallException + * @return mixed + */ + public function __call($method, array $params) + { + $point = lcfirst(substr($method, 14)); + if (! method_exists($this, 'setPlayPodcast' . ucfirst($point)) + && ! method_exists($this, 'addPlayPodcast' . ucfirst($point)) + ) { + throw new Writer\Exception\BadMethodCallException( + 'invalid method: ' . $method + ); + } + if (! array_key_exists($point, $this->data) + || empty($this->data[$point]) + ) { + return; + } + return $this->data[$point]; + } +} diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Feed.php b/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Feed.php new file mode 100644 index 0000000000000000000000000000000000000000..af9ef690868c8648e7d5e06cf7551099b6524ff9 --- /dev/null +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Feed.php @@ -0,0 +1,245 @@ +<?php +/** + * @see https://github.com/zendframework/zend-zend-feed for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-zend-feed/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Feed\Writer\Extension\GooglePlayPodcast; + +use Zend\Feed\Uri; +use Zend\Feed\Writer; +use Zend\Stdlib\StringUtils; +use Zend\Stdlib\StringWrapper\StringWrapperInterface; + +class Feed +{ + /** + * Array of Feed data for rendering by Extension's renderers + * + * @var array + */ + protected $data = []; + + /** + * Encoding of all text values + * + * @var string + */ + protected $encoding = 'UTF-8'; + + /** + * The used string wrapper supporting encoding + * + * @var StringWrapperInterface + */ + protected $stringWrapper; + + /** + * Constructor + */ + public function __construct() + { + $this->stringWrapper = StringUtils::getWrapper($this->encoding); + } + + /** + * Set feed encoding + * + * @param string $enc + * @return Feed + */ + public function setEncoding($enc) + { + $this->stringWrapper = StringUtils::getWrapper($enc); + $this->encoding = $enc; + return $this; + } + + /** + * Get feed encoding + * + * @return string + */ + public function getEncoding() + { + return $this->encoding; + } + + /** + * Set a block value of "yes" or "no". You may also set an empty string. + * + * @param string + * @return Feed + * @throws Writer\Exception\InvalidArgumentException + */ + public function setPlayPodcastBlock($value) + { + if (! ctype_alpha($value) && strlen($value) > 0) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "block" may only contain alphabetic characters' + ); + } + if ($this->stringWrapper->strlen($value) > 255) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "block" may only contain a maximum of 255 characters' + ); + } + $this->data['block'] = $value; + return $this; + } + + /** + * Add feed authors + * + * @param array $values + * @return Feed + */ + public function addPlayPodcastAuthors(array $values) + { + foreach ($values as $value) { + $this->addPlayPodcastAuthor($value); + } + return $this; + } + + /** + * Add feed author + * + * @param string $value + * @return Feed + * @throws Writer\Exception\InvalidArgumentException + */ + public function addPlayPodcastAuthor($value) + { + if ($this->stringWrapper->strlen($value) > 255) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: any "author" may only contain a maximum of 255 characters each' + ); + } + if (! isset($this->data['authors'])) { + $this->data['authors'] = []; + } + $this->data['authors'][] = $value; + return $this; + } + + /** + * Set feed categories + * + * @param array $values + * @return Feed + * @throws Writer\Exception\InvalidArgumentException + */ + public function setPlayPodcastCategories(array $values) + { + if (! isset($this->data['categories'])) { + $this->data['categories'] = []; + } + foreach ($values as $key => $value) { + if (! is_array($value)) { + if ($this->stringWrapper->strlen($value) > 255) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: any "category" may only contain a maximum of 255 characters each' + ); + } + $this->data['categories'][] = $value; + } else { + if ($this->stringWrapper->strlen($key) > 255) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: any "category" may only contain a maximum of 255 characters each' + ); + } + $this->data['categories'][$key] = []; + foreach ($value as $val) { + if ($this->stringWrapper->strlen($val) > 255) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: any "category" may only contain a maximum of 255 characters each' + ); + } + $this->data['categories'][$key][] = $val; + } + } + } + return $this; + } + + /** + * Set feed image (icon) + * + * @param string $value + * @return Feed + * @throws Writer\Exception\InvalidArgumentException + */ + public function setPlayPodcastImage($value) + { + if (! is_string($value) || ! Uri::factory($value)->isValid()) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "image" may only be a valid URI/IRI' + ); + } + $this->data['image'] = $value; + return $this; + } + + /** + * Set "explicit" flag + * + * @param bool $value + * @return Feed + * @throws Writer\Exception\InvalidArgumentException + */ + public function setPlayPodcastExplicit($value) + { + if (! in_array($value, ['yes', 'no', 'clean'], true)) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "explicit" may only be one of "yes", "no" or "clean"' + ); + } + $this->data['explicit'] = $value; + return $this; + } + + /** + * Set podcast description + * + * @param string $value + * @return Feed + * @throws Writer\Exception\InvalidArgumentException + */ + public function setPlayPodcastDescription($value) + { + if ($this->stringWrapper->strlen($value) > 4000) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "description" may only contain a maximum of 4000 characters' + ); + } + $this->data['description'] = $value; + return $this; + } + + /** + * Overloading: proxy to internal setters + * + * @param string $method + * @param array $params + * @return mixed + * @throws Writer\Exception\BadMethodCallException + */ + public function __call($method, array $params) + { + $point = lcfirst(substr($method, 14)); + if (! method_exists($this, 'setPlayPodcast' . ucfirst($point)) + && ! method_exists($this, 'addPlayPodcast' . ucfirst($point)) + ) { + throw new Writer\Exception\BadMethodCallException( + 'invalid method: ' . $method + ); + } + + if (! array_key_exists($point, $this->data) || empty($this->data[$point])) { + return; + } + return $this->data[$point]; + } +} diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Renderer/Entry.php b/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Renderer/Entry.php new file mode 100644 index 0000000000000000000000000000000000000000..b828402dbb443283e1e190a3f9b961d6f54903b0 --- /dev/null +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Renderer/Entry.php @@ -0,0 +1,120 @@ +<?php +/** + * @see https://github.com/zendframework/zend-feed for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-feed/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Feed\Writer\Extension\GooglePlayPodcast\Renderer; + +use DOMDocument; +use DOMElement; +use Zend\Feed\Writer\Extension; + +class Entry extends Extension\AbstractRenderer +{ + /** + * Set to TRUE if a rendering method actually renders something. This + * is used to prevent premature appending of a XML namespace declaration + * until an element which requires it is actually appended. + * + * @var bool + */ + protected $called = false; + + /** + * Render entry + * + * @return void + */ + public function render() + { + $this->_setBlock($this->dom, $this->base); + $this->_setExplicit($this->dom, $this->base); + $this->_setDescription($this->dom, $this->base); + if ($this->called) { + $this->_appendNamespaces(); + } + } + + /** + * Append namespaces to entry root + * + * @return void + */ + // @codingStandardsIgnoreStart + protected function _appendNamespaces() + { + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:googleplay', + 'http://www.google.com/schemas/play-podcasts/1.0' + ); + } + + /** + * Set itunes block + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setBlock(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $block = $this->getDataContainer()->getPlayPodcastBlock(); + if ($block === null) { + return; + } + $el = $dom->createElement('googleplay:block'); + $text = $dom->createTextNode($block); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } + + /** + * Set explicit flag + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setExplicit(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $explicit = $this->getDataContainer()->getPlayPodcastExplicit(); + if ($explicit === null) { + return; + } + $el = $dom->createElement('googleplay:explicit'); + $text = $dom->createTextNode($explicit); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } + + /** + * Set episode description + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setDescription(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $description = $this->getDataContainer()->getPlayPodcastDescription(); + if (! $description) { + return; + } + $el = $dom->createElement('googleplay:description'); + $text = $dom->createTextNode($description); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } +} diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Renderer/Feed.php b/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Renderer/Feed.php new file mode 100644 index 0000000000000000000000000000000000000000..167d9fbefc8748a926fcf3444df6cee580fe2d12 --- /dev/null +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/GooglePlayPodcast/Renderer/Feed.php @@ -0,0 +1,202 @@ +<?php +/** + * @see https://github.com/zendframework/zend-feed for the canonical source repository + * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://github.com/zendframework/zend-feed/blob/master/LICENSE.md New BSD License + */ + +namespace Zend\Feed\Writer\Extension\GooglePlayPodcast\Renderer; + +use DOMDocument; +use DOMElement; +use Zend\Feed\Writer\Extension; + +class Feed extends Extension\AbstractRenderer +{ + /** + * Set to TRUE if a rendering method actually renders something. This + * is used to prevent premature appending of a XML namespace declaration + * until an element which requires it is actually appended. + * + * @var bool + */ + protected $called = false; + + /** + * Render feed + * + * @return void + */ + public function render() + { + $this->_setAuthors($this->dom, $this->base); + $this->_setBlock($this->dom, $this->base); + $this->_setCategories($this->dom, $this->base); + $this->_setImage($this->dom, $this->base); + $this->_setExplicit($this->dom, $this->base); + $this->_setDescription($this->dom, $this->base); + if ($this->called) { + $this->_appendNamespaces(); + } + } + + /** + * Append feed namespaces + * + * @return void + */ + // @codingStandardsIgnoreStart + protected function _appendNamespaces() + { + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:googleplay', + 'http://www.google.com/schemas/play-podcasts/1.0' + ); + } + + /** + * Set feed authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setAuthors(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $authors = $this->getDataContainer()->getPlayPodcastAuthors(); + if (! $authors || empty($authors)) { + return; + } + foreach ($authors as $author) { + $el = $dom->createElement('googleplay:author'); + $text = $dom->createTextNode($author); + $el->appendChild($text); + $root->appendChild($el); + } + $this->called = true; + } + + /** + * Set feed itunes block + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setBlock(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $block = $this->getDataContainer()->getPlayPodcastBlock(); + if ($block === null) { + return; + } + $el = $dom->createElement('googleplay:block'); + $text = $dom->createTextNode($block); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } + + /** + * Set feed categories + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setCategories(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $cats = $this->getDataContainer()->getPlayPodcastCategories(); + if (! $cats || empty($cats)) { + return; + } + foreach ($cats as $key => $cat) { + if (! is_array($cat)) { + $el = $dom->createElement('googleplay:category'); + $el->setAttribute('text', $cat); + $root->appendChild($el); + } else { + $el = $dom->createElement('googleplay:category'); + $el->setAttribute('text', $key); + $root->appendChild($el); + foreach ($cat as $subcat) { + $el2 = $dom->createElement('googleplay:category'); + $el2->setAttribute('text', $subcat); + $el->appendChild($el2); + } + } + } + $this->called = true; + } + + /** + * Set feed image (icon) + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setImage(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $image = $this->getDataContainer()->getPlayPodcastImage(); + if (! $image) { + return; + } + $el = $dom->createElement('googleplay:image'); + $el->setAttribute('href', $image); + $root->appendChild($el); + $this->called = true; + } + + /** + * Set explicit flag + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setExplicit(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $explicit = $this->getDataContainer()->getPlayPodcastExplicit(); + if ($explicit === null) { + return; + } + $el = $dom->createElement('googleplay:explicit'); + $text = $dom->createTextNode($explicit); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } + + /** + * Set podcast description + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setDescription(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $description = $this->getDataContainer()->getPlayPodcastDescription(); + if (! $description) { + return; + } + $el = $dom->createElement('googleplay:description'); + $text = $dom->createTextNode($description); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } +} diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Entry.php b/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Entry.php index 595689a055852cea0256608668dc6291f3ca8055..eb219b54cbd9481c5315311fce6bd1655bb29215 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Entry.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Entry.php @@ -9,8 +9,8 @@ namespace Zend\Feed\Writer\Extension\ITunes; +use Zend\Feed\Uri; use Zend\Feed\Writer; -use Zend\Feed\Writer\Extension; use Zend\Stdlib\StringUtils; use Zend\Stdlib\StringWrapper\StringWrapperInterface; @@ -71,12 +71,11 @@ public function getEncoding() * Set a block value of "yes" or "no". You may also set an empty string. * * @param string - * @return Entry * @throws Writer\Exception\InvalidArgumentException */ public function setItunesBlock($value) { - if (!ctype_alpha($value) && strlen($value) > 0) { + if (! ctype_alpha($value) && strlen($value) > 0) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "block" may only' . ' contain alphabetic characters'); } @@ -115,7 +114,7 @@ public function addItunesAuthor($value) throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "author" may only' . ' contain a maximum of 255 characters each'); } - if (!isset($this->data['authors'])) { + if (! isset($this->data['authors'])) { $this->data['authors'] = []; } $this->data['authors'][] = $value; @@ -132,9 +131,9 @@ public function addItunesAuthor($value) public function setItunesDuration($value) { $value = (string) $value; - if (!ctype_digit($value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) + if (! ctype_digit($value) + && ! preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) + && ! preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) ) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "duration" may only' . ' be of a specified [[HH:]MM:]SS format'); @@ -152,7 +151,7 @@ public function setItunesDuration($value) */ public function setItunesExplicit($value) { - if (!in_array($value, ['yes', 'no', 'clean'])) { + if (! in_array($value, ['yes', 'no', 'clean'])) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "explicit" may only' . ' be one of "yes", "no" or "clean"'); } @@ -163,12 +162,20 @@ public function setItunesExplicit($value) /** * Set keywords * + * @deprecated since 2.10.0; itunes:keywords is no longer part of the + * iTunes podcast RSS specification. * @param array $value * @return Entry * @throws Writer\Exception\InvalidArgumentException */ public function setItunesKeywords(array $value) { + trigger_error( + 'itunes:keywords has been deprecated in the iTunes podcast RSS specification,' + . ' and should not be relied on.', + \E_USER_DEPRECATED + ); + if (count($value) > 12) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "keywords" may only' . ' contain a maximum of 12 terms'); @@ -184,6 +191,23 @@ public function setItunesKeywords(array $value) return $this; } + /** + * Set title + * + * @param string $value + * @return Entry + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesTitle($value) + { + if ($this->stringWrapper->strlen($value) > 255) { + throw new Writer\Exception\InvalidArgumentException('invalid parameter: "title" may only' + . ' contain a maximum of 255 characters'); + } + $this->data['title'] = $value; + return $this; + } + /** * Set subtitle * @@ -218,6 +242,123 @@ public function setItunesSummary($value) return $this; } + /** + * Set entry image (icon) + * + * @param string $value + * @return Entry + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesImage($value) + { + if (! is_string($value) || ! Uri::factory($value)->isValid()) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "image" may only be a valid URI/IRI' + ); + } + + if (! in_array(substr($value, -3), ['jpg', 'png'])) { + throw new Writer\Exception\InvalidArgumentException( + 'invalid parameter: "image" may only use file extension "jpg"' + . ' or "png" which must be the last three characters of the URI' + . ' (i.e. no query string or fragment)' + ); + } + + $this->data['image'] = $value; + return $this; + } + + /** + * Set the episode number + * + * @param int $number + * @return self + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesEpisode($number) + { + if (! is_numeric($number) || is_float($number)) { + throw new Writer\Exception\InvalidArgumentException(sprintf( + 'invalid parameter: "number" may only be an integer; received %s', + is_object($number) ? get_class($number) : gettype($number) + )); + } + + $this->data['episode'] = (int) $number; + + return $this; + } + + /** + * Set the episode type + * + * @param string $type One of "full", "trailer", or "bonus". + * @return self + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesEpisodeType($type) + { + $validTypes = ['full', 'trailer', 'bonus']; + if (! in_array($type, $validTypes, true)) { + throw new Writer\Exception\InvalidArgumentException(sprintf( + 'invalid parameter: "episodeType" MUST be one of the strings [%s]; received %s', + implode(', ', $validTypes), + is_object($type) ? get_class($type) : var_export($type, true) + )); + } + + $this->data['episodeType'] = $type; + + return $this; + } + + /** + * Set the status of closed captioning + * + * @param bool $status + * @return self + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesIsClosedCaptioned($status) + { + if (! is_bool($status)) { + throw new Writer\Exception\InvalidArgumentException(sprintf( + 'invalid parameter: "isClosedCaptioned" MUST be a boolean; received %s', + is_object($status) ? get_class($status) : var_export($status, true) + )); + } + + if (! $status) { + return $this; + } + + $this->data['isClosedCaptioned'] = true; + + return $this; + } + + /** + * Set the season number to which the episode belongs + * + * @param int $number + * @return self + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesSeason($number) + { + if (! is_numeric($number) || is_float($number)) { + throw new Writer\Exception\InvalidArgumentException(sprintf( + 'invalid parameter: "season" may only be an integer; received %s', + is_object($number) ? get_class($number) : gettype($number) + )); + } + + $this->data['season'] = (int) $number; + + return $this; + } + /** * Overloading to itunes specific setters * @@ -229,14 +370,14 @@ public function setItunesSummary($value) public function __call($method, array $params) { $point = lcfirst(substr($method, 9)); - if (!method_exists($this, 'setItunes' . ucfirst($point)) - && !method_exists($this, 'addItunes' . ucfirst($point)) + if (! method_exists($this, 'setItunes' . ucfirst($point)) + && ! method_exists($this, 'addItunes' . ucfirst($point)) ) { throw new Writer\Exception\BadMethodCallException( 'invalid method: ' . $method ); } - if (!array_key_exists($point, $this->data) + if (! array_key_exists($point, $this->data) || empty($this->data[$point]) ) { return; diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Feed.php b/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Feed.php index 054fe3e33cf30875dd7278d8f043e9084a3fbe4a..3aa30995b01d6605935300b12d719138cc087077 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Feed.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Feed.php @@ -77,7 +77,7 @@ public function getEncoding() */ public function setItunesBlock($value) { - if (!ctype_alpha($value) && strlen($value) > 0) { + if (! ctype_alpha($value) && strlen($value) > 0) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "block" may only' . ' contain alphabetic characters'); } @@ -116,7 +116,7 @@ public function addItunesAuthor($value) throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "author" may only' . ' contain a maximum of 255 characters each'); } - if (!isset($this->data['authors'])) { + if (! isset($this->data['authors'])) { $this->data['authors'] = []; } $this->data['authors'][] = $value; @@ -132,11 +132,11 @@ public function addItunesAuthor($value) */ public function setItunesCategories(array $values) { - if (!isset($this->data['categories'])) { + if (! isset($this->data['categories'])) { $this->data['categories'] = []; } foreach ($values as $key => $value) { - if (!is_array($value)) { + if (! is_array($value)) { if ($this->stringWrapper->strlen($value) > 255) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); @@ -169,11 +169,11 @@ public function setItunesCategories(array $values) */ public function setItunesImage($value) { - if (!Uri::factory($value)->isValid()) { + if (! is_string($value) || ! Uri::factory($value)->isValid()) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "image" may only' . ' be a valid URI/IRI'); } - if (!in_array(substr($value, -3), ['jpg', 'png'])) { + if (! in_array(substr($value, -3), ['jpg', 'png'])) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "image" may only' . ' use file extension "jpg" or "png" which must be the last three' . ' characters of the URI (i.e. no query string or fragment)'); @@ -192,9 +192,9 @@ public function setItunesImage($value) public function setItunesDuration($value) { $value = (string) $value; - if (!ctype_digit($value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) + if (! ctype_digit($value) + && ! preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) + && ! preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) ) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "duration" may only' . ' be of a specified [[HH:]MM:]SS format'); @@ -212,7 +212,7 @@ public function setItunesDuration($value) */ public function setItunesExplicit($value) { - if (!in_array($value, ['yes', 'no', 'clean'])) { + if (! in_array($value, ['yes', 'no', 'clean'])) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "explicit" may only' . ' be one of "yes", "no" or "clean"'); } @@ -223,12 +223,20 @@ public function setItunesExplicit($value) /** * Set feed keywords * + * @deprecated since 2.10.0; itunes:keywords is no longer part of the + * iTunes podcast RSS specification. * @param array $value * @return Feed * @throws Writer\Exception\InvalidArgumentException */ public function setItunesKeywords(array $value) { + trigger_error( + 'itunes:keywords has been deprecated in the iTunes podcast RSS specification,' + . ' and should not be relied on.', + \E_USER_DEPRECATED + ); + if (count($value) > 12) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "keywords" may only' . ' contain a maximum of 12 terms'); @@ -252,7 +260,7 @@ public function setItunesKeywords(array $value) */ public function setItunesNewFeedUrl($value) { - if (!Uri::factory($value)->isValid()) { + if (! Uri::factory($value)->isValid()) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: "newFeedUrl" may only' . ' be a valid URI/IRI'); } @@ -283,7 +291,7 @@ public function addItunesOwners(array $values) */ public function addItunesOwner(array $value) { - if (!isset($value['name']) || !isset($value['email'])) { + if (! isset($value['name']) || ! isset($value['email'])) { throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "owner" must' . ' be an array containing keys "name" and "email"'); } @@ -293,7 +301,7 @@ public function addItunesOwner(array $value) throw new Writer\Exception\InvalidArgumentException('invalid parameter: any "owner" may only' . ' contain a maximum of 255 characters each for "name" and "email"'); } - if (!isset($this->data['owners'])) { + if (! isset($this->data['owners'])) { $this->data['owners'] = []; } $this->data['owners'][] = $value; @@ -334,6 +342,51 @@ public function setItunesSummary($value) return $this; } + /** + * Set podcast type + * + * @param string $type + * @return Feed + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesType($type) + { + $validTypes = ['episodic', 'serial']; + if (! in_array($type, $validTypes, true)) { + throw new Writer\Exception\InvalidArgumentException(sprintf( + 'invalid parameter: "type" MUST be one of [%s]; received %s', + implode(', ', $validTypes), + is_object($type) ? get_class($type) : var_export($type, true) + )); + } + $this->data['type'] = $type; + return $this; + } + + /** + * Set "completion" status (whether more episodes will be released) + * + * @param bool $status + * @return Feed + * @throws Writer\Exception\InvalidArgumentException + */ + public function setItunesComplete($status) + { + if (! is_bool($status)) { + throw new Writer\Exception\InvalidArgumentException(sprintf( + 'invalid parameter: "complete" MUST be boolean; received %s', + is_object($status) ? get_class($status) : var_export($status, true) + )); + } + + if (! $status) { + return $this; + } + + $this->data['complete'] = 'Yes'; + return $this; + } + /** * Overloading: proxy to internal setters * @@ -345,14 +398,15 @@ public function setItunesSummary($value) public function __call($method, array $params) { $point = lcfirst(substr($method, 9)); - if (!method_exists($this, 'setItunes' . ucfirst($point)) - && !method_exists($this, 'addItunes' . ucfirst($point)) + if (! method_exists($this, 'setItunes' . ucfirst($point)) + && ! method_exists($this, 'addItunes' . ucfirst($point)) ) { throw new Writer\Exception\BadMethodCallException( 'invalid method: ' . $method ); } - if (!array_key_exists($point, $this->data) || empty($this->data[$point])) { + + if (! array_key_exists($point, $this->data) || empty($this->data[$point])) { return; } return $this->data[$point]; diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Entry.php b/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Entry.php index ed8f732ed7c3b872d77b0c872cfedd3fd8133a69..699e6a528e62da54ce50ba4aa0bcea64eb8696e0 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Entry.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Entry.php @@ -36,10 +36,16 @@ public function render() $this->_setAuthors($this->dom, $this->base); $this->_setBlock($this->dom, $this->base); $this->_setDuration($this->dom, $this->base); + $this->_setImage($this->dom, $this->base); $this->_setExplicit($this->dom, $this->base); $this->_setKeywords($this->dom, $this->base); + $this->_setTitle($this->dom, $this->base); $this->_setSubtitle($this->dom, $this->base); $this->_setSummary($this->dom, $this->base); + $this->_setEpisode($this->dom, $this->base); + $this->_setEpisodeType($this->dom, $this->base); + $this->_setClosedCaptioned($this->dom, $this->base); + $this->_setSeason($this->dom, $this->base); if ($this->called) { $this->_appendNamespaces(); } @@ -50,10 +56,14 @@ public function render() * * @return void */ + // @codingStandardsIgnoreStart protected function _appendNamespaces() { - $this->getRootElement()->setAttribute('xmlns:itunes', - 'http://www.itunes.com/dtds/podcast-1.0.dtd'); + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:itunes', + 'http://www.itunes.com/dtds/podcast-1.0.dtd' + ); } /** @@ -63,10 +73,12 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setAuthors(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $authors = $this->getDataContainer()->getItunesAuthors(); - if (!$authors || empty($authors)) { + if (! $authors || empty($authors)) { return; } foreach ($authors as $author) { @@ -85,8 +97,10 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setBlock(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $block = $this->getDataContainer()->getItunesBlock(); if ($block === null) { return; @@ -105,10 +119,12 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDuration(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $duration = $this->getDataContainer()->getItunesDuration(); - if (!$duration) { + if (! $duration) { return; } $el = $dom->createElement('itunes:duration'); @@ -118,6 +134,27 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) $this->called = true; } + /** + * Set feed image (icon) + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setImage(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $image = $this->getDataContainer()->getItunesImage(); + if (! $image) { + return; + } + $el = $dom->createElement('itunes:image'); + $el->setAttribute('href', $image); + $root->appendChild($el); + $this->called = true; + } + /** * Set explicit flag * @@ -125,8 +162,10 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setExplicit(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $explicit = $this->getDataContainer()->getItunesExplicit(); if ($explicit === null) { return; @@ -145,10 +184,12 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setKeywords(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $keywords = $this->getDataContainer()->getItunesKeywords(); - if (!$keywords || empty($keywords)) { + if (! $keywords || empty($keywords)) { return; } $el = $dom->createElement('itunes:keywords'); @@ -158,6 +199,28 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root) $this->called = true; } + /** + * Set entry title + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setTitle(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $title = $this->getDataContainer()->getItunesTitle(); + if (! $title) { + return; + } + $el = $dom->createElement('itunes:title'); + $text = $dom->createTextNode($title); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } + /** * Set entry subtitle * @@ -165,10 +228,12 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setSubtitle(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $subtitle = $this->getDataContainer()->getItunesSubtitle(); - if (!$subtitle) { + if (! $subtitle) { return; } $el = $dom->createElement('itunes:subtitle'); @@ -185,10 +250,12 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setSummary(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $summary = $this->getDataContainer()->getItunesSummary(); - if (!$summary) { + if (! $summary) { return; } $el = $dom->createElement('itunes:summary'); @@ -197,4 +264,92 @@ protected function _setSummary(DOMDocument $dom, DOMElement $root) $root->appendChild($el); $this->called = true; } + + /** + * Set entry episode number + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setEpisode(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $episode = $this->getDataContainer()->getItunesEpisode(); + if (! $episode) { + return; + } + $el = $dom->createElement('itunes:episode'); + $text = $dom->createTextNode($episode); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } + + /** + * Set entry episode type + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setEpisodeType(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $type = $this->getDataContainer()->getItunesEpisodeType(); + if (! $type) { + return; + } + $el = $dom->createElement('itunes:episodeType'); + $text = $dom->createTextNode($type); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } + + /** + * Set closed captioning status for episode + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setClosedCaptioned(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $status = $this->getDataContainer()->getItunesIsClosedCaptioned(); + if (! $status) { + return; + } + $el = $dom->createElement('itunes:isClosedCaptioned'); + $text = $dom->createTextNode('Yes'); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } + + /** + * Set entry season number + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setSeason(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $season = $this->getDataContainer()->getItunesSeason(); + if (! $season) { + return; + } + $el = $dom->createElement('itunes:season'); + $text = $dom->createTextNode($season); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } } diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Feed.php b/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Feed.php index d978f03201e4bc2b78ef705d1b7c7672d9f6b9f2..6614e3ffbd3525c53c1e3b2922779084a2f0a4cc 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Feed.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Feed.php @@ -44,6 +44,8 @@ public function render() $this->_setOwners($this->dom, $this->base); $this->_setSubtitle($this->dom, $this->base); $this->_setSummary($this->dom, $this->base); + $this->_setType($this->dom, $this->base); + $this->_setComplete($this->dom, $this->base); if ($this->called) { $this->_appendNamespaces(); } @@ -54,10 +56,14 @@ public function render() * * @return void */ + // @codingStandardsIgnoreStart protected function _appendNamespaces() { - $this->getRootElement()->setAttribute('xmlns:itunes', - 'http://www.itunes.com/dtds/podcast-1.0.dtd'); + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:itunes', + 'http://www.itunes.com/dtds/podcast-1.0.dtd' + ); } /** @@ -67,10 +73,12 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setAuthors(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $authors = $this->getDataContainer()->getItunesAuthors(); - if (!$authors || empty($authors)) { + if (! $authors || empty($authors)) { return; } foreach ($authors as $author) { @@ -89,8 +97,10 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setBlock(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $block = $this->getDataContainer()->getItunesBlock(); if ($block === null) { return; @@ -109,14 +119,16 @@ protected function _setBlock(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCategories(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $cats = $this->getDataContainer()->getItunesCategories(); - if (!$cats || empty($cats)) { + if (! $cats || empty($cats)) { return; } foreach ($cats as $key => $cat) { - if (!is_array($cat)) { + if (! is_array($cat)) { $el = $dom->createElement('itunes:category'); $el->setAttribute('text', $cat); $root->appendChild($el); @@ -141,10 +153,12 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setImage(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $image = $this->getDataContainer()->getItunesImage(); - if (!$image) { + if (! $image) { return; } $el = $dom->createElement('itunes:image'); @@ -160,10 +174,12 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDuration(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $duration = $this->getDataContainer()->getItunesDuration(); - if (!$duration) { + if (! $duration) { return; } $el = $dom->createElement('itunes:duration'); @@ -180,8 +196,10 @@ protected function _setDuration(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setExplicit(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $explicit = $this->getDataContainer()->getItunesExplicit(); if ($explicit === null) { return; @@ -200,10 +218,12 @@ protected function _setExplicit(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setKeywords(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $keywords = $this->getDataContainer()->getItunesKeywords(); - if (!$keywords || empty($keywords)) { + if (! $keywords || empty($keywords)) { return; } $el = $dom->createElement('itunes:keywords'); @@ -220,10 +240,12 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $url = $this->getDataContainer()->getItunesNewFeedUrl(); - if (!$url) { + if (! $url) { return; } $el = $dom->createElement('itunes:new-feed-url'); @@ -240,10 +262,12 @@ protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setOwners(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $owners = $this->getDataContainer()->getItunesOwners(); - if (!$owners || empty($owners)) { + if (! $owners || empty($owners)) { return; } foreach ($owners as $owner) { @@ -268,10 +292,12 @@ protected function _setOwners(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setSubtitle(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $subtitle = $this->getDataContainer()->getItunesSubtitle(); - if (!$subtitle) { + if (! $subtitle) { return; } $el = $dom->createElement('itunes:subtitle'); @@ -288,10 +314,12 @@ protected function _setSubtitle(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setSummary(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $summary = $this->getDataContainer()->getItunesSummary(); - if (!$summary) { + if (! $summary) { return; } $el = $dom->createElement('itunes:summary'); @@ -300,4 +328,48 @@ protected function _setSummary(DOMDocument $dom, DOMElement $root) $root->appendChild($el); $this->called = true; } + + /** + * Set podcast type + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setType(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $type = $this->getDataContainer()->getItunesType(); + if (! $type) { + return; + } + $el = $dom->createElement('itunes:type'); + $text = $dom->createTextNode($type); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } + + /** + * Set complete status + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setComplete(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $status = $this->getDataContainer()->getItunesComplete(); + if (! $status) { + return; + } + $el = $dom->createElement('itunes:complete'); + $text = $dom->createTextNode('Yes'); + $el->appendChild($text); + $root->appendChild($el); + $this->called = true; + } } diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/Slash/Renderer/Entry.php b/vendor/zendframework/zend-feed/src/Writer/Extension/Slash/Renderer/Entry.php index c74cb02023f443eaa99454c0af42489b4ec89fa2..9d3e07c3b2aad5e2fd7c6491a80c607ead22bba8 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/Slash/Renderer/Entry.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/Slash/Renderer/Entry.php @@ -47,10 +47,14 @@ public function render() * * @return void */ + // @codingStandardsIgnoreStart protected function _appendNamespaces() { - $this->getRootElement()->setAttribute('xmlns:slash', - 'http://purl.org/rss/1.0/modules/slash/'); + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:slash', + 'http://purl.org/rss/1.0/modules/slash/' + ); } /** @@ -60,10 +64,12 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $count = $this->getDataContainer()->getCommentCount(); - if (!$count) { + if (! $count) { $count = 0; } $tcount = $this->dom->createElement('slash:comments'); diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/Threading/Renderer/Entry.php b/vendor/zendframework/zend-feed/src/Writer/Extension/Threading/Renderer/Entry.php index 6f19641b89572795ba1a6a42ad9ca448ae076a6a..bf7cde51a4cb570966463e2d707389790766f995 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/Threading/Renderer/Entry.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/Threading/Renderer/Entry.php @@ -49,10 +49,14 @@ public function render() * * @return void */ + // @codingStandardsIgnoreStart protected function _appendNamespaces() { - $this->getRootElement()->setAttribute('xmlns:thr', - 'http://purl.org/syndication/thread/1.0'); + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:thr', + 'http://purl.org/syndication/thread/1.0' + ); } /** @@ -62,10 +66,12 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCommentLink(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $link = $this->getDataContainer()->getCommentLink(); - if (!$link) { + if (! $link) { return; } $clink = $this->dom->createElement('link'); @@ -87,10 +93,12 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $links = $this->getDataContainer()->getCommentFeedLinks(); - if (!$links || empty($links)) { + if (! $links || empty($links)) { return; } foreach ($links as $link) { @@ -114,8 +122,10 @@ protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCommentCount(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $count = $this->getDataContainer()->getCommentCount(); if ($count === null) { return; diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/vendor/zendframework/zend-feed/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php index 48c0d8f2e3248803cb8f543452ea0afcfd03313d..cdb6e58de65b3cc482f251119421e354802da308 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/WellFormedWeb/Renderer/Entry.php @@ -47,10 +47,14 @@ public function render() * * @return void */ + // @codingStandardsIgnoreStart protected function _appendNamespaces() { - $this->getRootElement()->setAttribute('xmlns:wfw', - 'http://wellformedweb.org/CommentAPI/'); + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:wfw', + 'http://wellformedweb.org/CommentAPI/' + ); } /** @@ -60,10 +64,12 @@ protected function _appendNamespaces() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $links = $this->getDataContainer()->getCommentFeedLinks(); - if (!$links || empty($links)) { + if (! $links || empty($links)) { return; } foreach ($links as $link) { diff --git a/vendor/zendframework/zend-feed/src/Writer/ExtensionManager.php b/vendor/zendframework/zend-feed/src/Writer/ExtensionManager.php index a7efb3e1a6d108f97189870a365b10c8bbb2f1a2..82bc73ab08677e42a102bf631e0dc732425e551c 100644 --- a/vendor/zendframework/zend-feed/src/Writer/ExtensionManager.php +++ b/vendor/zendframework/zend-feed/src/Writer/ExtensionManager.php @@ -46,7 +46,7 @@ public function __construct(ExtensionManagerInterface $pluginManager = null) */ public function __call($method, $args) { - if (!method_exists($this->pluginManager, $method)) { + if (! method_exists($this->pluginManager, $method)) { throw new Exception\BadMethodCallException(sprintf( 'Method by name of %s does not exist in %s', $method, diff --git a/vendor/zendframework/zend-feed/src/Writer/ExtensionPluginManager.php b/vendor/zendframework/zend-feed/src/Writer/ExtensionPluginManager.php index 34cc57f4866317a27b52ddcb7b75fc1bfdfa8420..7e2c4e42dfefb4a485ebceb92dd01392eb28ab62 100644 --- a/vendor/zendframework/zend-feed/src/Writer/ExtensionPluginManager.php +++ b/vendor/zendframework/zend-feed/src/Writer/ExtensionPluginManager.php @@ -18,7 +18,7 @@ * * Validation checks that we have an Entry, Feed, or Extension\AbstractRenderer. */ -class ExtensionPluginManager extends AbstractPluginManager +class ExtensionPluginManager extends AbstractPluginManager implements ExtensionManagerInterface { /** * Aliases for default set of extension classes @@ -29,40 +29,86 @@ class ExtensionPluginManager extends AbstractPluginManager 'atomrendererfeed' => Extension\Atom\Renderer\Feed::class, 'atomRendererFeed' => Extension\Atom\Renderer\Feed::class, 'AtomRendererFeed' => Extension\Atom\Renderer\Feed::class, + 'AtomRenderer\Feed' => Extension\Atom\Renderer\Feed::class, + 'Atom\Renderer\Feed' => Extension\Atom\Renderer\Feed::class, 'contentrendererentry' => Extension\Content\Renderer\Entry::class, 'contentRendererEntry' => Extension\Content\Renderer\Entry::class, 'ContentRendererEntry' => Extension\Content\Renderer\Entry::class, + 'ContentRenderer\Entry' => Extension\Content\Renderer\Entry::class, + 'Content\Renderer\Entry' => Extension\Content\Renderer\Entry::class, 'dublincorerendererentry' => Extension\DublinCore\Renderer\Entry::class, 'dublinCoreRendererEntry' => Extension\DublinCore\Renderer\Entry::class, 'DublinCoreRendererEntry' => Extension\DublinCore\Renderer\Entry::class, + 'DublinCoreRenderer\Entry' => Extension\DublinCore\Renderer\Entry::class, + 'DublinCore\Renderer\Entry' => Extension\DublinCore\Renderer\Entry::class, 'dublincorerendererfeed' => Extension\DublinCore\Renderer\Feed::class, 'dublinCoreRendererFeed' => Extension\DublinCore\Renderer\Feed::class, 'DublinCoreRendererFeed' => Extension\DublinCore\Renderer\Feed::class, + 'DublinCoreRenderer\Feed' => Extension\DublinCore\Renderer\Feed::class, + 'DublinCore\Renderer\Feed' => Extension\DublinCore\Renderer\Feed::class, + 'googleplaypodcastentry' => Extension\GooglePlayPodcast\Entry::class, + 'googleplaypodcastEntry' => Extension\GooglePlayPodcast\Entry::class, + 'googlePlayPodcastEntry' => Extension\GooglePlayPodcast\Entry::class, + 'GooglePlayPodcastEntry' => Extension\GooglePlayPodcast\Entry::class, + 'Googleplaypodcast\Entry' => Extension\GooglePlayPodcast\Entry::class, + 'GooglePlayPodcast\Entry' => Extension\GooglePlayPodcast\Entry::class, + 'googleplaypodcastfeed' => Extension\GooglePlayPodcast\Feed::class, + 'googleplaypodcastFeed' => Extension\GooglePlayPodcast\Feed::class, + 'googlePlayPodcastFeed' => Extension\GooglePlayPodcast\Feed::class, + 'GooglePlayPodcastFeed' => Extension\GooglePlayPodcast\Feed::class, + 'Googleplaypodcast\Feed' => Extension\GooglePlayPodcast\Feed::class, + 'GooglePlayPodcast\Feed' => Extension\GooglePlayPodcast\Feed::class, + 'googleplaypodcastrendererentry' => Extension\GooglePlayPodcast\Renderer\Entry::class, + 'googleplaypodcastRendererEntry' => Extension\GooglePlayPodcast\Renderer\Entry::class, + 'googlePlayPodcastRendererEntry' => Extension\GooglePlayPodcast\Renderer\Entry::class, + 'GooglePlayPodcastRendererEntry' => Extension\GooglePlayPodcast\Renderer\Entry::class, + 'GoogleplaypodcastRenderer\Entry' => Extension\GooglePlayPodcast\Renderer\Entry::class, + 'GooglePlayPodcast\Renderer\Entry' => Extension\GooglePlayPodcast\Renderer\Entry::class, + 'googleplaypodcastrendererfeed' => Extension\GooglePlayPodcast\Renderer\Feed::class, + 'googleplaypodcastRendererFeed' => Extension\GooglePlayPodcast\Renderer\Feed::class, + 'googlePlayPodcastRendererFeed' => Extension\GooglePlayPodcast\Renderer\Feed::class, + 'GooglePlayPodcastRendererFeed' => Extension\GooglePlayPodcast\Renderer\Feed::class, + 'GoogleplaypodcastRenderer\Feed' => Extension\GooglePlayPodcast\Renderer\Feed::class, + 'GooglePlayPodcast\Renderer\Feed' => Extension\GooglePlayPodcast\Renderer\Feed::class, 'itunesentry' => Extension\ITunes\Entry::class, 'itunesEntry' => Extension\ITunes\Entry::class, 'iTunesEntry' => Extension\ITunes\Entry::class, 'ItunesEntry' => Extension\ITunes\Entry::class, + 'Itunes\Entry' => Extension\ITunes\Entry::class, + 'ITunes\Entry' => Extension\ITunes\Entry::class, 'itunesfeed' => Extension\ITunes\Feed::class, 'itunesFeed' => Extension\ITunes\Feed::class, 'iTunesFeed' => Extension\ITunes\Feed::class, 'ItunesFeed' => Extension\ITunes\Feed::class, + 'Itunes\Feed' => Extension\ITunes\Feed::class, + 'ITunes\Feed' => Extension\ITunes\Feed::class, 'itunesrendererentry' => Extension\ITunes\Renderer\Entry::class, 'itunesRendererEntry' => Extension\ITunes\Renderer\Entry::class, 'iTunesRendererEntry' => Extension\ITunes\Renderer\Entry::class, 'ItunesRendererEntry' => Extension\ITunes\Renderer\Entry::class, + 'ItunesRenderer\Entry' => Extension\ITunes\Renderer\Entry::class, + 'ITunes\Renderer\Entry' => Extension\ITunes\Renderer\Entry::class, 'itunesrendererfeed' => Extension\ITunes\Renderer\Feed::class, 'itunesRendererFeed' => Extension\ITunes\Renderer\Feed::class, 'iTunesRendererFeed' => Extension\ITunes\Renderer\Feed::class, 'ItunesRendererFeed' => Extension\ITunes\Renderer\Feed::class, + 'ItunesRenderer\Feed' => Extension\ITunes\Renderer\Feed::class, + 'ITunes\Renderer\Feed' => Extension\ITunes\Renderer\Feed::class, 'slashrendererentry' => Extension\Slash\Renderer\Entry::class, 'slashRendererEntry' => Extension\Slash\Renderer\Entry::class, 'SlashRendererEntry' => Extension\Slash\Renderer\Entry::class, + 'SlashRenderer\Entry' => Extension\Slash\Renderer\Entry::class, + 'Slash\Renderer\Entry' => Extension\Slash\Renderer\Entry::class, 'threadingrendererentry' => Extension\Threading\Renderer\Entry::class, 'threadingRendererEntry' => Extension\Threading\Renderer\Entry::class, 'ThreadingRendererEntry' => Extension\Threading\Renderer\Entry::class, + 'ThreadingRenderer\Entry' => Extension\Threading\Renderer\Entry::class, + 'Threading\Renderer\Entry' => Extension\Threading\Renderer\Entry::class, 'wellformedwebrendererentry' => Extension\WellFormedWeb\Renderer\Entry::class, 'wellFormedWebRendererEntry' => Extension\WellFormedWeb\Renderer\Entry::class, 'WellFormedWebRendererEntry' => Extension\WellFormedWeb\Renderer\Entry::class, + 'WellFormedWebRenderer\Entry' => Extension\WellFormedWeb\Renderer\Entry::class, + 'WellFormedWeb\Renderer\Entry' => Extension\WellFormedWeb\Renderer\Entry::class, ]; /** @@ -75,6 +121,10 @@ class ExtensionPluginManager extends AbstractPluginManager Extension\Content\Renderer\Entry::class => InvokableFactory::class, Extension\DublinCore\Renderer\Entry::class => InvokableFactory::class, Extension\DublinCore\Renderer\Feed::class => InvokableFactory::class, + Extension\GooglePlayPodcast\Entry::class => InvokableFactory::class, + Extension\GooglePlayPodcast\Feed::class => InvokableFactory::class, + Extension\GooglePlayPodcast\Renderer\Entry::class => InvokableFactory::class, + Extension\GooglePlayPodcast\Renderer\Feed::class => InvokableFactory::class, Extension\ITunes\Entry::class => InvokableFactory::class, Extension\ITunes\Feed::class => InvokableFactory::class, Extension\ITunes\Renderer\Entry::class => InvokableFactory::class, @@ -89,6 +139,11 @@ class ExtensionPluginManager extends AbstractPluginManager 'zendfeedwriterextensioncontentrendererentry' => InvokableFactory::class, 'zendfeedwriterextensiondublincorerendererentry' => InvokableFactory::class, 'zendfeedwriterextensiondublincorerendererfeed' => InvokableFactory::class, + 'zendfeedwriterextensiongoogleplaypodcastentry' => InvokableFactory::class, + 'zendfeedwriterextensiongoogleplaypodcastfeed' => InvokableFactory::class, + 'zendfeedwriterextensiongoogleplaypodcastrendererentry' => InvokableFactory::class, + 'zendfeedwriterextensiongoogleplaypodcastrendererfeed' => InvokableFactory::class, + 'zendfeedwriterextensionitunesentry' => InvokableFactory::class, 'zendfeedwriterextensionitunesfeed' => InvokableFactory::class, 'zendfeedwriterextensionitunesrendererentry' => InvokableFactory::class, diff --git a/vendor/zendframework/zend-feed/src/Writer/Feed.php b/vendor/zendframework/zend-feed/src/Writer/Feed.php index 5d01232d5d5d28912b02f8066dd3242c54d9ce6e..e8328ed60cac3eb79c4819dced35bd0639a6dee1 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Feed.php +++ b/vendor/zendframework/zend-feed/src/Writer/Feed.php @@ -99,7 +99,7 @@ public function addEntry(Entry $entry) */ public function removeEntry($index) { - if (!isset($this->entries[$index])) { + if (! isset($this->entries[$index])) { throw new Exception\InvalidArgumentException('Undefined index: ' . $index . '. Entry does not exist.'); } unset($this->entries[$index]); @@ -112,6 +112,7 @@ public function removeEntry($index) * added to a feed container in order to be indexed. * * @param int $index + * @return Entry * @throws Exception\InvalidArgumentException */ public function getEntry($index = 0) diff --git a/vendor/zendframework/zend-feed/src/Writer/FeedFactory.php b/vendor/zendframework/zend-feed/src/Writer/FeedFactory.php index 99b528c73aebda2b703e48b95ef67a430efab630..b321d70fc729aca544bcf4fa25c6b666126ba684 100644 --- a/vendor/zendframework/zend-feed/src/Writer/FeedFactory.php +++ b/vendor/zendframework/zend-feed/src/Writer/FeedFactory.php @@ -22,7 +22,7 @@ abstract class FeedFactory */ public static function factory($data) { - if (!is_array($data) && !$data instanceof Traversable) { + if (! is_array($data) && ! $data instanceof Traversable) { throw new Exception\InvalidArgumentException(sprintf( '%s expects an array or Traversable argument; received "%s"', __METHOD__, @@ -39,11 +39,11 @@ public static function factory($data) if (method_exists($feed, $method)) { switch ($method) { case 'setfeedlink': - if (!is_array($value)) { + if (! is_array($value)) { // Need an array break; } - if (!array_key_exists('link', $value) || !array_key_exists('type', $value)) { + if (! array_key_exists('link', $value) || ! array_key_exists('type', $value)) { // Need both keys to set this correctly break; } @@ -88,7 +88,7 @@ protected static function convertKey($key) */ protected static function createEntries($entries, Feed $feed) { - if (!is_array($entries) && !$entries instanceof Traversable) { + if (! is_array($entries) && ! $entries instanceof Traversable) { throw new Exception\InvalidArgumentException(sprintf( '%s::factory expects the "entries" value to be an array or Traversable; received "%s"', get_called_class(), @@ -97,7 +97,7 @@ protected static function createEntries($entries, Feed $feed) } foreach ($entries as $data) { - if (!is_array($data) && !$data instanceof Traversable && !$data instanceof Entry) { + if (! is_array($data) && ! $data instanceof Traversable && ! $data instanceof Entry) { throw new Exception\InvalidArgumentException(sprintf( '%s expects an array, Traversable, or Zend\Feed\Writer\Entry argument; received "%s"', __METHOD__, @@ -116,7 +116,7 @@ protected static function createEntries($entries, Feed $feed) foreach ($data as $key => $value) { $key = static::convertKey($key); $method = 'set' . $key; - if (!method_exists($entry, $method)) { + if (! method_exists($entry, $method)) { continue; } $entry->$method($value); diff --git a/vendor/zendframework/zend-feed/src/Writer/Renderer/AbstractRenderer.php b/vendor/zendframework/zend-feed/src/Writer/Renderer/AbstractRenderer.php index a609ca785404f65e6d1827e97157ad82e392dbc2..1e5e728803fc36e6b0302c8209aa2111f0a257f5 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Renderer/AbstractRenderer.php +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/AbstractRenderer.php @@ -82,7 +82,7 @@ public function __construct($container) */ public function saveXml() { - return $this->getDomDocument()->saveXml(); + return $this->getDomDocument()->saveXML(); } /** @@ -146,8 +146,10 @@ public function getEncoding() */ public function ignoreExceptions($bool = true) { - if (!is_bool($bool)) { - throw new Writer\Exception\InvalidArgumentException('Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)'); + if (! is_bool($bool)) { + throw new Writer\Exception\InvalidArgumentException( + 'Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)' + ); } $this->ignoreExceptions = $bool; return $this; @@ -213,16 +215,16 @@ public function getRootElement() * * @return void */ + // @codingStandardsIgnoreStart protected function _loadExtensions() { + // @codingStandardsIgnoreEnd Writer\Writer::registerCoreExtensions(); $manager = Writer\Writer::getExtensionManager(); $all = Writer\Writer::getExtensions(); - if (stripos(get_class($this), 'entry')) { - $exts = $all['entryRenderer']; - } else { - $exts = $all['feedRenderer']; - } + $exts = stripos(get_class($this), 'entry') + ? $all['entryRenderer'] + : $all['feedRenderer']; foreach ($exts as $extension) { $plugin = $manager->get($extension); $plugin->setDataContainer($this->getDataContainer()); diff --git a/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom.php b/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom.php index dced034caf425f863429468a734703134d55c71b..9425f72b27bf5081d89b474a4a4bc1c0278606e4 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom.php +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom.php @@ -56,7 +56,7 @@ public function render() foreach ($this->extensions as $ext) { $ext->setType($this->getType()); $ext->setRootElement($this->getRootElement()); - $ext->setDOMDocument($this->getDOMDocument(), $entry); + $ext->setDomDocument($this->getDomDocument(), $entry); $ext->render(); } @@ -71,13 +71,15 @@ public function render() * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setTitle(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getTitle()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getTitle()) { $message = 'Atom 1.0 entry elements MUST contain exactly one' . ' atom:title element but a title has not been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -98,9 +100,11 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDescription(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDescription()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDescription()) { return; // unless src content or base64 } $subtitle = $dom->createElement('summary'); @@ -120,13 +124,15 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setDateModified(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateModified()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateModified()) { $message = 'Atom 1.0 entry elements MUST contain exactly one' . ' atom:updated element but a modification date has not been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -149,9 +155,11 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateCreated()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateCreated()) { return; } $el = $dom->createElement('published'); @@ -169,10 +177,12 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setAuthors(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $authors = $this->container->getAuthors(); - if ((!$authors || empty($authors))) { + if ((! $authors || empty($authors))) { /** * This will actually trigger an Exception at the feed level if * a feed level author is not set. @@ -208,10 +218,12 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setEnclosure(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $data = $this->container->getEnclosure(); - if ((!$data || empty($data))) { + if ((! $data || empty($data))) { return; } $enclosure = $this->dom->createElement('link'); @@ -226,9 +238,11 @@ protected function _setEnclosure(DOMDocument $dom, DOMElement $root) $root->appendChild($enclosure); } + // @codingStandardsIgnoreStart protected function _setLink(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getLink()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getLink()) { return; } $link = $dom->createElement('link'); @@ -246,16 +260,18 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setId(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getId() - && !$this->getDataContainer()->getLink()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getId() + && ! $this->getDataContainer()->getLink()) { $message = 'Atom 1.0 entry elements MUST contain exactly one ' . 'atom:id element, or as an alternative, we can use the same ' . 'value as atom:link however neither a suitable link nor an ' . 'id have been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -263,17 +279,17 @@ protected function _setId(DOMDocument $dom, DOMElement $root) } } - if (!$this->getDataContainer()->getId()) { + if (! $this->getDataContainer()->getId()) { $this->getDataContainer()->setId( $this->getDataContainer()->getLink() ); } - if (!Uri::factory($this->getDataContainer()->getId())->isValid() - && !preg_match( + if (! Uri::factory($this->getDataContainer()->getId())->isValid() + && ! preg_match( "#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $this->getDataContainer()->getId() ) - && !$this->_validateTagUri($this->getDataContainer()->getId()) + && ! $this->_validateTagUri($this->getDataContainer()->getId()) ) { throw new Writer\Exception\InvalidArgumentException('Atom 1.0 IDs must be a valid URI/IRI'); } @@ -289,8 +305,10 @@ protected function _setId(DOMDocument $dom, DOMElement $root) * @param string $id * @return bool */ + // @codingStandardsIgnoreStart protected function _validateTagUri($id) { + // @codingStandardsIgnoreEnd if (preg_match( '/^tag:(?P<name>.*),(?P<date>\d{4}-?\d{0,2}-?\d{0,2}):(?P<specific>.*)(.*:)*$/', $id, @@ -325,23 +343,25 @@ protected function _validateTagUri($id) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setContent(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $content = $this->getDataContainer()->getContent(); - if (!$content && !$this->getDataContainer()->getLink()) { + if (! $content && ! $this->getDataContainer()->getLink()) { $message = 'Atom 1.0 entry elements MUST contain exactly one ' . 'atom:content element, or as an alternative, at least one link ' . 'with a rel attribute of "alternate" to indicate an alternate ' . 'method to consume the content.'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; return; } } - if (!$content) { + if (! $content) { return; } $element = $dom->createElement('content'); @@ -355,9 +375,14 @@ protected function _setContent(DOMDocument $dom, DOMElement $root) /** * Load a HTML string and attempt to normalise to XML + * + * @param string $content + * @return \DOMElement */ + // @codingStandardsIgnoreStart protected function _loadXhtml($content) { + // @codingStandardsIgnoreEnd if (class_exists('tidy', false)) { $tidy = new \tidy; $config = [ @@ -391,10 +416,12 @@ protected function _loadXhtml($content) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCategories(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { + if (! $categories) { return; } foreach ($categories as $cat) { @@ -419,10 +446,12 @@ protected function _setCategories(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setSource(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $source = $this->getDataContainer()->getSource(); - if (!$source) { + if (! $source) { return; } $renderer = new Renderer\Feed\AtomSource($source); diff --git a/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom/Deleted.php b/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom/Deleted.php index 8519bd9d9ea1a4afdfc5201eb915290b64e4f386..717718c6aece2b288e330c85d356046680f18dc4 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom/Deleted.php +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom/Deleted.php @@ -55,9 +55,11 @@ public function render() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setComment(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getComment()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getComment()) { return; } $c = $dom->createElement('at:comment'); @@ -74,10 +76,12 @@ protected function _setComment(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setBy(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $data = $this->container->getBy(); - if ((!$data || empty($data))) { + if ((! $data || empty($data))) { return; } $author = $this->dom->createElement('at:by'); diff --git a/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/AtomDeleted.php b/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/AtomDeleted.php index f0db3e9328ebd38a0e0a7b19a2be953335a745fe..f36f30d99b869dfb13b4f8497afdd11e942d964f 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/AtomDeleted.php +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/AtomDeleted.php @@ -32,7 +32,7 @@ public function __construct(Writer\Deleted $container) /** * Render atom entry * - * @return \Zend\Feed\Writer\Renderer\Entry\Atom + * @return \Zend\Feed\Writer\Renderer\Entry\AtomDeleted */ public function render() { @@ -57,9 +57,11 @@ public function render() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setComment(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getComment()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getComment()) { return; } $c = $dom->createElement('at:comment'); @@ -76,10 +78,12 @@ protected function _setComment(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setBy(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $data = $this->container->getBy(); - if ((!$data || empty($data))) { + if ((! $data || empty($data))) { return; } $author = $this->dom->createElement('at:by'); diff --git a/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Rss.php b/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Rss.php index 3edb4fd3b807128c367978e678888041a9e6261b..f1e218170806b2660e2c4cde7d5a22688b9c7929 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Rss.php +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Rss.php @@ -56,7 +56,7 @@ public function render() foreach ($this->extensions as $ext) { $ext->setType($this->getType()); $ext->setRootElement($this->getRootElement()); - $ext->setDOMDocument($this->getDOMDocument(), $entry); + $ext->setDomDocument($this->getDomDocument(), $entry); $ext->render(); } @@ -71,15 +71,17 @@ public function render() * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setTitle(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDescription() - && !$this->getDataContainer()->getTitle()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDescription() + && ! $this->getDataContainer()->getTitle()) { $message = 'RSS 2.0 entry elements SHOULD contain exactly one' . ' title element but a title has not been set. In addition, there' . ' is no description as required in the absence of a title.'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -100,23 +102,25 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setDescription(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDescription() - && !$this->getDataContainer()->getTitle()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDescription() + && ! $this->getDataContainer()->getTitle()) { $message = 'RSS 2.0 entry elements SHOULD contain exactly one' . ' description element but a description has not been set. In' . ' addition, there is no title element as required in the absence' . ' of a description.'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; return; } } - if (!$this->getDataContainer()->getDescription()) { + if (! $this->getDataContainer()->getDescription()) { return; } $subtitle = $dom->createElement('description'); @@ -132,9 +136,11 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDateModified(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateModified()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateModified()) { return; } @@ -153,12 +159,14 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateCreated()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateCreated()) { return; } - if (!$this->getDataContainer()->getDateModified()) { + if (! $this->getDataContainer()->getDateModified()) { $this->getDataContainer()->setDateModified( $this->getDataContainer()->getDateCreated() ); @@ -172,10 +180,12 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setAuthors(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $authors = $this->container->getAuthors(); - if ((!$authors || empty($authors))) { + if ((! $authors || empty($authors))) { return; } foreach ($authors as $data) { @@ -198,34 +208,36 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setEnclosure(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $data = $this->container->getEnclosure(); - if ((!$data || empty($data))) { + if ((! $data || empty($data))) { return; } - if (!isset($data['type'])) { + if (! isset($data['type'])) { $exception = new Writer\Exception\InvalidArgumentException('Enclosure "type" is not set'); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; return; } } - if (!isset($data['length'])) { + if (! isset($data['length'])) { $exception = new Writer\Exception\InvalidArgumentException('Enclosure "length" is not set'); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; return; } } - if ((int) $data['length'] < 0 || !ctype_digit((string) $data['length'])) { + if ((int) $data['length'] < 0 || ! ctype_digit((string) $data['length'])) { $exception = new Writer\Exception\InvalidArgumentException('Enclosure "length" must be an integer' . ' indicating the content\'s length in bytes'); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -246,9 +258,11 @@ protected function _setEnclosure(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setLink(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getLink()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getLink()) { return; } $link = $dom->createElement('link'); @@ -264,22 +278,28 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setId(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getId() - && !$this->getDataContainer()->getLink()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getId() + && ! $this->getDataContainer()->getLink()) { return; } $id = $dom->createElement('guid'); $root->appendChild($id); - if (!$this->getDataContainer()->getId()) { + if (! $this->getDataContainer()->getId()) { $this->getDataContainer()->setId( - $this->getDataContainer()->getLink()); + $this->getDataContainer()->getLink() + ); } $text = $dom->createTextNode($this->getDataContainer()->getId()); $id->appendChild($text); - if (!Uri::factory($this->getDataContainer()->getId())->isValid()) { + + $uri = Uri::factory($this->getDataContainer()->getId()); + if (! $uri->isValid() || ! $uri->isAbsolute()) { + /** @see http://www.rssboard.org/rss-profile#element-channel-item-guid */ $id->setAttribute('isPermaLink', 'false'); } } @@ -291,10 +311,12 @@ protected function _setId(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCommentLink(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $link = $this->getDataContainer()->getCommentLink(); - if (!$link) { + if (! $link) { return; } $clink = $this->dom->createElement('comments'); @@ -310,10 +332,12 @@ protected function _setCommentLink(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCategories(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { + if (! $categories) { return; } foreach ($categories as $cat) { diff --git a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AbstractAtom.php b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AbstractAtom.php index a5400a6050290a25597bae601cd85af6e821c517..349d65cd652d6f039c5000cb836471dfacd1437e 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AbstractAtom.php +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AbstractAtom.php @@ -37,8 +37,10 @@ public function __construct($container) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setLanguage(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd if ($this->getDataContainer()->getLanguage()) { $root->setAttribute('xml:lang', $this->getDataContainer() ->getLanguage()); @@ -53,13 +55,15 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setTitle(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getTitle()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getTitle()) { $message = 'Atom 1.0 feed elements MUST contain exactly one' . ' atom:title element but a title has not been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -81,9 +85,11 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDescription(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDescription()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDescription()) { return; } $subtitle = $dom->createElement('subtitle'); @@ -101,13 +107,15 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setDateModified(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateModified()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateModified()) { $message = 'Atom 1.0 feed elements MUST contain exactly one' . ' atom:updated element but a modification date has not been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -130,11 +138,16 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setGenerator(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getGenerator()) { - $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - Version::VERSION, 'http://framework.zend.com'); + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getGenerator()) { + $this->getDataContainer()->setGenerator( + 'Zend_Feed_Writer', + Version::VERSION, + 'http://framework.zend.com' + ); } $gdata = $this->getDataContainer()->getGenerator(); @@ -157,9 +170,11 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setLink(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getLink()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getLink()) { return; } $link = $dom->createElement('link'); @@ -177,16 +192,18 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $flinks = $this->getDataContainer()->getFeedLinks(); - if (!$flinks || !array_key_exists('atom', $flinks)) { + if (! $flinks || ! array_key_exists('atom', $flinks)) { $message = 'Atom 1.0 feed elements SHOULD contain one atom:link ' . 'element with a rel attribute value of "self". This is the ' . 'preferred URI for retrieving Atom Feed Documents representing ' . 'this Atom feed but a feed link has not been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -211,10 +228,12 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setAuthors(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $authors = $this->container->getAuthors(); - if (!$authors || empty($authors)) { + if (! $authors || empty($authors)) { /** * Technically we should defer an exception until we can check * that all entries contain an author. If any entry is missing @@ -252,16 +271,18 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setId(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getId() - && !$this->getDataContainer()->getLink()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getId() + && ! $this->getDataContainer()->getLink()) { $message = 'Atom 1.0 feed elements MUST contain exactly one ' . 'atom:id element, or as an alternative, we can use the same ' . 'value as atom:link however neither a suitable link nor an ' . 'id have been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -269,9 +290,10 @@ protected function _setId(DOMDocument $dom, DOMElement $root) } } - if (!$this->getDataContainer()->getId()) { + if (! $this->getDataContainer()->getId()) { $this->getDataContainer()->setId( - $this->getDataContainer()->getLink()); + $this->getDataContainer()->getLink() + ); } $id = $dom->createElement('id'); $root->appendChild($id); @@ -286,10 +308,12 @@ protected function _setId(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCopyright(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $copyright = $this->getDataContainer()->getCopyright(); - if (!$copyright) { + if (! $copyright) { return; } $copy = $dom->createElement('rights'); @@ -305,10 +329,12 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setImage(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $image = $this->getDataContainer()->getImage(); - if (!$image) { + if (! $image) { return; } $img = $dom->createElement('logo'); @@ -324,12 +350,14 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateCreated()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateCreated()) { return; } - if (!$this->getDataContainer()->getDateModified()) { + if (! $this->getDataContainer()->getDateModified()) { $this->getDataContainer()->setDateModified( $this->getDataContainer()->getDateCreated() ); @@ -343,10 +371,12 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $baseUrl = $this->getDataContainer()->getBaseUrl(); - if (!$baseUrl) { + if (! $baseUrl) { return; } $root->setAttribute('xml:base', $baseUrl); @@ -359,10 +389,12 @@ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setHubs(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $hubs = $this->getDataContainer()->getHubs(); - if (!$hubs) { + if (! $hubs) { return; } foreach ($hubs as $hubUrl) { @@ -380,10 +412,12 @@ protected function _setHubs(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCategories(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { + if (! $categories) { return; } foreach ($categories as $cat) { diff --git a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom.php b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom.php index 939babc0b6e4af7811bd1f68977d014a94f12d00..1739f780f25ef6f601f0d4189ffde89a67c5b31b 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom.php +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom.php @@ -34,7 +34,7 @@ public function __construct(Writer\Feed $container) */ public function render() { - if (!$this->container->getEncoding()) { + if (! $this->container->getEncoding()) { $this->container->setEncoding('UTF-8'); } $this->dom = new DOMDocument('1.0', $this->container->getEncoding()); @@ -64,7 +64,7 @@ public function render() foreach ($this->extensions as $ext) { $ext->setType($this->getType()); $ext->setRootElement($this->getRootElement()); - $ext->setDOMDocument($this->getDOMDocument(), $root); + $ext->setDomDocument($this->getDomDocument(), $root); $ext->render(); } @@ -75,7 +75,7 @@ public function render() if ($entry instanceof Writer\Entry) { $renderer = new Renderer\Entry\Atom($entry); } else { - if (!$this->dom->documentElement->hasAttribute('xmlns:at')) { + if (! $this->dom->documentElement->hasAttribute('xmlns:at')) { $this->dom->documentElement->setAttribute( 'xmlns:at', 'http://purl.org/atompub/tombstones/1.0' diff --git a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom/AbstractAtom.php b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom/AbstractAtom.php index 20fc8df81e79144cabcf9d52a76d4ee4f59a5cc7..2330057313fd5c9919371dbb2f7524c353aaa124 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom/AbstractAtom.php +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom/AbstractAtom.php @@ -34,8 +34,10 @@ public function __construct($container) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setLanguage(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd if ($this->getDataContainer()->getLanguage()) { $root->setAttribute('xml:lang', $this->getDataContainer() ->getLanguage()); @@ -50,13 +52,15 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root) * @return void * @throws Feed\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setTitle(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getTitle()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getTitle()) { $message = 'Atom 1.0 feed elements MUST contain exactly one' . ' atom:title element but a title has not been set'; $exception = new Feed\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -78,9 +82,11 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDescription(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDescription()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDescription()) { return; } $subtitle = $dom->createElement('subtitle'); @@ -98,13 +104,15 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) * @return void * @throws Feed\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setDateModified(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateModified()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateModified()) { $message = 'Atom 1.0 feed elements MUST contain exactly one' . ' atom:updated element but a modification date has not been set'; $exception = new Feed\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -127,11 +135,16 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setGenerator(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getGenerator()) { - $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - Version::VERSION, 'http://framework.zend.com'); + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getGenerator()) { + $this->getDataContainer()->setGenerator( + 'Zend_Feed_Writer', + Version::VERSION, + 'http://framework.zend.com' + ); } $gdata = $this->getDataContainer()->getGenerator(); @@ -154,9 +167,11 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setLink(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getLink()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getLink()) { return; } $link = $dom->createElement('link'); @@ -174,16 +189,18 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) * @return void * @throws Feed\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $flinks = $this->getDataContainer()->getFeedLinks(); - if (!$flinks || !array_key_exists('atom', $flinks)) { + if (! $flinks || ! array_key_exists('atom', $flinks)) { $message = 'Atom 1.0 feed elements SHOULD contain one atom:link ' . 'element with a rel attribute value of "self". This is the ' . 'preferred URI for retrieving Atom Feed Documents representing ' . 'this Atom feed but a feed link has not been set'; $exception = new Feed\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -208,10 +225,12 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setAuthors(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $authors = $this->container->getAuthors(); - if (!$authors || empty($authors)) { + if (! $authors || empty($authors)) { /** * Technically we should defer an exception until we can check * that all entries contain an author. If any entry is missing @@ -249,16 +268,18 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @return void * @throws Feed\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setId(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getId() - && !$this->getDataContainer()->getLink()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getId() + && ! $this->getDataContainer()->getLink()) { $message = 'Atom 1.0 feed elements MUST contain exactly one ' . 'atom:id element, or as an alternative, we can use the same ' . 'value as atom:link however neither a suitable link nor an ' . 'id have been set'; $exception = new Feed\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -266,9 +287,10 @@ protected function _setId(DOMDocument $dom, DOMElement $root) } } - if (!$this->getDataContainer()->getId()) { + if (! $this->getDataContainer()->getId()) { $this->getDataContainer()->setId( - $this->getDataContainer()->getLink()); + $this->getDataContainer()->getLink() + ); } $id = $dom->createElement('id'); $root->appendChild($id); @@ -283,10 +305,12 @@ protected function _setId(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCopyright(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $copyright = $this->getDataContainer()->getCopyright(); - if (!$copyright) { + if (! $copyright) { return; } $copy = $dom->createElement('rights'); @@ -294,6 +318,7 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) $text = $dom->createTextNode($copyright); $copy->appendChild($text); } + /** * Set feed level logo (image) * @@ -301,10 +326,12 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setImage(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $image = $this->getDataContainer()->getImage(); - if (!$image) { + if (! $image) { return; } $img = $dom->createElement('logo'); @@ -320,12 +347,14 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateCreated()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateCreated()) { return; } - if (!$this->getDataContainer()->getDateModified()) { + if (! $this->getDataContainer()->getDateModified()) { $this->getDataContainer()->setDateModified( $this->getDataContainer()->getDateCreated() ); @@ -339,10 +368,12 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $baseUrl = $this->getDataContainer()->getBaseUrl(); - if (!$baseUrl) { + if (! $baseUrl) { return; } $root->setAttribute('xml:base', $baseUrl); @@ -355,10 +386,12 @@ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setHubs(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $hubs = $this->getDataContainer()->getHubs(); - if (!$hubs) { + if (! $hubs) { return; } foreach ($hubs as $hubUrl) { @@ -376,10 +409,12 @@ protected function _setHubs(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCategories(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { + if (! $categories) { return; } foreach ($categories as $cat) { diff --git a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom/Source.php b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom/Source.php index 3793db0cbca2771f591933f59323fcfa3351f63d..ac48fb859cd1f86d67668a78eb7b1e4ad619a18a 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom/Source.php +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom/Source.php @@ -29,11 +29,11 @@ public function __construct(Writer\Source $container) /** * Render Atom Feed Metadata (Source element) * - * @return Writer\Renderer\Feed\Atom + * @return AbstractAtom */ public function render() { - if (!$this->container->getEncoding()) { + if (! $this->container->getEncoding()) { $this->container->setEncoding('UTF-8'); } $this->dom = new DOMDocument('1.0', $this->container->getEncoding()); @@ -71,9 +71,11 @@ public function render() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setGenerator(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getGenerator()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getGenerator()) { return; } diff --git a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AtomSource.php b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AtomSource.php index d552b8089229ae9b6fe3704046fe036765295a85..0c00fa15b30b6534a49c8c772abd4f5810f8343b 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AtomSource.php +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AtomSource.php @@ -31,11 +31,11 @@ public function __construct(Writer\Source $container) /** * Render Atom Feed Metadata (Source element) * - * @return \Zend\Feed\Writer\Renderer\Feed\Atom + * @return \Zend\Feed\Writer\Renderer\Feed\AbstractAtom */ public function render() { - if (!$this->container->getEncoding()) { + if (! $this->container->getEncoding()) { $this->container->setEncoding('UTF-8'); } $this->dom = new DOMDocument('1.0', $this->container->getEncoding()); @@ -60,7 +60,7 @@ public function render() foreach ($this->extensions as $ext) { $ext->setType($this->getType()); $ext->setRootElement($this->getRootElement()); - $ext->setDOMDocument($this->getDOMDocument(), $root); + $ext->setDomDocument($this->getDomDocument(), $root); $ext->render(); } return $this; @@ -73,9 +73,11 @@ public function render() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setGenerator(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getGenerator()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getGenerator()) { return; } diff --git a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Rss.php b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Rss.php index be902b8a901770f68e2816e424c44159477de500..0f340b5294e3bd20f6d303497d8841cae5e0e3df 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Rss.php +++ b/vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Rss.php @@ -65,7 +65,7 @@ public function render() foreach ($this->extensions as $ext) { $ext->setType($this->getType()); $ext->setRootElement($this->getRootElement()); - $ext->setDOMDocument($this->getDOMDocument(), $channel); + $ext->setDomDocument($this->getDomDocument(), $channel); $ext->render(); } @@ -99,10 +99,12 @@ public function render() * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setLanguage(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $lang = $this->getDataContainer()->getLanguage(); - if (!$lang) { + if (! $lang) { return; } $language = $dom->createElement('language'); @@ -118,13 +120,15 @@ protected function _setLanguage(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setTitle(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getTitle()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getTitle()) { $message = 'RSS 2.0 feed elements MUST contain exactly one' . ' title element but a title has not been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -146,13 +150,15 @@ protected function _setTitle(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setDescription(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDescription()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDescription()) { $message = 'RSS 2.0 feed elements MUST contain exactly one' . ' description element but one has not been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -172,9 +178,11 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDateModified(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateModified()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateModified()) { return; } @@ -193,9 +201,11 @@ protected function _setDateModified(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setGenerator(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getGenerator()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getGenerator()) { $this->getDataContainer()->setGenerator( 'Zend_Feed_Writer', Version::VERSION, @@ -225,14 +235,16 @@ protected function _setGenerator(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setLink(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $value = $this->getDataContainer()->getLink(); - if (!$value) { + if (! $value) { $message = 'RSS 2.0 feed elements MUST contain exactly one' . ' link element but one has not been set'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -243,7 +255,7 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) $root->appendChild($link); $text = $dom->createTextNode($value); $link->appendChild($text); - if (!Uri::factory($value)->isValid()) { + if (! Uri::factory($value)->isValid()) { $link->setAttribute('isPermaLink', 'false'); } } @@ -255,10 +267,12 @@ protected function _setLink(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setAuthors(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $authors = $this->getDataContainer()->getAuthors(); - if (!$authors || empty($authors)) { + if (! $authors || empty($authors)) { return; } foreach ($authors as $data) { @@ -280,10 +294,12 @@ protected function _setAuthors(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCopyright(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $copyright = $this->getDataContainer()->getCopyright(); - if (!$copyright) { + if (! $copyright) { return; } $copy = $dom->createElement('copyright'); @@ -300,19 +316,21 @@ protected function _setCopyright(DOMDocument $dom, DOMElement $root) * @return void * @throws Writer\Exception\InvalidArgumentException */ + // @codingStandardsIgnoreStart protected function _setImage(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $image = $this->getDataContainer()->getImage(); - if (!$image) { + if (! $image) { return; } - if (!isset($image['title']) || empty($image['title']) - || !is_string($image['title']) + if (! isset($image['title']) || empty($image['title']) + || ! is_string($image['title']) ) { $message = 'RSS 2.0 feed images must include a title'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -320,13 +338,13 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) } } - if (empty($image['link']) || !is_string($image['link']) - || !Uri::factory($image['link'])->isValid() + if (empty($image['link']) || ! is_string($image['link']) + || ! Uri::factory($image['link'])->isValid() ) { $message = 'Invalid parameter: parameter \'link\'' . ' must be a non-empty string and valid URI/IRI'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -354,11 +372,11 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) $img->appendChild($link); if (isset($image['height'])) { - if (!ctype_digit((string) $image['height']) || $image['height'] > 400) { + if (! ctype_digit((string) $image['height']) || $image['height'] > 400) { $message = 'Invalid parameter: parameter \'height\'' . ' must be an integer not exceeding 400'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -371,11 +389,11 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) $img->appendChild($height); } if (isset($image['width'])) { - if (!ctype_digit((string) $image['width']) || $image['width'] > 144) { + if (! ctype_digit((string) $image['width']) || $image['width'] > 144) { $message = 'Invalid parameter: parameter \'width\'' . ' must be an integer not exceeding 144'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -388,11 +406,11 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) $img->appendChild($width); } if (isset($image['description'])) { - if (empty($image['description']) || !is_string($image['description'])) { + if (empty($image['description']) || ! is_string($image['description'])) { $message = 'Invalid parameter: parameter \'description\'' . ' must be a non-empty string'; $exception = new Writer\Exception\InvalidArgumentException($message); - if (!$this->ignoreExceptions) { + if (! $this->ignoreExceptions) { throw $exception; } else { $this->exceptions[] = $exception; @@ -413,12 +431,14 @@ protected function _setImage(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setDateCreated(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getDateCreated()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getDateCreated()) { return; } - if (!$this->getDataContainer()->getDateModified()) { + if (! $this->getDataContainer()->getDateModified()) { $this->getDataContainer()->setDateModified( $this->getDataContainer()->getDateCreated() ); @@ -432,9 +452,11 @@ protected function _setDateCreated(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setLastBuildDate(DOMDocument $dom, DOMElement $root) { - if (!$this->getDataContainer()->getLastBuildDate()) { + // @codingStandardsIgnoreEnd + if (! $this->getDataContainer()->getLastBuildDate()) { return; } @@ -453,10 +475,12 @@ protected function _setLastBuildDate(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $baseUrl = $this->getDataContainer()->getBaseUrl(); - if (!$baseUrl) { + if (! $baseUrl) { return; } $root->setAttribute('xml:base', $baseUrl); @@ -469,10 +493,12 @@ protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) * @param DOMElement $root * @return void */ + // @codingStandardsIgnoreStart protected function _setCategories(DOMDocument $dom, DOMElement $root) { + // @codingStandardsIgnoreEnd $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { + if (! $categories) { return; } foreach ($categories as $cat) { diff --git a/vendor/zendframework/zend-feed/src/Writer/StandaloneExtensionManager.php b/vendor/zendframework/zend-feed/src/Writer/StandaloneExtensionManager.php index c9a88c76aba3cdf3059489e7e6790a14df27f371..1e6ae7d1b72a830014735f2934ab3776e4e06fd2 100644 --- a/vendor/zendframework/zend-feed/src/Writer/StandaloneExtensionManager.php +++ b/vendor/zendframework/zend-feed/src/Writer/StandaloneExtensionManager.php @@ -9,6 +9,8 @@ namespace Zend\Feed\Writer; +use Zend\Feed\Writer\Exception\InvalidArgumentException; + class StandaloneExtensionManager implements ExtensionManagerInterface { private $extensions = [ @@ -16,6 +18,10 @@ class StandaloneExtensionManager implements ExtensionManagerInterface 'Content\Renderer\Entry' => Extension\Content\Renderer\Entry::class, 'DublinCore\Renderer\Entry' => Extension\DublinCore\Renderer\Entry::class, 'DublinCore\Renderer\Feed' => Extension\DublinCore\Renderer\Feed::class, + 'GooglePlayPodcast\Entry' => Extension\GooglePlayPodcast\Entry::class, + 'GooglePlayPodcast\Feed' => Extension\GooglePlayPodcast\Feed::class, + 'GooglePlayPodcast\Renderer\Entry' => Extension\GooglePlayPodcast\Renderer\Entry::class, + 'GooglePlayPodcast\Renderer\Feed' => Extension\GooglePlayPodcast\Renderer\Feed::class, 'ITunes\Entry' => Extension\ITunes\Entry::class, 'ITunes\Feed' => Extension\ITunes\Feed::class, 'ITunes\Renderer\Entry' => Extension\ITunes\Renderer\Entry::class, @@ -47,4 +53,42 @@ public function get($extension) $class = $this->extensions[$extension]; return new $class(); } + + /** + * Add an extension. + * + * @param string $name + * @param string $class + */ + public function add($name, $class) + { + if (is_string($class) + && (( + is_a($class, Extension\AbstractRenderer::class, true) + || 'Feed' === substr($class, -4) + || 'Entry' === substr($class, -5) + )) + ) { + $this->extensions[$name] = $class; + + return; + } + + throw new InvalidArgumentException(sprintf( + 'Plugin of type %s is invalid; must implement %s\Extension\RendererInterface ' + . 'or the classname must end in "Feed" or "Entry"', + $class, + __NAMESPACE__ + )); + } + + /** + * Remove an extension. + * + * @param string $name + */ + public function remove($name) + { + unset($this->extensions[$name]); + } } diff --git a/vendor/zendframework/zend-feed/src/Writer/Writer.php b/vendor/zendframework/zend-feed/src/Writer/Writer.php index 4c1e257fbc8e8e0ddaec5b667c40eab3c0e5ff77..4f5c1697a9017c31944cf96b95d74779d719cbeb 100644 --- a/vendor/zendframework/zend-feed/src/Writer/Writer.php +++ b/vendor/zendframework/zend-feed/src/Writer/Writer.php @@ -76,7 +76,7 @@ public static function setExtensionManager(ExtensionManagerInterface $extensionM */ public static function getExtensionManager() { - if (!isset(static::$extensionManager)) { + if (! isset(static::$extensionManager)) { static::setExtensionManager(new ExtensionManager()); } return static::$extensionManager; @@ -91,40 +91,36 @@ public static function getExtensionManager() */ public static function registerExtension($name) { - $feedName = $name . '\Feed'; - $entryName = $name . '\Entry'; - $feedRendererName = $name . '\Renderer\Feed'; - $entryRendererName = $name . '\Renderer\Entry'; - $manager = static::getExtensionManager(); - if (static::isRegistered($name)) { - if ($manager->has($feedName) - || $manager->has($entryName) - || $manager->has($feedRendererName) - || $manager->has($entryRendererName) - ) { - return; - } - } - if (! $manager->has($feedName) - && ! $manager->has($entryName) - && ! $manager->has($feedRendererName) - && ! $manager->has($entryRendererName) - ) { + if (! static::hasExtension($name)) { throw new Exception\RuntimeException(sprintf( - 'Could not load extension "%s" using Plugin Loader. ' - . 'Check prefix paths are configured and extension exists.', + 'Could not load extension "%s" using Plugin Loader.' + . ' Check prefix paths are configured and extension exists.', $name )); } + + if (static::isRegistered($name)) { + return; + } + + $manager = static::getExtensionManager(); + + $feedName = $name . '\Feed'; if ($manager->has($feedName)) { static::$extensions['feed'][] = $feedName; } + + $entryName = $name . '\Entry'; if ($manager->has($entryName)) { static::$extensions['entry'][] = $entryName; } + + $feedRendererName = $name . '\Renderer\Feed'; if ($manager->has($feedRendererName)) { static::$extensions['feedRenderer'][] = $feedRendererName; } + + $entryRendererName = $name . '\Renderer\Entry'; if ($manager->has($entryRendererName)) { static::$extensions['entryRenderer'][] = $entryRendererName; } @@ -192,11 +188,61 @@ public static function registerCoreExtensions() static::registerExtension('WellFormedWeb'); static::registerExtension('Threading'); static::registerExtension('ITunes'); + + // Added in 2.10.0; check for it conditionally + static::hasExtension('GooglePlayPodcast') + ? static::registerExtension('GooglePlayPodcast') + : trigger_error( + sprintf( + 'Please update your %1$s\ExtensionManagerInterface implementation to add entries for' + . ' %1$s\Extension\GooglePlayPodcast\Entry,' + . ' %1$s\Extension\GooglePlayPodcast\Feed,' + . ' %1$s\Extension\GooglePlayPodcast\Renderer\Entry,' + . ' and %1$s\Extension\GooglePlayPodcast\Renderer\Feed.', + __NAMESPACE__ + ), + \E_USER_NOTICE + ); } + /** + * @deprecated This method is deprecated and will be removed with version 3.0 + * Use PHP's lcfirst function instead. @see https://php.net/manual/function.lcfirst.php + * @param string $str + * @return string + */ public static function lcfirst($str) { - $str[0] = strtolower($str[0]); - return $str; + return lcfirst($str); + } + + /** + * Does the extension manager have the named extension? + * + * This method exists to allow us to test if an extension is present in the + * extension manager. It may be used by registerExtension() to determine if + * the extension has items present in the manager, or by + * registerCoreExtension() to determine if the core extension has entries + * in the extension manager. In the latter case, this can be useful when + * adding new extensions in a minor release, as custom extension manager + * implementations may not yet have an entry for the extension, which would + * then otherwise cause registerExtension() to fail. + * + * @param string $name + * @return bool + */ + protected static function hasExtension($name) + { + $manager = static::getExtensionManager(); + + $feedName = $name . '\Feed'; + $entryName = $name . '\Entry'; + $feedRendererName = $name . '\Renderer\Feed'; + $entryRendererName = $name . '\Renderer\Entry'; + + return $manager->has($feedName) + || $manager->has($entryName) + || $manager->has($feedRendererName) + || $manager->has($entryRendererName); } } diff --git a/vendor/zendframework/zend-stdlib/CHANGELOG.md b/vendor/zendframework/zend-stdlib/CHANGELOG.md index 65177990d5f05160be232373d76bbd2c7fcdb7ea..26c5e792a688ac08de65c57ab3131f4879954b90 100644 --- a/vendor/zendframework/zend-stdlib/CHANGELOG.md +++ b/vendor/zendframework/zend-stdlib/CHANGELOG.md @@ -2,6 +2,105 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. +## 3.2.1 - 2018-08-28 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#92](https://github.com/zendframework/zend-stdlib/pull/92) fixes serialization of `SplPriorityQueue` by ensuring its `$serial` + property is also serialized. + +- [#91](https://github.com/zendframework/zend-stdlib/pull/91) fixes behavior in the `ArrayObject` implementation that was not + compatible with PHP 7.3. + +## 3.2.0 - 2018-04-30 + +### Added + +- [#87](https://github.com/zendframework/zend-stdlib/pull/87) adds support for PHP 7.2. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- [#87](https://github.com/zendframework/zend-stdlib/pull/87) removes support for HHVM. + +### Fixed + +- Nothing. + +## 3.1.1 - 2018-04-12 + +### Added + +- Nothing. + +### Changed + +- [#67](https://github.com/zendframework/zend-stdlib/pull/67) changes the typehint of the `$content` property + of the `Message` class to indicate it is a string. All known implementations + already assumed this. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#60](https://github.com/zendframework/zend-stdlib/pull/60) fixes an issue whereby calling `remove()` would + incorrectly re-calculate the maximum priority stored in the queue. + +- [#60](https://github.com/zendframework/zend-stdlib/pull/60) fixes an infinite loop condition that can occur when + inserting an item at 0 priority. + +## 3.1.0 - 2016-09-13 + +### Added + +- [#63](https://github.com/zendframework/zend-stdlib/pull/63) adds a new + `Zend\Stdlib\ConsoleHelper` class, providing minimal support for writing + output to `STDOUT` and `STDERR`, with optional colorization, when the console + supports that feature. + +### Deprecated + +- [#38](https://github.com/zendframework/zend-stdlib/pull/38) deprecates + `Zend\Stdlib\JsonSerializable`, as all supported version of PHP now support + it. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + ## 3.0.1 - 2016-04-12 ### Added diff --git a/vendor/zendframework/zend-stdlib/CONDUCT.md b/vendor/zendframework/zend-stdlib/CONDUCT.md deleted file mode 100644 index c663d2be9302139a32da7386de101ecae97b185b..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-stdlib/CONDUCT.md +++ /dev/null @@ -1,43 +0,0 @@ -# Contributor Code of Conduct - -The Zend Framework project adheres to [The Code Manifesto](http://codemanifesto.com) -as its guidelines for contributor interactions. - -## The Code Manifesto - -We want to work in an ecosystem that empowers developers to reach their -potential — one that encourages growth and effective collaboration. A space that -is safe for all. - -A space such as this benefits everyone that participates in it. It encourages -new developers to enter our field. It is through discussion and collaboration -that we grow, and through growth that we improve. - -In the effort to create such a place, we hold to these values: - -1. **Discrimination limits us.** This includes discrimination on the basis of - race, gender, sexual orientation, gender identity, age, nationality, technology - and any other arbitrary exclusion of a group of people. -2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort - levels. Remember that, and if brought to your attention, heed it. -3. **We are our biggest assets.** None of us were born masters of our trade. - Each of us has been helped along the way. Return that favor, when and where - you can. -4. **We are resources for the future.** As an extension of #3, share what you - know. Make yourself a resource to help those that come after you. -5. **Respect defines us.** Treat others as you wish to be treated. Make your - discussions, criticisms and debates from a position of respectfulness. Ask - yourself, is it true? Is it necessary? Is it constructive? Anything less is - unacceptable. -6. **Reactions require grace.** Angry responses are valid, but abusive language - and vindictive actions are toxic. When something happens that offends you, - handle it assertively, but be respectful. Escalate reasonably, and try to - allow the offender an opportunity to explain themselves, and possibly correct - the issue. -7. **Opinions are just that: opinions.** Each and every one of us, due to our - background and upbringing, have varying opinions. The fact of the matter, is - that is perfectly acceptable. Remember this: if you respect your own - opinions, you should respect the opinions of others. -8. **To err is human.** You might not intend it, but mistakes do happen and - contribute to build experience. Tolerate honest mistakes, and don't hesitate - to apologize if you make one yourself. diff --git a/vendor/zendframework/zend-stdlib/CONTRIBUTING.md b/vendor/zendframework/zend-stdlib/CONTRIBUTING.md deleted file mode 100644 index 39327161b4d37c0ad1d32b033178f4c957975a9c..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-stdlib/CONTRIBUTING.md +++ /dev/null @@ -1,244 +0,0 @@ -# CONTRIBUTING - -## RESOURCES - -If you wish to contribute to Zend Framework, please be sure to -read/subscribe to the following resources: - - - [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards) - - [Contributor's Guide](http://framework.zend.com/participate/contributor-guide) - - ZF Contributor's mailing list: - Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html - Subscribe: zf-contributors-subscribe@lists.zend.com - - ZF Contributor's IRC channel: - #zftalk.dev on Freenode.net - -If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-stdlib/issues/new). - -## Reporting Potential Security Issues - -If you have encountered a potential security vulnerability, please **DO NOT** report it on the public -issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead. -We will work with you to verify the vulnerability and patch it as soon as possible. - -When reporting issues, please provide the following information: - -- Component(s) affected -- A description indicating how to reproduce the issue -- A summary of the security vulnerability and impact - -We request that you contact us via the email address above and give the project -contributors a chance to resolve the vulnerability and issue a new release prior -to any public exposure; this helps protect users and provides them with a chance -to upgrade and/or update in order to protect their applications. - -For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc). - -## RUNNING TESTS - -> ### Note: testing versions prior to 2.4 -> -> This component originates with Zend Framework 2. During the lifetime of ZF2, -> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no -> changes were necessary. However, due to the migration, tests may not run on -> versions < 2.4. As such, you may need to change the PHPUnit dependency if -> attempting a fix on such a version. - -To run tests: - -- Clone the repository: - - ```console - $ git clone git@github.com:zendframework/zend-stdlib.git - $ cd - ``` - -- Install dependencies via composer: - - ```console - $ curl -sS https://getcomposer.org/installer | php -- - $ ./composer.phar install - ``` - - If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/ - -- Run the tests via `phpunit` and the provided PHPUnit config, like in this example: - - ```console - $ ./vendor/bin/phpunit - ``` - -You can turn on conditional tests with the phpunit.xml file. -To do so: - - - Copy `phpunit.xml.dist` file to `phpunit.xml` - - Edit `phpunit.xml` to enable any specific functionality you - want to test, as well as to provide test values to utilize. - -## Running Coding Standards Checks - -This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding -standards checks, and provides configuration for our selected checks. -`php-cs-fixer` is installed by default via Composer. - -To run checks only: - -```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs -``` - -To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run` -flag: - -```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs -``` - -If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure -they pass, and make sure you add and commit the changes after verification. - -## Benchmarks - -We provide benchmark tests for zend-stdlib under the directory [benchmark/](benchmark/), -using. [athletic](https://github.com/polyfractal/athletic). You can execute -the benchmarks running the following command: - -```bash -$ ./vendor/bin/athletic -p benchmark -``` - -## Recommended Workflow for Contributions - -Your first step is to establish a public repository from which we can -pull your work into the master repository. We recommend using -[GitHub](https://github.com), as that is where the component is already hosted. - -1. Setup a [GitHub account](http://github.com/), if you haven't yet -2. Fork the repository (http://github.com/zendframework/zend-stdlib) -3. Clone the canonical repository locally and enter it. - - ```console - $ git clone git://github.com:zendframework/zend-stdlib.git - $ cd zend-stdlib - ``` - -4. Add a remote to your fork; substitute your GitHub username in the command - below. - - ```console - $ git remote add {username} git@github.com:{username}/zend-stdlib.git - $ git fetch {username} - ``` - -### Keeping Up-to-Date - -Periodically, you should update your fork or personal repository to -match the canonical ZF repository. Assuming you have setup your local repository -per the instructions above, you can do the following: - - -```console -$ git checkout master -$ git fetch origin -$ git rebase origin/master -# OPTIONALLY, to keep your remote up-to-date - -$ git push {username} master:master -``` - -If you're tracking other branches -- for example, the "develop" branch, where -new feature development occurs -- you'll want to do the same operations for that -branch; simply substitute "develop" for "master". - -### Working on a patch - -We recommend you do each new feature or bugfix in a new branch. This simplifies -the task of code review as well as the task of merging your changes into the -canonical repository. - -A typical workflow will then consist of the following: - -1. Create a new local branch based off either your master or develop branch. -2. Switch to your new local branch. (This step can be combined with the - previous step with the use of `git checkout -b`.) -3. Do some work, commit, repeat as necessary. -4. Push the local branch to your remote repository. -5. Send a pull request. - -The mechanics of this process are actually quite trivial. Below, we will -create a branch for fixing an issue in the tracker. - -```console -$ git checkout -b hotfix/9295 -Switched to a new branch 'hotfix/9295' -``` - -... do some work ... - - -```console -$ git commit -``` - -... write your log message ... - - -```console -$ git push {username} hotfix/9295:hotfix/9295 -Counting objects: 38, done. -Delta compression using up to 2 threads. -Compression objects: 100% (18/18), done. -Writing objects: 100% (20/20), 8.19KiB, done. -Total 20 (delta 12), reused 0 (delta 0) -To ssh://git@github.com/{username}/zend-stdlib.git - b5583aa..4f51698 HEAD -> master -``` - -To send a pull request, you have two options. - -If using GitHub, you can do the pull request from there. Navigate to -your repository, select the branch you just created, and then select the -"Pull Request" button in the upper right. Select the user/organization -"zendframework" as the recipient. - -If using your own repository - or even if using GitHub - you can use `git -format-patch` to create a patchset for us to apply; in fact, this is -**recommended** for security-related patches. If you use `format-patch`, please -send the patches as attachments to: - -- zf-devteam@zend.com for patches without security implications -- zf-security@zend.com for security patches - -#### What branch to issue the pull request against? - -Which branch should you issue a pull request against? - -- For fixes against the stable release, issue the pull request against the - "master" branch. -- For new features, or fixes that introduce new elements to the public API (such - as new public methods or properties), issue the pull request against the - "develop" branch. - -### Branch Cleanup - -As you might imagine, if you are a frequent contributor, you'll start to -get a ton of branches both locally and on your remote. - -Once you know that your changes have been accepted to the master -repository, we suggest doing some cleanup of these branches. - -- Local branch cleanup - - ```console - $ git branch -d <branchname> - ``` - -- Remote branch removal - - ```console - $ git push {username} :<branchname> - ``` - - -## Conduct - -Please see our [CONDUCT.md](CONDUCT.md) to understand expected behavior when interacting with others in the project. diff --git a/vendor/zendframework/zend-stdlib/LICENSE.md b/vendor/zendframework/zend-stdlib/LICENSE.md index dbb1b49c01421e18478507a9ef40b8087317c306..d44ab5dc72bf4cbca7c9ddc4c8334a929c2185de 100644 --- a/vendor/zendframework/zend-stdlib/LICENSE.md +++ b/vendor/zendframework/zend-stdlib/LICENSE.md @@ -1,16 +1,15 @@ -Copyright (c) 2005-2015, Zend Technologies USA, Inc. - +Copyright (c) 2005-2018, Zend Technologies USA, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. +- Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. - Neither the name of Zend Technologies USA, Inc. nor the names of its contributors may be used to endorse or promote products derived from this diff --git a/vendor/zendframework/zend-stdlib/README.md b/vendor/zendframework/zend-stdlib/README.md index f4ca9532d7e516274eee8b0a3237c3e4bd555825..8d9ff96cc785c94025af249014c54ea5d7487fbb 100644 --- a/vendor/zendframework/zend-stdlib/README.md +++ b/vendor/zendframework/zend-stdlib/README.md @@ -1,13 +1,12 @@ # zend-stdlib [](https://secure.travis-ci.org/zendframework/zend-stdlib) -[](https://coveralls.io/r/zendframework/zend-stdlib?branch=master) +[](https://coveralls.io/github/zendframework/zend-stdlib?branch=master) `Zend\Stdlib` is a set of components that implements general purpose utility class for different scopes like: - array utilities functions; -- json serializable interfaces; - general messaging systems; - string wrappers; - etc. @@ -15,4 +14,16 @@ class for different scopes like: --- - File issues at https://github.com/zendframework/zend-stdlib/issues -- Documentation is at http://framework.zend.com/manual/current/en/index.html#zend-stdlib +- Documentation is at https://docs.zendframework.com/zend-stdlib/ + +## Benchmarks + +We provide scripts for benchmarking zend-stdlib using the +[PHPBench](https://github.com/phpbench/phpbench) framework; these can be +found in the `benchmark/` directory. + +To execute the benchmarks you can run the following command: + +```bash +$ vendor/bin/phpbench run --report=aggregate +``` diff --git a/vendor/zendframework/zend-stdlib/benchmark/ExtractPriorityQueue.php b/vendor/zendframework/zend-stdlib/benchmark/ExtractPriorityQueue.php deleted file mode 100644 index 8fa7527ab18ee254464530d5b759d61be11e3176..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-stdlib/benchmark/ExtractPriorityQueue.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php -/** - * Zend Framework (http://framework.zend.com/) - * - * @link http://github.com/zendframework/zf2 for the canonical source repository - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ - -namespace ZendBench\Stdlib; - -use Athletic\AthleticEvent; -use Zend\Stdlib\FastPriorityQueue; -use Zend\Stdlib\PriorityQueue; -use Zend\Stdlib\SplPriorityQueue; - -class ExtractPriorityQueue extends AthleticEvent -{ - public function classSetUp() - { - $this->splPriorityQueue = new SplPriorityQueue(); - $this->fastPriorityQueue = new FastPriorityQueue(); - $this->priorityQueue = new PriorityQueue(); - - for ($i = 0; $i < 5000; $i += 1) { - $priority = rand(1, 100); - $this->splPriorityQueue->insert('foo', $priority); - $this->fastPriorityQueue->insert('foo', $priority); - $this->priorityQueue->insert('foo', $priority); - } - } - - /** - * @iterations 5000 - */ - public function extractSplPriorityQueue() - { - $this->splPriorityQueue->extract(); - } - - /** - * @iterations 5000 - */ - public function extractPriorityQueue() - { - $this->priorityQueue->extract(); - } - - /** - * @iterations 5000 - */ - public function extractFastPriorityQueue() - { - $this->fastPriorityQueue->extract(); - } -} diff --git a/vendor/zendframework/zend-stdlib/benchmark/InsertPriorityQueue.php b/vendor/zendframework/zend-stdlib/benchmark/InsertPriorityQueue.php deleted file mode 100644 index 561c53597566b07d829432485298ced58f5f25ee..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-stdlib/benchmark/InsertPriorityQueue.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Zend Framework (http://framework.zend.com/) - * - * @link http://github.com/zendframework/zf2 for the canonical source repository - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ - -namespace ZendBench\Stdlib; - -use Athletic\AthleticEvent; -use Zend\Stdlib\FastPriorityQueue; -use Zend\Stdlib\PriorityQueue; -use Zend\Stdlib\SplPriorityQueue; - -class InsertPriorityQueue extends AthleticEvent -{ - public function classSetUp() - { - $this->splPriorityQueue = new SplPriorityQueue(); - $this->fastPriorityQueue = new FastPriorityQueue(); - $this->priorityQueue = new PriorityQueue(); - } - - /** - * @iterations 5000 - */ - public function insertSplPriorityQueue() - { - $this->splPriorityQueue->insert('foo', rand(1, 100)); - } - - /** - * @iterations 5000 - */ - public function insertPriorityQueue() - { - $this->priorityQueue->insert('foo', rand(1, 100)); - } - - /** - * @iterations 5000 - */ - public function insertFastPriorityQueue() - { - $this->fastPriorityQueue->insert('foo', rand(1, 100)); - } -} diff --git a/vendor/zendframework/zend-stdlib/benchmark/RemovePriorityQueue.php b/vendor/zendframework/zend-stdlib/benchmark/RemovePriorityQueue.php deleted file mode 100644 index 1cfd35b74f94b949e331e681242f86c746309b61..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-stdlib/benchmark/RemovePriorityQueue.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php -/** - * Zend Framework (http://framework.zend.com/) - * - * @link http://github.com/zendframework/zf2 for the canonical source repository - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ - -namespace ZendBench\Stdlib; - -use Athletic\AthleticEvent; -use Zend\Stdlib\FastPriorityQueue; -use Zend\Stdlib\PriorityQueue; - -class RemovePriorityQueue extends AthleticEvent -{ - public function classSetUp() - { - $this->fastPriorityQueue = new FastPriorityQueue(); - $this->priorityQueue = new PriorityQueue(); - - for ($i = 0; $i < 1000; $i += 1) { - $priority = rand(1, 100); - $this->fastPriorityQueue->insert('foo', $priority); - $this->priorityQueue->insert('foo', $priority); - } - } - - /** - * @iterations 1000 - */ - public function removePriorityQueue() - { - $this->priorityQueue->remove('foo'); - } - - /** - * @iterations 1000 - */ - public function removeFastPriorityQueue() - { - $this->fastPriorityQueue->remove('foo'); - } -} diff --git a/vendor/zendframework/zend-stdlib/composer.json b/vendor/zendframework/zend-stdlib/composer.json index 46f6af007847559b8325ce4d32caf475546d2f5c..8c9900963c3777793b96e8bde1ddd20b3b558062 100644 --- a/vendor/zendframework/zend-stdlib/composer.json +++ b/vendor/zendframework/zend-stdlib/composer.json @@ -1,29 +1,31 @@ { "name": "zendframework/zend-stdlib", - "description": " ", + "description": "SPL extensions, array utilities, error handlers, and more", "license": "BSD-3-Clause", "keywords": [ - "zf2", + "zf", + "zendframework", "stdlib" ], - "homepage": "https://github.com/zendframework/zend-stdlib", - "autoload": { - "psr-4": { - "Zend\\Stdlib\\": "src/" - } + "support": { + "docs": "https://docs.zendframework.com/zend-stdlib/", + "issues": "https://github.com/zendframework/zend-stdlib/issues", + "source": "https://github.com/zendframework/zend-stdlib", + "rss": "https://github.com/zendframework/zend-stdlib/releases.atom", + "slack": "https://zendframework-slack.herokuapp.com", + "forum": "https://discourse.zendframework.com/c/questions/components" }, "require": { - "php": "^5.5 || ^7.0" + "php": "^5.6 || ^7.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/PHPUnit": "~4.0", - "athletic/athletic": "~0.1" + "phpbench/phpbench": "^0.13", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0" }, - "extra": { - "branch-alias": { - "dev-master": "3.0-dev", - "dev-develop": "3.1-dev" + "autoload": { + "psr-4": { + "Zend\\Stdlib\\": "src/" } }, "autoload-dev": { @@ -31,5 +33,24 @@ "ZendTest\\Stdlib\\": "test/", "ZendBench\\Stdlib\\": "benchmark/" } + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev", + "dev-develop": "3.3.x-dev" + } + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" } } diff --git a/vendor/zendframework/zend-stdlib/doc/book/index.html b/vendor/zendframework/zend-stdlib/doc/book/index.html deleted file mode 100644 index f4b09ab4457e2ee4cc04ac82ac28d8c34ca8d53b..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-stdlib/doc/book/index.html +++ /dev/null @@ -1,10 +0,0 @@ -<div class="container"> - <div class="jumbotron"> - <h1>zend-stdlib</h1> - - <p>SPL extensions, array utilities, error handlers, and more.</p> - - <pre><code class="language-bash">$ composer require zendframework/zend-stdlib</code></pre> - </div> -</div> - diff --git a/vendor/zendframework/zend-stdlib/doc/book/index.md b/vendor/zendframework/zend-stdlib/doc/book/index.md deleted file mode 100644 index f4ca9532d7e516274eee8b0a3237c3e4bd555825..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-stdlib/doc/book/index.md +++ /dev/null @@ -1,18 +0,0 @@ -# zend-stdlib - -[](https://secure.travis-ci.org/zendframework/zend-stdlib) -[](https://coveralls.io/r/zendframework/zend-stdlib?branch=master) - -`Zend\Stdlib` is a set of components that implements general purpose utility -class for different scopes like: - -- array utilities functions; -- json serializable interfaces; -- general messaging systems; -- string wrappers; -- etc. - ---- - -- File issues at https://github.com/zendframework/zend-stdlib/issues -- Documentation is at http://framework.zend.com/manual/current/en/index.html#zend-stdlib diff --git a/vendor/zendframework/zend-stdlib/doc/book/migration.md b/vendor/zendframework/zend-stdlib/doc/book/migration.md deleted file mode 100644 index a0c7ff398832a8998662a348aada663ecc56ee24..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-stdlib/doc/book/migration.md +++ /dev/null @@ -1,60 +0,0 @@ -# Migration Guide - -## From v2 to v3 - -The changes made going from v2 to v3 were: - -- Removal of the Hydrator subcomponent. -- Removal of the `CallbackHandler` class. -- Removal of `Zend\Stdlib\Guard\GuardUtils`. - -### Hydrators - -The biggest single change from version 2 to version 3 is that the hydrator -subcomponent, which was deprecated in v2.7.0, is now removed. This means that if -you were using zend-stdlib principally for the hydrators, you need to convert -your code to use [zend-hydrator](https://github.com/zendframework/zend-hydrator). - -This will also mean a multi-step migration. zend-stdlib v3 pre-dates -zend-hydrator v2.1, which will be the first version that supports zend-stdlib v3 -and zend-servicemanager v3. If you are using Composer, the migration should be -seamless: - -- Remove your zend-stdlib dependency: - - ```bash - $ composer remove zendframework/zend-stdlib - ``` - -- Update to use zend-hydrator: - - ```bash - $ composer require zendframework/zend-hydrator - ``` - -When zend-hydrator updates to newer versions of zend-stdlib and -zend-servicemanager, you will either automatically get those versions, or you -can tell composer to use those specific versions: - -```bash -$ composer require "zendframework/zend-stdlib:^3.0" -``` - -### CallbackHandler - -`Zend\Stdlib\CallbackHandler` primarily existed for legacy purposes; it was -created before the `callable` typehint existed, so that we could typehint PHP -callables. It also provided some minimal features around lazy-loading callables -from instantiable classes, but these features were rarely used, and better -approaches already exist for handling such functinality in zend-servicemanager -and zend-expressive. - -As such, the class was marked deprecated in v2.7.0, and removed for v3.0.0. - -### GuardUtils - -Version 3 removes `Zend\Stdlib\Guard\GuardUtils`. This abstract class existed to -provide the functionality of the various traits also present in that -subcomponent, for consumers on versions of PHP earlier than 5.4. Since the -minimum required version is now PHP 5.5, the class is unnecessary. If you were -using it previously, compose the related traits instead. diff --git a/vendor/zendframework/zend-stdlib/doc/bookdown.json b/vendor/zendframework/zend-stdlib/doc/bookdown.json deleted file mode 100644 index ad93f485fa49e7363213baf990f26547e29b27f4..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-stdlib/doc/bookdown.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "title": "Zend\\Stdlib", - "target": "html/", - "content": [ - "book/zend.stdlib.hydrator.md", - "book/zend.stdlib.hydrator.filter.md", - "book/zend.stdlib.hydrator.strategy.md", - "book/zend.stdlib.hydrator.aggregate.md", - "book/zend.stdlib.hydrator.namingstrategy.compositenamingstrategy.md", - "book/zend.stdlib.hydrator.namingstrategy.identitynamingstrategy.md", - "book/zend.stdlib.hydrator.namingstrategy.mapnamingstrategy.md", - "book/zend.stdlib.hydrator.namingstrategy.underscorenamingstrategy.md" - ] -} \ No newline at end of file diff --git a/vendor/zendframework/zend-stdlib/mkdocs.yml b/vendor/zendframework/zend-stdlib/mkdocs.yml deleted file mode 100644 index bf87a22ad8a6174611143e1b7969520bf9f60b72..0000000000000000000000000000000000000000 --- a/vendor/zendframework/zend-stdlib/mkdocs.yml +++ /dev/null @@ -1,9 +0,0 @@ -docs_dir: doc/book -site_dir: doc/html -pages: - - index.md - - Migration: migration.md -site_name: zend-stdlib -site_description: Zend\Stdlib -repo_url: 'https://github.com/zendframework/zend-stdlib' -copyright: 'Copyright (c) 2016 <a href="http://www.zend.com/">Zend Technologies USA Inc.</a>' diff --git a/vendor/zendframework/zend-stdlib/src/AbstractOptions.php b/vendor/zendframework/zend-stdlib/src/AbstractOptions.php index 812e1ca132da6ba3e51c395f62c98457e794fd67..172f5d363f86213b05f6715b8e722962cb884e1c 100644 --- a/vendor/zendframework/zend-stdlib/src/AbstractOptions.php +++ b/vendor/zendframework/zend-stdlib/src/AbstractOptions.php @@ -13,6 +13,7 @@ abstract class AbstractOptions implements ParameterObjectInterface { + // @codingStandardsIgnoreStart /** * We use the __ prefix to avoid collisions with properties in * user-implementations. @@ -20,6 +21,7 @@ abstract class AbstractOptions implements ParameterObjectInterface * @var bool */ protected $__strictMode__ = true; + // @codingStandardsIgnoreEnd /** * Constructor @@ -46,7 +48,7 @@ public function setFromArray($options) $options = $options->toArray(); } - if (!is_array($options) && !$options instanceof Traversable) { + if (! is_array($options) && ! $options instanceof Traversable) { throw new Exception\InvalidArgumentException( sprintf( 'Parameter provided to %s must be an %s, %s or %s', diff --git a/vendor/zendframework/zend-stdlib/src/ArrayObject.php b/vendor/zendframework/zend-stdlib/src/ArrayObject.php index e890084d077e4b0ab31dc1e13fedf5f97436b6ba..8c77c62097ef25af585bd9cbce88cd6e47b26df2 100644 --- a/vendor/zendframework/zend-stdlib/src/ArrayObject.php +++ b/vendor/zendframework/zend-stdlib/src/ArrayObject.php @@ -180,14 +180,16 @@ public function count() */ public function exchangeArray($data) { - if (!is_array($data) && !is_object($data)) { - throw new Exception\InvalidArgumentException('Passed variable is not an array or object, using empty array instead'); + if (! is_array($data) && ! is_object($data)) { + throw new Exception\InvalidArgumentException( + 'Passed variable is not an array or object, using empty array instead' + ); } if (is_object($data) && ($data instanceof self || $data instanceof \ArrayObject)) { $data = $data->getArrayCopy(); } - if (!is_array($data)) { + if (! is_array($data)) { $data = (array) $data; } @@ -290,7 +292,7 @@ public function offsetExists($key) public function &offsetGet($key) { $ret = null; - if (!$this->offsetExists($key)) { + if (! $this->offsetExists($key)) { return $ret; } $ret =& $this->storage[$key]; @@ -423,7 +425,7 @@ public function unserialize($data) $this->setIteratorClass($v); break; case 'protectedProperties': - continue; + break; default: $this->__set($k, $v); } diff --git a/vendor/zendframework/zend-stdlib/src/ArrayUtils.php b/vendor/zendframework/zend-stdlib/src/ArrayUtils.php index 17e3ae3cdc691de7c12d9b051ee5dbb422fe2dc7..4edcacf11917dba0145cc3e61f153e06e919f8ca 100644 --- a/vendor/zendframework/zend-stdlib/src/ArrayUtils.php +++ b/vendor/zendframework/zend-stdlib/src/ArrayUtils.php @@ -39,11 +39,11 @@ abstract class ArrayUtils */ public static function hasStringKeys($value, $allowEmpty = false) { - if (!is_array($value)) { + if (! is_array($value)) { return false; } - if (!$value) { + if (! $value) { return $allowEmpty; } @@ -59,11 +59,11 @@ public static function hasStringKeys($value, $allowEmpty = false) */ public static function hasIntegerKeys($value, $allowEmpty = false) { - if (!is_array($value)) { + if (! is_array($value)) { return false; } - if (!$value) { + if (! $value) { return $allowEmpty; } @@ -86,11 +86,11 @@ public static function hasIntegerKeys($value, $allowEmpty = false) */ public static function hasNumericKeys($value, $allowEmpty = false) { - if (!is_array($value)) { + if (! is_array($value)) { return false; } - if (!$value) { + if (! $value) { return $allowEmpty; } @@ -119,11 +119,11 @@ public static function hasNumericKeys($value, $allowEmpty = false) */ public static function isList($value, $allowEmpty = false) { - if (!is_array($value)) { + if (! is_array($value)) { return false; } - if (!$value) { + if (! $value) { return $allowEmpty; } @@ -161,11 +161,11 @@ public static function isList($value, $allowEmpty = false) */ public static function isHashTable($value, $allowEmpty = false) { - if (!is_array($value)) { + if (! is_array($value)) { return false; } - if (!$value) { + if (! $value) { return $allowEmpty; } @@ -187,7 +187,7 @@ public static function isHashTable($value, $allowEmpty = false) */ public static function inArray($needle, array $haystack, $strict = false) { - if (!$strict) { + if (! $strict) { if (is_int($needle) || is_float($needle)) { $needle = (string) $needle; } @@ -215,11 +215,11 @@ public static function inArray($needle, array $haystack, $strict = false) */ public static function iteratorToArray($iterator, $recursive = true) { - if (!is_array($iterator) && !$iterator instanceof Traversable) { + if (! is_array($iterator) && ! $iterator instanceof Traversable) { throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable object'); } - if (!$recursive) { + if (! $recursive) { if (is_array($iterator)) { return $iterator; } @@ -274,7 +274,7 @@ public static function merge(array $a, array $b, $preserveNumericKeys = false) } elseif (isset($a[$key]) || array_key_exists($key, $a)) { if ($value instanceof MergeRemoveKey) { unset($a[$key]); - } elseif (!$preserveNumericKeys && is_int($key)) { + } elseif (! $preserveNumericKeys && is_int($key)) { $a[] = $value; } elseif (is_array($value) && is_array($a[$key])) { $a[$key] = static::merge($a[$key], $value, $preserveNumericKeys); @@ -282,7 +282,7 @@ public static function merge(array $a, array $b, $preserveNumericKeys = false) $a[$key] = $value; } } else { - if (!$value instanceof MergeRemoveKey) { + if (! $value instanceof MergeRemoveKey) { $a[$key] = $value; } } @@ -292,12 +292,13 @@ public static function merge(array $a, array $b, $preserveNumericKeys = false) } /** - * Compatibility Method for array_filter on <5.6 systems + * @deprecated Since 3.2.0; use the native array_filter methods * * @param array $data * @param callable $callback * @param null|int $flag * @return array + * @throws Exception\InvalidArgumentException */ public static function filter(array $data, $callback, $flag = null) { @@ -308,28 +309,6 @@ public static function filter(array $data, $callback, $flag = null) )); } - if (version_compare(PHP_VERSION, '5.6.0') >= 0) { - return array_filter($data, $callback, $flag); - } - - $output = []; - foreach ($data as $key => $value) { - $params = [$value]; - - if ($flag === static::ARRAY_FILTER_USE_BOTH) { - $params[] = $key; - } - - if ($flag === static::ARRAY_FILTER_USE_KEY) { - $params = [$key]; - } - - $response = call_user_func_array($callback, $params); - if ($response) { - $output[$key] = $value; - } - } - - return $output; + return array_filter($data, $callback, $flag); } } diff --git a/vendor/zendframework/zend-stdlib/src/ConsoleHelper.php b/vendor/zendframework/zend-stdlib/src/ConsoleHelper.php new file mode 100644 index 0000000000000000000000000000000000000000..79a65c803f5e434490b71b3f4d062b73bfc3393a --- /dev/null +++ b/vendor/zendframework/zend-stdlib/src/ConsoleHelper.php @@ -0,0 +1,158 @@ +<?php +/** + * @link http://github.com/zendframework/zend-stdlib for the canonical source repository + * @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +namespace Zend\Stdlib; + +/** + * Utilities for console tooling. + * + * Provides the following facilities: + * + * - Colorize strings using markup (e.g., `<info>message</info>`, + * `<error>message</error>`) + * - Write output to a specified stream, optionally with colorization. + * - Write a line of output to a specified stream, optionally with + * colorization, using the system EOL sequence.. + * - Write an error message to STDERR. + * + * Colorization will only occur when expected sequences are discovered, and + * then, only if the console terminal allows it. + * + * Essentially, provides the bare minimum to allow you to provide messages to + * the current console. + */ +class ConsoleHelper +{ + const COLOR_GREEN = "\033[32m"; + const COLOR_RED = "\033[31m"; + const COLOR_RESET = "\033[0m"; + + const HIGHLIGHT_INFO = 'info'; + const HIGHLIGHT_ERROR = 'error'; + + private $highlightMap = [ + self::HIGHLIGHT_INFO => self::COLOR_GREEN, + self::HIGHLIGHT_ERROR => self::COLOR_RED, + ]; + + /** + * @var string Exists only for testing. + */ + private $eol = PHP_EOL; + + /** + * @var resource Exists only for testing. + */ + private $stderr = STDERR; + + /** + * @var bool + */ + private $supportsColor; + + /** + * @param resource $resource + */ + public function __construct($resource = STDOUT) + { + $this->supportsColor = $this->detectColorCapabilities($resource); + } + + /** + * Colorize a string for use with the terminal. + * + * Takes strings formatted as `<key>string</key>` and formats them per the + * $highlightMap; if color support is disabled, simply removes the formatting + * tags. + * + * @param string $string + * @return string + */ + public function colorize($string) + { + $reset = $this->supportsColor ? self::COLOR_RESET : ''; + foreach ($this->highlightMap as $key => $color) { + $pattern = sprintf('#<%s>(.*?)</%s>#s', $key, $key); + $color = $this->supportsColor ? $color : ''; + $string = preg_replace($pattern, $color . '$1' . $reset, $string); + } + return $string; + } + + /** + * @param string $string + * @param bool $colorize Whether or not to colorize the string + * @param resource $resource Defaults to STDOUT + * @return void + */ + public function write($string, $colorize = true, $resource = STDOUT) + { + if ($colorize) { + $string = $this->colorize($string); + } + + $string = $this->formatNewlines($string); + + fwrite($resource, $string); + } + + /** + * @param string $string + * @param bool $colorize Whether or not to colorize the line + * @param resource $resource Defaults to STDOUT + * @return void + */ + public function writeLine($string, $colorize = true, $resource = STDOUT) + { + $this->write($string . $this->eol, $colorize, $resource); + } + + /** + * Emit an error message. + * + * Wraps the message in `<error></error>`, and passes it to `writeLine()`, + * using STDERR as the resource; emits an additional empty line when done, + * also to STDERR. + * + * @param string $message + * @return void + */ + public function writeErrorMessage($message) + { + $this->writeLine(sprintf('<error>%s</error>', $message), true, $this->stderr); + $this->writeLine('', false, $this->stderr); + } + + /** + * @param resource $resource + * @return bool + */ + private function detectColorCapabilities($resource = STDOUT) + { + if ('\\' === DIRECTORY_SEPARATOR) { + // Windows + return false !== getenv('ANSICON') + || 'ON' === getenv('ConEmuANSI') + || 'xterm' === getenv('TERM'); + } + + return function_exists('posix_isatty') && posix_isatty($resource); + } + + /** + * Ensure newlines are appropriate for the current terminal. + * + * @param string + * @return string + */ + private function formatNewlines($string) + { + $string = str_replace($this->eol, "\0PHP_EOL\0", $string); + $string = preg_replace("/(\r\n|\n|\r)/", $this->eol, $string); + return str_replace("\0PHP_EOL\0", $this->eol, $string); + } +} diff --git a/vendor/zendframework/zend-stdlib/src/ErrorHandler.php b/vendor/zendframework/zend-stdlib/src/ErrorHandler.php index a849620ab23090ce5c68edd0994f5dd7fcbd9116..405cdd799fc5bff895e07bf06c16b093a23df340 100644 --- a/vendor/zendframework/zend-stdlib/src/ErrorHandler.php +++ b/vendor/zendframework/zend-stdlib/src/ErrorHandler.php @@ -51,7 +51,7 @@ public static function getNestedLevel() */ public static function start($errorLevel = \E_WARNING) { - if (!static::$stack) { + if (! static::$stack) { set_error_handler([get_called_class(), 'addError'], $errorLevel); } @@ -63,7 +63,7 @@ public static function start($errorLevel = \E_WARNING) * * @param bool $throw Throw the ErrorException if any * @return null|ErrorException - * @throws ErrorException If an error has been catched and $throw is true + * @throws ErrorException If an error has been caught and $throw is true */ public static function stop($throw = false) { @@ -72,7 +72,7 @@ public static function stop($throw = false) if (static::$stack) { $errorException = array_pop(static::$stack); - if (!static::$stack) { + if (! static::$stack) { restore_error_handler(); } diff --git a/vendor/zendframework/zend-stdlib/src/FastPriorityQueue.php b/vendor/zendframework/zend-stdlib/src/FastPriorityQueue.php index 16d2bcceba2ef6088a5ced445dbea167793b7f14..883da06e42f353b58364b28b060174e6b9c5bd8b 100644 --- a/vendor/zendframework/zend-stdlib/src/FastPriorityQueue.php +++ b/vendor/zendframework/zend-stdlib/src/FastPriorityQueue.php @@ -57,9 +57,9 @@ class FastPriorityQueue implements Iterator, Countable, Serializable /** * Max priority * - * @var integer + * @var integer|null */ - protected $maxPriority = 0; + protected $maxPriority = null; /** * Total number of elements in the queue @@ -86,7 +86,7 @@ class FastPriorityQueue implements Iterator, Countable, Serializable * Insert an element in the queue with a specified priority * * @param mixed $value - * @param integer $priority a positive integer + * @param integer $priority */ public function insert($value, $priority) { @@ -96,7 +96,7 @@ public function insert($value, $priority) $this->values[$priority][] = $value; if (! isset($this->priorities[$priority])) { $this->priorities[$priority] = $priority; - $this->maxPriority = max($priority, $this->maxPriority); + $this->maxPriority = $this->maxPriority === null ? $priority : max($priority, $this->maxPriority); } ++$this->count; } @@ -132,11 +132,35 @@ public function extract() */ public function remove($datum) { + $currentIndex = $this->index; + $currentSubIndex = $this->subIndex; + $currentPriority = $this->maxPriority; + $this->rewind(); while ($this->valid()) { if (current($this->values[$this->maxPriority]) === $datum) { $index = key($this->values[$this->maxPriority]); unset($this->values[$this->maxPriority][$index]); + + // The `next()` method advances the internal array pointer, so we need to use the `reset()` function, + // otherwise we would lose all elements before the place the pointer points. + reset($this->values[$this->maxPriority]); + + $this->index = $currentIndex; + $this->subIndex = $currentSubIndex; + + // If the array is empty we need to destroy the unnecessary priority, + // otherwise we would end up with an incorrect value of `$this->count` + // {@see \Zend\Stdlib\FastPriorityQueue::nextAndRemove()}. + if (empty($this->values[$this->maxPriority])) { + unset($this->values[$this->maxPriority]); + unset($this->priorities[$this->maxPriority]); + if ($this->maxPriority === $currentPriority) { + $this->subIndex = 0; + } + } + + $this->maxPriority = empty($this->priorities) ? null : max($this->priorities); --$this->count; return true; } @@ -191,11 +215,15 @@ public function key() */ protected function nextAndRemove() { + $key = key($this->values[$this->maxPriority]); + if (false === next($this->values[$this->maxPriority])) { unset($this->priorities[$this->maxPriority]); unset($this->values[$this->maxPriority]); - $this->maxPriority = empty($this->priorities) ? 0 : max($this->priorities); + $this->maxPriority = empty($this->priorities) ? null : max($this->priorities); $this->subIndex = -1; + } else { + unset($this->values[$this->maxPriority][$key]); } ++$this->index; ++$this->subIndex; @@ -211,7 +239,7 @@ public function next() if (false === next($this->values[$this->maxPriority])) { unset($this->subPriorities[$this->maxPriority]); reset($this->values[$this->maxPriority]); - $this->maxPriority = empty($this->subPriorities) ? 0 : max($this->subPriorities); + $this->maxPriority = empty($this->subPriorities) ? null : max($this->subPriorities); $this->subIndex = -1; } ++$this->index; diff --git a/vendor/zendframework/zend-stdlib/src/Glob.php b/vendor/zendframework/zend-stdlib/src/Glob.php index dc37562ad35f80e9c6d229d33dd56b6c49bf177c..ded3fc5330ac9e8914573d891b5f9636c246d12f 100644 --- a/vendor/zendframework/zend-stdlib/src/Glob.php +++ b/vendor/zendframework/zend-stdlib/src/Glob.php @@ -38,7 +38,7 @@ abstract class Glob */ public static function glob($pattern, $flags = 0, $forceFallback = false) { - if (!defined('GLOB_BRACE') || $forceFallback) { + if (! defined('GLOB_BRACE') || $forceFallback) { return static::fallbackGlob($pattern, $flags); } @@ -96,7 +96,7 @@ protected static function systemGlob($pattern, $flags) */ protected static function fallbackGlob($pattern, $flags) { - if (!$flags & self::GLOB_BRACE) { + if (! $flags & self::GLOB_BRACE) { return static::systemGlob($pattern, $flags); } @@ -182,7 +182,7 @@ protected static function nextBraceSub($pattern, $begin, $flags) $current = $begin; while ($current < $length) { - if (!$flags & self::GLOB_NOESCAPE && $pattern[$current] === '\\') { + if (! $flags & self::GLOB_NOESCAPE && $pattern[$current] === '\\') { if (++$current === $length) { break; } diff --git a/vendor/zendframework/zend-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php b/vendor/zendframework/zend-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php index e6959a5ef42ec4192a3a031b88186e2ccbd8dfb8..116101f1b25426881104aee8112351b13b76c278 100644 --- a/vendor/zendframework/zend-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php +++ b/vendor/zendframework/zend-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php @@ -29,7 +29,7 @@ protected function guardForArrayOrTraversable( $dataName = 'Argument', $exceptionClass = 'Zend\Stdlib\Exception\InvalidArgumentException' ) { - if (!is_array($data) && !($data instanceof Traversable)) { + if (! is_array($data) && ! ($data instanceof Traversable)) { $message = sprintf( "%s must be an array or Traversable, [%s] given", $dataName, diff --git a/vendor/zendframework/zend-stdlib/src/JsonSerializable.php b/vendor/zendframework/zend-stdlib/src/JsonSerializable.php index 16cc24466157a45e0a17cbc54978ec7e16ca10d0..05b8836d749e6eb14aa66259aededa76f1e36a51 100644 --- a/vendor/zendframework/zend-stdlib/src/JsonSerializable.php +++ b/vendor/zendframework/zend-stdlib/src/JsonSerializable.php @@ -9,6 +9,9 @@ namespace Zend\Stdlib; +/** + * @deprecated Since 3.1.0; use the native JsonSerializable interface + */ interface JsonSerializable extends \JsonSerializable { } diff --git a/vendor/zendframework/zend-stdlib/src/Message.php b/vendor/zendframework/zend-stdlib/src/Message.php index 12d5bb3d8c259f1302eae4659b911c0c00c6b158..008e23f36a13e0c961f5143f043e2d89bbc9a971 100644 --- a/vendor/zendframework/zend-stdlib/src/Message.php +++ b/vendor/zendframework/zend-stdlib/src/Message.php @@ -19,7 +19,7 @@ class Message implements MessageInterface protected $metadata = []; /** - * @var string + * @var mixed */ protected $content = ''; @@ -40,7 +40,7 @@ public function setMetadata($spec, $value = null) $this->metadata[$spec] = $value; return $this; } - if (!is_array($spec) && !$spec instanceof Traversable) { + if (! is_array($spec) && ! $spec instanceof Traversable) { throw new Exception\InvalidArgumentException(sprintf( 'Expected a string, array, or Traversable argument in first position; received "%s"', (is_object($spec) ? get_class($spec) : gettype($spec)) @@ -66,7 +66,7 @@ public function getMetadata($key = null, $default = null) return $this->metadata; } - if (!is_scalar($key)) { + if (! is_scalar($key)) { throw new Exception\InvalidArgumentException('Non-scalar argument provided for key'); } diff --git a/vendor/zendframework/zend-stdlib/src/Parameters.php b/vendor/zendframework/zend-stdlib/src/Parameters.php index ab5ada97a9553ce757a33049e463fe114cb6beab..e845fcdafe3d7421f7d99dce17c33f065722a18f 100644 --- a/vendor/zendframework/zend-stdlib/src/Parameters.php +++ b/vendor/zendframework/zend-stdlib/src/Parameters.php @@ -70,7 +70,7 @@ public function toArray() */ public function toString() { - return http_build_query($this); + return http_build_query($this->toArray()); } /** diff --git a/vendor/zendframework/zend-stdlib/src/PriorityList.php b/vendor/zendframework/zend-stdlib/src/PriorityList.php index b318f264e43e1d37ad79fdf4d66dcd8418ebf309..d5ca136bd3987b56514ca0d8c4eff700113566f4 100644 --- a/vendor/zendframework/zend-stdlib/src/PriorityList.php +++ b/vendor/zendframework/zend-stdlib/src/PriorityList.php @@ -62,7 +62,7 @@ class PriorityList implements Iterator, Countable */ public function insert($name, $value, $priority = 0) { - if (!isset($this->items[$name])) { + if (! isset($this->items[$name])) { $this->count++; } @@ -85,7 +85,7 @@ public function insert($name, $value, $priority = 0) */ public function setPriority($name, $priority) { - if (!isset($this->items[$name])) { + if (! isset($this->items[$name])) { throw new \Exception("item $name not found"); } @@ -131,7 +131,7 @@ public function clear() */ public function get($name) { - if (!isset($this->items[$name])) { + if (! isset($this->items[$name])) { return; } @@ -145,7 +145,7 @@ public function get($name) */ protected function sort() { - if (!$this->sorted) { + if (! $this->sorted) { uasort($this->items, [$this, 'compare']); $this->sorted = true; } @@ -161,7 +161,7 @@ protected function sort() protected function compare(array $item1, array $item2) { return ($item1['priority'] === $item2['priority']) - ? ($item1['serial'] > $item2['serial'] ? -1 : 1) * $this->isLIFO + ? ($item1['serial'] > $item2['serial'] ? -1 : 1) * $this->isLIFO : ($item1['priority'] > $item2['priority'] ? -1 : 1); } diff --git a/vendor/zendframework/zend-stdlib/src/PriorityQueue.php b/vendor/zendframework/zend-stdlib/src/PriorityQueue.php index eded6adfe69b90552ae145041de90d9afa480129..2a1628731678616ce64b282e971fec6dd95234ff 100644 --- a/vendor/zendframework/zend-stdlib/src/PriorityQueue.php +++ b/vendor/zendframework/zend-stdlib/src/PriorityQueue.php @@ -99,7 +99,7 @@ public function remove($datum) unset($this->items[$key]); $this->queue = null; - if (!$this->isEmpty()) { + if (! $this->isEmpty()) { $queue = $this->getQueue(); foreach ($this->items as $item) { $queue->insert($item['data'], $item['priority']); @@ -277,7 +277,7 @@ protected function getQueue() { if (null === $this->queue) { $this->queue = new $this->queueClass(); - if (!$this->queue instanceof \SplPriorityQueue) { + if (! $this->queue instanceof \SplPriorityQueue) { throw new Exception\DomainException(sprintf( 'PriorityQueue expects an internal queue of type SplPriorityQueue; received "%s"', get_class($this->queue) diff --git a/vendor/zendframework/zend-stdlib/src/SplPriorityQueue.php b/vendor/zendframework/zend-stdlib/src/SplPriorityQueue.php index 28b365d854cd415452155859b4179c1ad0bb851b..c5952dd3175e7f4056499871256e452f42e57dad 100644 --- a/vendor/zendframework/zend-stdlib/src/SplPriorityQueue.php +++ b/vendor/zendframework/zend-stdlib/src/SplPriorityQueue.php @@ -36,7 +36,7 @@ class SplPriorityQueue extends \SplPriorityQueue implements Serializable */ public function insert($datum, $priority) { - if (!is_array($priority)) { + if (! is_array($priority)) { $priority = [$priority, $this->serial--]; } parent::insert($datum, $priority); @@ -84,7 +84,9 @@ public function serialize() */ public function unserialize($data) { + $this->serial = PHP_INT_MAX; foreach (unserialize($data) as $item) { + $this->serial--; $this->insert($item['data'], $item['priority']); } } diff --git a/vendor/zendframework/zend-stdlib/src/StringUtils.php b/vendor/zendframework/zend-stdlib/src/StringUtils.php index 575cf2aab055e39bf65055bb480b3d9b56343d06..79a22a4c011ff0f3ead309fd70edc59d0d51e653 100644 --- a/vendor/zendframework/zend-stdlib/src/StringUtils.php +++ b/vendor/zendframework/zend-stdlib/src/StringUtils.php @@ -84,7 +84,7 @@ public static function getRegisteredWrappers() public static function registerWrapper($wrapper) { $wrapper = (string) $wrapper; - if (!in_array($wrapper, static::$wrapperRegistry, true)) { + if (! in_array($wrapper, static::$wrapperRegistry, true)) { static::$wrapperRegistry[] = $wrapper; } } diff --git a/vendor/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php b/vendor/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php index 3e395ccc5ae6784175ded8f07f5bd6f16e654ae7..cf2625079a3bb507751a3821cc35d2b114f4fbd7 100644 --- a/vendor/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php +++ b/vendor/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php @@ -38,11 +38,11 @@ public static function isSupported($encoding, $convertEncoding = null) { $supportedEncodings = static::getSupportedEncodings(); - if (!in_array(strtoupper($encoding), $supportedEncodings)) { + if (! in_array(strtoupper($encoding), $supportedEncodings)) { return false; } - if ($convertEncoding !== null && !in_array(strtoupper($convertEncoding), $supportedEncodings)) { + if ($convertEncoding !== null && ! in_array(strtoupper($convertEncoding), $supportedEncodings)) { return false; } @@ -61,7 +61,7 @@ public function setEncoding($encoding, $convertEncoding = null) $supportedEncodings = static::getSupportedEncodings(); $encodingUpper = strtoupper($encoding); - if (!in_array($encodingUpper, $supportedEncodings)) { + if (! in_array($encodingUpper, $supportedEncodings)) { throw new Exception\InvalidArgumentException( 'Wrapper doesn\'t support character encoding "' . $encoding . '"' ); @@ -69,7 +69,7 @@ public function setEncoding($encoding, $convertEncoding = null) if ($convertEncoding !== null) { $convertEncodingUpper = strtoupper($convertEncoding); - if (!in_array($convertEncodingUpper, $supportedEncodings)) { + if (! in_array($convertEncodingUpper, $supportedEncodings)) { throw new Exception\InvalidArgumentException( 'Wrapper doesn\'t support character encoding "' . $convertEncoding . '"' ); diff --git a/vendor/zendframework/zend-stdlib/src/StringWrapper/Iconv.php b/vendor/zendframework/zend-stdlib/src/StringWrapper/Iconv.php index 46413ab79e16c2e5983b534bc9e9ab2a73231d4b..bc791b893cb0152baada74c66d43f3ca43f8a3a4 100644 --- a/vendor/zendframework/zend-stdlib/src/StringWrapper/Iconv.php +++ b/vendor/zendframework/zend-stdlib/src/StringWrapper/Iconv.php @@ -214,7 +214,7 @@ public static function getSupportedEncodings() */ public function __construct() { - if (!extension_loaded('iconv')) { + if (! extension_loaded('iconv')) { throw new Exception\ExtensionNotLoadedException( 'PHP extension "iconv" is required for this wrapper' ); diff --git a/vendor/zendframework/zend-stdlib/src/StringWrapper/Intl.php b/vendor/zendframework/zend-stdlib/src/StringWrapper/Intl.php index eaab28f88d8936f1b2828c0c49fad1f5c6585ab5..4644db361d058766e09f169319be0749216772a9 100644 --- a/vendor/zendframework/zend-stdlib/src/StringWrapper/Intl.php +++ b/vendor/zendframework/zend-stdlib/src/StringWrapper/Intl.php @@ -37,7 +37,7 @@ public static function getSupportedEncodings() */ public function __construct() { - if (!extension_loaded('intl')) { + if (! extension_loaded('intl')) { throw new Exception\ExtensionNotLoadedException( 'PHP extension "intl" is required for this wrapper' ); diff --git a/vendor/zendframework/zend-stdlib/src/StringWrapper/MbString.php b/vendor/zendframework/zend-stdlib/src/StringWrapper/MbString.php index d6db18566d247dbbcab313b09ecd14902919c220..a0f80f62ac2ab27fb4508ae43fe1475cf8ad0a66 100644 --- a/vendor/zendframework/zend-stdlib/src/StringWrapper/MbString.php +++ b/vendor/zendframework/zend-stdlib/src/StringWrapper/MbString.php @@ -48,7 +48,7 @@ public static function getSupportedEncodings() */ public function __construct() { - if (!extension_loaded('mbstring')) { + if (! extension_loaded('mbstring')) { throw new Exception\ExtensionNotLoadedException( 'PHP extension "mbstring" is required for this wrapper' ); diff --git a/vendor/zendframework/zend-stdlib/src/StringWrapper/Native.php b/vendor/zendframework/zend-stdlib/src/StringWrapper/Native.php index 38b3c10a41c515f0358a32cd712677be54311f80..b01bb86cfaff3b25362d058808288d13d4d4a934 100644 --- a/vendor/zendframework/zend-stdlib/src/StringWrapper/Native.php +++ b/vendor/zendframework/zend-stdlib/src/StringWrapper/Native.php @@ -16,7 +16,7 @@ class Native extends AbstractStringWrapper { /** * The character encoding working on - * (overwritten to change defaut encoding) + * (overwritten to change default encoding) * * @var string */ @@ -35,7 +35,7 @@ public static function isSupported($encoding, $convertEncoding = null) $encodingUpper = strtoupper($encoding); $supportedEncodings = static::getSupportedEncodings(); - if (!in_array($encodingUpper, $supportedEncodings)) { + if (! in_array($encodingUpper, $supportedEncodings)) { return false; } @@ -69,7 +69,7 @@ public function setEncoding($encoding, $convertEncoding = null) $supportedEncodings = static::getSupportedEncodings(); $encodingUpper = strtoupper($encoding); - if (!in_array($encodingUpper, $supportedEncodings)) { + if (! in_array($encodingUpper, $supportedEncodings)) { throw new Exception\InvalidArgumentException( 'Wrapper doesn\'t support character encoding "' . $encoding . '"' ); diff --git a/web/core/MAINTAINERS.txt b/web/core/MAINTAINERS.txt index bd8192318a15859e0058c989cd8bc7d61cfb90dd..0d8cd50e107a3a3790763e59f9bb755e8042a6c5 100644 --- a/web/core/MAINTAINERS.txt +++ b/web/core/MAINTAINERS.txt @@ -319,7 +319,7 @@ Quick Edit - Théodore Biadala 'nod_' https://www.drupal.org/u/nod_ RDF -- Stéphane Corlosquet 'scor' https://www.drupal.org/u/scor +- ? Render API - Alex Bronstein 'effulgentsia' https://www.drupal.org/u/effulgentsia @@ -493,7 +493,6 @@ Out-of-the-Box Initiative - Mark Conroy 'markconroy' https://www.drupal.org/u/markconroy - Gareth Goodwin 'smaz' https://www.drupal.org/u/smaz - Keith Jay 'kjay' https://www.drupal.org/u/kjay -- Elliot Ward 'eli-t' https://www.drupal.org/u/eli-t PHPUnit Initiative - Daniel Wehner 'dawehner' https://www.drupal.org/u/dawehner diff --git a/web/core/composer.json b/web/core/composer.json index 34fed39b1ae5d60bc43e5c7eee9274f9c516b1d5..bbd9faa42e53e7788da4b97f1813e7211ce749d6 100644 --- a/web/core/composer.json +++ b/web/core/composer.json @@ -32,7 +32,7 @@ "symfony/polyfill-iconv": "^1.0", "symfony/yaml": "~3.4.5", "typo3/phar-stream-wrapper": "^2.0.1", - "twig/twig": "^1.35.0", + "twig/twig": "^1.38.2", "doctrine/common": "^2.5", "doctrine/annotations": "^1.2", "guzzlehttp/guzzle": "^6.2.1", diff --git a/web/core/core.api.php b/web/core/core.api.php index a6361a95ca554582d0c795b4b482855170078a66..a9a7006c205fb3230919066d6e00eab7fcd6677f 100644 --- a/web/core/core.api.php +++ b/web/core/core.api.php @@ -1046,7 +1046,7 @@ * more information. * - In configuration schema files, you can use the unique ID ('id' annotation) * from any DataType plugin class as the 'type' value for an entry. See the - * @link config_api Confuration API topic @endlink for more information. + * @link config_api Configuration API topic @endlink for more information. * - If you need to create a typed data object in code, first get the * typed_data_manager service from the container or by calling * \Drupal::typedDataManager(). Then pass the plugin ID to diff --git a/web/core/includes/file.inc b/web/core/includes/file.inc index 77a743eab044ad4ec095b26c1fa159a4a56dba25..3037a233608b473eac4476b1b0bb4daab41ee228 100644 --- a/web/core/includes/file.inc +++ b/web/core/includes/file.inc @@ -6,6 +6,7 @@ */ use Drupal\Component\FileSystem\FileSystem as ComponentFileSystem; +use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\UrlHelper; use Drupal\Component\PhpStorage\FileStorage; use Drupal\Component\Utility\Bytes; @@ -587,8 +588,15 @@ function file_build_uri($path) { * @return * The destination filepath, or FALSE if the file already exists * and FILE_EXISTS_ERROR is specified. + * + * @throws \RuntimeException + * Thrown if the filename contains invalid UTF-8. */ function file_destination($destination, $replace) { + $basename = drupal_basename($destination); + if (!Unicode::validateUtf8($basename)) { + throw new \RuntimeException(sprintf("Invalid filename '%s'", $basename)); + } if (file_exists($destination)) { switch ($replace) { case FILE_EXISTS_REPLACE: @@ -596,7 +604,6 @@ function file_destination($destination, $replace) { break; case FILE_EXISTS_RENAME: - $basename = drupal_basename($destination); $directory = drupal_dirname($destination); $destination = file_create_filename($basename, $directory); break; @@ -768,11 +775,20 @@ function file_unmunge_filename($filename) { * @return * File path consisting of $directory and a unique filename based off * of $basename. + * + * @throws \RuntimeException + * Thrown if the $basename is not valid UTF-8 or another error occurs + * stripping control characters. */ function file_create_filename($basename, $directory) { + $original = $basename; // Strip control characters (ASCII value < 32). Though these are allowed in // some filesystems, not many applications handle them well. $basename = preg_replace('/[\x00-\x1F]/u', '_', $basename); + if (preg_last_error() !== PREG_NO_ERROR) { + throw new \RuntimeException(sprintf("Invalid filename '%s'", $original)); + } + if (substr(PHP_OS, 0, 3) == 'WIN') { // These characters are not allowed in Windows filenames $basename = str_replace([':', '*', '?', '"', '<', '>', '|'], '_', $basename); diff --git a/web/core/lib/Drupal.php b/web/core/lib/Drupal.php index 653f3d07dbc559c9639435f607e73325b45b4926..68380b051c712919d9e23cacd495fcbeeb883c06 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.10'; + const VERSION = '8.6.13'; /** * Core API compatibility. diff --git a/web/core/lib/Drupal/Core/Datetime/Element/Datetime.php b/web/core/lib/Drupal/Core/Datetime/Element/Datetime.php index bfdaa40bc50303ed508b7247a4ea810281081275..3c1062dbdcc1a0d6a576830535d79c19fedd073d 100644 --- a/web/core/lib/Drupal/Core/Datetime/Element/Datetime.php +++ b/web/core/lib/Drupal/Core/Datetime/Element/Datetime.php @@ -96,7 +96,7 @@ public static function valueCallback(&$element, $input, FormStateInterface $form ]; } else { - $date = $element['#default_value']; + $date = isset($element['#default_value']) ? $element['#default_value'] : NULL; if ($date instanceof DrupalDateTime && !$date->hasErrors()) { $input = [ 'date' => $date->format($element['#date_date_format']), @@ -274,7 +274,7 @@ public static function processDatetime(&$element, FormStateInterface $form_state // Allows custom callbacks to alter the element. if (!empty($element['#date_date_callbacks'])) { foreach ($element['#date_date_callbacks'] as $callback) { - if (function_exists($callback)) { + if (is_callable($callback)) { $callback($element, $form_state, $date); } } diff --git a/web/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php b/web/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php index 9525de6b1891c0e0a3a8842ddda8bb954928b013..dd3fd1c0e406bfa5cfa7c42f016c845670eda5aa 100644 --- a/web/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php +++ b/web/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php @@ -293,7 +293,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // Enable update.module if this option was selected. $update_status_module = $form_state->getValue('enable_update_status_module'); if (empty($install_state['config_install_path']) && $update_status_module) { - $this->moduleInstaller->install(['file', 'update'], FALSE); + $this->moduleInstaller->install(['update']); // Add the site maintenance account's email address to the list of // addresses to be notified when updates are available, if selected. diff --git a/web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php b/web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php index c7517a9bdd0e6a68d9a4aa91f8b1380e87a95c79..bed8a87155fbbbd519f51d32790bf591dfc79b61 100644 --- a/web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php +++ b/web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php @@ -17,12 +17,19 @@ class ContextHandler implements ContextHandlerInterface { * {@inheritdoc} */ public function filterPluginDefinitionsByContexts(array $contexts, array $definitions) { - return array_filter($definitions, function ($plugin_definition) use ($contexts) { + $checked_requirements = []; + return array_filter($definitions, function ($plugin_definition) use ($contexts, &$checked_requirements) { $context_definitions = $this->getContextDefinitions($plugin_definition); - if ($context_definitions) { - // Check the set of contexts against the requirements. - return $this->checkRequirements($contexts, $context_definitions); + // Generate a unique key for the current context definitions. This will + // allow calling checkRequirements() once for all plugins that have the + // same context definitions. + $context_definitions_key = hash('sha256', serialize($context_definitions)); + if (!isset($checked_requirements[$context_definitions_key])) { + // Check the set of contexts against the requirements. + $checked_requirements[$context_definitions_key] = $this->checkRequirements($contexts, $context_definitions); + } + return $checked_requirements[$context_definitions_key]; } // If this plugin doesn't need any context, it is available to use. return TRUE; diff --git a/web/core/lib/Drupal/Core/Render/Element/Container.php b/web/core/lib/Drupal/Core/Render/Element/Container.php index 357e6a5484968625232a37ab10e5c5d9dbf44cab..0708546dee6544741995c719b0c0580717236835 100644 --- a/web/core/lib/Drupal/Core/Render/Element/Container.php +++ b/web/core/lib/Drupal/Core/Render/Element/Container.php @@ -18,27 +18,27 @@ * * Usage example: * @code - * $form['needs_accommodation'] = array( + * $form['needs_accommodation'] = [ * '#type' => 'checkbox', * '#title' => $this->t('Need Special Accommodations?'), - * ); + * ]; * - * $form['accommodation'] = array( + * $form['accommodation'] = [ * '#type' => 'container', - * '#attributes' => array( - * 'class' => 'accommodation', - * ), - * '#states' => array( - * 'invisible' => array( - * 'input[name="needs_accommodation"]' => array('checked' => FALSE), - * ), - * ), - * ); + * '#attributes' => [ + * 'class' => ['accommodation'], + * ], + * '#states' => [ + * 'invisible' => [ + * 'input[name="needs_accommodation"]' => ['checked' => FALSE], + * ], + * ], + * ]; * - * $form['accommodation']['diet'] = array( + * $form['accommodation']['diet'] = [ * '#type' => 'textfield', * '#title' => $this->t('Dietary Restrictions'), - * ); + * ]; * @endcode * * @RenderElement("container") diff --git a/web/core/lib/Drupal/Core/Template/TwigEnvironment.php b/web/core/lib/Drupal/Core/Template/TwigEnvironment.php index a3a830411686f3fbb7c84c87e81427cc578722a7..233521f23f83b664d14a6f6100ebb37773095181 100644 --- a/web/core/lib/Drupal/Core/Template/TwigEnvironment.php +++ b/web/core/lib/Drupal/Core/Template/TwigEnvironment.php @@ -137,7 +137,7 @@ public function getTemplateClass($name, $index = NULL) { // node.html.twig for the output of each node and the same compiled class. $cache_index = $name . (NULL === $index ? '' : '_' . $index); if (!isset($this->templateClasses[$cache_index])) { - $this->templateClasses[$cache_index] = $this->templateClassPrefix . hash('sha256', $this->loader->getCacheKey($name)) . (NULL === $index ? '' : '_' . $index); + $this->templateClasses[$cache_index] = parent::getTemplateClass($name, $index); } return $this->templateClasses[$cache_index]; } diff --git a/web/core/lib/Drupal/Core/Template/TwigNodeTrans.php b/web/core/lib/Drupal/Core/Template/TwigNodeTrans.php index c0691dbca6ad4523bb75a03325041ab741f643bd..aad9d0b069fe0e0e3b02ef2dc2d1853d702dfeca 100644 --- a/web/core/lib/Drupal/Core/Template/TwigNodeTrans.php +++ b/web/core/lib/Drupal/Core/Template/TwigNodeTrans.php @@ -2,6 +2,8 @@ namespace Drupal\Core\Template; +use Twig\Node\CheckToStringNode; + /** * A class that defines the Twig 'trans' tag for Drupal. * @@ -113,6 +115,9 @@ protected function compileString(\Twig_Node $body) { $n = $n->getNode('node'); } + if ($n instanceof CheckToStringNode) { + $n = $n->getNode('expr'); + } $args = $n; // Support TwigExtension->renderVar() function in chain. @@ -134,6 +139,9 @@ protected function compileString(\Twig_Node $body) { } $args = $args->getNode('node'); } + if ($args instanceof CheckToStringNode) { + $args = $args->getNode('expr'); + } if ($args instanceof \Twig_Node_Expression_GetAttr) { $argName = []; // Reuse the incoming expression. diff --git a/web/core/lib/Drupal/Core/Update/UpdateKernel.php b/web/core/lib/Drupal/Core/Update/UpdateKernel.php index d5051a7916c2df54d0ad93e7a47590168fe0f76f..1b993b4061ea8d705845f10f4583533a5afbd613 100644 --- a/web/core/lib/Drupal/Core/Update/UpdateKernel.php +++ b/web/core/lib/Drupal/Core/Update/UpdateKernel.php @@ -218,7 +218,18 @@ public static function fixSerializedExtensionObjects(ContainerInterface $contain // created by Drupal <= 8.6.7 then when it is read by Drupal >= 8.6.8 there // will be PHP warnings. This silently fixes Drupal so that the update can // continue. - $callable = function () use ($container) { + $clear_caches = FALSE; + $callable = function ($errno, $errstr) use ($container, &$clear_caches) { + if ($errstr === 'Class Drupal\Core\Extension\Extension has no unserializer') { + $clear_caches = TRUE; + } + }; + + set_error_handler($callable, E_ERROR | E_WARNING); + $container->get('state')->get('system.theme.data', []); + restore_error_handler(); + + if ($clear_caches) { // Reset static caches in profile list so the module list is rebuilt // correctly. $container->get('extension.list.profile')->reset(); @@ -227,11 +238,7 @@ public static function fixSerializedExtensionObjects(ContainerInterface $contain } // Also rebuild themes because it uses state as cache. $container->get('theme_handler')->refreshInfo(); - }; - - set_error_handler($callable, E_ERROR | E_WARNING); - $container->get('state')->get('system.theme.data', []); - restore_error_handler(); + } } } diff --git a/web/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php b/web/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php index 3b8fd036f95ce005306f5d0fd9ce83034bd515a0..3c34ec9665e29ac9894198b3147201da3c0defb7 100644 --- a/web/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php +++ b/web/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php @@ -23,9 +23,16 @@ public function validate($items, Constraint $constraint) { $entity_type_id = $entity->getEntityTypeId(); $id_key = $entity->getEntityType()->getKey('id'); - $value_taken = (bool) \Drupal::entityQuery($entity_type_id) - // The id could be NULL, so we cast it to 0 in that case. - ->condition($id_key, (int) $items->getEntity()->id(), '<>') + $query = \Drupal::entityQuery($entity_type_id); + + $entity_id = $entity->id(); + // Using isset() instead of !empty() as 0 and '0' are valid ID values for + // entity types using string IDs. + if (isset($entity_id)) { + $query->condition($id_key, $entity_id, '<>'); + } + + $value_taken = (bool) $query ->condition($field_name, $item->value) ->range(0, 1) ->count() diff --git a/web/core/misc/states.es6.js b/web/core/misc/states.es6.js index 811a5112d1746cbc3bd65608cf54e56f12dc0e2d..ccf99937182e3d9a42d8325d07d89f0102da517d 100644 --- a/web/core/misc/states.es6.js +++ b/web/core/misc/states.es6.js @@ -695,7 +695,7 @@ if (e.value) { const label = `label${e.target.id ? `[for=${e.target.id}]` : ''}`; const $label = $(e.target) - .attr({ required: 'required', 'aria-required': 'aria-required' }) + .attr({ required: 'required', 'aria-required': 'true' }) .closest('.js-form-item, .js-form-wrapper') .find(label); // Avoids duplicate required markers on initialization. diff --git a/web/core/misc/states.js b/web/core/misc/states.js index 7b451b07dec9c55526461602ac7860ae7738dee0..1da26592bcca29b40c42ca966bbd229dea5c4be7 100644 --- a/web/core/misc/states.js +++ b/web/core/misc/states.js @@ -352,7 +352,7 @@ if (e.trigger) { if (e.value) { var label = 'label' + (e.target.id ? '[for=' + e.target.id + ']' : ''); - var $label = $(e.target).attr({ required: 'required', 'aria-required': 'aria-required' }).closest('.js-form-item, .js-form-wrapper').find(label); + var $label = $(e.target).attr({ required: 'required', 'aria-required': 'true' }).closest('.js-form-item, .js-form-wrapper').find(label); if (!$label.hasClass('js-form-required').length) { $label.addClass('js-form-required form-required'); diff --git a/web/core/modules/block/tests/src/Functional/Update/BlockConditionMissingSchemaUpdateTest.php b/web/core/modules/block/tests/src/Functional/Update/BlockConditionMissingSchemaUpdateTest.php index 79c3beaacf1f3c1adaac8e9322b4f97cee755085..751dd54170a6be3a46dd0681d3f2fdb8ed44d236 100644 --- a/web/core/modules/block/tests/src/Functional/Update/BlockConditionMissingSchemaUpdateTest.php +++ b/web/core/modules/block/tests/src/Functional/Update/BlockConditionMissingSchemaUpdateTest.php @@ -14,17 +14,6 @@ */ class BlockConditionMissingSchemaUpdateTest extends UpdatePathTestBase { - /** - * This test does not have a failed update but the configuration has missing - * schema so can not do the full post update testing offered by - * UpdatePathTestBase. - * - * @var bool - * - * @see \Drupal\system\Tests\Update\UpdatePathTestBase::runUpdates() - */ - protected $checkFailedUpdates = FALSE; - /** * {@inheritdoc} */ diff --git a/web/core/modules/config_translation/migrations/d7_field_instance_label_description_translation.yml b/web/core/modules/config_translation/migrations/d7_field_instance_label_description_translation.yml new file mode 100644 index 0000000000000000000000000000000000000000..07dbcd87d25055b3b204f619882e2f866f38d2eb --- /dev/null +++ b/web/core/modules/config_translation/migrations/d7_field_instance_label_description_translation.yml @@ -0,0 +1,62 @@ +id: d7_field_instance_label_description_translation +label: Field label and description translation +migration_tags: + - Drupal 7 + - Configuration + - Multilingual +class: Drupal\migrate_drupal\Plugin\migrate\FieldMigration +field_plugin_method: alterFieldInstanceMigration +source: + plugin: d7_field_instance_label_description_translation +process: + langcode: + plugin: skip_on_empty + source: language + method: row + translation: + plugin: skip_on_empty + source: translation + method: row + entity_type_exists: + plugin: skip_on_empty + source: entity_type + method: row + objectid_exists: + plugin: skip_on_empty + source: objectid + method: row + type_exists: + plugin: skip_on_empty + source: type + method: row + exists: + - + plugin: migration_lookup + migration: d7_field_instance + source: + - entity_type + - objectid + - type + - + plugin: skip_on_empty + method: row + bundle: objectid + property: + plugin: static_map + source: property + bypass: true + map: + label: label + description: description + title_value: label + entity_type: entity_type + field_name: type +destination: + plugin: entity:field_config +migration_dependencies: + required: + - d7_field_instance + optional: + - d7_node_type + - d7_comment_type + - d7_taxonomy_vocabulary diff --git a/web/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php b/web/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php index 87e1b22c8d9cb468396c29ccf13948f8031d2603..f07e7804b4a6a0e5dff1149982a91db569d83537 100644 --- a/web/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php +++ b/web/core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php @@ -54,7 +54,7 @@ public function enforceRevisionsEntityFormAlter(array &$form, FormStateInterface */ public function enforceRevisionsBundleFormAlter(array &$form, FormStateInterface $form_state, $form_id) { // Force the revision checkbox on. - $form['workflow']['options']['#value']['revision'] = 'revision'; + $form['workflow']['options']['revision']['#value'] = 'revision'; $form['workflow']['options']['revision']['#disabled'] = TRUE; } diff --git a/web/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php b/web/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php index e8d8ccd8df0606eba698e3a3ad1742b3d47424e3..a0a5fe01f8d53e67653b200c43b06de631f733be 100644 --- a/web/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php +++ b/web/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php @@ -88,4 +88,21 @@ public function testEnablingOnExistingContent() { $this->assertSession()->optionExists('moderation_state[0][state]', 'published'); } + /** + * @covers \Drupal\content_moderation\Entity\Handler\NodeModerationHandler::enforceRevisionsBundleFormAlter + */ + public function testEnforceRevisionsEntityFormAlter() { + $this->drupalLogin($this->adminUser); + $this->createContentTypeFromUi('Moderated', 'moderated'); + + // Ensure checkboxes in the 'workflow' section can be altered, even when + // 'revision' is enforced and disabled. + $this->drupalGet('admin/structure/types/manage/moderated'); + $this->drupalPostForm('admin/structure/types/manage/moderated', [ + 'options[promote]' => TRUE, + ], 'Save content type'); + $this->drupalGet('admin/structure/types/manage/moderated'); + $this->assertSession()->checkboxChecked('options[promote]'); + } + } diff --git a/web/core/modules/datetime/tests/src/Functional/DateTimeTimeAgoFormatterTest.php b/web/core/modules/datetime/tests/src/Functional/DateTimeTimeAgoFormatterTest.php index 5c9bafb13b84aadb61d497fa69ceb36bececd95a..2aa9c5fbb8aa6e731d39dc952aec6e11775e89bd 100644 --- a/web/core/modules/datetime/tests/src/Functional/DateTimeTimeAgoFormatterTest.php +++ b/web/core/modules/datetime/tests/src/Functional/DateTimeTimeAgoFormatterTest.php @@ -110,13 +110,13 @@ public function testSettings() { $edit = [ 'fields[field_datetime][settings_edit_form][settings][future_format]' => 'ends in @interval', 'fields[field_datetime][settings_edit_form][settings][past_format]' => 'started @interval ago', - 'fields[field_datetime][settings_edit_form][settings][granularity]' => 3, + 'fields[field_datetime][settings_edit_form][settings][granularity]' => 1, ]; $this->drupalPostForm(NULL, $edit, 'Update'); $this->drupalPostForm(NULL, [], 'Save'); - $this->assertSession()->pageTextContains('ends in 1 year 1 month 1 week'); - $this->assertSession()->pageTextContains('started 1 year 1 month 1 week ago'); + $this->assertSession()->pageTextContains('ends in 1 year'); + $this->assertSession()->pageTextContains('started 1 year ago'); } } diff --git a/web/core/modules/field/src/Plugin/migrate/source/d7/FieldLabelDescriptionTranslation.php b/web/core/modules/field/src/Plugin/migrate/source/d7/FieldLabelDescriptionTranslation.php new file mode 100644 index 0000000000000000000000000000000000000000..805108d2c9cb25d7d4e702f4098c0b593007ea99 --- /dev/null +++ b/web/core/modules/field/src/Plugin/migrate/source/d7/FieldLabelDescriptionTranslation.php @@ -0,0 +1,93 @@ +<?php + +namespace Drupal\field\Plugin\migrate\source\d7; + +use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; + +/** + * Gets field label and description translations. + * + * @MigrateSource( + * id = "d7_field_instance_label_description_translation", + * source_module = "i18n_field" + * ) + */ +class FieldLabelDescriptionTranslation extends DrupalSqlBase { + + /** + * {@inheritdoc} + */ + public function query() { + // Get translations for field labels and descriptions. + $query = $this->select('i18n_string', 'i18n') + ->fields('i18n') + ->fields('lt', [ + 'lid', + 'translation', + 'language', + 'plid', + 'plural', + 'i18n_status', + ]) + ->fields('fci', [ + 'id', + 'field_id', + 'field_name', + 'entity_type', + 'bundle', + 'data', + 'deleted', + ]) + ->condition('i18n.textgroup', 'field') + ->isNotNull('language') + ->isNotNull('translation'); + $condition = $query->orConditionGroup() + ->condition('textgroup', 'field') + ->condition('objectid', '#allowed_values', '!='); + $query->condition($condition); + $query->leftJoin('locales_target', 'lt', 'lt.lid = i18n.lid'); + + $query->leftjoin('field_config_instance', 'fci', 'fci.bundle = i18n.objectid AND fci.field_name = i18n.type'); + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return [ + 'lid' => $this->t('Locales target language ID.'), + 'textgroup' => $this->t('A module defined group of translations'), + 'context' => $this->t('Full string ID for quick search: type:objectid:property.'), + 'objectid' => $this->t('Object ID'), + 'type' => $this->t('Object type for this string'), + 'property' => $this->t('Object property for this string'), + 'objectindex' => $this->t('Integer value of Object ID'), + 'format' => $this->t('The {filter_format}.format of the string'), + 'translation' => $this->t('Translation'), + 'language' => $this->t('Language code'), + 'plid' => $this->t('Parent lid'), + 'plural' => $this->t('Plural index number'), + 'i18n_status' => $this->t('Translation needs update'), + 'id' => $this->t('The field instance ID.'), + 'field_id' => $this->t('The field ID.'), + 'field_name' => $this->t('The field name.'), + 'entity_type' => $this->t('The entity type.'), + 'bundle' => $this->t('The entity bundle.'), + 'data' => $this->t('The field instance data.'), + 'deleted' => $this->t('Deleted'), + ]; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['property']['type'] = 'string'; + $ids['language']['type'] = 'string'; + $ids['lid']['type'] = 'integer'; + $ids['lid']['alias'] = 'lt'; + return $ids; + } + +} diff --git a/web/core/modules/field/tests/src/Functional/Update/FieldUpdateTest.php b/web/core/modules/field/tests/src/Functional/Update/FieldUpdateTest.php index 67c72dc58765581e27f2bc83523ae8098b23f029..bec6e96546ace8289943e34ab8ef79ead10fb383 100644 --- a/web/core/modules/field/tests/src/Functional/Update/FieldUpdateTest.php +++ b/web/core/modules/field/tests/src/Functional/Update/FieldUpdateTest.php @@ -48,13 +48,6 @@ class FieldUpdateTest extends UpdatePathTestBase { */ protected $state; - /** - * The deleted fields repository. - * - * @var \Drupal\Core\Field\DeletedFieldsRepositoryInterface - */ - protected $deletedFieldsRepository; - /** * {@inheritdoc} */ @@ -65,7 +58,6 @@ protected function setUp() { $this->database = $this->container->get('database'); $this->installedStorageSchema = $this->container->get('keyvalue')->get('entity.storage_schema.sql'); $this->state = $this->container->get('state'); - $this->deletedFieldsRepository = $this->container->get('entity_field.deleted_fields_repository'); } /** @@ -193,16 +185,18 @@ public function testFieldUpdate8500() { // Run updates. $this->runUpdates(); + $deleted_fields_repository = \Drupal::service('entity_field.deleted_fields_repository'); + // Now that we can use the API, check that the "delete fields" state entries // have been converted to proper field definition objects. - $deleted_fields = $this->deletedFieldsRepository->getFieldDefinitions(); + $deleted_fields = $deleted_fields_repository->getFieldDefinitions(); $this->assertCount(1, $deleted_fields); $this->assertArrayHasKey($field_uuid, $deleted_fields); $this->assertTrue($deleted_fields[$field_uuid] instanceof FieldDefinitionInterface); $this->assertEquals($field_name, $deleted_fields[$field_uuid]->getName()); - $deleted_field_storages = $this->deletedFieldsRepository->getFieldStorageDefinitions(); + $deleted_field_storages = $deleted_fields_repository->getFieldStorageDefinitions(); $this->assertCount(1, $deleted_field_storages); $this->assertArrayHasKey($field_storage_uuid, $deleted_field_storages); $this->assertTrue($deleted_field_storages[$field_storage_uuid] instanceof FieldStorageDefinitionInterface); @@ -223,10 +217,10 @@ public function testFieldUpdate8500() { // Run cron and repeat the checks above. $this->cronRun(); - $deleted_fields = $this->deletedFieldsRepository->getFieldDefinitions(); + $deleted_fields = $deleted_fields_repository->getFieldDefinitions(); $this->assertCount(0, $deleted_fields); - $deleted_field_storages = $this->deletedFieldsRepository->getFieldStorageDefinitions(); + $deleted_field_storages = $deleted_fields_repository->getFieldStorageDefinitions(); $this->assertCount(0, $deleted_field_storages); // Check that the installed storage schema has been deleted. diff --git a/web/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceLabelDescriptionTest.php b/web/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceLabelDescriptionTest.php index 5d51972d72f589e05d40327ab12c20478a0fa7e4..fe99f5a261804ff33608beac17e39d2aa2995e68 100644 --- a/web/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceLabelDescriptionTest.php +++ b/web/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceLabelDescriptionTest.php @@ -8,7 +8,7 @@ use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase; /** - * Tests migration field label and description i18n translations. + * Tests migration of field label and description translations. * * @group migrate_drupal_6 * @group legacy @@ -57,7 +57,7 @@ public static function migrateDumpAlter(KernelTestBase $test) { } /** - * Tests migration of file variables to file.settings.yml. + * Tests migration of field label and description translations. */ public function testFieldInstanceLabelDescriptionTranslationMigration() { $language_manager = $this->container->get('language_manager'); diff --git a/web/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceLabelDescriptionTest.php b/web/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceLabelDescriptionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..17ffd2f82e0ce81444e16859130f3e6af1030c2a --- /dev/null +++ b/web/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceLabelDescriptionTest.php @@ -0,0 +1,113 @@ +<?php + +namespace Drupal\Tests\field\Kernel\Migrate\d7; + +use Drupal\Core\Database\Database; +use Drupal\KernelTests\KernelTestBase; +use Drupal\Tests\migrate\Kernel\MigrateDumpAlterInterface; +use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; + +/** + * Tests migration field label and description i18n translations. + * + * @group migrate_drupal_7 + * @group legacy + */ +class MigrateFieldInstanceLabelDescriptionTest extends MigrateDrupal7TestBase implements MigrateDumpAlterInterface { + + /** + * {@inheritdoc} + */ + public static $modules = [ + 'comment', + 'config_translation', + 'datetime', + 'field', + 'file', + 'image', + 'language', + 'link', + 'locale', + 'menu_ui', + // Required for translation migrations. + 'migrate_drupal_multilingual', + 'node', + 'system', + 'taxonomy', + 'telephone', + 'text', + ]; + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + + $this->installEntitySchema('node'); + $this->installEntitySchema('comment'); + $this->installEntitySchema('taxonomy_term'); + $this->installConfig(static::$modules); + + $this->executeMigrations([ + 'd7_node_type', + 'd7_comment_type', + 'd7_taxonomy_vocabulary', + 'd7_field', + 'd7_field_instance', + 'd7_field_instance_widget_settings', + 'language', + 'd7_field_instance_label_description_translation', + ]); + } + + /** + * {@inheritdoc} + */ + public static function migrateDumpAlter(KernelTestBase $test) { + $db = Database::getConnection('default', 'migrate'); + // Alter the database to test the migration is successful when a translated + // field is deleted but the translation data for that field remains in both + // the i18n_strings and locales_target tables. + $db->delete('field_config_instance') + ->condition('field_name', 'field_image') + ->condition('bundle', 'article') + ->execute(); + } + + /** + * Tests migration of file variables to file.settings.yml. + */ + public function testFieldInstanceLabelDescriptionTranslationMigration() { + $language_manager = $this->container->get('language_manager'); + + // Check that the deleted field with translations was skipped. + $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.node.article.field_image'); + $this->assertNull($config_translation->get('label')); + $this->assertNull($config_translation->get('description')); + + // Tests fields on 'test_content_type' node type. + $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.node.test_content_type.field_email'); + $this->assertNull($config_translation->get('label')); + $this->assertSame("fr - The email help text.", $config_translation->get('description')); + + $config_translation = $language_manager->getLanguageConfigOverride('is', 'field.field.node.test_content_type.field_email'); + $this->assertSame("is - Email", $config_translation->get('label')); + $this->assertSame("is - The email help text.", $config_translation->get('description')); + + $config_translation = $language_manager->getLanguageConfigOverride('is', 'field.field.node.test_content_type.field_boolean'); + $this->assertSame("is - Some helpful text.", $config_translation->get('description')); + + // Tests fields on 'article' node type. + $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.node.article.body'); + $this->assertSame("fr - Body", $config_translation->get('label')); + + $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.node.article.field_link'); + $this->assertSame("fr - Link", $config_translation->get('label')); + + // Tests fields on 'test_vocabulary' vocabulary type. + $config_translation = $language_manager->getLanguageConfigOverride('is', 'field.field.taxonomy_term.test_vocabulary.field_term_reference'); + $this->assertSame("is - Term Reference", $config_translation->get('label')); + } + +} diff --git a/web/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php b/web/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4f7bce2c43b71532cc7f992307efe685af4441cd --- /dev/null +++ b/web/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php @@ -0,0 +1,131 @@ +<?php + +namespace Drupal\Tests\field\Kernel\Plugin\migrate\source\d7; + +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; + +/** + * Tests the field label and description translation source plugin. + * + * @covers \Drupal\field\Plugin\migrate\source\d7\FieldLabelDescriptionTranslation + * @group migrate_drupal + */ +class FieldInstanceLabelDescriptionTranslationTest extends MigrateSqlSourceTestBase { + + /** + * {@inheritdoc} + */ + public static $modules = ['config_translation', 'migrate_drupal', 'field']; + + /** + * {@inheritdoc} + */ + public function providerSource() { + $test = []; + + // The source data. + $test[0]['source_data'] = [ + 'i18n_string' => [ + [ + 'lid' => 10, + 'textgroup' => 'field', + 'objectid' => 'story', + 'type' => 'field_image', + 'property' => 'label', + ], + [ + 'lid' => 11, + 'textgroup' => 'field', + 'objectid' => 'story', + 'type' => 'field_image', + 'property' => 'description', + ], + [ + 'lid' => 12, + 'textgroup' => 'field', + 'objectid' => 'forum', + 'type' => 'taxonomy_forums', + 'property' => 'label', + ], + ], + 'locales_target' => [ + [ + 'lid' => 10, + 'translation' => 'fr - story label', + 'language' => 'fr', + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + [ + 'lid' => 11, + 'translation' => 'fr - story description', + 'language' => 'fr', + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + [ + 'lid' => 12, + 'translation' => 'zu - term reference', + 'language' => 'zu', + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + ], + 'field_config_instance' => [ + [ + 'id' => '2', + 'field_id' => '2', + 'field_name' => 'field_image', + 'entity_type' => 'node', + 'bundle' => 'story', + 'data' => 'a:0:{}', + 'deleted' => '0', + ], + [ + 'id' => '3', + 'field_id' => '3', + 'field_name' => 'field_image', + 'entity_type' => 'node', + 'bundle' => 'article', + 'data' => 'a:0:{}', + 'deleted' => '0', + ], + [ + 'id' => '3', + 'field_id' => '4', + 'field_name' => 'field_term_reference', + 'entity_type' => 'taxonomy_term', + 'bundle' => 'trees', + 'data' => 'a:0:{}', + 'deleted' => '0', + ], + ], + ]; + + $test[0]['expected_results'] = [ + [ + 'property' => 'label', + 'translation' => "fr - story label", + 'language' => 'fr', + 'lid' => '10', + ], + [ + 'property' => 'description', + 'translation' => 'fr - story description', + 'language' => 'fr', + 'lid' => '11', + ], + [ + 'property' => 'label', + 'translation' => 'zu - term reference', + 'language' => 'zu', + 'lid' => '12', + ], + ]; + return $test; + } + +} diff --git a/web/core/modules/file/file.module b/web/core/modules/file/file.module index 0eb9a64ec7aad0c633fe21009f8dd449340ccbdd..58a2b8e1a96633be46c517fc359fd17f20be7e66 100644 --- a/web/core/modules/file/file.module +++ b/web/core/modules/file/file.module @@ -1022,7 +1022,13 @@ function _file_save_upload_single(\SplFileInfo $file_info, $form_field_name, $va if (substr($destination, -1) != '/') { $destination .= '/'; } - $file->destination = file_destination($destination . $file->getFilename(), $replace); + try { + $file->destination = file_destination($destination . $file->getFilename(), $replace); + } + catch (\RuntimeException $e) { + \Drupal::messenger()->addError(t('The file %filename could not be uploaded because the name is invalid.', ['%filename' => $file->getFilename()])); + return FALSE; + } // If file_destination() returns FALSE then $replace === FILE_EXISTS_ERROR and // there's an existing file so we need to bail. if ($file->destination === FALSE) { @@ -1076,6 +1082,10 @@ function _file_save_upload_single(\SplFileInfo $file_info, $form_field_name, $va } } + // Update the filename with any changes as a result of security or renaming + // due to an existing file. + $file->setFilename(\Drupal::service('file_system')->basename($file->destination)); + // If we made it this far it's safe to record this file in the database. $file->save(); diff --git a/web/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php b/web/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php index 44600369df671ea00003d9904d8959b7250ea799..f70e288bff2c71cc45bbe8ecb39b5ed870254a9d 100644 --- a/web/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php +++ b/web/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php @@ -322,8 +322,8 @@ protected function streamUploadData() { fclose($temp_file); } else { - // Close the file streams. - fclose($temp_file); + // Close the input file stream since we can't proceed with the upload. + // Don't try to close $temp_file since it's FALSE at this point. fclose($file_data); $this->logger->error('Temporary file "%path" could not be opened for file upload', ['%path' => $temp_file_path]); throw new HttpException(500, 'Temporary file could not be opened'); @@ -374,7 +374,7 @@ protected function validateAndParseContentDispositionHeader(Request $request) { // Make sure only the filename component is returned. Path information is // stripped as per https://tools.ietf.org/html/rfc6266#section-4.3. - return basename($filename); + return $this->fileSystem->basename($filename); } /** diff --git a/web/core/modules/file/src/Tests/FileFieldWidgetTest.php b/web/core/modules/file/src/Tests/FileFieldWidgetTest.php index 3102bd744d79252cbc07f42ad97d89ca1a4e2247..e1fa4e4b2c44f91f35fe73cfe215ed8860479e96 100644 --- a/web/core/modules/file/src/Tests/FileFieldWidgetTest.php +++ b/web/core/modules/file/src/Tests/FileFieldWidgetTest.php @@ -259,7 +259,7 @@ public function testMultiValuedWidget() { '%field' => $field_name, '@max' => $cardinality, '@count' => count($upload_files_node_creation) + count($upload_files_node_revision), - '%list' => implode(', ', array_fill(0, 3, $test_file->getFilename())), + '%list' => implode(', ', ['text-0_2.txt', 'text-0_3.txt', 'text-0_4.txt']), ]; $this->assertRaw(t('Field %field can only hold @max values but there were @count uploaded. The following files have been omitted as a result: %list.', $args)); $node_storage->resetCache([$nid]); @@ -291,7 +291,7 @@ public function testMultiValuedWidget() { '%field' => $field_name, '@max' => $cardinality, '@count' => count($upload_files), - '%list' => $test_file->getFileName(), + '%list' => 'text-0_12.txt', ]; $this->assertRaw(t('Field %field can only hold @max values but there were @count uploaded. The following files have been omitted as a result: %list.', $args)); } diff --git a/web/core/modules/file/tests/src/Functional/SaveUploadTest.php b/web/core/modules/file/tests/src/Functional/SaveUploadTest.php index bebf47e076e2821869a5ac31199dc648fd7d0069..870d599eb1c4886d9c00b708440eaabc5f887b80 100644 --- a/web/core/modules/file/tests/src/Functional/SaveUploadTest.php +++ b/web/core/modules/file/tests/src/Functional/SaveUploadTest.php @@ -2,6 +2,8 @@ namespace Drupal\Tests\file\Functional; +use Drupal\Component\Render\FormattableMarkup; +use Drupal\Core\Url; use Drupal\file\Entity\File; use Drupal\Tests\TestFileCreationTrait; @@ -206,6 +208,7 @@ public function testHandleDangerousFile() { $this->assertResponse(200, 'Received a 200 response for posted test file.'); $message = t('For security reasons, your upload has been renamed to') . ' <em class="placeholder">' . $this->phpfile->filename . '.txt' . '</em>'; $this->assertRaw($message, 'Dangerous file was renamed.'); + $this->assertSession()->pageTextContains('File name is php-2.php.txt.'); $this->assertRaw(t('File MIME type is text/plain.'), "Dangerous file's MIME type was changed."); $this->assertRaw(t('You WIN!'), 'Found the success message.'); @@ -221,7 +224,7 @@ public function testHandleDangerousFile() { $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, 'Received a 200 response for posted test file.'); $this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.'); - $this->assertRaw(t('File name is @filename', ['@filename' => $this->phpfile->filename]), 'Dangerous file was not renamed when insecure uploads is TRUE.'); + $this->assertSession()->pageTextContains('File name is php-2.php.'); $this->assertRaw(t('You WIN!'), 'Found the success message.'); // Check that the correct hooks were called. @@ -291,6 +294,7 @@ public function testExistingRename() { $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, 'Received a 200 response for posted test file.'); $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertSession()->pageTextContains('File name is image-test_0.png.'); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'insert']); @@ -307,6 +311,7 @@ public function testExistingReplace() { $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, 'Received a 200 response for posted test file.'); $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertSession()->pageTextContains('File name is image-test.png.'); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'load', 'update']); @@ -365,4 +370,60 @@ public function testDrupalMovingUploadedFileError() { ]), 'Found upload error log entry.'); } + /** + * Tests that filenames containing invalid UTF-8 are rejected. + */ + public function testInvalidUtf8FilenameUpload() { + $this->drupalGet('file-test/upload'); + + // Filename containing invalid UTF-8. + $filename = "x\xc0xx.gif"; + + $page = $this->getSession()->getPage(); + $data = [ + 'multipart' => [ + [ + 'name' => 'file_test_replace', + 'contents' => FILE_EXISTS_RENAME, + ], + [ + 'name' => 'form_id', + 'contents' => '_file_test_form', + ], + [ + 'name' => 'form_build_id', + 'contents' => $page->find('hidden_field_selector', ['hidden_field', 'form_build_id'])->getAttribute('value'), + ], + [ + 'name' => 'form_token', + 'contents' => $page->find('hidden_field_selector', ['hidden_field', 'form_token'])->getAttribute('value'), + ], + [ + 'name' => 'op', + 'contents' => 'Submit', + ], + [ + 'name' => 'files[file_test_upload]', + 'contents' => 'Test content', + 'filename' => $filename, + ], + ], + 'cookies' => $this->getSessionCookies(), + 'http_errors' => FALSE, + ]; + + $this->assertFileNotExists('temporary://' . $filename); + // Use Guzzle's HTTP client directly so we can POST files without having to + // write them to disk. Not all filesystem support writing files with invalid + // UTF-8 filenames. + $response = $this->getHttpClient()->request('POST', Url::fromUri('base:file-test/upload')->setAbsolute()->toString(), $data); + + $content = (string) $response->getBody(); + $this->htmlOutput($content); + $error_text = new FormattableMarkup('The file %filename could not be uploaded because the name is invalid.', ['%filename' => $filename]); + $this->assertContains((string) $error_text, $content); + $this->assertContains('Epic upload FAIL!', $content); + $this->assertFileNotExists('temporary://' . $filename); + } + } diff --git a/web/core/modules/hal/src/Normalizer/FieldItemNormalizer.php b/web/core/modules/hal/src/Normalizer/FieldItemNormalizer.php index 5408cc436b6d003d644ae48eadb33930bbad0832..df38e856195c6ba284853e7b0ac22660055afde3 100644 --- a/web/core/modules/hal/src/Normalizer/FieldItemNormalizer.php +++ b/web/core/modules/hal/src/Normalizer/FieldItemNormalizer.php @@ -83,7 +83,7 @@ protected function constructValue($data, $context) { // being automatically serialized, manually managed serialized properties // expect to receive serialized input. foreach ($serialized_property_names as $serialized_property_name) { - if (!empty($data[$serialized_property_name])) { + if (is_array($data) && array_key_exists($serialized_property_name, $data)) { $data[$serialized_property_name] = serialize($data[$serialized_property_name]); } } diff --git a/web/core/modules/hal/tests/src/Kernel/DenormalizeTest.php b/web/core/modules/hal/tests/src/Kernel/DenormalizeTest.php index fde694fa690f362bdc8416d4ab76446d2c559946..6c6fb731c98a9e037ec953b1e9e49628f80eac6d 100644 --- a/web/core/modules/hal/tests/src/Kernel/DenormalizeTest.php +++ b/web/core/modules/hal/tests/src/Kernel/DenormalizeTest.php @@ -140,4 +140,52 @@ public function testMarkFieldForDeletion() { $this->assertEqual($entity->field_test_text->count(), 0); } + /** + * Tests normalizing/denormalizing serialized columns. + */ + public function testDenormalizeSerializedItem() { + $entity = EntitySerializedField::create(['serialized' => 'boo']); + $normalized = $this->serializer->normalize($entity, $this->format); + $this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized" field (field item class: Drupal\entity_test\Plugin\Field\FieldType\SerializedItem).'); + $this->serializer->denormalize($normalized, EntitySerializedField::class, $this->format); + } + + /** + * Tests normalizing/denormalizing invalid custom serialized fields. + */ + public function testDenormalizeInvalidCustomSerializedField() { + $entity = EntitySerializedField::create(['serialized_long' => serialize(['Hello world!'])]); + $normalized = $this->serializer->normalize($entity); + $this->assertEquals($normalized['serialized_long'][0]['value'], ['Hello world!']); + + $normalized['serialized_long'][0]['value'] = 'boo'; + $this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_long" field (field item class: Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem).'); + $this->serializer->denormalize($normalized, EntitySerializedField::class); + } + + /** + * Tests normalizing/denormalizing empty custom serialized fields. + */ + public function testDenormalizeEmptyCustomSerializedField() { + $entity = EntitySerializedField::create(['serialized_long' => serialize([])]); + $normalized = $this->serializer->normalize($entity); + $this->assertEquals([], $normalized['serialized_long'][0]['value']); + + $entity = $this->serializer->denormalize($normalized, EntitySerializedField::class); + $this->assertEquals(serialize([]), $entity->get('serialized_long')->value); + } + + /** + * Tests normalizing/denormalizing valid custom serialized fields. + */ + public function testDenormalizeValidCustomSerializedField() { + $entity = EntitySerializedField::create(['serialized_long' => serialize(['key' => 'value'])]); + $normalized = $this->serializer->normalize($entity); + $this->assertEquals(['key' => 'value'], $normalized['serialized_long'][0]['value']); + + $entity = $this->serializer->denormalize($normalized, EntitySerializedField::class); + + $this->assertEquals(serialize(['key' => 'value']), $entity->get('serialized_long')->value); + } + } diff --git a/web/core/modules/layout_builder/src/Controller/ChooseBlockController.php b/web/core/modules/layout_builder/src/Controller/ChooseBlockController.php index 9bd76bacc13f7df47d918053e167a034e4bdeb5a..76269a3c3a258ccc50f2f3aa6cc244239dfa3119 100644 --- a/web/core/modules/layout_builder/src/Controller/ChooseBlockController.php +++ b/web/core/modules/layout_builder/src/Controller/ChooseBlockController.php @@ -154,8 +154,9 @@ public function inlineBlockList(SectionStorageInterface $section_storage, $delta ]); $blocks = $this->blockManager->getGroupedDefinitions($definitions); $build = []; - if (isset($blocks['Inline blocks'])) { - $build['links'] = $this->getBlockLinks($section_storage, $delta, $region, $blocks['Inline blocks']); + $inline_blocks_category = (string) $this->t('Inline blocks'); + if (isset($blocks[$inline_blocks_category])) { + $build['links'] = $this->getBlockLinks($section_storage, $delta, $region, $blocks[$inline_blocks_category]); $build['links']['#attributes']['class'][] = 'inline-block-list'; foreach ($build['links']['#links'] as &$link) { $link['attributes']['class'][] = 'inline-block-list__item'; diff --git a/web/core/modules/layout_builder/src/Controller/LayoutBuilderController.php b/web/core/modules/layout_builder/src/Controller/LayoutBuilderController.php index 00bb40261911761f30bc0a22dcf0082578ce97e8..5686cb733cfb2b3c44efc1d8eca60c04588ed272 100644 --- a/web/core/modules/layout_builder/src/Controller/LayoutBuilderController.php +++ b/web/core/modules/layout_builder/src/Controller/LayoutBuilderController.php @@ -6,6 +6,7 @@ use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Plugin\PluginFormInterface; +use Drupal\Core\Render\Element; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\Url; use Drupal\layout_builder\Context\LayoutBuilderContextTrait; @@ -209,7 +210,7 @@ protected function buildAdministrativeSection(SectionStorageInterface $section_s foreach ($layout_definition->getRegions() as $region => $info) { if (!empty($build[$region])) { - foreach ($build[$region] as $uuid => $block) { + foreach (Element::children($build[$region]) as $uuid) { $build[$region][$uuid]['#attributes']['class'][] = 'draggable'; $build[$region][$uuid]['#attributes']['data-layout-block-uuid'] = $uuid; $build[$region][$uuid]['#contextual_links'] = [ diff --git a/web/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php b/web/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php index d35041d03d8fe09835e442cf85cd3b538b2d5c20..8d83d4e07bb779dc67f5eead7a50b038cbcad9ac 100644 --- a/web/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php +++ b/web/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php @@ -99,7 +99,7 @@ public function setSectionList(SectionListInterface $section_list) { } /** - * Gets the entity storing the overrides. + * Gets the entity storing the defaults. * * @return \Drupal\layout_builder\Entity\LayoutEntityDisplayInterface * The entity storing the defaults. diff --git a/web/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php b/web/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php index bba10ef67f39959df3f61592d18b25bfca836261..07d679b023b4dcbf3edab8ac0b4ce707692f1252 100644 --- a/web/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php +++ b/web/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php @@ -146,13 +146,17 @@ public function getSectionListFromId($id) { */ public function buildRoutes(RouteCollection $collection) { foreach ($this->getEntityTypes() as $entity_type_id => $entity_type) { + // If the canonical route does not exist, do not provide any Layout + // Builder UI routes for this entity type. + if (!$collection->get("entity.$entity_type_id.canonical")) { + continue; + } + $defaults = []; $defaults['entity_type_id'] = $entity_type_id; - $requirements = []; - if ($this->hasIntegerId($entity_type)) { - $requirements[$entity_type_id] = '\d+'; - } + // Retrieve the requirements from the canonical route. + $requirements = $collection->get("entity.$entity_type_id.canonical")->getRequirements(); $options = []; // Ensure that upcasting is run in the correct order. diff --git a/web/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestPlugin.php b/web/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestPlugin.php new file mode 100644 index 0000000000000000000000000000000000000000..de0ee7d0791382ce185018073090a8fc0affb07b --- /dev/null +++ b/web/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestPlugin.php @@ -0,0 +1,29 @@ +<?php + +namespace Drupal\layout_builder_test\Plugin\Layout; + +use Drupal\Core\Layout\LayoutDefault; + +/** + * @Layout( + * id = "layout_builder_test_plugin", + * label = @Translation("Layout Builder Test Plugin"), + * regions = { + * "main" = { + * "label" = @Translation("Main Region") + * } + * }, + * ) + */ +class LayoutBuilderTestPlugin extends LayoutDefault { + + /** + * {@inheritdoc} + */ + public function build(array $regions) { + $build = parent::build($regions); + $build['main']['#attributes']['class'][] = 'go-birds'; + return $build; + } + +} diff --git a/web/core/modules/layout_builder/tests/src/Functional/LayoutBuilderMultilingualTest.php b/web/core/modules/layout_builder/tests/src/Functional/LayoutBuilderMultilingualTest.php new file mode 100644 index 0000000000000000000000000000000000000000..683d6012df9dd918bbf5eb70ac7c93f5ec891541 --- /dev/null +++ b/web/core/modules/layout_builder/tests/src/Functional/LayoutBuilderMultilingualTest.php @@ -0,0 +1,114 @@ +<?php + +namespace Drupal\Tests\layout_builder\Functional; + +use Drupal\block_content\Entity\BlockContentType; +use Drupal\language\Entity\ConfigurableLanguage; +use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay; +use Drupal\Tests\BrowserTestBase; + +/** + * Tests Layout Builder functionality with multiple languages installed. + * + * @group layout_builder + */ +class LayoutBuilderMultilingualTest extends BrowserTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'layout_builder', + 'node', + 'block_content', + 'content_translation', + 'locale', + ]; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + // @todo The Layout Builder UI relies on local tasks; fix in + // https://www.drupal.org/project/drupal/issues/2917777. + $this->drupalPlaceBlock('local_tasks_block'); + + // There must be more than one block type available to trigger + // \Drupal\layout_builder\Controller\ChooseBlockController::inlineBlockList(). + BlockContentType::create([ + 'id' => 'first_type', + 'label' => 'First type', + ])->save(); + BlockContentType::create([ + 'id' => 'second_type', + 'label' => 'Second type', + ])->save(); + + // Create a translatable content type with layout overrides enabled. + $this->createContentType([ + 'type' => 'bundle_with_section_field', + ]); + $this->container->get('content_translation.manager')->setEnabled('node', 'bundle_with_section_field', TRUE); + LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default') + ->enableLayoutBuilder() + ->setOverridable() + ->save(); + + // Create a second language. + ConfigurableLanguage::createFromLangcode('es')->save(); + + // Create a node and translate it. + $node = $this->createNode([ + 'type' => 'bundle_with_section_field', + 'title' => 'The untranslated node title', + ]); + $node->addTranslation('es', [ + 'title' => 'The translated node title', + ]); + $node->save(); + + $this->drupalLogin($this->createUser([ + 'configure any layout', + 'translate interface', + ])); + } + + /** + * Tests that custom blocks are available for translated entities. + */ + public function testCustomBlocks() { + // Check translated and untranslated entities before translating the string. + $this->assertCustomBlocks('node/1'); + $this->assertCustomBlocks('es/node/1'); + + // Translate the 'Inline blocks' string used as a category in + // \Drupal\layout_builder\Controller\ChooseBlockController::inlineBlockList(). + $this->drupalPostForm('admin/config/regional/translate', ['string' => 'Inline blocks'], 'Filter'); + $this->drupalPostForm(NULL, ['Translated string (Spanish)' => 'Bloques en linea'], 'Save translations'); + + // Check translated and untranslated entities after translating the string. + $this->assertCustomBlocks('node/1'); + $this->assertCustomBlocks('es/node/1'); + } + + /** + * Asserts that custom blocks are available. + * + * @param string $url + * The URL for a Layout Builder enabled entity. + */ + protected function assertCustomBlocks($url) { + $page = $this->getSession()->getPage(); + $assert_session = $this->assertSession(); + + $this->drupalGet($url); + $page->clickLink('Layout'); + $page->clickLink('Add Block'); + $page->clickLink('Create custom block'); + $assert_session->linkExists('First type'); + $assert_session->linkExists('Second type'); + } + +} diff --git a/web/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php b/web/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php index eb7f5a28b861e2874a0bf974aa217b343d0d0fb5..53eec4231fac9181f1d8df7d8aff4d7a478d6ea2 100644 --- a/web/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php +++ b/web/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php @@ -236,6 +236,38 @@ public function testLayoutBuilderUi() { $assert_session->elementNotExists('css', '.field--name-field-my-text'); } + /** + * Test that layout builder checks entity view access. + */ + public function testAccess() { + $assert_session = $this->assertSession(); + + $this->drupalLogin($this->drupalCreateUser([ + 'configure any layout', + 'administer node display', + ])); + + $field_ui_prefix = 'admin/structure/types/manage/bundle_with_section_field'; + // Allow overrides for the layout. + $this->drupalPostForm("$field_ui_prefix/display/default", ['layout[enabled]' => TRUE], 'Save'); + $this->drupalPostForm("$field_ui_prefix/display/default", ['layout[allow_custom]' => TRUE], 'Save'); + + $this->drupalLogin($this->drupalCreateUser(['configure any layout'])); + $this->drupalGet('node/1'); + $assert_session->pageTextContains('The first node body'); + $assert_session->pageTextNotContains('Powered by Drupal'); + $node = Node::load(1); + $node->setUnpublished(); + $node->save(); + $this->drupalGet('node/1'); + $assert_session->pageTextNotContains('The first node body'); + $assert_session->pageTextContains('Access denied'); + + $this->drupalGet('node/1/layout'); + $assert_session->pageTextNotContains('The first node body'); + $assert_session->pageTextContains('Access denied'); + } + /** * Tests that a non-default view mode works as expected. */ @@ -536,6 +568,26 @@ public function testDeletedView() { $assert_session->pageTextNotContains('Test Block View'); } + /** + * Tests that sections can provide custom attributes. + */ + public function testCustomSectionAttributes() { + $assert_session = $this->assertSession(); + $page = $this->getSession()->getPage(); + + $this->drupalLogin($this->drupalCreateUser([ + 'configure any layout', + 'administer node display', + ])); + + $this->drupalPostForm('admin/structure/types/manage/bundle_with_section_field/display/default', ['layout[enabled]' => TRUE], 'Save'); + $page->clickLink('Manage layout'); + $page->clickLink('Add Section'); + $page->clickLink('Layout Builder Test Plugin'); + // See \Drupal\layout_builder_test\Plugin\Layout\LayoutBuilderTestPlugin::build(). + $assert_session->elementExists('css', '.go-birds'); + } + /** * Tests the usage of placeholders for empty blocks. * diff --git a/web/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php b/web/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php index a94be8ba17db5229498125442c45e336c0fd91f8..673319458fef7a76d69fc035c058a7cd62477602 100644 --- a/web/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php +++ b/web/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockPrivateFilesTest.php @@ -139,7 +139,7 @@ public function testPrivateFiles() { $assert_session->pageTextContains('You are not authorized to access this page'); $this->drupalGet('node/2/layout'); - $file4 = $this->createPrivateFile('drupal.txt'); + $file4 = $this->createPrivateFile('drupal_4.txt'); $this->addInlineFileBlockToLayout('The file', $file4); $this->assertSaveLayout(); diff --git a/web/core/modules/layout_builder/tests/src/Unit/OverridesSectionStorageTest.php b/web/core/modules/layout_builder/tests/src/Unit/OverridesSectionStorageTest.php index 3691fb6c711fa5c5d54df5817ce8d747d0196641..da670de330693d76aef963bd3c9bc3113c5c868e 100644 --- a/web/core/modules/layout_builder/tests/src/Unit/OverridesSectionStorageTest.php +++ b/web/core/modules/layout_builder/tests/src/Unit/OverridesSectionStorageTest.php @@ -184,6 +184,22 @@ public function testBuildRoutes() { $entity_types['no_canonical_link'] = $no_canonical_link->reveal(); $this->entityFieldManager->getFieldStorageDefinitions('no_canonical_link')->shouldNotBeCalled(); + $canonical_link_no_route = $this->prophesize(EntityTypeInterface::class); + $canonical_link_no_route->entityClassImplements(FieldableEntityInterface::class)->willReturn(TRUE); + $canonical_link_no_route->hasViewBuilderClass()->willReturn(TRUE); + $canonical_link_no_route->hasLinkTemplate('canonical')->willReturn(TRUE); + $canonical_link_no_route->getLinkTemplate('canonical')->willReturn('/entity/{entity}'); + $canonical_link_no_route->hasHandlerClass('form', 'layout_builder')->willReturn(TRUE); + $entity_types['canonical_link_no_route'] = $canonical_link_no_route->reveal(); + $this->entityFieldManager->getFieldStorageDefinitions('canonical_link_no_route')->shouldNotBeCalled(); + + $from_canonical = $this->prophesize(EntityTypeInterface::class); + $from_canonical->entityClassImplements(FieldableEntityInterface::class)->willReturn(TRUE); + $from_canonical->hasViewBuilderClass()->willReturn(TRUE); + $from_canonical->hasLinkTemplate('canonical')->willReturn(TRUE); + $from_canonical->getLinkTemplate('canonical')->willReturn('/entity/{entity}'); + $entity_types['from_canonical'] = $from_canonical->reveal(); + $with_string_id = $this->prophesize(EntityTypeInterface::class); $with_string_id->entityClassImplements(FieldableEntityInterface::class)->willReturn(TRUE); $with_string_id->hasViewBuilderClass()->willReturn(TRUE); @@ -211,6 +227,109 @@ public function testBuildRoutes() { $this->entityTypeManager->getDefinitions()->willReturn($entity_types); $expected = [ + 'entity.from_canonical.canonical' => new Route( + '/entity/{entity}', + [], + [ + 'custom requirement' => 'from_canonical_route', + ] + ), + 'entity.with_string_id.canonical' => new Route( + '/entity/{entity}' + ), + 'entity.with_integer_id.canonical' => new Route( + '/entity/{entity}', + [], + [ + 'with_integer_id' => '\d+', + ] + ), + 'layout_builder.overrides.from_canonical.view' => new Route( + '/entity/{entity}/layout', + [ + 'entity_type_id' => 'from_canonical', + 'section_storage_type' => 'overrides', + 'section_storage' => '', + 'is_rebuilding' => FALSE, + '_controller' => '\Drupal\layout_builder\Controller\LayoutBuilderController::layout', + '_title_callback' => '\Drupal\layout_builder\Controller\LayoutBuilderController::title', + ], + [ + '_has_layout_section' => 'true', + '_layout_builder_access' => 'view', + 'custom requirement' => 'from_canonical_route', + ], + [ + 'parameters' => [ + 'section_storage' => ['layout_builder_tempstore' => TRUE], + 'from_canonical' => ['type' => 'entity:from_canonical'], + ], + '_layout_builder' => TRUE, + ] + ), + 'layout_builder.overrides.from_canonical.save' => new Route( + '/entity/{entity}/layout/save', + [ + 'entity_type_id' => 'from_canonical', + 'section_storage_type' => 'overrides', + 'section_storage' => '', + '_controller' => '\Drupal\layout_builder\Controller\LayoutBuilderController::saveLayout', + ], + [ + '_has_layout_section' => 'true', + '_layout_builder_access' => 'view', + 'custom requirement' => 'from_canonical_route', + ], + [ + 'parameters' => [ + 'section_storage' => ['layout_builder_tempstore' => TRUE], + 'from_canonical' => ['type' => 'entity:from_canonical'], + ], + '_layout_builder' => TRUE, + ] + ), + 'layout_builder.overrides.from_canonical.cancel' => new Route( + '/entity/{entity}/layout/cancel', + [ + 'entity_type_id' => 'from_canonical', + 'section_storage_type' => 'overrides', + 'section_storage' => '', + '_controller' => '\Drupal\layout_builder\Controller\LayoutBuilderController::cancelLayout', + ], + [ + '_has_layout_section' => 'true', + '_layout_builder_access' => 'view', + 'custom requirement' => 'from_canonical_route', + ], + [ + 'parameters' => [ + 'section_storage' => ['layout_builder_tempstore' => TRUE], + 'from_canonical' => ['type' => 'entity:from_canonical'], + ], + '_layout_builder' => TRUE, + ] + ), + 'layout_builder.overrides.from_canonical.revert' => new Route( + '/entity/{entity}/layout/revert', + [ + 'entity_type_id' => 'from_canonical', + 'section_storage_type' => 'overrides', + 'section_storage' => '', + '_form' => '\Drupal\layout_builder\Form\RevertOverridesForm', + ], + [ + '_has_layout_section' => 'true', + '_layout_builder_access' => 'view', + 'custom requirement' => 'from_canonical_route', + ], + [ + 'parameters' => [ + 'section_storage' => ['layout_builder_tempstore' => TRUE], + 'from_canonical' => ['type' => 'entity:from_canonical'], + ], + '_layout_builder' => TRUE, + ] + ), 'layout_builder.overrides.with_string_id.view' => new Route( '/entity/{entity}/layout', [ @@ -382,6 +501,12 @@ public function testBuildRoutes() { ]; $collection = new RouteCollection(); + // Entity types that declare a link template for canonical must have a + // canonical route present in the route colletion. + $collection->add('entity.from_canonical.canonical', $expected['entity.from_canonical.canonical']); + $collection->add('entity.with_string_id.canonical', $expected['entity.with_string_id.canonical']); + $collection->add('entity.with_integer_id.canonical', $expected['entity.with_integer_id.canonical']); + $this->plugin->buildRoutes($collection); $this->assertEquals($expected, $collection->all()); $this->assertSame(array_keys($expected), array_keys($collection->all())); diff --git a/web/core/modules/link/tests/src/Kernel/LinkItemSerializationTest.php b/web/core/modules/link/tests/src/Kernel/LinkItemSerializationTest.php index dde7dc117fbdac175225c6db4f79d6da28ae3cb0..66209eff6f353d119a6e1677a3d56122e91b482d 100644 --- a/web/core/modules/link/tests/src/Kernel/LinkItemSerializationTest.php +++ b/web/core/modules/link/tests/src/Kernel/LinkItemSerializationTest.php @@ -80,4 +80,25 @@ public function testLinkSerialization() { $this->assertSame($options_expected, $deserialized->field_test->options); } + /** + * Tests the deserialization. + */ + public function testLinkDeserialization() { + // Create entity. + $entity = EntityTest::create(); + $url = 'https://www.drupal.org?test_param=test_value'; + $parsed_url = UrlHelper::parse($url); + $title = $this->randomMachineName(); + $entity->field_test->uri = $parsed_url['path']; + $entity->field_test->title = $title; + $entity->field_test->first() + ->get('options') + ->set('query', $parsed_url['query']); + $json = json_decode($this->serializer->serialize($entity, 'json'), TRUE); + $json['field_test'][0]['options'] = 'string data'; + $serialized = json_encode($json, TRUE); + $this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "options" properties of the "field_test" field (field item class: Drupal\link\Plugin\Field\FieldType\LinkItem).'); + $this->serializer->deserialize($serialized, EntityTest::class, 'json'); + } + } diff --git a/web/core/modules/migrate_drupal/tests/fixtures/drupal7.php b/web/core/modules/migrate_drupal/tests/fixtures/drupal7.php index 68171683d8277dd6e6700ef3a85fddf33671a74c..a5cffc612bdeeb9c7ba4431499e3997cee486112 100644 --- a/web/core/modules/migrate_drupal/tests/fixtures/drupal7.php +++ b/web/core/modules/migrate_drupal/tests/fixtures/drupal7.php @@ -14804,6 +14804,876 @@ )) ->values(array( 'lid' => '76', + 'textgroup' => 'field', + 'context' => 'comment_body:comment_node_page:label', + 'objectid' => 'comment_node_page', + 'type' => 'comment_body', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '77', + 'textgroup' => 'field', + 'context' => 'comment_body:comment_node_article:label', + 'objectid' => 'comment_node_article', + 'type' => 'comment_body', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '78', + 'textgroup' => 'field', + 'context' => 'comment_body:comment_node_blog:label', + 'objectid' => 'comment_node_blog', + 'type' => 'comment_body', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '79', + 'textgroup' => 'field', + 'context' => 'comment_body:comment_node_book:label', + 'objectid' => 'comment_node_book', + 'type' => 'comment_body', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '80', + 'textgroup' => 'field', + 'context' => 'comment_body:comment_node_forum:label', + 'objectid' => 'comment_node_forum', + 'type' => 'comment_body', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '81', + 'textgroup' => 'field', + 'context' => 'comment_body:comment_node_test_content_type:label', + 'objectid' => 'comment_node_test_content_type', + 'type' => 'comment_body', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '82', + 'textgroup' => 'field', + 'context' => 'body:page:label', + 'objectid' => 'page', + 'type' => 'body', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '83', + 'textgroup' => 'field', + 'context' => 'body:article:label', + 'objectid' => 'article', + 'type' => 'body', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '84', + 'textgroup' => 'field', + 'context' => 'body:blog:label', + 'objectid' => 'blog', + 'type' => 'body', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '85', + 'textgroup' => 'field', + 'context' => 'body:book:label', + 'objectid' => 'book', + 'type' => 'body', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '86', + 'textgroup' => 'field', + 'context' => 'body:forum:label', + 'objectid' => 'forum', + 'type' => 'body', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '87', + 'textgroup' => 'field', + 'context' => 'field_tags:article:label', + 'objectid' => 'article', + 'type' => 'field_tags', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '88', + 'textgroup' => 'field', + 'context' => 'field_tags:article:description', + 'objectid' => 'article', + 'type' => 'field_tags', + 'property' => 'description', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '89', + 'textgroup' => 'field', + 'context' => 'field_image:article:label', + 'objectid' => 'article', + 'type' => 'field_image', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '90', + 'textgroup' => 'field', + 'context' => 'field_image:article:description', + 'objectid' => 'article', + 'type' => 'field_image', + 'property' => 'description', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '91', + 'textgroup' => 'field', + 'context' => 'taxonomy_forums:forum:label', + 'objectid' => 'forum', + 'type' => 'taxonomy_forums', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '92', + 'textgroup' => 'field', + 'context' => 'field_boolean:#allowed_values:0', + 'objectid' => '#allowed_values', + 'type' => 'field_boolean', + 'property' => '0', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '93', + 'textgroup' => 'field', + 'context' => 'field_boolean:#allowed_values:1', + 'objectid' => '#allowed_values', + 'type' => 'field_boolean', + 'property' => '1', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '94', + 'textgroup' => 'field', + 'context' => 'field_boolean:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_boolean', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '95', + 'textgroup' => 'field', + 'context' => 'field_boolean:test_content_type:description', + 'objectid' => 'test_content_type', + 'type' => 'field_boolean', + 'property' => 'description', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '96', + 'textgroup' => 'field', + 'context' => 'field_email:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_email', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '97', + 'textgroup' => 'field', + 'context' => 'field_email:test_content_type:description', + 'objectid' => 'test_content_type', + 'type' => 'field_email', + 'property' => 'description', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '98', + 'textgroup' => 'field', + 'context' => 'field_phone:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_phone', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '99', + 'textgroup' => 'field', + 'context' => 'field_date:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_date', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '100', + 'textgroup' => 'field', + 'context' => 'field_date_with_end_time:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_date_with_end_time', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '101', + 'textgroup' => 'field', + 'context' => 'field_file:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_file', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '102', + 'textgroup' => 'field', + 'context' => 'field_file:user:label', + 'objectid' => 'user', + 'type' => 'field_file', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '103', + 'textgroup' => 'field', + 'context' => 'field_float:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_float', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '104', + 'textgroup' => 'field', + 'context' => 'field_float:test_content_type:description', + 'objectid' => 'test_content_type', + 'type' => 'field_float', + 'property' => 'description', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '105', + 'textgroup' => 'field', + 'context' => 'field_images:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_images', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '106', + 'textgroup' => 'field', + 'context' => 'field_integer:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_integer', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '107', + 'textgroup' => 'field', + 'context' => 'field_integer:comment_node_test_content_type:label', + 'objectid' => 'comment_node_test_content_type', + 'type' => 'field_integer', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '108', + 'textgroup' => 'field', + 'context' => 'field_integer:test_vocabulary:label', + 'objectid' => 'test_vocabulary', + 'type' => 'field_integer', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '109', + 'textgroup' => 'field', + 'context' => 'field_integer:user:label', + 'objectid' => 'user', + 'type' => 'field_integer', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '110', + 'textgroup' => 'field', + 'context' => 'field_link:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_link', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '111', + 'textgroup' => 'field', + 'context' => 'field_link:test_content_type:title_value', + 'objectid' => 'test_content_type', + 'type' => 'field_link', + 'property' => 'title_value', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '112', + 'textgroup' => 'field', + 'context' => 'field_link:article:label', + 'objectid' => 'article', + 'type' => 'field_link', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '113', + 'textgroup' => 'field', + 'context' => 'field_link:article:title_value', + 'objectid' => 'article', + 'type' => 'field_link', + 'property' => 'title_value', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '114', + 'textgroup' => 'field', + 'context' => 'field_link:blog:label', + 'objectid' => 'blog', + 'type' => 'field_link', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '115', + 'textgroup' => 'field', + 'context' => 'field_link:blog:title_value', + 'objectid' => 'blog', + 'type' => 'field_link', + 'property' => 'title_value', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '116', + 'textgroup' => 'field', + 'context' => 'field_text_list:#allowed_values:Some Text', + 'objectid' => '#allowed_values', + 'type' => 'field_text_list', + 'property' => 'Some Text', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '117', + 'textgroup' => 'field', + 'context' => 'field_text_list:#allowed_values:Some more text', + 'objectid' => '#allowed_values', + 'type' => 'field_text_list', + 'property' => 'Some more text', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '118', + 'textgroup' => 'field', + 'context' => 'field_text_list:#allowed_values:The key', + 'objectid' => '#allowed_values', + 'type' => 'field_text_list', + 'property' => 'The key', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '119', + 'textgroup' => 'field', + 'context' => 'field_text_list:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_text_list', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '120', + 'textgroup' => 'field', + 'context' => 'field_integer_list:#allowed_values:1', + 'objectid' => '#allowed_values', + 'type' => 'field_integer_list', + 'property' => '1', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '121', + 'textgroup' => 'field', + 'context' => 'field_integer_list:#allowed_values:2', + 'objectid' => '#allowed_values', + 'type' => 'field_integer_list', + 'property' => '2', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '122', + 'textgroup' => 'field', + 'context' => 'field_integer_list:#allowed_values:3', + 'objectid' => '#allowed_values', + 'type' => 'field_integer_list', + 'property' => '3', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '123', + 'textgroup' => 'field', + 'context' => 'field_integer_list:#allowed_values:6', + 'objectid' => '#allowed_values', + 'type' => 'field_integer_list', + 'property' => '6', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '124', + 'textgroup' => 'field', + 'context' => 'field_integer_list:#allowed_values:7', + 'objectid' => '#allowed_values', + 'type' => 'field_integer_list', + 'property' => '7', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '125', + 'textgroup' => 'field', + 'context' => 'field_integer_list:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_integer_list', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '126', + 'textgroup' => 'field', + 'context' => 'field_long_text:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_long_text', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '127', + 'textgroup' => 'field', + 'context' => 'field_term_reference:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_term_reference', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '128', + 'textgroup' => 'field', + 'context' => 'field_term_reference:test_vocabulary:label', + 'objectid' => 'test_vocabulary', + 'type' => 'field_term_reference', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '129', + 'textgroup' => 'field', + 'context' => 'field_text:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_text', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '130', + 'textgroup' => 'field', + 'context' => 'field_node_entityreference:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_node_entityreference', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '131', + 'textgroup' => 'field', + 'context' => 'field_user_entityreference:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_user_entityreference', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '132', + 'textgroup' => 'field', + 'context' => 'field_term_entityreference:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_term_entityreference', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '133', + 'textgroup' => 'field', + 'context' => 'field_private_file:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_private_file', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '134', + 'textgroup' => 'field', + 'context' => 'field_text_plain:article:label', + 'objectid' => 'article', + 'type' => 'field_text_plain', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '135', + 'textgroup' => 'field', + 'context' => 'field_text_plain:page:label', + 'objectid' => 'page', + 'type' => 'field_text_plain', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '136', + 'textgroup' => 'field', + 'context' => 'field_text_filtered:article:label', + 'objectid' => 'article', + 'type' => 'field_text_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '137', + 'textgroup' => 'field', + 'context' => 'field_text_filtered:page:label', + 'objectid' => 'page', + 'type' => 'field_text_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '138', + 'textgroup' => 'field', + 'context' => 'field_text_plain_filtered:article:label', + 'objectid' => 'article', + 'type' => 'field_text_plain_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '139', + 'textgroup' => 'field', + 'context' => 'field_text_plain_filtered:page:label', + 'objectid' => 'page', + 'type' => 'field_text_plain_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '140', + 'textgroup' => 'field', + 'context' => 'field_text_long_plain:article:label', + 'objectid' => 'article', + 'type' => 'field_text_long_plain', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '141', + 'textgroup' => 'field', + 'context' => 'field_text_long_plain:page:label', + 'objectid' => 'page', + 'type' => 'field_text_long_plain', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '142', + 'textgroup' => 'field', + 'context' => 'field_text_long_filtered:article:label', + 'objectid' => 'article', + 'type' => 'field_text_long_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '143', + 'textgroup' => 'field', + 'context' => 'field_text_long_filtered:page:label', + 'objectid' => 'page', + 'type' => 'field_text_long_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '144', + 'textgroup' => 'field', + 'context' => 'field_text_long_plain_filtered:article:label', + 'objectid' => 'article', + 'type' => 'field_text_long_plain_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '145', + 'textgroup' => 'field', + 'context' => 'field_text_long_plain_filtered:page:label', + 'objectid' => 'page', + 'type' => 'field_text_long_plain_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '146', + 'textgroup' => 'field', + 'context' => 'field_text_sum_plain:article:label', + 'objectid' => 'article', + 'type' => 'field_text_sum_plain', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '147', + 'textgroup' => 'field', + 'context' => 'field_text_sum_plain:page:label', + 'objectid' => 'page', + 'type' => 'field_text_sum_plain', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '148', + 'textgroup' => 'field', + 'context' => 'field_text_sum_filtered:article:label', + 'objectid' => 'article', + 'type' => 'field_text_sum_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '149', + 'textgroup' => 'field', + 'context' => 'field_text_sum_filtered:page:label', + 'objectid' => 'page', + 'type' => 'field_text_sum_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '150', + 'textgroup' => 'field', + 'context' => 'field_text_sum_plain_filtered:article:label', + 'objectid' => 'article', + 'type' => 'field_text_sum_plain_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '151', + 'textgroup' => 'field', + 'context' => 'field_text_sum_plain_filtered:page:label', + 'objectid' => 'page', + 'type' => 'field_text_sum_plain_filtered', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '152', + 'textgroup' => 'field', + 'context' => 'field_datetime_without_time:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_datetime_without_time', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '153', + 'textgroup' => 'field', + 'context' => 'field_date_without_time:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_date_without_time', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '154', + 'textgroup' => 'field', + 'context' => 'field_float_list:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'field_float_list', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '155', + 'textgroup' => 'field', + 'context' => 'field_reference:article:label', + 'objectid' => 'article', + 'type' => 'field_reference', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '156', + 'textgroup' => 'field', + 'context' => 'field_reference:user:label', + 'objectid' => 'user', + 'type' => 'field_reference', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '157', + 'textgroup' => 'field', + 'context' => 'field_reference_2:article:label', + 'objectid' => 'article', + 'type' => 'field_reference_2', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '158', + 'textgroup' => 'field', + 'context' => 'title_field:test_content_type:label', + 'objectid' => 'test_content_type', + 'type' => 'title_field', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '159', + 'textgroup' => 'field', + 'context' => 'subject_field:comment_node_article:label', + 'objectid' => 'comment_node_article', + 'type' => 'subject_field', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '160', + 'textgroup' => 'field', + 'context' => 'subject_field:comment_node_test_content_type:label', + 'objectid' => 'comment_node_test_content_type', + 'type' => 'subject_field', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '161', + 'textgroup' => 'field', + 'context' => 'name_field:test_vocabulary:label', + 'objectid' => 'test_vocabulary', + 'type' => 'name_field', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '162', + 'textgroup' => 'field', + 'context' => 'description_field:test_vocabulary:label', + 'objectid' => 'test_vocabulary', + 'type' => 'description_field', + 'property' => 'label', + 'objectindex' => '0', + 'format' => '', +)) +->values(array( + 'lid' => '163', 'textgroup' => 'blocks', 'context' => 'user:login:title', 'objectid' => 'login', @@ -15743,7 +16613,7 @@ 'version' => '1', )) ->values(array( - 'lid' => '76', + 'lid' => '163', 'location' => 'blocks:user:login:title', 'textgroup' => 'blocks', 'source' => 'User login title', @@ -15823,7 +16693,47 @@ 'i18n_status' => '0', )) ->values(array( - 'lid' => '76', + 'lid' => '83', + 'translation' => 'fr - Body', + 'language' => 'fr', + 'plid' => '0', + 'plural' => '0', + 'i18n_status' => '0', +)) +->values(array( + 'lid' => '89', + 'translation' => 'fr - Image', + 'language' => 'fr', + 'plid' => '0', + 'plural' => '0', + 'i18n_status' => '0', +)) +->values(array( + 'lid' => '90', + 'translation' => 'fr - Upload', + 'language' => 'fr', + 'plid' => '0', + 'plural' => '0', + 'i18n_status' => '0', +)) +->values(array( + 'lid' => '97', + 'translation' => 'fr - The email help text.', + 'language' => 'fr', + 'plid' => '0', + 'plural' => '0', + 'i18n_status' => '0', +)) +->values(array( + 'lid' => '113', + 'translation' => 'fr - Link', + 'language' => 'fr', + 'plid' => '0', + 'plural' => '0', + 'i18n_status' => '0', +)) +->values(array( + 'lid' => '163', 'translation' => 'fr - User login title', 'language' => 'fr', 'plid' => '0', @@ -15838,6 +16748,38 @@ 'plural' => '0', 'i18n_status' => '0', )) +->values(array( + 'lid' => '95', + 'translation' => 'is - Some helpful text.', + 'language' => 'is', + 'plid' => '0', + 'plural' => '0', + 'i18n_status' => '0', +)) +->values(array( + 'lid' => '96', + 'translation' => 'is - Email', + 'language' => 'is', + 'plid' => '0', + 'plural' => '0', + 'i18n_status' => '0', +)) +->values(array( + 'lid' => '97', + 'translation' => 'is - The email help text.', + 'language' => 'is', + 'plid' => '0', + 'plural' => '0', + 'i18n_status' => '0', +)) +->values(array( + 'lid' => '128', + 'translation' => 'is - Term Reference', + 'language' => 'is', + 'plid' => '0', + 'plural' => '0', + 'i18n_status' => '0', +)) ->execute(); $connection->schema()->createTable('menu_custom', array( 'fields' => array( @@ -49060,18 +50002,18 @@ 'bootstrap' => '0', 'schema_version' => '-1', 'weight' => '0', - 'info' => 'a:12:{s:4:"name";s:19:"Contact translation";s:11:"description";s:63:"Makes contact categories and replies available for translation.";s:12:"dependencies";a:2:{i:0;s:7:"contact";i:1;s:11:"i18n_string";}s:7:"package";s:35:"Multilingual - Internationalization";s:4:"core";s:3:"7.x";s:7:"version";s:8:"7.x-1.26";s:7:"project";s:4:"i18n";s:9:"datestamp";s:10:"1534531985";s:5:"mtime";i:1534531985;s:3:"php";s:5:"5.2.4";s:5:"files";a:0:{}s:9:"bootstrap";i:0;}', + 'info' => 'a:12:{s:4:"name";s:19:"Contact translation";s:11:"description";s:63:"Makes contact categories and replies available for translation.";s:12:"dependencies";a:2:{i:0;s:7:"contact";i:1;s:11:"i18n_string";}s:7:"package";s:35:"Multilingual - Internationalization";s:4:"core";s:3:"7.x";s:7:"version";s:8:"7.x-1.25";s:7:"project";s:4:"i18n";s:9:"datestamp";s:10:"1531342125";s:5:"mtime";i:1537747250;s:3:"php";s:5:"5.2.4";s:5:"files";a:0:{}s:9:"bootstrap";i:0;}', )) ->values(array( 'filename' => 'sites/all/modules/i18n/i18n_field/i18n_field.module', 'name' => 'i18n_field', 'type' => 'module', 'owner' => '', - 'status' => '0', + 'status' => '1', 'bootstrap' => '0', 'schema_version' => '-1', 'weight' => '0', - 'info' => 'a:12:{s:4:"name";s:17:"Field translation";s:11:"description";s:26:"Translate field properties";s:12:"dependencies";a:2:{i:0;s:5:"field";i:1;s:11:"i18n_string";}s:7:"package";s:35:"Multilingual - Internationalization";s:4:"core";s:3:"7.x";s:5:"files";a:2:{i:0;s:14:"i18n_field.inc";i:1;s:15:"i18n_field.test";}s:7:"version";s:8:"7.x-1.26";s:7:"project";s:4:"i18n";s:9:"datestamp";s:10:"1534531985";s:5:"mtime";i:1534531985;s:3:"php";s:5:"5.2.4";s:9:"bootstrap";i:0;}', + 'info' => 'a:12:{s:4:"name";s:17:"Field translation";s:11:"description";s:26:"Translate field properties";s:12:"dependencies";a:2:{i:0;s:5:"field";i:1;s:11:"i18n_string";}s:7:"package";s:35:"Multilingual - Internationalization";s:4:"core";s:3:"7.x";s:5:"files";a:2:{i:0;s:14:"i18n_field.inc";i:1;s:15:"i18n_field.test";}s:7:"version";s:8:"7.x-1.25";s:7:"project";s:4:"i18n";s:9:"datestamp";s:10:"1531342125";s:5:"mtime";i:1537747250;s:3:"php";s:5:"5.2.4";s:9:"bootstrap";i:0;}', )) ->values(array( 'filename' => 'sites/all/modules/i18n/i18n_forum/i18n_forum.module', @@ -49137,18 +50079,18 @@ 'bootstrap' => '0', 'schema_version' => '-1', 'weight' => '0', - 'info' => 'a:13:{s:4:"name";s:19:"Multilingual select";s:11:"description";s:45:"API module for multilingual content selection";s:12:"dependencies";a:1:{i:0;s:4:"i18n";}s:7:"package";s:35:"Multilingual - Internationalization";s:4:"core";s:3:"7.x";s:9:"configure";s:33:"admin/config/regional/i18n/select";s:5:"files";a:1:{i:0;s:16:"i18n_select.test";}s:7:"version";s:8:"7.x-1.26";s:7:"project";s:4:"i18n";s:9:"datestamp";s:10:"1534531985";s:5:"mtime";i:1534531985;s:3:"php";s:5:"5.2.4";s:9:"bootstrap";i:0;}', + 'info' => 'a:13:{s:4:"name";s:19:"Multilingual select";s:11:"description";s:45:"API module for multilingual content selection";s:12:"dependencies";a:1:{i:0;s:4:"i18n";}s:7:"package";s:35:"Multilingual - Internationalization";s:4:"core";s:3:"7.x";s:9:"configure";s:33:"admin/config/regional/i18n/select";s:5:"files";a:1:{i:0;s:16:"i18n_select.test";}s:7:"version";s:8:"7.x-1.25";s:7:"project";s:4:"i18n";s:9:"datestamp";s:10:"1531342125";s:5:"mtime";i:1537747251;s:3:"php";s:5:"5.2.4";s:9:"bootstrap";i:0;}', )) ->values(array( 'filename' => 'sites/all/modules/i18n/i18n_string/i18n_string.module', 'name' => 'i18n_string', 'type' => 'module', 'owner' => '', - 'status' => '0', + 'status' => '1', 'bootstrap' => '0', 'schema_version' => '-1', 'weight' => '0', - 'info' => 'a:13:{s:4:"name";s:18:"String translation";s:11:"description";s:57:"Provides support for translation of user defined strings.";s:12:"dependencies";a:2:{i:0;s:6:"locale";i:1;s:4:"i18n";}s:7:"package";s:35:"Multilingual - Internationalization";s:4:"core";s:3:"7.x";s:5:"files";a:3:{i:0;s:21:"i18n_string.admin.inc";i:1;s:15:"i18n_string.inc";i:2;s:16:"i18n_string.test";}s:9:"configure";s:34:"admin/config/regional/i18n/strings";s:7:"version";s:8:"7.x-1.26";s:7:"project";s:4:"i18n";s:9:"datestamp";s:10:"1534531985";s:5:"mtime";i:1534531985;s:3:"php";s:5:"5.2.4";s:9:"bootstrap";i:0;}', + 'info' => 'a:13:{s:4:"name";s:18:"String translation";s:11:"description";s:57:"Provides support for translation of user defined strings.";s:12:"dependencies";a:2:{i:0;s:6:"locale";i:1;s:4:"i18n";}s:7:"package";s:35:"Multilingual - Internationalization";s:4:"core";s:3:"7.x";s:5:"files";a:3:{i:0;s:21:"i18n_string.admin.inc";i:1;s:15:"i18n_string.inc";i:2;s:16:"i18n_string.test";}s:9:"configure";s:34:"admin/config/regional/i18n/strings";s:7:"version";s:8:"7.x-1.25";s:7:"project";s:4:"i18n";s:9:"datestamp";s:10:"1531342125";s:5:"mtime";i:1537747251;s:3:"php";s:5:"5.2.4";s:9:"bootstrap";i:0;}', )) ->values(array( 'filename' => 'sites/all/modules/i18n/i18n_sync/i18n_sync.module', diff --git a/web/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php b/web/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php deleted file mode 100644 index 97ccc77710588542c64d28114ee48341cface921..0000000000000000000000000000000000000000 --- a/web/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php +++ /dev/null @@ -1,215 +0,0 @@ -<?php - -namespace Drupal\quickedit\Tests; - -use Drupal\Component\Serialization\Json; -use Drupal\Core\EventSubscriber\MainContentViewSubscriber; -use Drupal\Core\Field\FieldStorageDefinitionInterface; -use Drupal\Core\Language\LanguageInterface; -use Drupal\simpletest\WebTestBase; -use Drupal\taxonomy\Entity\Vocabulary; -use Drupal\taxonomy\Entity\Term; -use Drupal\Tests\field\Traits\EntityReferenceTestTrait; - -/** - * Tests in-place editing of autocomplete tags. - * - * @group quickedit - */ -class QuickEditAutocompleteTermTest extends WebTestBase { - - use EntityReferenceTestTrait; - - /** - * Modules to enable. - * - * @var array - */ - public static $modules = ['node', 'taxonomy', 'quickedit']; - - /** - * Stores the node used for the tests. - * - * @var \Drupal\node\NodeInterface - */ - protected $node; - - /** - * Stores the vocabulary used in the tests. - * - * @var \Drupal\taxonomy\VocabularyInterface - */ - protected $vocabulary; - - /** - * Stores the first term used in the tests. - * - * @var \Drupal\taxonomy\TermInterface - */ - protected $term1; - - /** - * Stores the second term used in the tests. - * - * @var \Drupal\taxonomy\TermInterface - */ - protected $term2; - - /** - * Stores the field name for the autocomplete field. - * - * @var string - */ - protected $fieldName; - - /** - * An user with permissions to access in-place editor. - * - * @var \Drupal\user\UserInterface - */ - protected $editorUser; - - protected function setUp() { - parent::setUp(); - - $this->drupalCreateContentType([ - 'type' => 'article', - ]); - // Create the vocabulary for the tag field. - $this->vocabulary = Vocabulary::create([ - 'name' => 'quickedit testing tags', - 'vid' => 'quickedit_testing_tags', - ]); - $this->vocabulary->save(); - $this->fieldName = 'field_' . $this->vocabulary->id(); - - $handler_settings = [ - 'target_bundles' => [ - $this->vocabulary->id() => $this->vocabulary->id(), - ], - 'auto_create' => TRUE, - ]; - $this->createEntityReferenceField('node', 'article', $this->fieldName, 'Tags', 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); - - entity_get_form_display('node', 'article', 'default') - ->setComponent($this->fieldName, [ - 'type' => 'entity_reference_autocomplete_tags', - 'weight' => -4, - ]) - ->save(); - - entity_get_display('node', 'article', 'default') - ->setComponent($this->fieldName, [ - 'type' => 'entity_reference_label', - 'weight' => 10, - ]) - ->save(); - entity_get_display('node', 'article', 'teaser') - ->setComponent($this->fieldName, [ - 'type' => 'entity_reference_label', - 'weight' => 10, - ]) - ->save(); - - $this->term1 = $this->createTerm(); - $this->term2 = $this->createTerm(); - - $node = []; - $node['type'] = 'article'; - $node[$this->fieldName][]['target_id'] = $this->term1->id(); - $node[$this->fieldName][]['target_id'] = $this->term2->id(); - $this->node = $this->drupalCreateNode($node); - - $this->editorUser = $this->drupalCreateUser(['access content', 'create article content', 'edit any article content', 'access in-place editing']); - } - - /** - * Tests Quick Edit autocomplete term behavior. - */ - public function testAutocompleteQuickEdit() { - $this->drupalLogin($this->editorUser); - - $quickedit_uri = 'quickedit/form/node/' . $this->node->id() . '/' . $this->fieldName . '/' . $this->node->language()->getId() . '/full'; - $post = ['nocssjs' => 'true'] + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost($quickedit_uri, '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $ajax_commands = Json::decode($response); - - // Prepare form values for submission. drupalPostAJAX() is not suitable for - // handling pages with JSON responses, so we need our own solution here. - $form_tokens_found = preg_match('/\sname="form_token" value="([^"]+)"/', $ajax_commands[0]['data'], $token_match) && preg_match('/\sname="form_build_id" value="([^"]+)"/', $ajax_commands[0]['data'], $build_id_match); - $this->assertTrue($form_tokens_found, 'Form tokens found in output.'); - - if ($form_tokens_found) { - $post = [ - 'form_id' => 'quickedit_field_form', - 'form_token' => $token_match[1], - 'form_build_id' => $build_id_match[1], - $this->fieldName . '[target_id]' => implode(', ', [$this->term1->getName(), 'new term', $this->term2->getName()]), - 'op' => t('Save'), - ]; - - // Submit field form and check response. Should render back all the terms. - $response = $this->drupalPost($quickedit_uri, '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->setRawContent($ajax_commands[0]['data']); - $this->assertLink($this->term1->getName()); - $this->assertLink($this->term2->getName()); - $this->assertText('new term'); - $this->assertNoLink('new term'); - - // Load the form again, which should now get it back from - // PrivateTempStore. - $quickedit_uri = 'quickedit/form/node/' . $this->node->id() . '/' . $this->fieldName . '/' . $this->node->language()->getId() . '/full'; - $post = ['nocssjs' => 'true'] + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost($quickedit_uri, '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $ajax_commands = Json::decode($response); - - // The AjaxResponse's first command is an InsertCommand which contains - // the form to edit the taxonomy term field, it should contain all three - // taxonomy terms, including the one that has just been newly created and - // which is not yet stored. - $this->setRawContent($ajax_commands[0]['data']); - $expected = [ - $this->term1->getName() . ' (' . $this->term1->id() . ')', - 'new term', - $this->term2->getName() . ' (' . $this->term2->id() . ')', - ]; - $this->assertFieldByName($this->fieldName . '[target_id]', implode(', ', $expected)); - - // Save the entity. - $post = ['nocssjs' => 'true']; - $response = $this->drupalPostWithFormat('quickedit/entity/node/' . $this->node->id(), 'json', $post); - $this->assertResponse(200); - - // The full node display should now link to all entities, with the new - // one created in the database as well. - $this->drupalGet('node/' . $this->node->id()); - $this->assertLink($this->term1->getName()); - $this->assertLink($this->term2->getName()); - $this->assertLink('new term'); - } - } - - /** - * Returns a new term with random name and description in $this->vocabulary. - * - * @return \Drupal\taxonomy\TermInterface - * The created taxonomy term. - */ - protected function createTerm() { - $filter_formats = filter_formats(); - $format = array_pop($filter_formats); - $term = Term::create([ - 'name' => $this->randomMachineName(), - 'description' => $this->randomMachineName(), - // Use the first available text format. - 'format' => $format->id(), - 'vid' => $this->vocabulary->id(), - 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, - ]); - $term->save(); - return $term; - } - -} diff --git a/web/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php b/web/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php deleted file mode 100644 index 61af1f52b632dd3f59b9c21ecc5026a5c4fe638a..0000000000000000000000000000000000000000 --- a/web/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php +++ /dev/null @@ -1,607 +0,0 @@ -<?php - -namespace Drupal\quickedit\Tests; - -use Drupal\Component\Serialization\Json; -use Drupal\block_content\Entity\BlockContent; -use Drupal\field\Entity\FieldConfig; -use Drupal\field\Entity\FieldStorageConfig; -use Drupal\Core\EventSubscriber\MainContentViewSubscriber; -use Drupal\Core\Url; -use Drupal\node\Entity\Node; -use Drupal\node\Entity\NodeType; -use Drupal\simpletest\WebTestBase; -use Drupal\filter\Entity\FilterFormat; - -/** - * Tests loading of in-place editing functionality and lazy loading of its - * in-place editors. - * - * @group quickedit - */ -class QuickEditLoadingTest extends WebTestBase { - - /** - * Modules to enable. - * - * @var array - */ - public static $modules = [ - 'contextual', - 'quickedit', - 'filter', - 'node', - 'image', - ]; - - /** - * An user with permissions to create and edit articles. - * - * @var \Drupal\user\UserInterface - */ - protected $authorUser; - - /** - * A test node. - * - * @var \Drupal\node\NodeInterface - */ - protected $testNode; - - /** - * A author user with permissions to access in-place editor. - * - * @var \Drupal\user\UserInterface - */ - protected $editorUser; - - protected function setUp() { - parent::setUp(); - - // Create a text format. - $filtered_html_format = FilterFormat::create([ - 'format' => 'filtered_html', - 'name' => 'Filtered HTML', - 'weight' => 0, - 'filters' => [], - ]); - $filtered_html_format->save(); - - // Create a node type. - $this->drupalCreateContentType([ - 'type' => 'article', - 'name' => 'Article', - ]); - - // Set the node type to initially not have revisions. - // Testing with revisions will be done later. - $node_type = NodeType::load('article'); - $node_type->setNewRevision(FALSE); - $node_type->save(); - - // Create one node of the above node type using the above text format. - $this->testNode = $this->drupalCreateNode([ - 'type' => 'article', - 'body' => [ - 0 => [ - 'value' => '<p>How are you?</p>', - 'format' => 'filtered_html', - ], - ], - 'revision_log' => $this->randomString(), - ]); - - // Create 2 users, the only difference being the ability to use in-place - // editing - $basic_permissions = ['access content', 'create article content', 'edit any article content', 'use text format filtered_html', 'access contextual links']; - $this->authorUser = $this->drupalCreateUser($basic_permissions); - $this->editorUser = $this->drupalCreateUser(array_merge($basic_permissions, ['access in-place editing'])); - } - - /** - * Test the loading of Quick Edit when a user doesn't have access to it. - */ - public function testUserWithoutPermission() { - $this->drupalLogin($this->authorUser); - $this->drupalGet('node/1'); - - // Library and in-place editors. - $this->assertNoRaw('core/modules/quickedit/js/quickedit.js', 'Quick Edit library not loaded.'); - $this->assertNoRaw('core/modules/quickedit/js/editors/formEditor.js', "'form' in-place editor not loaded."); - - // HTML annotation and title class does not exist for users without - // permission to in-place edit. - $this->assertNoRaw('data-quickedit-entity-id="node/1"'); - $this->assertNoRaw('data-quickedit-field-id="node/1/body/en/full"'); - $this->assertNoFieldByXPath('//h1[contains(@class, "js-quickedit-page-title")]'); - - // Retrieving the metadata should result in an empty 403 response. - $post = ['fields[0]' => 'node/1/body/en/full']; - $response = $this->drupalPostWithFormat(Url::fromRoute('quickedit.metadata'), 'json', $post); - $this->assertIdentical(Json::encode(['message' => "The 'access in-place editing' permission is required."]), $response); - $this->assertResponse(403); - - // Quick Edit's JavaScript would never hit these endpoints if the metadata - // was empty as above, but we need to make sure that malicious users aren't - // able to use any of the other endpoints either. - $post = ['editors[0]' => 'form'] + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost('quickedit/attachments', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $message = Json::encode(['message' => "The 'access in-place editing' permission is required."]); - $this->assertIdentical($message, $response); - $this->assertResponse(403); - $post = ['nocssjs' => 'true'] + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertIdentical($message, $response); - $this->assertResponse(403); - $edit = []; - $edit['form_id'] = 'quickedit_field_form'; - $edit['form_token'] = 'xIOzMjuc-PULKsRn_KxFn7xzNk5Bx7XKXLfQfw1qOnA'; - $edit['form_build_id'] = 'form-kVmovBpyX-SJfTT5kY0pjTV35TV-znor--a64dEnMR8'; - $edit['body[0][summary]'] = ''; - $edit['body[0][value]'] = '<p>Malicious content.</p>'; - $edit['body[0][format]'] = 'filtered_html'; - $edit['op'] = t('Save'); - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', '', $edit, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertIdentical($message, $response); - $this->assertResponse(403); - $post = ['nocssjs' => 'true']; - $response = $this->drupalPostWithFormat('quickedit/entity/' . 'node/1', 'json', $post); - $this->assertIdentical(Json::encode(['message' => "The 'access in-place editing' permission is required."]), $response); - $this->assertResponse(403); - } - - /** - * Tests the loading of Quick Edit when a user does have access to it. - * - * Also ensures lazy loading of in-place editors works. - */ - public function testUserWithPermission() { - $this->drupalLogin($this->editorUser); - $this->drupalGet('node/1'); - - // Library and in-place editors. - $settings = $this->getDrupalSettings(); - $libraries = explode(',', $settings['ajaxPageState']['libraries']); - $this->assertTrue(in_array('quickedit/quickedit', $libraries), 'Quick Edit library loaded.'); - $this->assertFalse(in_array('quickedit/quickedit.inPlaceEditor.form', $libraries), "'form' in-place editor not loaded."); - - // HTML annotation and title class must always exist (to not break the - // render cache). - $this->assertRaw('data-quickedit-entity-id="node/1"'); - $this->assertRaw('data-quickedit-field-id="node/1/body/en/full"'); - $this->assertFieldByXPath('//h1[contains(@class, "js-quickedit-page-title")]'); - - // There should be only one revision so far. - $node = Node::load(1); - $vids = \Drupal::entityManager()->getStorage('node')->revisionIds($node); - $this->assertIdentical(1, count($vids), 'The node has only one revision.'); - $original_log = $node->revision_log->value; - - // Retrieving the metadata should result in a 200 JSON response. - $htmlPageDrupalSettings = $this->drupalSettings; - $post = ['fields[0]' => 'node/1/body/en/full']; - $response = $this->drupalPostWithFormat('quickedit/metadata', 'json', $post); - $this->assertResponse(200); - $expected = [ - 'node/1/body/en/full' => [ - 'label' => 'Body', - 'access' => TRUE, - 'editor' => 'form', - ], - ]; - $this->assertIdentical(Json::decode($response), $expected, 'The metadata HTTP request answers with the correct JSON response.'); - // Restore drupalSettings to build the next requests; simpletest wipes them - // after a JSON response. - $this->drupalSettings = $htmlPageDrupalSettings; - - // Retrieving the attachments should result in a 200 response, containing: - // 1. a settings command with useless metadata: AjaxController is dumb - // 2. an insert command that loads the required in-place editors - $post = ['editors[0]' => 'form'] + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost('quickedit/attachments', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $ajax_commands = Json::decode($response); - $this->assertIdentical(2, count($ajax_commands), 'The attachments HTTP request results in two AJAX commands.'); - // First command: settings. - $this->assertIdentical('settings', $ajax_commands[0]['command'], 'The first AJAX command is a settings command.'); - // Second command: insert libraries into DOM. - $this->assertIdentical('insert', $ajax_commands[1]['command'], 'The second AJAX command is an append command.'); - $this->assertTrue(in_array('quickedit/quickedit.inPlaceEditor.form', explode(',', $ajax_commands[0]['settings']['ajaxPageState']['libraries'])), 'The quickedit.inPlaceEditor.form library is loaded.'); - - // Retrieving the form for this field should result in a 200 response, - // containing only a quickeditFieldForm command. - $post = ['nocssjs' => 'true', 'reset' => 'true'] + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); - $this->assertIdentical('quickeditFieldForm', $ajax_commands[0]['command'], 'The first AJAX command is a quickeditFieldForm command.'); - $this->assertIdentical('<form ', mb_substr($ajax_commands[0]['data'], 0, 6), 'The quickeditFieldForm command contains a form.'); - - // Prepare form values for submission. drupalPostAjaxForm() is not suitable - // for handling pages with JSON responses, so we need our own solution here. - $form_tokens_found = preg_match('/\sname="form_token" value="([^"]+)"/', $ajax_commands[0]['data'], $token_match) && preg_match('/\sname="form_build_id" value="([^"]+)"/', $ajax_commands[0]['data'], $build_id_match); - $this->assertTrue($form_tokens_found, 'Form tokens found in output.'); - - if ($form_tokens_found) { - $edit = [ - 'body[0][summary]' => '', - 'body[0][value]' => '<p>Fine thanks.</p>', - 'body[0][format]' => 'filtered_html', - 'op' => t('Save'), - ]; - $post = [ - 'form_id' => 'quickedit_field_form', - 'form_token' => $token_match[1], - 'form_build_id' => $build_id_match[1], - ]; - $post += $edit + $this->getAjaxPageStatePostData(); - - // Submit field form and check response. This should store the updated - // entity in PrivateTempStore on the server. - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); - $this->assertIdentical('quickeditFieldFormSaved', $ajax_commands[0]['command'], 'The first AJAX command is a quickeditFieldFormSaved command.'); - $this->assertTrue(strpos($ajax_commands[0]['data'], 'Fine thanks.'), 'Form value saved and printed back.'); - $this->assertIdentical($ajax_commands[0]['other_view_modes'], [], 'Field was not rendered in any other view mode.'); - - // Ensure the text on the original node did not change yet. - $this->drupalGet('node/1'); - $this->assertText('How are you?'); - - // Save the entity by moving the PrivateTempStore values to entity storage. - $post = ['nocssjs' => 'true']; - $response = $this->drupalPostWithFormat('quickedit/entity/' . 'node/1', 'json', $post); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical(1, count($ajax_commands), 'The entity submission HTTP request results in one AJAX command.'); - $this->assertIdentical('quickeditEntitySaved', $ajax_commands[0]['command'], 'The first AJAX command is a quickeditEntitySaved command.'); - $this->assertIdentical($ajax_commands[0]['data']['entity_type'], 'node', 'Saved entity is of type node.'); - $this->assertIdentical($ajax_commands[0]['data']['entity_id'], '1', 'Entity id is 1.'); - - // Ensure the text on the original node did change. - $this->drupalGet('node/1'); - $this->assertText('Fine thanks.'); - - // Ensure no new revision was created and the log message is unchanged. - $node = Node::load(1); - $vids = \Drupal::entityManager()->getStorage('node')->revisionIds($node); - $this->assertIdentical(1, count($vids), 'The node has only one revision.'); - $this->assertIdentical($original_log, $node->revision_log->value, 'The revision log message is unchanged.'); - - // Now configure this node type to create new revisions automatically, - // then again retrieve the field form, fill it, submit it (so it ends up - // in PrivateTempStore) and then save the entity. Now there should be two - // revisions. - $node_type = NodeType::load('article'); - $node_type->setNewRevision(TRUE); - $node_type->save(); - - // Retrieve field form. - $post = ['nocssjs' => 'true', 'reset' => 'true']; - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); - $this->assertIdentical('quickeditFieldForm', $ajax_commands[0]['command'], 'The first AJAX command is a quickeditFieldForm command.'); - $this->assertIdentical('<form ', mb_substr($ajax_commands[0]['data'], 0, 6), 'The quickeditFieldForm command contains a form.'); - - // Submit field form. - preg_match('/\sname="form_token" value="([^"]+)"/', $ajax_commands[0]['data'], $token_match); - preg_match('/\sname="form_build_id" value="([^"]+)"/', $ajax_commands[0]['data'], $build_id_match); - $edit['body[0][value]'] = '<p>kthxbye</p>'; - $post = [ - 'form_id' => 'quickedit_field_form', - 'form_token' => $token_match[1], - 'form_build_id' => $build_id_match[1], - ]; - $post += $edit + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); - $this->assertIdentical('quickeditFieldFormSaved', $ajax_commands[0]['command'], 'The first AJAX command is an quickeditFieldFormSaved command.'); - $this->assertTrue(strpos($ajax_commands[0]['data'], 'kthxbye'), 'Form value saved and printed back.'); - - // Save the entity. - $post = ['nocssjs' => 'true']; - $response = $this->drupalPostWithFormat('quickedit/entity/' . 'node/1', 'json', $post); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical(1, count($ajax_commands)); - $this->assertIdentical('quickeditEntitySaved', $ajax_commands[0]['command'], 'The first AJAX command is an quickeditEntitySaved command.'); - $this->assertEqual($ajax_commands[0]['data'], ['entity_type' => 'node', 'entity_id' => 1], 'Updated entity type and ID returned'); - - // Test that a revision was created with the correct log message. - $vids = \Drupal::entityManager()->getStorage('node')->revisionIds(Node::load(1)); - $this->assertIdentical(2, count($vids), 'The node has two revisions.'); - $revision = node_revision_load($vids[0]); - $this->assertIdentical($original_log, $revision->revision_log->value, 'The first revision log message is unchanged.'); - $revision = node_revision_load($vids[1]); - $this->assertIdentical('Updated the <em class="placeholder">Body</em> field through in-place editing.', $revision->revision_log->value, 'The second revision log message was correctly generated by Quick Edit module.'); - } - } - - /** - * Test quickedit does not appear for entities with pending revisions. - */ - public function testWithPendingRevision() { - $this->drupalLogin($this->editorUser); - - // Verify that the preview is loaded correctly. - $this->drupalPostForm('node/add/article', ['title[0][value]' => 'foo'], 'Preview'); - $this->assertResponse(200); - // Verify that quickedit is not active on preview. - $this->assertNoRaw('data-quickedit-entity-id="node/' . $this->testNode->id() . '"'); - $this->assertNoRaw('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"'); - - $this->drupalGet('node/' . $this->testNode->id()); - $this->assertRaw('data-quickedit-entity-id="node/' . $this->testNode->id() . '"'); - $this->assertRaw('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"'); - - $this->testNode->title = 'Updated node'; - $this->testNode->setNewRevision(TRUE); - $this->testNode->isDefaultRevision(FALSE); - $this->testNode->save(); - - $this->drupalGet('node/' . $this->testNode->id()); - $this->assertResponse(200); - $this->assertNoRaw('data-quickedit-entity-id="node/' . $this->testNode->id() . '"'); - $this->assertNoRaw('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"'); - } - - /** - * Tests the loading of Quick Edit for the title base field. - */ - public function testTitleBaseField() { - $this->drupalLogin($this->editorUser); - $this->drupalGet('node/1'); - - // Ensure that the full page title is actually in-place editable - $node = Node::load(1); - $elements = $this->xpath('//h1/span[@data-quickedit-field-id="node/1/title/en/full" and normalize-space(text())=:title]', [':title' => $node->label()]); - $this->assertTrue(!empty($elements), 'Title with data-quickedit-field-id attribute found.'); - - // Retrieving the metadata should result in a 200 JSON response. - $htmlPageDrupalSettings = $this->drupalSettings; - $post = ['fields[0]' => 'node/1/title/en/full']; - $response = $this->drupalPostWithFormat('quickedit/metadata', 'json', $post); - $this->assertResponse(200); - $expected = [ - 'node/1/title/en/full' => [ - 'label' => 'Title', - 'access' => TRUE, - 'editor' => 'plain_text', - ], - ]; - $this->assertIdentical(Json::decode($response), $expected, 'The metadata HTTP request answers with the correct JSON response.'); - // Restore drupalSettings to build the next requests; simpletest wipes them - // after a JSON response. - $this->drupalSettings = $htmlPageDrupalSettings; - - // Retrieving the form for this field should result in a 200 response, - // containing only a quickeditFieldForm command. - $post = ['nocssjs' => 'true', 'reset' => 'true'] + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost('quickedit/form/' . 'node/1/title/en/full', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); - $this->assertIdentical('quickeditFieldForm', $ajax_commands[0]['command'], 'The first AJAX command is a quickeditFieldForm command.'); - $this->assertIdentical('<form ', mb_substr($ajax_commands[0]['data'], 0, 6), 'The quickeditFieldForm command contains a form.'); - - // Prepare form values for submission. drupalPostAjaxForm() is not suitable - // for handling pages with JSON responses, so we need our own solution - // here. - $form_tokens_found = preg_match('/\sname="form_token" value="([^"]+)"/', $ajax_commands[0]['data'], $token_match) && preg_match('/\sname="form_build_id" value="([^"]+)"/', $ajax_commands[0]['data'], $build_id_match); - $this->assertTrue($form_tokens_found, 'Form tokens found in output.'); - - if ($form_tokens_found) { - $edit = [ - 'title[0][value]' => 'Obligatory question', - 'op' => t('Save'), - ]; - $post = [ - 'form_id' => 'quickedit_field_form', - 'form_token' => $token_match[1], - 'form_build_id' => $build_id_match[1], - ]; - $post += $edit + $this->getAjaxPageStatePostData(); - - // Submit field form and check response. This should store the - // updated entity in PrivateTempStore on the server. - $response = $this->drupalPost('quickedit/form/' . 'node/1/title/en/full', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); - $this->assertIdentical('quickeditFieldFormSaved', $ajax_commands[0]['command'], 'The first AJAX command is a quickeditFieldFormSaved command.'); - $this->assertTrue(strpos($ajax_commands[0]['data'], 'Obligatory question'), 'Form value saved and printed back.'); - - // Ensure the text on the original node did not change yet. - $this->drupalGet('node/1'); - $this->assertNoText('Obligatory question'); - - // Save the entity by moving the PrivateTempStore values to entity storage. - $post = ['nocssjs' => 'true']; - $response = $this->drupalPostWithFormat('quickedit/entity/' . 'node/1', 'json', $post); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical(1, count($ajax_commands), 'The entity submission HTTP request results in one AJAX command.'); - $this->assertIdentical('quickeditEntitySaved', $ajax_commands[0]['command'], 'The first AJAX command is n quickeditEntitySaved command.'); - $this->assertIdentical($ajax_commands[0]['data']['entity_type'], 'node', 'Saved entity is of type node.'); - $this->assertIdentical($ajax_commands[0]['data']['entity_id'], '1', 'Entity id is 1.'); - - // Ensure the text on the original node did change. - $this->drupalGet('node/1'); - $this->assertText('Obligatory question'); - } - } - - /** - * Tests that Quick Edit doesn't make fields rendered with display options - * editable. - */ - public function testDisplayOptions() { - $node = Node::load('1'); - $display_settings = [ - 'label' => 'inline', - ]; - $build = $node->body->view($display_settings); - $output = \Drupal::service('renderer')->renderRoot($build); - $this->assertFalse(strpos($output, 'data-quickedit-field-id'), 'data-quickedit-field-id attribute not added when rendering field using dynamic display options.'); - } - - /** - * Tests that Quick Edit works with custom render pipelines. - */ - public function testCustomPipeline() { - \Drupal::service('module_installer')->install(['quickedit_test']); - - $custom_render_url = 'quickedit/form/node/1/body/en/quickedit_test-custom-render-data'; - $this->drupalLogin($this->editorUser); - - // Request editing to render results with the custom render pipeline. - $post = ['nocssjs' => 'true'] + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost($custom_render_url, '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $ajax_commands = Json::decode($response); - - // Prepare form values for submission. drupalPostAJAX() is not suitable for - // handling pages with JSON responses, so we need our own solution here. - $form_tokens_found = preg_match('/\sname="form_token" value="([^"]+)"/', $ajax_commands[0]['data'], $token_match) && preg_match('/\sname="form_build_id" value="([^"]+)"/', $ajax_commands[0]['data'], $build_id_match); - $this->assertTrue($form_tokens_found, 'Form tokens found in output.'); - - if ($form_tokens_found) { - $post = [ - 'form_id' => 'quickedit_field_form', - 'form_token' => $token_match[1], - 'form_build_id' => $build_id_match[1], - 'body[0][summary]' => '', - 'body[0][value]' => '<p>Fine thanks.</p>', - 'body[0][format]' => 'filtered_html', - 'op' => t('Save'), - ]; - // Assume there is another field on this page, which doesn't use a custom - // render pipeline, but the default one, and it uses the "full" view mode. - $post += ['other_view_modes[]' => 'full']; - - // Submit field form and check response. Should render with the custom - // render pipeline. - $response = $this->drupalPost($custom_render_url, '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); - $this->assertIdentical('quickeditFieldFormSaved', $ajax_commands[0]['command'], 'The first AJAX command is a quickeditFieldFormSaved command.'); - $this->assertTrue(strpos($ajax_commands[0]['data'], 'Fine thanks.'), 'Form value saved and printed back.'); - $this->assertTrue(strpos($ajax_commands[0]['data'], '<div class="quickedit-test-wrapper">') !== FALSE, 'Custom render pipeline used to render the value.'); - $this->assertIdentical(array_keys($ajax_commands[0]['other_view_modes']), ['full'], 'Field was also rendered in the "full" view mode.'); - $this->assertTrue(strpos($ajax_commands[0]['other_view_modes']['full'], 'Fine thanks.'), '"full" version of field contains the form value.'); - } - } - - /** - * Tests Quick Edit on a node that was concurrently edited on the full node - * form. - */ - public function testConcurrentEdit() { - $this->drupalLogin($this->editorUser); - - $post = ['nocssjs' => 'true'] + $this->getAjaxPageStatePostData(); - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - - // Prepare form values for submission. drupalPostAJAX() is not suitable for - // handling pages with JSON responses, so we need our own solution here. - $form_tokens_found = preg_match('/\sname="form_token" value="([^"]+)"/', $ajax_commands[0]['data'], $token_match) && preg_match('/\sname="form_build_id" value="([^"]+)"/', $ajax_commands[0]['data'], $build_id_match); - $this->assertTrue($form_tokens_found, 'Form tokens found in output.'); - - if ($form_tokens_found) { - $post = [ - 'nocssjs' => 'true', - 'form_id' => 'quickedit_field_form', - 'form_token' => $token_match[1], - 'form_build_id' => $build_id_match[1], - 'body[0][summary]' => '', - 'body[0][value]' => '<p>Fine thanks.</p>', - 'body[0][format]' => 'filtered_html', - 'op' => t('Save'), - ]; - - // Save the node on the regular node edit form. - $this->drupalPostForm('node/1/edit', [], t('Save')); - // Ensure different save timestamps for field editing. - sleep(2); - - // Submit field form and check response. Should throw a validation error - // because the node was changed in the meantime. - $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', '', $post, ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical(2, count($ajax_commands), 'The field form HTTP request results in two AJAX commands.'); - $this->assertIdentical('quickeditFieldFormValidationErrors', $ajax_commands[1]['command'], 'The second AJAX command is a quickeditFieldFormValidationErrors command.'); - $this->assertTrue(strpos($ajax_commands[1]['data'], 'The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.'), 'Error message returned to user.'); - } - } - - /** - * Tests that Quick Edit's data- attributes are present for content blocks. - */ - public function testContentBlock() { - \Drupal::service('module_installer')->install(['block_content']); - - // Create and place a content_block block. - $block = BlockContent::create([ - 'info' => $this->randomMachineName(), - 'type' => 'basic', - 'langcode' => 'en', - ]); - $block->save(); - $this->drupalPlaceBlock('block_content:' . $block->uuid()); - - // Check that the data- attribute is present. - $this->drupalLogin($this->editorUser); - $this->drupalGet(''); - $this->assertRaw('data-quickedit-entity-id="block_content/1"'); - } - - /** - * Tests that Quick Edit can handle an image field. - */ - public function testImageField() { - // Add an image field to the content type. - FieldStorageConfig::create([ - 'field_name' => 'field_image', - 'type' => 'image', - 'entity_type' => 'node', - ])->save(); - FieldConfig::create([ - 'field_name' => 'field_image', - 'field_type' => 'image', - 'label' => t('Image'), - 'entity_type' => 'node', - 'bundle' => 'article', - ])->save(); - entity_get_form_display('node', 'article', 'default') - ->setComponent('field_image', [ - 'type' => 'image_image', - ]) - ->save(); - - // Add an image to the node. - $this->drupalLogin($this->editorUser); - $image = $this->drupalGetTestFiles('image')[0]; - $this->drupalPostForm('node/1/edit', [ - 'files[field_image_0]' => $image->uri, - ], t('Upload')); - $this->drupalPostForm(NULL, [ - 'field_image[0][alt]' => 'Vivamus aliquet elit', - ], t('Save')); - - // The image field form should load normally. - $response = $this->drupalPost('quickedit/form/node/1/field_image/en/full', '', ['nocssjs' => 'true'] + $this->getAjaxPageStatePostData(), ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); - $this->assertResponse(200); - $ajax_commands = Json::decode($response); - $this->assertIdentical('<form ', mb_substr($ajax_commands[0]['data'], 0, 6), 'The quickeditFieldForm command contains a form.'); - } - -} diff --git a/web/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php b/web/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php new file mode 100644 index 0000000000000000000000000000000000000000..8921a9cf6590c3dfcb8cf200dbe5af800bb6f6e6 --- /dev/null +++ b/web/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php @@ -0,0 +1,102 @@ +<?php + +namespace Drupal\Tests\quickedit\Functional; + +use Drupal\Component\Serialization\Json; +use Drupal\Core\EventSubscriber\MainContentViewSubscriber; +use Drupal\Tests\BrowserTestBase; + +/** + * Tests using a custom pipeline with Quick Edit. + * + * @group quickedit + */ +class QuickEditCustomPipelineTest extends BrowserTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'quickedit', + 'quickedit_test', + 'node', + ]; + + /** + * Tests that Quick Edit works with custom render pipelines. + */ + public function testCustomPipeline() { + // Create a node type. + $this->drupalCreateContentType([ + 'type' => 'article', + 'name' => 'Article', + ]); + $node = $this->createNode(['type' => 'article']); + $editor_user = $this->drupalCreateUser([ + 'access content', + 'create article content', + 'edit any article content', + 'access in-place editing', + ]); + $this->drupalLogin($editor_user); + + $custom_render_url = $this->buildUrl('quickedit/form/node/' . $node->id() . '/body/en/quickedit_test-custom-render-data'); + + $client = $this->getHttpClient(); + $post = ['nocssjs' => 'true']; + $response = $client->post($custom_render_url, [ + 'body' => http_build_query($post), + 'query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax'], + 'cookies' => $this->getSessionCookies(), + 'headers' => [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/x-www-form-urlencoded', + ], + 'http_errors' => FALSE, + ]); + + $this->assertEquals(200, $response->getStatusCode()); + + $ajax_commands = Json::decode($response->getBody()); + // Request editing to render results with the custom render pipeline. + + // Prepare form values for submission. drupalPostAJAX() is not suitable for + // handling pages with JSON responses, so we need our own solution here. + $form_tokens_found = preg_match('/\sname="form_token" value="([^"]+)"/', $ajax_commands[0]['data'], $token_match) && preg_match('/\sname="form_build_id" value="([^"]+)"/', $ajax_commands[0]['data'], $build_id_match); + $this->assertTrue($form_tokens_found, 'Form tokens found in output.'); + + $post = [ + 'form_id' => 'quickedit_field_form', + 'form_token' => $token_match[1], + 'form_build_id' => $build_id_match[1], + 'body[0][summary]' => '', + 'body[0][value]' => '<p>Fine thanks.</p>', + 'body[0][format]' => 'filtered_html', + 'op' => t('Save'), + ]; + // Assume there is another field on this page, which doesn't use a custom + // render pipeline, but the default one, and it uses the "full" view mode. + $post += ['other_view_modes[]' => 'full']; + + // Submit field form and check response. Should render with the custom + // render pipeline. + $response = $client->post($custom_render_url, [ + 'body' => http_build_query($post), + 'query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax'], + 'cookies' => $this->getSessionCookies(), + 'headers' => [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/x-www-form-urlencoded', + ], + 'http_errors' => FALSE, + ]); + $ajax_commands = Json::decode($response->getBody()); + $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.'); + $this->assertIdentical('quickeditFieldFormSaved', $ajax_commands[0]['command'], 'The first AJAX command is a quickeditFieldFormSaved command.'); + $this->assertTrue(strpos($ajax_commands[0]['data'], 'Fine thanks.'), 'Form value saved and printed back.'); + $this->assertTrue(strpos($ajax_commands[0]['data'], '<div class="quickedit-test-wrapper">') !== FALSE, 'Custom render pipeline used to render the value.'); + $this->assertIdentical(array_keys($ajax_commands[0]['other_view_modes']), ['full'], 'Field was also rendered in the "full" view mode.'); + $this->assertTrue(strpos($ajax_commands[0]['other_view_modes']['full'], 'Fine thanks.'), '"full" version of field contains the form value.'); + } + +} diff --git a/web/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php b/web/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php new file mode 100644 index 0000000000000000000000000000000000000000..8d30a9c94dd0320d269590b9a8641ef021826e5d --- /dev/null +++ b/web/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php @@ -0,0 +1,96 @@ +<?php + +namespace Drupal\Tests\quickedit\Functional; + +use Drupal\Component\Serialization\Json; +use Drupal\Core\EventSubscriber\MainContentViewSubscriber; +use Drupal\Tests\BrowserTestBase; +use GuzzleHttp\RequestOptions; + +/** + * Tests accessing the Quick Edit endpoints. + * + * @group quickedit + */ +class QuickEditEndPointAccessTest extends BrowserTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'quickedit', + 'node', + ]; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $this->drupalCreateContentType([ + 'type' => 'article', + 'name' => 'Article', + ]); + } + + /** + * Tests that Quick Edit endpoints are protected from anonymous requests. + */ + public function testEndPointAccess() { + // Quick Edit's JavaScript would never hit these endpoints, but we need to + // make sure that malicious users aren't able to use any of the other + // endpoints either. + $url = $this->buildUrl('/quickedit/attachments'); + $post = ['editors[0]' => 'form']; + $this->assertAccessIsBlocked($url, $post); + + $node = $this->createNode(['type' => 'article']); + $url = $this->buildUrl('quickedit/form/node/' . $node->id() . '/body/en/full'); + $post = ['nocssjs' => 'true']; + $this->assertAccessIsBlocked($url, $post); + + $edit = []; + $edit['form_id'] = 'quickedit_field_form'; + $edit['form_token'] = 'xIOzMjuc-PULKsRn_KxFn7xzNk5Bx7XKXLfQfw1qOnA'; + $edit['form_build_id'] = 'form-kVmovBpyX-SJfTT5kY0pjTV35TV-znor--a64dEnMR8'; + $edit['body[0][summary]'] = ''; + $edit['body[0][value]'] = '<p>Malicious content.</p>'; + $edit['body[0][format]'] = 'filtered_html'; + $edit['op'] = t('Save'); + $this->assertAccessIsBlocked($url, $edit); + + $post = ['nocssjs' => 'true']; + $url = $this->buildUrl('quickedit/entity/node/' . $node->id()); + $this->assertAccessIsBlocked($url, $post); + } + + /** + * Asserts that access to the passed URL is blocked. + * + * @param string $url + * The URL to check. + * @param array $body + * The payload to send with the request. + */ + protected function assertAccessIsBlocked($url, array $body) { + $client = $this->getHttpClient(); + $message = ['message' => "The 'access in-place editing' permission is required."]; + + $response = $client->post($url, [ + RequestOptions::BODY => http_build_query($body), + RequestOptions::QUERY => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax'], + RequestOptions::COOKIES => $this->getSessionCookies(), + RequestOptions::HEADERS => [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/x-www-form-urlencoded', + ], + RequestOptions::HTTP_ERRORS => FALSE, + ]); + + $this->assertEquals(403, $response->getStatusCode()); + + $response_message = Json::decode($response->getBody()); + $this->assertSame($message, $response_message); + } + +} diff --git a/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditAutocompleteTermTest.php b/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditAutocompleteTermTest.php new file mode 100644 index 0000000000000000000000000000000000000000..375528b2e32ac0ba95fc4fc8f8a9e797961b2937 --- /dev/null +++ b/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditAutocompleteTermTest.php @@ -0,0 +1,204 @@ +<?php + +namespace Drupal\Tests\quickedit\FunctionalJavascript; + +use Drupal\Core\Field\FieldStorageDefinitionInterface; +use Drupal\Core\Language\LanguageInterface; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; +use Drupal\taxonomy\Entity\Vocabulary; +use Drupal\taxonomy\Entity\Term; +use Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait; +use Drupal\Tests\field\Traits\EntityReferenceTestTrait; + +/** + * Tests in-place editing of autocomplete tags. + * + * @group quickedit + */ +class QuickEditAutocompleteTermTest extends WebDriverTestBase { + + use EntityReferenceTestTrait; + use ContextualLinkClickTrait; + + /** + * {@inheritdoc} + */ + public static $modules = [ + 'node', + 'taxonomy', + 'quickedit', + 'contextual', + 'ckeditor', + ]; + + /** + * Stores the node used for the tests. + * + * @var \Drupal\node\NodeInterface + */ + protected $node; + + /** + * Stores the vocabulary used in the tests. + * + * @var \Drupal\taxonomy\VocabularyInterface + */ + protected $vocabulary; + + /** + * Stores the first term used in the tests. + * + * @var \Drupal\taxonomy\TermInterface + */ + protected $term1; + + /** + * Stores the second term used in the tests. + * + * @var \Drupal\taxonomy\TermInterface + */ + protected $term2; + + /** + * Stores the field name for the autocomplete field. + * + * @var string + */ + protected $fieldName; + + /** + * An user with permissions to access in-place editor. + * + * @var \Drupal\user\UserInterface + */ + protected $editorUser; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + $this->drupalCreateContentType([ + 'type' => 'article', + ]); + $this->vocabulary = Vocabulary::create([ + 'name' => 'quickedit testing tags', + 'vid' => 'quickedit_testing_tags', + ]); + $this->vocabulary->save(); + $this->fieldName = 'field_' . $this->vocabulary->id(); + + $handler_settings = [ + 'target_bundles' => [ + $this->vocabulary->id() => $this->vocabulary->id(), + ], + 'auto_create' => TRUE, + ]; + $this->createEntityReferenceField('node', 'article', $this->fieldName, 'Tags', 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); + + entity_get_form_display('node', 'article', 'default') + ->setComponent($this->fieldName, [ + 'type' => 'entity_reference_autocomplete_tags', + 'weight' => -4, + ]) + ->save(); + + entity_get_display('node', 'article', 'default') + ->setComponent($this->fieldName, [ + 'type' => 'entity_reference_label', + 'weight' => 10, + ]) + ->save(); + entity_get_display('node', 'article', 'teaser') + ->setComponent($this->fieldName, [ + 'type' => 'entity_reference_label', + 'weight' => 10, + ]) + ->save(); + + $this->term1 = $this->createTerm(); + $this->term2 = $this->createTerm(); + + $node = []; + $node['type'] = 'article'; + $node[$this->fieldName][]['target_id'] = $this->term1->id(); + $node[$this->fieldName][]['target_id'] = $this->term2->id(); + $this->node = $this->drupalCreateNode($node); + + $this->editorUser = $this->drupalCreateUser([ + 'access content', + 'create article content', + 'edit any article content', + 'administer nodes', + 'access contextual links', + 'access in-place editing', + ]); + } + + /** + * Tests Quick Edit autocomplete term behavior. + */ + public function testAutocompleteQuickEdit() { + $page = $this->getSession()->getPage(); + $assert = $this->assertSession(); + + $this->drupalLogin($this->editorUser); + $this->drupalGet('node/' . $this->node->id()); + + // Wait "Quick edit" button for node. + $assert->waitForElement('css', '[data-quickedit-entity-id="node/' . $this->node->id() . '"] .contextual .quickedit'); + // Click by "Quick edit". + $this->clickContextualLink('[data-quickedit-entity-id="node/' . $this->node->id() . '"]', 'Quick edit'); + // Switch to body field. + $page->find('css', '[data-quickedit-field-id="node/' . $this->node->id() . '/' . $this->fieldName . '/' . $this->node->language()->getId() . '/full"]')->click(); + + // Open Quick Edit. + $quickedit_field_locator = '[name="field_quickedit_testing_tags[target_id]"]'; + $tag_field = $assert->waitForElementVisible('css', $quickedit_field_locator); + $tag_field->focus(); + $tags = $tag_field->getValue(); + + // Check existing terms. + $this->assertTrue(strpos($tags, $this->term1->label()) !== FALSE); + $this->assertTrue(strpos($tags, $this->term2->label()) !== FALSE); + + // Add new term. + $new_tag = $this->randomMachineName(); + $tags .= ', ' . $new_tag; + $assert->waitForElementVisible('css', $quickedit_field_locator)->setValue($tags); + $assert->waitOnAutocomplete(); + // Wait and click by "Save" button after body field was changed. + $assert->waitForElementVisible('css', '.quickedit-toolgroup.ops [type="submit"][aria-hidden="false"]')->click(); + $assert->waitOnAutocomplete(); + + // Reload the page and check new term. + $this->drupalGet('node/' . $this->node->id()); + $link = $assert->waitForLink($new_tag); + $this->assertNotEmpty($link); + } + + /** + * Returns a new term with random name and description in $this->vocabulary. + * + * @return \Drupal\Core\Entity\EntityInterface|\Drupal\taxonomy\Entity\Term + * The created taxonomy term. + * + * @throws \Drupal\Core\Entity\EntityStorageException + */ + protected function createTerm() { + $filter_formats = filter_formats(); + $format = array_pop($filter_formats); + $term = Term::create([ + 'name' => $this->randomMachineName(), + 'description' => $this->randomMachineName(), + // Use the first available text format. + 'format' => $format->id(), + 'vid' => $this->vocabulary->id(), + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, + ]); + $term->save(); + return $term; + } + +} diff --git a/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php b/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0ecd655a93494f57f7b71af794ec46f8899f05ec --- /dev/null +++ b/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php @@ -0,0 +1,392 @@ +<?php + +namespace Drupal\Tests\quickedit\FunctionalJavascript; + +use Behat\Mink\Session; +use Drupal\block_content\Entity\BlockContent; +use Drupal\Core\Entity\Entity\EntityViewDisplay; +use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; +use Drupal\node\Entity\Node; +use Drupal\node\Entity\NodeType; +use Drupal\filter\Entity\FilterFormat; +use Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait; +use Drupal\Tests\TestFileCreationTrait; + +/** + * Tests loading of in-place editing functionality and lazy loading of its + * in-place editors. + * + * @group quickedit + */ +class QuickEditLoadingTest extends WebDriverTestBase { + + use ContextualLinkClickTrait; + + use TestFileCreationTrait { + getTestFiles as drupalGetTestFiles; + } + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = [ + 'contextual', + 'quickedit', + 'filter', + 'node', + 'image', + ]; + + /** + * An user with permissions to create and edit articles. + * + * @var \Drupal\user\UserInterface + */ + protected $authorUser; + + /** + * A test node. + * + * @var \Drupal\node\NodeInterface + */ + protected $testNode; + + /** + * A author user with permissions to access in-place editor. + * + * @var \Drupal\user\UserInterface + */ + protected $editorUser; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + // Create a text format. + $filtered_html_format = FilterFormat::create([ + 'format' => 'filtered_html', + 'name' => 'Filtered HTML', + 'weight' => 0, + 'filters' => [], + ]); + $filtered_html_format->save(); + + // Create a node type. + $this->drupalCreateContentType([ + 'type' => 'article', + 'name' => 'Article', + ]); + + // Set the node type to initially not have revisions. + // Testing with revisions will be done later. + $node_type = NodeType::load('article'); + $node_type->setNewRevision(FALSE); + $node_type->save(); + + // Create one node of the above node type using the above text format. + $this->testNode = $this->drupalCreateNode([ + 'type' => 'article', + 'body' => [ + 0 => [ + 'value' => '<p>How are you?</p>', + 'format' => 'filtered_html', + ], + ], + 'revision_log' => $this->randomString(), + ]); + + // Create 2 users, the only difference being the ability to use in-place + // editing + $basic_permissions = [ + 'access content', + 'create article content', + 'edit any article content', + 'use text format filtered_html', + 'access contextual links', + ]; + $this->authorUser = $this->drupalCreateUser($basic_permissions); + $this->editorUser = $this->drupalCreateUser(array_merge($basic_permissions, ['access in-place editing'])); + } + + /** + * Test the loading of Quick Edit with different permissions. + */ + public function testUserPermissions() { + $assert = $this->assertSession(); + $this->drupalLogin($this->authorUser); + $this->drupalGet('node/1'); + + // Library and in-place editors. + $this->assertNoRaw('core/modules/quickedit/js/quickedit.js', 'Quick Edit library not loaded.'); + $this->assertNoRaw('core/modules/quickedit/js/editors/formEditor.js', "'form' in-place editor not loaded."); + + // HTML annotation and title class does not exist for users without + // permission to in-place edit. + $this->assertNoRaw('data-quickedit-entity-id="node/1"'); + $this->assertNoRaw('data-quickedit-field-id="node/1/body/en/full"'); + $this->assertNoFieldByXPath('//h1[contains(@class, "js-quickedit-page-title")]'); + $assert->linkNotExists('Quick edit'); + + // Tests the loading of Quick Edit when a user does have access to it. + // Also ensures lazy loading of in-place editors works. + $nid = $this->testNode->id(); + // There should be only one revision so far. + $node = Node::load($nid); + $vids = \Drupal::entityManager()->getStorage('node')->revisionIds($node); + $this->assertCount(1, $vids, 'The node has only one revision.'); + $original_log = $node->revision_log->value; + + $this->drupalLogin($this->editorUser); + $this->drupalGet('node/' . $nid); + $page = $this->getSession()->getPage(); + + // Wait "Quick edit" button for node. + $assert->waitForElement('css', '[data-quickedit-entity-id="node/' . $nid . '"] .contextual .quickedit'); + // Click by "Quick edit". + $this->clickContextualLink('[data-quickedit-entity-id="node/' . $nid . '"]', 'Quick edit'); + // Switch to body field. + $page->find('css', '[data-quickedit-field-id="node/' . $nid . '/body/en/full"]')->click(); + $assert->assertWaitOnAjaxRequest(); + + // Wait and update body field. + $body_field_locator = '[name="body[0][value]"]'; + $body_text = 'Fine thanks.'; + $assert->waitForElementVisible('css', $body_field_locator)->setValue('<p>' . $body_text . '</p>'); + + // Wait and click by "Save" button after body field was changed. + $assert->waitForElementVisible('css', '.quickedit-toolgroup.ops [type="submit"][aria-hidden="false"]')->click(); + $assert->assertWaitOnAjaxRequest(); + + $node = Node::load($nid); + $vids = \Drupal::entityManager()->getStorage('node')->revisionIds($node); + $this->assertCount(1, $vids, 'The node has only one revision.'); + $this->assertSame($original_log, $node->revision_log->value, 'The revision log message is unchanged.'); + + // Ensure that the changes take effect. + $assert->responseMatches("|\s*$body_text\s*|"); + + // Reload the page and check for updated body. + $this->drupalGet('node/' . $nid); + $assert->pageTextContains($body_text); + } + + /** + * Test Quick Edit does not appear for entities with pending revisions. + */ + public function testWithPendingRevision() { + $this->drupalLogin($this->editorUser); + + // Verify that the preview is loaded correctly. + $this->drupalPostForm('node/add/article', ['title[0][value]' => 'foo'], 'Preview'); + // Verify that quickedit is not active on preview. + $this->assertNoRaw('data-quickedit-entity-id="node/' . $this->testNode->id() . '"'); + $this->assertNoRaw('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"'); + + $this->drupalGet('node/' . $this->testNode->id()); + $this->assertRaw('data-quickedit-entity-id="node/' . $this->testNode->id() . '"'); + $this->assertRaw('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"'); + + // Wait for the page to completely load before making any changes to the + // node. This allows Quick Edit to fetch the metadata without causing + // database locks on SQLite. + $this->assertSession()->assertWaitOnAjaxRequest(); + $this->testNode->title = 'Updated node'; + $this->testNode->setNewRevision(TRUE); + $this->testNode->isDefaultRevision(FALSE); + $this->testNode->save(); + + $this->drupalGet('node/' . $this->testNode->id()); + $this->assertNoRaw('data-quickedit-entity-id="node/' . $this->testNode->id() . '"'); + $this->assertNoRaw('data-quickedit-field-id="node/' . $this->testNode->id() . '/title/' . $this->testNode->language()->getId() . '/full"'); + } + + /** + * Tests the loading of Quick Edit for the title base field. + */ + public function testTitleBaseField() { + $page = $this->getSession()->getPage(); + $assert = $this->assertSession(); + $nid = $this->testNode->id(); + + $this->drupalLogin($this->editorUser); + $this->drupalGet('node/' . $nid); + + // Wait "Quick edit" button for node. + $assert->waitForElement('css', '[data-quickedit-entity-id="node/' . $nid . '"] .contextual .quickedit'); + // Click by "Quick edit". + $this->clickContextualLink('[data-quickedit-entity-id="node/' . $nid . '"]', 'Quick edit'); + // Switch to title field. + $page->find('css', '[data-quickedit-field-id="node/' . $nid . '/title/en/full"]')->click(); + $assert->assertWaitOnAjaxRequest(); + + // Wait and update title field. + $field_locator = '.field--name-title'; + $text_new = 'Obligatory question'; + $assert->waitForElementVisible('css', $field_locator)->setValue($text_new); + + // Wait and click by "Save" button after title field was changed. + $this->assertSession()->waitForElementVisible('css', '.quickedit-toolgroup.ops [type="submit"][aria-hidden="false"]')->click(); + $assert->assertWaitOnAjaxRequest(); + + // Ensure that the changes take effect. + $assert->responseMatches("|\s*$text_new\s*|"); + + // Reload the page and check for updated title. + $this->drupalGet('node/' . $nid); + $assert->pageTextContains($text_new); + } + + /** + * Tests that Quick Edit doesn't make fields rendered with display options + * editable. + */ + public function testDisplayOptions() { + $node = Node::load('1'); + $display_settings = [ + 'label' => 'inline', + ]; + $build = $node->body->view($display_settings); + $output = \Drupal::service('renderer')->renderRoot($build); + $this->assertFalse(strpos($output, 'data-quickedit-field-id'), 'data-quickedit-field-id attribute not added when rendering field using dynamic display options.'); + } + + /** + * Tests Quick Edit on a node that was concurrently edited on the full node + * form. + */ + public function testConcurrentEdit() { + $nid = $this->testNode->id(); + $this->drupalLogin($this->authorUser); + + // Open the edit page in the default session. + $this->drupalGet('node/' . $nid . '/edit'); + + // Switch to a concurrent session and save a quick edit change. + // We need to do some bookkeeping to keep track of the logged in user. + $logged_in_user = $this->loggedInUser; + $this->loggedInUser = FALSE; + // Register a session to preform concurrent editing. + $driver = $this->getDefaultDriverInstance(); + $session = new Session($driver); + $this->mink->registerSession('concurrent', $session); + $this->mink->setDefaultSessionName('concurrent'); + $this->initFrontPage(); + $this->drupalLogin($this->editorUser); + $this->drupalGet('node/' . $nid); + + $assert = $this->assertSession(); + $page = $this->getSession()->getPage(); + + // Wait "Quick edit" button for node. + $assert->waitForElement('css', '[data-quickedit-entity-id="node/' . $nid . '"] .contextual .quickedit'); + // Click by "Quick edit". + $this->clickContextualLink('[data-quickedit-entity-id="node/' . $nid . '"]', 'Quick edit'); + // Switch to body field. + $page->find('css', '[data-quickedit-field-id="node/' . $nid . '/body/en/full"]')->click(); + $assert->assertWaitOnAjaxRequest(); + + // Wait and update body field. + $body_field_locator = '[name="body[0][value]"]'; + $body_text = 'Fine thanks.'; + $assert->waitForElementVisible('css', $body_field_locator)->setValue('<p>' . $body_text . '</p>'); + + // Wait and click by "Save" button after body field was changed. + $assert->waitForElementVisible('css', '.quickedit-toolgroup.ops [type="submit"][aria-hidden="false"]')->click(); + $assert->assertWaitOnAjaxRequest(); + + // Ensure that the changes take effect. + $assert->responseMatches("|\s*$body_text\s*|"); + + // Switch back to the default session. + $this->mink->setDefaultSessionName('default'); + $this->loggedInUser = $logged_in_user; + // Ensure different save timestamps for field editing. + sleep(2); + $this->drupalPostForm(NULL, ['body[0][value]' => '<p>Concurrent edit!</p>'], 'Save'); + + $this->getSession()->getPage()->hasContent('The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.'); + } + + /** + * Tests that Quick Edit's data- attributes are present for content blocks. + */ + public function testContentBlock() { + \Drupal::service('module_installer')->install(['block_content']); + + // Create and place a content_block block. + $block = BlockContent::create([ + 'info' => $this->randomMachineName(), + 'type' => 'basic', + 'langcode' => 'en', + ]); + $block->save(); + $this->drupalPlaceBlock('block_content:' . $block->uuid()); + + // Check that the data- attribute is present. + $this->drupalLogin($this->editorUser); + $this->drupalGet(''); + $this->assertRaw('data-quickedit-entity-id="block_content/1"'); + } + + /** + * Tests that Quick Edit can handle an image field. + */ + public function testImageField() { + $page = $this->getSession()->getPage(); + $assert = $this->assertSession(); + + // Add an image field to the content type. + FieldStorageConfig::create([ + 'field_name' => 'field_image', + 'type' => 'image', + 'entity_type' => 'node', + ])->save(); + FieldConfig::create([ + 'field_name' => 'field_image', + 'field_type' => 'image', + 'label' => t('Image'), + 'entity_type' => 'node', + 'bundle' => 'article', + ])->save(); + entity_get_form_display('node', 'article', 'default') + ->setComponent('field_image', [ + 'type' => 'image_image', + ]) + ->save(); + $display = EntityViewDisplay::load('node.article.default'); + $display->setComponent('field_image', [ + 'type' => 'image', + ])->save(); + + // Add an image to the node. + $this->drupalLogin($this->editorUser); + $this->drupalGet('node/1/edit'); + $image = $this->drupalGetTestFiles('image')[0]; + $image_path = $this->container->get('file_system')->realpath($image->uri); + $page->attachFileToField('files[field_image_0]', $image_path); + $alt_field = $assert->waitForField('field_image[0][alt]'); + $this->assertNotEmpty($alt_field); + $this->drupalPostForm(NULL, [ + 'field_image[0][alt]' => 'Vivamus aliquet elit', + ], t('Save')); + + // The image field form should load normally. + // Wait "Quick edit" button for node. + $assert->waitForElement('css', '[data-quickedit-entity-id="node/1"] .contextual .quickedit'); + // Click by "Quick edit". + $this->clickContextualLink('[data-quickedit-entity-id="node/1"]', 'Quick edit'); + // Switch to body field. + $assert->waitForElement('css', '[data-quickedit-field-id="node/1/field_image/en/full"]')->click(); + $assert->assertWaitOnAjaxRequest(); + + $field_locator = '.field--name-field-image'; + $assert->waitForElementVisible('css', $field_locator); + } + +} diff --git a/web/core/modules/quickedit/tests/src/Kernel/QuickEditLoadingTest.php b/web/core/modules/quickedit/tests/src/Kernel/QuickEditLoadingTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ed8e5143d702bded66044bdaf77c8742ee0fe922 --- /dev/null +++ b/web/core/modules/quickedit/tests/src/Kernel/QuickEditLoadingTest.php @@ -0,0 +1,88 @@ +<?php + +namespace Drupal\Tests\quickedit\Kernel; + +use Drupal\KernelTests\KernelTestBase; +use Drupal\node\Entity\Node; +use Drupal\Tests\node\Traits\ContentTypeCreationTrait; +use Drupal\Tests\node\Traits\NodeCreationTrait; +use Drupal\Tests\user\Traits\UserCreationTrait; + +/** + * Tests loading of in-place editing functionality and lazy loading of its + * in-place editors. + * + * @group quickedit + */ +class QuickEditLoadingTest extends KernelTestBase { + + use NodeCreationTrait; + use UserCreationTrait; + use ContentTypeCreationTrait; + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'user', + 'system', + 'field', + 'node', + 'text', + 'filter', + 'contextual', + 'quickedit', + ]; + + /** + * A user with permissions to access in-place editor. + * + * @var \Drupal\user\UserInterface + */ + protected $editorUser; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + $this->installSchema('system', 'sequences'); + $this->installEntitySchema('user'); + $this->installEntitySchema('node'); + $this->installConfig(['field', 'filter', 'node']); + + // Create a Content type and one test node. + $this->createContentType(['type' => 'page']); + $this->createNode(); + + $this->editorUser = $this->createUser([ + 'access content', + 'create page content', + 'edit any page content', + 'access contextual links', + 'access in-place editing', + ]); + } + + /** + * Tests that Quick Edit doesn't make fields rendered with display options + * editable. + */ + public function testDisplayOptions() { + $node = Node::load(1); + $renderer = $this->container->get('renderer'); + $this->container->get('current_user')->setAccount($this->editorUser); + + $build = $node->body->view(['label' => 'inline']); + $this->setRawContent($renderer->renderRoot($build)); + $elements = $this->xpath('//div[@data-quickedit-field-id]'); + $this->assertFalse(!empty($elements), 'data-quickedit-field-id attribute not added when rendering field using dynamic display options.'); + + $build = $node->body->view('default'); + $this->setRawContent($renderer->renderRoot($build)); + $elements = $this->xpath('//div[@data-quickedit-field-id="node/1/body/en/default"]'); + $this->assertTrue(!empty($elements), 'Body with data-quickedit-field-id attribute found.'); + } + +} diff --git a/web/core/modules/responsive_image/tests/fixtures/update/drupal-8.responsive_image-enabled.php b/web/core/modules/responsive_image/tests/fixtures/update/drupal-8.responsive_image-enabled.php new file mode 100644 index 0000000000000000000000000000000000000000..a23eea7913964a142b0e1b54f95a588087d0f870 --- /dev/null +++ b/web/core/modules/responsive_image/tests/fixtures/update/drupal-8.responsive_image-enabled.php @@ -0,0 +1,46 @@ +<?php +// @codingStandardsIgnoreFile + +use Drupal\Core\Database\Database; + +$connection = Database::getConnection(); + +// Set the schema version. +$connection->merge('key_value') + ->fields([ + 'value' => 'i:8000;', + 'name' => 'responsive_image', + 'collection' => 'system.schema', + ]) + ->condition('collection', 'system.schema') + ->condition('name', 'responsive_image') + ->execute(); + +// Update core.extension. +$extensions = $connection->select('config') + ->fields('config', ['data']) + ->condition('collection', '') + ->condition('name', 'core.extension') + ->execute() + ->fetchField(); +$extensions = unserialize($extensions); +$extensions['module']['responsive_image'] = 8000; +$connection->update('config') + ->fields([ + 'data' => serialize($extensions), + 'collection' => '', + 'name' => 'core.extension', + ]) + ->condition('collection', '') + ->condition('name', 'core.extension') + ->execute(); + +$connection->merge('key_value') + ->condition('collection', 'entity.definitions.installed') + ->condition('name', 'responsive_image_style.entity_type') + ->fields([ + 'value' => 'O:42:"Drupal\Core\Config\Entity\ConfigEntityType":44:{s:16:" * config_prefix";s:6:"styles";s:15:" * static_cache";b:0;s:14:" * lookup_keys";a:1:{i:0;s:4:"uuid";}s:16:" * config_export";a:5:{i:0;s:2:"id";i:1;s:5:"label";i:2;s:20:"image_style_mappings";i:3;s:16:"breakpoint_group";i:4;s:20:"fallback_image_style";}s:21:" * mergedConfigExport";a:0:{}s:15:" * render_cache";b:1;s:19:" * persistent_cache";b:1;s:14:" * entity_keys";a:8:{s:2:"id";s:2:"id";s:5:"label";s:5:"label";s:8:"revision";s:0:"";s:6:"bundle";s:0:"";s:8:"langcode";s:8:"langcode";s:16:"default_langcode";s:16:"default_langcode";s:29:"revision_translation_affected";s:29:"revision_translation_affected";s:4:"uuid";s:4:"uuid";}s:5:" * id";s:22:"responsive_image_style";s:16:" * originalClass";s:51:"Drupal\responsive_image\Entity\ResponsiveImageStyle";s:11:" * handlers";a:4:{s:12:"list_builder";s:55:"Drupal\responsive_image\ResponsiveImageStyleListBuilder";s:4:"form";a:4:{s:4:"edit";s:48:"Drupal\responsive_image\ResponsiveImageStyleForm";s:3:"add";s:48:"Drupal\responsive_image\ResponsiveImageStyleForm";s:6:"delete";s:35:"Drupal\Core\Entity\EntityDeleteForm";s:9:"duplicate";s:48:"Drupal\responsive_image\ResponsiveImageStyleForm";}s:6:"access";s:45:"Drupal\Core\Entity\EntityAccessControlHandler";s:7:"storage";s:45:"Drupal\Core\Config\Entity\ConfigEntityStorage";}s:19:" * admin_permission";s:28:"administer responsive images";s:25:" * permission_granularity";s:11:"entity_type";s:8:" * links";a:4:{s:9:"edit-form";s:67:"/admin/config/media/responsive-image-style/{responsive_image_style}";s:14:"duplicate-form";s:77:"/admin/config/media/responsive-image-style/{responsive_image_style}/duplicate";s:11:"delete-form";s:74:"/admin/config/media/responsive-image-style/{responsive_image_style}/delete";s:10:"collection";s:42:"/admin/config/media/responsive-image-style";}s:17:" * label_callback";N;s:21:" * bundle_entity_type";N;s:12:" * bundle_of";N;s:15:" * bundle_label";N;s:13:" * base_table";N;s:22:" * revision_data_table";N;s:17:" * revision_table";N;s:13:" * data_table";N;s:11:" * internal";b:0;s:15:" * translatable";b:0;s:19:" * show_revision_ui";b:0;s:8:" * label";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:" * string";s:22:"Responsive image style";s:12:" * arguments";a:0:{}s:10:" * options";a:0:{}}s:19:" * label_collection";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:" * string";s:23:"Responsive image styles";s:12:" * arguments";a:0:{}s:10:" * options";a:0:{}}s:17:" * label_singular";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:" * string";s:22:"responsive image style";s:12:" * arguments";a:0:{}s:10:" * options";a:0:{}}s:15:" * label_plural";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:" * string";s:23:"responsive image styles";s:12:" * arguments";a:0:{}s:10:" * options";a:0:{}}s:14:" * label_count";a:3:{s:8:"singular";s:29:"@count responsive image style";s:6:"plural";s:30:"@count responsive image styles";s:7:"context";N;}s:15:" * uri_callback";N;s:8:" * group";s:13:"configuration";s:14:" * group_label";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:" * string";s:13:"Configuration";s:12:" * arguments";a:0:{}s:10:" * options";a:1:{s:7:"context";s:17:"Entity type group";}}s:22:" * field_ui_base_route";N;s:26:" * common_reference_target";b:0;s:22:" * list_cache_contexts";a:0:{}s:18:" * list_cache_tags";a:1:{i:0;s:34:"config:responsive_image_style_list";}s:14:" * constraints";a:0:{}s:13:" * additional";a:0:{}s:8:" * class";s:51:"Drupal\responsive_image\Entity\ResponsiveImageStyle";s:11:" * provider";s:16:"responsive_image";s:14:" * _serviceIds";a:0:{}s:18:" * _entityStorages";a:0:{}s:20:" * stringTranslation";N;}', + 'name' => 'responsive_image_style.entity_type', + 'collection' => 'entity.definitions.installed', + ]) + ->execute(); diff --git a/web/core/modules/responsive_image/tests/src/Functional/Update/ResponsiveImageUpdateTest.php b/web/core/modules/responsive_image/tests/src/Functional/Update/ResponsiveImageUpdateTest.php index 32b89d4256d0e0fb1ab25f99f60149121482639b..e14f58d696a6d1a8bca8feab52c376f6a874d1d6 100644 --- a/web/core/modules/responsive_image/tests/src/Functional/Update/ResponsiveImageUpdateTest.php +++ b/web/core/modules/responsive_image/tests/src/Functional/Update/ResponsiveImageUpdateTest.php @@ -20,27 +20,10 @@ class ResponsiveImageUpdateTest extends UpdatePathTestBase { public function setDatabaseDumpFiles() { $this->databaseDumpFiles = [ __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8-rc1.bare.standard.php.gz', + __DIR__ . '/../../../fixtures/update/drupal-8.responsive_image-enabled.php', ]; } - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - /** @var \Drupal\Core\State\StateInterface $state */ - $state = $this->container->get('state'); - - // Enable responsive_image module without using the module installer to - // avoid installation of configuration shipped in module. - $system_module_files = $state->get('system.module.files', []); - $system_module_files += ['responsive_image' => 'core/modules/responsive_image/responsive_image.info.yml']; - $state->set('system.module.files', $system_module_files); - $this->config('core.extension')->set('module.responsive_image', 0)->save(); - $this->container->get('module_handler')->addModule('responsive_image', 'core/modules/responsive_image'); - } - /** * Tests post-update responsive_image_post_update_dependency(). * diff --git a/web/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php b/web/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php index 42c7b2c50a8397f8be50a88a3a3ae0a177f44601..2bd4f7d670c241734f2a104759bdb299c8207869 100644 --- a/web/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php +++ b/web/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php @@ -373,11 +373,13 @@ public function testFileUploadUnicodeFilename() { $uri = Url::fromUri('base:' . static::$postUri); - $response = $this->fileRequest($uri, $this->testFileData, ['Content-Disposition' => 'file; filename="example-✓.txt"']); + // It is important that the filename starts with a unicode character. See + // https://bugs.php.net/bug.php?id=77239. + $response = $this->fileRequest($uri, $this->testFileData, ['Content-Disposition' => 'file; filename="Èxample-✓.txt"']); $this->assertSame(201, $response->getStatusCode()); - $expected = $this->getExpectedNormalizedEntity(1, 'example-✓.txt', TRUE); + $expected = $this->getExpectedNormalizedEntity(1, 'Èxample-✓.txt', TRUE); $this->assertResponseData($expected, $response); - $this->assertSame($this->testFileData, file_get_contents('public://foobar/example-✓.txt')); + $this->assertSame($this->testFileData, file_get_contents('public://foobar/Èxample-✓.txt')); } /** diff --git a/web/core/modules/serialization/src/Normalizer/FieldItemNormalizer.php b/web/core/modules/serialization/src/Normalizer/FieldItemNormalizer.php index 085e5242d04128bd3abb00937c85eaba37c2ddcd..ff6548ef954537935a22e09d4a68e81bc4ca504b 100644 --- a/web/core/modules/serialization/src/Normalizer/FieldItemNormalizer.php +++ b/web/core/modules/serialization/src/Normalizer/FieldItemNormalizer.php @@ -62,7 +62,7 @@ protected function constructValue($data, $context) { // being automatically serialized, manually managed serialized properties // expect to receive serialized input. foreach ($serialized_property_names as $serialized_property_name) { - if (!empty($data[$serialized_property_name])) { + if (is_array($data) && array_key_exists($serialized_property_name, $data)) { $data[$serialized_property_name] = serialize($data[$serialized_property_name]); } } diff --git a/web/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php b/web/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php index 487cbc12583be6082298daedc956789f33db3570..5ba830d163ac792cb61485f36fa429bfa4ea1263 100644 --- a/web/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php +++ b/web/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php @@ -261,4 +261,92 @@ public function testDenormalize() { } } + /** + * Tests denormalizing serialized columns. + */ + public function testDenormalizeSerializedItem() { + $this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized" field (field item class: Drupal\entity_test\Plugin\Field\FieldType\SerializedItem).'); + $this->serializer->denormalize([ + 'serialized' => [ + [ + 'value' => 'boo', + ], + ], + 'type' => 'entity_test_serialized_field', + ], EntitySerializedField::class); + } + + /** + * Tests normalizing/denormalizing custom serialized columns. + */ + public function testDenormalizeCustomSerializedItem() { + $entity = EntitySerializedField::create(['serialized_text' => serialize(['Hello world!'])]); + $normalized = $this->serializer->normalize($entity); + $this->assertEquals($normalized['serialized_text'][0]['value'], ['Hello world!']); + $this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_text" field (field item class: Drupal\entity_test\Plugin\Field\FieldType\SerializedPropertyItem).'); + $this->serializer->denormalize([ + 'serialized_text' => [ + [ + 'value' => 'boo', + ], + ], + 'type' => 'entity_test_serialized_field', + ], EntitySerializedField::class); + } + + /** + * Tests normalizing/denormalizing invalid custom serialized fields. + */ + public function testDenormalizeInvalidCustomSerializedField() { + $entity = EntitySerializedField::create(['serialized_long' => serialize(['Hello world!'])]); + $normalized = $this->serializer->normalize($entity); + $this->assertEquals($normalized['serialized_long'][0]['value'], ['Hello world!']); + $this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_long" field (field item class: Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem).'); + $this->serializer->denormalize([ + 'serialized_long' => [ + [ + 'value' => 'boo', + ], + ], + 'type' => 'entity_test_serialized_field', + ], EntitySerializedField::class); + } + + /** + * Tests normalizing/denormalizing empty custom serialized fields. + */ + public function testDenormalizeEmptyCustomSerializedField() { + $entity = EntitySerializedField::create(['serialized_long' => serialize([])]); + $normalized = $this->serializer->normalize($entity); + $this->assertEquals([], $normalized['serialized_long'][0]['value']); + + $entity = $this->serializer->denormalize($normalized, EntitySerializedField::class); + + $this->assertEquals(serialize([]), $entity->get('serialized_long')->value); + } + + /** + * Tests normalizing/denormalizing valid custom serialized fields. + */ + public function testDenormalizeValidCustomSerializedField() { + $entity = EntitySerializedField::create(['serialized_long' => serialize(['key' => 'value'])]); + $normalized = $this->serializer->normalize($entity); + $this->assertEquals(['key' => 'value'], $normalized['serialized_long'][0]['value']); + + $entity = $this->serializer->denormalize($normalized, EntitySerializedField::class); + + $this->assertEquals(serialize(['key' => 'value']), $entity->get('serialized_long')->value); + } + + /** + * Tests normalizing/denormalizing using string values. + */ + public function testDenormalizeStringValue() { + $this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_long" field (field item class: Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem).'); + $this->serializer->denormalize([ + 'serialized_long' => ['boo'], + 'type' => 'entity_test_serialized_field', + ], EntitySerializedField::class); + } + } diff --git a/web/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php b/web/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php index bad2e7e7a4d6330d15c2ef7de3972f4caf498f6d..b6ef1ceb0d864a5237a4cfc262c3db059b42c9d7 100644 --- a/web/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php +++ b/web/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php @@ -365,7 +365,7 @@ protected function assertDenormalize(array $data) { ->shouldBeCalled(); } - // Avoid a static method call by returning dummy property data. + // Avoid a static method call by returning dummy serialized property data. $this->fieldDefinition ->getFieldStorageDefinition() ->willReturn() diff --git a/web/core/modules/serialization/tests/src/Unit/Normalizer/TimestampItemNormalizerTest.php b/web/core/modules/serialization/tests/src/Unit/Normalizer/TimestampItemNormalizerTest.php index 47abc4601f56a198d34c82234212c172c3d1c39e..92dfd22d977e29b6e65733e9b3496d484b48a776 100644 --- a/web/core/modules/serialization/tests/src/Unit/Normalizer/TimestampItemNormalizerTest.php +++ b/web/core/modules/serialization/tests/src/Unit/Normalizer/TimestampItemNormalizerTest.php @@ -113,7 +113,7 @@ public function testDenormalizeValidFormats($value, $expected) { $timestamp_item->setValue(['value' => $expected]) ->shouldBeCalled(); - // Avoid a static method call by returning dummy property data. + // Avoid a static method call by returning dummy serialized property data. $field_definition = $this->prophesize(FieldDefinitionInterface::class); $timestamp_item ->getFieldDefinition() diff --git a/web/core/modules/system/tests/modules/entity_test/src/Entity/EntitySerializedField.php b/web/core/modules/system/tests/modules/entity_test/src/Entity/EntitySerializedField.php new file mode 100644 index 0000000000000000000000000000000000000000..0d8bb8bd554aee322cb7f4f3749d32a10dda257c --- /dev/null +++ b/web/core/modules/system/tests/modules/entity_test/src/Entity/EntitySerializedField.php @@ -0,0 +1,49 @@ +<?php + +namespace Drupal\entity_test\Entity; + +use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Field\BaseFieldDefinition; + +/** + * Defines a test class for testing fields with a serialized column. + * + * @ContentEntityType( + * id = "entity_test_serialized_field", + * label = @Translation("Test serialized fields"), + * entity_keys = { + * "id" = "id", + * "uuid" = "uuid", + * "bundle" = "type", + * "label" = "name" + * }, + * base_table = "entity_test_serialized_fields", + * persistent_cache = FALSE, + * serialized_field_property_names = { + * "serialized_long" = { + * "value" + * } + * } + * ) + */ +class EntitySerializedField extends EntityTest { + + /** + * {@inheritdoc} + */ + public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { + $fields = parent::baseFieldDefinitions($entity_type); + + $fields['serialized'] = BaseFieldDefinition::create('serialized_item_test') + ->setLabel(t('Serialized')); + + $fields['serialized_text'] = BaseFieldDefinition::create('serialized_property_item_test') + ->setLabel(t('Serialized text')); + + $fields['serialized_long'] = BaseFieldDefinition::create('string_long') + ->setLabel(t('Serialized long string')); + + return $fields; + } + +} diff --git a/web/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/SerializedItem.php b/web/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/SerializedItem.php new file mode 100644 index 0000000000000000000000000000000000000000..d460cb2026aa1e9fe07a26cb12915bab90fdfff4 --- /dev/null +++ b/web/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/SerializedItem.php @@ -0,0 +1,48 @@ +<?php + +namespace Drupal\entity_test\Plugin\Field\FieldType; + +use Drupal\Core\Field\FieldItemBase; +use Drupal\Core\Field\FieldStorageDefinitionInterface; +use Drupal\Core\StringTranslation\TranslatableMarkup; +use Drupal\Core\TypedData\DataDefinition; + +/** + * Defines the 'serialized_item' entity field type. + * + * @FieldType( + * id = "serialized_item_test", + * label = @Translation("Test serialized field item"), + * description = @Translation("A field containing a serialized string value."), + * category = @Translation("Field"), + * ) + */ +class SerializedItem extends FieldItemBase { + + /** + * {@inheritdoc} + */ + public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) { + $properties['value'] = DataDefinition::create('string') + ->setLabel(new TranslatableMarkup('Test serialized value')) + ->setRequired(TRUE); + + return $properties; + } + + /** + * {@inheritdoc} + */ + public static function schema(FieldStorageDefinitionInterface $field_definition) { + return [ + 'columns' => [ + 'value' => [ + 'type' => 'blob', + 'size' => 'big', + 'serialize' => TRUE, + ], + ], + ]; + } + +} diff --git a/web/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/SerializedPropertyItem.php b/web/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/SerializedPropertyItem.php new file mode 100644 index 0000000000000000000000000000000000000000..c9b067fe421fcec20fd8700ed3305591214ca27d --- /dev/null +++ b/web/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/SerializedPropertyItem.php @@ -0,0 +1,50 @@ +<?php + +namespace Drupal\entity_test\Plugin\Field\FieldType; + +use Drupal\Core\Field\FieldItemBase; +use Drupal\Core\Field\FieldStorageDefinitionInterface; +use Drupal\Core\StringTranslation\TranslatableMarkup; +use Drupal\Core\TypedData\DataDefinition; + +/** + * Defines the 'serialized_property_item_test' entity field type. + * + * @FieldType( + * id = "serialized_property_item_test", + * label = @Translation("Test serialized property field item"), + * description = @Translation("A field containing a string representing serialized data."), + * category = @Translation("Field"), + * serialized_property_names = { + * "value" + * } + * ) + */ +class SerializedPropertyItem extends FieldItemBase { + + /** + * {@inheritdoc} + */ + public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) { + $properties['value'] = DataDefinition::create('string') + ->setLabel(new TranslatableMarkup('Test serialized value')) + ->setRequired(TRUE); + + return $properties; + } + + /** + * {@inheritdoc} + */ + public static function schema(FieldStorageDefinitionInterface $field_definition) { + return [ + 'columns' => [ + 'value' => [ + 'type' => 'text', + 'size' => 'big', + ], + ], + ]; + } + +} diff --git a/web/core/modules/system/tests/modules/twig_extension_test/src/TwigExtension/TestExtension.php b/web/core/modules/system/tests/modules/twig_extension_test/src/TwigExtension/TestExtension.php index 93be201e5cfe911fe4ebbd672e84a409e588d25e..2f51e721a6ff22220aef771adec7249fbe3f69f4 100644 --- a/web/core/modules/system/tests/modules/twig_extension_test/src/TwigExtension/TestExtension.php +++ b/web/core/modules/system/tests/modules/twig_extension_test/src/TwigExtension/TestExtension.php @@ -2,6 +2,9 @@ namespace Drupal\twig_extension_test\TwigExtension; +use Twig\TwigFilter; +use Twig\TwigFunction; + /** * A test Twig extension that adds a custom function and a custom filter. */ @@ -21,7 +24,7 @@ class TestExtension extends \Twig_Extension { */ public function getFunctions() { return [ - 'testfunc' => new \Twig_Function_Function(['Drupal\twig_extension_test\TwigExtension\TestExtension', 'testFunction']), + 'testfunc' => new TwigFunction('testfunc', ['Drupal\twig_extension_test\TwigExtension\TestExtension', 'testFunction']), ]; } @@ -39,7 +42,7 @@ public function getFunctions() { */ public function getFilters() { return [ - 'testfilter' => new \Twig_Filter_Function(['Drupal\twig_extension_test\TwigExtension\TestExtension', 'testFilter']), + 'testfilter' => new TwigFilter('testfilter', ['Drupal\twig_extension_test\TwigExtension\TestExtension', 'testFilter']), ]; } diff --git a/web/core/modules/system/tests/modules/twig_theme_test/src/TwigThemeTestController.php b/web/core/modules/system/tests/modules/twig_theme_test/src/TwigThemeTestController.php index 1e995c58f754c5441b8abaeafd350c97327a3c1f..fcaf319368ad5070e986d2aafff2d5e8d0e0effe 100644 --- a/web/core/modules/system/tests/modules/twig_theme_test/src/TwigThemeTestController.php +++ b/web/core/modules/system/tests/modules/twig_theme_test/src/TwigThemeTestController.php @@ -104,4 +104,11 @@ public function renderable() { ]; } + /** + * Renders for testing the embed tag in a Twig template. + */ + public function embedTagRender() { + return ['#theme' => 'twig_theme_test_embed_tag']; + } + } diff --git a/web/core/modules/system/tests/modules/twig_theme_test/templates/twig-theme-test-embed-tag-embedded.html.twig b/web/core/modules/system/tests/modules/twig_theme_test/templates/twig-theme-test-embed-tag-embedded.html.twig new file mode 100644 index 0000000000000000000000000000000000000000..63d7f477cbb9683ca3e24bb6f02344c28396749b --- /dev/null +++ b/web/core/modules/system/tests/modules/twig_theme_test/templates/twig-theme-test-embed-tag-embedded.html.twig @@ -0,0 +1 @@ +This line is from twig_theme_test/templates/twig-theme-test-embed-tag-embedded.html.twig diff --git a/web/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.embed_tag.html.twig b/web/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.embed_tag.html.twig new file mode 100644 index 0000000000000000000000000000000000000000..035c3784e4e7bfd071f5a7c5cd2de3dd8e6da24b --- /dev/null +++ b/web/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.embed_tag.html.twig @@ -0,0 +1,3 @@ +{% embed "@twig_theme_test/twig-theme-test-embed-tag-embedded.html.twig" %} + +{% endembed %} diff --git a/web/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module b/web/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module index a8b4086203ad844160a9e5fcd064be20e3644b5d..31a1a4693043bb1f400476fad0b95ba7c42a6a68 100644 --- a/web/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module +++ b/web/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module @@ -73,6 +73,10 @@ function twig_theme_test_theme($existing, $type, $theme, $path) { ], 'template' => 'twig_theme_test.renderable', ]; + $items['twig_theme_test_embed_tag'] = [ + 'variables' => [], + 'template' => 'twig_theme_test.embed_tag', + ]; return $items; } diff --git a/web/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml b/web/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml index df665c346431b652f805a69f448c5f5e0e6540dc..e671d70fbbf73c71d3543cbdd925bb0fb6291fa6 100644 --- a/web/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml +++ b/web/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml @@ -69,3 +69,10 @@ twig_theme_test_renderable: _controller: '\Drupal\twig_theme_test\TwigThemeTestController::renderable' requirements: _access: 'TRUE' + +twig_theme_test_embed_tag: + path: '/twig-theme-test/embed-tag' + defaults: + _controller: '\Drupal\twig_theme_test\TwigThemeTestController::embedTagRender' + requirements: + _access: 'TRUE' diff --git a/web/core/modules/system/tests/modules/unique_field_constraint_test/unique_field_constraint_test.info.yml b/web/core/modules/system/tests/modules/unique_field_constraint_test/unique_field_constraint_test.info.yml new file mode 100644 index 0000000000000000000000000000000000000000..a667c6217d0d14e5c568cc3e2c62cb482147582a --- /dev/null +++ b/web/core/modules/system/tests/modules/unique_field_constraint_test/unique_field_constraint_test.info.yml @@ -0,0 +1,6 @@ +name: 'UniqueField Constraint Test' +type: module +description: 'Support module for UniqueField Constraint testing.' +package: Testing +version: VERSION +core: 8.x diff --git a/web/core/modules/system/tests/modules/unique_field_constraint_test/unique_field_constraint_test.module b/web/core/modules/system/tests/modules/unique_field_constraint_test/unique_field_constraint_test.module new file mode 100644 index 0000000000000000000000000000000000000000..c9bb6ca484a83044ce95fbf6338551e4f92c5e47 --- /dev/null +++ b/web/core/modules/system/tests/modules/unique_field_constraint_test/unique_field_constraint_test.module @@ -0,0 +1,18 @@ +<?php + +/** + * @file + * Contains unique_field_constraint_test.module + */ + +use Drupal\Core\Entity\EntityTypeInterface; + +/** + * Implements hook_entity_base_field_info_alter(). + */ +function unique_field_constraint_test_entity_base_field_info_alter(&$fields, EntityTypeInterface $entity_type) { + if ($entity_type->id() === 'entity_test_string_id') { + /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */ + $fields['name']->addConstraint('UniqueField'); + } +} diff --git a/web/core/modules/system/tests/modules/update_test_schema/update_test_schema.install b/web/core/modules/system/tests/modules/update_test_schema/update_test_schema.install index eef6b255aa09e8a0ad1320c7dae3aff594a8edaa..12f14f2860cda87056ccc3ae8288350c6e1d557a 100644 --- a/web/core/modules/system/tests/modules/update_test_schema/update_test_schema.install +++ b/web/core/modules/system/tests/modules/update_test_schema/update_test_schema.install @@ -48,3 +48,19 @@ function update_test_schema_update_8001() { } } + +if ($schema_version >= 8003) { + + /** + * Schema version 8003. + */ + function update_test_schema_update_8003() { + // Uninstall a module with no dependencies installed by the Standard + // profile. + \Drupal::service('module_installer')->uninstall(['page_cache']); + // Install a test module that is not installed in any of the database + // dumps. + \Drupal::service('module_installer')->install(['module_test']); + } + +} diff --git a/web/core/modules/system/tests/src/Functional/Theme/TwigEnvironmentTest.php b/web/core/modules/system/tests/src/Functional/Theme/TwigEnvironmentTest.php new file mode 100644 index 0000000000000000000000000000000000000000..26f47e9068eb3c1fbd25949c43cfba2e327b211d --- /dev/null +++ b/web/core/modules/system/tests/src/Functional/Theme/TwigEnvironmentTest.php @@ -0,0 +1,30 @@ +<?php + +namespace Drupal\Tests\system\Functional\Theme; + +use Drupal\Tests\BrowserTestBase; + +/** + * Tests Twig environment. + * + * @group Theme + */ +class TwigEnvironmentTest extends BrowserTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = ['twig_theme_test']; + + /** + * Tests template class loading with Twig embed. + */ + public function testTwigEmbed() { + $assert_session = $this->assertSession(); + // Test the Twig embed tag. + $this->drupalGet('twig-theme-test/embed-tag'); + $assert_session->statusCodeEquals(200); + $assert_session->responseContains('This line is from twig_theme_test/templates/twig-theme-test-embed-tag-embedded.html.twig'); + } + +} diff --git a/web/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php b/web/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php index 2446289984eb5be96bbf13c0f595ac82595c3b9e..da02b2ba8a812668e41660d91f84779a0e648402 100644 --- a/web/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php +++ b/web/core/modules/system/tests/src/Functional/Theme/TwigRegistryLoaderTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\system\Functional\Theme; use Drupal\Tests\BrowserTestBase; +use Twig\TemplateWrapper; /** * Tests Twig registry loader. @@ -33,7 +34,7 @@ protected function setUp() { * Checks to see if a value is a Twig template. */ public function assertTwigTemplate($value, $message = '', $group = 'Other') { - $this->assertTrue($value instanceof \Twig_Template, $message, $group); + $this->assertTrue($value instanceof TemplateWrapper, $message, $group); } /** diff --git a/web/core/modules/system/tests/src/Functional/Theme/TwigSettingsTest.php b/web/core/modules/system/tests/src/Functional/Theme/TwigSettingsTest.php index 0ad88ce320bb0f5bb528bc5ef83eb093a1a02146..0aed306fd9706e4b9eed936e74189069da9660d4 100644 --- a/web/core/modules/system/tests/src/Functional/Theme/TwigSettingsTest.php +++ b/web/core/modules/system/tests/src/Functional/Theme/TwigSettingsTest.php @@ -96,7 +96,12 @@ public function testTwigCacheOverride() { // theme_test.template_test.html.twig. $info = $templates->get('theme_test_template_test'); $template_filename = $info['path'] . '/' . $info['template'] . $extension; - $cache_filename = $this->container->get('twig')->getCacheFilename($template_filename); + + /** @var \Drupal\Core\Template\TwigEnvironment $twig */ + $environment = $this->container->get('twig'); + $cache = $environment->getCache(); + $class = $environment->getTemplateClass($template_filename); + $cache_filename = $cache->generateKey($template_filename, $class); // Navigate to the page and make sure the template gets cached. $this->drupalGet('theme-test/template-test'); diff --git a/web/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionDefaultTest.php b/web/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionDefaultTest.php index aa8ba00461b152496f4a032c8b7a1bfd89684339..26f5c2c9bf5d4dff91234079a02cc3c80d71e468 100644 --- a/web/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionDefaultTest.php +++ b/web/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionDefaultTest.php @@ -25,13 +25,6 @@ class EntityUpdateAddRevisionDefaultTest extends UpdatePathTestBase { */ protected $entityManager; - /** - * The last installed schema repository service. - * - * @var \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface - */ - protected $lastInstalledSchemaRepository; - /** * The state service. * @@ -45,8 +38,8 @@ class EntityUpdateAddRevisionDefaultTest extends UpdatePathTestBase { protected function setUp() { parent::setUp(); + // Do not use this property after calling ::runUpdates(). $this->entityManager = \Drupal::entityManager(); - $this->lastInstalledSchemaRepository = \Drupal::service('entity.last_installed_schema.repository'); $this->state = \Drupal::state(); } @@ -71,20 +64,20 @@ public function testAddingTheRevisionDefaultField() { // Check that the test entity type does not have the 'revision_default' // field before running the updates. - $field_storage_definitions = $this->lastInstalledSchemaRepository->getLastInstalledFieldStorageDefinitions('entity_test_update'); + $field_storage_definitions = \Drupal::service('entity.last_installed_schema.repository')->getLastInstalledFieldStorageDefinitions('entity_test_update'); $this->assertFalse(isset($field_storage_definitions['revision_default'])); $this->runUpdates(); // Check that the 'revision_default' field has been added by // system_update_8501(). - $field_storage_definitions = $this->lastInstalledSchemaRepository->getLastInstalledFieldStorageDefinitions('entity_test_update'); + $field_storage_definitions = \Drupal::service('entity.last_installed_schema.repository')->getLastInstalledFieldStorageDefinitions('entity_test_update'); $this->assertTrue(isset($field_storage_definitions['revision_default'])); // Check that the correct initial value was set when the field was // installed. /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ - $entity = $this->entityManager->getStorage('entity_test_update')->load(1); + $entity = \Drupal::entityTypeManager()->getStorage('entity_test_update')->load(1); $this->assertTrue($entity->wasDefaultRevision()); } diff --git a/web/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionTranslationAffectedTest.php b/web/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionTranslationAffectedTest.php index 6553fcb06eb3f3fb2773f7d62b6c591146483041..b6c4fd03777d92d4c2279c9cd33bf8f146a88b87 100644 --- a/web/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionTranslationAffectedTest.php +++ b/web/core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionTranslationAffectedTest.php @@ -25,13 +25,6 @@ class EntityUpdateAddRevisionTranslationAffectedTest extends UpdatePathTestBase */ protected $entityManager; - /** - * The last installed schema repository service. - * - * @var \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface - */ - protected $lastInstalledSchemaRepository; - /** * The state service. * @@ -45,8 +38,8 @@ class EntityUpdateAddRevisionTranslationAffectedTest extends UpdatePathTestBase protected function setUp() { parent::setUp(); + // Do not use this property after calling ::runUpdates(). $this->entityManager = \Drupal::entityManager(); - $this->lastInstalledSchemaRepository = \Drupal::service('entity.last_installed_schema.repository'); $this->state = \Drupal::state(); } @@ -71,19 +64,19 @@ public function testAddingTheRevisionTranslationAffectedField() { // Check that the test entity type does not have the // 'revision_translation_affected' field before running the updates. - $field_storage_definitions = $this->lastInstalledSchemaRepository->getLastInstalledFieldStorageDefinitions('entity_test_update'); + $field_storage_definitions = \Drupal::service('entity.last_installed_schema.repository')->getLastInstalledFieldStorageDefinitions('entity_test_update'); $this->assertFalse(isset($field_storage_definitions['revision_translation_affected'])); $this->runUpdates(); // Check that the 'revision_translation_affected' field has been added by // system_update_8402(). - $field_storage_definitions = $this->lastInstalledSchemaRepository->getLastInstalledFieldStorageDefinitions('entity_test_update'); + $field_storage_definitions = \Drupal::service('entity.last_installed_schema.repository')->getLastInstalledFieldStorageDefinitions('entity_test_update'); $this->assertTrue(isset($field_storage_definitions['revision_translation_affected'])); // Check that the correct initial value was set when the field was // installed. - $entity = $this->entityManager->getStorage('entity_test_update')->load(1); + $entity = \Drupal::entityTypeManager()->getStorage('entity_test_update')->load(1); $this->assertTrue($entity->revision_translation_affected->value); } diff --git a/web/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php b/web/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php index 4ffd2558f0744d5a466f7965453499f8320f9118..87a9801ec1266f0884d4c5f1104dfb775ab932c1 100644 --- a/web/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php +++ b/web/core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\system\Kernel\Theme; use Drupal\KernelTests\KernelTestBase; +use Twig\TemplateWrapper; /** * Tests Twig namespaces. @@ -33,7 +34,7 @@ protected function setUp() { * Checks to see if a value is a twig template. */ public function assertTwigTemplate($value, $message = '', $group = 'Other') { - $this->assertTrue($value instanceof \Twig_Template, $message, $group); + $this->assertTrue($value instanceof TemplateWrapper, $message, $group); } /** diff --git a/web/core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyPerType.php b/web/core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyPerType.php index db752eaac57bb939e547d8e4c6069d3e38b436a9..a21a85e012775a1e9b496440a8fe2506452fdd2b 100644 --- a/web/core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyPerType.php +++ b/web/core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyPerType.php @@ -34,7 +34,7 @@ public function prepareRow(Row $row) { // 2 - Predefined language for a vocabulary and its terms. // 3 - Per-language terms, translatable (referencing terms with different // languages) but not localizable. - $i18ntaxonomy_vocab = $this->variableGet('i18ntaxonomy_vocabulary', NULL); + $i18ntaxonomy_vocab = $this->variableGet('i18ntaxonomy_vocabulary', []); $vid = $row->getSourceProperty('vid'); $i18ntaxonomy_vocabulary = FALSE; if (array_key_exists($vid, $i18ntaxonomy_vocab)) { diff --git a/web/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyPerTypeTest.php b/web/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyPerTypeTest.php new file mode 100644 index 0000000000000000000000000000000000000000..d5f27274b04fec2425bc13ae792e5950655de341 --- /dev/null +++ b/web/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyPerTypeTest.php @@ -0,0 +1,188 @@ +<?php + +namespace Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d6; + +use Drupal\Core\Field\FieldStorageDefinitionInterface; +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; + +/** + * Tests D6 vocabulary per type source plugin. + * + * @covers \Drupal\taxonomy\Plugin\migrate\source\d6\VocabularyPerType + * @group taxonomy + */ +class VocabularyPerTypeTest extends MigrateSqlSourceTestBase { + + /** + * {@inheritdoc} + */ + public static $modules = ['taxonomy', 'migrate_drupal']; + + /** + * {@inheritdoc} + */ + public function providerSource() { + $tests = []; + + // The source data. + $tests[0]['source_data']['vocabulary'] = [ + [ + 'vid' => 1, + 'name' => 'Tags', + 'description' => 'Tags description.', + 'help' => 1, + 'relations' => 0, + 'hierarchy' => 0, + 'multiple' => 0, + 'required' => 0, + 'tags' => 1, + 'module' => 'taxonomy', + 'weight' => 0, + ], + [ + 'vid' => 2, + 'name' => 'Categories', + 'description' => 'Categories description.', + 'help' => 1, + 'relations' => 1, + 'hierarchy' => 1, + 'multiple' => 0, + 'required' => 1, + 'tags' => 0, + 'module' => 'taxonomy', + 'weight' => 0, + ], + ]; + $tests[0]['source_data']['vocabulary_node_types'] = [ + [ + 'vid' => 1, + 'type' => 'page', + ], + [ + 'vid' => 1, + 'type' => 'article', + ], + [ + 'vid' => 2, + 'type' => 'article', + ], + ]; + $tests[0]['source_data']['variable'] = [ + [ + 'name' => 'i18ntaxonomy_vocabulary', + 'value' => 'a:2:{i:1;s:1:"3";i:2;s:1:"2";}', + ], + ]; + + // The expected results. + $tests[0]['expected_data'] = [ + [ + 'vid' => 1, + 'name' => 'Tags', + 'description' => 'Tags description.', + 'help' => 1, + 'relations' => 0, + 'hierarchy' => 0, + 'multiple' => 0, + 'required' => 0, + 'tags' => 1, + 'module' => 'taxonomy', + 'weight' => 0, + 'node_types' => ['page', 'article'], + 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, + 'i18ntaxonomy_vocabulary' => '3', + ], + [ + 'vid' => 1, + 'name' => 'Tags', + 'description' => 'Tags description.', + 'help' => 1, + 'relations' => 0, + 'hierarchy' => 0, + 'multiple' => 0, + 'required' => 0, + 'tags' => 1, + 'module' => 'taxonomy', + 'weight' => 0, + 'node_types' => ['page', 'article'], + 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, + 'i18ntaxonomy_vocabulary' => '3', + ], + [ + 'vid' => 2, + 'name' => 'Categories', + 'description' => 'Categories description.', + 'help' => 1, + 'relations' => 1, + 'hierarchy' => 1, + 'multiple' => 0, + 'required' => 1, + 'tags' => 0, + 'module' => 'taxonomy', + 'weight' => 0, + 'node_types' => ['article'], + 'cardinality' => 1, + 'i18ntaxonomy_vocabulary' => '2', + ], + ]; + + // The source data. + $tests[1] = $tests[0]; + unset($tests[1]['source_data']['variable']); + + // The expected results. + $tests[1]['expected_data'] = [ + [ + 'vid' => 1, + 'name' => 'Tags', + 'description' => 'Tags description.', + 'help' => 1, + 'relations' => 0, + 'hierarchy' => 0, + 'multiple' => 0, + 'required' => 0, + 'tags' => 1, + 'module' => 'taxonomy', + 'weight' => 0, + 'node_types' => ['page', 'article'], + 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, + 'i18ntaxonomy_vocabulary' => '', + ], + [ + 'vid' => 1, + 'name' => 'Tags', + 'description' => 'Tags description.', + 'help' => 1, + 'relations' => 0, + 'hierarchy' => 0, + 'multiple' => 0, + 'required' => 0, + 'tags' => 1, + 'module' => 'taxonomy', + 'weight' => 0, + 'node_types' => ['page', 'article'], + 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, + 'i18ntaxonomy_vocabulary' => '', + ], + [ + 'vid' => 2, + 'name' => 'Categories', + 'description' => 'Categories description.', + 'help' => 1, + 'relations' => 1, + 'hierarchy' => 1, + 'multiple' => 0, + 'required' => 1, + 'tags' => 0, + 'module' => 'taxonomy', + 'weight' => 0, + 'node_types' => ['article'], + 'cardinality' => 1, + 'i18ntaxonomy_vocabulary' => '', + ], + ]; + + return $tests; + } + +} diff --git a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileEntityDisplayTest.php b/web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileEntityDisplayTest.php similarity index 97% rename from web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileEntityDisplayTest.php rename to web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileEntityDisplayTest.php index ac7c181b5ff0d78ebd85dc2ed22af1e2a1c46015..57fe817a2d99182457f7b31a9354eabad9eecf6d 100644 --- a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileEntityDisplayTest.php +++ b/web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileEntityDisplayTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Kernel\Migrate; +namespace Drupal\Tests\user\Kernel\Migrate\d6; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase; diff --git a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileEntityFormDisplayTest.php b/web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileEntityFormDisplayTest.php similarity index 97% rename from web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileEntityFormDisplayTest.php rename to web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileEntityFormDisplayTest.php index 2fcec8dabb770b9e500bbaeea75af781061f2db1..73fdf54ffe780b34a083f0ad91a998e44a91cf19 100644 --- a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileEntityFormDisplayTest.php +++ b/web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileEntityFormDisplayTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Kernel\Migrate; +namespace Drupal\Tests\user\Kernel\Migrate\d6; use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase; diff --git a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileFieldInstanceTest.php b/web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTest.php similarity index 98% rename from web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileFieldInstanceTest.php rename to web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTest.php index ecc9bc9651f1d2252e0d2fb0f295bf4a4513cd3f..fbdcb3bf48c75bba0a26362fc83317020b6d0b42 100644 --- a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileFieldInstanceTest.php +++ b/web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Kernel\Migrate; +namespace Drupal\Tests\user\Kernel\Migrate\d6; use Drupal\field\Entity\FieldConfig; use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase; diff --git a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileFieldTest.php b/web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldTest.php similarity index 98% rename from web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileFieldTest.php rename to web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldTest.php index 75bccf14beb830e76690f003af94423b4244412d..b85295555837e1496bb7b8d7b57afa5ee63173ab 100644 --- a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserProfileFieldTest.php +++ b/web/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Kernel\Migrate; +namespace Drupal\Tests\user\Kernel\Migrate\d6; use Drupal\field\Entity\FieldStorageConfig; use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase; diff --git a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureEntityDisplayTest.php b/web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureEntityDisplayTest.php similarity index 95% rename from web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureEntityDisplayTest.php rename to web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureEntityDisplayTest.php index 0d3bb7c20607842e622a1d7603685e26506cf365..6bbb89a338039df6622388caecf41d5be1e65fc9 100644 --- a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureEntityDisplayTest.php +++ b/web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureEntityDisplayTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Kernel\Migrate; +namespace Drupal\Tests\user\Kernel\Migrate\d7; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; diff --git a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureEntityFormDisplayTest.php b/web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureEntityFormDisplayTest.php similarity index 95% rename from web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureEntityFormDisplayTest.php rename to web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureEntityFormDisplayTest.php index f75382496feda9ccfe79bf4d1ce4991eea27e8d5..2dfebe09ced883b04c1872a8af530e5c16f3fa2d 100644 --- a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureEntityFormDisplayTest.php +++ b/web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureEntityFormDisplayTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Kernel\Migrate; +namespace Drupal\Tests\user\Kernel\Migrate\d7; use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; diff --git a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureFieldInstanceTest.php b/web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureFieldInstanceTest.php similarity index 95% rename from web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureFieldInstanceTest.php rename to web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureFieldInstanceTest.php index 9b3829e06d55e05500282bb0e779cca1421233a4..b601da7de10a729db42d5794607f8298def16ead 100644 --- a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureFieldInstanceTest.php +++ b/web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureFieldInstanceTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Kernel\Migrate; +namespace Drupal\Tests\user\Kernel\Migrate\d7; use Drupal\Core\Field\FieldConfigInterface; use Drupal\field\Entity\FieldConfig; diff --git a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureFieldTest.php b/web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureFieldTest.php similarity index 95% rename from web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureFieldTest.php rename to web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureFieldTest.php index 1389693024474b171899cbe05e29458fa5a98479..7fa3fbbd0bdcd72ca4ea7fd0482a56104c57dd22 100644 --- a/web/core/modules/user/tests/src/Kernel/Migrate/MigrateUserPictureFieldTest.php +++ b/web/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserPictureFieldTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Kernel\Migrate; +namespace Drupal\Tests\user\Kernel\Migrate\d7; use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\FieldStorageConfigInterface; diff --git a/web/core/profiles/demo_umami/config/optional/block.block.umami_banner_home.yml b/web/core/profiles/demo_umami/config/optional/block.block.umami_banner_home.yml new file mode 100644 index 0000000000000000000000000000000000000000..7af458eb353d51ba8d477ddf1b89be0013003bd6 --- /dev/null +++ b/web/core/profiles/demo_umami/config/optional/block.block.umami_banner_home.yml @@ -0,0 +1,33 @@ +langcode: en +status: true +dependencies: + content: + - 'block_content:banner_block:9aadf4a1-ded6-4017-a10d-a5e043396edf' + enforced: + module: + - demo_umami_content + module: + - block_content + - system + theme: + - umami +id: umami_banner_home +theme: umami +region: banner_top +weight: -7 +provider: null +plugin: 'block_content:9aadf4a1-ded6-4017-a10d-a5e043396edf' +settings: + id: 'block_content:9aadf4a1-ded6-4017-a10d-a5e043396edf' + label: 'Umami Home Banner' + provider: block_content + label_display: '0' + status: true + info: '' + view_mode: full +visibility: + request_path: + id: request_path + pages: '<front>' + negate: false + context_mapping: { } diff --git a/web/core/profiles/demo_umami/config/optional/block.block.umami_banner_recipes.yml b/web/core/profiles/demo_umami/config/optional/block.block.umami_banner_recipes.yml index 4a5a0bd05eb04efa4f85ccd3ce31545afeb64bc1..a37d73c4ed5d615e70b90070d536938f7c1cf86a 100644 --- a/web/core/profiles/demo_umami/config/optional/block.block.umami_banner_recipes.yml +++ b/web/core/profiles/demo_umami/config/optional/block.block.umami_banner_recipes.yml @@ -14,7 +14,7 @@ dependencies: id: umami_banner_recipes theme: umami region: banner_top -weight: -10 +weight: -8 provider: null plugin: 'block_content:4c7d58a3-a45d-412d-9068-259c57e40541' settings: @@ -28,6 +28,6 @@ settings: visibility: request_path: id: request_path - pages: "/recipes\r\n<front>" + pages: "/recipes\r\n" negate: false context_mapping: { } diff --git a/web/core/profiles/demo_umami/modules/demo_umami_content/default_content/images/vegan-brownies-hero-umami.jpg b/web/core/profiles/demo_umami/modules/demo_umami_content/default_content/images/vegan-brownies-hero-umami.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ce330d42287e6d4769d5058ab3ad0075bc58d43c --- /dev/null +++ b/web/core/profiles/demo_umami/modules/demo_umami_content/default_content/images/vegan-brownies-hero-umami.jpg @@ -0,0 +1,973 @@ +�����JFIF�����������##""'#!!#''.030.'>>AA>>AAAAAAAAAAAAAAA!!1!!$!!1>-''''->8;333;8AA>>AAAAAAAAAAAAAAAAA���#��"������������������������� P@A,��((*��e�,`� @��� + a��X�,(XQ��b��,�B�@ DT�%�Q,�(Q`� +(X��9%K�H*QAB�`),�R�X���RPJ +����)e������P�XT�J���@�(��� + +� +9��,���,�, +�T�K� E�@���(,��%���JPRP�� b�H +(�P(�@P��C� PJ�TYAP(P(TT����Q(P��,����@RIb� @R(������YPJ�X�Q*�%b�Qe9��,�@@�@,EJ +XRQ,X��,D��%�J@@J�@,���(������(%�,�PJ((�������@(�XQ@���`� +EJ�TT,X�XK*,��@X%��PT�����J���(P,�eU��@�,��,��(�((R,�,��(���X��`��QIP*PH��,�@��,�%!R�,�JYVP(,�+�� e�a� +��PQB���*�� ��(�((X,�%���II@� RPe���%��J(�@YJH�D�!,����q��(U� +��,R(X�((�ŀ�J@TYab�@J��(()X@ @�JQK,RR�(rRX���(AB�U���*R�"�R�B���@J� BP�E!`XY@���Ab�B� Ib��e��%TX�-�����e�(r�@!��E� +!`��,�B��,������ +�������@�,�H,�ʕ*�@P�XXeE����AT��X�,X�P�0H���R�eJX��PRX�EE�RYeJ�������@,,�D�XP�(��R�**,�R��P +���"��J%JE� +�@�%���J� +P(P(�J�Aq��(�,�P +��t1ŞsHeߣ�,P�,�ŕ��U)T +��*Y@�8 @����@@��A@)@YB�D�P���,��r��?kG�����\^7��S���ߘ�,Q(�����,)JR�@ +�Yƀ��@��,�QAeR�"��JJ�A`X�����X�����P*�߲�r�0݄ٹ1�>��}|9~͒P��,,P�(T�`Qe���A�X%�PX��E���%��Ye��(��ePT�J� �Y@���e���z-<z�:�۫.OB�.��|����B��IPPUR����,R�"K)����T�J�� � @���E�(Ŋ�%K������QR�eX)}��L8�ݝ2�0ǡd\k��[JX)e�a��-�TU (YE�)J�%�@J%�X�b�J,QPX���Y@,�T�����,,�� P*,X,,�E}Ϻׯv.����e��x�^�_�qcamz���ca +�UYj� �R�E�X���,ZP(���@����*��Y@��(��� R��X� U �C���m�&Z�{I��N��r�����_��������/��XJ%�P*-)@D�U(TP�UpJ� `@�,P��)� +"� + +(�(���Y`"��X���Z���o����}���ܵ���1�,1��m�5z�亽/R㩾j��̐�R�j�R���E�(�W�DX %�,��D������ + +@ +�P�D����X,XQe���Z�_���Eӧ�_��ՖZ����ϣgNa�[4�e��������rs���= +�"�md DD�J��U��Ѐ@�@�X�K(��� � �,PPT��*P��(� e�`�����~G�d����:6a�͚�>��jɗGG����ǧ����kw�zm���!`3���)m�eէL�ޏV|�o��R���^z��@X�RQR�b� ��@ �� +�(���P*X%���,R��=����y��/O�}��ç�݆z8�t���pM]W��a�g����˿�^��>;]����;���j���[\���F���q�bQs���~���<�������8�O�R +�IJZ_9,�,� �T���Q@�P���@@��� + +�**Q�PX%��P��7ogGw�^L��ǃ�t��=������y�}��k���4��ݮݙk��ѣ���^�{���tv�o����>[���o�|��/{�ϟ����X���L����}=9g�ѳ,y<_�R��O8��(JK��%P���� b��� +@���P�cH @�{ܝ~��?�ÓW����̽�|�2i�.��<Z����,:8�6��p��f�M��0������n̷vT��ݖ�>g�i�ݻ������x~w�v�ߧq���z����ut��ϳ�����,��U+�AYb�X +�@X���)(B�,�� +P��K�(������������j֞S�v:�{���������v�[������٫=:6m�_F�5��>��{:�7ru���=���ѿW���<�m{:��83�>��on����)�_;�����t��7��|��^�7�ѭe[/�� T���X((X�,��K�()R���� @YE +K,T�P/�����f�zu�t���^}ײja���=���ߟ�ů^W==z0�Lr�+���.�7���������ߓ^['>�|�zvtt��ʚq߫���jt�g0��5٧�;zu�;�:�y�/���@PE���P(,��%� ��,�P +�*� +��*��JJO���hջpɆ��7�㿯&|��]s�f�&ͼ��,��Ϸl��~��=<���>�}/G���c�^�8t�l��n�'N{p�)��ٮޜ���yH��\uq�{��y���?�g���+�%�X��P((���@����(�`�(P�@��H�T���x�~�/��ц��z&<�;-�N��9j�UߣvsVܵgϟdՍ]����s�s�n�{�{���7��v]��~�ϯw6 �};�ݞ���i�����<�z}�C |�]�}ۆ�\��|���3�+̀K�ab�ʀ�,�B���(A(K����@�b����AB�J�o���4r���&\�;�g�r���pâ��L�c� Y�r�r�e5ٻ^z�ui�Ϸ-xu����ӧ�껰��fɎ{��2�ݝ��L���<�}�a�7��m��G~����{�z_)��0 ` P + b�� +��@ IP�P(�����!(� +()��RV���٧�V�S{���ʖ���e1َ7eՖ{4캱�2�t�X��X�h�eӣWc)q٩��uˏ{��ն姓���og����e�v��n�쵴�y�����^��L�-�^ǟ��� XYe!B,`�R��K�`��(YEK(��@���R�XPJ��+/A�㩳Og6�O?QɆ�nL0�����ѣ^xu���v1��l�x��l�I�Sn����[|��^ǣю<������lݎ�n�ѣ>-ݙ�g����ty��{=?W�kז�r��)�Ì���% ���R� %�@� DQB�T���� @�YB�XX�� ]�ms�v^�s�я��p��c�;��u�ۆ��K����բ��3Ϗ�,�ՆS=m�a�,��٣����^^��ۺwl�nxjcu/��v휝�|^/F���[&x��˯�~sZ<���!e%�X� +��`��X��%�)eQ@�� @�R��ŀ�J��5rs���۴���Ӟ�>]���ك��f�=�a��Nx�2٣a�VΞ,-�1���f�{uc�� �%׳]�ɷ��ٗ>�����E��x�yv��ͣ�cў��+Ȟ���Y�&8�/������ I@���(J@��%e�����%%�B��������^��F�};��ߗ&ue����slnuk�~�]��d�L&;2�n��Z��e�ϕg��4tN|�k���������Tկ+��n3f��� ���1����zY��=��5�|����,�� `����,(,XX%J��JP(�����(�J(�ł�,�6�ѧ���rl�no6�m���&�[R��ի;&fmYg���Xv�6l�,�tsΎk9�������]v�e��N�V�+/{�ݷGnZ;��[�+�ݿ6����Y���K�����,K,Ya`�R��E���B +�(�B�P��;�^\��e�V���ٗZ�%ɯ=Z�iߎ�N��c�^ʸta�w6�gϻlՇn����&���^8n���-�6o驎YFx��ϟ����=�||~�ޭZ��c��ꗟWT���o_���(`�@�TX���,��@J������QT,(�%���j��1�}:5��ٷ=���ٳ2�V8L���\���cs�3ի�ttۆ�R�OOF9hâj��N�]=���N{�7l���c��5��k�ónW0է>Όuݗ<���~̱����dY@@���@ +`�ʊ@Yb��@�����R��%����=��տ�v[���÷���,��[���M��ߧ)�ӗN����9��9�]Yn�ug�+�KU�ݿ��n{��2%ȷ�dh��WFPǗ�+�կ+�H�Y��伯$E%�� P�X�����J@�YAB��Q(�`B +��(X�%�6u�}�x4k��Ǜ��m�y[6q���ps�v�fٯ<5�R���'V���WUӜ��q�-l����u�m�����ٻ.�9gq�&3g7�Ҷ�����gva�2�&9������P�� D*�R�)�J�%�R���P���P��,����2�n�+)���n�5x0��s��M��fg0�V;[�Z�xkǡ;�sń��Nz1�qe�˻-\���z���uM�e��d�0�z���+�'6��}����V���~�������� P��Y@P��`%�P���� +PK(�J��!���PR�)aE@ ��>L���߲uw9�=ykזξ<�nՖ�պY��M;�o^��ѳ���ë�mݜ��׳nS�q��a��z=���U���d����g?*yW��w���__�����o���,P�%X�K(��Pe"������ R�R�)eP@<�yp���Óg>Ξ|�կvx�ݞY�8C �N�u��f��lkm��wg��ٶ��Z;6ۯL��˧f���a� 7����:���&2Ը���Lt���5��˥ş���y=�������Qa@A%�PR����ŀ���UQe���l�4{;��ǂ�²�dɞ��5g��2ǧ S;��.�:��շ�o���ן���8��8��9|�[sѥ���66n�}����F3d�e��]}[W)��;2���U�p��ի������@*�B��T�UJ���K((�(�*���Y`e*�PQb/�tp{;��g�LJ��r��6k����=�c�nw��]ܷg^{st篷����Nݛ5�y�l���X��ك~:����vj��L;�3���F��l�Tٖ̹�]�u�ˑ��3�����a�������PQR�� @���,�ʔ(PX�����X"�(QB�"�������Xj�|�s��������4���0��mӆD���ߎx���ggW;��wf?�G�����u�l٧W'�1Ӗ9e�e�gO�����y�z;���1癵s������{�Շ'�G>���2������b�@%��E�(� @��))aB� X��� @YJ +P�e@ Y�|Z��e98�ןo��:�V��y:�h��f8�v������>n�ק������~M=��|^/��s��,�� �vr`�w�ݿW�����t�=Xc�k��x�}���=_��oM�}��w猷����ӧ����@YQH������K�� +(P* eE���X��,���� Jl��h����������9�����ߣ=Yc��Q��ݜ�f�[:0Ֆ��ty\}�}[��kg�,��\4i���է=���˫��˟9�����ק.�N�;B竟���>;�ק�?S��u�ߧ�{ſ�����ɀ��B��"��"�PQE�a`����`K� +,����J6u�rs����ѷ��ק��]<]�6�7��HُG-��o�\��կ&���=�z=��^U6��ra�_'&:v3.]����ɖ��nYu�˟F����Y������h�we������n�}���j��%��� *(���,�, +���%�eB��B��,�A�v\��g3~{�_G|�+�5l��w���ˣ�f���M�o�g>r�]�t�[���d�f�;��s��Xj�����fz�2��l��-�����v��c����5gׯӺ0����C�W��G��>C��_� +E��@�@(X `(�� +��������$� T��u&��?W.�C��{|���DŽ�g�>}ya�e�ѯc��r�٫8Թ���Ys|�/��M:q�^�7ɻ��]�>���2ߣ^ݜ<={sMݞo�� �O�������g�χ��-x|�ލ�(��T���A@XJ��Ye� +�J��*������DY@��Q�*���^���ç��|�<��=�oO=ў�n9�=�������z8�n7nz����[/��x��>��<�Y��7ŗ:]�>��ny��۫����l����y�?����t����bq�����Yx�7���|�@X �JJ�Qe�"����R������Ye%¥�,�T��ʅKէG=�����=,95�c�^���} �VSLכ^n�}�vꮝ]a����o6����6q|�̙z�c��`���a�,��ݥ�ލ�n�����o�����oѣ�������z{2�}�tc&��g����_���(��E��� R���J +U�B�����)(�K(XX,�% e�×^Z�0߿?C��[}�o3oVf�1ۣoG&wo?J�[X���s�/?>[3�������}�<�Շo�����2�<���=�O��{��O_?���o���x������)�C?3�JP �%�P(P� @�PQlR���A,���(b�����%"�\���#L��.k�qo��F1�jɎ��fc�[��ٕ߯�-ӟ�˷=�L����-�s;��=.�z��я��Ѷ^� �_�������wa�����=,�f��a���ݟ�>@�*�E(�@@�� +���T� ����� +RU���,PK�ϯn\��M���l�z9�l���~]��v�^<����N͝S�V�x��%¦[��oӫ-�<������̼�[�Վ�ݻ�4�~�m����?��������ӳ���}�[,���~�C�/� @T�T�����%��QJP�XPE����*�(Ł(%%�}z�g�<y�߷9�&��S�dӷu�k�v�n�6kٟ�\n��9xsխ�f�v8��ۿ\���V�vu�l��}��||�^�\y����������xS�݇��x���� ��k��c��?ޟ����,�B��,�P���@����P���X!R��v<�x�0�-�'N�yf��8�j��M�<�k�y��v��_W��ن���z�����4��F��8��4ttl挶cVgѺގ�[<0�:/.�o�ʝ~v���'�ps��w���~c���7L��գW'��uO���@"�R��X@�)E(P�@����((�%��K( 1ٓ�}8\:���1�;���4���eυ�.�َ�>��3f��ޜ<}9]v�t�]m���˗^y�ђ�s�3������٫=�2�s߇?F��f���z�f����te�淉����7�v��� + +,�%��)B�@(, b���P�������TT,��p�ێ�:]�c�^�>6��t��ϟS���C_<˻��ǣ��=>_>Q�џWNy���ϖ][f�x˞��6z^�_4�����������ٻG��G�t�G~~GOu�g�F�k�m��/oO��� A +� +YB�H !��T�(U + +������BP*QQe�+& H�*]�g&��6hݲe�n�[vㆮ�Xml��۫<���l���WVXy���v�}zzu�-����ѿ�����=��3��}�Wo��o&ݻ9�����m�����������y�9�]�.��j�wM�k�,@�eX���� +�E +YJ��B���JH���b���|�"������mٖ�����,&��nX�W.��8+n�S�� |nu��ϟVٔ٧]�͘a�a�߿9���g&�{6r|���۸�u�z0�{��]�t�j������;��n=�N�,:����!X(�P( @�b��E����@ ����*(t�_��^>$XP]�T#q]�<n̚��m��ѻ^�9\��xe�٫>�N��~F�v���No1՞xk���ыn���2�f�ޯ[��ن�^�<O'������8:::5qn����}Ɏ�Z����㗽�Ƀ=�?;���p�� A,YJJP� @(�����%��-�6�O����sq���/:�GF]��^��Ę�I[2�1��v��m8� ��˷-L���ӫE�,r�=,�۳F=6��~�vk�T�]m�^ߡ�z\�|�/� ������ǗM��1l�|�S�1�n�?��Ϧ�����t8~+���� "�)b���@@��,*PYJ(�@@`%P����\�����s��,tk�ϝ�u�_?祀���c|��q�O>Yec&8�7n��߷,<ޛ�-�~}��տ=}{5��F���:�/?w���|��O,f��ci�g���oß����Շ��/_n����k2�-o��ۜ����7彜���e�����������H��(X��@*P�PPP(�� P `������*�q�nYq�xq��hю�7O��Y��~�������PI0��w���k�ի-|>4n�ڧ�����ǧ�-�\��ϫ���4��uM3.1�����=�����Vs�>g����N=^��ѣ�_.��<���C;����>��>�w&���<z�<�%�T P�� + + (���PR %� BU���m�����$<�a�N�Z<�'����z@}չ�k���9�<�yb�d��G=�2��q���ף�M��~���+�َ�3{/G6x�t�l�}9g��v�$�mz�M�f�'��w��4o�ׯ����Km�4p��3�>�n�?^��?�������"��(P,X�� +P��,"� ae@B��(��w��S�`�_4�r�N?��ݾ�g�x�I�sx�կ3��5P���{s�3�z���tiկ���Nz�忓<���:90�eۻ.L�����|�f�.-u�\6}'������rx�?k�ٯN�������U��0Ѯa����=lp�������@����@��b eK�(�YB�����P B��������Vg9����xwz�>��j����,�Ó~zy4�u�y�o6_K����qa�^�ZtjףO'*2ٳ�]��d�n߫6�Wf�va�ە͎��Yo�h}��]^���s��t��__�׳f_;��5��s�ړ�Nܵ����yY�E������ X�,�X,�������,P�T�@P +�Q,�����er%��=}���cO��c�Xui�<�-��n^�yM:6�Ó�-��cv�^V5w}���dՎ`ˏ �9��?6-ʰ�2����jݷn��Z2�0�k���|7D�t}g~��o?6��Xqgі�z~o�:q��z.Y$�������uy^.�I�w���e���P��Q`�"� +�P����(Y@@)@"�R��~�ʉ��/����U����q�r�G~����4s����2��o_����<���ec�v�<<�����4B�6�<��ypۜ]�}��7�wfSw�wv��O/7�����٧s><�7��Ir���<^�g����N�>�X�P +� R�@((��eXX� +�D�PT�(Yk��ݛ��?�[����y|�=����}�Uѫ���Ɏ������G�[����r�v�~f{��y���ۖ�7�-�x�o̬d��)Ye�f�Z�M��˿v�-��fi��>�g���<�[4�ٟG����Vl�I��,<����:�>o�������X�PX�P�XRPP�(J ����PX�,��ݞv������w,5��ӳV���&̷�Mf�����:v��z>{�ץ��~�X�ϛ^^�ק9���ٷ#�l�M8��[r��f��Y��oٖ�K��>/���}8������}n]ݞ^����}��� ��.c�w�ӫ��IQ`�Ab��%� e�Je��,(�"¥QH %��]�e�f���W�i��2�{z:6�pym���7t�ۜ��yy^|=.�|��������c���N��F�m}���,�/�='����_'� f[��y����������������k��<6{{�l��������d�=ߠ������Y\kJ��|���oN>��A���)R��EE��R��P�A�)@�,��P*�?��~��ͫ��V�7e�~�O7��lӣ�GVyp|��>����Yh���0�s����������ț4�a�G��O��Nz����V���cZXU��ͻ���::�����������ϻw�����Ϝ������\ug��2�o����{���������� `,���,B�ł��*YJu��F�9���]S�o;=�t�����+���e�W����0���q�9q�����<�^��rz9r��/7'g>S��ǓGV�o7N��������{u|߅��c1���S%�f;��vz{x6yϭ��m�����^g����tr��]�=?WjM_����=>/7��P@( +�)(�ŀ������aE� e +,YE/G�u9�z|�5�y��mu�c�~�~�n�������������_Z���|\]z-�t{_E��־^�v��]��NZ�x3���j���2�߫�����.<��\�����6aK2Ʈ[sٳ��ӯW�ՇF�>�_���^/S���w�h���o���ף�Տ�g�^?�������*,����J�X�P�Y(��J� +���)e��o�߫�w97�ц<��=��Yz��ûn̻wt��>�W>ynÇ~��a���-����{���x�>�)���_;g��m�>�CN��y�����yv�v"��.�4��n��X6t�1g�-~����S������};/O��/����/�ÿ�?W�_��oÛ���z�_���(��� +J�J��P IP%���� +YAP�����;��p�8�z�0����'&��[v�m�o�_��ţw�g��~s��GV\~�s����&�W��������Ϳ���2��������m���ˎ/W���R��&yk�-��I�u����흚���&e��ߡя��W��_�|Og�����帾���˫>ݻ~>}/'��|��(R�X���R�������K���"��PP�]�����Ə[_�������~'g�u���G�{�^={� �m��kw�~������:�����4��ϡ��|���F���×^������;���L�ӄ�%Q�1Hd��nX㜘�R��o���vᆭ�-ٻ���ϝ�����}o����O�����2���������)�R�Q(�����JX���X����(Qe�{V�xe��v�-~��S�G����ta���1���&�wa�̞&�����6wl�����W���o/��x5w���7�I�x��ykë�,9<^|{:<�SV�W#8H6�0���Ɍ�tke�vk`�i�-�-��]{x:��=/7U������G���^���W�rs�O��, +B��J�J�RR��`T�����*��PQAJ��w�o�th���vpm�����Y���o�Ȏ�o�5���'�x���o^�˯���ח����sy���m�>g\�4ɟҵa�sf:|�#�Ύ}Lr�S��"�<-�l`�:�n{q�\�Xc�l���&[�}��������zޗ���~����s��K��ݏΒŁIDP���E�TRQ�RXXYP�����)B�����û>>oj��������ׄ�6lӻ,p��vo�������/���_Kѻ��/+��n�6vs������]\�>^�W�:yy��z����f�����kݿ��@�<������g%��e��:��[61������?OW��}w7c��p�F�c���x�|�e���R,��YA@�,��, +@����E6}���Ƕp����}8a�}�c�T��q͇��i�>���|��������纼��C��Ǚ�ǯ>\23����ZǗ�������~��Ǔ�����هI�D��.vkY㌣.��CM�V��\5j�m&�����燗��l����-;ў�Y�����|ȀX�����X�P� P�bQ�X�X���K(�_E�ڼ�>��qx�����6n�ukMz<&��u�<<_?����#��stn�a�nX��s����3����ow��������5��tx��=-�]|���f�|��p��f�. +��@Y���ӖZ�n�iӞcYg������|:U˷��ճ��˻�����}^a�, +��,�X�)I@�E BX@%�P B��QB�z��Eͧ����W��:������s��s�~F��}��y^o�o&����Z9��ц}����ѧ������˖:���H��n�ߢ�>_����Yj�O7���ӓ^Y�������h�mߧD���e�ݕ�W/�&͖��ny�������9�,�������y�1�|��[��R�������D�����(���� ��,�B��z[5st�����z�;�����nY��'����s�>��'=����ǧ���L��2�4o˚a�կ~�nw绾�m�o��g����-ڴg�����tk��s�<�~�O��R����X�]eA +uz9�5qsE:&[6M����_[g6��?��%��{=;�tl�|�xpz���,�e���(((�E�P���e��(�� +(�6�3��ۻg����^���u��[vk�:9<��]���{f͜���o�:3��K-�e��[u�z��k^ ��h�j���5psl���ͷ?#��ɣ����u�r�Sq�~��zt���\E����á,�����ٖ�s����;����L�ߤ��n��m���/����P*�V@)���EJ%E@��T�(Q}-=x��2ߎ:5j�ײ����>����3�gѻ���eۣ]m��ߖwd�a�ˆ�p�����/>�0�V�\���Gv�}���{6r�4s�n�ʳ�tl��1����ѯ��7[r`B�.|Hz)�wC]���c+���[����͙�m���~V�P��P,��� �� e@J( P-�4wq��\;zp��v�㗻^ɞ�����������,�vc���������ݳ0�3ծa�,[��-a3�^�N>ߡ���<��.;-rlL���<�/7F�[6���=��'�j�vkӖ H�ݾ�zva1����u��ϻg��7��=�7�ٳfy������Yab��(* +AHT�!��%@���@�������q��ї��L�ݗm��û����pk���ůCn�u];�^[�u��]�6L0۳�O��Y��/��V9͛x�����۟�:��S<nSu�NN[�&{��xue��+|�j�K)*�XX߷-�W>����u�p�����MGŖ��zrt������I�A@�Y@�����"���,���b���*R��g�n{v�=>7�џ��:/o�ͼ�^���V��� �<���e�����<��ێ���L:����o�˟�V�Y�z��r�Ӝ��N5�ucvg��z�\�#c�sL4e��o���*���]����5Ϫ��M_Kջ���K��~�����{~=:�=M�=�c��E����@� +T�X�P���J��K�P�j�VZ�w{+���M\��:�o��������❚��ѿ<4�ٖ8���-������c0�v��c���\\��W=�3=Z��յ�8�{���:pճ��^�g�;�8��xk��f����Tٞ9�Ŏw\�bY^�ϙ����7j��s�:f����w�z>?���?3�ٗ'��z;vV���PXXae�B�(�%� �� ŖY`P��rtc�l��>��-���ۍ�ϛ������|.;6�ݫn�6�Ɏ�|�ɞ�������z�ٿvz����ַ���ݫ��<5�Zp��6h��v'������m�=oW.�_=�~[���Lu�,pǧ��qL�Y3�>��tz�X�ӃO�ѧ;FϠ��Ӟ����n���tg�?������JP(�X�(�K�� P��P +R�����Y��m��8|�lz~���3����c��=�����x�n�^����6����sut�]];�5��\ڷ�L���a��=����ׯv�-Z:u�[v|�q\[�����c%�6��q��ۮ����w5`���/Sw��,�g�����^~�,m�˫VW,��3�����οW���İ`��J���J`��B����P�U +��l��0�ՇV�3ٳϼ8z|zv�aգ��~��Fwe�͟F�r�vy;z�c��ϣ�����Ɇ2b��L<�'GF�uMX���Xz�����������~��N͗�~�n�x�jer���p�f8a-vw�Z�-��˖�9v��ˎ���<�7�Ngg/OV�//��OW�EJ�),���J��(��� ��!B��-�[�wr�ϛf�3�ol��t� ]Ӄn>��÷n[s������r�V�Y�ѯ��ن]��kg�wpßG�.nϣN7���>^���u����i�}<y9�ӫWF7=�6�~\�1�>{���Cmiƫ=���ӿN� �q�;U�]]�:�۫~�7 ܻ��˳ўH�P���JK������� +QDB�K�vp��4�|�ѿ�<�1���ק�u��:y4�۳ ��z�\=���u�]Z�c�Nz{==��ݽY\p�˟WCO����|Z�w�Fތ5sj��nS��&�#VY厽�2�f����p�^��Mz��6�0U�K��цɔ� yt�uk���y���NX���e����잶.�Y@����P�R��� A���YEUT" )T��w��9�Ν9m��Ɇ9�σGl�gvh�ëV~�]v5a&�)���[{:����ݺ8#�����N�۹q�8k����<��NŽvq��˦1/S2�q���Ӗ�p�=?;h��$�J��z\|�,��x�k��ן6�Yg�S�~mӣ<�3�a�|�<��|� +,����P����� ��(��Ā��Yt�vh��7Ls�ݯ^�]���j����շO�����zX�t���k���~�f=ޜ��xq� �7o�����r��Ny�pumӞ���q�2ծT���˞8e�ٞ�jg�����N2����&��ً,u]����w-X�f�:9n��[pa����`@%@)(�,�e��,X�"�X�(�ڹZ $�(��۳�>.����x� {�>�Z�g��^�M:=MZ��߷�Ui�ю���-��=����ß^��q�ϗZjϣ_/�|�2����$�(Ɏ0�,�%g�-�fs���~�<�m�Y�6E��3ݎ������f�N�zte8�׳�,'=8���M���e��RJ%�B�@,� +K*�����D�(����+j�$��Uo_=���t`ûg6���nz��ӯ<vs��o�f����1��6aͫo�׳f�Sn�L2ק|ի�a�ov�>>9��gs�1ų9`�����&bc���u�m��&2έz�{6M���e����=Z.��s�ܼ�-�N{��ՌR����`P�e��e%!��@AB�2��$�b��P�~9�e��~���iߔ�C<��/F���e9�eq��ѯ �;qߍrh��,��zqc�!-蚮ˆ����fZ�a.X��+���g�e��sUk�o��j�� a��uq\n�}��ٻ}��͚z�z�;�ust�ݻNXeͧ�Z�y",�VTX `���J����B,��[nW+�RH�@X���Mז7^�1�ۖZ�c�+ ����z��,;t��ͧ97as��l�ۢiϭ�l��W,Q�Z�dm�ͺ�`ʩ��.X��]��=|x�q�Yl���c,��2&���5j�aLi�����pN�gup�l�M�y>�d�Z<pD��K�Y@*P*�JE�@�jܲ�\��F(�,'f�i�͋f�q�O���G^�r��r2ӇvMzy�����F��_F�5ꎮ^z֓f�1�j�욵�n��^9㱋����`�0վ\�ܖl�o��m�k�L��5Vl�m��.<����s����͝|\�vo�yy6p���e��tx�)lE�,�A@� +�A��J�(R��+�J��L�l�^W^YN�;.�y�W��V��]Zv��ێysy[.��W�^�f�S^�ߣ� +1�潛5\��%�f91�.�~]�el�猓)qճ,nZّ��y��]� ��,R�Vc���5�&�<�=ӛywc�;��9��ٞYi�����͆<� (RP�E�,� +)�� e��B��(�2�\�X��H�l�M�˽����g1�˞~ם÷ +ˣ�����g�[��Ή�x.If2�e3��*ɋ���ٍɧfd�a��*��el������&�qɦ1l���������l�\}m�^�3���ю��f�7Ӹݗ���ٶ�ϗ���K,����P��P@��� ��J��r�,U@ $�0���k�V��-]9��?1���3��<sd�v6e�-��g?+vYL��eg0�Ęl�7�V�;��R�I6%cpщ�mcs�ɖ:�L$قRk���N��v�r̷z�G��c�̵s]����ŝَ�_������G����K +����,�*XK@��T�jە���FVP�I$��l��W]1��)�y�8h�n�h��ߪjָt��y��瞞]zeٻ~�m� ��0�c�S8�q��^=��f���Y�ϑ���5�<}?V9I�Zr��9K,��������s��fxe�>=����5����-]������y�;��J������P�@��EU)j��\�R*�K,��DM��f=��6s�ϝ�gɆ��{u�iٮݍ�^�r�ߎ�xqt�ݯ��%��qחM��lo�5�Ӎ�b3�Z�,ێ��a�z����ͳDѳo>yl�l� R猦q�1��5�R˟�>g 8�����ŗ.]�[���zvg��p��<'�k�� +�*��e�D�)U` �����iUnV�m�P��h�bF,w�r�y��>�|�� ��h�6���5t�z�h�<sק)��v,.������\:;.2`�2���a�����va�����,uu�^��ѻ1ߖ�rK�Mن�x6IcX��������7l���S^���i����g&��͖&�Sg���(@ʥ,T��@��UK���JUVKim��nJ�-Z�Ș�����;wpほ���ʹ�V���۷^=�r�N�0���٣|׳�F���n:���u0�v�t��$�V�Z�YYc�+�<`�p\�h�=��������+>k� +�Fz啖�l�se�f}]������V��&��z|�>�<�M���1�٣�O��X����A)*Z*��B"T @�UZ�ګY[��� +��T��������y�>ޮl��sg�Nya���tg�:�wr�k�����|��k��j˶��zya��s4�Ϳ]Վ۵���-�j�f;1�\�`g��w��.���.���cYLr�D�=�7Oo^�cn�>O��.�������˞W�e�_6�}o���*R� ,J)UE�@ ��Y.U�*��+m( JQI$�����ϟg>X�<y��ǻ�]��K���oW�.��%�v��~z�z4k��ŷ=�3��6MX�c15b�0�X��vMy3��k��ٞ:�l�e�,,�;�8�bӶaD�z};:9���}�t�����6`�.Iq˻W�ߞ�,b�1���)��(� �"�����(�D�R�&V�r[���iJK�""I|�}=;|k�g�Ynת�نYg����tc�yr�s�0پ�ï��&;{6I6�Z�� +b�k�d��� ��x圚���K��9��.}[�cY똓�Z,Y�>����y;��߾�s��c,�zu�۫�g&=;��g�sM��_��B��Rŀ�P��)���B�UR�m�[mek*��"D�u�p����l5�t���f|��-u�ۏGF�p�0�V�ˡ�s Ϫte�F9n�ӹ���f9Y�n��3�����T�1�,�pc�٪bd���F�ی���"}��ѣ�r��ݎ�_��c�ի��> �u]ڮ���Wu�V����-@ @ ��%�J�$ ���ܭ�+L���KJ��D��!���,�ٯN�pݷS&��;���<��Ş�~��{yuv����iӻ~;s�����y�eqϣ��%�$���l��l��6k�²T�3�ژ�[n� �s��,l��[�� p�H���Z�t��ӷFZ<o?��=8i��5g���vXj�1��Ӗ�5r�-���YaP��UQP!���VL��r[V�Ke"$I ���oG�xg�������:l�ϫ/Byz;�a��^��|e~�=k�y�Z�Zv�۷xgH�%M�cr0��7 u��s�tm�α�+�]�ta��q�5���0Kf6C?��%������j�v������͟>Y�tk���9q�~�l:4��@PDX�����$�XPUR�m�ܭ�V�(F1�@u��y�=<{1�2���22�GL��+�^= �]�4�]lpt���zw^]\�9f[7&�d��Yk�Ӟ)e2�^9e����7��KV�aӌ�)p���3٧MBl��=d����y�.�q˦�� 1��q�߷q��i�4�ٻ��J����J�,��!(@�������m�ە���h�JBF2D�)[��^]�\�姭�-[��>,k9��:��N�z��N2�.\�=�o���Ůmˣ^�0�\�,u�4l�;s���0�9��2�̱��6k��Z���]d�Y��хE��o�ϯ>�W�������y2��ۦkϿ?/9wo�y:57[�:v사��,���XUKe"BP(ZZ��ܭ�*R�(��I�De���>,g��G>��7�����twie�����F�Ӳqk��`�wk��{�����y<�|�&8�V��V[潘�Ĺ_[���&\v����Knfz�Ya�lrk��8a�SoTٮ_K �Ύ�������ߧg/N��c��V����m�<���k�P�@�(,��BB�ګKr���JRŖ�%��%���Z9e������tn���.7�>{ɷv�w ~��>|�=��Z��F�}`�e�O��W����2儛1����|,2[*v���˝�f����m٣V{&��Кb%!�Y��;�-�dzz�yu�l�.og6���ՖwO�^�n���@T����K@U AUH�m���j�-��`�� +��1��ӧ�Fףy�<�c��o�����7O7T�=v��.Z�����WF��᧳�^����3��4̮5��ᕺ�ٮ�O9m��Xaէ.L&wJ��n]��K&X���Co�����f�ܷ�����]�~utI���ٞ�������̝`�*XR�,�R��X�,��HR����+�Km��%QeD%��ڑ�u�wt:��k��߇s]݆�����M�6hճ%�ˣ>~~��xV���ה�\5m�2$�}���4tg����ͻc�+��� ��3�X�q�[�Ը����:9��r������w���֝y��㥞�Zl߮��˓m�E��,���*�T�Q��ܖ�[�W%P$�Ye@�,P@�m� ���×Vz�vs��k��˸�k�ߖ���}�l��՜�ǟ_V:m0��f�vk���3�\\��q�X���^�l�Ϝ.��0�c�͓Oo,ˣ�v�K�;�Mz9x����4g��K$՞:7a�F�k�_W��,/F�ͼ��\ܺ�n���߯��(���)`��QE��R�E����m[r�Հ"" V��X��"�Y\��V����o���仱件.Z��5c���ϟFsg[�gVe��fY�p��͉f�5�N���=8�,&xe����2۷�_m���˯�ڗ&YlɎ�Xkӣ����F��^�sv�6a�Y�َ<��Xl�{p�躸�^����\���,�X����R�U[))Ke�+m[U� "�!aJ��2�b��ܭY@�V"c��ݷW���ն���ч.jҙoٞ��):79wm��Wݺp˧L:�Lsc����}/{��^_+&3/K�&�{2�z3���X�Ֆ��=�[��z�է����g�=~f;�a�s�<v�����^x2�.ye��&���}�fG�� +A@���V�Z��V��TZ�jH �$�Ҁ +,"FL����Ȥ��O���|?����Lz�y>>��c��<n�&ݷṈ�n7g���������a�^�72M�����>G��ߣ��/c���4zxy��(���s��:�i�ѷf��[��z���������s|�x�ɖxd����هF�{2��c���y�.�=T�}?��P@����j�[V�+%�r��Z��KX�Hd�2��+"���r�h�ٯ-z'z{�Gf[o��\3oڹ��:l�V̲�2�2c�~�����~f90��n�l���7}N]|��?�զF9���ׇ7O��o���ӷ�ֺp߳ \�o�߿~ڹm�,u�� Z9��.�����9m���]��ٺ�F[�u9we�\Ӎ���o�~XPP +E�R�ڶլ�ٔ���[J*�b��-RE[m����mZ*��x�%������th�������ن�4����r�1�٨�,y�\z:�O]��x��䊷+q�+�oGWO6�;8����O���w�ӷW�c�������c�n��e���&�uiӻf�\�?��g��r� ڵ�a�ݗn<�[�^~�����1ˣV^���T + +�����UYR�ʩVPgrYV����U�!J�nV�k,�5m�UUUig��zq{>��ճ sh�/OF�/�rk�#��gn�UM8�wwF\�v7R��p�d���wj����t������x�|=^��'���=�c<�{�N��.-۲�:���ѣ��vuvt��ã8c���o��0�=�����Ӎ�s3՞S=���YAeR��U-��+jҬC,��T�W5�Զ��iL����\��<����U.�o7�y���>�WfZ�M�Z5k��y����1���v\u���g�Ֆ3)$-�!mf���:�6����v�����{{���W?��?o��Je�����=��rӻ��fva�;:����sߧ�g�f�:��x.�7\���u�a�_=ݪ�\5�t`"��(Qe*�j���r��jܖKe�UmU*��j�UU�)�Vйe�W,�H�PL���1۟��m׆�g�6�x��Z���Y�I�6S+�CV[��η�����Yc+닜�o�Ֆ�g���<ws��M����nμyq���o�`�{=>,�9��,�����3�^�te�<�N:u�3�v�:��k�2�35�fYY�n���^��e�RP(R�"ګFUrR�-�%[m���md�QUh�\��ە�nYe�� s��w<>���\<N=�9&}5���;nZ��ӧ^3�YKp���a�z;p�?K��o��<K��,�K2߫o�v����~�0��N�.�����9�8��%7ua�WW��˳v��|�.�O��z61ׯN������h�ӌ�)��u`���0f׃fs)�ͽ;x��83Y`YAeQk&Km-[VR�mVJ��m��r�m[����j�U(<� +�eh!f_�rw�^��V��r_W�=�]��;;���N�} ?#Ȁ��1����,z�7mի�>L&h%�m���}�����sc�n���ɳ&9��;�^�ݞ^���_=_/�/G�����1�^�][�7�ˣW6�F7+0� !��ba�=���I��ޖQeX��UUVU��S**ڶܖիm�+nUm���m�ە�J��B,�Ps|ߔ��vLg.;�kc���~n�woF��~�<�^'/��X�[�Z������u��m�r�߃�y���Vt�_N|����cq��Ն�\m��ua���M9I���|�:?G�ٓ��>OO�{:6\0ף���ssh�F�r�n9�1�%�Lc-��Y�Y�,(�,�K(U*��j�V�ȥ[V�m�ʮU�\�d��m�+m�-)@RW<�L�P�_5�q���߫|��t����n����{;7m�9zd�y��n�R�xao���Yg͇vy�]9�h�g���w�8z������G�o'��oa�e��\ÃU����uk����������y\�;vq}����?)�Z��{Ӹㆎ/;D×V��\ʱ�g��qq���q�L[�fV�O^�(����V�k;m��J�*���%��j�Vܖ�m[m�[nKJ,RP(�)�)�ݔ������vs��y�� ���\ww��Z1۳�2��o�6�WU���ن:�6v��ٶ� ~������zy���ϫ�N;����vtc��L�3�8�]���ُ����=��o��M����v�,p���?�]���ѷW��s�<���Z�L���e�;0��m�c$��۠ZR*��V�nU���VګiT�m�m[m[m��ڶە�m�(ʋ,�W��cs�;��xS�� 3�=�6h�^}y�pO_�����jߣ�g�\<?��~^&ͺ��_��4�n醷_v��S[��������w���>�G>�kNW;�ݚ�,���ɗ�8����^N�}N�|�=n�5z��$�)�?��wz�8u��V�0�I���Q�1�����=�s� �^8�|*҂X�YU����rd���j��-�jڶ�j���mZ��j���YR���=�)f[p������4tc��熗uz����<-�l��.�+����ɯ����ї6>��l�D߷��a��G�;f:�����ֶc9�Úm����n�͆���ˇ��<�?��y���~��N�����G���]Z���j�:x���[��f��r��6�W��<��I���2-�)�G�����86��y�8�YKTª�V�m�ն���*Ҫ�Z��m��r�,�ҭ�(X��� G��=�d��{t|ǃϷ��z�7c�6��5z~�2�<�~:w���U�����\����8��1�Ok�urm�ٯ�.}x�ӟ��tcwNO�]Y��q�Ï���z5���ٶc����|�W�^>K�N��~?���z��s_rݒ�d�=}���.���x>?��CG�����K�xk�-�v^n��S-�n��//�3� +�����Z�*䶖�*�U��Uk%��nW+��ے���������l�<�;�w���8����<ۗn�^n�3�Ɏ�^��f��}�Qn�??7$�1��OW�:�l0�7�}����������r���ny}����n<p����g��������ٖ9l��x}l7|��������jݳ���֟/�ٲj�佯c������XɭͲ��*����y�3�e:>����^>�o��l�PT����jժ�V�Z��j�m�ܙ[�+�����`��%,�i����y�����?��x��<:���5�����},����8��V|���N���y??�1���ُ��{������~;>��N>��������uvn��X��>͞���&W_'���/s�:F�-�{�]i�c�vz:���~v��j�}G������<�����?6:�ٖ�C����ɫR�)��}�M>�?8w}?�g���[~�����*�Z�m-��jե�m��nW&ur[mR�����"�o7�c+�};7k�|�8|��e��vj�d�.�Ω�/��s�l��oFCf^?�h�;rգn8r��߫���s�~~���uh�����ە�]}��v˞n.}��ݷ*ɯ����~۷|�s��?�{X�\WN�]�pǺ�y�|����e�k������o^��&�~?����]���}�4�V�Nz�*��&ٖ��{���7��|���|>_�����V�յVյUU�ە�[�V�mZ������PעI.ygsk���z0��aݻ������g��7����c�>��9%�+�ue�^��a����^/.��G����yڳ��f��{�6���l�4�o�ўy��o���O�C�\kϷ��u�p���~{�sq�l���+�m����}<~}N�3�_C��:6m�����_=�E�2`�������<^����T��U�2�V�Z���+��em�UZUP����(�(����?N�=����#����O��������c9�.<�~(�Ѯ]Y0��vs��&=�����7nd-�L��۞��[o��tmݳ+j��~_���$����];5�ן��Nͺ���4�գ�������y_k�����ޞz�=����_�ӻ�x��WwW*y�h�&vf�wk�O��O�z�OͳvX��A�T,�QiUm���mU�Um�\�V�m�Z��e�� +(��o+帮����^���]���ы�wGF������tc����c���V9&��^_'�����͝[5�˛�sn�s�o��ק�zv���mV���&w�ή���j�ͻ��Fܲ�<���z|�z6����۱��ӎ��S=�O>�&��<��Ռ�\eَ{5������ѧ�L�}W����)JU�V��յjիW&Y[m��R��J��(Q@�A��|�̸�xno����m�F=[��.m[���k���\s��������oK~[��1��Ӈ��\�5L��~u���,�(��<�kO?��z�z����E��m�3��ϧ��m���N7_�������p�c�-�=��ц�,pk�K�3fs���ӷg_^�����%�P�U-[V�jյj�[m��K��Ae�%@�(P$I%����W��:6��V�Ӟ��Xi�>nݚz����ea��O'^��v��0���}}[���͆�}S~��:LJ�����[3�2�9����K�Ww_oV��z�tg2ȸ]���<��F�:0��o ���|"zs<.�~gva�3�s�n�oϻ^�]���w���KBՖ�V��jիJ���%�U�T,�X��H����[m,�y��գd��GO^��Ӟ�ѻ)��r�ݯ��߆���C,:���4˞8�z�����o�k��ק_?���6��K��[s�͖�m������q�_��oT�\9n�{6�c������\r�;6e7M~sN�N�|��W<�s�,�%�v;�b�� Y�����>kNm����� +*���V��UKKjܗ+j�բR(��R�HI1�Lm��e��y}=};�s�2�ޭ=8j��l�6��^�z1Նz���g�V�����M;w9}{:v�����F�?���nYeny��Ǐ�v������G�����twm���e���~ɧN�p���3��?��)��g��^�;:�pǻ��[Vެ�?,�2KVl�����&�:'����vl�����`(E��mU�T�-Z�ܭ��)i,��)E(D�c$�&Kj�/����?�ͧ�v�5� �urp�z8���zy��i�ݎ<�v�ɳ�˕�і�4���O#潎�[.�oc.^/U��q�-���_^�8|[�ѳn[2����MSv�r�w�?Q�vg�7��spr�p{;u��)������E�^�;U��ۯ��n���=N�Ԑ����Ӯ�ܹkٳ.��S������߳��� +R���իj��-�m��ʭ��e���@()JP�Ld�Uɐ�~w�8z���l�^��z��n�U��ݫ_V�KǷ^8��ua�oA���v��������{��9y���3���������d��ٜ�<�V�`�Շ��g�ū��_[��s��}���vg��C����}{����s�C����˯o3o>z�p�V�O&ZsϟN�O6%��ŞYmѻ SvR�S���s��9B!eJ����mUU)h���m�մ��"�QAE(�e�D�"XZV|��rv��lϣ�j��ǣ�N�����yug���s�|��ێ=��z~���۫�����7���_���d�;�.��N�G��<nOk/���s��k���zxx{<�|2�}n��>{�w~S ��yc�N���6ݻyu���f�[�n�7��n����_?���m��ݳ���.�|�_\�߯�=<����U���J��ER�V�UU����JR�(��"D +��o��r���ݯ~�{��gͧt�w>���݇���o��v`�n�<ڶ���7{����Ϙ˫N�.���?/�Nλ��6��9sy�g����p����fd�Ͽ.M�z���ɫ�6�^�\yr��קoN��t�t�������qx}:s�ëf[u8�etᏏ!��n��VZn���W.��y��ņtKPU +����QT�U�ڶ�ڪ@ ` +UU)AB�! +�$ +TZy7ŗ�3���.z1Ǣɖ9��ێ��y�ۖ7f�l�WN;wo�Ww���^o�׆۫��ul�~Y�ɗgof�?VZ1��aώ�qɅ�6r�շL�ۖ��m>���~�V\xl����|���.�Ov̹���q��h�2ݷ ]��zq˗�^Y�.Y�Nz��Ɇl;g5��t��������*�(�K�իUiD,X EUUR��@�$��y_5��MYzzt�z��6ti�6ݻz�0�^2�nή?]َ����\�w�Xc��� ���/c|��9��^ǧx�f�q�9�7g�\�l�2�#���b���v��Ni���w�ן&�g����pzyz�W�r������wr]���۔�ՕI[�m� �un�-y���og�����(*�)EEP�ZR�UR�(�������T��%$�_��LL1�9ކ�vo�ӫ�{4kӯ�f��>�|�j��ve2�<�^,Y6�ǣ��rx�t��痥�99��l���{�^��=m��k�����z���i���l����Жa����z2��twgrɌ�Z7��Ea�{��wG��W��2ɷў�>^�����������ɫ��(PP�e)B�T���U +��Z�@Z� +��%,��"I���86�tk��:�vkמ�e3�>�w���ӳ��p۷.\�2يg�~���[4��������,�M%�n��e�n���d�6�~� �q����ѫ�߷WF:z9���fz7��ݜ�}?S=���|��Yi��y�cc��G��l� ٥jç�z�u���>owV]��� + +(PR��YT(��[@ +�TUJ����Hc����.�9����^W-&�����ٖݺ�c�Wͷ��i�vmYoՒe��[z�5����=�2��qn��1կ����e�̱�����˞��<��7WF�{;;�wg~]�y�s�uu��v�g�q�=\�{}�����;���ϝ��ۯ�枬�����-��f��������n;p��ue��(Q@ +P)ePP�*ҋmJE�V�P�R�EP��&�pgtj��G6[�]x�}6�.V�Qr�e�;wi����t�������4kç�fZyw�K1Ռ�v�;:uqYr�Ã������]�;������r����y�z6��1�u�tm�^N��k�����^�*�q��>S^-}\<�l٪���<2��&��s�o�� �2��P��P� +)E��J�T-[iAT�J( +J��F?!�h�=�O���ߞ�l���:rݖ��9�=���7�2�u��&Mv3�m�b��߷n\��m�{n,f�['_G/7O#n9e����Y�ͧ.�y�vt3��ˏ���������=�/+,�}�o'����٣FF���<Z�ه/T��ˏ1 �f6�V�Yn�_���oT�>��P(YAB�(�QV��T%�Vڠ)TUR��P bX��^>[pϑ՞�գ��<n��=��Ŕ�f�z:�Վ�{����2�v�ז�F�l0�ѷV��_.�������קdthю.��/&;z3���t�g�����x���y{{:�k���9�x7;=�A�N�eg�`Ǘ����������ӇW��R�L��ٳ��p�ҍ���(P�@% + +�UeU- �Q`�iJ��J�����~<7��Fxt��X7�2�tg=�z3� uM��h���Վ�S[��+�]�g��VyHϫ�ݡۖ�V4ٷ|��g�Ϯm��yV�����=|����wg�շjNN>&^��ٻ_�3�mں����O=������\xfR�u�6��jټ�ǫ>�����R��`TQE[)e)T� iIe[mRڪ��X�!W�y:�ۖ����g&���n {;9y�v��>��7k\�V[����շfތu�7f�i�iՖ�������N�Y�d�.}�ys�l���نV翧_�������v��uz:����\6�}3E�1������x����8�=}~^Z;0gͯ�S<X�9�j�٣]�m�Ů{���zԥ��TP(��QT� +�B�)P�r�R�ڢ��E�@�h��>|���i�0���ի-ڮx�^]�1�e�gf^vژ�+1ٷ�\�l�u�m�4͓��.�C�7����{tql�r��o&Ν�s��5a��ܺ�ݞ}�syz3���u��^w���k.����h��V�~n���]�f5����a�.nDŞI���Z���o�<������R�,��*% + +T�R�E�� B�R�-�emU\��T���?�pq���ˮv�ָ7s���p4���|��ٳ�>�8�חF�ݖ\x�2��^xc���MZ/g_�ц�+g/�zv�fѯf�w^�4��8�6k�7���ի�v�y�u�z[�ܶn�=z��x�?WO?�7^����ϟ���Mů��,���\��l�=�Z4�usj�Gٔ,X�(J�YB��JT���B�% +Qm��Z�+A��ei@�I<L~7��F:�a���|�zt���ї^�:�r�l���yk�e�V��>7:y��6�_.{w�K,z;����E�ݏ�Ͼr����x��G>����q��sk�ݳ?W缮�C����ϗ���Y�fv�NX��y���ɷ5�O�캴��;<��6MX�Ŗr6kٜӻv:wm�8�kٵzp� +�P� +�P((KhP"������T��TI玛�y�P|��<Y�^l�fz���ve��whїV|F�8���óg4���{������y};p�ӷ93�v�rmۏ&y��u�����h�W:������:�y�z��{�猬�Yc���ǫ���߿g��g���lю~/%����WG.�^+]:�yuml˳����^/Cf���b���(,� +PX�-(���m��T�3�f�m� >k�}n��/L��ק�n�[r˟]�ë���N�_�1�.��vk�Nܯv�l�vtr�͖k�fڲ��]�m��ń�c�OF:r�]<� ������g�w�3�<?k�>}~���[f����T���L��n���^=;6s�ѣ���L���2�U�Yr�Vm�����g���6w�������@R��(P��� AEPm[Z1n�,�-���Da���|r���s�ߞ���.�}�vZ'G����K�ލWVZoV�e�����7g�M�psN����跣n����ŖYm۳���W6S^�7�������g~���<�r�}V�u�*]�1���ͷ��wo���ɛMՎ�>���_N�<n7\\k�Ng�y{^�7����s�t_�BX�,� +�����`�;ϯ&��"�����7�KnV�B,?��ݚt7Lq�fz͛�ˢyvm���c.I�ކ�o��k˻�/4ٞ�<�Y^���ݻ�����2����X�8�s�߿,�m��ta�N�p�N|�W/�O����������ӯ��s�����z.C X\9<~��-90�\�ד]�}��f�1��,XK +P +��J,(%A��edc�`UY#fB���U%UĤ9�#��v�r�t�V7-�+�wL�з���O5��ٿ���W%Ն{�ç�v�M7n&WF�xo��ۆ].ͼ�9�� ]��6����qm�9��eua���������o��e�&&Z�O7w��^^^#���OK�۳,&Z��s���ӧ|c=>�+VW �ݟ>�GN����o��GG���b�a`��%���R��A(P�U���K���˖Y�d�Ɍ��<?�գ�f�1�k�^^�[��j�ݚ4�^Yh�gGfi�ۯV����:8teq� XY2��C;�Wf�0ÓNxe���cV��Ӈ'V�z�N�=��~{0�Ϸ���e���b�ɖZ<O?�g���������e���??Ϛ����v������f3�:z�7�_o���u������PYR� (�e(K�*Q,�(Z���:�r�8[jEʤy���c%�,7My�c�ӏgf�+Nnͺqժ�e��v�4F��a=]�:0�n��f�;6t�n��s����c��N�vmՎ�r���]][��3�N{1�=��y}>�k����c�^�L������Nvx;9�s���~�V������NY�8��{<��[r�S6�{����o���O-�dPE��YA�Ye�����J�ĐKJ% +P��>�R���c��|�-�'>����GgW����ѳV˯Vz�I�����Ѫ�1��}|�&[7l�˪\�mۻf���ӳ^i�t�Ѻ\W~�sէM�s߯WF�m��˳��4y͜�];rӜ�������{�Ǘ��������ٳoO?6;7k��ϋ�F��So ߞ�;rՏw�V�L~����,P����T��P�"Ɍ�z��,eȱ�-"}Y +ܮ%Ʉ�N?��,4m6qM�Ͽ�|�'��G����-x�/C���ߣN� ���tt�y�Iz7�?.9L�{z�N��3�ů�-|��ˮc�VZy�˅żٞ9awMZgG�����f�;��ݫ^<�e�:4lXo�/7W���t��kt�\6=_Jey|� �<va��W�us��0��P ��)`�!B����AUR�*\�DU��J�'V�Pd���������tl���ɺ��G�������^�����m�.�C�fm����S�f������~̘���uk������l�ͯ5���}L��hٷ�Wf|�0�u�ۧNx�8K˳~{v�pt�|�z�۳ q��g�l�gN��z<����c�����t\���ф�{�?����nY��s���b,TX +�,)`�)J�*��&P��!m q�*ܦ8�zti��w� yl���xگ7'���'.��l�n�v��7V�Mz�v[6k���sܱ�l��=<��i�c�Og�ٖ���l٫����hǏ_~�zv�Ө�o9��ώ��7�lَ{�y��˧ � {����sL�-��fL<�|9�I2ͯs���,��94�/��F[�|�t�f�~��"�,�Yab�@Ya(*�P�R�R!PR Z��)�&8����߳�..N6Ɇ�����yz���c�wN]8h�ػuNM�ɭ���k�<f�rѳ�َ�1��{�I��4]�uj��ߦ�^Z0����-z�6��t��� �����MX�ٷ)5�l�ѷ����[��?;OZ���ra�g��e��9x�9�n�{z93��9�<���@J��P� +Q@,R2�K"���KIaW�ƢLqU�\��5�q4�yXw�7������'xgջ,5�і0ӯN=6�W]��f0�J��ѵ�p����ۻ�~<����׳V����ۖX�ã>n����y�F[uo����ۻN�{3��d�Λ�n�^yaͯnxm�^m�}<���?#� 1g.���ʲ�j����gF�}x�c�����p�%��)@B*�X%�"E������� �����Zy.�>N͚�l�����՟��v��Մ�E���~r�͢]��b��G���Ԗ��{�/A�0jϳ�p�yu��,zy�t���j�O��^�4���ᖫ�����s_CFttrs��s��~9a�V�:uɎ̶�C�٧n�Y����M8aՖ����p��"�P���"���LT�"ܭ#I"U���#V=��sh� <_?�}˟V���xczr����,uɖW<SFZ6lՎ{c,�g����\�2�g����<q�U�������5�4wug�F�+ٳ_=��������W�5r�僻W&�OO������}�n��\u1�ڹwl˛���t����ݳ,���Kn8y�f�L�է �w���b��������� �lLj��U���I���\��&Ym�sa����c:�v�c�-qgo^�3�L6�;d�U��Ӧm�$ǻo&���\���f�̰�,&;���7�ps�����-��6gp�t�xy~GGWg���O�ێ9�4�z~S�.����~�|w��vm��ya�˧���cݿ[��)�����h������s�um��RX��B��(�@R�QPTH P A$��q�*�t�4i��ݣ_�������ǣgF����ѻ�/_l���v��s��u�<�;7e��x��� :�tg���:n�de��^�[0ӳ�ÛSSmמ.矖=k���qt��,5M8n݇�����>:���]ng������yz:1�ջ�ee��I9��;.͜�F��ܛ7���� �HP(P +-�`H�(�AD��$�L��cX�5rk���ǯ�g3O��~G����fz�۷f[;zp����}���εk��s %.y�[��z�������n�TՎ}3n�M�y�ɯ�;�N�������s�Go��t��<�;�߶j�իow6����yV�g�^z:u�z{t�M��^P[BX�����?�oN�;����T��(J��YP�� Pl3��Qn�Go��� ��������>~]�a�n3���-<|�~kcoG�ãO.�nQ��,Kifxc��C��輕3����˞ͮn��&��39:.�����ǣ���On�\�#��� �������c:;<��m�/n��<q��m�1�1C�G���×/z۴��rE������(�Z�R�"�UU�Y�0���������m���<�+��LJ·>�����<uq�i�5m�~�u�e�f����)d�%�ͻ�zwun�C�ϓ_6�C<�e�;f\�/��ͣ=Z���ɞ��7���a�ov�;�97l���7[���Yr��@"�cdzt��pa�����g�ß������O�)�@AP)@Z�!���@J��B���I �V�NN]���iۺM\;�{L<-��{�j�����u���Nx�9l��nz��aLq�����w�9��4m��ϿmϗV��N��y<K\��v�{�1ar��{5�u�N]�6��}v�ed�cG��A�ST����'�����l��r�%@�,��� +)D�� %���P$*Ҙ�D���$�|���O7�������~���>w�=���7�k <>>yn��wL�e��w��aqe)��kd������_��~_�߯�U�s^���o5����ф�f�Nm�.}S~ ���� �[�*���ϧ��QH �>��i��OE�,�YD�,� e� ���RQ, (@B� @����Hc�-�I�6��xܽ}��oc�:�{9px7~���2�O��<:�i�fZ4͛��<���*��4�u���}���{���nZ<]��W'>�u�٣Ocn=Z����������z0���ѿfs,�s�z��qk��t��l�*X,�������&Q&��),�@�P����(@!R���"Y1T� �<�.���M��/K=zd���n�=���c� |�D��ql�6&Xᝌ[1�V1flm�)�{�.̺=9�g�\σ����;ƗN��������ϯ����}M=����|�KftI�{1�*���^���Iuk�A��N�>�V�;�q�w���,�ň(���,�)@�b�(%�@ � Lq�&8j����漺n~��.:��2����c��ݰ��/�ţ����n����V�Vb�*ܦW]=;�z]5�ˎ{�'���^����ϯ.����]��&YM;�to��B!HR�lV�/g�R�c����wl��<N��ьg, +��J�*����� R��@� H�HK"�c�8������y���wWOG���}����vzV[&�^�מq�廣W67-��c��*arL��Tٻ=ݙ_S�V�WN\[=���OF����~|ܽ�w���ݻ}����Yj��a��,�va��vxue*1Ǜ���������{=0P� X,��YAbʕ@�U(� RŀR�ա�f�$�Ԕa��I0���՞r�f[����8,�ݳ�bk����ܮ:��ĖL��&�x�k���Y���=�{���j�tg�pˣ������W���g���{)LfL�������Bc�gF�q����6��v9yx�����(�, +,XP��`��!A(�����AeG?.��d�Hd!p�SX�r��k��v3�~S_���Z�����p�I��i��L&��IYH�푎g�e��;�s]xlߣ�|�\y�q��?k~��l����,���Rrcٔ�2�g��繯W���tQ"�� ��ٲ٣��Zq��X�UB���b�J�)*%IPX��R�T�K�[q�$�c!R�hH�Y,����Z㣓�o^�n���<�}ۻ3�c�dׯ<q��.1�U͖�nrg�Z�v�L7��ߣ�N���y����I:�wGGE�b�*���:�y}.���S�z��ۆ����e"��s�Ռg�������������������������@��� R� ,���,�� +����TYE0T�� +������%%@P���@@���J�X���,P������,��@ +����\��(�X,����@��P����� @������(������@�(K��( +�@�( �� +� ������ +��A@���`��H���*�EAP��I��q����� ����P�����������V.�-����@����Y@������@�@���'[�i&�ZՒ�J�@�`�����Y@� �(���\���:3'N��e���@!@��(�X��"��� +��Yyg}9c��:�N|�OWR� ϲ �������T�P�����Ls�y���Ef��kk��G�H���&O�����DC`��P���@� +@��Mt�����ƮlXΌ�U7э4�wu����-�k3�P����P�������(��Z�g:��,Ϋ5r2�ƺhg����YN\��u�[#������ �P���(<�ʋ�4Y sL�3��n����9�Ә�#���Y@����� ���Z����uC6��).D�ޓ2ޗP�<�w&�:��,(��������X����[���i,�R��\���3[����_W]謺��XP��)�����\�s� H���I�t�4�\x�Y��;ˠ��(����P�����㛙�I5 +���E�*��tՅT��.�v:����J�,��������"Պ%��%%����]Yk��ũ*]�����J��J���@P�Rj +����ڍH�s��fj�YΘ���e��%�J���A�劙آ�)�6�`�Z���TU�����T������� +��y��lL����M]k)r����4�S�����(����� +���=�=�e+-H�$������>�GIS���e�����*P������s�7'>�Օe%%#9���r��z�6K����� +�P� +�����P� A�Y�]¦�J��3�Y%��,fՖ�Y�H�� +��(`�������k;���+��B�t�霤��#:Ͳ�m�%K(��(���������[�������굙5�u���3�������@��,��Pb����u����b�1�VX��f��M�K�[x����a@�,���Pe �r�Z�Inm�3�5��L��e��y�Y�f34�����,P�� +���,��*r��P��71�,�6M[&��id�p�SV�t����������"g��m̐EHֲVgIqij]k1��̲˝��\6��(�%� +���� +��f�.=u�GJ�8���&c9�禦���݉syf�Q���:�����u���%�����eq�N~iz��hy���7�y��=o��1n����tD�&�MY3��;��N���� +�����X���9s�L{w-������Ӿ�\i3n�QL�X��s��ܵ"�eֹ��BP�P�����Y嚙���F�9�ϟ���뾏?6�çLo�����kR�`:�y�`(��J�������-8o����y�:s����'M��O'?GN���% �F��Y:ɛ�b�j�`��"��%����_48t�K%������zye�D�����}�>ڻ�aj�@�7U�wZ�;b����Ye� e(����N|�L���]x�R��=5�s��λgS{�ӞZX(&U�u�[�걶������ @���� +��y���Z��zw��>�=��]�Y��n��M��b�(.C8i��q�oMJ�;�P�Y@���@���L�|�s7϶7ӗk��k��]\t���#�y&��� s��oJI����:3z�*P�����,� +|S��<!:a��t�\ck�e]"�α���ՠ��<a5�Yi�۩�%�X(����� A`( ���Xޙ����o�~��M\��U=|�3~�7:�U��,�ZBN��e�2ޠ +������@������瞒W;3z�mjU���Y�[uĺCv*�ƺT��P�N�g�P������,<�F�Mb�*f�z�Y�,$^W]VkK3��T�e� J�Y�]zk��������QBYb���&7���ʹ����BX1�}zjD��,ۚ��T(�I�>�?�OoL� +������( +5�˫�IW����Ro�3�,�[5�3��k+J��i��ε)�����������(pơ�o�z9N�3��MIb�5"��ݩ��� Mg0��Q��P��������>.�U��f�zIX�ΡlηRj*�6�j�Ŷ�L�%�*,J����������P@��+�2��֧>��Y��1ֵE�H +�$���;����$^����X�X��V��1�j�7d�\T�K+1kiE�h��!"�J*#S+l�z������Km���6���M"%[5��P(� P5��HVV������D���Kj����Y5��2ݙ�f�����"��-��e�Ib��s4�b��(K��B��,��ʔ�s��ʦWZ�T��BP(J+�a7-�(�P����%%*��O%@"h�6\�Z�-I,�5�Kf.�MImР�����)Ui`�����ʔ�[u�3��ʢ"�% -I���Im�� +�%%�P �����X�К��5�M%\�gZշe� *X�����FsԩU$F�*�,�J�Uj�|ޜ{�Zf�+HåR�K��B,��b٠X�}6K,��������A'�Y��RY��+Fd�JJ%�@P,%��SVJXYI�� ��(��*����=U�l��ku���X(�&�qD�"�j�������UZ��8���5&z��W�L砙�X(�@���͢ȷ4�� +�E�Q@�)39�q�|���MD��TR�(��E�j�˥��*Xܠ�(�(P�@���Bs��bj�j�j�hTYE*L�:��!6������(�� +�YB����" +&x�I��Լ�&�A����5Slr���P�j�X�3nK���e��"���XX��"d������Ma��m5�� $��?.�17�gQ����tԨYk*�����P����"DJ� +�p۞�q���@!���xc�kz"I "S<zt.ZR�g`�KP@�� `�� ��u�X���MF&$�[��Ny�3:u�\��4�Rp��X[T�7���@@���Q9��V��Nz���ր�y��>�"��C嗣��!IY�u�`�Y K���J����]חb�.\���Zց<���w�g;�D�硓8燳W+�sf��gW@�T�H D����Q@P����Zy�.Su��/.������:�V�D�8�lΦ9�~���U�\���X�-H�p,�� +E���3�Z'G-��.3�Չ�.����9��:rt��ns���c R5e�:��Y��-$�ҹ���@���>}V�uz�55���a�jM3:�w�X]B[��nf��:�ɞ�'6�=r�qhJ竛m��e +� +(RX�25�mjf+�J,�dKY�����Lc7�T��s�]3���yt�JɓvK$�DͲ��%��E� +P��P�8���&���4�[�UԷ�Sw�Fs�j�Y��{3��+��f��S3@��Z�`( +X(��J��X@cVɸB�5�5�$�l�gYl�ɢ�L���5d��n�.VȊ�x�� +E�����\�:jM^ho2�9��֘�ѬKb����WY̔�4�QK���0��w���P�@����@��Y�7�f�����^�sk\�7W���2Ց�����kW�@�3e�8�(R��!@� + +�(���)R�ʨ�u3uَsWY���R!jM�Zܱr�k�y���y�P����P�(�B��.��PDZ˥̉�"݉��3Y�K�.r��۫��fӐPP(���(PP��8� l�Ji-ƲAuzF&��$�I�i�V����vA3�e�(( + + +D�w�K,��A!IU�հT2�%�Ω�S&6.��3@�6m�(�P����@��Q�����JIV�i�It�k[&�D��\��,�:���M��b���8���`*)()JA�>��RM%�$ՙ5��HhjV�aU���Z����H�U�������)T%(��;M�mK�ή�3L�T�v��e����s�DZƑ����PA�N$�(�`��JTQTAÿzȗ6j[��[1��&��Z�e�ؒX��qud*�2��u�[*g�髿0�( +@��!Anh�eA���fř���3.�X�\�Y��II�1jܪ�������R�55r����z������(m�=����W-j15l�Υ]g-�ܔi1+u���.�Z�ZY-L�YNy�U��������@<�� +��:Xi3�V�3�Ԇ��3j�n��Kg<�k��rI-��r�]k��� +����PC�:jۮZM�E��mRM$����̖ؖ�M$� crKs�D�L��f�w�������"� �q�kV��v�9ʮ����lNzԬ�jf��k2�:$�3��,�8� @�,�*TP�� �4ޥ��s힎CU�met��.Td��H��ʈ�4�L�jɻϤ�� P� `-�Y��fW>��JgC�T���Աsr���ȉ,��"]�:�N����� A� +�$��.���6�x,g=�5B$�[�D����6�"�I�7�+Bk�T�� +���� � 1U�n���i9�Ի��]5��Z��w3ft���dK,�RI=:�������@� R���)2nN�3��֓���D�"�-��lԚ�Z�̙��,�#3:� +��������B�u�\sͺ��NZ�V��@������:�����e�� +�I(�@����I�ק,�b�d�M*��R�(��u&%Lܵ(�,�9��2���P���� DMjfa�����eB���YjY�L�J +��$�1"\Mi@��,���ʊBʂ��J@ ���y�K�r�o{@ڕ&U(Q Y��f�b��Y?����������������������YH����(����Q��@���E����������I@�R����@���R�!��,�X�����@,*� ��@ P���#`��������@�������P("6��������P�����@�( +4������e� +��,��@ ��!E�@��������(� @ �����*�PE����������( +��@:u�U��b �QA`U�,��������� �u֯,�fیP@���Z0T)������@ +� �%u!p����NZ����B��Na)J������P� �Z�z���\�g\����}0����K�R�EU�A,��������%�PQ@@��w� �o|�b��-�c�����p�2QZ�S��%�R��(���������P�@�'>���\gs�]1��\����Y������8��g��*��P�������������v�n&��tf#y��Z��>8�{e��nu$�{\�=����j���������X���(�����I��8�ud�5��jޓ�I�K�s��ʾ��{�כ�{q��R�(@���������ѻ����+S*�T�h��&u�3�6�x��;���f��@���������P@��;�����Yt�YW4��l2֧<!6�o�������������������(�(�lM�f�Ve�@-J�k������Ξ�1�gY��` ��������`����z��ԙ \�Y��$�c8���[��rۈ +����������E��o�rnD����+P%3d��RF���kR*:NVX����������� +Q����s ��@���<��b5N��|s�9^K +��������������q�l�%K,��ʳ�e$���ճ>�;�@��������� @Q��"*K&���5�5�#3\��g��fN�kn b� �������� �P����9��rJʬ4�j��.��k�W�p�Ǯzޜsgo(E�����(�P ���ӔmQ)���\�H�� ��n�fޙ嫾}s�3(�D�����@��@��w�%Օr�%�%�j�kx�6s\��s���f�ûEJ����� ���@�%�Ӧ7���Φe�jܵ�ˬj������\��Ӝ�rMv��J����!`%�����f����*̳��i��Γ�i�-��c|J�9J�����X�(�@ ���u�cFf�.K.�kx�j��#F�y�Ւ;a4s�(k�Y��RX���,��*(�]����kY�ff���� ����j��9D�3�>�<���k���%������J����"���R�j��Vv�se��n�ŲIW��Rk�=g��8ˮ������� �P�@K������[KRkL�A:g1��㤆cP��m�M�㖝r�ü� +�������� PY/N�;��!zu��[kWI��b�]Ny]�Y霡�n������^�=yk3�,������ �e���@Z]�,�y�/n�<��%u�5�3��i&MV����i��x��0����oU�gs������Y@�� ��u:��g)��lu�8�� m�c%�K�[b����Y� Mq�zfc�_������Ye�� �5�w9�$֝:p蓆s:�/\cNw ��YZ�Ά1ӕε\J;^����������� "�7���f��>�.}=1�k8�[˿N8�Ӕ� +�Un���NMu�yJ��g<����� @���@@�}8��r��9ϿN~~���n7�1�ӄ�ʭ�*����9o�o9��}�Ӗ0�����J%���w���NsZ����Q5�|��5�v���͜�ŋ,J�/I1Ӟ]$Ms��������(�ŀ �:��9k�+;g[�p�w�sϾ2ƭ�M�3y�田� M5�.Zo'Fy� �����%J���,X �٩� ���o:c�Y������vt�$c���J��V���^sz�������������i�I�v��p�M�L恵/�:t�'ite�H������Q�nw������������b�@�n��זM�{����<��l��^�p�ý�y鉄�@�@/c9��^r���r�3����������X��S�iæ�Q����e"�.�y���{鞘�1��1(�H t���1u��<��t����������X����m1t�MjT匑l�嫬r�;#9h�]�L\�rB�4,�K}Z�9����������`l�[���3}!���b$��c},��p��߭���LDD������dž������������H�H���fw��Y��۞9��w��)d��2÷D�cl˘�ZF��fek������������fj�y�仒YIw���Ű:jCbel���y�5n,��RzY:s����������������]k:�ι�I�]d�3��單V�l�U��2蘌hC:��2iUM_��������!@{&�D�Ľxn��2WN��J�YJ�$��]j��ew�nT͋W7c��������� ߩ�ޱ*JܲX͗k�\[�yE�R�[B&V"�hͫqv�:�8��������T�9���2�nL��tc!e�f��J��5�˫.��L���������" +���-Pۜ���Ms�S"Z%P �=jK�s��s�q#W��`��JJ����B h#���K�gH������ +�B� ��f]�*k�4̷�B�R�K,!h���K,����]K:g&�(` d���#[�隩9j�S$��,��(� �(5���Y-�id�JI���h��M�#���{ebL����� �Q�BB +Pzz\���o3sI�����S6MT� ��H�s��D�����`���"��" �DQ^�w�Y�je�\�M]^R�[��"�����#R�MoHK$I{s���K�K��V��醒].5���Z՜�n����@��.`�Q�n��ʹ�L@ @��@A,�m������9n�X�o8����+) ab�dCQ��T�q:Y��e�E%um���uy7�N��NCZɷ8�J@�@܃Z�M�R0����%AP�-�+Z��1��S|�Ʈ��32\�*I�K i�R.���3��`�TX,���U(-������l���ˬ��X� R&� (��[iq%�����q7r��� +�@ +(m�� "ٍ�/��H�Yf"��:jH6�]��s����Q��S:��T*T�, +����U�*���/^qsu��LɮWY%�KRgӾX��zmmq��5����Ջ�Լ��(P���*�Cz�n9��sYEtə���g:e۽��^sk���Rĝ��Ud�W(��������Y��:�[��뉘�t������w��+�rΕ'E^��qٌ�YIQUi�4�����D^�9�I ���`���Հ g龶y�F�Ϋ��MHt��pJ�� +�B ���֓'��fr�k�9���X��~]�1w1R�o��[����{�9�Q��[���,�PР���B��}3z���jt��bjf���s˓�8{��o����lY +�d��dT-��,T �� u��]p�L��]s%��"�8�h���a&��s�m�3��w�35���!aԓ�� @��}�s����L�K�$�ݷ:N>�bk��\�����$�;�뛛����-��=5�[e��V5�sY�%�E�@���Z#�lgWI�[��2��If���l���7i�׳<5&Z�:�3�J��c���UQp������@��� +�� s��Y��8ݓ5���[r�noB�}]��V!&�R�z5�3��u�Lg�� �@ +��� +���l��RkPF7f3m�q�y��Ao^��� rY�Zs���jI�ȋ��q���B���� ���7�gq��9�.�lLg;��c�<C){��^�4�˔������Z� [m3���E`@���UN��lk:I�d�].8sw�gl�s*c{aw�=�ϛ�.�s�͢enp��,ZܭLg�@��PQ�F.-[�ͬ��\����gLcnm�)ZŻe�h���=�˫9���%�aB����/^�ΤU#w��ոM��Ytv��z����eX���W�b�7��V ��e��������7��Yi.jM�f��ᇣxĵ6Ks��.���)�Y��[L��@���EB�@ �_V�s�V&��Suf�䚼�5sw��jM.bL��Fx��4�������.������"���7:"�e��X��f!p��J��έE�sl�{Y¢V���n ԫ�˨� ����A���|k5,k3S+�(\K�sɾ=-�Y�kET�9;^R7�*�{��J-��o=�� �������p��se��&u�[��R���t�Y��t5������J�������@���� K�oy媹�gRcsIw��*��;-Lk2�l�N���>R�].��ŝ���.�Xc@� ����� A��|�R�9���j�K5�:��Vf]#-̛ާ�Zk�γ�"�锒œw��<c�����,� Q�F3��WW��u�#7�c��Vb�j1��M�>r��g���V]j�Έ�]nG:����E �%�{�Rg�n��Vew�����\�S�gV̖�2kl�kV�3&����37K&����`���`��o(��I���SͲ����j�Մ�猫WRf�Y2kQ�;�W3|�&eܵRF��oL��T�H���������NyCL�{�&d��Y�9/,��뜤�$�-j,nf7s4��J�A�����4�R(Kb�����[E�\��w.�\:�L��n���Kb�&[j$K��5q�ƒ�kY�X�nZ��������T]E�y��v��q�����M\En�R�Z�t�K-���Ƶ�-��p]�,��������.��y�ǵ�n���%�b�n��5y�2�[J�wY�+VM�jjt� [� ����`T� +��-#s �MY9:�Y���h�٤�磝���4��e@A�m����,B��� +��VRJ�9��֭�,^�2Afj�Ȼ̗6�[s�zk*�Ġk�( +���������� +��QAz�7L�ޫ�5���d�[!sf]:f�E��F��.��$�7xkQ`���(����-:k�g[ ���ĕ�)-������ey�PYzs���8��z�K +��P����� -��Rjs�7���"�%���E�. b���A��v���x +����,PJ�(����3.�ηB��Bʩw�5X�����{�FS^�0��-���'������� 0p@P`�������������9���L��϶Sú��`�-�;��/Bp��18��/��p��7�Ji���O������8�~�Cn�j�@ +���?�xT�\������v���tјD�첷�l��;/��.�цh �����G^�s��?�o����<��`�oV�_v-�����?i+��ȹ�o�XM�>���i��vs +���8G��0�t+������<�_�u���sxN�7}o����{�O�fgC�W���!NUu-t��br8��'�U�O���S�G�Meօ-�e�o���-�5���k�~BD����dw�ګU��^��Q�[_�� QUscU7P������S�����,��u\��y�g)�X��r���������A����'1�bƲ��$Nw����88����N��p��o�]�B�� +��S��?�����������!���}ٜ�����J����!�P�X�״V2�$��0[�#5��U��Sk��)��~.���ʟ�ͻ��������x��g�����78�/\�b�������ö���e��)0��n�2�O���bZ�j]u璼��Cr)����?%,+�z�oh��$���Fk'ɱ�!�,h�K"�65���:������x�������²���[�r�pyf��p,��<fL�;��O��q�2�f�`�}B�o����l/��[w(?��|���Y��|�y���5�n<%{��؞%�Pe�]��+U�CК_�K>q�W^J^����>��0VlBʰ�N_� +�[|�o��M��-��j�J�{�⯎���|���=�����y|<���Uxk�7�o^�����Ao��̱ד��!u�V�2�,%���6��B݇�Ř,Y��z��r����z3�N�!臨��J���j�q�����a���],�]���� �ȫ�������?������\a5مn_�)Nұ>���+�u�#V����ӟA��e'a�� l �ײ��M���䋒���b��$�T*�����U�-��p�\�3�K�� �P�/~M��U�?1,5Y�}�ƽ_�4.Yg�p<��1X�T�,�OK4�����b��lj�ڰ�/�0����Uw����RvvA��R�brE�]�Bލ�ߐ;;7���)�r�#�#�4����ї��n�e��&ƣ!6=�R�Qւv�-�5?����ݼX�Ҫ��4�l{�(�*�P�g�Y +�h��!��sք����a�i ���f�mzR��A�2ؖWjXn��ܡ��E������o�J� ��%�b����ɍ�b��Ի�w���x�O"��V���<U����*�JrxdvR�z&1d���$RAR���ja�k�"��ԍ�5���*�4OE�K�ހiǻ�������J����.�tB>FJ�B*�K�ŕ�����r��'�l��w~EwC�AT0�/��f�[��t�<�*����g���vVŦ*��`bǵ��%j�{,��N[ϼ�0�I��B�B�� � H���~OP�Ɖ2 ��b�t��t�*��31b�+("�`�C�m5��ʱ��jz��gpZź"�f�OSP�*�*��!k���ϝJ�PN<��L]�4 m��iꮃ��6z�V�1u�b��4L�%�3=�I��qbZ�Y`n�e=��0E���Zޘ�ցp�hu|���l�w"�j���f���.��8�UO���MM4IcMoIU�5�9�(3ݎ��,*�iP��`}n��\$O^<��`��E��rd'p�B4��TU�i�D�@�V;���z�µ�b�eUP����%�*Uo�L��P���DtT0��j�sЍ>E�@�+U�+4a>���C�����(����`1`���D'���1����W�%j�>?p��f�h��J���[xL) +k��;��9�6_�z���T�k��1� +«ub��ֈ�+@�`[���O��7�%f� "��w��C�ǒȱ��Q���|���!|�J�5�o��H���s���Rۻ��������s�������Ɔ�F�T`���Y�"#��C4�BcW�á��@r�6h�,#b��kY�IXI���L��� ��d '��0�e�Ż�I�1BA`W��X�A�՛�AթzsP�-u��i��D��@ (1XF�V���!�" `{3TZ��n�f�]��q�gDcP�z=`�V+�GB,��d�a��#�Ȫ 3j!�������$�l5�=s�e��HY +L#|XT�L�,��1Sג�H���5�@�13��D +B�ׂ<V�D## )'ʮo�t�������v~�ftg���l�]mR0�0����yU�Ie�}s�����q�3��X)� ��CB�6��t``]�L�ߏ�L�@�#/E�V��*�00v"��EU"��f~��鮡X�����lڌh����;c�s��@*�40�OL���@���u�Cs��#��@L�����7}��;�D(��;�I�C<�F���"2P �����ջ߹�f䥊�_���=���ю�Z�:�q�]O$�m�1��+3chhlrij� ��l�ҫ�(_3U��f�0A� �����`B2Vat{� ^�z�m7Br��nF��w�fc+�P��ax92�?2�07��������5��t �� C���k�;½�܁<�qJ��c4zF��֡��`�X�!(45OH�)7E�������� +�]���S3��ww~�>̅|�%v�eu�+ڵ �l}��>2�GZ�5l�3}�B��&�u��5:í�����ZD�e�R`���<'Qf�X�U2c/��9�OD�$u� �E5+bگ�O^���Kt���A���N5�QrX,k��[M��܀� +d��3몋*XF,~�x<��f{����0��T�, )=�ֈ���� ��w�@ +�OV�v ����%.[×��@2��]/�o������嶚�b-}po�j!�%OB��5�G�I�т�!�� ���b!8���,���]��W)�>5�����!��E@����R��[<�h����h��7�>�$Y�=�1���2Zb�&�l��^z�N#+s�������8����1�W��[(��V�ժQ0����:���f�1�3u�b�OF-i/c8���Yo$��\�V�0�0u� +*�ڲ�ʵ�i��^����-Mז�%�|��j��"����]Y=4���0%U��l(\������^�iPW3�`���J�M +��E�l0�*VAoL}l@D�V�3� +�T��m���H'!G�k��3!�4p#tH=,�����_JK{��+(��]�1��%�>Gϵ��P�-�o�ך�Jk�fA�wnW�2O]��ވq��Ə+OMHR ��Cta���+�XJ�e6�K4 2�6��i鏯]���1����W�$a�țk��z3� Z��� e$Z�͕��a���X�/ E���/GP��ߋ�̠K!��Z�m��UD��#.�3��!O�<�S|��Eg�+D����U7a�&�������&�z�щ�B���\���I�32�[��E��m CO��yj-���KP��r�{�u�����e%��`L5�e��Y'�O%����`�^�o0������ڰOD��>!�Cy��A�Sz��e����cV����"KЙ����k-)a��K�)IE��d�ʩ�kR| O�NEu�̍�qa����<Dk����@�1{c�Җ{iP�ւ��Ny1ctN�Xf���� +��f���O�X�e��x�Vs!��A���{J�s�_#��I(A1cW�K�M+r�g����DŽ�砶kS�%��E�q��7&T�������2�"�G!՞�,����X�����fz�4�LtL�DFD\���O�!H����[u���0��\��y���1�٫�^�s>d����!lKm.Dw���4����,R����4d�X|��Z�.�����Š*R|��*��T�*�]��u�=�`���kZ�*��ID�#"�\�^���ȡ�Z���%�ٳX���j�&,��az����y���<� �eo +^�')� +��t�#Z�_�����ɳ�M4�+�]��8̂4Α�EJ�5��X�,�h�Wm|�l�tLP`�0� +*U[!�=1��ZV�a�<�����/�br�i���ڂ�UM +����(%��qhe�g���`��Q}���˕J�v#�1������^�� �P���hN����Y�����0�x1Y�Z!�}�H��AE��`.�fWR4#��ўAc,0��(�-M��V255��|�@���6��:�!�R�kV�리�4C#I�\��ek��?��t�t��"�� �4�'T��aIY=�HR���!���s !DBͤM��� � aל�"��̘`I��vS��@�4�0D��?�6-��)������U�By�Ykr>kH������B=3Vl�@E��8�8+u�6y����P��L,����k�d>��3I�'ߨ�Vo�UÙ�����,@��@�g��j5q���h~wx7�5�T�쯏3��p�� i�4��+�ڗv���.z����ޱ30Fh�*h`���u�a�ס`"�'&�*T��� ������c��ƫc�"�(L��� ��% P��_��l@+_V_@��5���D�0�=��^�tf��'�4@��%{1DbL�I�f,���n�_�-�`����%��_8!�Qc@��u��/@7�臢��M�Z+0L�'��M���������R�UW�uu,�����3�0/Z��j�g�P��,I�B�# Y��ǯJ��o��3z��30eQ�c�TE��a�g� +:e"�a0/�I'�Л�J�����!��d�X^�]k�X#��.2�Ŷ%�ԄCRJ٢��O�[n�n(x�0)_�BXT�A�����cI��$\)��P�1�HL�$$ǟH&���[�=�`��40L�A��8�W1��ë!��w��X��\���r[�}v�VԽ,W�Ǖ��9��NRupa��V�d�-���qy���� ;�ְA�1I�oǚ��E��c7�!a�����"@Kc�,(�Q��<����&��{Si)��#���e|����5�@� +����+!X��+��/�Dž�"�)�� +�����]���F��J���))���ӑG#���j���n��ײ���g�&x�\eҤ���@uF1W�5�Nv���� +wK�Fp:=��=i ��"21O.�'�O-k�5o]��H�(=8RE��i���P4<��ʘ�!P"�<^�S_#�)���8 �j�p:�/�Y��/��~?ܴ�ZZ����#�;ٻ��f�ȃZ+���c0@�0�>$T�tGD �銺��1W��0� � +���G�į�����(�;Uj9bG�X��W D=�u�ʭl��e�����we�j�� '��zO�/ǝ;�/���5Y������WCԪ`g^H�33>�2�����b�U���駪�4s���Bz+�����B����L�zfپ�C���V������ +����oK��Z �������?u��̿��H�ڦ�'YH[���)}_�<4���o��� �=,�rA�W���ZLs|�ٞs�e�n?��������h��h��g����^�>6O�LVee0���4��bFb�`�fv���t���������V���>TQj�\�W�O�W8�L�Y(��[�Y�q���h�խ��ﶮg����w3�y�����Cr��NO#���� J���C�n'��,O��B���3!�0`AJ��E��!���q�[}Ѝ��t1=fJ>�4�<��d d"f���w�-�D��-��z��H�Y���ǎ9}^�����46��Y�Z�No=q������R��[X� ���s�Y�W�Ǭ�����{�cU��/.��B��<t�C�0��AlL�}zW���̦Fa�,a!�b��#y��fxT����y*&En+�ĵvx��>�|v��VR�b�+� +n��˞壎>�+�U^�.P�M�[���9t����px�>���ę�o�{_#��N�L��M d0�4�4I��k�y��x����#tz3~6Q,�~�����+�ŷ֞��T(���:� �:��|�µL�H� �d�ı�"=|{}��Ty��1ND����l��*�I@W�@l��yLUb�#�����T����MD�� -,��f~F������%�-y5����7o���P~� ������O�݇�Ҵ&�w֑��z�7I��b�a_5=��2�iY�<p�L�j�!!�e���T���b�9�#�W]5����Tp���y6'�=�o/�k=��ʼnp��$IbD1i�nji+7�����'���ͅ /S���1;�� -��i��"2���UF|f�����g� �uD�3�čף+�\D�l���̳��G2�kP��#^�x�}X�3�̡,��ל�{~C�l���S�� b�l1'�Lc���VD��Ե>�/��z,mR�7L,MLu����C��0����Y���akO���h.^Uvm�(�G:��Y �<�Sb�G��G*�8<hѨJ��O�Z��^(�ןV��������B��Z0�l$N9����Heq��f��@�(�a���}z����4'X��E>����&y��^q�s���wzVf�����U�z�+�"űg�.�A��ܓ]���u��&�2�F+������k���|����+�����x� >�mw[.r<�� +���z�#'5��E��h}�����\���L0�B)/�1��O����[V:R`��Ϝ[����<_,�Ϝ(v��w����7}�>Ajޜ��cth�RW�*r%6�)-�zꭇ���l�ͣ�e���$�C���|�m�##�Rq�7,��]�B�t��+K(���B�ą�c3�* ��%�4�C��+�!�b����[�T)Z�W�����f�k>R����a���]IW��][���z�Ӡ��Su�=��K�K�k+q�)�?5���~&��j,o_���s��6���#O�_�O*qޗ%�x�U�����0�7Z� +�v3�"�P�C�_�î��'a�+��]�5A�FX���Zzsd"px���xա���h��|��/kx�5q�� +�B�c�UA��C��33?��Q\]����Y�p���z���é��.��x�.<��{x|:뺺��-������5��Ư��s�{?�*/Vʫ%�2� X���<����h�uM�`��:~5t����Y������������u�<&�{ �b=�eD�j:!����rA�m�u��Ճ]�`��n�n��ɓ���wA�:^Br����*���j��YuF��;�[��>F����.���y6/�t�R���Ti^G���*�p���Y�$�Չmf����p �UV3�)i0)>��Uab��z��?���v��������_���)h� ]���2=�J��'�2�-<v:T�H�J��-�����>�g�Dߨ3=z� ���7 r>Jm3�h����(��� �ƈy?�Uʕ��y��<����V-1�2WUw�����Z�_���!����c-�~��P��c�C�!�Ё�����ܒ�$=~#�~͎�X�ZT����9<�.�%��%V�M������F4������^Y>K���G���������y�}����J�3�'t0��Ew\�V��i��U�5<g���8<u�_?��E��i��WxW��u�ɋo!?��AR�G�qx�'Ee��V�e�J�o��Ó<�Jҋ��k 6\�ga3亳�u�6���,�4����(�W"�m��X-k? �}���h�Q��R:%��ڬ[g@�,������tG{��,�IJY�0O��W�)lW��e�Qr%po/���f��Ls��Y(���Z��*�Z����?+�vCA��+bp�}m�j*l3ek�2�]�6�i^ֵ��NU���VZ�y�ɵk��l�W���E�p�*�.�D:�t�Bol"WЇ���[������L�� �h�_�NEF���3��kD�(����e �Cw���rַ�=��X�u�0I|��ӏ�����a_9=�x�*��0Q4���M����]��C7\��+�7��B�^��q�-U��W���`1%H�1Wm,[y��~����9������@B%0����&z��:$|? +��/�b���rm������.�Z���ȅ�m�8�����5z .<y�yǪ��UU�G�&^�z dV�� �g&�����5�ŽZ�U`e��2|Ī�J�=TI�l�?�Yò��hn;��Z���a��C�����k�:?�%n&t~��C3�Fu���T������TQ��V������ώ�k���YG�R�'�(}~)�:���J,��%�&�N��?C5���U-u�|�����c�U�-@K+�Z++oxǎȫ�xT������kAJ&}2���[A�:Bך�fv䭕B�]��Y��0��t��t&B�3��ǔ� ���Y���"������Y��?�DT�]+�R���T���i7�Ʊ@<�ȑ�keK�|d�l���u������:2���e\1KDr�HVToG�f\"�c1˗⮿��QGݏ�c�(Q���Qن bڈ\o���@cL��3�dγ�?N��a�~O�>�o@~�HZ�Y���NU|ҫR�j���%��y��ٿ���r�%��Q�˳�d���ŵM���C���z�|�Y�Tl��E<�t��jien���JTGo^�� s��g�����x�U��������G]����E��T'v40B^g�ݨ���Z��˯�y���� bc�7bt:���O�矋��ˮ�6d�V�qB$�����*�ŲT��<`c�8b��r(�V����6[mW�:�1�,�����x��]Ŝ���j/g�-[��t��+�fm[��)o�nKI(�"G[վ��s���:�#pی�Af:4h��h'���0Uu�kW����V4�M������!^��v�,,��d�X:g�/K����`�Ɩ��o�u�/#���d@���:W�l�ҷ��n��yZ�Wʬ�|�A,�O#C�K�M�I�u��'�=oY33���LSc�3�xf�\n����� �5��ӡ��:�ћ������m3�_9���(P��w��jxc��'�谀t:�������ֳ����6����~|��v�2s8~?�D���wQYs�����Ac�%�@5$��icW�n��1� ��[���L����3>;�y o�+�`gh�94�5�$e� x3Xg[y��M$?�!�EK'����]�����/7����'G�������)!�@����q�����ҶVS�F���" � qM`rY[�x,.mW«���-��e�^�z�~�Ox��c���?S٩V�G�&z�˜7�g%q��:�CKqVӘ`\Y�B�����'�+��"0��!j����U�X�9���^!��y �:l[ ��ڹp�� >����i��ś�/KՍ��a�B���cM!q��kk�Պ����U���d��x*���m�f���سOԑڨ]\a�1m����-��&�0��Ky��f�?�n��'K<�@Smͦa@����ՠ���i����e̮�h�����.���՞�V��@�)�c,Y��-`�W����Fe&T�l���C�ب�|5��ʠt�} ��İ7��D���a"*|l�;V�홺3!臬 h>��+���Pu����<k�%��j4*�e���Im&���������,N9�������h��Gj3�-�x�����hcG�0 +�Ƨ�8�u����H}� UQ<�dE@ ��A�Rk��y��К�il`bL �b<��7�v�fa��<��6�"��Oy�\��FgG�e��M=4,ƓZ4�� +m�V�Ƅ�I��� ���� ���<�K��5q�+��"GK4�v�Sȭ�r��a�U-��ac�8�E�[�����%��,��Y��R�E|{"�$xX,�,&�K�M��g�\vS���N�c��[��n��\{���lv����!o ����9�0j�n���>Jx��9��fk���4u��AD��!���A+�[jCЊ�n@��-�:��As\o`��W�34V��XO��n�g���O����Z� ��˒Ҫb=]�XM���Uw������V_�� +����f1`,)�T�X0��;�����tz1���1_��E�o��F%c�9�l`&�,ωǯer1,%-��b�졁I�1�v���Q)����2�e0��"G�"���'�Uت��_���7�M\���Q�%�kۑ��E|����y?Ԫ�^kO�#�*H���׆U]�; +��L�E���Oi0+4O�@�2)1��}á��[w~�s>�]��i�W0�R����a$6|��0?�l��j��8�X��0 ���L��K��~�X�������9�pW�8{'��`�4���Vd*��X�z���:������W~ �8��G^�vE���t�z��Gaj��)F��Kij��`,�r��vn��:X���5�)�G�M%���$�>>%G01�"G����s`��I��S҈�b��П#<0M0��2n�T���b�8��7r>�ўP�X� �S�5�^�#�7���R��C�K���.\G��ⷃ�>Rm���[*�ʐ�y�� P�^�X�3�@�zH���b�ɩw���$����z$�����-������@�Y|�}z���A �..7�y�+��g�$��h ��!菨����R�Į��4�c"\9~W���U\��\�2+,���eKP0��5���R��=v�E��x�T�R�-0h��LSa0D��\�I����&,f�zF&n�=�(X,G"��)J��90Ei>D�a�>�;踳��E�43tn��\c��X�}������[������M��<K=���m���m�^�D¢/o#7J�Q��(I0D�T��|�����QM��UWC�Kl�a�ں�h��!T�h� _� +CM��f����\�_�4V'<�P##U��"�� `:��sa�3�H�\�C�����8�t�5f�^�I�?NvX˶�6,0(�T�^p�V�[�1F��`Uc�����3'�O-X��j(x�k,�^�'± +Z#��Uc��ЊY�a������>�W�K��ie�ߦ>��H|`U��\�"�~�{�-���Bε�o!\j�zV~�'�$~�{�t����;��!����U��dǶa��i�����љ3��|��X�$����ȱ[�t�&]FI� !S!m�I�S3�d��췵dqg�e�`���Ai���K_�ϔ��V�7Y��@�G����*>��'�a���!$���:��",(J���~-"� ���&"�n��������W�!���4�<�a�y�4@|����̱+n��������Bbŋ7ҳ������-�ߠvn�?�!� +�z��^��Cȇ�p��[֖�*�5���k��F +v��-F40OUX�Z�U��VJ�Ι��T�Vhj��LJw�j|��b�m�,���4�,��Di�7�ŷ����I�dV_����L�3�3���B>���0�G��6O0�� ���l+w�я�LR���؇��Ą�mNx�ep�ЁmP<i����+�jI&)� �za���I�p`���>���#:��������(܌�0BLś�3L��q���{����v~���L=�;0+�W�I�L=�p*��K�2o^w��������U��ƛ�!a���K�X�P+ +#T����=�V��ϸ^�TZ�XЀ٩c��հ���PUI��Wj��Zevbwp�������;f ��2f�`�fw���H�LΏb`L`��S=���ͥ�#�� ^;ق�ꬂ�;�^����{�ё~@g +�$�fzD �yEX! A�����}k��Vn��>b�}yPe㊾}��%����d0�tI�@ށ� �=��ə��B��3��fy+��^�����9�=@E�#�E�g�ϥ#Ɉ,�R*�-���ۉeq�����dt�Jș��!��ſ���<X�t��=)H�g��3�9�4�" @��Y�2�=�J��c�ݙ�L�rfL; ��f� +��f���^��'��Ioe�!!>D!���>��γ�Qs�kJ� ��9�0�tՈ +-�Feal����@���@sm�?�^H&� � �p�j Nw�փ���g�j�p� 6��ƀ�Xan�zc�b�HG���f�2&���U0���&N�i���_�D��� �C��"GC��Ϧx[U���g�*�#���i�b�}x�5i]V� c�a��,�cYw%���6O0Y7JO,`��,� +��K ��sp ���<�� �W��AX��g�*�����R�a\�u�ń,a�H0M���Mi�Kō0�<�C*xe��!�=o@~����v���`��<k63yF��>%x��2��ٳc�q���|?�5�$#�\@ЀIXz=��|��X˦{FD�Qقn�L���``�Ӂ,30�%>3X�VPM'�z�w� ��Hwry��fAe ��W��,e���� �ս���|a|�R���U���ǥ��������JrZ�D����h��WRiZ�����+s-�����hXn�C=��W�w��̎�3+�p� +z�*��Ǎ�Z��A+���3a�:����L��a[跣6 �� ��~�a�x���c)>=�^{ٰ}�C��<ҳ�"יˠR�r�*����փ�wf*������8;�8S��*�N��*�4US�@Й�*�OQT�G~D̚&� ��H8Ѐ�h*���*OX!H�`��f��1���ņ���)����`��c����Ā�7@�ބΌ�z�d��Z�"�Yv�T��Q�E��;���B����q�����8��mJ;�7�}ye«0����bĭ���*� +�3zΌP�Di�;�V?B��&�-���n��!;�^������v�T +�PЏ3����I���Gx�~*�$4ievU���H+�`��i���yaك�xu���,��O����N���`h�D +��?!�[Ѕ||AJ����gC����B$���&����d��oY�����ț菠Pt��頗�k���ª�F����Ԝzi����%n�C��c6J��x#ǘI@9?�9����`��������#Z���H��,U�:���c@O^T4G�پ��|�zE" �vAb�=�l�����Z=l+�G[<��Bsf�'�m0�|�1�g���0��L=+`�{���+ӹ;WG�I�yg�7ɘ�O�P؈�0�|Ĺnf�Ҙ֓��q��Yh0B��XԤ��$گ�@]'�v +�F�Ƙ#F�35� 0L�z� ��dH;֎���a��g��;�0M � ��gƢ4�PX�)�1F�{x'��t���;� +�u�^E��y��! ʆ,Q���{Y�Z�@u����Aj��R�&c�+ @}B�f��:�g��*]�lR1�.0�ޔ�1J�!Y�T�z0��L��Y3��x�'ȅf�;����A��<�Џ\ym���#2���?�a�31�P����&�-�>��*��[�����|ig�oa/�IG� +�Y\�UI�eG�G�P�����3�1#0t-�(i!������cM��t&� ~�2����H���`������`b��&l ,� ���Re��@�[#k�7@������Ǖ�Y +��<W@Ik�ʟc��a�����Y�f���Q5�XF� +=OJB��U�K&�/4E�X�fA�^J�m��V������h�'� }<�����za_ ����`!GJ�&��<��E`�������5���J��]�aVI���ʧ�=�Z�f�L1���h�����Ϯ~���X����# �FfV�1Gz��|��R)�A 2�xc<Ş��F��F�P�桮��?r3/Ev�q����;l�2[ ���u�Z�1�Z����0�b��B-�{-00�1�m�/S^�4� �a5���`�G�����h���&fu��33�Vffy� 2�� +�!X��=�W�Z���3�E}JU���V�N�ڠ���g�]j��/�&O%r����Ebf����$4��C��` ��)x0"y�U�Xe��j�+^�>=X�x���DR��7�|���X�9�!����I��`� ~�0�����ffffffgY��3<��>s�fy�����:��sϏ�Ӎ0( +�� K�CҰ+�ʅw����#��h����$b"��FoY3<�37�6`��G@7' ��� ��H��Z܂���g�m�@P0+��&gY���oK96�`%B��oU*���'��-4E_*�0F��X�<Պ����̙3&gY�33333333Ϝ��������5���j�e�b��E]v��F +J�A p&fb�"W�Y��(�Hc0r��[z���?M� ��M\�8��NzE���7"�Ա�����:/Ϧ�,e&Y�Ù����u�\ncZכ�<���KX�O~l���bڮ�=�@���}���G�������L�5)�'��4�Z��V�~HU�����tF����,�"�Ǭ��a�A��i��t!�}���M@U��ηր�A�3wȞ�)P�v��7��0�/��<���_�_�c��������<3�nq�+*���0ď���-���B�2��b�>�c�ӏM��D5+<����9��gY������CPx�x�~-�Թ����2�c��00(��H$�IX & ��L��F���&���l��N]�Z�"-�6�&��<���|M�%�1���������R���DO?��x��&va���9ݍIoE�'|��B0F���enŢ[�,K��E�q��={x���3333&fL����:�������ə��g� +�T����v�E�'�\���Xa�"��B'��oD��,b:V6;!,[`$����:�hn>���`?*�� nWC�A1bA��^��7�@��ц4x���'�6 �F��L7D��`L��!*� ��z�$υ�ұ������\��3330��̙�3�L��+;���s�\��<g�|�8I�W�I�&�]g��I�``=��foJ�Q��^5������j��7��x*#��n���D@)�����y���!B�����w�b�Ձwww�z0Ə "��W�5\����FO+�����AȢ����R2�V�l$3�^�O�u�3��2fgY�g���dϮgY�g�Y����<�>|���Nj,~w��?�<���dz��O�@}��r�����fK+n�X&��;��'Up�\���߿~�n�y��,��y���w'�-ٔ�OU�u�l�4��(��@ErٰZ,�\�8*������;��ن���L"��1`�=��JƊތF�$��,f����*�8C��333333333333<�>|x��Ǐ<x��Ǐ<y��ϟ>|���ϟ>|��g%ۥU�?��#E�|e|�+K)K>kZ����9s�k�)"n�Y�z�� +)�ع��l�f}w�'�����<S��1W^��*c�VU�h�����������/��{�-[U�z0m����X|������hX1�X+��MKm`� LZ���J*�|������������������������>|���ϟ9��Ϗ|���ϟ>|���ϟ>|���ϟ>|�&�$L��� +�2�[��F���ci�߿^�h�Ly����v#�Ӗ9�����~����V�����X�%O}>s�A�a��H���v�4��)�C~O~���,��p���;�0�����/!o��_��g�)�@�ϑ=���ld��Yb+(*��b� �Ee�����2gy3>����?���������33�y�>|���ϟ>|���Ϝ���Ϗ<���ϟ>|���������,�Z�|�Eϊ��ʬ �Ѓ���[��z��O�<���F~��c��Q�S- *�<۹ ���PWw�AE�]���x�%��x�O�-���f/M/:�,�M������?L�!G��]�G�� +@<�0� +��<���&~�ٿL�����3&ffg�����ɝgy���\̙���������������g�˹�����姜�ʫю����䟨�{�N� ����8u����d�������D�u?����|ay)Z,T�l�y{Y�����֖�Y�|�'�ڢ�}F�C.�!��[�V�n��E�/�am���/O�|žH�����U�Gy333<�y��ϟ>|�fffffffffffffy��ϟ9���������O.���w.�[!��������W�6ie���j4�8��a��ќ�>��3�T-T�&�(��T��%�}��=%|Z~v���͓ϖ�'��p�cL+�B"OY%V7#�1[���QZ���)�c0��� �;�p33:=�� "Ļ������s��2g��ə���3ϟ=fffffffffffg�>|���ϟ>|���ϟ>|���ϟ9��333��Ŭ��v�'�&�E�7O_.�"K'�����J��h;��=m�N��|bR��CP@� +��P+���g�q�4p�)R-Y���,A=�ı!+6�[{rۡ��`��i��g�̠V+@��4�ޜ�a�Ѱ���c�>��ߓ�VL��;��3;�̙������333333333333333333333333333�n����m�!l���<��f�R��g%^�]�~3�A��MG�&2�h��(U� �_+�P�b�@=%�ʫ�O�<�h��@�;^�3X�f�c��[ۃ�Һ�U?JQ�������K��<b,�'L?S3��7w~������s333333333;������������ə���Ǭ�����I.`Ez�B��JTDP��'���5a�Y�&�����M /��Be\JxB�>,�X>��w�GF���'�]�ACx��?p���?'݈��Y�R��[�@�D����@�t��<Q�l�7�߉��M�����m��9@�a�BwK'a��c�X������3333333333333333332fgY�g���� ����B��K{�%�C�a�m�n�<H��+7���E�w���q8k^df!B�ޡc3�J���SH4=>L��0A\���E>��h�y�E�1��i��a-g4�Z5M��yT������j�\#�WJ�ϫ�A�[��#ZX��`?���g�����s����ϦfffffffffgY�������32gY�����Y���龽t��w�����\5�uc<��9����iz�P�~I�|y�Lta�]�RO\>*�a;��J��Tk�-C�ɶ�� ��"��#w^l�C�6OK+NU����Wo�@�/ኖ�ok�=ގ7a�`��3�Ư���"'(s��z���Ul���o��ə�ə��γ3333333333��9�>��u��333333333?���|�y�=,!TE���7)� +L�_���^�9��U���Znv��e�!}˞���Y�ˈ�'w}+���L��š��a-k[QX��:=�����<�-A\���lU�+֓«!5�:�)���eҊ]���Q3��z�,��8���<c�p�<��w��G�?�����GJ +�C�gy�����̙�33�g�?�də�������������z<Q�ļ���L��A�x^BW}�8(�Qƴ[p�%pvD�H���ϯõ���=1���]^���}%��W���α����^��y�wTy¾Z��:��uJ�54���0�M\y�sR�|���Ծ�~�w!y����U^/�}ǩ�CJ��pB��j��3t 0O��q���ffLϾffw�dɟ��333333333�����z0�-0)���x�a��z]Z�ֈ��!T��eW������`3n_=g^3���� &;��/�<֩'��_]ވy�w��Ǩ�V��ʨ@�!� �UP��|������%�\ �&0x��(���7������5�m9u�x�����#�'��}=l��W/�h�T������[>I�x(��ã9\&_���?�ffL����w������6��*[��O���m����;9��m���.�����Z�'�2��}�`S�:����&a�e܂���R!���������4��)xo�� T�%J>�X�Su�3�K��DXЏ>s��{���� +���K�� 9l�r��*�:��=p�{��tX�[x<~U���nf�� +�{`W����2��{#��>uŜ{0-���+RL��3�?�q��~/>||@Cl+m#�xvB�|2����Ҿ�)���n�u�ïdA5Mc�K�jXh V��Xꦤ��۽�f`�rc�X��o�c��(X����W�B�����MV�^��Ն���������Q��l�p+J�����$u|NR64��M�'=���j�P�?r��Uޅm��gc�41(g����Gᔡ����q���9����������?<��� +G*��$�A�[��Ժ�C�������>�ޏО�B�*z]I{�cgl��EX��g��� 1-[C�dA�p�J�ў�p D��$�Dj���A"=���|��U,-��p��>6�hz�I�8� '����-F���fC����C���Dc ��쯭�9qx_����<���!'1�X +Z"��Ԡ&�����śc�Г���G M���2�I�T5�fD�9~�Ig�8֖D�}�_g���>@A���Fo�`����U����k�C�`��ى4��fyQ"um]��e�ӌl���qD�}9k�:�܇Z�k,[�.ʋ22���V�Qdjq^�ĵ�����yf��%O)X��ǖ3F4� Y�ؼEͶ,p欤�ؔ�ߙW&��eVC3)v�ղ���H�m��BӍb`_*���!TW��s�BKЉ���$�n�m����=a���5LF �s�-������x���,R�wUcNgR���I�j�¶�F�#�� +���:�)1�OO����E�K �����O��1G%lF,i��'�̦�F�����T�$��������!I$g�>��d�r)a������0C*USZ����j����i�c���*Q�^�����ul�~�T����R2A� W��C9���L&-t��q��d+k��gG�#�³l��"Z!����j5��s�d�����wwׯ^�z��ׯ[�7�a�و��yT�+<dBT����W���+;����%tYI��kt�*���Ŧ�p��T�_9��³i �>�X��]Kn��n�zg�[5J��_��Y��p�U��,2�|q�:f��#6�*i�UpX���������o^|�D��S�� E�����8�ԼĸB�z�iY��b���m�ql��@H��3��ݮ��R(5����Ew�EX�aR���O#JJ��vaO�W�:�CB�Ͷ��:��+у�N���XO^|��B +�o-y\�[��f8E�H��������?��H�wIٞ��2� E[�y^�ц +����1���*y6Yuj��ʀ~q��BR�L��HkY�N:0�����wUe@G��#O*������l!���~�1{��[�b��/ʼ��~M�m��&��6��Z� ���+*K'���Z96�b*�J��l�V��`���8���?��FW�B�Ծ���+K+*�V���ٙ��9� +ǀ�J��D>�U�"���B�b&�Kj�X�R���9���� F��<U��H��}^j_<��)��5��cbXvh`ދ����X0~�Y�q96��a|�n3�n�d���,�w���V|`_!aP96qݺdFA�lU@T,*U�=����-Y���!������b*�Ʋ�VVJ������>|�ffu���4ゎ}�K;�,��¡ȬBU���YJ�%�+(���ój���u�l O��4�:�GXU���Wk.�����/NB ��o�^�{ݭ�Fr�)��XmK�F��mwYc+V*�M)�~5��V�����ukro�rE�anB�K���Z7"� W���f��o�C�[-EZ�x�m/��'���>����0��z`:/[�2�hY���Ryטe���m�*'�>4S�1祊~0��/���|�@�+�g�@�auw+lref����'�c�WU�l-�y���� +4ض �X��4R�����J�E���LH#�O�~)�W˯���A��9��ܶ+Y=���c�or +A@��x5|.���W^���j8zhK�f?�u��� +�^U:`�m|��t��R�9U�Z�B|`0I����ׯ�\�>���h`�Qߗ��ϑ4��!��7�aimV��F~�\��u5��#�x����� +R�+����Vj�U�ɟ/��33���@$��յ?WUn���Y��@��G�*�!Ճ���7 +��㐒�X���$=uK'���h.�D�����E�,�cC�R�G"�V\ +!�; �7D0��d";��q *X�#�1A>��$�}0@0@3k�n��e�Օ��!CXE>M_��ϟ,��W�/�U�OD4w�$��\>�W�q�X�����q�S[��X�N@���R�܋o���,O*0�f_B��������=g@�cĶ�4�t!��"��� ���h �km�` ��#��Qm�WZ�>��#�j� =�o����ވ�1L�z �&��57����=�^|��b����J��A�LǚX�a���en� �Zj���X��y5�����+�c��0p�li��|�k+X������-��DE�n�@ f|��ߏ��4u�$&y� ��p�5��,���E�z�=9*H"Y���X�dЬX��G���D-�� +@!��Mm�<��ѕ�X.�g��L�X9vr�[�c={��_߯~�j�a>��z���f�}��_�)1T�k&�l��V�A�3>�s�PrIi��_b��V�a�b���* �`��D1g�i��s�H�8�Ҡ��L[�ȱ�{Ff��0�kK�H�ҳ��0bL*�UAc&�@��=��ȄC��^�d;��Db�`�鏯sM���F�P����XL���Rk�\�[\%�K=3��0G��t�[<��Yk��V�����X#����{�t�`qjǦ��Ϡ$�;�dž��U���0�VV^� �r.�^! !C�PH�Vl�z�3�>Ƃ(��y�T@!��u�Mݚn7z^�$��K���q0 ���0@ _.�<�`k�yxN��1�@j�5guR���::>�����rV|Mų�Q1V��QZ�gD+D�z�fE��I5 �j���EYb�۬�����AX�*�T�ҫح��#���i��$��l�f��)��@< +�>�.zЭ��~��a�ŌLMٝ�t��#�O�~Kr=,����Q�!�<��@�7.�!�*��[%�����Ob�8��+���4X��c�V�]�N?V����,���Ya �iA=1�`c6*� {���h��Q��C4>��m�.�������F#��lrN��ޢ����97��Ϫ�m-��c���U�a�3!��`S��Y�A��$[2Fdof�%Y�5Ŗ*��Dm��kіO8�Sm�D�V"�a��3o��Fz�����Z�-�ꤐD`�\��8�a**�ȶ���j�tƊ�� %l�k%���xG������u��W�XDW�:h;�AE��~�u��!cڔdi�a��F��0&�&k+Y�Ĵ���9�̸Vr�"��,X���H�y�0 +��<|/�&l�F=��4�������'��p�}�������J�3��Y�����++���|Q��<نz h +��'�ҷ��cL��=���?U#�3��C߭� +�\:�П^�'a�#��A���,,���&[#9�=���\Ł��}�)��,���V�z%�3z��e�uE��>|�V�{�(���T��0*�X�����-#W�M�Kx�:Fk'��#B��`&%�ПFP`�:C��!|�GF=7�����[��B X��C#�M�}zq���Y��o��d � F[bh���j��Vx��NUJ$-��,���[G05��{relfOH��c/����4�t�KXڠ�:�/[)x��f7����zWj��h`v|��_����cM=�`�H������ $�B�� +���!&:��x +�i��ƍ�:�E ����!m��6��� j�Yb�'�����j��>R�~�-��X��=�`���b;[]�$h ,m?Q�E'���II`��.VN=����R�弖�U�g�H����Rź#?@���7��� ���@�Z #tP�3�g�0A��B�Z��=<�zڠ�$ǥ$��Hs��r�: ��0�d�mk�d�bԴ���C�4�w��+���&��-���* +�=YW��O[i���u�`S7�y�¥HQ����7w�w��-���H�`N�^���W[~�\*,c�"�0�?^�GU�'�����&��C:?O(�_��� ���W� 嗯9� +&�ՉՓ�W�[)�x�s���`/�G�c��}4�։����Fo���5-AH�r+�JI�:}33�&�!�I���BL����E����tz��y���徇P��9��4�����DK{��t�eC�X݉�7~pD��/B@P�@`�A=��*��a<�u�f�0@}1� +yV��9�(����A����I��6r �a(����][-5(��G��?&�`����nMN`�f�jj�mK@@V'���}}F�����c]\� ���EB�Ƌ^�Hl���Rz��a=hh"ǀ耬�Dd�f���t6łb�bfn�Ko�I�DX����[zXff��M�!��o ����RQP�Y��a���5q� + _����X�_�����7B7�0CV`1*��r���,̱J��7��@����9�����%��UV8H*1��1L��R�Ŧ��dY�H���[�"�]���Њ +:t��Ұ���_/�7������=�6��B�$6�><��č-_���H�kP<�[����4�=�B����$��TH���ʏ��`�a����zٌ��ON����C,��}n�z�S����n���O:�����< ��Ak� +��I� �B�a}ٱ`;�f0O[X�Le"=!�f� �D�!>s2o�M�α�����z0���@�(�KVk�WG�q���ߨ37*����rY�]� +jTU��wI����o�6ւ+d@C��3~�)V�ZL������E��L�����y϶���-ǐ�V8s+��B�h+̭�9�g� l7|� +�F�����}�XX�F"���A=h���#�"���3<����}�oy�?Aӯ7)��n)]��k-��?N��,��ް��(�oD̈́�a{#BPC$BR����~��a�{yEfj�TMM�Mց��,�����y��N�}o��%k�.�+ ��"G0��Kt:N����@ɢoȐ��M�I��1��螽|���0��2+���:$��"���M-�A�K��B��éQ�#��M����TE$� ��Ȓ�v��a�5J��z����-U̬γ:�2��M�p�2�ԇ")�[��V>ۻ��������T��#��VE�t�D��0�j�hQ�7�����=b��U`fog�^�Ly��'`�DU��3T��tЏ$EHm�z��:W �f,* -Y�c �.OM8罄��p������z�+���Z�ƱW�A4��_8�s��m-����GB#X�gba��H���k�.Y 5KE� *?�n���������m��M���ݛ����O20��)�LT�k8mı�Hoe����������F��w��Е��~���aVY��@}��H�fye tTٞp/���n�),���'����mkch����=隣�B�D���WF��g%�Tip�K���F�,`iD5�^�B�ЊL�Ax��SH���Y}j�����������wwww��k���Z`A�- ��NE���ؽ��S�wDPW+���}B&��Y� �P�|�[�AX!=0a3ɚ +T�Af,����b��������IoUDc�ұs+�R�>;FR�^!/�0yE����\J�kjd���g���ʼ�^��L�(7������M�-���;���������Y��h�WR�UV[�|�T��-%{a�;р/MZ�U|�pFM����R5w.f;���H�0��J0�<��ŕ��zRC�UB�ByU0��a�Kk3�i�l�[�=�����Ѧ�P��1[�&�bU7r�͠�^� ��~�meO�Mݢ|���E�+V�2�O�g����a�k����>E�59�q+-���9�2�w�EE'�`�!1�~�!�����`L&������!��e+����e�2�4���詈Z4���=ctՂ�W�E��#,�ޚ�Iw��.ԣ�kg� M�v j���5���j�K�j@Pb��mW��O_�����n��DX~\g�/�7�$3:ͮ2%mRO�� <� 3kg�0�d`tm�f��H�,#v`�k`�0�!� 0� �B�`��ء��z0�ф��}3w�z�����(�&0(�/��q]YT��/Nbr>D�`Ђ3�K{�%���@M�uZ�}5�E��w��vn�����7}z��>�Cbb������]^Wa���"֪�K@��s� m�a�z<�+0��>��VWS�?Ȯ R�0e�&�Z�:����J�0/��:��FW���fS�7�UVU-=+��\��K������F�Y$�V�r�V�R�f�C�Q�M�izZ���!��'I���,�+?�ٙ�l����n�{��f}Z��eeX���#�y�SYs<Xp���vy(f����xTF�:��hp՜�?�[�dj�I��C,�����lfV���-eR'��U���,��Z���YQXIdW)b���T�j�Y�B'���U@LkRY+~G#��ԣ�#��U��XP�5s���yK�+�� �7�ha���J�s��Q���3;���ւ8W�0��m$@}+�1G��P��wb�VX`���,�z��L�Vy�3��Z�X_��D�Cz���,(ea Vx�:֚Ip������ vV�T1���d���I��5Ys~k���nGEU��J��X��b:b���n!�+ .��� +zc։��z+u��c����3��-��wwwf�����DM ��ϛ������n��_ �_�fbO/S�LXO����oгLu�aPRߑ�Ba�0:� 0���33Wo��Ɗ +�� +cW���H�ܭk�V���BX��Y�o���D�Y�r��Ϩ#XH�5f�Q0�Ziy���L��hc�9BR���%�ww~ٝn�����ѻ�$�^ۓ��=�%�IW��x��j���2h��3�E����(���νz�^���7��z �zR�`�7t�B�0�����}oYߢQ�b��e��l����9�06R"�W%u4[,�Z�X(g��e����n���@E��oSw�C���]�Y� Y+�I���Ϯ����33��vn����!��ӭuWJ����:+��(5YƳ�kİ@@`����c� $��䏱���O�2")��I:�sv��R��~�L�N���Hz��ȵ�5�8u&zNE����2������]+�������Ό3��[c�j�W��p�|x��2fy��8��5���H������Dn���<�y�2a[�ԐM"��z�V�-���RA3|����b2�V��`"<�?���?T*�o������� s�=T�U�! +%�\�WעC�v� ��� ����n��W`R#J�W���k-}bZ��E�������q<y���>sϟ���Q�V�}�f$EZ�!'��,������l�γ��϶�i�š��G�˕oC�V��Pǚ��xcGn���:�����?����`!&,����Z���LL<�eu%�V>6VM��.�(���k�nF�>"�"�Z��![!)����9x?�����5q�?�?S�f��fffa\"�[�a���S���n��333�g��=y�#��tb��e���~���K(�*�d2��XJ�٘'��l#럳>��)<��2b��C��0>��Z���,��U�N�Eh��֘J�@��\�Qju"�i�a�3��9a����g�:`%�\�(�E_�������;�B��і���>�z֗'V�f,H� ve���#� ����>��bDr�a"Ŋ�/|�Y�2t��,V��ϑ�C2���� }u��u4 +�-vD0�T�q_|������.��(�L�U��a_����~ә���y��?F~���3�*X����H���цUh2�f�� +���,�h�L=��&M�_��Y�c�W�벺Yg� +���o@�Y���ˀ�;T���X�����+��5��?���^s,�rf}��Y���/TQ�s3?N�Ӓj�^d��������d�љ������N}���!c* �K�0�,��B=�T(���3!�<u�����߮f�����Ϯ�K=j�¯Z����Rr���2�oq�22�� +��] +`�R{�驸�� +T+ǟ~�z���s33�J|_��M���w�3�^�����,��Kɿ���g��ck#t��\lYSva�[_�0���=��3Ycw��n�_�����h��R��#Ɇ{V1�e���B�: ������H�=VXD�%j���[�f}s��c�7{̙�]V�����+��Ǐ����/1��oK���hK�m�ъ ��1���B���U�BI�@�#��9���`��A�Ѱ��B�AEV��Z��d�C��l,�����B�6J��332f��� � +��&33;��z��$���r��VQ+�o�A&���&g�>s33 +�mCqp���?�W.��'�� ��}b��e�x�~�<����?x��<�)ޏ�>���� ���*�[�o@�ڟ�Z!%?��~�~2��~s������33>����\Օ?|)�|_�+(�շᮔL���`Q?����><|~<x��?���~?�Ǐ8c}���A饆�h"�y�����_ �7�|?�hn?��}l�۽g�C33�^����,HƁ�1��2�`�? +q�y �rg�γ�����>�z��� ta���~��+��_��do���$��=$E����t�`��~�L��:�a��}!�`��%D��<1LH!;��/�sx"te�L$�F4����������D���!1AQ "a02q��@Bp�#��PRb����3�C`r�$�S��������?���)i=��L~��W��2�����M�z�Y�NUG ���#XDӪ8��B��81�p�*�ὐ�y����|1�v(����ƴ�jݜ8�>X�X��E��� �Q��8,��#D��X���O0�8��B���.紇/q�_����j=���x(m����9�~%�R/m�<��eد�.��8Ɨ���n4%���r��_�.�h�c���{�������_S�r�ow�L��n��a��'_[� n�������яE�ֲ���q���|H�Y�g�u�-���#�K�_��:����(����`mc��23�R���_������]������NR�Q�G��׳���J�߇���i�9~^��8�ľ������]u�G,[�NWʕȟZ�"��gU������r=�������ߵ�~V�|Mtl��֎�mu�2<^��g��//�!��{��0���U�\+r��5�ΰ�G�T�q�˭W}�$-���U�OaI��r��-|[ +L|�ԶA'��w�z��En����n�=�������d��{�� +��M������8ſLt���sA77�/�k!i��DZ̹����% a�� �%4����Ax=���l��E]���W*�����dR�,z�Gˆq-7]9�����f���=_��/ټo}>�g������D���������C������il�eG˙����Ry�y����A��eOj8��/+�%��� sTz��8N�lJWX:u[�!*�}H�iS%�rnHP����g�h��e_���MZ�<��C!B6s�8��?2�O�s���T��sn�)���|w��i���ޱ��qrQ|�w�.$��J.�������g�����YƆ�k�����NG��ĤJ+ܗ6�Nl?�Ep�I�8���~I/?�9��G��p�5C��9;'5�%�M�H��8s>���#�^���k�?��R{��'u�?�,vG/�lrI9y����RX��W�.싥�C8�>��&����IT���Ҿ��F�}�*�"��r\�K��ܩ�������O#N���z>��ĎQ��HG��X�ey��YkТ5v6��ö�>,����s��x\���>�����YG�1�K���c�>7��}G�%�$��X�d�F��8�GE_s��������5j,�q%��,�%�G��� *Dx��&O�.Y,��s���JE�D�8R�-Ⴭ�J;���1�dV�Z���V/���=�*��[YcQ���搒�$�6IK �mcyo#��˞��9� b�pR�w/�{N�z�V�8��М��Д|�W�#(�[nes�b+����)aG ����eR��r���������8U��z��w{Hu�<����k�8BQ�]`rO�k}�Cn���*|ߔr�iy_�jY/��O�XlK�� 1Kr���ԡ�8�O��V����B�F��*�+]N/IC���D�O�/_j�Y��q�yd�o�+��Dx�sX����G�E�8kNIy���FQ�!IS���>��M8�g\5t8���\H�y�.UJ�b�UW��h�Y�>�t��ť2$^�Z'�B/�8�7������ĕ#�*�:���_B[�,�]"���9!�����#J>Tqa.i����Gf��+����y�S��b�R����:�����O*sW{����>��CxG�:��f���ˮ�[E�n����~��FJ��^���eԌ�6ȅ�b;<֞c�ܗ�Mz���ٓ���sy(�X,L�s�ؓ��qܯ+�_>�[�_�q-��r� +�\U��8��d���Q�^�S8iSVp�7ȷ��q[��Yn8��S�8�|�d�/����q�G���<�w�#�]���l8�Ʋw�Kau,�)�]#-�� ?)ğń>vؗo1E�v"�g7ȧb��OE��q���z����������G��_�D��*�8�����*-n�)c��ӳ�D��-�2[w#[�ҭ��^��~�Q�+��B�BQ���C�v�M�'x�}+�J�qZ��� �G�To����r�Ӯ��]N\ {�yCK"����{����� +H����8�ْ<��d:�dJ�`��ңh���~�+F?��C��?��'*�]{��#T��S8r]�g.m�g�J�q��/�I��l��t�]�9G�p�l�ҕ#�~.*�5�3��)%��v|�V3"��vΔ�D� �)`��k�2���M�iFro�c==�<����9yo�J2˦R�/�+U�d�>��y���E|YU�{��}���'��ª�ˑ9*_3���Jw��dͭV���NU�`�gF5��KFJk�o���Lt[1�k-�[�B��as%��,��ƴ���m���Jz֭��5�ˆ��� +D����Q*Kr�Ò�8R~���*�r柡�%��b����f=��W���<��M��f���שlFٚ:�u����<�8� /^�i[*.���K��؝�Dz��lv�W��澻�9d���K}����rT��B�+��Ig�ؚ��9Z9�h���s2)�yoH�����EL��uCC���J�(��DE�]�X�;h��� +/�5'{�K�GЬ�[�+Cp#o'<y㰓��r�е�g���w��q�o�0+^�)w0"�6�/ROH�A�w:�weiO�%�%ZܔۛycI2�2<����4���-�������'��Uҷ����u܍wcX�M۹�G�i��uͱ�mп�R��Sx��O�/�(���\�5Mg�t�Y��Q�̭]���!sR�MY����N����4��"���.���d��Й��-�ر�dg�%�i>!����Rb��$�s�r|(Զ��s���4��{<�����ؗ0�l&Z�Sq��t��mLu�Ɍ�;��R0��RvR���e,��5�|���<�/$n��t���s"���_��f�$��"���8�1��]u�L��ܓ\���[��3uBDk��_A&{_���̾Os�a���-ğ7B-�_���-�,�R�g;�]F���Q�%�P��Q�7���V��fK�1�X�E���w#$)��Q��XC��F1S�o)t/o�� +/�Q�]��Js^�/^��ߴ��'�<�[�ً�����m�_:�����1��,�e��Q���E ��ƿ�+m�����,V�g��+4RB{n���r8e��o��ᮟ��I�lK�%��̬�+e��G}� D��"��1W�<� 䩡���s�'��b��o����xzV� �v5�7�zr������wѡ���]/bC-�-Y&�'�d�����W�_q���8��Ց�\��ר��È�]#QIz���<����|7M~�d��-�릍���&�K��%,�$��������F� +1R{���jU" (�]La���}�~��]J�lS�����Mn��.�-�o�J��'+︴�!���؇��,�C5c��WQtRь�Y:�Ω�?!K�N�Օ�:X����Лǂ�ᖙ�Q(���V[$ʉXj�\<~b\��!����l�9]�#s��ꖵ�Ga�!�[�[~��#$%�ԣ1��G��3�>&b8�1-�u���"�&F��rc���pV��AK�]#��nG/����K�3�C���}e�O�+E��v;�_�d����B����i��Tj,_Q�=��c���N��#����U�k���o�Oő��W���ƔYX��)YKDsal�r��,����H�a�\�~�*�)m�Mz�G��RT����M�i`��N� =��~�*�FN��2+���9�d�9�:=+�jW�7��3�"��o�(�_Vc�b�Zy;���4�i{�9-�l��_rЩW�߰��$�1�E��SM�źF�XЫ;�{���җ���J�����u���vYGG�����78}��������|9� ����ӧ��SB�U"���(y�Dލ���L����t�;C$�̌Ez(�EWY:��ti#��4���~�R=� +Ui\v�9������o�t�y�Tc�s��__AП��1�&=�#��z �;�Ą/5Z+#^�:W��1��֝������ft�S"Y�� ���Ҵ\=tNj5�rm�~����21عRxɟ ����,��K�1n���W��8��{�Y�N�U�����bث��:���{b������ێ?請�����P� +��ɏ}b����N�%�e��ζ�����Ƌ�� *:v1��ଏNx�rqY���,��r�+#�����p:]fN�lL�^�ݼ.ž�J��O�/�}��A ����Ǧ��'�����*(�����v�������� +5B��d*آ���--xp^4h�u���z���~^-��4�d�E���Wc�+�������9�%?����J�r�4GO����rυ�[o&|T�TP�y�����ђQ���rH��#����M����T:��ĒQ��^���Ւ�7���{�{�R�+r��O"���Z+(��̬enduC-�ţ�e����/��;�����S��D_B��"�>�tL�%��gTM�$��}��ɝ��[���Ⱥ����,�sd��n�3U�f�_��G�M�������h����k��G����v� ܺtX�>t�萫�QdKt3�ح֪�e�����~2��P�-�"�y;���ė���T�~���P���"�����w�J;�\>U���c�Q�����!)_B��5��ʉ���>��Mb��`]N�K�>��AoC�^�i�cCy�.�[�C�"��R�*�0t:t1��oG�^�-��w��ϒ1#tS�Ǜ����+$W�J��]���-���L�����߁,�V�_�DX�����|�W��DI�/�ʖ��v{��O�e�,�Z.v�:1JUy)� �$EH�o~�)�H�\��9�iR�9��N�C�z1��Α�;Z\�F|,�B�߽�%����%�Kܡ�Œ�k�Z�e"/�,�tf����bDa�J�X�Ӊ������u�����RY1�c��#���v*���XC��Wc[dǛsу�q�5D7��K�oO�}F��D�s��ͯ����U*�ݝ^L]���>ü_S�M~�3��L�ّ��dL��.E��lW�;9�QV #�;э���&/p�_�������e++�E��%�L머s��Ը�^�\Xr�O�Ċ��s������$���� ��eM��zq�3�_"�Uk+����x-S<�BDoH�����z�5�+^Y"�u���l��rIS�v2J��E��H��V��[DMd]�N������UuF.#�"��F�]�^�44��cF���5L���W��|o�gV������)K���Kb��9�dx����� I]˅��i�π������R������ގ���Kْ�Q����f�e�#~�Sw��?Y�!� +��6gU�kq��5�=�/���[ +/�a��ɒY�u2=�fJ��*��ŝ����^�R��<S�~�w]Ĭw�oK���rV�[甽�GS�QlKtB��b�)����5��c���R�'���oq��;��C��^e�pg����%p�yz�odgkM�|��q(����,cob�8�w��wc��������xҘ��Zw)��ؒ�M�g�*X��%�D�U�K�y}4��E�^4��sg�;������E�俚;�}���Iᔐ�H���~n�u�i.�Э�����K�0s-}����Ґ����ۜ��"(DE~�J(��1��C��`O\��ǫ(hd��{}G��� �]18���˽��d��RR��4�)�n.K����Fm������}�_�[�|~wS��z�F�n���EK���E>�n=;������ ���N����l�Gb��ݲ45�����qد�Na�m`l���<ն�R�):G7_�5��!K��F�}���-:��_q<5��h��^�*�<��o��c�TU���rm�@� �Z$;��i�K����V��)zV�E+�����$'��>S����%FӋ�n'���knȣ�YE����T�Փ��Kn����JNV�Ě��{|K���{� �"��1��2'Q[w�p�o�<ˣ��\�%�)z����6����8n����ҋ����4��>oC�f5�Ċ�S2�d��I}H��7ͳ9j�����k�J�,=�*�dI���G������m��\�S���"r%�� +e���L�yn��&lF�e ਗ��ě�4đ�ovDZ/}ڭ<��R�^5B;i�J-��D�E��F�#�����8�$��9�T̊����\����Νa�՝�������}�<}���[����,���AC�JY�y^�ڙX���^����p�"�;|�fG���� ��� +J3���������q%y��R�#:����Œ�����<��O����ԏ5l��7���T[2����c"�m�������#�rVsJ��I� +��V�E���v0R���R=4��1�ib0`VcZFi��zS� +���e<�4� �{6qe��p�J��r�%*D���I�_�Q���ˉ�%��I'(b����1å�?6/���Qq�|ׅ�rǝm�$�,�gת8{$�R8o���Y�/\P�|+��y�L�1���Y.�N�K��}ՊsKϾ���ޖ�x���gD%�Θґl�9b�h� +�ϝ�.7�^��B��?)�C�;ߢ�4���%Ԏ�������Ҳ��l��r���&����O)+���_2�]F��ب��_s����R�kc��zQf=�?�x�;Xz!F��^+���t#5E*-�l]V䛹<�\N_��q$MO�i��S�,�"�n�-T������(�ڞi�ssJ �8��Z_Zd��+�uK|2J K9���>,`�����MÂܒ��2�\�R�m��.6�q��{9���_���ڮl����HwoW�*4�2^�$�]�\���(�����M�"P�\�V�r8��eƄ�� *q�]�����[�|�V����?�b_��w{Y��N�����K(�s,��_.��9��}GD��;��Q�F����QfJh���vs{�Ҽk_2<�1�HQVs��Z)�E#{�P���uQ����!�$�D��b/��R��E<-�> lETk�G7�o�S¾N��f�#��b�Qm(�}z�HIM��p�k����]VoӘk��:v]����/�\�6���ߡ&�y�u���ӿ����$�u\�������&t�y�3˭���>iK�)Y��b�X�Dר��jK�|n�ͽ�e�r���6N��T������.�QUߨ�C�c����Q7{>���G���݉/C�͝;G�[L�41��Ld����9d&��uǁ��:�c�ԱE���k��RrC�����WS7f��%� B�����*�\V���iV�n��2G������I\j�l��C����s�H� ��/��l�n<�I�L�{?i�Y�����m�ūm,��!$��+�ȇ����5v냕��b[.���=�FL��љ�W�� �ls}�$�L��2���+���9v�V?�J�X�ԋt8��B���7S��%>���1����Cߨ���K�/1U�h��*�U�8(�YӠ��6+*&| �E<�,U�E��������W�X���4G����F�&�Vt�)���'Z�25Ƴ&�Y�^���6�rȣ.×�%2Q��7�Nܸ��>^Y3��%Ņ7]�D"�KbݔP��F���b?,K�Ԛ��bK�)�ro7�N��v�e��rQ���o����;��$�>xi��iL�XOa�^��R� +)��U��tw���c�̨�_D� �㋢�q8��{w�ow�6���?�_���4�`���.w�-�-,ws,���Q��2��_�I���^��d(�2숋�"Ζ�����IBH����N;3�މ���x�F���s�nt9�`�]�I�9#�}��G,�dS0'� @R��J�;�MQ�~����8��Nΰ�nG���S��]�^9����e�����B7�u�֔���s��o<��K|�iOx�?�>/���j�}Z"��>���K�Ey?g�x�rrV߭���'��IQ����a�һ6�y���T&�ٜ�<xQ����QN}WA�ˮK��a�Y��JT���R��l4��0b�OЪ)�RT���)�d%Xkr��:�b�O:�q��4LZ'��^Q��J{��!x%�����dE�|�����RCl�ōnYb��+^eG�t�g?�>RT6���5�9�Զx͜ETIF9�����s�i����:�y�.�OAw�sWm��)\V�G�-�>��~���ܽz�� %�~w���O�n_������ؑ^*�/�!�9��=��mb�}z� I�Iإ�Cm�K7�n�+#X���J��LO=ƾ��T�.KꇿQsZ�R���:(�R�B���˕��4����x|���d���9֑'�mP��P�V5��r�s��q^m��1�*g/]��q�4��pi/�R��S���Ĺ-���o�B�Ӿt���\H�V. r��]$�V')J?���>�Q�5������4�|���$��=�2���`EQ�S�\��Uo���]�K��RȺ���g�2rI��h�%�d��\�R���4�:��I��e�N����]^�J�M/m0���r+O�!=�dR�;�[Q��E���2YE���φ����04Y~�R2v+D`�j���T7�IͲ]I��s��F9CU�l�J�%��3�z>����sr>X�B�����tG�"\��_AljU�X}�{:]_N�q�*�����g������/�{cKK)������.h�W�c��,QU�K9#m�i=�}�լu#)y��Dv�;�w>�Ԛ�����N�x�]vu���+��,R�Ɍ������jK�q��:��),i�.9ܷ���h�i�!X�Ee~�8ҋB�� +1�0P�iZ/�K��ݯA��'Os����0J�и�D�i'��dc��2�1r]���ƈE3#�)�i����C�W�k�V�����˂���?�_�U����aG��^~(u��\��s�wĨ��W��>K,g}9P��n!К)�ǿC���C��S����u=�f����9�>'��=���G�IuܷK�(�*_�P�+��D��Kb�~�dﰹ�t?˿�:�]�������«�F���$�V[) m��4cG�F=�ә���/�YC,��bhE2�Z0No�����j�'IP�yds|��INjr�^�TR��cFNJ�#�k���n�?���Ot���+���>$��ò�y���%2���U�K���K�Vc�u���;���ѢCH�w7�qR���~����LR�Q�w������C[��)r�]D�wG�(�����N��s�ؽ3�mt1[1��D��^��|���Z�:`mr�)�+�E���Z_���ɓ:V��3$�dc��,����,M�Ƙӝ�*t�m��.�0؏��{�(�Z��ϑ���P�.l��_�"��/ͷA�."��T{�?���?+\��t�9B8�±�+�_���rr�����ۣ �R���z8��?���E����Y�/FdTuyz}�&�����^6�y�iwE�E؏2r�W�p��g!:Ml����j9WqV--^���2^;���C���[�,�1��"��x1���^'ﹴcL��kDŢ,tH��J%c�-�L��.a����p�g��x�M�-�/e}H��R�%�l�Kr-�V.4hoҺ��T.KӉ̳���yb��~U��#�IG<��ݾ�ᦤ�i_ܜ[��m�s���1Er� ������8���BD^�z�9��*���(����B[�a��p~Se�QMn_�o����_�*�7���G�{�N�r]�w����/M�;����j����mbKN����s�н� n"��,hlid�] �#��F��A��+dȵ�{P����=�9X�\&��e�S�-���O%g�1ilnm��E 9;���eq{;8)�w��U���W������.�S��!�I~e�̜-^}K�����S|�rNNY�T�ש|U�>�?��p��Ȕ����#BC�^Dn����5�j�ͷ�g߱�F��V&���y]w#%��V��V$G +�c���$���Wc:VC>�^�V1����5�[05�c^*�V��zcLh��%�bz���D�6�5�I����R���{B�Ug�5��X2..���p����~Ξ��9WП ��k�9�w�U-���?ky���QmϹ�G���k��r�f�F����:��qs����.O�����y#-�cr�Mzv��l�o��[~��o���rƎu�P�r�{D�^�בֿF0�,�j:�^�rע[�\s��V�\��IG}����[����$�x)X��^�s��B-���ƶ$�?�F<5�EE1xs�q��E�gES#�L[���v(�2B+K%{�i��8�4G�qj#iV��ܼ���� �f��g��q�m�*R��s\4��%�p�ҿ����C��[A��֝����V�-�lE��q9�R��=���r{_E�D���Ϯ�(�/,��W�$��YkIM�U�J�dK#-b�J~C�Ug�ƫ�������D�l�#Fm ~���=|�|�^�J-oԟĺ �X���|��?��+"���at�x����,;طf.�bK'mQt; �l��TXт���t^�S����4��qc�hsB[�Zs�FtR2VO-�����7�c�ZY(�#絎0�nY:�vF.�~�'˞������_Փ�5f��vc�vv(qy7���_2��7�c9:�9Sj�9q18p���oj'���P�uԨz�?1P�ľ��ák[nI|B9��Պ���v!7�\'��9�*S�`�&����q����"5��+�I�.��8��풾$F��h���BqQ��KF�* ����1�[Ֆ-���m�-0y�Ft��~4/yh} !��s�]��9�6(]��;�)�S�d�Ep�΅,�����O�.E�x��̖�����b[K�QG��^R���qy_?AJ9[?�m(>\��p���k�����n*);}��WՎM���?S���u���C����y8k��u(|r��?�W�0Qb^ +E�k��:cC�`��u#��`u��j��G�7K,��?��yi�߯t�ύ._�u#w��8[EQ����H.�T�VDkbUMl'҈�q�%�S��NH ��N�Y1����ǁ��B�"/���z?sB�V�I;�8ʘ��H�ضբWF4Ν�ΦI�n�'��"L�/�/�W�����$�]u=���9}Δ�� ��))y>/_��� ������._ʾ�?�)Q$�u�] C��u��Om��#4cy�Y8o�y��{I�P����o�D���?O�*�߸v�B���v$���8��܄�$侧����(:k��a%�zs!7dDQ��rC�k��_�"��K�����/��e����d�d���ř�E�icFH�K~ +�ßq� xi�����n��Z��6�b����E��'���sШ��x�� +Y��w8kh�ud��3����K�������g��'��W;�6]�pxj���um���e%�w�o���8�W����X�<k�VW��rAqr��7Vp8�j��ܸ>4_,���~4#��a�Zy���o���j&U���\��z*���$+�ͱņ��+q.����V��B3�a�~듿�_��w�G��!�[�ʘ�z�#zw#᱈U�ƙ�6w�֗�k+/qP��%��bbBh�#��V*2:��Ya�� .>U"N4������;{ �;iʪYG���y���p��)%��{5�ş���G~m��S���V��������q'�����](���=�7&�诰�Ӌ���n7����F��!�f9Eӵw[~���nr�����j=��c\֮ư�ˍ�{^{�./ ��Y5✎_|6P��+G� �j|Er�NȌ~��U�3�$�+D�Y�|oE�� �p�����F +��^�]N�'�ͥ3��ρ?N� ��>k'�E�<�A�̡э'���V�˧��ȼ���<���wC_#�-S���R����֩,J+{8�R��]= r��D�"<X�Xŧъ?�����W���s�啣�ҪS��VN�*O��I�>�K�X���[lsE?q[nJOL����ċ\���ђ����DS�qZs��_?1��~%�]V��*�n&%Ь-3��-Q~&^�X��ַ��K�l���`�'bB�18d��XZ^���9����=K�n�Iܰ�~j�u�q(I��ى�vX]k�o���/��۔��[?C9�BR|�_�q8�����8��ٵo�S�~g�����6���}�"ss�s�����"����:�U�N4�il�w&F�Ǡ��"�r�~����|��>����,k�>[�����~���[��*�Z&"��#��CG؍�0y�s!BnK���B��1�U�_ApTf�Ӧ��K�����Rov��R�J<<{Io�B5On���'����7�3)���jw�/ d�(8�}�gR�ym,�Ia�e�����G�+�ʭ�NkT�8�EȰ� (�|���*���%f�#.�{�5�Kbs�̘��|�<�V=01��ݔ^��z�?�&>�ؿ +:����]2w1�)��K��e{��e�3�dJ%d�-���ho'/��Kq?�c��E� �&r�E�;��ؚ�y�<E����R|>�]����cٺ���?ܔ��_�6�oo��rrw��oȓ��R��r��~�5�ԇ#�I[�Vp㘯�����H%�B������ �8(��7�luh�$�Ž�1�B�%{�S�1�JQ����~�x-�c;ҋ�b��"��ݽ�|�8�W��'��L��G��,�Dy�˂P��9Q2�ʞK� [Lkf>\�&�|�"�t�����|;��� ��),{����E�Ư�A�qqV_]���c��K�K>��K|�� �h��.F���,]_OFR���~�sIG��ܥ�������'�\N^�RFJ�$N�1� ��?� m����$� +X��{[�l�oJ���2�HZ�s�`���~*Z���,//c�?��"���L��o���ֿ����e� �L��ӲQV���:�Dr����hJ\Îw-l9<lK�M$���� +��/��pO�x\���pg��G٘�t�"��7NK$�������>���(Ǿݮ����ɳ���m2\%/l�{*��\���ro�xk$d�w���f�����o������<In�8�Ќ!KH�mQu,fu�r����b��/�Xׯ����-տ~ᱣ�|�[u%ʜ��X3~�HlR1�g:��:K?T`ϊ�Z��B�}JCco#��4ˎNYr��H|��"�g�E��m=���9�O��K��ysw3�28���n���{O�`�#��dy9���>"���ޞe�X�]���E��j�];����'[I>���p�gn��2�|���/i^�n�|X�|\���J���"R��_��X;/l?�©a�ߧ�qb���~��s�Kb0ؓ��t�1i�D�FDdb2^�=�Y�� �����8�>l�/�y!-,�sH�����7��q<�w8jLr��q�GA���O%d}�"���%-�������u{-�wӦ��|+���91�4��D��x��4#8�K���Na�����S�ҡ7�ߕx�,w8iԞH�`��B���8�~bw�;�h��N!�����q�������g�\O�%J������,f��[|뛇9-�.Dz���V�Et���U>��������k�.���|���r���8nդ�ϦI'~Yv�1P��1�� +1�W"��k�=�梞F��_.7-���9>z)�&-�;/���-��4Y�ObwO[G�9D!����oJb��KvM|J���$��];k���Ldqȥ�U���x�;���r���C�:C���5n\T�b��D_���BH��1��{�M`U����ѣ�܈����J�LZ-e��D���y*%s,���(�d��n�)ԗ��?�����uR{���7��8<X��z��3ݟ�F���� +r����3��,��r�� [��#���v�o���/$�閜Ty�V�����K��sx�z?�+�x���颹x�7t��u��p~Y9nS�mu����-��JWSX+��/��������G,�����Uxn$��F��������X26V�G�|�<��\�!�c� ���rǻտ���9��~�/�e��������%M����89!�7�Y>H*�ۜ�y���c�s:[ �N�NK]:���oQKp\�Z�#uyDdrJދ�6��F �BZ�H���W�:��ַ����OaQ������!+�A+q���s��������_B��dz�J,�|G8�N�fp��R�Ծ�{XyT~��*k���������"���]�Q��5$l�q��R\�]�~�_�����X��%Ó�y%U'ճ�����2ot�*�x�蟨��.��d%�=�r���j���7�ˢ��T��\�T�-EǨ�s:l�C��p��濃��6��f��O���_B \�����kqJ~b�N�ڸ�/r��ꄝȇN��)7U��Ð�В�P�1bͺ����ķK�JR����*���_��B�eHm�v>�^�������4G�u��{^&��,�����8��j?����U�/�>Fy�N�J�Q'�E��.�K�b��7�J��DR(��*�u�s\WՑA�+dto�9�8��$>����Bk��sR�g7$�~�O����p�s����{�.J+��؍.�P�O��|5c[m�nw�xD�˙�b挫̶�\."Q��,�'�]��/C�7�|�w�Fߗ��վ�p�\E�T\'�k �>�,���\ZݴT��W/�!��vڶ�䦔q�G�)[i���;��e���nd�g�I+�O�)�<D���o��7K}�Y��rr�ŜNm�Yl��|M�B��p�{��a�t�A���˾���ǖ���0\|W˂�gAVQ�C�2(���&���X��xӞ^VJJ�c��g��7ĺ�C�V�'��p����.V�� +\J�Ɨ�Q�Z2���=��|9rF<ί���19˚n�N�J*�7���(��{M[;}��k���+��vV��Y��ߡ!�����mލ��"�FV��ɍc�;:������{�5�'���Kq��r,��d\9_~� +q��WbJ ��BM��$���:�$�{dq~�?sa�e�>%�������U|D��Y���}����ic� ɵκsv����Mf�?�����ĸ<(�2����̭�v�������]W���q ��Z�[?����'��|)\�n��9[�7�3������k�N��/��J\�V������Ϡ��Z&��/�Q��l|5��u�9%] �<�>����͜�˯S�_'��\n���IC;��r�Ftz��fJe;<�v��'���W�!��Y/^X.����r���G��C�Ċ�^g�aF��,�u܊�{;xYtpw�8�o���������_��l�qg����_M�y}t�;Y�z�P�+���c]'��W�}|ң�o�q����EZ�u���8��~+)�������{-�6�p�˸��D<�˩�Z��;��H�Ⱦh��)�Ϭ^�n���� R���]z ��_C����� �^�� �����Yǩ8����������=���|.nN�ֺ#�ȕw}Y<MF�^��)��-.u�ȓ��1���%�w!$yľ��(�t��~��_�$#�bu��������J���QN��L{�}r-�)�r����� �3l�VK�$��ώ�+X�Ԙ����"L�nK����� +ҾD�-�J�t�ͩ8�B�q���%~���� �C��K'm_QJ)��N� R�j=}[� +��۟�K�(-�:C��6���S����AQ��1���=���z��� �����)�1�+�Ӵ*���T�©�w�(�����ᶈ�N���������8ȟ%��y��ms�[#��U"JJ�' �f]H�8 �3����e]��$�~�Y?�K�T�˹9�%�E�RS�ǖ]/�Nn���w���~�㷩9C٨��o��v��T/e�^� +\Z�\�9���aÔx���wrⴔV�����ի����*%��G|#�g��%%Kn�r�~Ȍ^r�rUC��a(X۾�6X��ʼ�����{1�"sdR9V�#Ɲϧ^�ϳg���P�l%�o�/H��'P�wd��lVYD��"���E�B�6���I@�ZS9��h����h���)�\�BJ�O�\�o�]�Ƽ�Z��n��rF� +�����F�����K �r��|5n�V{��*��pF.�� ���q`�&�Ҹ��,����8���yk+ehr��Y�)goݜ^%)�Q��ڎn:�_L+�������^�/���Û��vW���q��E����W��~��I%�c�F��)Y̯��k�����M��M�V�"m�O�!�0r�ꈵo�9<��x�S�M�$�F��%7�Ti ,��M�q6bkH�r�֜�MR(�-�D$!h�Q��kƞ�i9,�Ɂ!�Edo��Q�2Qnֶ����Ք��{�"r�Gn�u�X� +KZC"�\�Q^_���'�}�Õ�����B0����ğb��P�h�q����p����R<6������ +MG����u8����.���^#��8h��3�-�ؔ�n�嗣'�?2��1~g�[��6qS�㮱�j�' +�FR\�n*��6�9U��yr(���H��5��G��"流ly�}G}<8d����D������]qv��1+N׃=\�B�dR҈�Q�W�����^!!P��d�BV>�N]�\�A��,lG�D�3�9x�K)���^5T`�������- nE��]�����Džrݐ��V'�E�+[�p%��P���x�Ŏ,����qa�̯{o�ć,b����~''�|�#<�M�/�2�����Ҩ��U"t�EI��w���^*��s�|��o���%�W��bp���*�+o���]�de��{����J،xu%��壛w�!.,5��ş��]O6~%��1i%b�m��R�Id�34q�<&"U]ϝ��+�O����7��L�NN*r�U� �fEiZ`i��a�oE��^����ZS+��려���C(p|��SV���$�$X�l�̉��zYfED[W��E��ZY.$�bN*�L�7.�i�����T}���Ze�[T��Z�L��i.���;�i,E��r�:�ȣ\�}D�0S���K��MR\��o�ņ#�O�?�Ir����-l������O�!Ĝ\_O5�W��G���uo���'���r]Jᜓ�g��p���8+���*B��U��*�iV䪭���ˡ�ďl��My�ؔ���]WS�+�R+V�I9���+bSw��'�xc�D��2� E�1<��x���|֎�h��R��C{��/L ��l>���ҋ$M^ +1? +������!�ވ�vG�6�C�a�qg+2.Z3�ѡ���͉���<h�m����'��ߗo)����JY���|_����9;^�6�W�z*�"{��S�����o�.���8|Lm>��j��udH�%M��o������cC�p�������ٜm� +k�ǝLJþ���?�%O�B;�����J�!�2���F����� +��}����S���,S�D��+��cryM��f2��"��&���/�� +/��k�����B��M����vG���BX'���l� �Q�Ζ-�!�hmܔX��$G����tlkN_+���c´ǸT8�g��B�r=Jd�� +��>�h�;nw�H����'���֫Zܿqq�/N�8�/,�������7�8�Gm�:"hh�G3��In�9|�t({� :gM��DS�q�4q�C����*K���ry��H��נ���:� +^��VIű���efk"[n�וܺ��]=/gcx��1E��F?=�M]��/?s�:��5�{7飊��s�m��}�̑��//��hz�$2��.EB9J9����BѬ�q��#5�,�q�N>�с���1/�_6?�G�F�m�Ǧ�J�M�_]�b�$� +�ė�!����}|Y�G�W��o��b߸�ectc���8�/iY��Qn�X%�K�<r�t�Q��b��0Y�n� ���s�yYb��J�Y��擅e�͟�N#�q[~ĕ�����¡_�7�"����y(��)��R�RV+؞�ؙ��#����ӗK�k�Z`����d��%���ew1��<�bDzk��Gmo �1j�6��gG���l��J��%˵�kb��=�x-x�m�s����d���9r�BqṲ�s��~O$�N$x|�'B��Q������ǭ$�Y<�"�ˮ�ҶϠ�=l�i��T�$�J9f��%hko��G�+ҵ�4��1�V���WFK�*�y������^�H�ώ���.'��L�d�(|��Ψl��1�W_�?+V2����Z�Q�(E�ҎgKo�^�<�Ö��ZG����9/,m��=���3���O�����\�U��,Mr��ʼ��?2)|�+O��G�gG�TS.LΙ,�?����WܟU��C������ó�|G̑#ϕ�����E7̰>����9��C��g�.^.?�.��]=Ɔ���[�=���L�� ���y/��K��A7�s���#҉�~�����,�[���on�c�^��W����)y�������LTdB��=�C��B� +V�c�z�x�D/t����D�ꖹ���b��+�R���(��5/�72G����SX����m��\�/&tɟ��N��-�7�N$�QƎ��d�+�-^�F9d8�R_��\ip���҉p9\��v=���F����)��0I^d�� +��S���7}N +�\�����"�qY�z{n���?2����UĎ��q���#���qo��q�l�N7,���:lp�.d%��m�R���V$��`U�1��jh��أ����� c�K�e�c9�U��\���$��$����dp\�3���_,2�J^m; o�K�Zg�*>�D�AZ-_����xQt����3��Q�΅��$�x������ +�)n8��:���I.�g���=j? �f�?�EyyU/C��_�c��~g��^]�G����#��m(��m'U}F�y]Q�<����Q�P�q)S���aJP캕����� d��ۦ��#τ�:�9ũ�2���8��ڟ���I�k��o(�r�����g��'/]�Կ��{"����z�-�ɑJT��+�)�m簳�2* +�!���ج�i*�!Ď +<�Ig�����~uo��J1�[�FԬ܇�t�����N�g|�Zq�ْ����"��m4yt���BcE�hB[$-s�Ε�^�OT/sFGb�"bb�-��B�F���R�9tf�=>�Z�J�n�41ĩ/�8/{Gr����7&/��u�:����T��f}���-x�y�G�'��]�>\���s��K�F培[���N��D狥�O��6��Z�|���m�S|�7�s��k�?�f#���K���2�ܝ�6IJ�7d�Ǜ�n%ME�ץ ���&A��_~�*�����S4����<%�.V��|��uF3�/TEd�U��W�N���BKX��� ��u�x{��s���.�❽�O�'7�����.<��(��3r.l�������IP��P�_�f2S$QE�^�5zY~�8�~�KW��>��!3زhf5B]=�QMEG!b��a"��K���N^���:vwm�k��5�/��י��^�K�{�N\��k�f���*��,�u�Q��sW���j�v#��{�����?�'|��r�C��o�9�J?�?�%O\��[�.�?S���z3���K=sЗ�%�tRi-���G� F�ooBP���qyd��bOg_��t���8�X�̚��vEylᶡo�O�Ț����Vp�����ي(|5�%w��Cw�"�̶<�_�g'H�8k��>M�4Л��X�s��ߩ�p7 +�/VĕV s���N2���Z����Ri ;[!�95��lJL+��w���b����Z%Ĝe���%�����YE�Ɨ���Qr�_�"h��Jz�� +�lkJ-^ +b�ڈ�,zsiY1���:��;q2�s��9n?��Iz�m_a��R�����]+���|F��f��C��=��[�<�>���P��*�����§�������j���������L=��W�n+�"�~�r/bXka�ҧ��}/�\D�2P��R�%�7BQ��1ں��\�����,ٕb��8��I��z��fJ�l{�M�?C�I%I�:����7�Ȭ�E�ͱ�,� +�l'��&yR�Kw܋���i�m�^��T�K��DVo"�W����.^{BR�N��M��%���YZ�����'�Jzc%�Tė��^�uEn'�(G3��I�3-2*9K^r�c\ �GGEn-,�^l���ɜ��m�>����>�[e��`�=�.n蕿ݖ���f�"��\6�/���D���zz�;�C��e|��G{�Q�:��W'*_�u9�k�F\E���9�SX�Z&���[��b��qTw�Cu�TGe����JU�x[�G���k$�k��'C��N� � +i������E�Џ�y$������qsy���6��md�*�38��~�y�c���x<��chX؞Nl�%�O� +��V隷�[�\)t�<3VG��8���uk,d�'�Pph��b������l���(�G�Ze�zcK �Z-Z�OZ�Χ�&$Qz!-R,u�(��I䆘�DD!��=��vdU���1Ck?s'�B���om����<�w<�Ƕ��'Y�*�K0���̱-Ϋfs�AG�t�y���"������W̕z�����*���n�':j+���\��?+!.m������ f3���� +�Lz���r�S�ԇ3����F8���k���De�i��V��)z����r���4�t,�=��Vrʜo��P�D�%DSx9�U1IR�lu���dV4m6�u-����Q�N�G�Cʅ�Nťx�r��O��Mf��Y�bxط��'��y��5�q/q1"��~��OFKK^���>���5��Ei�������^�G�{��6r���TQ��ي*7e�Q�=~�C��+"�O�u��k�?�q�r�Bo�i�����c��`� �w�ݱ캍ZigqB<�?S�Ѩ�ӻ9���*�9�L����m=��a��b��]i<��t=w*Y��v]�]#��]z�����rqإ��M��Rؕo�O,�)�_/����H�'ӹ�r'�����������V�F5'��v��o��Mil�t��r�W^�j�h�VF+̮�~T4�<��8�KjFh��>�0;�e���0X�WB��+Vg�X�� +�*�qEh��}���Q�qCoD!t�L�(mZ��6ܕm�o�\����'+j������ӵЏ c�}�ZqT���r�E1�ߩ̝�{�Wܒ���Kj�п�,_���l��|�H�Tvc�e�W]X����������lI���a�FQ�D�6"���]�,�o^py�m3����:P�틩5����[���^Hɨ�~���u�ˇԽ�蚣����̺��;�{�2�����Č��~�RT��UX���:1����O�<��ط�+%��ê���t+�+���J��s���������j�x��ϸ�(�Y��V""�u�N]/�E�3��3��̓mYx_���a��=+��JY���������R�~��냆�[�����[��fDޔ1|徽�<�u��p�9��b�Є�.[�ýua��d�*%MuD�S�onǚ�+m��.m�'��vt�H�g$iN�E 6���P��E��m.�T1�.-���&�G��I��s����7]����)K��W�}�� +���v���%��kR�6Gt�q� �*���xlgqj�u�j�>�n�FJgo�ь��L]Dg�6V��k����ţܵb;i�Am��G(�C��%��s�o];�O��߂ƽ��J�Z7�����1ղ4��3}����_�2I��M$�K4A'{��y�qsgo�[7�F..�V�ofp�*�����Q���\ޢ����r�ݑ����J�S�K��nH��?))���Ĉ�����~��^R�flU�`�E���(m�9[��s=��z/ͿB[2Oʖ�E���M�>����� +[���m���- +�=��i~5��L�e���?�+�S,�sZ$�b��xQt�}E��ء�d_^�Y]��Ɗ�n-�j��[��I%�vf���ǼXqì��ܡ7L\�m�w����������_�1On��TW�1���|�6�[�9�xX]X�t��d��v���Ĭ�f���r���ߘp���g+��"o������&8��De�|ރj��W�H���VK���³�k�C[~�u�*v!�E���q��Ӹ�6����!'�ƾ�k�����7y}'�%ס�h�І�393{�*�乬mS /]]�X�G�^�^�]��2����ū��tk"��#�^���B� ��K��]��l�N����}L +��^��d�����]?�Bk��9Rϛ�8|��~b�Mcԕ�>��R�ԔwǠ�[9[J^R���xR�D�e�nģX�S�����t#."�VĶ��s�>��m�]Yk��^�{d�+[�~�O�ұ���&��_1uV��Ķ}��G�ס������1�����]F��|�V[C����.~Ya� I�]6ӛw�%��6��7���5t/�F���}�[���Q�k�E���5��_�&5c�7�н�+DV���Lh���v�2�X��K_.�}/�W�K���u�[O��q8|��!Ń����������ש�(��r�u��t$������u��6��zϧ�|Kw��2�'��� +\��ǿR.X�������mX���2��q]<.�'+��G���c�ݺ���iZ%�܌�{>�R��K����*Ov���%\̓�h���h��/Дv�!(�{�h��L��,l��>�?R�*]_Bka�|v%�u��r%k:5,`���⨼�:�H��aYD�(��7L��>�|lks������zQ~7�uU�k�ش~���kE�(�(�u/L1��4w�ЯS������M� <3�k���.$[xO��S��|�;N�t�G��?���y��UT����̢��X�/��7����q���RT�6�%%�"�U}uQ[+N�r�� +T��U38ط�'�#��pj�T]`Ol3��b*T�Z�^�bԟ��II�݅��ſB/�D�-�����Ą��4��sD�����Nx�r�t21���`X�$�U����������Fi�͊��Nm��-����}5t �����>�:d��Z��������c��,]�dS�L��2�= +6D�5~��Z_���(U��=1�~㾗��B��b�X:��N�Du�dQn_O���}([~�n�L�%���-�9%�+WuЍ;�1��X��%*�FL�/E�^�w��i��/u�K �%t���G�_�>$\k�-݉ew.�e�i���c����#��������I������Dq�}E�#��'�Y��EJ�݊�*/����y��壕z��xg��Bl�Z}��-�?K��qeh�w��(���I�%Լ �{r]7]��R��b�i��9��Լ�c�D�9_�rR�Rw��ؕg'T?x�Ŀ��Qt���X(w�?3��M�Ć�呴�����g.o=�>���6�{x���[/����\h�u�g�����h���e��3��b/�؇��`��Yŗ�h��#����SR���ڏ�����?-�{ +�<�Y�Y*8w��ӿO��a� �̭V���rJ��A�w��#���A�yU�J�v�ʼ|��z^�.��QEاCeE �7�[��F�Ql]vm�A�=����ƞL���v[=4oD��,�e��`�U���2r�K/Vޘ���ִOǟq�/�6? +�^�W�Z���Ц=�������\���4g�� dJW�N9��h��[�:��wd; �����t�R8�~����O�.��Y��1Z`�(Ɨ��-���,�O�g��K�6�Q�d��y��iY-_Ե�<>h�����K&s�!'�O��}�1�Kg�$��2Jq��-��8��7�L�$��o�#ʘ�����Cו�7�Cj��qu$`ia�Z�ޔgaDs�����������\5+��eU�5�D���f���C[~�-S��.ė��;���:�^F;�+K;�����x)贿sz4/��~4#���,iid���[�&�,M$�$��sy��(�f������ȧG*��������ȵ�YJ�����"����:�����yl������~f?��G�����Iv�J��DG�I|�W���<�f��or� �����7�8���B�QS�%�zd��=�Uem�oQ�\j���n���U��U��8����mw���T�8pT�U���j�}��|K���*�]*Q�Y:\ؿ�]-��s3� +�e���ȫ:y/����]��� m�����(�7��Y� �� ?.�#���+O(�d�sz^��h����cּ9"!/��z3t�P�o�b�TD��k�ȵ�H���/�6FJ�3�9nJK���N+��v����Ydn���B +8������ +��s�����ʗ��aK���Ǻ�T��O�ι�����[����Oе���:���,�<��m��̕���7�]��]�E�fB���^�RL���'o�l�[��8���M%Ќ��Rk�"ў��IP������~.�1 ��t��*�]������������v�X�S�'��+�J�_����[dN�sg��^�4YCحQcZP��uK�Ί�(^+z��W�:-,~%�V������^���+W�a��v9v��]�aV7'�����9;��G/Î��35��O���1�\�yO{"�U����\_*��n�2F���\��_�N���y}������k}�]t�T�z�yRD�!{���;�{���|���Θ�Q��ig�<s1��+(�t��ԟM�F��$G���6!����QK��#.-l��O�?��Rn꿡��,�Qt�]<E���LV=���K�X}=H�q$[!n��J��ȅ��N^��I�8�v����'�,�d�풥U��{P����m�-R^���E���\�9���)���j��Z��> +�_��/�R�4.���W�a��_�_LB�R{�#�qr�ywS���R竮���cS��N\N~-7���̾���ކ����~�U��<�$g,�N�{�q���X�,to���_�Im�Ē��Rѳt��)"��(����=�8>Ya��?�L�/UV�Yo �j�'����)�3h�_�Až���K���S�~��d��\��2�Z]��ʙ�����?��{��/�U�g����22j�1�`���9�>�pTR�d�t�Z����|�g�~n���}�t�$��k�I�Ԝ�4^�2��,�`��K�+�%�Dž�^��^�}/�C�����`c-є�E<�����v3����:of5ي�8��q\�s�������n�nڣ��������lƖ:�sbN��B���ks�x;~�C�ۦ��W�n��~����Waƹ��J��+J�z�|��V����' �1C���Q/��b9�-�}f��}]27�Jk��د�(�D_�k�Ò�>�k�5������i�h������Ăp�y�J������uYu�p�~���ܬ8�};�W�r��9�#Xx�]swZuS�U��w$���(�nJE36ZQ��w��t;��֏�!k^%���w�����.��9NÖG�+��u"��L_$gl2���7?)kԊ��.[k'��Y?��9�2NWy�e�s>����#���I�Y�[��c�>�I,^z��7�}�~�q��9E=��]H��n�v%)\���� l�y��r�'JO�$�r�3}�v5+e���F3��r��o�#�}N�a�ŏS���w��r�*�8b�k��o�5��x߱��}�*��U��~�R��0����Yy8]pF�KM��Kvf����a�p����f�؋j�T���;��Z06�Zb��1���oF`�/�������-Uj��!��w��gͰ��Fc|�C�d�^�o; �cЧ�O����E�/�K�����]H9yUקA���'��'��Q���&0��c�uU�ת���:�r���I/Rݲ��3�B9�0��C�������6��U�C��Bך=��'�z /7��ċ�8�O-���K=���~V>��A����DZ)᥎�Y�+�RD�m���Ť�3��������v?r +M��lF6ܳ��o��U���`����)���u��W�z����y�[��n�p��Q�aSd�i.��y�0`�b[i�}��ΖcJ�U�%����\�ih��8=oF=�]:�o�`{��Eݿ����zw.��#Ўߘ|ݓ��F��1�$��i%WEE�Go��)R�f~_��"�L���N����V�?���)�z�"ъZ}�enV�]�0u����b ;�'�Fl����Jv�wӱ�g�Rytd��nTl�Q��*z\|�Ie��^Y���n&����$�z#�|��G[��"�L��Yz�^�r�]MΥ�_S?��������%�{���G\�Q��c��Q$���F�-���xb��B�4^�F+�ё%�O%�k^�����gƴ�/���`mYoJ��}�w,��(���ZE�)���#�����_2?QR�~�v{�����S�S�ߩ��ƽo{��_2�o��qǗ��9bR�c�i�-�r7�M�_/���i���M��v��$�F��z���#rQ�O��^�k�[�Co����R\Ko�S���N?Q/���6R�V���4�S&h����7��v�e��c�������=�Y�q�d%�1��tƶ3���J���&Ʋ�d�i�̄�_��;�]��С�Đ��͙�t}�ܲOn���>NQiͥ/S9L��^�/��U�`�26-�U�t��P������Z#�zߨ��d��]��#"���s���WȎ�J��#��S��e���o�~���.���\�Z���zG�ӱ���~���_���lY��R QLvP�3���S�j�{_�{a�G�1�c���Tq�?؏]�s}��(��s�����=�[|��T�t2�f+�^;�v>��+�#,���;��3}z�*�� n>[�<_Ս<;%���BS��X�}���Υ����I��6��Z�Z'��NBr� �ؾ��������.�p�d"�)�c�t�2��ZN�m��av�������^Î�����nzj�Y^*E��h�2`��1���^�����*U�e�,r(H�)��O-�p����.�#�'U��bn���-�З\�W�{���#����)����)K�]N�z�c�a/���Vȼ�'Zs$/���_�?g�������W�p�s��.�Z#���gסo*|ѷъ��eb�K�Ӣ+;�:����ߨ�m�-������Y����}P����8Ò���<�� ;uj;���^��8���.nid����%yf~B�#��}�J�����r�S��~DS�̱zF��B��ig,�u�I*��Wt'&��'�͝� ,�_��dUO���]��h�m�l\�E�v'��Kэ-e���&5��E�e��c,�[gTt��-Â����0Q�h��:�+���.o�JN���_��\'p���^^�7��c�p����z��Q�n*=�Z��1�����WȥU�szP�쾃�`������h����i����)Yq��b�_��5�UkDy6����glGbp�Y���h��N/�V�}H=���ͮ����E�ԣܸru$�)�[t(�[>ZY����K|�.���:�-Wn�.ۓ�,�[W����D�ԝV�i��1Y�O��]pR��Kؔb���������T��e�ҹ��E��Us��8j-ݴ+�NWӫg#�slP���^n�Ju�rȵ��,��-�q�CV�[эH}{��:�?����eiz;��/���^z�(�Qb[�Ud]�,X�V��$8ԓ��ɯ�ۡf�XH�Qw�>����v��z��܉�f��N��p���Dm���ZǮ��#� q1�4.F��d{��"�cz'!7�,~��~ӕ�w'9T���yM^E��3ʍdR~��Ԓ�"�RO��nД���;Km����\�ETu�D�hۻt�4�n���=t�_�9�Ŏ4�[\Ŗȸ�]�ә(��l#��m����KS"G^A���o�V���\�Տr�j�e��7��`�2<��1�ᒒ'�1�5�+q=���ț9Jҋ9�8�,~%�������#�#���G���/)���_�c� ��v�B0�sK�.JMsz58u�=�w�������/�Au1��7���y$�w���Q���3{�;V��x�u�E���V�N��l��:��%O�T�s��ڨ����NK +q�y�/G�Gv�]��\��5N�%ײ.]/�{u-U_e�Yr��/RJ�D�ieB���E͌.��h�[;r���j�ve�N�c+Y�aݝ +~aE�vF� +� �}6%�-U�Y(����Y�'�g�+�N�=w9<��se��4V�>c�k$�}} +�ŕ�l�1�Z)����� +d:��:��! ��ⱍh��~-ދ�/k�/F=�$F0I����̯�t����W��G�&�����DA�%��#����'�v�������l���}�U��y��2G�/�ԡ�, +��t����y�vTJ?�^,y~����c�&��M�_�i��W۵�Kt�V��H� �jƳX{�3��:���(�]^�G�/��B[�ي����Z�,�'uG4Z�3�ܯ.�\9���}J�w��>�3���סp�_�9�-d}61E�N��>ì�G��w�[�ѭ�V.T;���ř���;��M틦��rݜ�e�N���WX)m�9=��<���捜��Y[ G��ƷG6��kG��_��K)�F|`h�����3�^���G�ycߩT����KG��Nc���(��G�'�e��VE�{ �R�Xc{��Ƀ��W����E�+���f��wvʋ�-��i|)����dq{_�k�N3�M���%��N��p���C��;�C�Ǧ�NO2��{���ܾ�$�Y_�Kgl�[����<�, �g�?s��[����)l*n�.�x��];Q�'�X�{��c�c�ɛ� ll�������w-w�ⓣ�,Eg���_69�N)���J)��I�� F��䜔V[�7�(��o�˒\�U���y od-�"��'��*�p�����Go28�RM���U8�H��[�~�b�u�Ǐg�v��c��j���8�t�(Ɛ��C�(l�V�#'o���;vv����1�'�����/*j w?���w?�8��ߩ +�K'���p�?�]vD{>���{B�h��ru�Ӫ� +;u�·�^�9��5�v0�r8�<��%�?�ĞH���<�>cn�Ҍ��>㗙�~���{-*�|X-����Y�҉G+nM�-�;rIYV�+���{I*T��Ǔ��?��������Q|�?�w���k�ëR��Ȣ�Nj���?'o�����y��.�����g��&��dڦ�IBori�y�Zߊ�0/¶W�#��ţ����^ q3�#��-�=���Tm<�צǭ��e�Gbs��-�|*�-��R�F9������u^��I�#8�Ra5��H��>k�d����`_�+�/r��t$�Y���%��ON���Yٽ���}Kx�N����05��ɏ�e�����Q4�d�$��a��܉|5$�ݽ +��씷m��Ȍ��;���)2.�k2{v�A�p1w.�s��D�����y�yd���}/5W��e��D��c���&��$r�J;������{� ����-l�=+^aW���*:�>���i��� +|O/äy}Qm�{"ri����.WK����Â��a�Ї�E��̃����qV�>�x��*��F�=���X�B�6EK�=-��a+���r����u�}tmՔ�W�Cd�G����ҿ���п,r�����6�ڋ�!������n�����hj�����K�Ҥ�^���z��w9�X"�o�éM�%���gMq8 &�+����ǣ������Tq�:?��I���/���rs�����l}H�����a��i�C"�ȣ��\(�Vqx����%�L��W��G �$Ea��o�[ilI +�o^UTsn���/��Mt8n�����W̨�~b\l,Doc�m�|�ʣ�WЇm���ԣ�|���,�������a��.zy�u���ã�� ����ğ\���B�w�����\����Ԯ�=oa�-K����vE�����t�m��}Jy_"Y.G�����9���Я-�.�97��|R��$���Д�<�/�������Y���\�q�'�u�<\%�����;���93�%7H��+۹�K9g +��X8sv�1T����f3��o> ¥��+���⺎��K��zg�=�������qN�#�Mv<��"�T>~DW�$�3�N=sWө7.J����\>W�R+{#���9K��DZ��дS���8IŢ��"6�^I=�=o�Z/�g��x��3�[�n�E���2k�r�k��/+�K�i�m�z�&{��̌��Ԃ�bK{�� f�%d������/�r����s�V:�3����6���?q_/DF�������ܿ�#�}b��I�E'�8* �r{����G��r{�%ē�ݍio���X����ex/��D���(]�Q���譊�C{�᜶V5��Bo���%(���-�q�E ��,�������.��N�Z[1z-/kͺ{)��Hŗ#��hz��Ȓ���3�o��'��7�s�/��� Eyd�ԙĎ{�ƶC����9��܌����5���1�*����9E),�ʺ�#|���`O�]cg�4���Q�^{�s��q�2���w���a�̰J[ }K��q����:������n&-.;�>/��1��\�������J�k�Q~��_��;}�]�N/��=��|l~%�������˼�]1]D��Ս������_�uf��6X��Ǯ�m�^��P�į�m�~R���_ug��ex/�gF�43��Dg;��qf�V~g +�⻦ȑk�d���$�q������&��y]7+/�BN^�ğ������Ս�+�.�8�/��6��q����4�g��I6�8�=����8�i�\?�N٪�9�IR_�:ӱ���mಝ�-_��n����Ȗ���G��GbQ����+3�9Q(a�5�q檱v"��"�'�d��A���nĮ����uBB�(~�ҋ��|��s;��9q�hz=���v�����z���wt�[����1���>�{�9���1��F����u�'��{jը����F������_�����{AUU�N��Jk�q7{�s�ӹ(>Z�qr���k�_oq����}�߄lcl�C�[��g�U�H��Nn����-��%Ԅ�y��V?s�g2NaE%�G7����gc6:�K3���/}�#:!h֜�T6YG����"[p��J��c��.??�g\��K�Q�����_����~eTtN�IR��9�]Y|߱��+mr�%-�r�3�r�/Ug��n�JEnEΪ�g�s|Ű��Dxn�>.�8B-������Zҵ�4n>jeh��^�|7R�n3m2̝ȉ&�K �Z!x�䨜++03��e�W�^��܄�ՙҘ�L +��\/����<��d��^�y�+x��u�^��\�ɿBU_������y�Բ�%�/��_�m`|�D�D���[i^k���"�#�w8���~&^u���Hgl����K^ir'�_ԗTEp�n�u_���d�։#%���G����$���ω*�!�/;]N�"'p�E�#��\��ǼϨ��}�D�*C���ܩr��q<2rIu#��b�x}�0�أ��¸�nF�?��fP�u��7R�,~�.��m�͕!W�K�"�b.n�D[��7��侄����Lэ����ع9��؏-�`�����#bj����xJ�����8�7���sw(��~�2297װ�s���V%nq��'̢�}H�JY��9�k�K���y'�D�������7����kɁG�_S��˟��L�,J��ic�.�ltW�'҆��pw�G �i�u�\H5S�����M9}�r������K7�[;���(�"���s�.�����C�����V��C�tWƾ����}� +���o��Z��,nF8O�v�F;��ܗa�v:�͒��t�M|�����iR�w�Z�r��y5�ҺǏ6� +�BK������aޒ����Q*ZY<���v���;���m���7�C[����+q^6�e�(���3���I��"�\<�^t����M5dxp�^N�ƾ_�ө)B����H�V�*�kn�e��nO���K~�x{c���p���-TU��?����bۈ��[õ�<�I�����c�(ϼ华r�;�fK��v5"�ȼ������~�^�6ۍl�^qJ?Q�f[�{�F�b�����|������t��r�=*Zy�����S�G���ſ|��&r���33U��/���|w�����R�G/�������ʖēhm��6J}zl�|�X�J0����>D�%�s����3Kr[$9Ǘd����v�fp��X��q�����Z؍�RW'DS�oR]`q���=�;Ͽ�j����si�,_�K'�mZ�|��/+�px���uׇ_���?��ù×��#-��:�^ߤ���R�1q<�,�Q�"�B4��p�/'��ND���JM��� �)#���:U���57o�*<�+�ý�I$�G��Q�d�/ܧZw%qBNԲs�2�8���u��ͯ{��/Oi<�+J����<�����V�R�،֖�QXY'=ƞD�r�����vĦ��G/ɜO/[؏݈���[�cm��E��<E.$\��9��e�]N%�H�`�����q_ÄqS�l7�Br�\t�+!?�(l����ˍ�>�-��������>^Z��=���_�8��X��N/u��c��s�����<#\�� �+���b���K���"#Ɠ����85Ȩ��G��m����������+�סĜ%8�,7�.t��W��� ϼn4��e��КM��Nˊ}K~����KU�����<����9�]LS�����ݼ-el8�j�nhai#�?���xW+��p����h�"�Ã��E�K�w�w�<���hߺZ�P�[ {�m���c�G�qx�Ty���su#%LQ�C�'����|3�ʈ��G��"�B�x9�K�9s,1qa�)eG�|9)r�G �g��i'����~,Ĝ~�!Z�E\��S��|������W��?�9��!]����*��O�����z��=��ӧ̟�\IK�Q�������R�ܸn�e����E|u]oc�kײ +����q������n|�U��劷د��zy�T2�璊ݜ,��K�v���m�.��(ƺ��R��(�Q����<9���}�Џ=< +(�T�Ac��*�TJ;�$��N�����B4������d�R��"ؚe�ƈ�X����yNg�xi�Lf|���kL���ܡ'��~��AƯZ�ׇ�MS86{ �^4�L�����؉�F≧V�E���Qq9e�g��Ǹ�Q��w��% NJ�k��%e�?�dT��w�1E��O��r���R�uB�C�9J��*[E-���W�n=����;9�Ȅ�|Y%-�Y��^x�ӫ-�x��������t"����>�AJ/��g��E��O����\�����׃�?�x��rYx�K����} E&��cOD-�)N$�3�E�HKq6��te�Ĩ���b�Y�&�ts;��QVĕ,qr�����k��^T��ğ� d�.R�E�N3�pZf�J(��2"�>��b���^�T�u�rE�S�hHM��[1�Kr)d��h��)]H>��ƾ��!�y��V=�2(��._��QV�n#���#�ؖEB�1I���g�\����'�ĥ�M�Yy��{�=��G��3����jJW��nG�$n/U��G��O��]p��z>x����3�hI�V��g&$J|?�>(�?�����ՓQ�U}�ƚq��.�����1����N�-�d�4Ӻ�n�L�f*3��gõ���W4���*�U�'ڇ[�����o,N'����>v��aJM.������' �ʖ�5���uӯ��$1��!�b��e�K���{7e��k&b�I`ǩ.c��"��{mԓt���n�䜹[��?##���[��E�}H���!�SG6�dyW�:^D�Y܊�*ґ��^�Fƴ\�����5��OYD��dE�l�2r��x�͘�')y��D�F<KJ�7�Α��u&��͒>"Q��^�Di�X#X�L�ŗȟjQt����� 8a���Q�_�Y� �y_��W^�G��Q�{���%Ï���O��Ww� +-��'ǝK C{t+�+�;����[Q��rQı!�L��E�z���=�UU̗��g�6���s�����Q̥)��1�l7�i�����[ �ufL4��v�r-�q�W�З�����J_Ԫ�i=m`���5�C����&(�ͳ�B�\��-X�����ș���<��b��T[��c�WC��/��i��dz�g���,w�8�%m��X��ɛE�{�E�<�Q.��Z7�15�B�F<̅i2��?p��������B�Zg���-��B-���Y�t���6�:g�9�.o�Z^�cB�x08�G�ԇ��yo�B+�h�5��q��F5��|��G +��c�|�sf����qd8s���b;��� +|;��+c�)ǃ(���o�ug�Sx��A�*�q�ߡ\�߯c�7)NU{}G� +2Ov� + N�^fJ����� �_ئ�ow~ +z�bl��?ظ����#Ux���fWB2寅��Q���Lǟ�!����T+��T�\�*<�E������o�ٛ?��9�+� �v�ح�����y��J�j�{ +R�G�ѝ��9����*嗉Gr=,��8�E�$��Đ��kr��c9��Ѳ���S���|f����Qď�О9�X2[�Y~��zd���j�����R�B��� \���J�G�c�Njx�w>��2�ĸj��$����'�}r�c�n�3��W�K�54�����Ie�*�`��q�.��r�j=;z�����#���X�t��i.��$���{��B/�5U؟*R�;��Jɔrȯ+1v$M��#�Å>�.�b^�H�셿R�As?��IE����+���Nޒ���p��d�3��U{�R�J�.T��1��I7�� +�1ߔ��U�whR�S�U/���$�V>�rV�p��=�ص�l�) +ph����F�^�=+T--�V�oJ��"Hc/I�fq�j�s�ߨ��q_��g�~*c/y��)�H�90�d�"�ĸ_��bS����F[��-�8�G��D��_=#�����9檎f�!�o�u��K<ۊ�2�Z#=����])1/,��>��(�k�$�jN�X�����N��/+]��痚�� �����&l�b��v,Q�ܜ�v�����9K����m�_�g�SNm�h��BUOs�2����ņ$���.%�v�%����il���_QGaWȌ�aC,����C���m_F-�0�-�W���.^m�"[`����)�۲ ^�͌m�9d+Tw#��kWq��g}(�V��d�BjĞH(��d&��t���=3�ku�� H�uE�G��+B���ʑElJ��=�S���^�e�1���*8��HQm5�:��o�v�XRW�r����ԓ����dz�vJQ��}�8���%��� +~f���ڷ#/��rn<�"qx~�&5�:�\�6�OW��bv�j%h�W��Ie�%�,1�.��9:D���u����Wy����;���S$�)g�>�WQ�/����&�����ϛ=�z5��2[:�������IG����$��[��%xܞVz���̽����\�ܔW5`om�l3͂t`��Bf4B3�Ζ�B��я\�{{2R��2=�φ���J,��{��$/ub��-1{IY���(��Ky�k%� �H��I���Ǩ����(��E"R{}H���8U�t+|�%������<ϯ�9\x��n�j�]p�q#��Y��Q���t�w��>UF-��\�ISK/��m�LRN�U��f�<�i�U��)���'��u��/b���*��)�7L��t�v9O��J|��M�r:,�J�)WR�R�U�b0m�fޣ�#$�p�D9n�G �6�#u���Q����z�ܥ�s@��/=�i�%��Ҳ�ьz:�Ic�9�h�Qc�1�r2&�Y +3�Η�w��1Q� ��"�,~�\�tJ��8�e�ЏԱl+��κ`H�Ûb�B+��{�u&�В���#Dv��EyLN9�'�D�J�����R��J)2H;���������2������8�_�*�2�%9\���g^W�/��:u�q�9�z���إ�e�l�&�28��?7��'�lvf���O'_���1�Ni6y�-�u���{W���/&�^6"����K3���%]�Ys�J/���Y9E ��g2(L���Q#!,�ZcÑ x�ᔾD�*��Gq�?q�Qbr�m �q7&�m�_��i�r���z63'+�BDc��D�^ �X�[8��Z8�|�ʥװ���Gź�Lf���V�vu�&�S�ʯ�/i}����%~a8c�Η�F2��w<ְ)y��_D{BK��"ݮ߂�)�B{iW{<�ym�d\�t3��ʶ#ȹv*�-�J}L�C�hB�3���+m9Y�NWc�'�'��w������/��$)��jV���!)[w��y���I:R]6�E+�j�]�Fq�3H����jĶ����zYFE�E^-��z;Ȓ��*~��j��aP���ϋ$��b�Ӯ�1���T�� :�C����&��1�B�^�e� +y��D��� �ئ^t��Ԋ}�m*�=��r'�ug���:ȧ;n���r�k1��,��2I���u���5���ߗn�3�)EO�Obp��8�Ḵ��Q�6���֘�\³��|��W��s��l���j�НU����dk� �����G��&�1�~�gY6G�澈�u�N������|�۸�X�)&��BOl��Д��У������A=��O|�;،�N�ܤ'��G�YL��z��;�b/E�kQg4��Z^�*Օ�d����˨���&�uzQ˥�B�9��#C�G�"H�cEa���ł����w�=�Ԉ�FE��Е`i� ��v<�������l�ܶS<��r똌�o�(�[�,�J2rV�'�g��{|]H8�ܹ���7wԭ�ė7�Mca���^�W��õ����:�)�5M����6c�� +�N�bQ�g Ö�ݞj��(��yKu�MBxBZU�ҳe��w[��c���ا}��fG��;����;(������Ծ�I"�s!�`�d��V����/��g�U��x����cɢd�D/ ŕ�z;���^�gD"��L +�v`�d��E���ȥ�;�>�<�%9[��Cl�-�)G/#[�O���r��E=��X�d%�t��&El&F��(���pH�m�9<�TE��$�7D�o��k��!���/�o�92��I�N��oS��ӑ���2�K)l�f��q��p�Y|=zP�t�u�Δ���и����v�(ȵ{����$N,��9ߔiP�������s���\F�����C��i�����Ol������d[��T�� +cӖV$�Jnǥx����zQ�2�>��"C2`T'�b�u#�B�Z!�'�ೕ�d��E�eHe��LBC%Xñ8��"ƥb��X%!�$K��Y�9lih�&mV*�Bh�=$�kb���>S�(�[.�)yz�a�o'����#�B\e���`�*������G�4�R��&�q�t�ZgJ�yh��(Jы�.[)��k`J~c��1s`�]������(��cɥ��`�!�;�*��V���d���o2&-����_aE���i9�{ ��K$oK��iex:h�9xW�1 ���hcd��?q~$P���oVǥ�yY�3��D�� +Ÿ�ó�E����l]Jb;��Jx��J�6��}D������ܚ��ιP�w*#����=v%���q<��1|���g��hW�Ћ��O�{l����[�M��Y�ĺ��g�ģ��w�߁f~_�\�TU�O�g���R'/�(� a��3#���ʇ�����O%<��e�X��h��[�3�:m���v�]ё��l��E�rﰋ��"��amY���Bֽ㋦&��kK�!Zy�Mx���`��FLh�C���E +�����"!�w���e�`h��Rrlɓ�TV��)�"�q+u���D�NJH��wH�[R�F�u}�N��ˣoױ>~Z��}+�O�鰣{��c"\�K6K +��f���%-��{�9Kz4����}�DTq�d*ދ�b�؋Ŝ� +����m����M�Y�&��(���fL��+�X�kb��ę�K���^�2Z6�BKv��e*�`�C�\�v�-/��O�����yZ"���Ek��{����I�B*Z`�/ +^-04I �h�&-ZM:D��Ab���+0E����ucR������rT�t*�Ck}ƕU�>E\W�t<��osK��EI�y} =����P�_=fs����Q�����$�`�E[����%��["���>����rOܜ|��'G$in�]������hJ:5%� �VC6.^kK����]�n�h}�.ݙ��ɑ֎DhQ1�Ƙ���������x/[�/Z�>�?=�1�=��}����!2�Y��[��oJ�*&ݭ�ć�/���$&.� +b3�yLm�h�E�)/Q� y�D������4.��E�N�3j��谒�_S�:�W̰��t"���p�+�+��DE��O����R\�:�F�c����l�3��K��r�t}��N�l�G�v�"����%�!����Ҳ���q6��JV���g���JX�.�(��^��*"���)�7o�R�~c�eg}e��cL��V6�ȬG�l�F�5��+��Ǿ���FuUz*/L��+�#��GЛ�-�,�v�V�S:�ș-�H�ȕ��&w�'gFv:�h��&q>g"� �%m���\�2��wb�>�۪"�җ6En+=~_��Һ�.�m�Q��u���B��-�O��ǎ�L���M���b�P�I�eѩn\��Uv+�S'��t_���\�=L_Q���e*1{[�g(���G�V�Hd��H�|��frq%��; +8�װ��d���,U��3%��Ɨ��k���!W�QR$^��~:/T߅�Jb��9�;�"!ƕ���\L�Bh���^� ��k�*F\KE6d�b.����[���'$�����q���ĥ���&��u�Oo��_!/25��3o�$�bv������X��WhIؚ������R����+���i������li������ +0]�fD�y�[�%D�9,O6T��C� +{�����1z4=�F�bH�R��~ +�X�g�V�K�x�=�oq�z^�L�"��z�,h��"���VZ�8�C2YK�b�(�r��Y̎$zr�"��>������QWk/E"S�=�����C;�������ߩL�J�ԧ�(���0;����ﰙ���:���������\��O���K!D�<�YKGB�K�c�����u�ҕ�C���+�X����n^"4ǹЧ�Ŗ��L��S,��U�k���oF3Z'�cQ5����$)L����0dι0w�T��fB"����67c^Y�w"�w��r�Qŭ��r��J��k�c��2S�,��8y_��p������)�S�8ߩ����#?����KԴTm?��\�vGm)��*q�8R�5��g&�J�] +�L��Os=24�l�,�-� +�c;�)_td���cC�pޘ���V��+���c�^����������&J�Y�X%)Q��蘫I)zh�g�́�����v������2NW+l������)y��W��7۩�����w)U[�K�)d�|����z݊����;h�����K}9eo'2n���\4so����Qf����8ܚv_�N�Ց���2;��r���IiN�s��}���(��x�3���΄�]��Ɨ�~ +�lƮ�H�2��1�^,�\�ZYrǁ� +�F4ͱQ�Q�D--���Z#̓�OI>���ZR%�K։�1Y�q]�8�]��x����p�弜:�#���\��UG.~�K�a�QŒS����h�|�����zwd����EG���#Xd +I�w��u�6���4�ؚ��?}j�i�N[�/. �E<�-��2U~������H�c�=�C|<M��I��#쬶R3C���r��r��tv����j��W�$�S�n����y`�k%�[ڙ(�^�&���g��mo�Ƈ���^����83F�A�����ֲ�j-x,L�h��܊� +Ī��{��?/c���\�E;�)5����in�����|� �M���E稣�,l�g����.;2��8-!'�b;-�J�Kqٕɇ�{{���1cLCQW�Ә��1sc�~�^����yzq8?ϡ>"�r��o'���n�I������r�$�`lq�Ɏb,�D�'VYR���Y}��%�Xx�i��dN>��{�%�0-q����߃>zW���xU�E�LkLj�����ธ��9�w�1�;ք7��c�%�{��-�vص�ǹ�e�}�Y#CL�_<e����6J|Nm�a�r����A|)�����]NW���c�)c�ySM?�q�[���2�N���)S��}�x3� ���Mt��`�YܷB��� f��.0O��̄atT�[퉝|2ek����/AV�q:�窳�_���ڧE3��_�/����#�h�(�W������^�,�Z�Ӱ�z�֏\�xE=���'���%'Eo������sq� +0nN�.%V(U�lM�N����{���Zvѷͷ�K�l� �َȼt:l+�u__w~EW����dV%�N����J����7]�^�o��bRXT7�1)e㰥�Z��I�o�'������(Ю��r��".'myU��$�&+<���c�V��s�ex��A�=ln7WlΔ���Ft+��KG�,ǁ��Q/���g��oN��Ҵf-,�}LV�i�2X��g���:P��t$윥��34�*�=�.���r��"ڒ�O�O2�Czt��%���V�K��:�\�Vt���9c\���G�Ҧ��dɎV��1T�f��)��$eii:��c�������jТ�NJ�S��źn�H�<�υ�;mlp�i��.74~MvG��t�ȵ}GU�uC{ᜬ�^�t7,�����Rl\8�x�ZcKVX��~7�ּ +�=��y��=^����+���6�#�Z�i�_(�<�h�bk�^�Yr<��il(�)3�~�lU� ���d{�ݕ��8S����.J>D�]�Eu!��+=I�������iL�*J�?]�J[�#�RO�%�d���]F�&�hM�O=ʋi_�"�J02��ӞO���m���gh|ܱܔ�oD�9�r.�t��د8"�I�!x/H��el`]71�o�Z���s�^����^:��ǦtIlz1�����Q���1Hz䥭~��㏩�*[�+����b�/��"[���} +��Yᗓ̯c1�Y/���������6H��B)U��e���;x,D�7���1�<�u��̩�I�� �K=�Y]ח��q�(]|?�ȼ��� �|���#����l�ź&e��&�osꏰԳ�b,Ȋ��r���y7z�\�[lW�W��8)��V���:!x3���}ucּ�k[+>/J)�z[Ҏ���rLJ(����76�_�%��lsJ�����οq�ud�$��EnJ��S|������[���M�c�W����剪xe`�G1d�^�P���,}�&��+؇-�s�ؒY�J���h�/��VP�L���I^��NQJ�.^�>jZsE��=�_�/r�X�<�u�K��z�r'BN�^�2����ݯ{c��<9���W���iD���ѢC~�GqU�ih�$�ez��))�EC��������m�_�&G�����F����o��#��v%�c/c�+C��4�xƑ�BO�9Yr�{��>$�V�NIrv�$qx7Ԕ�oLdmW/�n��E��*�5�骣66v`��'�Ȟ#�O��P��1��np伤[����:x,��#5��Q�yFK;���'�+L����=1�z1�e��wH�͆V��,�Ytr�YB��[1�R��0�WE�z�S*�1�1̏.��ob�v�ܴ%�8i�O�%ϷD8�w��E�סy�\��$��=ti�^�ٜ�K�R���������qP��90�}�^�9��\�!4���q+�2�Le�rJIz�����������t�'lς��VY��%�Jȹ���Lz��I�+�e�[w��#�!���#���Kx���Jg5Q����:f4[{�����ܯ���EY�N�Ֆv;����b(���dhi�z?P�/.âR~"LĩP�;3F0[� /)�rOc9/H�1f<0r[��Y��1����bI?��C�.��|�"_М��_OQB�}�?OC��^���%�]79[U��tʱYft��Y2>�=m� Kys��������jE<��:)Si����ۨ��r��8O���}B���x�Jبz��؎����'���MGrj6�ۑ�/��~�k��y� �}K���ыn�$�F=t�OkL�DF=��1{�xW� h��LKJW�+^�L�Z=t��Hob�!D����(����'���ƞ 7��/�g�%� |����&���Xg��-���ZM���Dxm����6�ض���'�}s�B���ͱQ��m�0dȹ�Q��E�J3�a�+؍��ʾg}��/�s8t�����rt�b�-�H�� �����[�I���v����T\_q���˰�5������̅���<���i))����͵�EoԶR��I�G��b��^ĺ�oV=�J2-)a��2C��+�Lo�w��-���~���q��]H���b�Hr�Cl�p��݈���J�D���֏6h�r�1�$�ߠ����X�q�� ;{�����]�K�R1V�$���ll����I�Զ�a��V�dT���o"x(�"<����E�E�eiL���`���Hwb����N�JH��ӧd�b�G�}�'USܔej��J*�Qsz����� nD��1�5,��?f�{�=�["qj ��i|5���Z��!.-7W��\��F��*���t��QN�7�-��1���~�p[#F}����߃�:g�Ƌ��Z��������9��]K͔�,��zn7����r�j�����Y(��͉|[��G�p��_�'-�G�9O9bT��nM�C��q)��Isg��0��}�4:�o��q������#�G��x�#6B.�l��в+��L�Q����{t#Cr܋�����?Ҝ`d�Q�K�X��p�g����]K����>i��0,�{Ы6kq�sI��m���a۾�5�����;��Z62Η�]�en*9��3�? +� =1�z2�]З��cG�C���^J,�8���wcG6��h��˂��1��+�� ,�sUX�oq�;1D��'�9�Mg�-R1V����#,�Ean8�O�\�_�#O� E8��:�)��vG�V�K�W���zV��$�͜Lz�J��n>"��Q�O�}�2C�r�&sK�\C�\���-^��,rtZpB��J? $�̅-������5�#ö����������Ҫ���� ��+ +�X��o���}��:/wz1ُ��j��fuw��/ +�j�c���F6�s2=w"�UB��:����r��Gc>�eO%�$���aI�U9% +��k#U���4����<ۇ\d�������'�6�� �վ�*i�Y-ǷB�ބ��y��e�����-��s:aKtJIƎWM���H�r�*L��r^I'����P�Lcs�O_���c���e�E*fpV�gwй�ˑ�\�N�Z��t1���qW�ס>U���� �N�R��EW�oG��Z-_����Z�lcB�fDY�F:��D`�kf�~�0-: ��f��H��Ų0��7,�����%�Nfs+Hꇱ�G���|��_�N���#�ac�!Ηs� +um~� ɮ��ᢣ�d��ň�|����#�R����}1�i ��q��W�bD��"Ce�k�>�j��v?��-)�.T�lteM�._Q$���#��W���.2[�.Ց{�Z�{=�)sK�s/���������d���%��pp��n.Z���Ic%��ceh����v�Z?}~�����V�φ��� ��� +z'�j�t46[�0f�(�EC,HM�\��sSȔ�6 J$����w". +����˄5�̽O�EX۴4����O��������G���7��4��&���.7:��~EМS��o/��e������{E�l��Mzk�y�kD-bȞ�<��j��Q_a۷��C%a�$�r���νO��C��+�֍iC�k��C��/��l��*u�Q��|9�=)�^or��k~��3��ߍif5Ft�����E�dT}G��<��i�d����?1x[o'#��X�uGQ���ݢ�H>'+[��ôc՝H�l Jؤr�b���e7�|<-�1+r�;=ɵ��qJL�0��� +��"�G$��BWX]:R����W4^��r㹚B��ȧ�v#o�E�V�G�H�r0T�^$��ߩk��j��yi}�. +����1~��6�t�B��}�1�~�x�BW���qux�Џs��R�/q�! h����kK�tY~�d�Ȗ�z��1��i�0$-��egNh�Rв�X��j�BVYNЧ����c%Z�D��L����{�)=����,�TG٪v��'�,^/t&�[3��m���"��uO��ǛD���}��m���-��ý���B��н}4^��j�S8��n���{dg4��� ۋ��(J��JD��K +9�y���__��^?p�!U�=D""�����V×Q�طZ�� �!�iCE��Xb��v��߃6?v����{��p�M�TV����DDƄ*28��l�ђLmX��L�t;R�X'$8n6쳮�븢��-��}��Q�[�E�d�"Q�7Ԕ�ԉ�\���V�^��VF?Q&�IS[��o���~�$�O~��l\W7A� +��Dzt�+�|g+1�s�LR�G���+�QĿ�#��V�oE���Z����g��Ir�kʹ�7�ԡ�v+��lg3�L�dŜ���u�c�B�zx��,hƏIH�Y�iю/ͱ lE��K�$Q+�2����L]uB҉"Os��P�F���3��"$H�3��4�����K��h�X跧s>�b����!�c %�l&��œj����k�El�C��x������T�/̾F�,�CY�ȕ��⼲|����6�����Pyl�]|K�'���s:颒�NV� +��8�̱�(�啷��~:�%ob3WkN����̐Rm�Ⱦ+�زK)���ȕ�R����_�$? +�Z&Qe��^�4{9�-���ПbK�%��+����֙����=����4Z�[�5C;��2`qb��+Y�J:r��Ռ��9�t;%]�G���9"��6r-�1?Q��+���s��RXV�FvIʩ�an�����?"�s��$�3bڱ��T�����܉/s���OF1�=�i�o�!QŪO+e��w��d��(� sU�����9s5��{Q�[����c�1��?R/�`�e]дD+b��� �����f4����Ɩw2;ҴLH�=,�q�L1����d�K�ї# 5�"�.�h���!��ȫ��O1T]u ��ԊV�),-��xD%/C�/�6�F��N#��]����8�~Vqo88?��s����� w��R1�Ux��q�ҳ��^4-Z�ȹT���>'�>X�-%l��q8o�����_�2/�Oʿ��R���U��)�~��1�c�B�ֵ� �ּXe��E���ζ4?�!QB�V�Ѣ���/�Ūh�h呂$DQ"� +Y�ŏD���8g.Q�zZ-�*1�_%WX9�L�-�%� ;l��B��F�=��]`�D�=��g-1�s���8}�v!؇c��~����|�;1�1x�S�i/}�:�c����07�x3�� 1����\�g)e�v04X��Ц.�[ �v&"�� �$����}I"ڼ�N�8�F��#��v!��z��z�iX�Ɲ�X9]�j�^� +[���k��c��~��;�BB~�P��^�3�����1�Z61�-�!-(L�C2-�����}�D�u$��J����G�)t%'o���Y�]b�v!�Z� +��������%2�nJ�^�B�/_�k��ƙ(���,�����l)-��g���A���+a4%� �R��&��L�F4���Kc�ȖtV!]�)l)+9d.S'�3�"�Fpc$�5����qT��c9�_�B��^�"Ex�R��-(H��ZcH�v>�oF=�ZzW�}toO_q(ʺ3�ϼ�{��� M`���K�9�=(���W����r���u&�$�:��&w���W��B]�c���4l�] �?rݶ#>/�Dd��H������W�KLR�YB[k�"#���cz2��39 ȋ��6I1B�K��:1��~����/�`|������g,hm��$Hc_��� z1��8���'�'"L�+�P�����1�d�&1�kƿ�^�z4[��������ibav��_��V-QZػ����?�$!U�B�/��v��B��hkrƼ(OD'�fJE�����W�D/$��g���6�P�!_�Ϗ�3&5Ƀ˦5ǃ����{������*�����!1AQa q�0��������@P�����?�S�_G�]3�s�Y~�u�]�ǯ������џEt=9��C��������l����.~}g_��]�sҺg��S�t�z���kۯ�������<O��iSr�1�ә�.s3�Ʈ?n�M���٘�t79�5/����y���e�O^'��3��3���zc��+��������3ߧ~ќ_N��ך�=8�����u��y�&�g�O��!<o��?�{O��t�=� ë����f��u�Q +�������pT�y�~��03�s������x�nx��ؚ���_ys����i���]�SN"�b������=�s���鞜Oס���'����s��zx���_J��I㯿L�k���N��_篷ѹ������_O�O�tfVnq?^�zq��S��Z�+2�J����*r����fe��75S���о�����ϷO2����^�y����<s7�s����U8��Oy��N&fg���� ���S�fq+���h���ޜ˙���O���9��ķ��=��9�OC{����T�C�Tk�?�7�>fc3���~�x�]3s3̮w�C�q��g�>zf�3���b{G�t���b�s�$jg��U��:�>ߨOn��8j{�o�/�~�Z��fs��y���Y����W�����ǯ~�oG���5�I?=w�O~���Z��z·_ϣ���ӎ�z�}:|K��<���W�=9��?Y���]1=� ]}��N:UJ�%n�*=��]oђ~�{�?��⸞��]?s�n����<O=3���/s����fet�y�T��b3~��t?]��_�������b�ܩωo�g3���K��f���c���v����h�J�1�������e�%t�������t���9�38������܅t�o�j<��OO������{t��7�������1�t��3ۯ�9g���8~zT�fo����Q8���s��=��?�+��}q.>�}>}~�1�_�����Oׯ���B�'��N�֧���K1?�<ºq��=o��ǫ�G��3�{u��O�Q��_����W_=/���_�Гs̮�9�C}*�7+3=*T���������ݦzs.~'717?}���8����i�~�=���ħĹ�������l�fY�c_E�L��j\���N?^��C�O>�i��'�'��ba�3p�~�K:xg�����~�W2�O���5wҘu���t�G���s�]q'��~�?�_3�=��?=�'㡮�N<�����+�9�Ng�s?�t%�u�bq�1���������a��7<��2�����7���1?���<믾��]1��=_�=��3�������t�G�=Q��u��ߥ}���g��e�+�z.{�~�:g��O�랗�=Y��t���3�����k�W�����~�q�g��_n���eO|M���=3��'��~�3+U1 �����L�=�^}>g���=1/�t���ߙ��]K�y��jyw1�.q9��T��Ǧ:bq�C�������+s7?=3+37*~�:�'3���q=��U���/�u�O~���秙��?����E��1w�3�=�]1 r��;�31�G8���e0�3�3�1�?=k���?�۞����������_y�����:������w���x���������WC��N�<u�D}�o���Һ���̿l��1}=�>Ҧg���S��y�]x��~!�_�П��uN���<ʕwA�i�w�.��t%�������z{8�F=^c5�}P��S٘���Y�?������9�]GR�:��A�O��s]?����>�Vf!?���T���=yzfW����y����LK�a�=7���N<�<O��8�J������e����g�����R�+3�\�_y��'�|L����*W^:��0��_���ԿM�����3�=O?KR��V��c��ϣ���s�����{�����zq � ����3^���N:{t�}~��G��?ǡ����gx�����y�}O��S�ӈ����S3��c��g���_i�;�f9�Χn�<�3��~�Ght���e��ћ���Bh�?}5��t����ٞe�������L�l��{����F�3��x��ޝ�}A��f��\�����ϼ'n�}���Q9�㯎�����S>�㧃�` ���=��+78�W������۞����N��_����\�O<��ѯW|M��O����}[��>��o?J���Oߣ�}.W_�x���0���e�������}3�龏O=�j_O3ߧ3������>��u��0?����'�v��W���3������_�_J���ע�bg�i}9��O=8�}r��Q�K��Mǿy���3���ny����/�b~:��ۦzjs�&�?�:bjy��x�Oo������'V��C��~:�����W��g�~�>��9��?|��p���ꒉ�Y������t������1?�ϴ���'���{�m���̛��O�z?�1���鎙�V:���G�]_������й��~z��f�?������g�z��ј������:�t�t>�g�����>���?C�믷��O~��S�]^�u��O��O��xt3�7�?���~�V'��������=����������L�=EG t�<��8�W^'~Һ��_�O�;�����1��w�bq���u�2�n��Pf��}Ĺ�����x����t��*���u+�㎏c�/��l�O��}���'����W=��3����*&�ә�:��=iǎ'=3��o3��_n�S�W����L\��yM�g����c�N#��O�פ��Ǧ瞜�� }+�Һ�e}==y�~�O��q+��3辏K�S���f~玸�s8�����O㦽>ެu:?G�=_�O��T� ǡ���9��O�MOy�K�x���s�]7>?�v���=8�� ��7��e=/��'��=x�S��u3�����BT&&e�+�Oby���ι���q<���_��{c������S�Nk^:�zx��tw�=+���s�s����3�WW<�}��C�*x>�3��vT��WO�Oo�_ܦ��Z�������T��1~a����=�5]���:d���i�*f������O���Ǭ�T����ǫ���}W�:�1���C����������Z���%t�z �s?R�_�����q����js?w�^�����zg�y�ݽ�������Ƿ_�����zi��|O�L��}1<�ף�y���=��_���O�ߧۧ�O�+���t����:{t��<Bq;�T�������\�Bq?ٕ�����S�3s7?s�7�?�O$y����'j��?ؚ�]jg�>1|�$:�2�^��<�?��������h�����?�k�9�}N��+2�:�����#R����?������ֱ�������jq���.���y�����vt��ǣ>�~�&���O���<t�3?C=q���ç����3�>�=Y��_O>�ծ��[O�}y��uG��� }/��OF��x�鮼���7�B����%�?Q��߮g��웟��O��O313q����8�}��L�:jT�����O3��q2���n����N"<M5���R���zx�ʲW��Nұ�����?������\��=?���t�����t�oݞg?���N&�5���~���-������?3�C�*WM�et=��ew��������}�y����ħ�����8�o�3^�s�c��� O����������>ޏ���_?J������1�����/�?3x��=<���|�?��ߧ=�+��O���:Etzg���%��_�����]?�+�Rs��S����*3��3=�cs�7s=���K��\�x��z{J�t���J���=?���8���/ƽO1Ҹ�?Et��0oD�DDIi�E{J�-��E�Q�+��WiO��|J�v����6w��f=��g�^&Y�����?��:�Įg����k��/3�������\��x��F�zU��<s8�ߣ��b�=O�z~�����W��~'�nnk�W����|N}�9%t�1� s}nY}��y��N*g����wƧ���&z1ӟW_G3+���f'��O�ϫ������������yf>������g���/��/���z='Lz9���⧿������1?S�i��������_�ާ�������OW?���q=��qQ���?e���/��MLޞ%�y�/�����zq5��?�L��'�'���g�?[����n�E��R��E+��ɡ�EWc��(�Ģ�q��_ ��3����7.�tJEZ]y��ɉX��%�~�(�����Č�bq1��3�q?N�v�~few�O�a�~��3y�q߭����3O��y������?�_�~'5��g�3�����z����;��/���?s�ߧ���=��5���=�]3��_�T�J����N!*��ҾӋ���X}8�c�~�>����/�W�C7��H��鱬z��{t��ы�t�K�=?�9����5�.nq��zܹ㞾ޓ�~���t7�]��?G�j3X���\O��nx��u?������M��O3�g�Թ�n�t��WW�LJ�z��ܾ��~�~c��/������L_���!b�����[�`�:���n��3D�8�r�R�atD AGb!0�`Yw)���s�X;@_���Vv����Ϟ�5=�s��S�1��.����1?^���o�������jg����2�q3;J���S�*b� �cS���NnV13�os�Ҹ����l�e�/��'����O�=�]�~����������֙��O�0��T;����G�+��7��>ފ��k�z9랞z�u��������3���Vg����u3>�x���T�~���}/��}��~��z8���g1�s3����z��|˚�u�<��=�=�.�}7�?�}59��3�Y����~&�x��Mu�9�;�.�����WU6 ��7����z[Qq��Q�{�EJN�R�E(��a�&�t�Q#�M��8�_��g�bf����\O��#;N<L�z?�������z~��h�:~&��4���J����<�zoP���OJ�Oo����+�_1�W@�培w�zr3s���M���<3��n�̫g�:�����b{O= ��G�s<��y���������=3����z�k�o�c��x�9��������t��'��q8�����i���o���g�����������?�������Ӽ��qWKw����8�O�0����~:y�:Y.V�>y�q3�'3�{J�S�k���"�f�8��8���ft��ы���-N�rֆا|�P,a$��%����������+ώ���ݙ����n{���<J骚�:bbWi^:�����������C������s:&x��J����������*�����=��X��w��b1�3���ӎ�3�s*_�iY��_]j�Lzw�ϡ�o��}�Fc_G�ֱ�}������秏M�7�;鎇�����t�����/����뾗 ���}�ѯ�#ՏWЌ��\�tϼ������}�i�����]?sSĸ�o��1;�u'�<K����~���L�|�N`��8��������^�ɀr�p�d�� j A�_Ag�ޫ=�m�|�qCi̧��X���DW�G}+���,�q�5��|��"��j�Y�}."����������%��o�g1�?3���n&�9�����=Ng�&?����/�<�+D�c��'���?����Du�����.k�~8�3C?�����?��WO��x���ϿN:c������~�����s�]<�����N~���ץ���O�맞�^'�B�~����q�7х�O�W�}o��џU�s<�3/����^g��>�s��ӟ�+��ۧ���z�����=����<O3>�=�'��=�j3=��~=L���O����Ӳ��ҿ���oJ̵ͥSQ3�+�0��26�tK������AG�� Du����� +w�5 �m�؎��X�]m������u��EP���h��$��ķ2��4���a��Qv1l V��&����~�+�y}13}�������'�Q�:�/�K:x�\��O�״��T0O���z��������;C���b{�{s;�'�'�O����x� �nf��q��58�������篎����b>�G�'�[�Lo�jT���x���G*?i�W�}>z�z^}�V5^�{��������C���~'����������fu��{Ng=8������=/Y|�9�}u����i���������]O�Z��<ϏIo� 55� +�~��mr���0bfy�%Ywk�1��c�2AAJ]Y}�M�g�.��'�!���1��r��Ov*�h��3h��5�F,�00�0��/h� �+UQ ���k��V��+�����P5�f�Ҡ6��R��ɨ�3�[��'��e_N��ܩS�b�fWNzt���i��Į� ] H�sD���J���U�nQY'�C�JĬ2�f~a۞���Ol��g�3?p���S�P�������+�:���Ͼ��w�@�=^��G���Vq����z1*g��+տ�u:��31_E���~��ߣ��q^����㧶玿�I��篾���Ŀ^�x����_������=+��+=ur�a�����<j?y��,zsS��ә���zs�?��O�?=5���zw���Y��c�ib�����7�.�c��_�!������43J��s����K��@Z���nq�u�N�"8y��#R���M��j���_Ա��6�%9{F�8j����Bگ�$�n"sZ]; `��I�Sr;ԠNG�2���Gz�����w�{�/t� �<�̋h�j��]�h����̃g5zq�-�J�m���"'+g0l�2� ���[��̻�2R�2�`�'�M�M�FQ�C�?(P�D5����'�Į����?��J����<J?�P�'��v����x��ҿ�x�=�s?�9�?+�}�S^%N<O�L\��<OM������Lo�Пo�fs�c�:va��v����>:s�71<�ǣ�y����J��WOy�MMz����鮷�zg�>�����ǣ>�Ny��?p�z����Һg�zΘ�q��]o����:s�����Zg���=���=�\�=���|�ix���?�Q7�!ԟ��T<O+S��p���@�B9%�@l����gC�I QWY�/)~�O`�GiXS�H�Qrw��J�۳q��g�2�N���[�vAk@��5of����y�qV���� .p%4ʽ����|J@9�sT.�g�4���J +��]���q��6;�� +���R�S����� �Z{� Y�G̴�b�����a�w\�A6�k��=�{�)NK-�le�U������O,���[!@b|F���(Z>DC�P �P.N^Ұ��>j.���e�o�,«�X�L\��Wn;v�Ɣ��)7������[�W�Y��=w]�����p�������֙��L��+���� ������a8�������nc1�+�c�`|�䈮Ӕ�I�=�>bc����On��9�_�^'�{}�{��^�'�?}�<�<�~������:\�}^g��T��T���=8���]�����On�{���x��~>�z=����ez^�zXK��|tׯ��W��пO�N.f{b���G�5����3Į��uϦ�8�s��Ҧ ��b����y�пh0�#f�hK�8v��mrTu}&6��@?dVٿ�)ZϘ]��<�s�+��ᅠ4ƪ*�.bE<CV�ܡ2�kD�*:q�؞%�7 ���"�V��!)�����3�U g�/�]�g��"���(hѤ��ZzɴQ��p�ynY���>b�m��HД�����Jj���░��h�� *����n��ӈ�֫������K��Kc�܍=p��P�&�DR�� 2�\$��Ȳ�X������X9#t��$�I�xW�ٌ��vÜԻCl����yF�5��um���̨���YM0�o�ik|�?�zV�K��9c5�ߒ.��̯�i(ՐCTm[w�[���Tw�.�hs +�uҡ��Wyp���B�]�3�nc9��.���ZkG�r�r�y��Hy�*}�=�����R���m/.Ǽp��������(���0�%�pX��x���q���C�1�3r~�6���;F)�yL�]3��C�f{�<t5����J�����q��s�Oy�I����F=}������C��{L|���?_O��������=�+������������Z���� �����x�㧉~�Vq���LN|�t��=x��v��߫]MJ�1?�9������y��g��lB���ˀ `7��{�.<%��Q@>�1sHp�߈+�\t��Ӂ���F�_2�Y�;k�;h �|�UU�8��=I���̦a�H�u�� +��Ƞ�V{2�3��Ѡ-q��^��~�L&�qL�b\e�S����������i�� +F�=����8}�P�,�ܹ�A�q^��t6�����$�� +��� �dq]�卫]v�'=�@6m��� ��Y�2����8����I����p�m����?�.��J]�72�����X4�@4/�3Cj0����]�� �D0_x�5��C�,o��{����`d{1��ۥ��H�Ӄ��XU��M�-1�7,Ի�z��H�4$�:�s�X`Y���U{�h��Z�|������* �^�ZZy6ܪ�QT)Z ˇW��C���|pL�L@ਐ���d�n`V �`���[ҩ�H&��J~e��f��s�����3��fo���������|O�*�������Ӊ����?G������?����ǫ̮�:qӟA�,�_]�zy�����u��Ҧ�g������<zx�����{�_���tκ���?����Qw1?]y������퓢N=��k������%���P`��ۇ'yXOiy�;{����n��Q��g� +�3Q�Yw��(ƥ`�n���u����e7r�y�6�e��Wa�e@�����_>'Ub����Hy�]Lpe�����5{o3P��̫E��V��B�8�ڨ����������P��p�.y���!���~&P��|�!�,�{D42�q4�� ��(Ec,H춱-iH�J���[��,��d�r�=�WF0��M��E+|7��gl/qa�]������q�����P�6��M����H�d^o�`��6���6_Qb _$L��L���'�8/0��L�7��w��� +�xe��*Z�[|��9:��-�Ȧ0[�h��r���%�����T���"�SQl�D6��ZT���-�.\���{,�9��Z�6B\X*�����\�}��;7�0?��fD��A0�Kc�.��B�I$e��@�-��DL#�;v�5�{��~�tî�����sy��_���fr�>s����qӛ������=>:�C���������O�陿]t�F���e�������>��7���z}�~}\}n���[�D|t�s �����_O��3��'>'�3�M3'�3�z�{�ǣ/��S�ҿ��x�J����Uuo��Zܠ)�Ύe���K�݇&�$���C0B���e�2K��yb����C'd�V&ډ��Ց���0ek�@0�r��������&8�r֙�y��C]�-{�fk +&�xmX�٢��ypk\�]KL���������w`BƔ�r�̇B�(i�?��+Q.���b�9� ��-Y��4�#�Z+[vy�Z�w�pr�>%.���)XP���O� R�����bT\E&}�,���{�k�E�2s^�J��K�W��w��c��W��u1��&����!b_B(s)�;�����P�GKH�v�+��:�َ""�>����!9�M6��/F�������qDtbm�DZ�/�S&��f5/-��@1�`+9#�R�E�5�M1�Ԯ��Ej>(�x�7qD�%Jw���;1V6�v�_�S)��ﹹS�%<O��<��ӏ:�ޛ��㮣�ϧ�S�M��y���_~�֧���\zS:�Y�M�����=\u�T=gC������\�g��]�g�1���_~���:y�����L|s��J&a1���r�����~���s<F��s1Ҡd��+����a㘭�x�;��H�s�8�� � �1fȌ��`i�L8�KQp3EB�R�Dۼl!�x�,�Ss3, +�W�7�*�VW*��͈]xqpS�A��j֦�R�&�]�T0��F�*��p�� \?�mE�]?b��ےR�QX�,.�V��4�F�{�3�o-��i�_�d5T� $sP{��K8���v9���~į,8|TWU�V���tZ|�3�����_��T��p�s �����n�!{"6pm�Ԡ3)�M���@�D]L�����gL�����e�Jf���-̽PT}._Si �J:f V,s(Y����#5-T.Ve�����C(��+�F*�"���K�JU��.�+�$;A@b�����V�+�(��@3�v���Ze�)�*�,�*W��Z��~g�?�牯��Bg�����W^�t��߭�3�ǣ�������ߨ�N���k�s�����������>��Ю���O~��3��&�������WBbn{��=���}s<������������Oy�y�K�ѿ_��)� +��aX�#6��cN�����՛�� ��^�r_�A��D��/�V�*Xr�7_d3I�Pa��;1������(�������Ơ֕_��v��]��LE9;E ��/a,[ͻ����#� �k�1(S9�Z-܋��iP��V:�L�E�g��Vk���6P<�1�[Y�x[���W}�")\��1V���U��H�rw�A��ՐMw&ý������,��+�1LAL����IP�[�[ T>#�hK����La��.�}��)�%���D{����c�.+%��i�v�q�m,��o�DX.�&ىәz^ȣ"�i�p�X����aU,�B���2�L�2A�,��*��5�%���1ܦ��P� ��8�Seg��M���r�yur���Ĩ���V�ppN�y���5���C +�a���w +��Yr=�KMq+����?i[�W37ߴ��C�/�ߧB���\�/����K�}k��?=/�Lq/�����=�Ls��_�ߤ�}|}y�F>�?���?y�_=\���9g'���/�s��7Е���zbk8�t��?��~�=F"��n}�%LjHV�.����bbm�5��.Z��� )a�P�;;˂ь#�0^�Ǵ����=��5uLtrWiA +����1�K\7D�y���h/s�f�[X�K?0n-��R�����O��X8g�%S���X-����bV=7J���3E�Kص��5�H��wq�j2�1�>|n!os̢���i���R�r��ZAV��ˣ��-��h�2.�R�9;�zC!���^���%�}�tψ���H�6�(��h@6��ŷ!�a�ږd"�� ��gq}��{{FJJ�"���6W�=e)w�]�-9�hV�����ʎfҮQ[�����x�4D�e��+�"F���N���c3)U�DBR��,��a{�M�a"�j@l~bq̦Lg"EDe��v�_Br=� ʨ�,sc�h�k���@�"���=�O���xNW[&s�ʲF�Gk�U(��Oi�#5��/��K�������}=>:>�=u�OS��k�/��?^��sgFc��Z�~�=8�����}|���]k�q������O=<~}����/��W�T�?S|O�u���v�q��O��Nc�rf4��E�lu(�&������~�x�h���R^{L���&,d̾l+����r�q�ϔu�*Z��(��c��є��3OdW�.�*��Z��ʅ.pp1S���612n���Y�w�+��h7b��'�+�!����QV5���We�W�1�AO�^�<v�.���AƯ4�e�[��_i���c�~b�(�LNXQ�Fmd��*E��X�<��&,yZ�������`̽MiD]^N!O(��5�p0hv�gr�*X�L`N�Z̼�ʓ��i��ʫٞ1��6�P�S�HW#ayĿnӳ~.QbB�in�i�~�1��w�iLĘ���b嘇�紣��p)s,~"����N&R��J,��`Y�=��L:�� #�@��<)��P�)�E�9A����V�u |8X�ŕ�Wi} ���|@���;tC�$%|�P4��s���V�!b^���].*.��̬��o�zm����~��ܿWϧ��o2�?C��랜z�z�z~�Ng�F��>��c�y��}?2�w뾧����������=��./[��W=H>�=7�\��Ӟ����c�No�ߥLz��sr���3)��m�e\D���y�Kqo���(�]� ��)e����>�BĂ@�`4�o3&!�e_1x�YJX2b`㦳DXN�$B_�� +(x��h�ve�.-2&���`,Q�qn7p�ZZ%�aQ佷,�����oȕ�q�l�e��(.b}��$�k�v���y�V��~ҡU�5�5��u�Cq������;2����K��T,;��S�K��qX6q1]���D�qy�����˲��m�H�7J��5��B�9#n��`�e���Gh�����̆_iu��p��P�3����:��!���,�h��~&k�̛���7���/���_1Q�2�[L�1�q0�~"��R\c<�D*�f��Q�x3`a���5�?�XD-Sfa-g�<]1�ܾp� W��� ���W���o> �P�;Jt5w��� �F%k� +���\1��#-�jVq���N#�Ӊ��Ǫ�\z11��:�ъ鞘������>����/��������N�q���z3�}Z�bWBT��js=���?��q�y���9��z��G��7�����r��:~�cי���x��-�jv�%N�?��1�>F;�ǴҰ�6a��ݾe!��D�n +��*�d��H��2Eg�ew�[l]��z�}�"�<D�q�K#�n���pY��`i��][� ]�P�x�+`�4�ʋj\jI������v/�Q���(K����(���J�ֲQ�\�� ��H��1.�4�O���)i��l�� Eo���P4���U�2=���;b��P�3�R]3v�,R�3[ٍ��sZl�@�c櫳���UL%��4ͨԸ�ć�K<��3��6^�PX�Y��5�,Ģ�h����FP�Qm���_���'3�qk����op5/��^9��*�q8��X�S����{�*��!�o+R��U�R*F��ob��F�_���h����F��E%9PkvE�&e�)t���^7�S�� ���i�x�˄8�%1|?yq�~�%ZeY�:a�e�LL���g�>�Mgr�z<z�����鎕뾙�������{z���'���G�[��G�?C?/�~��>�>�����W�����b\=���1�L�O�O�<~&&.yg立^g�Lz?Qק���牙�?2�U���YTS�n��1@��ih7�o=��4�3������Z4��XV#-;�2�|@�5ڷ8�;1�W�L��M ���JP���P�_Gh~�Խo��;��S���dj��ld�(Ů����q�FL�q +(2֗���5��wu�������R��s(����/E���t�{��+��i�._�`��$U-�D%���]U3�<{\ά�Қ��������/�Z��;�h����K���n�qj%VM���1x�+A�(�AVq{A���Y��L>ɧx����NŜ_1a˴���2_�9���\n?lw2�0MneQE%�����5��@��%�a3"�N"��Zdb4����MCc��)Z�S��L���3j�xSl�U�xCW�W��fo�-��a�� J&�EfQƟ0k�S�Gd;0\������.Sa��QK ��J�����q+�q�����>�{Lz�����<t�>��Fk���g��Ӓ=G������鮾�O�������=?s�ӿ\��_C��K�_y�}7 ����P����8��_G��N���b�����Le��Pb�NϙSUq��D��}�ξ?�ˇ�����5t�#U�c���1��>a������/`^��WW��� |��\DE +���@�� J߉F�UL�^� ��M�7h�� �<�,�<�}��S�-���Pp��މE*n4�)�C�^�-f�Ti?0��@���B��̾�Vݜѿ�X�y�#]�2��d�U���O���FP;�TM2�HM�Z��Ԣ-�a�X�`���ٖ�}���S�p-� ��9��QEŜ@s��ȇ������`�W�>�h�3�(�0�K�fu�� ���Hb%�i,2��[���(B�-�<Ɇ�b�]�iF�����\�sW���E�d��rW3 +����6���F����9 �����M��1�t�&:��-���%���I�5���_���8���9����n��I��J��}�[���W_oF�~}_���������V�^:���S�]x�OF?���ϣP����ΟS�\�~z5?r������?ٟ��t�秎������ +�Bp��KV_L� 1o�P��J�9` � P͵�>#!eC��85� mb����f�\�5c�p|K�7���1���f!��C�t��e�4.vkvs&M +4�k�V�{���W�@4 C";ˠ��P���.R�K����d=-8+5ccy�eÊ�35K;9����/��J�oy~��� +�"�|�h�=A�.���Y���Q�����Q������x=���+Ǽx?q�c���j +���U�&�(`��.5S���?�4;E����y�,���Ql�B�(�ҽ���!�2�9 �o�"�������qhn�2ݼs��4�_���ȣY�2`�9�1o��t�3�f�i��T0����5ĮDQu�l@�e�����+��sKn(��69�#D�G����Ӟ��ǧ}wӟW������+��^����z����bW��=��=����]�立���'����������ǯ���}?}/��=9�F��y�[�]k�=q7ҧ�������ʖs��o�n���1��$�4��)�M��ѷ+�/ޫP~8f����=1ڌ�����K�R�����r��yux���(+�/\+��%Սs�;��g�^Nj��(`���9/8��۟xr�<�%����V�E�۵an����`��5��3+�f��C������}�@�41ڸ{�W�fn�GW�^ 1T��Jw��1�e��[�Cj�J� +�H^<�Uw��{��/�KF�q2���0�<u���/�셦>�+N;3�3¡Uh�8|f\U��2��i�qR����/�h�O����ۂ����h�*��T�%u� p�ڨ��@�bS���(�6�;s��Z?�܊��"e��yx*f�IR�8�.�%�_hY�giI*����'�^��xw�/n^ڇ�9�W�����L�Y����Q(��@SI�N<����w������?���W��w�7/�J��c���?s��}l�^�|z �n'����������}<u��z��^&e����f�������{z?S�Ħx���Ǽ�>�ߧ?ٞ�?3f�����lw�d��w>��̬=j���;!M��#�Č�P�Im�gslC�1VL���5��U��R�0�%Eq����b�w�� ����C\��koϘ��Z�DƁ�v��lv��4��3/�K��w �Tj�a[l{�A��͠p@R����B^j�%�+�'-;��cN��S��k�y����%�y��Yّ!@^#�]�����/c������0���+�D7�{D���-��@*Pk��iJN{D��M��(�09�J�D�H0G�#�0��y��J������/���*�`�u��*邙�s���n��F�@C����Zf�� +��f_��(��9�Գ��0�����S0�^��Q]��q/��Y3�q�w5�Kqk)b�T�% K��je;�F��QEk�-tjV ��1�4u�'s.g������c�]N�z{�+���{�o�����'7?].~�5=������~��9�P�������c����!C����z3�篷�}w�z~��~!�MO==�ә�7?ޙ��:b=*nrL��@ڭ����R���"�?��1����u҉�jwgU0^�` +���_ᔱ0�#��.��GP)�L `ᴎYY�L(��^y��[�]��/1�> ��S1��w��q�}��g��ܷr�88S8���<��S5*�����j+��1����N�`�ӫ�h����1���SD�?x�9�Vi���J�h�f��V;A���cz�W[�ıg�0�N^��e4d�#����q+=��u�g!�_���BT5;#��p~a�/�R�˙� �v����ʗ�M�|D�Ÿg��2����M��p�T J�*��Q�E��q^,eB�D�1��0fR�n�v\Gh�#�DO�R�� FPm�Ts(g.���M�=.� ��`�Ǒx� J�(��Ԃ@���_�^=}���=��^&e�}WկN�==��z:�5꾿�_�+�J�t�>�3P�N:�����g��~��]x�~�o����>z��~�_OyX�'��c���#?����ۦuǡ���,�&B#)3���T�*��]������0`�|��������j�Z�n^�f�8�yde�]�� ���iy�b:s�9<L���\���ya5�X +Vʁ�� �7w������&����V�p��C���A�tD�hׇi�^�@?�?0�w���r�vW����pa���+�P� 6��E���U�l���_٩����V1)�!.�� p�؊K)� +J�{sa(�]�n��+cP-_x�;��n�Nd����}��ԭK5���È��I{�)����%7-�H�[#Vb2�,����� *�)5�:�"_ET�.�Q��{1�6s�|�M!e�P�(��3�9f`&��Nڈ��hK �]��U˧SL�c�25�F�F0hj�맷J�����2}N}%z�~����8�꾸��=W����э}.=[�I���Ϡ���F�>~�������>�����'y]s��+���:�n;�뚞�+�*s���Ӊ�'���Sd�L0�*Z�2�n�*�f �E +w~���3�G��������w�]N<¥9�p�x��{As�����S7�\�oT�������������������� i�P��-n|b~b�6g�K)t�%z>o��9<Do+�u)U����{���:�=&+bM�_�E�����;�W�^�BU����mnM|��.�w̽9 -�0���YO�B%4bd�ƠZ��\CiIe1���3,k�J�1is�N���0k�!���������P#���[��Pv�3��>i]ϙs��q�)S��`�c��@�~��;�s���D��z��$����&�$6�}B'N��XV.����]EG#-��I�\8���ϘQ�ej��Kv���%�Jy���� |�.��ꟗ��{����{��y�돥}=��=3�'���������R�ǣ�=y鞕�ϡ��?}=���}:���Fz�q��{}k�^��K���������3����x�N:m������t�Mt����zv�����@��Ľb8of����,�v\TJL�.Q������}��F�瘌W��-����`�M���� ��,��NuX�AA9��{_�"�{��X;�)�gL]�H[��yXzO�b���j�'q�o��\ƻ0l��5�`��4�� Hc�2,�:����#�e���;2�Cܤ�ڎ��W +��\��\�U���'gik�o6�8|2�;y�2��Q�x��,u��3_1%n��ƹ����.%��<��=�fW��%���4o����Ѧp����B�y�B�!Z�>%�����`>� Ϟ�N;C2���*��V`<Ŭ���iх�� pf�D����1��B�@�*s �381��xea���rEʕ��E��$�h��]�]ǘ�{6LB�P@DGL �c��:�8�f�A�C2��;O!�nna���z}�����Oo�>�u��?���y������=1�����u/���ϧ�����C��:g������=��\tϣ�^�ף��}5��q��gӿW�����o]8Į���On�������?���o���]���� Bk��T̮"B�f��c�����0��Cc��t��5k�,~`4|�o����%�����2>f�*/%r���I����l/�J�15���&�8n�5��N�k�M�p -����LY�T/���]J�c˴Im�<�%� ��"�;� uw�W��0\>x���w9�f����^H(Z�,�����;�����}����X����,@�<�B�Z�Z�n)f�/-�q 3�f�14e Af T+��,s��XŸ\�GPA�j'dȰBC��h�E?��my0��w�Ƣew�5�v�D +���`��z��n=��퍝Tu�L{��b�=�e�� +q(���o�V"��X�1�f�\I+�r咡��%uK�j�0�,S6Z�;��Y��Aeh!U� +�ϴ~�T�B:��Ģ`��eѡU�J�j��&X27�_��^��lK�e<A:r9�E�n�����N:\�A�u�^�n�}:�z���J���_�f�g��貺s���_�꯭S��&fz����ϣ=����q;�eO~�3��������'O��w����v��0����x�K��'������rT�a�VO��[�F�,�����|���w�������l�<b,W��c��YQ�:w��눢�����B��Q���t��������JX4\@�ԳN;�^�r���[�0��_$e;,k��0��������c���sW� aȴ���v�j��g�إ����hR�d@��KNt�=���p��D���L� +�[��eJsٙW;�i������\C�P��B�<GgҀ8�_�IGP�10�e�R��A�g�W��0nn��Q��<C����CL��#g2�����&R�C?aY��/="������-�].X���fP�,=�4jb���Q���IZ�F�R�ò��V(æ +�_�A�F�1KE!��i,}�����[a��E����Ķ,�a�*�7���D7���c%v��O�B���t�F:��o�H�z8��<�?^�z�z�u}x���믓�}���=��~��}����3 �������OoO��]+�������/+��z�|���LNӉ��un��^�c�������+c��C�0���s8�̡/'<s�3tc��*a��F�7� +>��䃣��b��{0.��d��N��c���w1 +<��5Q4;��$0 ��4;��U��"�L��E]�|���������6^״[��o�d��`����6�{K�Ƀ+qQ$ 9IX3F2֝���ip��2w"�KtW���D�HA��� +�/�B(%�����B�@,�&B�e����MNQp�2���ߏ&kr��Ӵh�� �hTU��"���O,1���%�a���{˽KK����W�����eÚ������-Ox�;?�VBs4�-3u0�AL��ܠ�A:+q��V��,�^i��^%�R�>c��ؕ���1�ձ��PG<e(H �K��_D��� +��MK�㈣,�;<B��E�{�t�`�a����+�j�v|s�z]?=?s<z������=N��y�Y�ǥ���~ތ�Ls�/=<ç��\����=�G�[����律z^���}�5��8���>��N�}��,���&����T�c��z^�u�y�NaW���9�?]<LO�:��|brJGr������*�x���/��Z��(�e�q(.���rG�/�K ��+^sS���q�$Hh�)�ܪZ��`_:=�0 ۊH�2<�<��s �p8���ˠ7-V�fZ���lSnv���F���`��ry�uK W�Kv֜J +��;�kr �{�.��X�K��s��k��*Eq�F?��qX�l�'�����PM�r��*Pp7���(����W�#���^��C&�/�0�eE�U�0�S��d�;��m�찢{CL1GR�n#�[��\ �|C ������������/�.�Vr�����S�x�f��.]1 @��0ƫ����7�p�"���g-|˙���L�o�DZ��SF�Q��y�#�}�{�A8a����&,�Q�>Gx�{:���Cdx4�W(�T����JE6��,�lB�ҸF�%&F +�-��pl�"�/t�2�? +��^~�z��?>���7?���'>�1��ѯO��e��L��b=?���c��\J�T�O��]�}_����Nz\����=/������8��+�L�c���T��\�9�'���g�vg�L��?�����z`�3����%�k����ω��������1��'����y���w�`�����,)N/Q[F�5-(CV��W0hpl' Fe����'7��i���;f�g3$�O9��L�߆&�w"U�J�n�w���q���'���1F�-aٖ5���� +��i���o#�w��Xx��P����i�/�ƴ(�Pwf�$�X_3��X����9� ��Lj����4w3 ���Y��~%Z�����k��P]n5��n�7����2rѶ���Y��F�-[� ������.��Ni��)Dn�*Ş=�¯�+f�L���0��R+Ĭa��p����L!�1�`��5��bVW�Tk�%4�ł���*����p�c���A�����{YۢQ=0Cp���b4N�L�X-|!)d|%�b���n��5 +���4d�S�q���J�d����qK!�x8\^�Ы�삙mCu�[��� ֚&��G��PhT!v�7ʃ=���쿘&UI^��H"`�}�1qan3���R��a��L���Y����驞�8���Lz�u�?V���/�}q3�;z+��g�WG����UO�����s8鉟W��ϣǫ3�%tף�+�{�<t���������b��y��������q��x�n��sĮ�g���3?s���fb����s�B�v����,C!~�d��;��{~����|� +&fm�E-8����lR(]���`��V�NO1���=�o��� +^}�K�m�Ը%������5ϼPvl��ty83=�L���j�;�������2A�U��7��sG��������,Qa�)v^_W_���L�w ����C��.B�%��h!���P�V:�X����;�e���q���\��8�7 +���,�2�\N͐{���r\�JB�a� �����x��4��)�3f�o�q��J)^�6���K�u������M���M�Vu�.5��0T�U�tDXMf�\^#�~�V c�'iHLv���+��&�r���?��[�9T�0��y����d�Tw����e�8�i +*��I̋�~�l��d +M�-��S�{A�R�/xS,��,� ��1R9�A��[�%���Ko�l�$d*3�m Z��z+������Nzx�_���?���Әz*�������O~����o���.���}ۡ���t��WϨ���z}���+�Ϧ���O�g��3�~���]3?O^?s���) t<|MFg��7�z���zy�s�]?�FjS���Ju0�`��늭9��f]W���Y�c��Xʼ� +��F�ޥ?�*�2��ĨPQ����X� +���C �'4r>e�Yu}�停���N�K*~�,Ms��� Ĭ�=���g�i+� +k;��fN!�]S���~b,�7��y�eP7��-�B%��w>fnn� b���bؖY |@@�Vm�3!V;cd,�(6u0��x�d�����2�v���94�t��e�ge�1�J�R�1�Yˈw�n��B��g��NS�J����{L��52���7����3&vjQ0����en�����UCz�/�2�z�9W3�ۘ� *X��R^�a�y�%d@?�-M���S�e�� J�{�������q^5Z_�d�+$%�x�A@�bY �1��cl����Ī����78>�(���s̥�T@����DS�ܩ�+u\,d�*��3����qgEc!"�l��ZVN�J����ǫ�Ӽϣ����돡���p������s�9�J�<z13��t��:����*��]OV�7<ur�z���F�}�\t��N�b��(ת��%c�_�?�gn����=�|O��2O�O��}���3?S��T��A���!�&tt�*{J�����Ľpo��0�m�ܨA�� ��\>�۴9�� ��qa��U�iO'2�<D���C7E�yC�5���=�k[]�n:'��b�5��j�j�ke����m��2lss��m��f �֩�E�v�@��Qj�h���0�1WB�c�h +��s0�!��\�j�[��dơ���w�}�֡�&d� �Qϒ`]�D�i�,�:��(�37��dQ��b��2��B����ψ����v���o= K��i��CY�D�C6�4�A�7���bܚ"RZg��!��fX�Bb��-]}��4�2ń�3��`�d��ge�(䅲ƼW03(�J~�����T���q�F���CN�_Y���is��f��@��7�o0һ�S`֮YK�T�"�3����J�jv��5pK1����(|�ER�!�r�eSq��-¨uA����q����q5FX�tX�py�BE��{�OoG���Mg�g�?~�o_����u�=�zO����ފ�zu�R�>����������z�������W�g���m������Ǚ�8����g}9�%���R�e�y��ۧ��������<�u)�y���+�N��],1r�O#݀���(�w��G���n�i�@X��%�{�����B��StW���_2�T�bDpx��Jm{N�CnwF������n�b�o�<�WnP����h\i~e�4 x(�t�4`�R.��iZ�vҰ�1���GJmQ���M�A`����x�r�CÒi?v��x�%��G+4����і�s/����o2�&,6G����b`�^"�x�u�����1J�̰}�_��S��U���@��Y��ţ���R��q����~>a�E�� �(*������c���4��"Q�s�a�iW'<F� +�N$�j[���A-�x G�/�1�)D։3Y�]�q���+��ʘa�m���A���;���*���{KP�H �ߘ���m�x�� {�y��[���ie��<�O�i�lQ̶#�>��Ur�Q��;\����G����5������l�,�W�U]@���`A��@�q�&C�<E���_��ϣ>�����S�Q�ۣ9�>�1I�>�o������B���ףr���zbS��}?~�n�}:W>�?�+��ʉ讕��P�\����?g_�T�T�J��;�Q���u����8e�y��ף�������fx�����Oh�}�����e 9�zN�r(�KuqW�c�7/��^�SY���Pp\U;q�����,Q�s-S�P��..(Z'�2�oTK����/�AJ�!�y7�������*� +w�R�7ͪ��bF��������������r�?��*��CQ��a��v�pq(��ߒ`��<ƶ�D(/z��,���E�1H��30i|�Z�P�ܔ5�PQ��}��rs69�& �����2��=Kx�e�h��h��+E�VzH�,�T���D�U�'�x��|�U��,���#ۈ,�2�WA��wQ�#O3���#tᕎ8���,-���>%̑a|���.B���E��U�'�x�%va���Lϓhӈ�!�9��ݴ�wA8w�\/~��fcA�Z�^PY�v)�6c�nf����en�r`:�r�4����r���� 7�%�ٕ�[`��38�\��TH4v�0�`#GK�p���7���o*�����\?��1���������^�z3����O��~�5�����O�ǣK������z�S���33=8��8�ޞz��=y�}M�'����S������!���̯��a(zvǴz�2��]�S���3����{C�%�%~:s�Ϥ�}�$.����"�5-0 ���]�v�*���1�m�� ��p�(�,)G��v�8�R�l�bh4~#h��h����e\����������ϴ*b�0�R����ve���;=�ߑk�f<8���#1���_� +�p1�!Nc�f ��� +h�8r��L�!�fb%dh7.�{�<�}L�K�4n�B �Jl��,T��@Z-1-K�tVy! +bL���v�z�Ap�q)�z#��aN��2�Ci��g�3&?��7��p~"XxJr�}�F�̰� J&7��`>`�2�7�z�aqia(:��e�@K�9�)+�㫊���k�2������)lR��YE�r��H��[���'V�=j{�){5Y�igh�1Ah'�H-��%[r��D��J�)0ݎ| R�K����Ԩo�Dz{x�������=�G'[)���-�rIW�C>�P��Rݐ��t���8������;�q�8�ϣ��}�j���鮞#֯�z_V_��t����_����s-�~�>��s��ϫ���W���o���c+���sЕ�鷣ۮ�������~'��i�!^:~�>���i���3��|��秉�?S<M�Z�bvaӎ��\���S�^��]<On�.�0�ĪGpx�X!��gۘ�A#�䲗��(�9�V��A�02gS��q���g �� �f����G��Y�]W��Ò8^a�?1���UKuU����G'������>�Yx���MY_�`c�c�s����XA�uW�=�"��QX��U�Cq���@L�UK!�Z�VF�+�jL�>H'���NM�"�_h�5�ێ�6. +��R�,�$�{ļ��Ug�]sP>x��DgI-:�\� K�L�M�dj2�c�~a�s��Y�Ĺ��&��0�j=�&��ĥ�^8�������G2��Ф�+��X�d6�U�r��6�̤C�k*������i�fT�2ɣ�b(o����<1�%V�*�����<�N!BϹ��4���)7k�c=�<���ᩂ��*�ؙ�Ԧ�"(Y���"�G~Hn��ڠ�C0��)���h8f���nq��nv;���Z<��y�j��[[�1u�����j�o��6��˟��!h�n�� .�ӿ��=��1 +��뎏O���x���8�z�|�:멏_�������r����X���G��S��A��G�WJ�{�����뚟��Ǫ�������N�57?]y���n:3�N��<q8�K�?R��l� �?=[���sz{O�t��F?h��{���?S^=N���CZ��1���fz�u�-�����]ѵ{F�G/iDd9����e������`�Z�������q&*W�V�.�w�bѮ^�&��x����Fam�Qe��x�j�Y��2ٺ���4�CXLg����*���@]v��L�����ҡ����W �b_E�e��l��_�dCF���`��8����s|�,��|s-W�b[��y��x�m��2��C�1��r�\�w�G,M��J��;��'��U��s,e[.g�u�d���Nڎ�.8�3����J�b�n�Rfq�?�E�%�bɘb�@��Z\D��EL� +^r��sT��F�A����|�X���un�"q,A���7�*O8�2��eqP�+�M�����%��U���f�M U���G���� +��������N��[�{@ɓ��ro2�������Z��j�7�(��s���`���f�d��Ф�x=ǘ��֞�X�e�%rmN�]��HbómP�����}�&z�����{��C���]s�����O��<O����߯�W���Nzqۯ�����SKq����z�������_~����ӌOm��$�����<��x��z�����;����t���g�2�Ӵ��;����]=�*WLNz��h/PR�����@^�ڍJ���A)B����4�_�*���V����C�$��:���x�� {��[��v���-n��Т�v!V��cT:��A��. +6? �[�NJ��5�xy��]s�]к~��9;�ћ�s, �C��rh�Q5gfpx|CB���&�*��߳*��������bSJ����}�pt�2~ca!vu3��� O���i�����-*h��e�1L�9x��O�i��G �[�n���� +b�8K0�f����D����MI�T�Fg}��ߝ� +��,��� + Pڛ�*A� JU�����"���`����B��0�8�^���]�U��v�Y8Hy��a�����y���(����D���8��E������)d�8������oP��2���"�O̽��X�e�E}��l`���Wt�p����H���X��,�bX�^E)OX1Ɔ�;�O5]��W��N���c^�<��K����G�ϣ�k�7��}�A�㧎�^~���:~������3}k�O��}s�OF��:{N=>~�n�������'���iy�����oS5�gĺ��eq=��{L���럾�O�Oy}�q=��?Q��/�}��:oнn{����TT%f84�홭�V�e��-p `�B��AM��o�n‾M�V�p��!J���]�IB�|���Y�͂h��ĵ 6F�cĵa0��E +�ib�g�TR]`q�?�FKjߘ��e$���~�M����s̽�9���x��� �`���P��t��;áMn(`��r�J59���,'�VX~Q�MUO�E Ø, (S-b�=�ٷ��Hc��QψA]�b9.��+W�P��*�SU�V��]����ޱ-qW� ��c��sE�7��Z��u4�Vq +k���-m�� �g�ej�=��Uq_<«IMJ��LL�|f�F&R��aՋ�ݥ]bU��|�ZRh;��W�04�r4������Q�;@ ��Wr(i7���*e�eA�(�ڻ�6���ub5�C����s9S<T���_x���k�T����&��Y�R9�^aIf��S�`یX�"����/��7m��[��CA4��ܿ�t����G�9�{O��ϣ���������\�ס�X�]N���~�G�?}�:���z���թ�����s��1�ϣ^��^=����n~��1ӆsn�O�no2�t����̩����8���O3�Q��ƺ�{OmC��f��������!�į���3�s���c��y�_��PwC +�h����b5vJ���� �c��X���o=�C���n��Dt����l����]�+kx5�Ur̝���4:�4�] q��I��M���FJ�bO�p� �rx$C?vQtK�qT.�������'(eg�X��8��ql����p/.a��|���iI[V����B9�h)��p����h�>!x�H�sa��t{��)5�V��'2������ŷ +]��Y�%��L����R��^"�e���Ex����Rbqiv[���{g0���Xn��s�����~�i���*Rk+k�0s(�@v�����;��, ��G�hÔ�8�'#��t�E�`E�#�',|�')�w�R�h}� �[�Q^�-�W��ƨg�(�0]CfI�a��2. "b%��,U_gS��_�-��eh��@ͻ��.�K�����0}�����o��)�x����Q�*����-��'�%����7�YS��t�G�ע������ǭ�u�����s̨�.=��̾��g�N&:���{��3�����=��=��}?ĭ���ܻ��g2���c����q?�X�t�x���w��{����E�0��y��?�^:f_����1}ᩫ�ӎ�!n/��ҋJATs1bPy��t��P��0B�c�f�j�Av�U� �o�VV���<��E�� v�q����!vqX��Wؕ����4���5䖰�%T(j[\[�lA\=�)�l���P1<���X��/�V�M�,X�2DM8ǖY�)^�A�1X�kߘ{���2�����,D[��]���.����-ֹ�z�P*��bT1����eb�*Xʢ�rn.!�u�p��Ѓp����q�0r�\w����q���=�ӳ��j-�h����5�-�RS��>e� _��Cu�Vf����s�cl.��2�R���(ī��3�\ �U��)�� +Y�� �/�X���e�����F�rw��p��L���U��ֳs01�*v�s��T��{�ŧ��E����T��Ĭ�����KBZ9�C���!y�e�o�x�M�5^��,d�����(j��"�JJ5}[�� 'uz�=��� ����υ��/�ϧ}3����鎷1�~�:~==Uӏ?C�E��Z�8������G��}�i�F��קG�s��t�ϧ�t}����K���<M��S$���>���fx�K��nv����m̦o�q?P�8�g�_oAL�����iW��������?�Ѝ�������j�[�%��Q�� +Ԫ��k��3��d@S���[a�������'�otTWj� m�o<v��kFf��ωY1M��`R�q�U��w�({��E`S���a�F�ڡ���O�8��{����L}��d��f!����^�ڨ��2�`R�o쩘w�d-��j��d�+�/Gx s[��� w䊼a�6� ,�+�"��L�� %�������\ +�GS�ِ�L��A�r��-��f�Uv�[�U�iK8fѣ;��^é^w���B�f�;tW8��sŸ�=�@3���iu"�:�+����N�#R�0m�M�K�&H'r�٭s()��6�AV�\��X�j8F6�'�-ʯ�r� @�<�`��4f`�ʷ�kL�b�Lw������Y5,�↵����n�30;p���B�����[�ز?����f�5�>ʬ�N0j�/�)s +#�uG3B�{�@춨��9���}>�w8���t��f==��>�x��:q��t��ק��W����\oө��O�s��y���������9��\N:c�q=�y���K�_���3�d��=9�<�yw)������:�x��>�f�=��y����9���f�����N&>"�P�x��q]|��K멹p���?s�W��}��똢<fw��m*�1�R��~.C�-Ve��j����Ás܀�%C]���g>e ���pk�s�����K�� +��B���p�NVF�+������oi���w�VY�D����)��50s��8g]�ƍ���+�(-��j�ch�V%���\���h�� +�B�-����,��"<FT�;�&@e���(����^+r�ސ�\��rظ��^*� B8�r���b(�2���h���V/�'l��?q9��,0��cu(k�7��V!�b�ś%��by���*�pF�叼��K+v� +H�P�'�\K�����K�0�:pˣ�f(�^V�U�1�^���Ơ.~!C)��<!�B�V�x�X��4c�@���3LT͝�;�z��w���1#W��k���]�5����e>���U�v��ŧ\XYcϲ�q}�)�L�'�d�X��ƌ�� j�����=�1��q�9��ޚ�s־��I��}��u��w����ߢ���K��Ez���=o��^z��?}}��Lu���T��w��y�b?�����������~eW�C]�����&�e�������� ��_����?s�\�G�/�t�1Ɨ�x�}=�?�\�x��o��L�t�Ӟ�ݺ~�GR*1.�<��5����U{�Y>%��2�P������1�'^$��ĥCO�����B�R7����G;��=>��J2<1(VN;{�t/yQK<�p�Å���E�w�xIU[�F!TY{��Q����jo�e�x����F�-��Y +C݉�5�`lT�k���õ�0s���J�e��g�EPߊ���8`6.���(X~%���+1�,���2!�\��vx"��) �0~�f��d�[�ߴ�k��_�(�1"�s�D�0�S�=��Z�Gx�g�#(u��U���ibA����w;�;@�x�p�sj��a�,�y�FY�y�x� �';#�+��`��-��jЈ)b~���Bb-#ȱix�BՄYMS���d�)�T�j��la����>��0��C`X��>��;U��%V�v`�#�k��-1�h�/m+��� �xl�G��[��3bV�� � "���K��9�9�����陙p�OL}|�??Kϣ7�9�����������ҳ�ߥ���s����~���=�y����Q��.~�x���z�����������������3?����=��fc7?�<ʟ�a{�Y�_Գ�Q�G}ss�s3�]x�>1����飞���L���j!�2���ا���{�Ah(]FX0s�?�j�T�C��5g�,�����346��Yࣤ�J��qy6<��U٭��r=��=˖��# ?�;����H�طO��՞si�6�Ë�ATo:��82�K��������`d(�$ ,�r�&�T�ݖq_�v���k��LL�]���%���+r���\K��2�8���\ ���Ȕ�gC�1+�g����-B��$-S�����$_+����*�F(Z, �x1�8��8�قF����w�(������3q����H��.��N����n=����E��o�O�e��CW�h���n,'���Uw��^��i\�G��n!��#���� Z8���&Sp,�`�Q!j!`,�����[���y!a;�T���b%����ļ;�K�7��j�Q���`5Q��+!R�����lb� +�ւ.l�+cW�k��q�ߧG373Ϡ��\�����}^~�:�gя���eLt��x�������+�3�8�~�^���~�o�}\�<B~�s� Ʀ}�tǧ�~�o��/���һN������c5� �+ƺW��^d��2��%��c8X㘣q��>&`|=/���s=�yf}����(���>�ug9�i�״��b�N��b�}�Cd����CG3'��+�z���z�����`�_xJ�_��1�HyI���� �E���sNC���\ª�) 4w�F�VZ,s�m��]K�le��r%������g ��%�Uk�ͫ���;"=���%Uj����Ke�5{��ee�{��S���~��-B�\��]���cZ���~R�(�ƻ��0�UC� �����(�0n������#��_0op 2n�h���fC�v�Fb��!�*�L�d:�,��.�h̺��!/�`���q���[Y�9*G�¹�)���$&�3-C��j)�H�d�W��s4���9�����"UrJ��*��2}� r�+��kMWc��0�+D7X�|��KN���ݨ�����+�f���XWa�hw��U+��\����"K��m��X���nd�pq��*��Й�_O>�=/NOi��>���8�oѮ��]����W��\���}K�W����u�z>��̮'��}=�x����t���Z�n���L�s�n��o0����8�U<K�w'xN1��_h*<B�M�����s4���i�r�`{X�`�����ct[�pF���\t�=�1�ϧO��@�~�ͥDu�G�8�#~��vNf�:oq����3�pUW��U���R'�o�6��� ��*n�����:,1�o�j�,q�o<�y��h0�����Cy�e.�w��x?��"�������tXn�!UOs����W�\�k1Tа;�jƗ��� Fw�;lV�� S�h��9*��e�d�0+8���v��d�/�(��+hV=�c)|��+��UԢ�VGx�<��[DLw��x�p��;������j5�[��nK��n��FFw}��IPeZ_Ԡ� +�g��ړ~!?�!G�殏>f�q�9E��N[Im�Ę0��3�����y9� ��`�@V� ��Ea���]s�y�3��` +55'xn����������G=�X�������u��S�'��V��q�3�����P&U�JwD��6�����>�PM+X���Ӂ�f�E���6]�k^ҙ�1�=��S���c�v�fc��bUc��3��z<z��ǣ�鞯�^��zOG�O�k�Ѿ�(zWC~�x��?]u.\|맙�_�~'�2o}=<O=8���z_���鮘��a�Zh�KyFY�k��~Z�|1(�����KP�W�� U�x�62�A��L�c��,JW��4���wO�鏼��M�J��h*�D�K7QG:7Xxj{t�c��ѷ�W������\T���#iDF�j��]c̶������h�Ỗ��!�"�������(�Ageq+D� +��F�3�a"���fr��c`���\Tb��F��5"<��C�����d7܈�1}��i�W�~ �^;���q'�9d������/<sar5?��(|Ʈ"�'���3���-k�G��{��WPR�A%/��c\>Ȣ��8�-��3D���iT@����J +��0H�:��X@�/��M�:�&��,�͉���Z��f*n�+/�̡�t l!C2�B"���+ j��Lj|[��x����]��p �^@�3Z���������1]�+��*oI�b�i�4�c�58��)q�c�ey��F�6>�T�;K����,�/�,��J�wR�9�-,��V���ռ���^��=^&����i���=s<�79��s^�yS�љ������������K�t��[�K�k��տ����?Sr����S�Y���t<L���C��&3�R6�8!�Zg �����[G�y{��nQe�S3 %�r�X�G:��K=��S|�7<=���v1��I�E +���\cQ��+��'>���F�qeR���9�����d�|F�TX<��e���X�~�e:��?�p�B�����w�Z�U��L��w����J����R�& ���z)�#N�(@^b���s�r�#2���w�CV��j����̫6����1�C���1PYd�sfpZ1s��3n��h�;J;a����Z����fw��ܵf*%��+^`��s�j;����#�۠X��(J��L�O��6���i�`�^� ��au5��fv�EE�(�%��"�Ak��;��Js���e��3Ne����P�f&��ÊTr���>#">.��p�*ܭ)@�^��P��?��Zxn��kT��y�kҌ7��wuv������kR��!�^Qq�������.��1�r�gs��z?�[����/��C����������z��1��g��G����~�ף������=�Fz_���x�����>��s���g�iGC���N�3�x��t���~#k�A�zWx����DUt����K�P�)��c#X�upnU��?0�n�X;\�>7+h�a+$��\'<=77��zy���n[4 \W��E�c�ctJMx��ad��t�z>z;�?�L<L������;��xLӔ�9U��X�p���e+�%���g��f��9Ta��CL���d���. M���l81�1�C���W5�K��g��6���;���or�O2�٘�o�.����'}�fč �b�fyw�V �D�q0Wi���Us���-�x��B�Ɠ��1+�[Ǽ�3[�v���N�Fٚ�j�P�B��pbȳ5( ��L|V�}�BV9���P�4L}�J��h��XF8�!�#U ��iM@]��l�ULh���t��]˙#�"��F � Y��0Z +��W&K~У%�k���J����&���-``� +��W �W�sP����Ϝ$ ����l�8QϘbD0�uW�\�~�1E���n�Y.@��3����_O��:�?C�+�=>��A��K?��ǣ��q������o��9�s�������<�ߥ�Nzs?�s�WK��{��?|N�}/�}?��t��� 6�0�X�]���صpi�i�nh����и�-�q��D`7�e�qq���:|��ľ!������W�s�a����B�5A[y�����Y��E��R���K���.�=����=�f��5Į� ��f���Y�K��|sy9�%����Y�����X2`G��S�r�(wg�Y��E���L4���s���t�ZV�#�?�r�HX{Ô1Z$ŭG��8��B1����-8�\J����!��<�J.%��X,�����^n0�<����Jl����!y�8��"�s/Q�㉡� c�X/%�40D���<Jh��e��Uv���z�J���i�[W���;�X�p_>Ib2�����8S5 �,����QSC�TRA�8V\�8 ��W�R��](�������e�/�P����Ma +�7Y�P���QV D�}� X��Q,O�F���=:�5���}/��~�?_�}O������ֺq�=~�Z�=��ѹQ���G��y�����}q��z�+���1��k�L��|T��__�\�K鞵��5к��V�W[t�0b\�r�\c�����Iy�3Y�� j.MF����L��n#Q�c,cߟP�T^��V��h%��PS��$FU�ب���^��`*�c���t~%#G��������$�k��T��y��y��v��X�f��+2�~Ӻ 9Ϙ�kQ� �L��P �o f�:�77���L�H1.�V_2��� -�1�7 r�� +�)q^��p,�v U��k�i�-�Tb_2�j�~&�e�\���e�~e�g9b'�=�)9s,���@��8.�3Z��L��5(I�XeCy�! �}�@v@M��� +�B/�075b�P5�/���� +���Ŀ�<��y" �Ϲ�&۟�HF��� �A�Y. �U�_x`�1���]�6.oDT�휐˂�+=�b��W���*��X6N�<�0 C���\��T ���ewn�i[���+��iۉB�o��}?��?sG�~������:W�Ϥ���jy�:�9�$:���\zx�?��|˙�=3��z8������z���z�&!?sۙ_i��=?��u+����c��땙��D�t/��W�r������,�X�l��^e�l�K�- +i��q��*1�Θ>�� �=�ƽ�~ )���yH1��@#H�e��X�{�^� W�.�K�F1`]�ƍGX�`�t��i����a��]�*�a�i|� ��x2�V=�8�V1�ČnHi4�� +���3(�3{�@�svAj����g������;��(�@Y�5,�r��`sF��6�U����k�T��a��L4JeK���G����#��E�#�K��u��0�&����p�>e����~����A������ፈ�)�^e��h��D�i[���58�+����A\K��\MK� [��K�<���Z�PиCs��ħZ� +�rXP1�y4���弪"=�UR���������P�1X�;D�a��"����Q���;7N��{�#�ak������s��r���}_���~���x�����讕�Y�ߢ�t��WOU\����n_O�_y�� ע�~���__�����:����[����eܦ�����3��ӟ砂�Ԥ�,���=$��E`�>�DT�dQ"�3Rk�`��U�ܷ��< Ta{@,���Y5�Cu�䅃��� U�`B�Ke�e��f�h�"�q1���وF#�.X) K�MʹN����� +��dXe��S��*ݖ��#.#ơ��Q�3�Cf�Y�vS8�<�%F��9�1]d�T�'|��_J�˖t2��`��1K�����e�5.�zo}���{̽�"�@\?h��Hظ�2���/��Ř�B���>�9aQ�4^�EP�K5z��������y��V�r0[u�������60J�Ը������w@�'8�'n]��79������D&X���J�Q�F���`j��@��q� �_1�Î�V�D&p��Ll�E�!J=�LŽ�YPw1�M��� ���Ѯ�ӏ_����'맷Z��~�I���g�c�ק��]y�s��3?0��w�G���]|˙�}OϦ���~�t�����_���q3����N!sΧ������'�>��2��<�m����T8BBT%J��@n!>��Q����R15���t`<̑lL;�ia�Otv%�2�"�P���ƈن%|��v�J�����s,���H����`�Ics��^b=�ѵ��ܵ�s.�|��y�ǘ0C �X�<����2�\�%�n�8s�2�q�[�<����hUd�ԭ�����G�+=�����0��v��+�e�|F�R��s���b��W�^�o�˲\��5�\i��(�1��F���D¢��L�11��p�+iHf�A��9x���s����|7,*_�V:��@|y����-����3O�7�i��˼��ZH��v��<D�t���r~%r�m�|>g�%��`d���5~�\[Q`�2�0::�&K�u��ЊY;�� +��ߋ��^�".¥Ƭ��J;�9%-�]�=�]bU7��?�b�v8�X��|�~f�a矩���z�7讜��3�^��8��ӟG�f���G�:yף8���L�x龾���C��3ўg>�ף��{t��3����=���g���~�Cъ�멏�SF�>�E*�(�WB*,x�ҭ� +�Y[�۬{���_x=�������32�f/1t2J���.O�%�1-aV YQTy��.�^�`$*��)�����̳ߘ���%H!��M0j@9A�=�~b���j��`Tc��ٍrF�.<"����]h�b*8+sb/��L���A��]�Q��|�f�pW1"�'h�W�<Lrv ��N���0��ZT�T�Wҹpe>�._��d:�.MGAV[��s�Q�au��51�{� +���i�����'0L��&���������/�@�s`k�!d�5�� +��N�A��xgb��4��F�i�݀.H���E���8�j]2����hC��d�= ��tbγ�qzڿj���X�9���ց/ �F��k>��Q�/=�L��w�C 2!�b(�Lo�1� +��iD�`d���Pe��_=^��K~�t���|zx��N'=S�O��YS��^~�57�������Ϥ�K��_���������_���38���}x��џ���C�羚��c+���e������F3j��qpe) ]F,B`�!C�p+K;EȮ#��8��f2�X������y���dN�*��A�;<{N)��H��Q�%��J96ڸ�q�k�Y�`�����6�H�]%Ƿ�S�F���� {@i��r������P��:;�kN����H ��0�Y�kq<�lL2�r렮-[e�2���p�ab����?f8oF�,� ��PaP���%�`�.*q�>�U�$%}A���R�˗/�z.ie��G_h��1���_L���H��ꆳ� n��jnr�i`q�R^�s��\i�L��19���(�-{{8����Բ�y��_0�� K�0�����V�!���¹7�+��&3qL#[P�1����H��#t��gox81Q�iY��e�_k�&&�)�q�A����� õ(g2�;O�Q�Ln`\1��N�����-+��`�[k˭}<t�����t�����_���:�Q=�~��z�F����S�nG��C�N����������?q�����u���z{O9ߣ��Ւ�M�u촿t�*\�r� UA�]dW�R�Ew�9��FT�?2�q�S*7(x��3�1����r��-n��$k�f<{��� Lt��Կ#�c�Q�LKi��xe0O~ � Ya�$;����b!��3���aR]F%C��ئ-�.���J�W��q}���֥��ʯ�����/KLQ��Xb��V��d��Ro/+�� 8^H�Ʀh��u�����z�n�5pOhv!��\�/�J�W.\�r�ˇg2��/��]�e˖�`�qNa�p�u����\�d�0�o\MGj��ًo.�/�-��<�h��/�Y!��0w>ѥ����/��q��YU�b_�J�u��B��k1ٷ��'�Bϋ�K��fWp)a�غ}X��Sr��f�%qpA��ƫUr+��FWlNDv^����f�fM�I�����,|���C��`��:CY�@���D+��mm�_�=���O3<s辟�}__�ӏ�����ٙ����ϣ=kӓ�y�ǧ����ӟC9����Ӟ����>�ߣߧ��K��������y��zx����1�J��*k==�?s�}Dn�tܩpeƑ�eL�\���~ҕC�p1 +f�a�^�J���w��/Zj3 ��#�Q� �T����1[�8� ��1��W�����D2b��3%�xe�/�T&�<�A��Jp�4�y�Ln���f�$8����Y��6O�hu|J�{���K�5�25d���GE� �o̫�fsL>_�'(T�Q���3 +�Pӷ�.[�wx"��ٝ��S�Y��IiڹH�.�e�w� +N�+Z�(���&�,q�uC,g��W�g�P�+�DE�mF��A�e}[�.\�s�r�r��B�|A�³3����Eq�[�Jw�B[[���w3��0����� ��Î�t� ����G�c�+� ��!�S�5�W��0Z?z��E���GU��@H��KR+� �rG��@"��:�-�̫up���˃pfy��Z��=�MӴC�]����O� U��xv�TdK�kE<A*�F���!r�l�!iv�cB�6%�����ܙ�e�3��_M�1�����y�G���Y���ϧ�~���u���+�J�߫LԿ��WCǫ�>�~�����x�����5=��~�7��}9��z{�s�#���P:x�O��Oܮz-�8{y�Jګ���TR��0�"��\aat����q?3b�pn����%�b��z��~e����˳D*�QBZ�Υ��*w����\�f0]�.s7م^ݥ�L��oD��y�K� .n6ϼ���d /$%�( ��z�:��N6�8��Ouʀ���E��r�2�81�n��";!X�o+�h��`bEȡz�����^�t�P}� <�6��_h�)���G2���w�C'h��G���������A,El���M<�V�A��3g�_E��4�13Аl���N�ysr��ĩ����u&`*�&�� ��l�p�����!X��*}�,��0�;�Z��i8���1��K ��8j�G�[�y.Q��qؕq8�;n �&�M�W�(mE�Ѭ� �ClVr� +�.�7�i��kmV��$jbc�n�`�*,C���̨ lV,䛾���N(J�tW/$7P����V1���L4O=����ķ�h.a��(�Z��� +_�7D4� +s�R����ޯ�=<}gۯ��>�=u�&z�*c]O��������+���]+�������==�>�tϣ}8�\秿_>��}���}���G���:T�u��t��~�y�����+1JW�)������_x* r��2�9��e%&4���6튩+�P�fHG,JUg��\�����������2�+�r�B|���Wj�����ܻD���K��p���ݙ)`Y[��Ɠ����EY}�ω�����Ju�>Ц{}���*��h���ڻȰ|���+�kd�n��d�e=�a�p�q"��_�������3R�]��*�1�0���U^�c�f�-{na���l&Q� ��R��n_@����������42�R�q�/�& �)p���_xr8!�����?� +���"[�j����B��`�rF���*T�]o-�т� f9\�x��Y����5�'�+����= ^w-o��h|��6Ei��o'%w�hݐ�!`������=��r�`�E{x�X��@�/��.�h�����<3/)�����K��+�a�TE:���'><�f�fg���.�I�h�7m�P�@S���"ٕ`�G�e!b:o���ջpő "�[ѡ�Q�� (�Q%b����ҝ�8a� +�d��Ua�R��l�e�Gzc�y~�����?GįI��^ �z_Mz��~�K���Л�c����T�J��~�&�k�2���>�Ǧ�����W���~���~g�C=8�Л��~g��>zs9��K,#8n�!�)�E\h��P��e�S�au���J�Nİ���G�30U.��1�X��g0�1����c�g�`��{L��r������{~����Uis��:;�P�� �8e��䷏i~T�����̻R�,�"�b9-8�T`G �x�i��_�*,_ eE���X�0����}�� �J��V�q7,�" �_��1��(�^��,��չ?#ky�Uhy�!�!T��Wl�6���94�������� �o���'�&Gd�~�H�-]5#c�;�hO.<C,�P�)� +�� +LFSGs�(e��1ߤ�Z�P@n���ˏ��+�_K�����+шJ��^#�F�Hשּ�K��g�#hE�s;L�4�ڼ�`j���Ȅ^X���9#*�J��'~�w��5~\�0H'=��]���$�TcU ����Q�,9�g+o�/"��g[�=��y`��t�s �A��}� �)�;c���m+C��vVi3I�E0ŭP8��Ec7�8N�*�j4�W�����0/� P�ҩU�;�aR`���It�@����nA-�_Q&�b�_����<���F��������Џ[�}�\t���>s�_C��,�x�s=��2��z���2�A�P�����U\@�ix�a2J�-�A�����w�ӗ�E��{`W����(�� +�L!�����%�+�A��}��Nw+G.&elX�s3`K�D~aLɏ1����f�U��|�XN�r�Q���6,���.�/��c<Jkġk�lS�Rm�p��a�>f��� =�����[ޱX�&�+v��n������A�`���TJ5[H "�;l���Ը����ȭ�g8z�1�IS�;�V*X�b�0�&#+��a37���~#�ssn��Q����;�$�T��"#�v�<�Ky,�,#� +����\EB�: +�Y߉H>���K����K%˗TX�o��K�/����0 � +�бe+�;��+(y��� �kP����po�n?�B0���h(��Н����Df%);���2�|��Ԥ��+�嗼��X���Ń�&�E�b�h�C �1�.�{F���s���E廒�A��Ge�O�Z�]_A@p�x�U�sd]]T,�����]���^��wj�g����������S���A�/����; ��bb�u�Q���o�2�L�NF9��y�gbS����=?s�����:��= ���+��c����Ns־�G�O�'^zs�s�^��'?I���s�/����ᮟ�����:{�HE�e�f��[r����N!�:��U)����&�~bj��,����A���q���8�4�B�̦�/�Fz��������NH��,J +%�I|��R+�w +b��wgd�@�˚�D�g�b{�@�h��)}���b�7���b�B����\_���YPxw.�q +=����R[l��^b�Bi)���YB����,��\�[��0dn+���{�zܮ�%��f4�(��>mQ)��"9���%��@<U.�y_�< +���^�Z�u�o���7�6%���-c��&<D���)�2���x��������,�UWx�M�A�[��9���Ơ��՜�}ɂ��x��s�K&(� +jkL0���'xq�ߪ�c�$��J��Ӿ�/���������6��?��B[ÌG�����q�DDIu�m��K�<�#هK��qS�#d��EQ�U�/a��l��̪壘#:2m�v�z������h�VL)� ���W�h] �BV`v�K[)��*��L��%��Nw��[�c̮��x\u +N-��>#�s�?$i�u�@��o6F�a�x�k�8�y�jɍ9����.Þ�7.�6/ �v����.��bx����g���Ϡz����Ϥ���O�]z��۩]p�����x�=���u�}C^�^�o�����^�~����Ң��FԵ���a�L�� �e'`����j8s�����lʒ�%��� �ݍ��3�~e�k��pJIL�ץ���[0pCd��*qk�WWq. TAQæ�s{�ڏi!+��yJ�Ħ[�;p�$�J�6��n�d����y�SQ(�лP�K�B��R/�e6x�[�%+�**�¸��Y�9 V�_�k��6j`E�+w��,v���g5��>�臌�P�.�h���j����̹*Vy������x���=�]�q�`R-xaV�k�m2�L]L�R�}�m���Ơ��nw�Z�iU�P�Yk���A�̢jH"�����9�m����i]E=�%AIx���DD���@L��L^,q�hL�%�}�b�E��_�й�[��Ć7[. +���2M�H��M��,gQ^Y**�唺��sI��~b�U���#�7��`���e��Ĺ��X $>òL!~@?�M��y/���Eo�q��E��w��.[T�q����w�KN�j�1���* 6�.{�fJ�+�DԊhn8���Ze�_��]�Zb�3,���{3��Y�������w���~�}7��E��_oG����g=7�^��cѹY��OG��U��~�����+������Y�_�=х�]&�8�V�p{B0�'�'İ,=�nYʼ�D7ʌD�0Gi�L]�+��+������}j�RX�� �&�LG�#Q�IF晕�Vs�c���c�A,x�;�'v�dqJ��n�L!W�P��0^3-��5c-`�cA�İ��;���Rob�x��>u@���b��B�;��<aL��䶢 +��x���q��&w�-�^e���.O2�*���c��4�������J�p�b��B�3 D�A,֠l�ߘ�0E�awUL��7����F!^b�� �L�V.c�7\N�6L�H���+@��B�����n"~e���Z�є�ez����*Ңs��,�w��馢�~.f������'�0l���X��_h�u��#"����Ħ�L��b�[H��m�"���}�%�`y��3R��+U����y#���ȷw��hơ�/Al��Sf)��A*�+�# � �D-7�������[~���s:���h����C��T{RP�e�����������c�}�8�W���_��q]|L�����g���M���߫�^���?�������3�����J��a�j�y��v=��H,�.f�%1�K`w�OaMLˣQ��iO +'ʾ�J��eKU�@���w���UGxP���㠈�xw���˦��n�^�;��QH]�r���:%���"�i���m��b��i�*g=�өU��Q]�X9��L��f����n# ���䊔���"k[���'eۓY��� c�v��7��@j�����"�� +�������DKl�j�*bK�Ի�q<�6̱����� a�fZ���E�ff*�%8��Y�kO�Z�MK��@����y��?�4W��l��_���9�NJ����VXk\��G�w�i������Fo�X{���n-���rw�.��l��%��fQ�� s��*���_31.��N�b=�*���u@]��v +_0ӉmT&���j��[�A�߉C�-<�K⃀s(��=���e|�ڶM��V6��݄IUI���x E��.*]!���|ʥkq~I�*��/�}�����x�d����O�^�%*����uS[��W�Q�˝B�Ʉv<�n:c��<�8����tz�zZ����f���:{�}.;����}gVq;��_O���^:w����ק�C�}�_�>����Q, 7���91,M�����J��b����u9l�(/c�B�\�֦ n3�u/��@A���RCo2�7zv���t#f�1qMX��ن���J���9-�������7FI��/�?hP6o03y�b�\Em�8�&i�0�N!��s&H�twb�DEe�sX l%� �o��3,�̶�Ԣv���̳��<��zn\��cI�� +�jkR���N!��$�m�-�Ȍ�K�6���!������{0����MD`�0�ng`�b���P��̴6 +�̡��UD9C��b�ٹ���Gx6�P�iTD��J���@�-��B�T�p�GMJ�W�Q�5����(!{C*��>`���-�º$;e#%��ŷiC�k� +b%n/��g���O�hVF�Q!����t���0 /w�������p���=��r����\�<�c*�� J�1U22e��*��Tw@�����c�T4�d��`Q�T�!�e�z�"n��v�E\�^5-Ɯ!�e��<(�w��*��j�N=OOע�W��z3���g��9��Ez}��:y��%Mo��_�P�%z����L�y����������>}������5�qr��*��������Q���MM��C!S�0���������_�(�u��MS=�P4�xe��e���ى&#��]��������> m��1w�aBXL��|3}{H�ߺ��1DŽ�;�5㳼�}Cb}���f)��zo��lDw�b���\�3T��c��T�7���2坧��i��\sr��<��i�o.fM}�Q�i08M��Z)���{"�d�=��dn��Y��\T ��-�qe��ea^)�K�m��=��0@9�#���0P��eta���wG�����"�� 6����u�'�8bᶲ�S�A�ws�22��7��,k�tc�B�DZ��2��w�����[X�V.'DN�c9�����[0�۾�K�g��`�`ŹM_.s*\���._KzmN�3��f +����2l�D[�=.��9�V�/(�%� +ˈ��n�݈�x�R� +�xv��������qj +.����Q�a%�%�W��"!���H?u������������-B�q��=���ԏu��\*��eh=�����(���{��pZ�0�^w._��}?Ϣ��8��3�4}}u�u��]+�q���L���?]w�ǧ����5��ۧ�������Lz��}�N��|�+�s��q?s�N<C����Y ����(S��Q�/:��0(�L@��W����pG8.�� +Y +R,:6[���Dl���&�;����-K@���E� ����$W��hH��G�4״̉u�N�#E���p��a���+����<J��M��l�UG�y�L�f��[�;M���a���^ľp�Va�f:���E�&�L����W1u4��L�at��L ^H��U��*�%�`xa��P�<Ce0�J���B�rJ����f���:�� +�AR��$0�꘨B�I�Z�/S���@̵L B�҆hL���yz���-���V��a�s��91)f"n,Qp(�pJm��*�j�"��C[��k.C��i�����1_h\p�,9�k�Z>�`u� ��̲���A0Wt��0Cs�������u�R�|M-15*W[�����`�q��@h����8��� \|�x��ۗcs0uS��PO�a���F{�-]�'f"_u>�g<nb1e�����D{L�UKz\b����ԯ��]����nO +@ LBo��*9+Js +����n>.aq��yRd��Y�R+�m��hB��x�s���Ѯ�����S�߿��s����D�X��̮�:|zw��}F��}9�o�]�&K�k�s־�����z�Nsm��CUe�Mև��n�r� ����@w�Zq�\�؇~F��;':�{=�, +�ZF_����''1(\?a,�>���-�ﰟs<w �)��p�0�[�eDm8�w��33*��s2՞���:y�����o�D�W�%���Ibx\���"�ݱ�lH�)�:��d�{����)Q���`��@ڌJ��i紻�!H�M#L��Ǡ�J�*�9�Y \�˳}Z�mI������M&Ŋj�7n�Ł����_;%��?��SSa�w�`XaI ]fi�6Sk�EIz��fNG�[���w�Qq+� +^c���U_}�sȅ�t�uW�^�O�,7��A��T���ů�YH��pB��USm�nWf�`�Á˂�g�ٙ�-nQ ���� As�[h�p�Xks'k�牦R�,�Q��,�)�x�e��z�0S&��s+���(���_B� +�>8���B�MU��}�Sݘ1�:0���o�s�v���-�&����e�Uf�E�P������r�~�a�m�O����4Ĺdj����� /��DUa܀4t�!Cܕ*V���Nz{K�������C�������ϫ�y����'�K���O�_��o�1��_o�=�==�t�t�8�<����L�K���nx7 ɕ#|���2�`�b��(-sLj#S�lw������n��b^m^��=���H����5��� �ѯh� +;�Ix�|�+6S_)����4P���8�}��� ť0 �8s����̴R��ϱ� ��^`,��$�x��� L��mW7w� �iF����q `��o��Z{�i�>��W�2���w+v�E�tQ5����$qʜ�M��./P��"`��(Po�Z`�[�(k�<�|���"�1 +����Ou=��..U�%�B�]��3�E��)���r�j�l��y�� +��J� 73�ƳP�������W-�o~�̋�#sv�f��Of'vы9��F[����e�,6��, S.p�~����M$hi{�����~=��g?C�V�V;��J%Tm���,�&b&g:��z�T©�#@Em[��>�:O�5Q��ny���"1D�����.]��C pe�VfZyD8�K��{Fܜ���َ7cC���iY�i�n��gx6���K��6P;<�V`��������_@����c�zo��&��Ng�i�5���އ�}|ϙ��m�<�����������C���|t?ī�]t�)���-�!~� d�n�x�-`An?,���4����~�� +�����Y2Td�N����M������s�U����ٖ62�����e?�D�� +�]��v���4��᪬����;x=���%��n�&=�'�G�"!f=�v\���۴��Y��^em��-��+�F�\��(5����ޠӉ�%�� +��}��Y�%��7��Q�Ts +�:0A���)�H��c)ȅY�ҽ*�q��$o�� ����&e���];֟x$�����Cu�sR�>��T�)%�����5��{q9���*��B���o,1*�U�2�����Ġ��Jh��E-��ԡ��2ò�8Y�9���d-; +���*�˄0���D���#���ġ#�y�;SqC�b\��0uU��p��<ʈ��F��{`uR�7�>�ue��ꡫ���1tMp����(#�/�{�zΈP����P;�7_�PSb�Ժ,�wn�J�������j���U���*�VB2��t���(�V�p�����k^�i^��BQ���[]��r��Q���?�8;ŗk�S�==��~�f=�qЕ31��_���{�eN?�������E�Tf>�q�=5�~�]3�z߭�nWN/�~�x�������^�:[S��b�dL�=���a�6�9h�6�f%.�a�*3�wy�p�%iq_�U_s�e �. �!��-�a�B��sl&�+mn����mw"B��\��l����F�8�b��eհ�+��0�����X�V1Woh����[([Za�����B�f`��YO�+/�������b����c���x\�3�3pP����v�~e�y�`9��.V��1�p�Q�G�5t2�$� �I�iĹs1�EP�R�EjKV�2��AY5-��21��0^n5������� �K̳���e�{�[���{��D�e����Av�Xx\fR��d�.�^���x�F�g�24�5dh�� ��_�3м..��n��ĸ�ߘ��)�j4X^��m�15��J�vw�B�{B�k�IJ۾!���<ڼrF�V0`l%+��L���WP1��a�e�牀��Ĥ��}%^}W�Գ�f�ya���r`��i�3Z�.��C��k��Mƛ���� ��rk#����TcĤQ�����m��T8D�&�jrǢ��OЊڭ�7Oi@~��,%���el�Ĺ��Js�Uߎf�㼢��Q�ӷ�{a���~�����ǣ}<��Dƺ�t:_�^z=53�?s�G�#+���߭K�z=�9�N�59����GO�/��\K���ϯ��Ŀ����8���E�\7��fy����"!�xe�-���A�q+�."�?�\�;Cq[ ��Ħ%i{=�u +������iy�S�����, @��r�fS��85('o�d&�T�V9|����GHX��C�� $<��w-�8��j�p0L��?�,�7kȞC��d�z`�>���9�Z7��{L��w��k%QǷ� fx$-���H��+�d��t�6ٓ,�1H��\Zaw�R�Q2�����|A*���?k���n������Q�a7v8�������D�%͛�D���_3�����T"'��W�.����Z&n�[�`5e���OF �\G*��U�A����ҥ��(a��Z +��P2�3�Q 0�Ȳ��� b�r�(n?o���)���q�-��-��J|�� �e_�)NM{O�s +Ju�8�0"b�bq鮼G� 6��z�֡H�.:�.\��İ� + �5���&��>"#�<2�s��q���;M�B�O��.J��� ��0F�0���8� F��o��2qҌW}B�~`��G��/�`��+@@:��N>g��0$��ሄ_p������j�Q������ڻ�<�f@U� R�=|z����W��]zk�<�1���ǣ�����}>�_��i_K����}�z1�I^�goF�?@����������~� ���}?};��3.Y��gi��"�N�6u�7��Ȯ��fZm����,�.uR���x����1N܆��-�ƞ3 @�~{Ŋ��>� +�y<��)Ȕ��\g�<�vW��/Y�&Q;��#��+�)� .$;!��S-��*X��1��ޠg�a�D������1e�2_�>#��?�x�Z��,��UY�ō��7��(��/0\K��y��Vޚ:Q<��4`eCHq,� x��R�0#*�\��� Q��!�CG�.8Es+1 +��.�h�λ��s�XW}��e_���nP?�Z�v���Q<5,�U��r�q64Cgd�]��W:����<��Y�9����� ���g��M<i���h��BZFWV�ASh��Y��rU/��Y��y�]�1˼��_���U��P���p#g�[}��Y�e[ν�p*�<M�����������˹�G˞��=%����a�(h�c� +uAZ�d���nU�=4�94W�Q�T4T�pr��Pߋ�����8��ٝ�P��*b6����-y��TV�C:p?�K<�& T��mT�֍q���2��\qX��]{��_EZF�̱��7'0)KM<���-px�dت��c� �*���e���UJ,{D�+�r�e&^>ѝ��k�"�)����.xh= @]q�.x�W�?C?L�ӏG>��:>�����>�t?3]<u��T�N=X�������>�z������x�^��������F��tl�1��c71�۩W��NM� +�ľ!�S�����w�Je�b�tPP}�@KPqt�l�m��^�M�d��%�9"Cv��v�%B��Es5T.�Ljs��-/�� +����,E6�)Z�)��V�&s���x��F�)�gs[�IJ� ���3KpV"�?3>�<�/��q /�g[��7��8��7+K?�y +=�Hrt)Jw +{tA`�� `��6d����)Э�&�vC�v�-X�����G��1�b7�Φ��l���J�䙽�U��7)q��W�f2 +B��;9�W���G�=��SF�D+�/ǖ5��R؛~a�\[-�Ƀw�E�K��н}ɉP]������Hd��y�I� P��H�h�>��d����7NnT����r�� �ɦLw��ӼO}q�*�pq���̧�N���1�{�7^#418I@�SC����8�J�JV���U�P6&�V�8������U���!�xS�,Y)3���c����i��-XR6x�Du�T$��Y�S�� +�!v��tu��$FOp� "ٯ�XV��CUbqE��x(y��I���\sP2���f��� +g �BZ��Ox�k)1SNC ��}�`�t�{��90���\ǁ�J������^��-�L��.�V�0=�Ԩv^��ʲ�@B]u�W+�c�}k����Mf_����q��љ����ҧ�}]=�ގzb�����>�z��<W���3�������ӝz�G��=�~:{}l�zb�C@��K��wy6E�U�p!�:j\�c����V&x�+4rL��^x�Sj��1�"e�v�e�N��%JX��8{�SVT���d��P�8$��� l�YG���5i���j�������D,����Z�u�3*�ܽ����"&or������j4�z��\HӸ�놋��G-qɾ���QdԦ���R+����5'DL���8R��L[�a�.a(��@��p����h^w�7����yc�qN�����w������.����!� ��a������DnICn��p ��F�*��B�v�������3���Խ��4,�q����@�BeRYLj`Os� +#���lj�˩l�b]�� )�V0gGhи!^f�7�[�[�H��v�ۗ��ܢ��)}��m� vą7���C-J�X��J�@{����z���"�A{7�%�-| %�$eG�(\ 1�*�����Z8<w"��F +��8L<���a����\i�|"J�͂� +����-�s��a�v�K�,V�6y�����B �p�1R��l�F�x�e����i�lw�S�⋧(��/v�ĦG9��!N���NN|NЭ"2 +�eJ����2�Z�(қoa�asP +c�ˤj�� +�`�.��0^ F �̲;5��bH5ca��8�ߟ��.��¦;���>����M�z��>�c�\���~���3/�{z7�t����ǡ�����zw9�ף�~�}z��J�G��^>�=��~�g�n�xh�"�U�.��`� $\�Ly�1L�B*���(�|���_�k��aed0�46)�����N�P"�a�(Qa6��eDUF��^�L�F���f��FmQ�����L�*X�G$��� 5}�Je���#��3���q���p��#��[[��q*ȨՖ�fĖe�0�*�Z�3�`�~��F E����� �a'�Ĵ}�=���E��)������h�b%�J���F1R�� �e#�:���d�*���Xb2��1Z���q�b�#,:�S.�q��٬��!��or�y�̄ԡ���)�2�Ey��s/rR�=��8���[#,م�+�������t��]��>���=��v�[_�74�!2�;y�;�����)�ebb��,щ�`�j�2�E�C�S�"n A\�Y�`�NoQ���� �Uo�m|E��ti�0h�7r%����s�J�W���`�x�S�-���A�f����-9�Gbq�!G>���Xrr�L$����!qq�5��d!����hl_�B�6��{�]�0)��P̯�Z!/}�3�#����R��n�O�_���ςq���-���TݍP��||�y��B�<!�� +ԙ���+��}�m��ˋl] Lb������͊6�F�2uQ.��0�K���Si��C�0���0�����w����j��z5��_n�����f=����z._�Ϣ�8���ӓ�>���ҧ��/���c�x�1�篞��>�:�}gC����^'�=5*�ҺW�����+WO�e�`�M+#q}��y�*�����������"���p�D�X{��J�Up�w3^қ�/�hi���m��Z��V���C�m�po�&�m?r���,�gN�0�{v��`U��<���c��^>�8�1J��Y�#X�,Z�Ť��f1���g���i�{�� �7�Eo� +q�$��o�rY��K�2����{������ +jf=��a�g�Q�e�ü+ �u��Q/��n�5�e�v�ėz�-���f+g���_�ʦ`>R�_hp�CL +��g��S&pq� 7�f��CLü����=ՂY�R�~̣�Fƨ��!LBT�Q�1�H��!����}�B����-�A\��*Qf� + 9�wB���{���V~}�Ⱥ� +8�B�� ���Ye�\����@�y@ьw�Z��L�狔@*�����x��Qq�/��ɷSc�WP(�����;A�Gh�h4��4a���iϞ}��p�A�QBl9^Gh�����Ϙ#�V��H8J�Xi�zƱ۵@Ԑ�}�+����Qr��. +s��Q fC��A@��u��R��_yF`�^"��6�q �V#��F��1]GI`�d2*&���!�܌t|!���`_w�ݷ��X���hn&� efY�nj�[&B`x��e����mj!�s�G|��̅����q֥u�_=7��=+������9�R�W�g�����7=��=[���w��L��ߧ_K�5���T�?A?�� ��S�ѕ+�u�EN!��A���%p#����J�˼%Zٯy�������ˢ-�=���/��Y�B2g�%-q*�=���Wp�̢ɡ_�e���e/") ��l��x��#EZʳ�L+,w�p�8v��ؾ�c�_�7�5�p����oi�o�X����@�C�{TF�0QU��DX.�K�yHW�D+/qlJ�)���U@��]�x��d��6�����`�Z����D�e�1Q�����u]�w�p/G �n>�\�?�B/�T�9�Hķ��ϙĝ�3����g2�����������@-\)w�Q�g*.��j�������;;C���dh%�7.�Q��cf!F�<��bf��|N^��Df�7l��A���8�ʗOq�����rw<L'ji}��˞�n���w��ώ`�[��V���4֫1��Hd6�1���f�P�v����䎛�����{x���}�Wg�\�} �7���E�A��.�.�pS&�R��v��|�5�J��E\�4�n�O?�[@��hY�A��s�ٔ +:^e]�w9����fy%�w�P_m�ኬN�e����b\ +����-�G��N\���B�]��P��0�H[�(o� ���(����5 J�������(���WNB�b~P��W��+��]�He�-��Ud��n��s��Q�h8b�q��x�P� ~���hQ+=�b,��MH�`�Y�3dz��^&#�:g��gӞ��c�>��K���g��J�^�to����q9�t����-����u�Oi����㮡**U�J�*�R�Wy�WѮ���:?��x6�x���k����/�-�cJw#������{D�8�6}�C�ߛ�aZY�9η�Gd*���1����~p͊y���YNh����An�u��NPi�P� B�4����%� a�x�Dw�DY�S&��M��Q*Xn�C{��|�-�S�v�#�(h/Q+�J~�GT��߉c�P�C��b]�&��ǿP�����ac�+�L���!v�>7p^��@U��,��1����P�f'������`�����%��f �Sy�y@����;���y��<?�K�rsİ��Y�����3��E�A�}��ne�*���'�U��Q��:��`4yk�����RT&�U̷QUQ�\�)�A� +Îѯ��h��Mp0W9Ik�A����q�J�`��î�͟=���`��6``��`V���(��rqق���#ӿ��_xF�-L��e�;E�{��x#��[�P���" a/�.�8U���Uj�]��#>ќ����ywN�t\ن/��#��A3�j:1tӟ�RЙ[�Em�)�^�fe�$�!wa�y����Q�w��Cᣢ���,/�2�ÍT��Y[�]y (M�H���)��fB���Pg*�hM���"���=�T�k��@[�b���ʶ���R������� ZqeE��Zk��5����ŀq�$�V �]�c$1f�Y���>��U�=u�3~�Oy�y�~��{��<=9�N:k�z��}Iǣ��z~�q?]3��Z�_i��z<z���Ǡ�R�J:Q*T�]*WJ��:c�*�6@C��KW^�w�"ު8.�c@J�F�-r�����m�h�9 ��W3ֳf�,6!�� <[hLTzj��|B� �� +�8�Y���Ǽz�n�����3�Ʈ�9`�p�[_��2�)�i�g�юH�X�W��U�\A�f�c:��=+r�d0���f�k�Yx o��s7W%����oye^��K����"� >������8�N7�5L�Nb5�y^8�50YĨc�K���w���pC����@��4�3��cr�̪�7��緈��]�ơu(����y���C���{�mXg�%J�N��T�{��iOK������W�3Ա���D���/1IK�!9���Z+�T_yF�=�}��^�#���h.��5d3Z���a8v��[7R�{j"�d��)����J��j��MDa�1}�D�4���Le�Z�,k�i���q-�2���}<�Ox�"4x�ܮg��_{��.KrJY��SL�qx�ʩ�2N~��?(v/j�]j,���W�f.�X.�V�Y�����P���2�V3��b Ic�{@�`�#!��������<\ʀ0�092���(�v%��&V��w�u��0�P4��^��Θ6�8��(ڝ�UA��h1�������*9Sq�����j +$}��1�|G$6s�Q��U�/LE�t"h�P��|B������R�9��@�y��W��^�}t='_2��+�z=^���q�Ǡ���z��o���5�G�_ק�3��J���~��w�_}�s J�*VeD̩Q"t���]3<��?��t�{ʩN��&ɖ;TK��������|KuV@е�UA#�[���I�b*v�v���Q���h�#�z�����*�L�`I~OQ��}�Ӓ�m+E�PM/��M�)�����P���ƈ�f�͊@w0��Z:>"��c��bW�k�J=�*�Q^����f��&�E��rnk�T�c�ƣ8��l�NfX�x��T� ��������p���Ly� +��W+�ħr�,�tq�aĭc_�b����WX�3�҇������ݘ#�_xY�0k �;���j�����[-�9�vFªnS��K��,����S&�w�e�����.5�Y`2���s��Sxfs*��{K�5����p����üpn(�����ˠ����X�Xr��Cpk��+�-qp�2Jg/�l��HX��3C����59"�0ܲcpWL[�1�����}��MiC���3o�����2]�I�g��vV^�,0��H�rw9�����J(����m/th��p*}�������4��W +����r�|�F�,�\C� }��Z(w������/x�j�]��R�8��3���qp���]�A5^�b�(��؉2g�x�+?������'��9C�����\C@ ]1I��PU<DlV�/����u�mw��]��]��Nz_Mz1<}ht�����篟Gn��q<��=1�>���G�-�\��J�������q�?=+��k�J��VP:+��J�W*T�R�J�*s+��R�J��C�fbi�@�w���V��CV���zj�ll�DB����v�V��\-��J,��t("��ط�J�� +:~H�.�h(zP�A"��r��FO#;���N�7K~��wuzW��AN �wGJ�G���,����f�l0�IR�L+��4kɗ����ܴUB�&ox��4�.�! d�n*�$��r���] �O�.=��r�r*��Z�|AW�f,� �� +LD�\Vj�<���ɿ�Tj��5���1[s���J]��o<���h��ML����G�m�o�6C�p��W`��J���yb.�s�R��*��0\�&�1<���楂����� �hِ)_��}�9� �c�K8�PJw�+@8H�.<��Ys�WV�!�#A���4�c[`lb�Z�o5[v��^3�W.;����y�`f"b �%BV��-��>D�����E�F>���eeV +���?(.��v;i����2R�R4� +䍆�-e��W�黍E,�7����6�c`q�وa��Mf��мp7���oz��2���1yU�h@7i\�B��iN���i�,�����Zc���6�Ǽ�R��di���*�E����rw�T��if����I��3��>���4�a[�z鸍�o�X�*��=�*��͍�]G�\����1������+��W���z����ҳ��LW�����]+3��L�{bc�z�T���G�Uz<tϥ�]1r��T���T��q*TH��J�*T�R�v�*�J�(��J�3|J�JLj�1�%Ԥ2�x��V��x���{L�U*��Z���2F-�p0��(/�v���� �i����>�M���J0`Nf�V^=�X�y���֯%%Ce�K P�76͡a]������62� +��y"��K�u6���<ܷ�(��9mvHW�2��i�?��<��U�^bCY�X��忸op1u�k�՜ŧ�s7�� +��o�=�eG:�^���g�.���+���\r�aX嘗�2�R�e�3�S����+p��UTD���R�����+����1;E��F<��D��ƾa�ũ�봢ㅦ�����dK�-�e +w�-1�<å[_iM�P��q�[x�� ���`���ЕV��O2��1D +��m��q�6dz S-D_�x���h�)YĤ�y̠{����ޥ���N��<�s+J�����k_� �E78���Į�GԂ�����TAh{JX�p��<���^"E��Z5pJ��S���v�P+3M��ZV�ˁ*�r�.�K��� n�QI����!4:�.|�.��L�P�u�����>�**_��VP�soh=Rh4J�^��%Wu�vč���E8�\E��ZິjP}ǜ@�(�l +�9D �=m��-<[�+g���{O�d��uj�(�䖄��#Vf�M}�_~�8�����#ֺ~:\�>�>����_n��WO�~�.3ۮ:�jy�c�?Ϥ�J�WO�>OE�k=��ߦ���Һ*�J�+�;���ĬJ��b:�+�J�+�J�� J�J��_�R�י�T�����(�f��34��+���ӍG��kP��;0-i�Bow{�՝�c��QR�q̴�Ľ� +��^��9�-2��vZn),� �c�eqA�W�l�t����DP�aV�<nM�eC�K�NӑW��j@^~'c�����x�������q���*!μB!%���-B��U�Js�5w���`�qg��Q���h��_�:y�Wc��cK\�J�������|Jy�̩hK��=+����gy|7*�����e1�7p���ԩ��{�U+cqQ��\�&_�&�E���� ���i}�H���\��`n�W�X{��{��ڮ!IJ�D�qGaf���F�O���̳��72V��^�0n�Ù�7E�T5����j�ᔔ-_?iJM�m܉�m��"ƻE��*LW��%�U�^&N%�x!ZM錌ӣu +�t ��Ur�zS��Si��@��N�@ �^N�Y�Z���Z���2��ܪ�K�Yj���WhDLn�_.eL�u +io�b�?�\V���HEhVsMX��ٔi�01S4�i�\���/>�3�� +�YeW$P�����.J���3�?#�dA�N���[w�5�4{1Щm���fQ��+����l"��p@,4姳+G=�-h�;KV��Ծ�lCj�/�C�_&`;_�J�Ù���]��u�c�I��k��)������i�s�gי�^����~'3���;��B�WW�L����ߣߧ�Uy�L���N1>=O��������+k�z|ʁ5*W2��8��'3�J����R�TIX�*T�Y�:T�<J�J9���+�Į�x������m0�O`!�����R��2�Z0��<mK�����c2�p�!��.���Į���#�� ��1�x�ܳ����h�~#L�q��0cQVi�%ʏ�&��LX]F�'�+U�3���2�ir�f�S6qR� ̇�L0��F&x�������N뗘"n��fݻ��MF�i��c����#L:�`=�֦>��9i�e���hш�̷S;��z<L��Q��g�;AR�̠jY���``"&[e�~�5��T-��C12nt��"��&iH��Pna ��E�'cᔅ�T�(��J3\�P��#�ck�U��̪��0�{Е�Pd�/*��'}�M�Q��۳]� +v~!L5h��o���U����?D�%���Z��2���v�#��o>�Y�_"d4&�CP�2;`)N{1,m}�!a�㉓h{���ݳB5�9�W,�w��3��������frx�X�`bC�[�!�,�!���<�A����ņ��XUjD� G�X�� +��#܆���Y1%��L��-��� e`�6Q��db�>cU`�&(חf_m���|�=�/��%WFi��@=�ƈ���X�&"M���������,iHz`%v����"i���8�3T�O2��v��� (��@���PȜ�K�8�$�E�,�������뼫�\���0�ˏ~�1�N=8����{O�+ӯKs�_F�zLt����7ߦ����?~��ҽu�ѕ�x�k��@�]1�%q+�t�]3��1+�|t J�?�C����蒥J̩R�J�*UnW�L|���f��W2�Ud��+��q�����v�g���^W. �[��ݘ �s{����,(�W�l�j�EMi�yr7t��jr�6J8;.�1mM��f��y�n�up�O�5���X��ZbK rf[~e��c���9��A�VY1A&Cx�E�h�46�i�y�m�N�f3�1X�1��7�x��|���D��Vu��co������ ʇ�T�̮��H08�EdU�4����y�{���T�o�d���"s_�T��nX�x#�1ff̜ne|�k2Sd^3�����L��. �_�ɮbK�s�3��)\�1�r��[#���"n�d�E�Xs:u�c��0D�{��M�>�)`Zq��R�� ��i���W!���D�+g�<(wOȼ� �W�7Tmf�UBo�(��&��w�����*0.�4y�`�0be�ߋ�r����mb��1!����h� ���&m1�d�������Lk��b���Ĭ@݅#q̂d++� V_��&K�n`�=�naG�~�|H�C�3f�̵���Yr�9�cɠT��LA����-��Xg��F����G��H����`���5 m.�����5��8W'h9��w!:��x��8GP�y.�&m�KY0Å����3"��QZ���u�q9��(�"��'���ű�b�a���[�W +צ/�Ko0£N�dD��c1�u����/��=�7�뿧_�W��=��{t����T�C��J��߫��W��������������QӉ��_x�WP�%@�'��ʞ�?�!;�k2�؝��J�*$�^5�tV���*��D�5�_�V%O�D��d;�0�r�ڶ�e8�7����6��s��0��sNio�q�w?�a*F�P ����$q�R�x�3E��|˳ɪ��T�uت�v� V�e�N���ںj�98��֏���ӣs%�@α*��L��R�$�r�{���3��exd��W ~�]L���� ��?19bx��u0��S�w3��lfs;;��YY +���(��Rx��Y`�0 w��������/o�[���"7��R�q�9�'��FW?yIX�a���?L +i���]��,c>з�0�/54 ����Dø5�,�+����VV��Z���E�K[H�Up@ڞ�&�,�.�Y��A0s�nٿ+�@��(4w��2��x��T���HKbV�#�Q���%�*�j�J�04k��(�Cq_U6mZ���j鏉j��^e�T�PXX����5���YFF G�ʫx�;54S�и7��{t���Բ\C�&:�Z5j���e@�tc��w�]�������<Q��,�|g2ş#������[��*��Z�H�#mj�c�R���A�-/8! 7�Z��fj�<���J;����+� +!�^�sl8OhS�ǖ8hclj���Jw�5��}E���x!��)���ܖ��5�q�QEe���1��;0�;��שj�]L��SU�G.�7iVoH�ERi�L�.�@��Y���1����i�\U$,��a���z�����{BW�ǫ���*W�>�'�Y�7����5�����33�+���w�k�tܮ�*T:T�P bP@���Qĩ\J���m�W+�J�+�R�\�S̫��N�_x`茫�2����T�4� A�(QÈ,�w�����{�62�s��cKy��|APe��1�b� +�g�����BYɎPQ^��\�_9U�\��n�QVX� � *�̸�8��v�R�q�����5�n�N��lh�WZ{G�<%�� +�yiE$uʝ�Ȣ�9���E�3���U�^`.A-T5��0s����g0/_lJ���j �Q���$����}����yTj7�a�i���c˃�(�!���7�?�0[a��y�Jq�&nPΟ�a���������Z0Fy�e1�V%�2س�&E�K�D��Lj�%6F�� +��i}ɵ��1��AV�� +��^f8[X���,bd֠��3�`��������F�e�Nc5b7����09�3l_��4��H[Z~��Ѷ�+8�b�[�'s�,� +%����M� xiy`�S�"�w��U�4y������v���cwq��r��+k�{=�7����|˵q��IBÈ@�忈Pp6%^+��Z�yh�3L@�)o��EB��qU�!��b���Z��Ի0��s>�1U�G"��gơ�p��� T�M�i�C��;Ǻ1$�t��F�'Oyg���C�@�S��2��r� K�Nо8p��83u^%�t˜��~7;�}��d�����r�@66x�++��X�J��,��*��W�!(��J�q~�ܯS��zA�ׯ�AҺ3�������\ǫ=?��̩Y�����I�&c�:y���Ej�ҽ;�T�R�J�+��@��%2��U�p��(�(뮞ҥJ�T�R�J�J���X����*g�����eD�EԨ����5����:�o��|�G�Kn�m�.N�D���6l0G��'a�!^��ٔ�� +9v�{^�W�a��<��}�t-��Lj)qD���d��r����>�)����p*{q-��A�Dn��WP��iۈ7�j<�\�F�g LH ��״/�Q_�oD�5��8_�i������*4�UjX�z�hV���bpKw�2���p�f%�Oh� ���g��3 +F�{�V9���fk1��s��?ԭ�SU��f��ߴa�FJ�(��ģZ�/W� ����#�@��c����o�P���A +�UVN�"N�!�t5hb��BX�\-y�6�7ţ|�(�6���Blu��������1� ��e�avh���]�07g����8��mt���"�� +�[c[��O��'�yw�����*��p��C��[�JW����볩� D�T��R����x�w��ɨ^���0 ^e\�e�Z%u<�F�;U�@V<��`-��6���a50�Nڢg�h����r9�����ٴ���C�d*4\�t�s�ɨ�AL�WR���&';C�"��T?f� +l�iq�j�����L��y�P��>�f6�1TM��uW��V�Z�&c�5�r�V�A��X���e㘀�̝��NL5�I{Z��T<~a�˯��%N�h���4�p�R��{|�/�a�}?i�����3q�]3+�1֙�Nz�]z*c����q�ێ�Z����WN:�_��Z���z8�^�5R�WR�tܩ]C8�x%J������J�*T̮��yR���|��J���X��+�!^"J�JܬGr�����eEȈf�j�F�y!�U������+��� <X�0�j��!;��!i�f9�1aǼ��zB� +'�{'��h�x�����2�aĹr��FX��7�q�\E��I�2�.�`n���c�`�c��+��r����-�m��%��}�*{ÑkP���0�-ƓUwJb���Z5����/,���!��XcQҚ���^�Ƭ�6���S�q�*#���Y/,�/q)��=�n�S��8�<����s�����2���չ��5r<���3s�� �����Q�����ąvb&^ �(��1�b�x�7vM�}�+/���e�5��u����H�R�]TO��I���,�y"w\���"��{��M�]mP9E�ڢ���2�D��U<�ShQi�X�I�,�b��!�ܷ^Y_&V}����Z!˼.�N#�;���������Յu��S���f��6b>=��+{v����F�x:Nĺ�����x��.b>A9�/��F��w����C�Gt��?��JW��Z�� +q��69��x69���nV�l�+G���y�ڥ�+|2�r���l���q�ĵ+�f9-a�ᔃt��C2T`�]�g\�-f��ŻF%��@�}�n[F .�#ʬ^�� -�y�@j{Tm���\=�@;�~fc\F�,?����9�RVܒYj���}�:�2k�U����8�מ��W���13<���z������[����G��C�?̮�u���L�<~:���u�OoW�T��T%t��֥J`J%C�R��*W�b�TL���.T�R�*�B�ӎ����ұ3w�5*W�x����Q�Kk�g�U�w�{a|F�x�{�0̘A\h�D���J8��9Fm��t���A\��X��L��sۈQQ&�K�n�)�nәep����Ev\�s�B�(l��?�{���oCQ#G���N#Y �?�G(!Z��`9~{˘�4˨s�<ci�����0��R�B��Ɉ�y#r7{�]"`;�b��a+�_�2TF��?��[�`��H��x��̧|Lj�J�q��Kl`�yb��w�U�����(�S@O�U3^�̿�&��1��Y~!���V0�39�$^�������ᦦ[�u���~�u�&"sg�E-�Jn����~b�Oto�.ω�q��ǝ0��w�u�aƷ��K�����wj���^"����w�G�JcQ�dy-��T�Y�x�Oda{�KU�q�KZ^Tv��%;3�Ye���cm|rA�v3Ij�B/2�]6��_'�bbDn�L�w� +�2�@�Ғ�8MG��d� �6�_눢�M��Y� +�E*�*U\��cձ�1K�TP���̫���3�u�ta[ +ߓ����k�5[�=�6۳�h(��K�)G��{�0��è���.e`Xw� ʘ��A#TS@ +���؛�dH棉�f���Ϲ��T��y�t�����;]��B���)X*�W�|������V���=��Q��2��Kżx���~�G����9)���w��q��%���2��#������^c��nX-iWG�{t�^�=�ߢ���n� �:SS��>�t��._L�K �E��g�z���Һ3��鎸�fx�q��ҥMO<�����|@�R�J��=�J�����ʀ@�ҥȒ�f�ed��W��s�S+�s*T R��yU+y�����ey_�8��k�cq�̺��b6�E`�4jUzd�����'܄:?�������S|�I4[��Nb�-i��)�j5�C���+.�@���1�ıI�:�^BRdI��2�8b%;n"����5qf7r�/3Xn\+�Q�˘�6� +"�Z96��P'���c�!��l�q;E�-ʷ� s�Ɇ�e�'����3�^��.5�S��c�� mO0E�bps�8̮���#��{Jw��<�\�,Z/�f��(�����n �ω�� +ۨ���-��n w��w3��0����9�|w�{��Թ��k��.��P����?���|̍|�%�ώ#eT���������*��in+���7�/��(�n�: B6)T@���3I���-�x�ywB�`F���`�Y�(h�[�n�u����t��_M:# +,�/��5M_���w�1@�t���-sH�¦Af��|"�\��cuK���4hk�e6;6<���o�C'��ۘ?�1�����>�̣qm� +-����ʸ����y̱b�r{�X�)*�]�Cm�TQ����Z��/$�4��7��"(68���;S���y@��y��ӷ�����Ag���v�.��(F���{�u��ɘ �aN8�0��*[ǘLi)�^�^�A -�hX`r����[kv0����H����{������p��kX]����0�o�-ؤ� +�s�qߘ���%�˶�����F�qs��%J�] R�zq�'3}=�ҥJ�������&:o�~�zY\z���J���SۥzC�>:T�n��13���Щ]Lu%g�R��*W2�@����T ]�~`J��@�iR�b iQ�R�J�Vq*W�Wn���w��5��W�9��pG�V��$���}�3�����%@���x���*�E��܀�U��ʎ�^D|�j2�G;��@�B�y���i6�@���G�wx�q���E��!LlX��]n�t�m0�n6���Y#�0�Uكy�KX�t� Ƅ�d�Kq^e��f&�4�����Q����ٚw�\jԦP��R��c8�Xo��9�1u��c��A���`.� +�����w/����r�{J�"c5�a��6�Qr�G�\K7q��,q�ܱܖ]�-+�vj`��(������ �}���ًܣ�AΥ��9�K�8�U�k��a��5�e�x�X�6�������2��B�w�E;�7u� ��,���� ��8:`���*�9�(Yj��Hc��ZQX��h�_��� L��4����Y������ ˻�:�������6��-p[n��^F��]*��i��NW��Kcl]�����/�YC�?�Uj��3�2��~h%�S�V��G>�"/߂)��2̻�9c=���q̮�K|w�5���Q��Vb���\{&X�şo�ՠn��Ť�1wd�1x�� ����q�0�Y�L�ωOL��4y��b�TK�q\v���:�ϴ�R���1m_�8��D�����on�8�ش�JE,3�P{h�|{F�S���m�:�l̈́'�y*(�,�ۼ�{<B�.������f�7Z9�����a��c�^�w�7x����g$��j¸�le�mr{�USe�1s�J�J�Qlj��Ӟ�K�ֺW��W�y�����G���z2�'L��}u?�����J���>�~����~�z~:Y>ޞ?�F�WBWZ��q*��{On���T�Wxn��+=�T�Įew��TLJ�?���1S�S*UL}��/��%߈c\Lj�s��?�����q��<K������.��̼�\ˇ��rVV���Kŷ9��c����v���Q�ut����#>ݙ�3�1��� �)�8l� �H<��;�� +sY;F�D��0}�j9�1E����%dT ���ij8\ ���ϙc�ܓ�e��O��c��L;���̼D�m���7�0�a�;Jt�_o��2��5p�<CX�[� ���":b9�yg�yp*��]�f��� +��y�l��Vc),�Q�=���J��6�M���w�y�\�TC��[;�8�6���<�Vx���(ǘ�����D_�8y︻O�@�]�䨓p`��Xi*4�����Y�5<w~�- .\� +�~�f�Q�U|��L:����-@E��q�|ú���$IIBef!��2� ]Z�?����2S%l�24��EY�Fps�1b�@?�]��wm��0-��PYJ���˻ļ��!^�6v7ޢ���a]�/�1G�|n;�����-e�Z��J�:��y�{�T�%��*W2�����Q3�]%��_x�R�|� `����3Y+�oJ�q�)�����/cC����I�n��e�Z��U�w�� +����"� ��p�۶w����û���(0L{dlN&.��`��y�P����$�n�㥍4��G!�8�N8�����8��R��b���i� ST�������4Ax�}�N�.eTBJNf�t�R�zk�2�Oħ�Һ{�;t����ϭ�S�ǣZ�J�3�O�J�N&!y�S��z{��뎀u��һ��Z�G�W��s+]h@�@`q̮Ҙ��;��ߘ@2������S���ec�������Nbt��}-s/����T�Ǽܿ�1e���i,���~e�e�S.;B����a��-cO�<D\������,�� �<� +��h�ګ�1\(��@�h2^�(��L}�(�7r���`�����خ}�L&ȐSo�7���EI��Pፂ�LR��D�<�� 3�'��xUp|�2���0^Vw�c�i�3,��w�B��0<D&8�c�8��V�)ܡ��+���T昫�!��Vf�5g�>�~`�L����9l}��q��_��왛��qM^'�)`��[l�<F�_�x�J�8�״�D��:�ry��)��{��5���F_x��B�=�_t��X�6�)���X�հ#��9�E,��4j��$F�@"�M��E�`w-��s��9#�w�����i�]�%-gHR�s��K��V�D�$7�����8������-kc�e�����JY���'!I����Z��Xh�n��.Ԝ�id���L��y��P�f�le݉N%{>"���!�"����(�p�hy���:���5�H�)�uA���f�=�ל�j�T�F-Q�FkQk��o��(jeZ'v�0���%������̔g�[�g��x�,Uk�U�f���@r�ѢR�Gn ���W�j�[��<9���Z��DP~�ׂ_}NS6e�3�c�X(v&A_`���0�R>�bBk�Dn� +n����5 �n��b���k���b�׳��?ق�q��|d�����<�s������ʛ�I5ѕҳ���T��1���%C��:�J�~��ּJ�M����]+��Vet���Q*{C��*~'%J뾞zס����N���f'���һMt�X����P>ex�Ӵ�����pJ'9�B����es1�2�G���=�1��~�be�^'�s���ne�zY�>e��=���L��Yp�e�D�N�.��3+�Jc�@��jP)�DFio}A^����C��; +�w�NoW� VZ K�c�[�0v�Sj�?�L�SK��\R���S������y����t����)_�'����i�G��"���+��sUr����������'��_1�a�q��Oh���5�KG{�a�n�����s �>�k9��bQr�2�W�|Glb/x�����������D��K���=�x�p;��-�]d>b��h�����.�i]�oh���Q���Y�幎u�m��Q�Ǝ"xg�@�7J�h��r��y�5,{�y��Z�9����̲;��`���0�cg"e��7-m�Z�`��� �(���k� ��r�L���d1���d0NWO����k̰<�C-���u�Z���f�v{�U^My�io����Nƌ����t�=��p���Y�w����S�'E����"���7��`�4�$�y��[�Cv���/@��,�% ��dd�K<@�p�m���:TJi�؈�*q8�J����8}�ǘ5�P��쾟�����G:����cg�'x���`�!���[�a4��].\���.��"�0�,���=�]B�J��d: �<D�U� n2Z��@p`,FR�n�1�J�ʙ�0~�m��ɴ��v���w��hE<�B�v���J���H�wq!JL���ۼ`����&��d�}�À��e�:x�����\����J�)�x��1�j�=���}�'��+�Jĩ^���{t���_�ҥO�ҙ�g�ӎ�MJ���~�ƹ�fz�WJ���T���G�@� ���\�֡8�@�����J�+�W;��S��W��~g������Mq���Y��t��3�Cs�?��t�~����!�"�S���]���<�f���w|K���M��0%Z��~�[� +c剑��3~Q�M�%+������+pw���n� +�LE��K��^��ⱦ1�H-B��x�k�����LFKe�@or�V\:�,hI���� +)W��L��̽��#9�$������T2�3XH�m�0g�����.n�������ѨaP�>`���9s�i�?3w���!����@�6�����f��-~ �'50F�ۦ[��%��{f_�x.q-z�6.S��0�s��2lj�a��a�܍���lh��YU�x��2��^�K\x�c�;��>`�T]�Ѐw���%���������ȶlR;`㙠~ tr�X�u0r��n����-QY���Cebf"/s��Ms^a�6�=�[W ��x��\��P(��0�s|x�P�V8UA���0o o���b�Ҟ؍l״l��V|�WC���p)xx����fW�� ��`������47,_�F`p�TP�0bg���5su�d�bیJ+���;��fz3���.5��q�\cڱ��@�!YwQĶ���[n>"��8�1��m�`'��YK�M����A�\����+�B��u��Ż*r��� aYU.퐏 el~�#p=��T�ΡXst��$#xx����P���l.�%���1O��nF���Y\��C^�O�>��Z�K�X�ı��B:��l^}�8k�*�V�J�+��%��� _0���*FKϯ�̹�=�*3ǡ�OC�t�R��V:Tn2��T��ҙR�t�P������\�M�3]3�={����P���_y��J�J���=M�zWL{���?�9� OB�����Lψ�|��*{F������?�qe˗����,�3���1��gj�@>ax��@#��-�ϑ�=��R��0���@�g|J�3�����-�{#I+�<JI�����L;���Xx� ��)mø�.�V'���n� �����4�NMŰ�b���-}�͔=�p���Wf�EY3�����>�Hܹ��L��g�eHQ��f_W0"Sp��E�g�(�OH��S���-f#�,�3���b�$Llj�iE釃�5��[�a����r���]3)�k���v�X�:��6�B�[� Ǻo��h�72�n�f�c؍o�B��A)�� ����Ե�3I�Ws����s�7��V�K�|��w�0��pBR���d�e�%e��mKn��׳�)��0�h�� ����[)~!|������S���|��_���� P�v4�4��(���� +�Y̵��ya �3š�������X�`����@7��(�ż�(ۮ�l�p\>��-�NEW�yF��X���1w.\^%z6��y�. S������af��5v���Gaޘ\Oaly�]�-�B�,�Q�V�f�i���K���{�Ff���(G�)�ʀ!"<���滋a��qq:�a�JvFǢ� +��q��G9���`iw��l��n"�<ܤ�����ȷ��r�ψ)����4Q�J�P?q�[�.��zX����>��(�]��R����(��b�2g1e�+Ѿ���}����Ι���T���Mt������x��=�J�֥J������ϣP�+�����G����q�����S�1��+�z*�O7*q+�����ӏ�*Ve��{���+=�8��L�=<������W�9����K���9�;����>%��{��+.q��\�a��?>�>�(�����5����4B�ۨ�C)��YR��G�y�-�7�&��?F�ܥ`��R3&#�����QE�k._�nN膬�e�e?Q`P�`-Vy���Q�W:����rq�T�%��"�%(,��.7��f�+�>^"7�� +�V��lk����,�4� '�*o�#�*墻�w,O�H@�qn(ʿ�]�u�Q�(��,������9��&'w3H�S����Q"�2��� z1q�̴ޡf��8�P�5���D�3��1�o�����4۴�ٍ�c��~�ww8w-T�Ĥ�h0CZ�@s9��e�jm�6{0�JE2!M�s�D��x� l6q0�^Sd������M@F���Xi��*�?�U�1���X��vK:�Lyy������Vv�P �^�4�*�#��MB�6\$��I�ip��[���uJ��� +�Lq)�ٗ�ò���Ya�0��:���5e�[���W�/� +���B)�-��3��,2����J��Syi�%~���.��#>y� +����xh�(Gd�3,q�/�|��-�[/�r6��� +���bк�^P�b�� +�PG�!�r9E�Qzg�!����¢��qX�$pȯ锃���t�Kϼ��g N��%�3�oR�<�,�w�=�P����,-8䕍(���U���K�4����>��\|8̽��"t^�Y��� /e6������i��?i�]oјO2�����P�J�Ҏ%z���Z�+�R�}�q���%u��״���WO�@����G�=�%g����K�]+�t��bW����T��i]*�[�!+?���ۦ����i�|3������8������|˘�l㭳���|�o������x�&��Бq�_9�0E<�8�m���Gf��D���]Lj�XT �U��� �_�xp�C��. qcZ��p��f�a�1�l�MUe,�gbq��,�����Ɏ��͠i23��%��,+�u�é�l���_5Y�h�1T�5B�.�f�l��R����vxeۗ��Q�>!v'&c#p�x#��1*�� +��pJ�>c�35���.(���3�Br���͈��9���xeXVFo�S��.���sUs��5+_������>;L5�u��Xj�̸cm��cX�g�qkQ�0��<ė��Y�/P��-�ycQJ�ϒc�����\�u�~��8!XP���!`.BCCS��!Zׇ�@�s��\]��ѧ +��,G�_x����E��^� �0~3,uI�< �����4���/]"�n���q�Ұ*4<��Q��%� ++��ɪ��¸���(aw*�\ +{q Kn��y�maQC��VshP���C���7��uo^ ��GT¬f"���$��/d���Z�<3<7�5 +o3r�+���˨��>��R�� +R�9F;H���T����~Ƹ{�ü.V��������i����u�I��M� R4`��E��U��:��#��"�ǃ���n�t����s�f���I�]B�J��W�L�g�a��o.bg�Y�-��P�术1�"Ȣ�K��w�9��S%F�!3dž�\ō{����E��U[��R�b�9��k�����9��'�����n�?^���G�= �e�����N<J��篴��=t�N=|z������LW�R�w��=t��s�3=k���3�*T��R��RT�X��(=�T��R�WH�T �<s��;ʯ�Q=����u��q�1 K�=<����O�y���RWh�x��ʍ�L��7+�O���w*�7�J��+2��!G��8���PG]���hU�n���y��GB��p2��͑+N������ @�C~�(T/��nr$2�>a�N8�ƍ<\# � �YC+[�A�O�%J���ƹ�CT}�e6AL�$�Cĥ�ܦpK��8� �<sz@-�,@����S��8�!�������]E�LٍP�N��;����%U�%�#S3�� ĵ�Q��*)��5�%���.3 o� �F��fa�2K+f�y��{`0�&><�� =��E�xv�sQ"/�r�;bcdT��Ġ���d���� �"�a�W�3���"g:�;KA��YU�!n+�+����FZ�g h?�z�4K��`Y�3dɽ.m�N +��o��5�v6b�R���C8�fh���J�f��_u��Ar6p⥨�\#� +��Y� �їTv;�Å��]��6�k��-ۉE�/ ��b7�P�NB������OF�h���>O�J��e�A��6s��1�M�ŇJ�B��o����Ea�w�K���W%9�� �!���� �nQ�X�P��o�)� ���ۈ5�LtžX��Nl��#V�n��l���ˍ��.ؓf�|�e�-�H@Mg7*h/T�����˓��g|��,�_��Vnpa7�FS���)�O���T����[�_�̴����ˍ)"�Mv�wx�|D-���M +�o� +ƚ��MX3����+�cb<;�� 6�0�SuH��=�U�s0�]Μt���sS��}8��O���1��z��J��C����ϫp�2�����T�Eb=7=�_Z�w������� P!+�J�*T�R�=�<J�*W�3H/�>�L���T#��B�T��{B�33s�ʜ��L�G]S�������vf����2����R�V|����R����S��s��A�{����ܧF�%\�-�M�.13�i��v�̵��9���0������`�:�1yr�bڶi"�/H(�狈W{��SL�c�g:"F��V]���F���Zy������r%3�F ��*�u +(k��p�x�:��߈G��2�i���Q:1�{�5/өIo�Z��F�1L��j'� ���S�t��2��*刧�*�-�y�'!�|�2�����en`��,��?�=چ{���a�ToD�����2�`��-JǙC!Ohۈ���6T�jȩ|0i��j�r}�%��S�j�x���.���HR�`6x͘�t+,����Rݠfl�A�G��rx�Ղ��7�y�&���\�vԬP]s+eF�(;WbK]]�&�F�em�G/,�A���£L�"]�%�b��.+�d��^12��{��-Q{�>"�����.�&3��{�e�r���Ux�(��8�\Aa��1a(Q���]���L�Q�_����e�3�[\A�K��-��Y*c�)B���T�8��#��"f�i]���B�0#���*n��Uv7`�LoW�cN���0��+�> ;ZmN|C,�}������s�%a���i`;�����Vx{c�ݮ�66�s6�^��-[��ߴ(ध��!3L�Xp�oݎ�pw�XVVT��Ծ\�!Kw����o/9�v������kV1w⎻@�4�h_G�Z5���P6��E��?��y:�~�v�k�x���[��Z�}8���x���zjf~���ֺ�V+�v���*V%O<t�R��zT�R�J�L�}�����R��Je�G�;�����q�#�y������J}�J�*W���g��w5���ҧ�J��}�r�:�R�J���D��%|v�*W*%�o2��+�ܗȂ��c�v7XQ�"�a6�����v��`�0�)̼��ѯxǾZ��0c& ��~!h>缠j2�Y�:Q9�`�m8�����GS`(�y��#��J��j1�;��Nx�b�PN��0[U�M�P[���dh=��8��b ����uY��ah�ˉm6��@��'����A��A��&��.�-|���N%��Y"���� ˫q�9��sp��(�E��R�����gA���n)m冣�^>&H1�2�ң%��\C����=�%,)�w����B�\�`���- ��1N��� ���`#��@�+!���$�[�90wO1���,��}��*�\�����\A�� +�o#��)b��Ĺ�s@M.U̻C�_���CKh�� +Bgg�w(� +~|�ڹ�P-3pIb�p��+l������߈V��Q�q�^1��n!5�k��̠B����%�*�}�,�[]f �� ��JL��q��&jqG�S�b�WB�W�m�"�N�iš@[����p^�+[��s�%����s�jl�{f9�!�������@�����In�.n���t�ie�pDK5��ٶ�{B�&�U M]�c����,o�%8���Ե,�ϴO ��K,��&�C�7��b1���Jb�fZ��+X���lj� eYH]��iCg"��,6f�����q�P,�y%J��?� �]�-)|��C���Ů���hp�Dry�fMM-}��V�ơ�ML|C�����b\����~��{t �g��J�C~�b|��EJ�*T��*T�R��Q>�}�>ete�ó��+���Ku(�"Ѝ�[����>a'��� �;��{ fr����tS�T�W3N>�>П�^�G1\�����?:�M��u�鏉��Z���u�;�e}��Vq����Q|Jc��Veg�U"�v3a�"�{�E��e�`p8cAc�0��:�_`�6cY�@�[�Є��7w7�+��!vVu��ZGly��x�:���-�A����.��`<�q}�BY�+_���~����x�6� ���� Zk���Q1��3���E\�9�Ļ��M�"EB� �L���� b�N9�f ��yZǴV��������%x��X�ķ�\@X����;.��Y�x*����78���f(^� U�"n�SK��<y��y�,�bi�Pa�5��s%f +`�F>�-}�XcoD��3|��"�6A�2�����kj����bٗĺ!��6�M G%l�7 Ra�{����_7,��{� �������n�"f�g8��"n��)�ן�AcFh���A�+��Hj��ep*�#�t���@�-�s0���P����h�� Tk7�Sa��i����ˎ�S��-�{�b�H��-^ȭ�A1.�m}�#�ʕ +���K�S�v��g��5/�RDa�j �B��]-�^<6Q���P UK���bv�4xn\<]F��h�܄ ��/�x�A��CÌE_�� ���4�U�0Ym{&bh�%DV�4�('^��,��n��`,���mL����`y�ü˂w9��?�(a���IN\�Kup`�̸�Z�wl�6�o�X�0ɫ�aL]�E� TW���W�g��Z�f��R&n�F���˲�i[���F p�^;��X�!W-������Njn�Qv=��3���=��\q.���[�������q뿗����?ĩO2�R�bWn�*T�^%D��IP:W�WJ���%J%v�+�J��)����J�+̯��P%~`a�ʁ���+�P��vO�S��)��D�Bx��&c���\��|�嚗�w�q/�@����e|�&�����=-隗3]9��EG��;˄%g��Y��3�(�ī�R�a~�5<� ���W2'nb\�J��K��p�8.�6��Ɵh(M�Ggs�z� �) h�Ѳ ��pC��Q��Dž�Y?SLUK�eB���k�f�i�<Ē���e�0e���'s�����3!�l,��:��bIL��d�����d�s +2�>H��v���M1���{G�u[�$i��.R,�����7w�y�e�`�q�a�b[��hr�`.���Q���.���˼�pʡ��{�t��*R�aR�� �W`%�=�<^҂�{˜_�R� ކ��.>#u�o���dF_�� +���S�)EqIk�;�_1 aY�� )��Q�Fӑ��<�W*�Ez�8�)�"Y@7�3�=�����6 M��l\�Vj3�9vTs�w"�]s4�� h�ƃ��8?(�[4���Y�]BWؕp���@އ��c�',)�a����Eq��1J�n3�s�G̺"�Q���l]�!?Q@��D�?t�7N� �������T��r�o�R�F�jZ��r#���#%��X�cuB>F����^c@�q��P=-�6(Ddp@;�.��nWMq3jΡ���1w��^��{��Ec�������a�Z��0WW-}���=:�DEX=��1Dn��� ^��x&��u �t�K'��D| ������|��Jx���T�t�}9���g�=n_^?����я�*sҺ�<k��֮s=��9�ta����Еs�t��.��+��ew�ʭtFT��y�ܫ�8���J��S(E@�t�|��ڡ��R�Ҿ��ǎ��/�z<��7ҍD�̒�S*T߿N1����������r�J����J�nSr�T�UJ�*~�@���:�W�V}�i�V'.��T Ԭ���1Sr�ԯ�����̰��k��aĦ�6.� +`pu�u�m���=���MQV���0.�u��ɶ^��L� &'��6�V��L�c��W1����Z�����`���X��s,���~�he[�u1��[r�"i�sc�+���5Pm���=��@��Q����|B���ùm��q��� j���>���ʹ�Q܅Y��k���jK�����"����+� ���}�*��J�缕 "����3f�iK�P���v�_�b��2`��Tn�u��7xe� b$m+�[k�b`���LU�V@� � +Qv=��U&���*qy��Y�����k4㉕]F�Q��;r�R�@��&+Ĭ� +a6�u����8cW�y�KcPE��Z�k�?�N�H���P�݉f���9#�'�U@��k�C��S�^��jm��~��̔mX +���?�0Z!��łp��>����R�2�,W���m��a���T5�N�ĥ`۷h�������&FB��Ү�*��x��1�u�o�mT�tR�PvV|�lwJ�Sm�Ƞ����� ˶x���]�Y���Q1�B�@RE�'ghU����f�]�'�VOm�y�J��Y�y����*{�G�L.���<���.�F��2o�Մ��QAH +)�s�����������5�����5���zc�y隚&{M��۷LN/��ԧ�gщR��T�P��T��8�����r�Z�d�������W~�)��Gd#_�;�C�ۨ�P�B��2�W)����q+����>�<t�C����3q%T���U�J̣=�JԩS�g Mg�+�S,Է��)Xa +M!�tp��|{����6��V}�c��T<��J�]�5���=�bQ*Wۼ�H���X�����Rd'�\D�g���Q��ح��Vy&^g!(1gr>�����!v%�'�� 2���P�'��UD�Q�oo�U� D +�m��J�B���@��kO1}�Ǚi��<�<|J9Ļ��vƘ��ٙ�R�U��]D����r\5�\gs7 ��+�-���Bc�s���2S�u/�����Mb�nl��w����>l,�u�G���VJ���"ޔ!�(�@+�.��Ph��|\��|��Yت>X6�w�Z]�% �CǴ��jV��\8���M��"y����)�ڄ�%*6��:��L������ǥz��#t!ՌN���<3tM���n�2�>b�핉T��X���ښ����� �dy����������k�H.B��F�9��T&�3�1э�DIxܠ��P�eKV��H���L�ZM�;����+���,V�A@��D]/���Tv�����l�?�%h�R:�U]�+{�$Jc�eMِ\��7�R�<�1n���[7����}���I���9sU�����|rJ\�����@o�u}��Y�O�V=�y��u�����2�3?r�>��g�T�J�?2�q+=�t���t��(ܩP&Ҧ]�~}x����2]��@%tRWۈt*Wy]1�*T��įMFjPg�+����t�_�T�^e^�tW�ZT��yR�fT��zW3ԩ��*T��9�+�w�v����JĪ��UJ�L�~er�'�8����%�ʕ�y̩F�TFW��4@`V�3|�M��G��J����yC}��;&/��U�pJ��P�1������e��l~��0wٻ6m9�`� ����a@]:��"����@��*(7��� �r��rx���ɨZ[���|��Pcbv&%-��^����*7����E�K��3Q�®�-KW��)��SxB�t�j�a�q�x�IQ��R�`�-y�8 EnR"��-����Vbx�2f��&���2�90�V-@X�*mgBq_X�\)��Kơ9�R0�ԪY�jryĥ��$��ނ�U�����H2�1b�TA�q-����s}%�$ڔ����q�}`0���1w������\A��k�}�Ìf����p�lʜ�� ��2�W�^\��H����`{�@/��W�h���� ���,|^Ħ3��6DS�w����İ��1�ڠ�kt��U�����r����7��Y���@��m���j��pָ�D�a�AM�2q1 C�䂊��b S��Ɍ�hB�荗����(P42�T�a�#�3�'����zߧ����ף}*=?���=uҧ�O�J&:��t R��J!��_n���S�>ң� �=��?e�S�A�+��> GߘweL2�WL{�L}�Y,�)՞IR��*VeJ�I�ĩR��6�*V���!���R��Q+���Wi��*T�W�$�J�ʕ�eJ��N�JĨ ��:į����;����[R���_���Kާ�J��O�K�vĽ�ֳ,�C0_hV�y���ܳ�i�\ڨ�E>jXQNWfa�����t���2�}��R��DP]bU�c}N��Y�^e�H:�=� ]@WF�SW6�pe'LEZ�Ʀ���b{g�c�K���2����2�����)3�q�Z�ق9�i��mG(�@��J\;ƹw +���U��Y��\t�,��zը&���E�M��T�<��'-Zc6v̺0�x���œ$�-�)���Q��9:���`�w� x�4�"��#X�m�J��u,AcM�`��~��FD� q.���w��)W�1��1b8PK�h�{���u�Gx}�l|�J@!��G�����[�ɤ� �O@=^�.�;D��@tI ��j(-�~%�.�v5T��a������XV�g���Z���d��mf|1�*�x_ \T�«�ܔ���R�b�� u�V/�8�!�d�&��n(E�\�����:�� �ݠ�2����C��ey�So��)M~!���k#_&b(q������:�������2{N2��Z^���M5�x"���f��קH���a߉R�Ra��+���1A-O?��ޮ%w����C�v�WS�����C�� �R���nT�D�ew�҉Sį�+$���)�Wy] J�?R�fQ���� ��c��a����b/�˟��� �O�&eO���*T���5+��eJ�*T���}�ޥ��m=��3h.����^��ZkP���zM�=$�!�����i��<zk��������)!���*�!��G�R������L�wk�=����ؿyh����*�F�����-p`�]�1�sn'�.R���H$]�X��l�?1-rL��ʽ��H��g�qR�ML1����2o��Y��eBf�,v�j�Y��@��ӎ�e�\�r���<�*��}0a�1c��-�-,�p{@wE�'ˑ����������}�J���xv��{�2Z��E���C�ck-���P��}"���+ Ao�0nf�3b�����O}B��?pB�RTωP�E��*wE]�&e��br�_�D�27p���y��]�@1l�యW%���b��g)��0nR�U���.���+���a�NS��ko�a-�T�U�� '-���>�=� L�j�" ���e�n������'b,�}�F�m=ݯ~��W��L��({���@�.㈕/ �P@Q��\( � �M��b�Rr`'T�yU��+ I��r'�U�d+�aZ3��bй�b4�f�K�A��*�Qx�mr5���W���[��JWݜr�ac�VW|t�1���S�L��]v@��� ]?R�{�t��}0���+���*W̮�+�b�$ ������<M�(�C_�8�9��y�3�3��]�7r�������eG�jf�T�eq*�J��V*W�q+�N}�v�����e@�O�~�0S���F�N���a�<a6�uI���ϧ����9'��a�=f�ׯQ!�{���KM������o#�h^Sp�� z��z`[9Spl¿6�1Q�b�h�\�!��h v�2�Pw���>E-�Ƃ�����r�AE��T��{�m�e4h����A\^�(���/;��>в��P�^�<��PA7�1Nn�q��.5(�N:,�\{�"'�z/�s+5%���}���,��xu[�7�x�U�K�Yc��x�Ҙ�),o��AAj�v�x*)�2�.%����2�sD@��U�/kܠf�gGHMF��Mss+���p�y����D"%� D�_�̼T�\� /-������~�/���Ϲht 0e����`�1��A�r��P���O�O�gs=�7�H���T; �a=�1��V��M+��:x^$�i�7/�_��KY߈�'"y��V#{���������0]�\�+���nb`�l&q��� v��SA�� ������T�E��T����[{ـ��?b�ʦ\���a����$*��x.H��?"aqQyp��;.��y �GQ`��0D��PX��8�廕*WN�q3֮J��.Wi]���x����y��R�*U��̩_�h�T��?�@����@�Vz�Z�P>e3(��p�*W"KT?�p�)1���J�iR�L]t�0�x�����Ҽt�Ҿҥq)eJe�Oo\��� o�u)����L���C�N������5L���2〵���i�2��^�U�xbޏiG�[�<Āz�LØұ-\Bij�w��4�����D��2��;5}�#����xYp^�_pe��-.\T%���X��K������-QG���0o]�Ƭ�t�0�3儼�-� +�ֺ_Bk��MŶj�ܼv�hm��� +��X�r�"�Rq�,y��J쯋���[�w�w��ŭ":�ϒ��04��Vx}��K��3��������b��x�ܩ��\��R� ��2�G���nq@�n�h� ,����ЏA�8�ʷ̳b�{1s����jR� 5��ܤMw���3ъ,z\tZ3+̧��� ��f:�[1x�s����Q�/�/�[�a�Rž�-�'���/��Z=�D���sU��Ց@�� +68�����������O�x�9�K!w�~�b���uV��W�� �,8H"�sv8���)R��*xCEKE�l�0@�WEc���y�giR��Zܵv��`h��&�:��*F�w��J�ҥJeJ�+�Jk�eW��Oi�J��]+��J��R�� J��*T�e�x��@O�Y%@����XeJ1z���Ĵ��'�kϘU��bQ���}���~��|O0Դ�ZZZ��W~��!ioiiS)i_~�K���oy� :5����"�*WEJ���J�+��*�����H � $�����h�)�BX#�R������{�x���V�� ��U�y�ѻ-�h��� +{��TBk3�P%���ơ�%M x\VV A�"�w���!����\aY;��N�d��/�R^5)��`Dr���C���c��e��3��R�&S*�cQr�'K�!%>����KR���mX8�^,Q�*�}�`Z5qaѨ�����~� .LJj�0�Xv�o\�\.�S��8�b��C���Hr: �x���f@1�D�ÌC+]�5L,�;y#fH-� ��,�5)J�(ʹz�T���m�/��[���P���3$�A`����[�Y�����4���b�s4X��c3+�'�~by�T�����ԢXK%K1��0����Ɠ�i��PЌnQGp��]A0�u,(a�M�� cc� h�\Զ�5�2�����䄭K`�@�,N�y+ʊ`9�0�%��&t�@M7��}�3Q}��*" +7����Ε�T�_y]�J�R�bT�eJ�+��J�����BT�R�����=d����!����J��]�N�J�W���2��WĪzW�����3�㡿������3+2��eJ紮�JϘ +�*3II�T��9�謤�H>����k��^^ +^�:G���~�@C�AЮ�*T�R�J�����N�eD�P���!��(��eb<���@��ԧI_i�J�nk�h���N���<�j�間KF��ER��O�P�܄�N +�[�� +��~�EؓMG*���l��Ǩ�/*��}KtR�TJk�}��S�ĠT^���5I@����ĭ�Ĩ�rGȣ�zY,��`���}���g�ʗ�]��]� }R�hО�.��2�;��q�2���t���2ҝL��An�J��})j�W��T^�� ��y�t��U���2��-���&17�QHs��qV�v�SLh�� *�LS��9��Wb�X7���4^R�q��\�%cT�Dj[�F�=����tbD�Ք��W/7��%�GK�1�S?�d�} +�_K�L2��Jo��\ܮ���],�5L$v�|,v�٬��ūv^�J4{v��������v�ұ+%}�t�R�%VeJ�~�T�Q+��&*W���x�T��J�*V%Jw+$�2��̩_'J���\@���+�+�����l�*3����(�����q*����iGAѦ�s�N>�🌿A�x@2����0����z��k+=�4� ��ͧ�)+� +Ĩ@J��MJ�j>������s.��q{�4J@_V<�7����\����"9Xb��3l�D)�c�mwnO��J�]x �����m��Y�b��6�w�-]��Y��Ŕ�Q��8-��%����{�l#�Y��!I�u�iϢ%��t9����v���)T�Cba�a���7r�*�%�0��(o�A�̴�ܾ�̸�. @��W0�Z��]���K�JT����Kk��v�����6��b�F���2��Z��u7���|d�~��x0.I���Ո.ժ�E�Jwe�fG�1�/52i�Tt<D�\M����D��2����noG�-��Ax���%�c���g���J��z=_)���ʌq��?�b8����$e\�ѹ�c2�z F1�.�d��e�9�E~�P;J�T�@�]���^�k�x���F5�T�R��L��_�]33 S��q*V'��zw%Cp��a+�Į�(̨�P��g��*�*{�*WF��S*��2���?�+�)�t�'1��=�T=g�:��A��A4���s�Ԥ"�J��ҺT�R�J�=�m-}�+���Xe�AJ�#5�qH����Z]\�}����Y)���� y.QGxE�#|0360��<K��l{����>G����?� �����f��e�]�#:�#������{��(3��Oi�}���}��)��xu���- �Z`�1�%��Ge����Z��Au���k{� �g�X�*��1*�"����.�Q��N��1^Й���J$,:WA�W)�2���LaT���S���q��A{J�V�s+���`1�3\�\}�t��<j�����Q2N��s���;[�����rY�I��,��(Z�iwe�߈- ����x������Q�k2�&oq��U�� ����5�!�]�8�=�3�p��;{M%J��U0�A�o~&&��nB�� �t���ӇM����}�i}����Ȧ��@�A;�u%��E��P��\:˸�z��0��%;��W����U킥�'�eO�J�Ħ�&�N'{�*T�R����5*W�T���R�J�J��_2�2� |J�*�����T��+R����!������g��C��8zP�`@��6�Κtz@z��WA+�J���J�*T�R�J�*T�]*WJ�(�ҥc�J�R�t�R�a]D��[[�gA#��#oN�� ]�"X�:��s��P|T�&��H v��܍T,��S@�Tq�o1h��,p�Q��/7�q�i����FYY�����M�,�%@?ٖ�d�Ee��@�nV&��b@c�(v�Fe[�pF/6��ǒIE��o:��j��o�y��Q�`��E�5�s�TA3�4�6ƪ;���Ut���"�=�ξ+\�3@i�v��$��=��w8��iNZw����U'e}��Pn)�����ܣ����PX�������@�,���`��."�xD���y�[��8����c���)�2����R��j=�8�0�f�ԸL�%�˚�S�[��>Ӵ�A_2�m��� "���B�Ø��nCڕ"�ԫ{°�����A��n�P��C�1j���� ��J�`���h7,/1[�c1�^�X.��<���q.=>9���;����\�ߋ��B����%�06�g���|�f���z��c1G�0�3̬�:U�J�tg�:W�W9'�T�fT�W����_�R�2�3��_��>��T�����*S)�+�~\M�>�HI�tm�9N'��������<:;#Ф���O�� ���J�R�*R�J`@�*T�R�fT R�@�*:*�R�WJ�]+�t��]+�^�QB�C�i茿MK���L�fb/|0X�%��E+q�]n_8���t�K!J���dS&�+�.Jv�F� ��5wtbR�*-v�"���\h�`����_[���̮8���lF�� b9#H D��O����Y �!^�j"�=*TAn�H��^�D�P�C�(.�n��LD�0b!p J�\śbYSX�@�Cb�}��@tÉ�������5�hh&�����H�qQ�2ɜ��"d���E(�<��vj ��.5�2�-�x�3dٷ�Pۼ@!����~�Sl�i�)���hT�Q7�,���M�< +{��1g���36�q0��oA��R�)��a�,o�d�,���h�1��^���ؕ�B�?I�w���a��闋K���A���Fb�7�Ys�P(s3�ʔzH�."#N�7�$@4��Q�-�rf�%��a��|1 n�Qr�3c���[����x���.Z\�.*9�Q&�f�b�``�jx�&�� +K:"��zT���e��R�ۦ�nT�s+��T�:�2�)�����ʔJܯ�TT��{'�^����T +���S�'��{8���v:�}&$:�;'A�Į�:�ф�J�*T�T��A�"�u"�*WE@�T���*�J�T�R�J��]*T�R�ԩR��]G���K���7��h4B-A�Dž����F['"&C5�tj�K��M\��4���+�������~a5l~�.9�]�sq*��66a��TĢN��f.��⸆m +�78#ە�l�� ����sS��2��טc=v�E����3��0��"%��b�8�B3/��3�<��ŷ*��9�E+��K�DV �� A���,lJ �:Ԣ7�,Y��z��*�>6��y +`$`��#���b� ���g5N�Q����+RȬgr���nWG��a���D���ngfӲQ��y@������q�����-���Ю���p#\nTa���ʈ�rϴ���-���D۵�yL=��q7���jߨ����`M����P�(`\2�Q;J3��VqZC�Ħ�A��+����Dw��{��b�%z �к�v�Љ"��g�h5��B4v;�LT�_x`��lϼĠ;��yuw�̰��6㕬K�z-�lcŖ˗��=H�*'Nh[ � +�<�,�J����gĸ�Zi} ���sĮes*e*{.ZV<D�+�[����ޥ���+�_�tWy\�p��8N����tZX+���6�T�R��*Wm�%J��W@%@�Ԯ��*T���*R�*��J�* R��Qo��uR�J�*W����YA���N�ID�P�e������5��X�_G��ϋ����a�����V��|�j-�c�tE����F)�e5X�쀀������.s��!�pc�!���I��&uO�2�x�*dTEJ9^��`Q�-��W�67�0"gf�`;�{y�e5Z`rL�Imv��� X�pJ���#(�},��ܧ�C�T�d�S�)���̽�" B+т��-��� ���fY, ˃�L%��P�B��-pf�R�:T��@�4S),1r�h���D [�fV98�p��R�Gt ��H`��1g��1� c%����W��q�_�iu�0&�"2�_y�tUc�m?)c�=��esPe]��Pk��;I������eS��.��������w�"������X��Wl0%7���{�ұ���+�L����7({�,;kJ��%˗�H�s�49��_$x�hT�QD�T5��ew�h��6U��V��*��N&������Ԯ!Zm��`����˂%��0��1�,t��U�.��#R�@1�e߈J�c� u1��膰 +P���)r�y[ԕ0Ś�{�ij��icqy�N��%w���7*T��Ҡ�J���T"�mt+���WhwJs�Sَz)�R��]�J�?2��Y�*U��)��D�R�J�*W�X��R�2�J�+�J�*T��J�*�P��WE�:{!�� +�*T�^�����D �!Є�����-m�~n�bz�;� q���"�*��ݜ�f2Vϼh��2�y�B�v�Z����'c�6����Lu[`p�3�#bUn�Qi��� +�pN�ωC/�-�����1��vc|�7�q�/�(t�.V������c��T�N��?�: +�EDjw�/�����\u�#��3*#�U4�-�:��7��(ܰ:5y��7*D��i�8���������gMG��� +�B��ЌF�T�Q�fP)�k�@Ba8@��CV3D58���1��H��W�OB<@(�X=��b�?B�9x�a��{���w��/��ݏ3V�&x����f����Dj0t>�h�,�8��6?x�FtS���/�1�Dž�9��W0�AS[��+..n�Ӛ�Pxd��̃�\Z�2�����1(��4�����SDХ��/7��R���W@�fc���� � +-}���k6^�/��i�Y<����(`�8�(��w�Q��F%�Ϲ�M��H��F=1Q"�c�����}አ�K� +�Ƹ�"6��gQ��V"fKʮ�m������\\�Į��2�WĤ�O9�wr�U�*W��?�>�e�D�Y���� �+0�2�1*T�J�R�J�t&:T�]�t��*T�P�*T�R�J�*T�R�@����� �z���*Q*T�R�J���k�r��Y�%B��d��z C(K��fa�lAva��\��P�xZvf��ܼ��f��%�7 ��J��w����e�� +����j5���ra������ψ �v�b�T��/��ŏ�����7 Z���*�4����)E�B��t0,�Ĵ���&1��Je�(:3 +\�Aa�ljd�d�;�K��lPD^��E��f6Z��G�4J�f*U�g0mZ��1]�јW��ʀDh�D�9��'���)�u��H@C9�T�1��ʕ)��L��(/��l +�Ë.��P���tWB�����K)�J)ލ�3�)0���8�Ig�<�b#A\uL��ž�@Ĥ�F����}���0��#���S +�M�6qǙw��cC�{F+�.�Lkx�[D\Y�⸬�.Tx��&�� +rj +��9���׳���0���wEs�0{A��~�� BQ�*P@3M��b�ѶLsu�c�� Ww�ߔ����M��.VU�/�訲*�+���]���$^��قnlCo�2�� ��Vj�dk�h(�i~���F��� t>�z�5VA�4o�<\�9�{ a�r�>м�K�R��6�t��X,aB�-�G��(.�RqL�\����e3��(%7��)�����e|J�*W̯�%x�ʕ(�RWPeJ�T�UT�MJ雕*Wh�����WJ�*V%J�*T�R�J�*T�R�J�P�:��R�J�*T��*W�����0�AM�u�b3���ۗP�&&���e�c���B/���u2fc[A��xd{��5�/ �ֆj9N x��6�b*hJ�7,�w�V% +�0b4�h'�sGCc�-w����e��mt����!T2J"�w�*u<CX�B��+]}� }�!�[���D��"��h���3:l�0��߉��S�0,��W��I�p��£�L��J1+�q��dz��Y�i���K�,��s +s��q(q�S�!{��g�s��A�a� +�)h[�6��C� +`M.2]�,�>���t1Ĥ��ֺ��[��&e�z������J�/=7�+�Z�̱fW71,BAs������<���)�$�qq���DYV 5�t.F�)ͩ���n��`n���3?��=̌p!9n�3���6����M.h}����7���%�`���]ֹ�;��@y�L��S���(Wd��_7�R�dA����Y5-�\N<�8 +`�;@*6��v�qh>��k�j|�������8 V���²Ai(���(z����>�;.�b.k�'߷BtaЌ�B#�5�`�K��+��m�<�M�O��{c[V���2� ��5�Jr9�^E�%��]�[���wc�Ы��L"���d�H��+�)�E�v����Jg�+�*S�WyZ��eJ�*���ǠJ�N%�J��*V%J�W��J�8�)�*T�R�J�*T�R�Lʕ*T� J���@�*�P%J�*T�R��z�Ho�D�@�F�)h)�!�@���)�]�g��H�Ԯ|�q.��r��k��@1 b�����D�o\�>Mɷ⥆���`���%,�n��Qi_h�E��z�*~'�+���-xe����%gq�z6�̉W����kIv�8av��.\�J>P��f�1��(�g +�8We���[ }b6�9��^R��J�KHa+6̖��b�?yv�H|�$y �|DZT7��;%���X4�Vjq�����C�~a��0��U�U��L�l����@fBZ��%��.&�3��.b P�J +��<���}�VXa�T�0�)H�bSۨ�u��N�n5��lY� A�I�j���~ ��ͬ��:٨P�%7`�K������>71�x?q��l��l���T +>QP��^�ů���HэKsDL;h́�퀗{����W��Me��%���h�o�Y�����a�U�J�2����Z�g1ʯn�߈m;/(E���g�D/���,7��EJ�b��L����bʬ뛈�x&_+�CU���)d�Y�(ЁǼ��55!�NN/�F�(��w���s��|L8��gŵ2\nd�����|��Qgg;�w��pu�Sk�X�W����g��_�T�������ʋ�<��/��J%@��ʔ�&%J�D�+�w�*�<J��T�ٕ�2��] �J�n�(�*T�]*T�%J�]*��ҥ}�J�P%@�T��@����q��OL�C���@Q�=�#S�B��� ��0�����&.;��3)b��gQ��`�P�Yag�Q� ���mv��]1�U����.����p|DM�T��a�˶-�0�[�)y7`�� ^�� �� +�{C���b�ဵAuPJw c��辦\��z��v��R.��"U����NYv�>:2� ��F�1� ��¨clu����G�=�]��r<CZ�6��0�7��|n��c�Y�˸]�p��]J��LW0��8;�O>c�|�MA�LRx<JSpJ<�+y��B��ڈ%l��8`�F +.)K��g�3�l.ҭb2Z[Y�L>"�%��f<�F�V�S�!r���b+L���BB.<��3�݄6��M�̪�To�Af���n犝5�Z�Y��1���Gv@;��d3c��U� �3!�%!g����@K2lTkK�sPU���4 9V�x,�Z�9H�a�v�Ea��+�isKP�p״�F��g��;����e+W�d[my]�2�\Od�dWh��#Y1a�n_^a�Yk�_h����P��!c&�(���7�r�wmZ���]�1�r-�<v����D� +�� +���[��v��A�0ݱhq��/�R����R�(�1*��bW�T�`J���į�S{�L�eOn�+=*V%c�t�R�t�R�J��P J�*WJ�*T R�@�*�O@@�*��J�*W��}���_ѩR��D�^����T�0[ي��3'�����:����6��)i���aō�.!��ұYN�!�P�ѨUWb1;�[[�.in������:����C����ͬwc�Pj����z�E��Ђ�<���b�;f˔�J���P�X�v��M0��b"�!v��� +7��G�L�8�f��X�J��&H�v��̓2�l�+���jS��8����P��}�lb��@Ǘ�SĢ���V�Z�� +��Ԯ<�ȄHr��!� +5����%��X~�W^��="Ȫ�=�r��ŀ�+GW�m)��DM�J��i�$a%[��s*�N��2��D�s�a��l���*�tX]���_i]���������/̳��0^���K +�a���CG�eG@*\a�����k�EU��4(]Wh� ����`<K2��,-��MnW1�ގ�FWi���7ϻ�9u��`�;��.�e���,`�]NFm�b����u�����^�o��VY�6P�q�J��E�\31��9���)�K���Y�"ϗ�66du�K +t�38��+ +��a�m����,ZrM� nL�Y�`X�=�5y�� �,e��6{t�_� ^%��+�XĬ�2��J�]*Qs3ۥJ�r�%J�ҥu����L�P�*T�R�T�R�J�*T ]*W@�*T�~g�R�t���_�����Y�������爕*�X�J��{��lž����q� �����b��E���}��U��"���0�N��KEg ����/��M�&��8c��%�����hvX��P�`��JҮK�Z�L������h�x�m�����,^��!�7rՉ�����M���8�s,{K�jy�n�(+�"�{���l��6f �"=��3A���H���>���Ԧd� I�+8��i���b��~ R����s�D��0� ���A0���W�4��5Q;8�����BkZ�^e�ұ��;kY�)��E)�%���C� +�%�#@�2������F�@]J���R�0b{���DR�MG7 ��ě����ɚ�od +7lP{0*�+2��r���o��g'��!7��lFCt��X%�cQf��喖��J״V�l^�PJ�Ya��1y*���2Bɷ7Zܡ`��R!_r���e�)�#cl�0 +zh ŮR=��&W,7��!b.�0�`�)?�;��L�Ok�%�.=Y�@R���xAXDxC%g$��B�����j�i���N��5BF����2r91��c�������E�Z:��)K_�a�~��j.��@"�Gb���0����3%�� Q(�1R�t�L��J��R��*Ur��T�\J�+�R��ĩ]+�Z�J�+�֥J�+�J�+�:T�J�*T�R�=Z�]9�V�w���*�,�����&O�cۼ:]�!Q�@"�a��$7oL���Z�K�3����̮���T��}�%�7p/9����d 8�&�ZW�r{J}ME���7--�ż=��F�5 +UT(� ����%�7 R��t����V��l{J�Sl�*2ŪZگx��L����R�V��� S��M����o9"�U/s�j�N`���N�}�-��]��Q)XO�IN�A����+�aw�7&9�x����|�pD\9%c4˓�`�> ���R�����ޡV��E�}�o�Q���X0�\J�b�AP���sg'=�$ct��%�$(Sn̮#O0��F�VS*��;���7R���_�m̙�=�9{@u�8�s:fq�-����"�Z���d��\��x�� z4�wj4o�"G����#@-��ٷ�x��>�,��N�#�ap� +�d�ز*��i�B���և&-��r�25�b<�h["���oC�XO���e���GA��0�a.gQ��8��8�H����s�+W3u��$�×�c�!@�{²��+���{�.�Ҕ�Uĭ[���l(��*�W~��\�L�� KHnt#FF�IA��Ѩ��N}5Į����+�R�J�+�R�*WJ�*T���*��*T�J�R�x�ЕӉS��+���B����~�����r��S��.^ZZ^^^_E�d��coC�/�G��!PGf]���e��bR��<�V��� <�� ������8=�Ӣ�ϼɀ��`��b 6[�����N��HwMi�CD@K�70`j��F�C0"p� �E1��,��\2C]�*rT���cv&)���<�j�Fܜ�����@ [� + �Ԩ�}bQ���R�C) a̢�?�����Ց���*]@�!zjR�,�G����<�,8�~!yA�B�39�FR����r��\�\ �BIm��G��DhB� R�,9�P�T:�0��yg,�~�L�N+79Y�S8D�@�yc2�����P"M2� �A�b�x�Ae��fҽ������TD�+�A�b��0���_h XF����[�Rs �Zx=�m ÌKajϴ��L�(�n��N��hvb�Dew,i�q)�SP)m���-R���̲)]� G�8�Ѱ�_h���{�HV׆�U2|�h���Z���*ov�ˋ2�� ��r�6�~ ��v%�0K�\0tj�Ln�ag���`����6�ex]����`ֆW�������IJ�w��1õ���5(�@���kHԽ�^n;�[�`U� q&Ǽ��+�讕ҥJ�Օ+��әS�@��J�*Uʕ+�J�R�t S�T�S|u�����et:����K�~�������=�[���˗\���˗-��M˃Ƌ���=4�§W�x���(�dQ�,��o�>e��_���0r�u/{��p ��_1&2+/�R��ju���BMsQ��TA��A+(�G�f������V��"ݑ����s�J��0���oD��;�s�_�c��i2��FW2�R�O|)L�����1ܹ`)�M��ʀd7_�EkS����%�!c����`.Q8��N���G��L�Bx�Fmq(58��J2�."��Y*k����[�B�)Qjr�\:��=�[D2n;jۍ��05 ���<�p���E ��r����#.�=g���S)'o!�Ū��b^b�7ٺ���nx�3��$+X�wߙ����p��㊙2����@�gTd�����V� +���I\E]�;�2�Tw������=����ƑJ�}��<�k���y�X)�Ћd�<��� ��s��LQ�+�ƹb3�!ߥ�����b�o<%6f"��U�ڥ���d���U)#x�l.+@�ˎ��%q3hZ��& ����z��;R�PYtK`���;�������;�n�m�i�/�þ�+�J�ҺfWFW�Z�(��@���R�J�+�2�WP�*J�+�C�t�Q�:�Fa��R�2��E˜K�~���꿨���z��K�,�K%˗�3v�&\���3o H|��K[8�8{@��B��܈��(�[��}�|N����9�3(�؊�����U�6��b.�>cޕ�n�\�(�)�ǂP(�,D:��tꗮ�7b���˃�3����*��b�1�{�n� +w�8��xDg��)/��{J |Am1���F�[���I�����8���]�J��G����ʄ+�@�c�c +��V�vkqó����U�Ġ�c (�X e�����@ԺL%YF �*T���!��L"���a�LJ�(v�� �1]�7����@j�il�����UwPDd�2��5�C�HmDV�[1�P#t?lB������q�g~�����q*�̮�ד0ͪ�?Sht<E�ӌ�6 +�Yݿ�����6\@0fj��q��g�%�=�H6.�e�:1�P�1q����@Sx�hl+i����UVͼ׀�&������^���Ӑ���%��:��CR����j%ݾ����V�F UE�\\����*��r�[� ��|�.�����G�H���.d&{����6&!s�TJ+�aj��@��=��3��^fzfWJ�+��L�%J�P��鮕 _H���]�!P�z_U�k�Ŀ�C꾦7�331�L�[�D���d�\���K��7o�5����.0J"��d��E�H*��S�����h&Pa1\|2�F��(�O�i%��F�V/P�a��Z�}�JD���1S7��S�e�a^@8�K^\�㛾H�q�+ZK�J7 d��g�����64�����+��?�ۦ%�nQ=�# +p�3���s� ���g#Y����83�#P�����z!�0JP�j�qx��7)(��(nJS01P�L����6ø����O.&��Q1���A��@i.��: 6N�%g���12Y^�@E����`�7/1 +�S��#�1�g�`��L$:H eʕ.��#�����������I^P<2�w�4% +�٫�o�����b�d��43^`%'q� +����f��/� +X��\q����p0"�]���+v��&���*2���d�ec�U^n�̫��N�1Z�&J����2)�|Ét=����x�*ʠ?CՑF��x%��J��y�)v�#U�=�.,%u&5�n"� n^%^���5�ll��69��)wx��ppoʡX�/�Q��օQDv�����Q}�Q��hĻ|"/�vZ��)�=�uG1VH���8�2���+�]+7�=jTÎz����נ�Ъ�N��Mt:qЖ��Net������[�\�}._K�}._��s�e�[����YYIIIIR�P����Y9���" h�t@9� �P�a�Vrs(Eg�w���BM9q��V��Qm�50���X�r��֠��x%4+�_�ⴉR�3��J���)�%���l���~dT�z����ԫ�.7��`*9�`�tvv�&숖��U�W��D��J�7*�&Bw������L[a~b�s�x~�M�D�AF=�B** w#�% D +��h+G���a\ �)�{�L2�IZ�]Z�Kp��*ьQa��8p�wl(���x�����X|�H�W���3��5���:��j�2��&��ق�2�{�1�f�Pa'V?�%m ��)p2�ue�nn=�)��@_7�Pb��.ڹ�0s&s��.Q~'fV��fW��`�hX�����u�_� ��1X�ܳ�W�a ��S���+������* +[ �@+ᅤ��|�c��B�0Tm��ڻX0Z��SM{�F�pF�a�;;JI֜{�H����Ƞ�� +�G�ڥ�A-*���q1r�1X$�T+��%�C�%͆y��ߘ���hy;w��`9J��qh�2�s�W�B�VS��� �!V�qP1����RD����.a Ԥi����+�����J�������1?sPzܹ|K���\��}o��Ů�1*TOMu�_@��[.�݈7�u�0�6�&jdS��['$�!�w��ΐo��fݳ!�����Kv�=��7�S�0�`0��\,1Y�|w�F�xa�梵�M\oN{�gUӼ{���������ȓ�LsPb?<B�Y���6�#о#�����ig0���U�"_oBn"��.����8�R���F�ω{r��ጻ� +�X��|���M@s�����7x��g��Y1ѯ� ��HQ�˥�!rb�8_h��o+��2fe.P����f�hv`���%�~"V����D��#3!�e^a���U�(��-�*)��a�<ʣ�\��Vw�ʴ�aF;�B�y���v���i���p&�� �,M�م��9�;�Ł�}�l�Qy\qj9�Q���M�oh[T�m�l��8k9����`�`8#�)������Fe\ᔼU@lgd��"w�,�;n�h9�/eQÜ��X��V���2�j����喖_���*��K ��n j��`&�P�wCo����5�tS~�i+.*Mau�!.Ra���� +�lJ�������i�q������=��7,��u�lؚ�Q��#cZ�_#1���aዞ L�u�/Ê�˕��TC��^"�7���W�;��S�ʙ��PS�v �����aw�OC����R��z*q*T���U����ӏN:e�u�!/._K�}1�2��._K�}/�������R��)�*T�R�J�+��[����Q|�aف�;�Rڨq�,W���W�ڡo���g� +M�~��a����{�ʣ�DZN|O��fRk�Q�[��籙��@��v�)}��0+�Ŭ|1���ܴs��zZ��f�3+�)��%�Ux�ω_Ƀk�JI�`)���C&#�}����!5(T>�� �~ch&-w��� /\��,�A�r���0S-Wx���#?Ļ'�)�������>�^�^f�5��!�dƧ ���\bf�!�Eq��ш���w����H9K��d��ev�w��A�������@�H*�!�u }��B���0(�8�#��M�A�\���o�S�{F蝠���w)q�m���&���fdܦ�� �|� �~ x�.��P���hc�9�Ob�&j���t���7���QjP!8 �R��X�ߴE�4F��6\$�1��jV��K�-�D����*�V+Yk�%��t����.-��14F���(�ւX�{& �p�m����X�K�pi�V���H�k,v���p�Ժ����Bv7ҥ���<#��hTFM>;K����$���~��|�w�ş �pL�ωZ,6�T^x`��x�]�$vǖ2�o%s+ cD@�$�w����Ѯ�Һԩ��ҽ��_B��b�^z�.��/�~�̼u�u���r���\����˗.\�r���_��Y���Ԯ����ILc�23)\�_7�(�w����}�5 ����%�� +���v��$+��r�^gy���% �� e�B��G��.���Uiz��֏y��<��v=��L{�ٶ!�@Ķ�G�e���T +;9�xj��=Ѕ^#ϴ,�g�(�R���5�#W��#bwX�!����N��l�e0��B�hW��n9��6s��p�@y��!���ڮ%p�"�.\n_U� h|�X�z��`<��> ��L����0�0�!��'ڄLia v�:�d��Z��x����$�YB[п�u�����U���@٘���f ��Ķ������C�ac�C��4���L��&"g�F��;r{N�!F��p�J���uO��)����S�YA*�vj,)�ጀ��2F�߈ؽ<Ķo0*���B�7Y�Pc�[��b�t1� +��w�Is�PrV��:tO�+*��F�x�e�Bڼ� + +!h�2%^�P{�4^lu +�YAǼ5�v;F�Ua�������cK�.�ٸ.K�2�6��������8ML���� � +���x�و�p�%�Y�0���]��'uv����v�>��� �� +�YXּ�"�Y^/�RߌC��+����)���+�)Ǫ�Uҧ��*WZ�*J�*T�O����鞤'=y�\�p� r��}/��}n\�r���s��Ϧ�'����/��ùqԴ�d�R���q=��8�QQ���պ�*!}����,��)��_h���Օqd��%/+L������-�mur����/��8i�@�jh�x���˨h\���Z!�S�m�!67ߘ���q���"Xw/=�̶�D1q +��Kꥆ���~ ����}����|�9l�DZ�<s +/~�&�ޥ8�9̠�-�����2djL�>b�٧�`k1�/�(n"^ �įh=�Q�"�1��h�̘�wq��q�����������X�KW�����9���x~ ;i��ݘ�ݐSf����������'�$J�.w��Th*>��2�=��<ͪ���9oR�j2{��#_yu�&���PnV���v�y���fX�,V��ƴǨ��.b��d�Qu4l{��쳴b��5q�cL+����bn+L���Gj[�Չ�]o�G +�a��a�`��?�,��j�����Ŏ��:��2�_r��s1cZ؞�d�8��uXq~�U ����?�4p\�:2�/X��4�eVq�Q��x� +\��.\����L�`U�Ay`�%�xII-�ĵ���%mZ���m̰�;KF�S��( ��Gk�4�h �%<::J�ҺT�R�ʕ+�J�R�}*���!�r�?ؗ�\r�˗.\��.\:_��]�p�������r��u�^��h{N��W1�UG��n��k�=ʑV���2�3�;�3�.���jV/,"V��C40v��U�q)jx*eYU��5����7�� ��p{L��c���*����=����'0��N6�q<���T���c&H����nTc�l��n~��7�:���l%��i� ^�:y�:��b�@�3 �R���iCw4$ w�"8ܦ�X +�J"[��~#F桨g��?�~x��2@v�1�� �"�X���-�1X��"\�Fٹ���Rna��<J;�ik�B�*P)��q�P�!#O�������e�cJ�44��a7+��P �1���sHW&�f�l��B{F_����3��j#��>p-}�9���܈*%����K�u2�����g-��,9��'i�@9������t�x��+��0 F��+^S �C]��c�~8�A�,��h ��Aw���g�Lo�����h� +�QlaA��0��9�1!��*�v#�~%��\\C<Kq��sD_�A.Q <6J^Kx�nP͗<J.�V#@�8���8Z�������ȋ� +��F�A����-Z̰f�&;]ʻ��ޝ�|0���4��R�z+��]*T�EJ�*T�P:T�^��}CןH��r��yr�K�.Y.���˟�r�}/�_��~�/�.\��/�R�5Ҿ��BlC���Z����vrF�ʫ�y�B���%.MLK��,|� +Uͦ��-1�4 ��c�2�V � j�x����P%��\��2�haw,i�͒�SZ�x���� V�J�o$!*�E���KÒ������b�C}%�o�����R�5�2ΣB�'�T��z�X�naL�}��W�%�� �� �V&��Z�s�}��@�@ˈ�U-E�Yf_�A�����r�Q��v��>e����L ��(�3�V_~%��Tôg�Deߖ'�A����{A���&�*!�����%J��`%�'A����ew�1�~b���!Ym �^IZ.��x�|�`_yau+�;8�9�U� +S�IM�'0'��x*��T�?{�P�;9������͖�E�ٕ4�xx���Lw�L~�,<��q���9H�T�9���Z;�+��3�k���r�2W� ����uGh��1jL3���� +!b��G�qۚ��ho��*U�� ;�㼹�� ψ�.�� ��<�5F�y� �t����yK��j�b�j^IJ���A�3q Ky���`$���!�aw����2�Xpz#�6Lza��4Y,���wm8'�6����$F������R�*T�R�J�*T�R�T�R�}?G��?Hz_K��ۡ��l����I?=/��}[���R�s*T�R�T�R�R�R�J�+��&X Tb�E[]�e�_w����<�iEU݂79��Rq&��Q�s�B�ւ���!a����vln4Qٌ�V�Q��/��~�h��=�)@f�*�CfLӉ���~"�s�L(x�"a���f$ f':D7�9��c�hn��+� �\&/����-�IaW�`+4@���'g1�ˊ��e6�G� +��ԫ���@]D{��\E���h���Wr�Ϙ̕x���Wܐ�G�+��rϖ��J U̡)�Q�J�0+���$�Ȗ����2`�q~f�����p�xV���(b+g���c���5(�ƅ[��t�/�X7��wQP���H�xF^f�h�ճr�����{�,J�8���K�{���� =�W�(n�������;�"L+�T���~e)��QT�^�����*2ΜJ)��(B�]l|'�R��F;���n��1LE@[R���&iq_��1��`l3 �^�H�6��hd���q�Yb��=�`x,6�~dzQ�^ +��0��O������SQ� Esx�IR�t�b+���%�Z�?�A�U��TaP�Uı*�O�����[}����6zHrK#�q*V����f���K����gc�T��*WJ�R�J�+�J�]++�t���LʇJ�]]u�}�\�E�����Sϣ�>���zj?S>��*T��*c�?�j��_�(��; ��a8Pxb*��W��'Ŀ�^A�;1}���� ��`�vh������^eB���͌�3�g�SW��� V��&M`�m<�`l|��SY�[�<F�c�[���A�;�,P�DP��TDf�1�1�G]�9b����3��5QV��M�g����@�Б�����PI����d��7��4��� ��e���Lj�fj-��������g�`������m�|BWG�;Fi���)��� +����^E�F�(�m D@ќv���h��%`�|�w;��]jd֘Q�N"���ˋ靖�.���x�!{O6�*c�U�-�.хI��5�Um��Z~�K��+�y.e�+�̡�����̦�+Eو݆�����Nay�T�K)"�`�D:9/�+%{D�e�ҦZD�^҈J��y���=�5�(�W��h�Q�#�{N�e��8��1��l�;;Y]�~co���e��2����gό���ߴt�w;T�t�?��̼ʕ�Tz(���/�y��s�@w*7U��K��|��C6�g���C�`�5/ܸ��u�4��j\��+���o)4���P%zy�ת�T�UJ�R�Q֥J�w3��銕�EC���q�I^��_O�[��������;�z�v5�]����U� �'b2Ȇb�F�KP��%�o���_9|D'��3 +�ohX�����.;�q������+�h�yxf�1dn3~I���J�z �0f���0���ek��*�v�b:��%�.;�ľ⣼S7\F3�1O�R��?iq|���sU�"�"�*_u-�%��_�_��̄A�E�̬�y��X��&N ��]}��rv�"�w)�2�oW�5����E��_J��q+2�b��r@��4��`[3l�2��E�GgxS��_p��,sl�����F9;j&�{�K +l�*P|̴�����.����s.�C�(!�C]{AE�~�d5�kK;A +wh�Wƣ�MEQ��C�Q���r��"LǍ�o���QPY�;���2n�(��4e�NDLj�+�G��@L&�a5�ђd1 ��+��`ܯtze[��kS:��4o�u@Ց���{̰R +�i���[��x�@���E���rי�\i2�iTt�) +���e(����}�%����t�\�WC�%�w�WD�]��PY��s�~`H�p|��w�q��i|D��x�!�(�z�02�������+/h�ߖ�~:9"!�k�R�J�*T�R�T��ҺSֳҥt����я�t��G��һC�5���Ӿ���2�=7�נe��^�C�W�� +�A���M䔻.-Οh�Zfe5�e�98�@��������I͊��^G1�F^"�2Δ�n��T� +�6§Aq �[U*�y����5�w/k au +���}���{�,ɨ��#���<��[�\�!���ը��)o�슐�E��a F<x�'i���ġ�@p%P�?���tdx�o��X��̵���+L�#s�(������ +/<ܻ�;��3{x����,�1+�s7��R�k���D7N#]�A�����m�{�����~W���]���+�r��`�Y����֡|�h��ҹ�\�+���"����A��0�4μ�� ���y�mo�F��W:#����;bP[�����9c��i��+bq�lt�J�N��P��p���SP̠�2[��E2�*$p����`F��ʫ��!@;��h��5)�Lg���Ǽ"��d�����_B��,��$+���¼}�N�n۹jp�����E��a2.��N�A�W0~ҕSk�|J�3Q��ղ��� +[�h�yf`e��,���pksh������B�;��f ����O�a]��"I +l�*T�R�J�5+�=*T�^��+�J�ꯣR�u��C�^�:���=.c����._K%˗.\�r���_�ǫD�����+�(�!���514"���\�\h�lj��t�o�8�U�u*�|\]��<R�ȸ-���SX[���X�����{��M��Kl� [E��k��}>` J� fM��w��V��9�<%�a�%~�j�?� +��9���I\L��0�-C�{��������⼰X��e�8�-v�"���!]��;#��.<�|��F���[���՛�YRR���\����Y�5��k�fY+b�s)f�ś��V�w�1j��E-���8�;JG��U\�_o�'��Qs*�Ƙ._r#�����S��F�M�cR��%�\d�p%hx���Qx,x�o���(sU)<�|E���ͼ���f��r�dv�p�{ �9����aE����犘6d�`�j[� �U�,�(�.�&1�g($�:�_�%�Mί�`�,�������*�*�`�+�"�&����AY�QB(���9��r�"�N����ɨ@o$Sܭ���058/sU݇���R����Z��w���)�q�.cJ��b1W�'.�㣄�K8 +���6{F��F}� �f��A����<�,QmG�9��@(�2��]��]��W'�䨺�eLd���Y*TǢ�ԩR�T�J���W������z�{z=�J�R�J��J�*q���Ox��в�_2�˗.\�e˗.\�r�˗��"�g����^�^둚˞�fqV w�l@��@�����]\�.*=ѯ��-�������G��w�v�9�4�Ȃ3f�e��Բ����^�������8_�w�?rC>#��?����+���fLNJ��8�Z�8�!o���|!+�L#�@��i��±�Q�@�A���f+cBن�n+]�K}�5*gp���Y�®*����M�v�H�z�0u{F�~%�HJ���јNȧ�2�%��D��喴Ax,�b[��*��d���{1(��D�_�S��2��R���6h#0�{�3�1�?�*g���,�� ^��P(x��U7�p����Y�Z�fyy�X3�U�C���O1���#�bT�Q�/kr�f�� n���g���Ǽ��jH���GY�<&�!{�W�PA����)B.#����&d���;U�e��Rݔ8�����~G�K���vb�UE٦��v�`�1���?0$�@u| �l<{��߹ y;��M���e,[#�E!0��i��J*U��=-�&k���<g0j1�X�2��Z�+���8�D�"�̴e���xf�>�����-J�nj������ȟ¥��-�]�NdJωE�>`$��c�d�\�7م]+*T�T��y�T��+�8��~��|J�+ӯ�K�̾%��qe˗.\_E˗.\�r���r��q����H���Ųc��Nx���i`�L���ٟx@\���҂�������� ����P뼦��n�㙉�. +/|�Q7�݆*_�E^C���/�����"UkZ^�8Ǵj����5��R���C��1�J��J�[�4���Z�a�l�d֢(b�\����{�*�����j�9� ���Gu�!�ظ9��d��<G�/���y�����5��9Y +�W��9���DU�)l#_����!���e-��lj���cƹ�����m�e�3�ƅ����1,�_�4�_̾��1į;�D��P����\���1CeYɻ�3q>%��h�"��d �X&J���Z�=� +p��Z��Q\3/fc�o4E)�#��4����M�#,���7����a�J3��1Ʊ֢L0]�.Q��s�*�$`;� w S5ɨ�]���p͉y��v�v ��`�+g����{Ki�wax�;����?q�M`a� +ņ��-�����Sd*��aA���6���g�(� +7WOo0�K�o��\�|�TIQ��P#�F�q�O� +|���eOĨ+��x�ƭ2��ܿ� +>`X��.�܁Mg2��\ʺ^�������4Kl���[��!-��*@.���ҺT��_C<���ӿG���J�zjj��x���E�/�˖K̾�/��p�\�l�}._K�.\8�.\�r����p��z�����i3/Akpn�������:۴�H�%��3�oy�����aw�K�M���e��IB�����(Z�[�P<ט��pū ���R�٧�.�Ow07��^�\A�Q�����#L�N �f�d75(�hAY�h"W0+���O�R��#ܞN��P��0������8���[�����`�(/�����hx�f5�4�#3*�4��(7ˉ�D_�AU�* \J�.�3!�EP�,��i�$B��:�N��˚��F��I��p�N��C[���g�XG��yF����ko�E����ȫ��(#�w�J��po|�s)/�(�>e��(��Q��ԃ� �4s�V��(�h��Cv{�@�7����8��2��Q��,�30�D��|D2��)��JX}�,�k�����Y�\`60��)�9��}1y+{;C�{��7C��fZߗD�@�{K惻׳�}B�/�ÃD+�+���!��2V��Cm6���~Ll�<*ݚ�1�;X����M��$���HY�vDn�����}n6���S�b� ���4���%� �f�j���W�(�eAP3����]�N�x�s-s�����V��J5���u���._���g������<���%�ߥ�%˗._E�K�����u�~��}.\�r�˗.Y._@�辩iĹL$���>�\��O�j/�`r0 �G��Cv���k����Ur��2�6v�|@������-;���i�!���e-��Gj��o�H@Z���ߨ +�WfS;\�qi�@Rm�̫�oRqnb\�^&0����[����"���acw<��VbwrՐ�����5+0f -�0��j����S,�`uWP�Vk8�����w�͇��|N�F�k3�pF�h�L���wMn+CR���M1� Ø&�c�~��;|Bj��g�$�(�8y~=���lǼZZ�3y�"� Z�06�jc�(�N�SR��D���za"���5�hP:������3 �Iq�������>jS�ybv*��S-��L�߈F#�T_1�����O0�b�� ��1����˗R���7D�+n� @���Ajr_�n�/yq��~����h.~#*Z2���1UF +�2�asZ��U��-}��~=����b&�ܸ�2np��V�k�"��6upP���'�幔�9���W +�՛��eп�����v��0��TrŧтCI+5��y��5�����\�R�4�� Kx����5��Q�]�3<�~��N����Epq�R6�8X�����v)�Q (�s��o���Ϧ�����=�s}1�$���}<�3�n\��ܹN����r�˗�`��r�r��2��.(��������"::�K@�� �3wK'r�g U��x���c��$xw�PM�{MLB`k�)���M*���r)uP�d�����2�Q��f�\/#����G#��[%تʘo�(&X� �L�]&���j��+����yfZF�T���]X1�f]J�Pv�9�5�CR���G3$s��jT"��7]#w����s'�q�1��7*�+��07X���.��=�@�^�>h��^��4��q�k5���3�� ���kO,�o@_̱&�3>g�����e��Zs|�,�`�EX�Y�c}�p㘾!���*�J�"���AiuSH��|̲�,̿�U�.R�,&� ���0! ��B{eF��Þ3͘eM�q0�ZC2�t J��r��guSdG�`n��%�c�sb�*it0E�4{\)�A +{��H�h�����oA�A�����|Q/ߴ���E9k�a�:[�F�F�Q���c;U��ˋC��U��������4� 1Yx�� �p�Ph2Mv�،>y�1�2��r0�i�h�\��J*�'�獑�˞��\+ o +�F��M7!U��bܫ�$m��<m��;'��z��龖}>~��o�~�%���ۥ���������~�~�=Y���Oצ�˗.\pe˗.\��̣�e��t_@�������#����#�N��9(�.�����0�Vw�����|åg�4&�P���i�c���� �7���]6c�3n���n�v9��>�B=,�=f�®ׁ��K![�nUSF�4�m�^"FܖT�-�F�O�L�VՆ�J^N"ñ�������1�My�f�mB���̩�|n]����%�܃$E���~"W� K�̥T�l3��g�*[�/0� +Xx�T��s�;w(��3���xJ�Pȋ;1g� �Cr�� e�1��։G�B�����@��~��kpb�V��&q��h)����WX���`^u����L�xU,��8����f�{���b*����33+���Ɨ�c��&U%J�3��Y����n�y�Vw0q3���3%�e@:���q=�%t�b8"� sP�Eu�� @lnQ��;ÊަB��o2�)�K����O}¾c�����E�����K�˝�]�\t�+n>A��E&q����k+�^����v1q��0ll�/h����]{�4v�+�KI��/�jZ7��ZYc�c�Ήb�s=���-x5�R���MF��0bi�Lq�7{�)�lFH�e�kQ"���,{��8:ߢ��� z1�ۣ��+���=o���B��z�c㥒��}n\�}._E��.\A,cf`�K �K�/�˗/��wԀ���s-�sG�0���5P%W�~|"����h�]����i�C�/�Wt�~�̥�/�J�n�,�-p�#�5/Y1PE�6FQ��� +�̰S�(��/��&�h�?̱��0���xNj���W)�K���)���7<1��(_~����"�/��r�&����+�&�f�]�f@y����vD�L\�y�Eqa�o�:�:[�ɸ�]��9ߘ�̲������-GiB�"�3��g�]w�Xf)b)lW������ļ����وJ\Q��87q�LM���Sk�Ɉ�u��|v��[Ip���-�컩^ ��D��t@_/�̣5�LH�\�b��܃t���������r�˗0j1q.%�0�y���B���_y�� �#Y^к�;�U��KT~��|��T��;����̣Bk��a��r^#v�,�\� �P�6�L\m�h�3�ġr�Y����h�����^�H���� +�C��0��Y�WFw6�Eļ���rG-����������o������(��E,^!g���Zf!�����h��L����U��@o����%n�eg���nW�ۯ���^~�=8�Z�~���{��~�n��>����������8�FN����f_K����nfK,�_A�/���/�E����W���pK�)��Vop)�ᖢKJ��K�)!l�����x�+5��+2h'Q�̪P�ߘ5N�y�ۣ�5K;���I����e��1������S��<��Y�}�,7k�����&��=�`V�@t���@��(��1��1e�5]L;�E���Ȳd8�*?�m���6�x�"/2�T����E=��bW�Կ�� @��)�E�ʼn��bf����w�q]3�c� +����0�8!��L��Y��Mʻ=�eh��u��J���+f �ᶙ_��nS�+�ķ&eBUL�|�}���vF-l�w���Dvb$��]�|A�d,�� +eƾЇ�7���2�9��!�8�N�*��� �!�SX��0��3"_RH�y���˦����E�o� +�|���*Qz���-�䴊mr�V8g�1���خ.m���FU���DeQ*�Am�Y�@��S�����4�m� Dy%�11x���d ���e�P/3ަ\D�F1�QDM�a�Ts�]0-s�x���R�{r5)V:N!�7�-�xy�DI0yO�g���3�'��` �� d^�Z]��W�}>~�?��/_�Mz+�?A����J%�O`�ߥ�8�����].\�}. ��C�˗.\���r�˗.\b��).��<GF-�%:o�0<j�+{�S|`�Dzi�`��PS�Q�����X军0��s��V�ë��Ww +�0��Z��Qv����dQ�K�cF��Z�k~!d)L̹��5$�;� ��cs �%8��b��>f��l$�ƹ�%kg�x�d�@�y\T�W�4o��I�û��̑�3���>5���������)�n��WP�b���V�0˳�wTt��x>ҷe,�Y�9e�U�N7��/s>;F��s��4��(f�?3<s�m�w�3�ܳ�Ǟ�-k�Q�=��Yx{˼�,j���Q��K7�\j�[\�+�K�K3ܕ��FJ�Y��H�#@R�U��q��L�bUYQ��.��.R�DZ��Kc����W*Cc�!����`.t���2�!6Ĩ�sG�X9BS�ǃS��k�cR�,����Q����q)�X���r����>e�@�ޝ��U�t�kY��G������s�K%Y��e7���jȪ-:�r�����O�v��� J\�|�2�]z��R��[@<�9vw>ahƆ��YB��6goPiW�7Z�r��8��&�]gW��f2'3.���BV�f`��K���ǣ�}3��F&?���8�tǣC�E�ߠ��?����k�,%˗�I%�*"\�r�˗\�r�.p�]��D({3SGpk.�A��g�Aܙ�����FP42��7���, Q�G7�ЫM_ii��1y8�� +Z�/�E�Qkk�ԛ×�a�կ�(Nw��l�q�c]�9��x������1�4���%��J2�"*��������̽9�o�\B�"-���;{�=�٨�pp9@41q��J9�����Ox�.��2ۛ�^m7�L��O���!�X-����A�� +���hf nP�Y�ǝB7�,��D��b-�>]C _2��q���x���1�;�g��u3<���Y�̴�F���;�f��W�KC������م��(f��˳1�������w`W�x�!�Z�f2,��1���¼�V:�����73_R/�`��@���_h�S�`*4gx/S&ewL��%�V�p���gSzc ]��|@��1<@��8���B`���˭T�S�Qz��W0�A��P�Y�-/-��-X��e�0�� ������)����nc\,������}�95Ĥ +�1�fL�F�7� �fҳ7Ҕ�1�D�nj]&r��h��E�`7�@��>&-k��0.�����'�.b�J�G�����ĿN>��|���e˘���zs�e�/����K�g[�/�y��8�Ϡ�O�M��}Q*"�\�0P�8��r��@�:���?1 Wq� Z��L�c�p��w���(Z�G�Y��x���N�_K]� �H�٩Pol�UV�+ +/շh��?_x���6{�L�����5��+ٗ�Egi�얧�cR��&;�ĩA�u�a�Ƙu�~�����~e-����V��K*���EL��S̹O��rN�J�87�aO0;���rZ= �K�Y�~b�q.hlj� �1�<"�����M��H;�����)�#�-s�� �������� C��DZqpCz�9^`��_�̛�/�����8J�h��QP��¿�Do=��D����!�C��(<���S�h�ùs�qvk�������1<1[��qY}�;��PΧ��r�ڹ��O�x��}��U�2b�h�<]�����j2��V0͘ibs2��t��:�b�RS�q'D��q p��Y"(�8��ӈ(b6Y� +����3m��% ���D�/��n/�K/ +�c,&�S%6���ݼ����sN����L��XĭJËp����y��?S"�.���ة{u�"��@j�x���,DԼw�Y��Un��%N-�0/F�^[����k�LEV�po�)x��X��Ǩ��i[�B�)���<$a�@ +�,/��Sj��ߦ�Y����ҿ�r�˗.\�r�/����˘�u��.^b���}.S�˗.|���qz\�r�%��.\�y�.\��/�0�r���D�p����2�Yö%�{� +�p�hf��a�3�qP*�㼡P-����P%�+�-,���#0;�)�0?���n'���� E�$1s,^ E�+� i�������8���CO0Cl;�h��B��c����3�.\��SWIU,��3� ��������ic&����ܶQs+�q"�����+w�����ψ���з�os�W��k��-:��Er���B��� ����1��8��������]�J�����a�ϟ��l��F������t��(d�<Bu +)'��X����L>5g�g���M�B]����@����� ��Bg�N~Ӱ������)�2���]�X��%����ؔ]��5�����"1�.����*��^r���P v&c�3�'��qD��f���\J8 �˹�d�q��S4A���4����mC��?r���$m>�A)�w�!y,��\/��к��@W9+/�%��F�Fi��C7�"y�nQA�� [M�V����$)�hA� +ɋ��&߈T@,[��w|�d��D�LCq������.��0�Qz~�x�3��^.R�=�=����̰ġ1Ò&�����S�y�Z� �#� +\��h��xe ]����O2�VcBJ9i�Tv��2&����rK�� ����ѿ]�/��/������\_EJ�*T�]*k��̶\��}/������T�$�Lu+��r�˗.\�r�˖˗�.\�r�˗ļ�\1�+�˗.\�r��B=����P���3� �e�E��Y���9.�o�sj�/ ����G�"�C���f�web��Ӏn&b�x�$u0kX���` ���Z?r��5�D�%)J��͊�eT���R]9��[����3�����MGD���13;�����u������ Bq}$I�.����ǘ� +�ŽJ�f��B���e�t�����.j����1���|ʫ��nnv>`&{BJ��Ø�1o�����/X���yg��p����RoS"�������8;����2�HdK'hl�Hg��B����ܢ��pw�^��rRoP?7Qe +�G�8�q������i" ����*@&���^�sP�U��59�R��9�B��92kp0��d �B旸�rn4)��� �E�ܴ.ܨ��hs���0+y��� �n���<�G8fe"ٱ�F,�r�ï�@I6��J��c��e�����b!�S��������6��ܶ�y{��6+O�P&�1��q�"�b���r�&�ī�n+�w{*!��i5"���O�� +�Y�%˃O���T<D���l�dv�023ڡ�lsRʋ]�U�P�E�7�����eK+�����l rsiF�`w�D���2�V���ϥO��_������}/��e��Y�_��Y1,���qҥt%���R�u)�S�����=_��/�˃�}._����̹r�˗��˗/��}*WE�ė4ܧC�`�5Z�+�l���j[a +m��N�R�˲��4����G��@oy�M6�0%�h�5�b�SҊx�E8D +0۲���D����b�����Xl�.b ��]ʂ�Q�7%�2��97��o�%�7�6:)p�Ox"_�Y��fa��������7u(U�>�3r��_$i2%����Mq̤��hȕ`�*�ј[������s�0#���I�� ���3�@S��������L>b�㼵N�M�)}�Gf�ʌ������qJ�@����N\�1�;�_�Y��S{jڂ�� ���[���������h@�_��jc^X�+=��x������"��(��@��{q/���P�x4�4ʹ�n��:y�kD�FXZ�� ;�`(�<�|�0�&"&�ܳuj�Z>b!���6�&L��k��l�9Z]���\���P��ۼ�`3O�Jq�f�,��q. r��-����� �jj�� �y=��̢�y���� 2>�a���i��P��g�,^Fۈ��rCR�]�q�-��42��k�i��@![X;F�pKf�?Q���/�͟�p,7{�M�XC��� ��[�0CI��j�0YA�f�N=5�gK�_B��韫s����=}�ܾ�.\����*SԩR�J�*T�_N�J����ў��l�r�˗.\�r���r�˗.\���Nc�D�~�˗.\�}.\�Y\T]�X��c��{N@��j)��*˳�¢������a>�d��b�>��G7�;�[��%�x��]uC��´�(��8�+g�[�2�� DW��-�cWXu�T�X�1���'�D�C�p�j��.� ��pV��oiy�=��h�G�g0�����,�lw�eN1�X��_�ܵ�ʨJ�Z�D���h��|ʴ���9�)�\�TUP�I��#�!R��)��n|ǵ�����Y��Y�y=�S��d�J�-�L:�7���?��wQ^.P�\RK���1 +M��VF��%�.�|��9sL�1� +waX����W�0�{ĥ����L8X���e +�x����Mܽ���ÈKXaf��.���*P��*��dhT@��?x�v��X�]7��#��Y��W�w�5q��Z��-$�u^�%7�,���c��p��Zr;�Al{��so�Q�.��8����BqdH .{5����!Ĵ���P���g#��^��r���p����aNO�5���w�MsޗqM�N&�Ev��|�8�L����?��D刣)���~�/�@���ݘ��X��{{AѠ�"�j�.8�`G� +�'ux�/�w�9p�Qr=�a�b��-j��.\�Uu����3�M���˗/���Ĺr�!l�[�73�q���\Ĺd�r�5+�+�J:fT�R�J�ҥJ�*T��Ё*T�S],�w�|����gį OyL����k.\g�=��ұ��m\��[//���2���R��EA]�s&�_B�*+G�l9\x�4����2��"�GJa�GK�Z���ڸq��X-1�n��L|�</�c!EJ㾮�����C�[JԱB?�4g+ �+o1C]��L�z��l!�<�AW�a��[���JLL%9vJ�Ϙ(�ik?Q�A�v�g +|�$����*����gUR��'�%V�T���T��bJF]���贮"{w��iLc_0�a_����/d���Q~�5+ħ�oō���]���~a�"1����pK��ʱ�����f�c�?�f��h"]T�w����ouQ5���1��+h�n���~!XP�Ua}ʈ�T�%����)��S����ơ�-�Þ&ٿ*dg]��o�`���Y��.�W�3\�P1Uy@6�[f�ƾ%]�U��P����% X�ep+_�[��o� ��ؔ�DU�T2�������d_h4N!�b�S��m+}��$~ �x����*VUc���\�����k�eޫ����[���2-���� �PRs�w�J�K8��H]��3�Ĺ�PB#IMx���u�(Ow��:���S�p�f_��K̿F�9�y^�|� �|��������Q��*o�Y����~�����뮗�n\�}3�Et�U��˗�]J�^��/�x��d�1/�y%;�%<���e��}�>�J������{�yg���<����c��Or{~ o9K��bb�c��J����+*`��-�,%�fY5LLو$Q5�����r%���/���UZZ���JV�~�2���s�=�F�V��� L�EV���I.��Qo��̣�pY��2��X�\�̡�11qF���*���@[q�\��) +{p��1#���TG�pp�s��0�2�y����T_������aĠ�p�X� +��1���0D3p�̹���HU�ObZ\V�U8R��NL�l{G8��6����*)����J���J�c��O�&kR��%���5ߡh.墽�-W���q2X���wQ��.�+��ډO���1����"p�2� ��w����0�]j�`�y��c<����x��#ؔ������yo����� +����W���Ĭ �<�k��k +����",0�B��j!,05�������i1,�\U�o�PZTl�if��1c��N �j$��E��Е��*l��^�C���<E�*^��q�V.�u�����E3t��x"~,����0]T���(���pmt��Q�K��=�ڰ;ǰ���S�}WĢ��h�����>�"8�u(@�^��W�-�(�����ظ����F����vKW[�f�2&|gQ +����Mn��v��}Z����jeznfT�R�u��J�ҥJ��2�>���~�eJ���ԩR�J�)�Q�Q1�c�˗.\�d���y~�|?i~��i~���g���K{L�ffz�E��2��>%�%��Ͼ�wKs ��wMs11,�E�D���C�Y��Nt���%�J������L���y@f־%Q,p���T���JX1h/>afW�!���a^K��t�p�� =�j��k�Z[�@]��O�-{����*���\�b8�BÎ���1�#� ��~y�|��(�% �P;�/�L���a�B�� �c���R�@ ����ˠ �b�/� +�!ߥ}�ܼ�:�����-�%C1�q��w(c�K�?�Gp�a�z�1�s9�j��c�+��qZ��0��h�Yi�19��N�_��k��$���|D����K��� aq��.R���͌�;u#ٟ��]�!gYuQ w�G�����>��Җe�����5z��$S��LiK����Gfb�\�"^�K�ì��x�4�C)�l!P��0�mx�t�d��]��7���J��%��{x .� �`���0�B�� b�v���'9�̣f�qW���Qh�:�(%��ؼ7jo�0"��pw�7�q�Urܬ�AE����H�9��fʍ�S�0дoj�����Y�t��������{G���cP<�5�<Fn��1ǼE�ڍ��Y��Vz�Q%7mD�P���!�9��e)lW�� +��gi�c���_h�T�c�2&��u���K鮏�ۮ~�w� R�=u���:�R�J%J�*fg�D������/�������s=�T�Q��+�Qz\�~:f\\f7[��Vx��2��u��z��T��iGiGil�1>�!s�5����"&. ���b/�SCR�6{;p������T�2ُU���1V�湅������0Ogr��g����� �=�z��f�Z��x#��Kp��r�j4��������k�v#nx��a�(b9nQ?�͌�j��q��:���[�X��EH��F��NٽP��_��|\��+��GpK���c���Ǒ۩yk�*�7��3��(�ಕ��!�3+x$�'>I�U��� +{˻cC[?0c���DVd��� �����"��0-*����=���-�f�|G�f�c��L&�/������D`�>�!]���7�_%cĵ�Ekd�`�?x��Q[m���X���aW�ʄ��ʓ�Ơ-�Er<��g�-@�$\��F�x�JU³4Z��P�v�����~�Cb�{����F�Rҋ��T��L�`�3Wt��į +g$\W��� ��p��3�0�%��o��@rݺ��5��I�˧b���d5oh�/�V�G�k@;���q�%C�s'?�z��4��<��K�k�K���K��6a�v��P�����������FJ~�ɤ�F�dTq��\��@l�y�Z +��^U�2 �״R��g��EQ�^�U�K�i��~�>��>�e}N~��K���ܹr�˗�=sҺW��y�]*T�](�R��fT��q��a���t�A*T��.[�r�r�Y�Y��fWJ��A��^̷�/���=��}�Ey~ж�e��a�2�;� $�*�"����xG�-*ZHλ�����+��ԭ5k��z���u��W1�_iZ]������ϙZ��]B�<~%0H��3>%����� +`x�Yx���r�n7}�2Kb�+��c7�!�K52�|t{J�.���N?�~b?�Q ��Ƽ��z�H�'�F��aq(����Q�^Ў� ������ ;ƛ��&~e�3�=�58���KWY�lc��y���ĢW�-�����s��,qϊ��S�ͼ��v�ge�)Q������ �|@��X�����6� +N 7~j��pwJa��m������c�*�� +Q+P_�q+e��4BN�Y+��GZ_cr�U�.y+sD��-�@j1�e�<����{L��k2�-���S����[l�/��0�*j+���(1b�3 E�����L=����-x�7TǼ�JQ�A`-;��/L�+�`�!�^X=��*���n�R�\TO�A%Ʊޠ�� jScrկ�M�Y��/��Nb�_iWƥ/Le*�|/U̽�c�:�P7�7r�B��l<�+����8��r�D/�y�Gqef���k�(���Ns�!��Elg�&@r�����Mgg��]*WZ�9���]O�V�J��(�ҥzj��*�_�r�%�z_K�v�T��k������;�'�S�O��2���'�[�g���RS����ry �'��IN��䈔����g�-�L��(w[=���ሊ2��i̾�[�t���]WAF2�d ��#�;\�S .3�* ,��E��1���M�,�j;��������������-�8�MF����b�㢵�K1��\�U�F�0b����ܾ��_� A�D��*'i]*��Zi�2� ��y�����:o�{�H'�X�`��c���Pi� ���u�W�y�OwܪV�l�h��>YVK%�������v���Y�1d\�"�a���fp�̜j/Ξ�VƠ�,��@�j:��#K��b�����)�@���LXB#�c�2�~�$n ��Z�?�;�kx�#��\x�<�6'O�Nv`��2J�?��]YQ�sT��bd-���>�.B���Y��E�́j���?<B�1�!T݅��8C�'��29n 5�.���ĵ´���j\o0l���S�yf�UI-"�K��"���v��i��1�=�eŇ,ŷ��*ȡ���k����k������+�+�v��`AJ��˵��J����~Ҽ���@g3�`���,��Oĥ|�Lk��$����ZxHM�>`��Y�[�B&�E]��g�N�0T�L�9K{E���T��ҥJ�*T���nc�߮�@�*WZ�+�s8���Z믙S�)�ꯧd�r���}/��f���*Q�S����K%����K�=�=�=�[^��x��x��Q�S�)*��1�"� ^�m-.�bc�K�I�#�F%�E�sĦ9�s��� + % �T9���%�4���1�<f\�L��m���X;����c&%�0��s�5�`��/��+?�6f�����P�������> ��quR���0&�j�2Ŧ6��R�D��k��K�Ж�,��/��[-�ߠ\����j,u�R&3.�Ay����U�e�L=�9�,�Cc����|Jn�s�v�� 1t��x��N&i�=��Z�Mk���ט�ee��J���c�0cLjR�|� i�u��3���E���&�,5��w�e��GFĹY�W�'�r�^��r�0U�EK�~�v�rԴ�&W�|�@�8 Z[�=�O�ҽ�6�l.�����Na %�5{�h�1u��P"��#4#�G��}��[�.���Xw�5xVS�R��kB��P[L����f��@�f�crV,�.&JV��\�Ò���Gl@Z,�vYۉ��C� 1��*���( ��Y����]`�%�J�3.��Aw=���r��\.��R�т�-YY�㣴+Π��vvG)B2� +�W��(<r����8�n;�Ч�����:��#�q*T��Һ��^��*T�\J�*T�R�=jWJ�*T�]*T��*T�R��R�J�ҽ8�o��?�7�z3�>��R�y���Q(�J;J;u�r΅K&%��(�b���2�,�1��(�w�d����L����3>��D��ZT�h���%��-S��щ��A�X���C0 H�H�c�� ~%�S.�w�䐽*!k;{DUV!w�A�b��M�Yl�$0w����� 0�������7k1 +�����U,0�,�))��)��c������#����./ZZeuS�Q���N%�{Ò��W�Q����A�aV��zHI�;�!F�?�l��p{��®\1�ُ�_�|E�ƥ ���L�������Mx��:L�o�0�Ǽ�M˿�C�Q�=��o��7i7����loT�e{��5�]�c<� �P������1�|@a1<Y)��?��k��2ʘ�O�Pl����� +[�����=�Df�Na4��o�'�b^��� ����M"�j[*����8���m˖U���F����Ah;��1���Ƒۺ3����\�`���Y�A�{W�TZ �ܲs�����S�/v��{�7�D��ĴGJ�B��Z�����3��6�E����.b\�{���ׂ��Ǽ�$E�>%�-�Ѳ����,�,��G�܌j�qq�j�,�q��B�l��z�T�R�J�*T�R�J�*T�U*T�EJ�*T�P�S�־�t����[뙞��eJ�+2�fW�zs�r������̦ZS�����F���e�_G�=�W�� �%wJ��Ў�����y�K�%���A|���w��]� +��,w/�q��ыě�Sg~%�n��(��x��<Lu��`+�Ιi{��5I@3�$0a�Gh��ksj�&X��+� *f>帎�� +�2L%0�=�E���*T�Q%zI]n\����5��q>�̈X̿9�O)/��Fb�l����+>�'�� s̥���H��c�b՛8������X�{�N��/��[�n[c�b>oR�f$���IL�14��������!�������U_��fQ��=�Uߘu�mw�-`���>aq�%��� +ɟ2�g�S�Ox��P�*Ҿ�z@Ep���&������V؍���1��8 �5N�;��.��A�o��&��d���'f,��� +���1�����0~e�Z��e�$`��Qp��x�n)�b)�[���{%���^X��y����ѧ2�ܱ��ڹ���Z�Lf����w�0+(v���`��o�>%��Ɛ�A���A������05�V����D��+�D�]*T�R�J��U뮞�+�}�R�J���Y�R��e2�JĩR��J�^8�z�,�r��e�����R�*T�R�J�g����J��-ݕ����ґ�.�_l����Wt���Ot�Ot�@�>9�&;LLtSR�������J�'L�EL�E�Q+"���s�*T���0A����!�r�1����0�A�7�2�c�K ����b��8~�n�Y*��^`�SL:�jT��c+�tH:*T�Q�WES�����Ao��V��M_�5NX�x��#WQ�H��f����P`7�T�K]�����9s2��b�<�y��K��o��f����f��q|�Z:�noq)�(�����d�������ج��D�`E +��gR�x��A,��4&sR�1��J@����O�2�q��1��q|<C�kw +�� � V����ԓ�Gw�g:���ڍ4O�.�^ ��cr�LD|����G�5B�8��P�k�����1R��<ԥʷR�D�����D��E=�+a��-ݏx�Yo�Qԣ�u���h5_�,�!�r�.qd�b���~�m��Wg��f�%u��;�̮�?�����R�J%J�*T�ĩR�J�+�z+�J�]�N:SҥJ�ҥJ�ҥJ�^��������s�eJ�+�ֺԩR�t��*T�S332��I3�\���'��Wy����%��������|Oa)���ϙ��.\���t�gĹ�"ø Q�`�<E4�dA�0�s/��E+�i�%��&��7�������QE��?�0fY��߉J�[Xc��b]�Ify��;�s�������0#2�W5.OyJ�D�����'�S�p/p��J\v!��x����X59��O5?�]��W����"��L���Xa���2[^!o0�E{�(�� ]���+�]O̥C +L�>"�����0��5^%�P]��^̄_�t�E�k�F�;쨕e(~Q��V�s)wlF{�9_bE�(̱�x�JwL7 +|L��&��Z�w�(a�F�?��fl�+Wa��y�Ҧ�����Ȯ�U�˸�Oj{R�%����;2j@;�2��TqK��8�����]�i�,&7/�3)��L�@a���KM0�.05��gv��!�>��(&%;%+�|u�A�r���G2�fW>���R��J�ĩ_�T�R�u�R��+��D�����J��2��J����_J����E}'�=jT�J�ҥJ%J��R�J�*T��EJ�*T�R�LO��iL�yHҥJ�T�R�J�T�Q"D�R�J�*T�]n[/��x � iSv�n;(��/9�>{L<$ne�"7K�ne�T�o�f'M�o6����Ɔ��_���^�������4�CW��x���Y�Q�Q���� �)Ƣ�DP����Z� y����b/^zT�t1�qsЃN%�7�㙉����AZ��^H�u,k�}�c�`���s��2��&P�+�Y1�љK������zb;!}�#��1���,��l^&��2�Ʉ���~"�P�oڇ�� ��C`xg��� +"���5��0q��{ �XGh�*p!�<�<��������<(@u�_2���Ƹu +�*� q�2���!��/�������8���W��\�9��{bX��_��8)�2��Q+��v�-���R˘�V�Q�ڨVM���\t5��*�JE���:2����ҥt�G����J��Ǫ�J�*T�R�:*T�ҹ��X�*T��*T�]�WJ:��S��T�������R�W̬J̩R�J��X�*T�R�t~R�*T��w��)����t��R�J�*T�R��t�R�J�Һ�IR�J诠.[.,V.%TH� ��&�M�^N��H^�Or�X�`�����������H ,>e�W��ŹL��As�C��JV`��s��s ��d�&�.e�,A�e���/f��u�e���4Q��_�Ќ��Cp�h�qD���fD�1<J��Pٕl������]j�=�!���s+��4����0oW���D�e���R�h��.3/ch%���� K��WpG���<7Ӓ:��x���Cn"^^ek�fcho5^)��@�w�9.A�*/��Y����,����lအ���v�)�A�&��胸���Wk��u2p@ffe2�P�����p���h�%eez�Lv� D�h,�UAU9 �I�Q�r�K�\S�%2��3=-�>R��s�,�.^P�g,pq�_�]P�����9���s���؍�q��]+�J�W�s��*o�w�]*T��V%2�<ʕ*T�R��R�J���*S*T�R�J�]*$���R�JeO����T�R�J��R�T�VeJ�*T�R�R��J�S�RT�R�T��R�J�*T�R�J�*T�R�teJ�*T�ʕ*T�R�@bF'J��z)<<�u���f���P�98��x.=���Q�6JnQ10���O���WW"����R�PZA����Pb�b�UL�0���K`�F�Dg�1B�9�һ�J���P9bV����1� n��Z��S��w�5סss�b�f TU��&\JS���Yc�[כ�Xl�`�U�`Ҷ�vCO�0ꓙFL1���B�J��X����d��Q�̡�'�B@k���0������)�8�{p����} �Xc��%0vb[u�r�˴t��^�g��0���Į,1(�J%��h2��_K�.\�r����̦fWt��MJ%��2����o]Pb1��W�̩]Jz`�j�c���ʱ��oiC�ʼn{������\�)�~%Y8""��\z*U����zk�:�}jT��*WZ�*T��*T�D�R��R�?�R�}�T�J�R�J�ҥJ�*T�R�v%u�R�OiR�Ҹ�� EJ��T�R�T�ҥJ�R�JeJ�8�%J�*T�R�}�J�J�+�ҥJ�+�ʕ*T���*T��R�J����r�z���)m|EF*,��s�Sfb�`eD�&S��O-́߉��͌ ��/}�s�.�$H`��a +��\�s�,�3�[�,�)�Q��:cwֲ:0X���{�$�or��V%D"AV�$*����]���7������%��.��w�+B��*��p*lqcPF}�P�["&a>Ȧ� z��%S>&@�R�����yL��*�^"y.4,���ĆH��5�Aۣĵ]�ʜ�L�@���D�Z���7z�Ί��e�@��J%�D�K�.\�r�lX-%=Jezn[��6 -Lu P�g��5X̶��Hj3����IM?Q�7(4�Je����Js�����=�h�r��u���*T�T�]7+r�cĩ]�ߥJ��S>��ҺQ��+�J����=�T�]�LJ�?=*T�R�J��+�8�+�*�@�*�J�+�*T%x�+�J�R�J��*T�R�J�Q*T�R�J��T�R�t�]�q*T��8�R�J�*$�q��\VY�bJ�r��k�z+�������o<�"B.���iK2��b`��(�� ��\�u�������/m�0��.���0��P�*t�P�� +���]��e&�٦=�xfD�P ��'�xzAB��%`j����bQC\K�fS��8��?)_x� x�.!xL�+� +.7���y1�͇�QN`V��[��aw� yqӸ7�Uy�j���PᅪK�����9�`h����Mb����" ��*�D�J;u�Q���11��XD��a���S��J�(��K�%�F�bF&����b�.\���=��F�!;D bܴ�< �W�b�B����J�T�J�u��+�J�҉R�]s�įEJ�L�BT��*T�R�+�J�*T�S�J�+���T�t�s�ҥJ�5ҷ*$�S����u�WBWZ�ҙR�WZ�*WP��*Q*Teth����R2�5��*Wйr�%�J%YIIXɃڝ�YN��"% W���O6�=��(R�F]K���e���D�X�ZԻ����������}EK>����u^'�q;#�@ {�ѨӨn��K�w��i�9qL� +G9���ws*�\/���b9��㡕jT�^����ܲ+v5�ZS�9�C��%�ݧ���=��3��K�[L�M�[��3��n��g����]���J�2K-bUQ�|L��e��e2�L���R�D��%��tJ�`�T�R�J�BÙa�e<��R$�V�s338�.BTb����J��W�GyD��h�Ѫ�Բ!�t�)��@�N��G���Tc �̣��N�9��!���q���`f�t�T��;�c+~����Vz������;�D.U=;��8#��J!9���8�磥�J���v�G�i���j1�'B�D�g0#4�y����sQ��N�1ӈN'~�Tcjq��=P�B�j1�Ncя����}N�J��t��ӟC3��=�u-������1�_��:CQ����ݐ��ª���!u���J.h��iF|J"� ����F;Kn5�9��j�V!+�CRՄGO��|M|̷ �B +=���q��*�����&.;D�l��������'0�T8�Ϙ�Z'������c1@��14�4�&���d���������w���$�gy�cs��t7��UR���n!����D%���GU�]��*Q� �����9�����! 1AQ0a"`q@�2�BPRp�#���br������?�����m!T�(�*�9ź��u�B��Ta ��U�95s<�x�d�nG1䥶���^�+��SSk#e<r3x2I"�I�9S�M^���~pi���\�����K��7J�9�>Ӟ=��HhԼ�2�,n�X�mF)I�j�W������7��(�W���O�L����j?���Z��k%��R���Ӣ)Y~MU�N|�*�C�3 S�dԔ9���&��CU7-�5�9'Ԟ�_M�G��R�_�S�����IO�z�j����U+�e_�)X̋�O&�G������O �-G>�;6�.���5�4��#�iN�R�U�%���_� B?� �������W��ML����O���J��k����r>�_��bm��2(K"��y h�R���� uT���F�J���R*�� ]-�~�쪦�1z�D|T��/Q�4�K����*��M*��i]?#�:�$�sz�YQ�jmrS��U='��O��h���o�W��n���?��g��}3W�a������$��&�z�ȩ�$iC�&�����RK�x��s�����߃��U��?��E�4�� pK]���EU,jR�>�� +}* ��uFOu9IvH��7�M��dU�R*����WEU.��'��>�7����U$�J�����=HI<�� +VE^%�*�h\���G�����^$������U��&i0%g�.EJ |�ݐ�$�4�coc�d�!AU)�5R������N���rg�I� +�|��$�i"��/ .jSoEUT����OKӡ㚊����MMvJ|�����=_�)�n-�� �R����;&���dlK;CPSUI�u3>L�4�4i M��z�8*�����E>d�K�Ӟa��)��x�y5L����e.1���KC��*e�$-��V�d�Ϙ!�,ζ�̉]��)[��t�6�B�F�.��T��R��+��y#�Q���ޯBlSf.�� +Hl�A + V�r����;�c�[�)�,��"�4S�����M�'4���QL�Q�����5���G"p�.�&6'�6v�=��6Dd� +�|-�AU +�t����USԢ���6��'��9b}}��r%�6'we������3h�F�d��!o���m��١�h?O�T$ʪH�< +�?z7,P1�D�N8�/k;W�L{�J��L��PU^� r'7�NH���>�?yW1�/"�!�Am����'9ŵl��M(t&**��ND�ک&��E�����T��R�s�>�CR���S���t�mv��fI�f`CD^=���#��a�Y��x�6�B��&�S +*X��MA���R�+3�Zҷ{�c����(� d����uugh��#�,� �g�3��`y�$2&���$�ҿ(�\jO�OS�2Gef�\0/jE7l�̘#�K'z��L�f�� �Q�N�R�)�f�jo�@�"���R���q�> +���>����zuN3��s"�̎�3�叁"��J&ӹ��Hݡd��VVbWWhk"��1r&3�&2<�#��H��(�4���|O��ҹ�^,���)Y����L��j���Ю��$�!1�B�w2�;$Nx?V����'�.8_���Ҿh͘��:�ዛ+%�I�kX2@��L҆��;�H��?$�S��h�NF#S?�"R\���LO��|����D���$ +�Ţ�$��C]ݶRƤJ�n�N�$�LvbDm��6fFʜ�^,�� +�\��q����/�*M�vwi�~y8$�T�J̙qn�Wc ���-ݑ��BhW�Vbd&*�Θ����ؒ��S5R����ҹ6B�6v��Y]"2$�W$$;-��H���;*HF��x�Y�C�Q���q�0�Ȟ��CJ2bf:�)� +��ԩi>�{�(bW��.��ɘ��R9Q�#b�6�+�eh�m%JP�I�y".Ԏά��|�3"�%R�0�ӟ���:���KI���*���$�:ʢ�,����� +�L�J4�� ���'gbd�i&͌DY�*S�J���=�jc�)d�J ��$�Ǖ=��$b�Z�Y��i��ꈜI���j\$��a}ũ��3&�7䪤��e/"�Sp*ܔ��=�� +��:�O�ܽ�i4�g����,������P�L�sf'$�U��dT�iVDou4*���І�H���-�cM&S�٥Kk�K\��ެp�H��D�ʪ�g��Z�����:�IL�z��4��,^�=:UjD���� [&*�0�T��fE'�S䦩%n� ]Y�!6R�v�I��H��&�ݚ�jI��*�H��L���`��Jn/09�C��T({%���N��3�+/�Bm5��S��*T�����֩Q�&�i���i����Ӧ����?� �N�����MK��{*l�z�T�<�BsV��K��7di �dAv2d��Y7�`N��$�&4�hO"�靮dӂ P���6��=�R4�]*���������'O ��%I�Pׂ�*T�i�p�Z����eN��ybF��p�IC&����e�T�#�T�%-3��c(���EXkE�ѱ ��Bj� ����ŠM� �d�t'�B_�QR�*�XĶ�Jm������P%f�=V�L�)?$Fm +�y)�C��_J���%S���R��=_J�@�E��2�;��T�E0�J�T�V��)�D�����,���[�Ki��� ��Z��''$ ��l\#�c�BM� \�̍�٧�54�����~�C��L9}ժY鹥_��m�ؚ�ԫ��Q K��P����)�A rP�����T��r&T�>G�(�I�(���8���T�X4�"���ؒ�Sy��j74i�D�N �J���'#E#k�9*�j�b��#c����R��TCn���U%5bo6�[M(�����'����:�Cs������L�|�d���'��s(��YP"�ʩ����d��*��LrT����MNz4ន�쬒՞..��ّ,�I��Bp&L �(rʹ��u-. +4�I+���!IR�<C���#��/ а����ʽJ)qT��'�����T�,����!����S/Oi��І�)m8�6/�|���YCXDIS�ȓu!�4��(��r*M-�]p2�'&�T�c��!sѧ-�B�ɡA*ɕ3�M�j $�-�Q�7612I�ZБS�ӆ����?꒚ґ��Ղ��� (D����< +�g�RXj���K�j���������=r�~�D&�cP� C�M.���ѩ:x���o���.,k�Y鷥�g$Y������~����aO�)(�6�$��U.D�M�EQթX��E�4��^Z��9��Ռ��Q$��sp7�dO�%�Ʊ�8)�p��F��^���+����)�+�G��S��ZU+S�>J�l�R�T���?QU�STӞ�5J"a"�!�h��pDYƢ�H�/^J� +h����$�Ƥ�$Lȓb��#V�8��m�/��͓;?��{S)d�IEM@���4�S���!Ꮞf�9)ye5'(�ԓ��K�����j�R����.:\���)zjL�*������W�zNS��3�R��I��OEk���6��<��(J ;z�(�`JL���=7�i +��lVb����DZckBPƥIU ��=5����v��l����zi��h�?�(��ȩd] ��*��L�Ӓ%��'<}�꿧�%�%>�.'�u�N�����եɪ���N�8B��؛L�������":MM��6��m*�i�e|��<E� T��2�dBژ��8���Ի��D��r��S}URq�ESB����c�WZ�5�$E��O,F�:`�1��q(Yȗ?� 9!ّh� +j}���-��;X�mQK�uCcr%�mu��$�w����m*�z�2��J�U�?R�e�^E�"��/���t�M��d)���95��V N80�PtiPR��f }����.隄�?i��Cb���MY�W"DA*ٺ�� +�4�1��j������N�����驦U�UR��?J���/�<�e����� &�L}�R�ؕ��e/�VH���/_�d�Ɩ�0��t��ih�d���1;�;�M���v1Y+8���F���j$�7�2 +��9(u.�\���S_&��J��R&%��^��E-�F�.,Ƅ���U6���K5|�9��O&�<�pqzGdA����'c��7�Г��/Od��wQ�'�Ut�EI�cu;4S�[��N���Q���K �ߡ?X�R�Y&��Bd�D �|j &�E�%-��$�$�K��;�[!��h�o��u�<]���I?j@�*z��L�X)�G���v:EJC�T����S2T�`�;%&<�@�;Sœ�t����uh#d�m&%��l�ŰM�v���?��P���K>Nn���$Y�r&�Ȳd�H�ɤN �7�Y��M���8 {W���8��Y�~?eǸ�:zY��b�Ȟ$���"�6���+4E�ݑ#BN�F�"�G���$U{L���see�m}��)d忑pR�����Ih��Ż"/),ޕ$[��+.H"�@��K�m!�{����@�B�ւ.ԨeT��(J�\ߡb������V\��O�Sx�WL�l�f?k��wl���Kc�V �-�����gd1_2Fg��iwMڲݝ����� ���v�1�m�ެ�?g�N����u}Fc5J:#bD5�,�ş�fvF���!AV��@��X�$eBڭ�O�Q�_V5�ʱK(I$6�դ�n��ͦY9bPN�#�1-�����b�Φ즨qн�"�i��]�?p�)SS#R��Ru��䥒@�͒V�����ggh�$�I����6'm(J��$�����\/Q,ȇn�4��d\��%lL��>l�j����^��J�i&�d��_[�t������JS�x$���6J�\�AЬؼ�p!^rD�D6O�L{ճ���gdl�Y��6�ӛzԧL���K6\���7��yqf�&DU�X�/\��L�K7�E��{�� +жN�eg�?�cdA{s�o$�I$�I'kI��tx?J�~���(誔�\TL2s&DҲ\ȹ$��d�<Y�rH�$��$@����u���7�>�9�H����I�Fm$�I$�I$�?N����+���:�����#�)�1rM�b�~�rT��y$�R�t��I�៩�����K�*�O4��O��k}���|�iF�B"�&��Ż#lVr&�����O�6�I$�ϱ$�I&�Q��j5�$�I$�I$�I$�I$�F<�r�R����@�a�S�qتO�'jbȑ�؝�N�~ +����<�jk�X)��<�M�X$Z��T�J}�DH���@�!�.?��I$�I6�I$��$�I$�I$�I$��I$�J$�Q&�I$�I&�jf�jd�U$�������ɩ�Mf�5-�"`��E1��/�4����*e2�6'�'��؆�W#��Oթ(�5OCũM�ӃI�� ���Td��!�Y�����>n��Cq�`��n��}>ĒI$�i$�I$�}�$�I$�I$�I��Nf�;��4�H����%5�Rif�B!A n�B#�PAV�(����� ڋ*e +�"Q��ݠ�-M �T���S�b��D:�U���΄��-���$�I$�m>�I$�I$�I?��T��jԵf��DȪj�/�Ȱ���8�؆4��'jT/϶�FY�_E �X�S\����ap&UAy��\'#��4AIH����N,ؘ�r5I�3lY�gs�1�Ԅ�#ܛ7��i$�I'�MHԶ���:��,�s�6�Gc�aq��ʫ���j�:�� N��>�irkRL�B@�D��t�H����<`��\ +�6ARMK��ɹ�.3ج�"lԚ62kscY�g��I6�����{u��N��/"c��@��ԩ$�d2�,Y�,2����o��S�G$�U%/cB�%,��F� c$4fΨEUy(�s�j*PN +ji��[jjWk��yVi>9��Lf�h ��@��᫂D�2������a"TY�ȗb�d�����*sT�L1R�=�Ál����7.v<S�ʪ�I�S��u��UNV��?����?M��В��B��M䪄�"�M�l�B㒪��(O���=�Q�I��ѥ�KF��1{��~���2",ʩ�KG����ϒ%pS����K����EO�p&�eL���_$�.,�I0N�V�H��b�"���3A��U)�U L�6�(X���)v�H�9�D (��-2;$&ӂX�$���5�mJIh�,w\��(Y�������>�r5Re-��o�jl�%4�~��/ɩ*T�B��A��D���'�v��V������a��z���S�T�S�! (9e4(*�&I"c���J|]ی�l�>�'"�UIr/Rp�e��Fdl�ٕ�/�S�k���JI�-Ւ��"���d�@��M���qɩ �G�ٍ#J4�M(��)����P��J&�`�<�D�T�%d`� Ñ�D��Ǖ4�U�P�IRQ(n +_l~��k�ݩ����Eؚ|1�w.H���T�e4A#�"��tʑa�5T�}�U��)�҈"І�����;tG�WVHh��f���Q��_�i��<!�ʳ�; ��B]�r�6�C]�8%5B��ʂ#�]dj������zj t�EI����/7��I[m�J�ؘ�$�+"�{V��&Л"�)B�l����w�?IL��r���$�w���pQJ�ׁC���U7���%g�%����]-�pkF��j��S J,�7��*l؞�j�i$DE����Jڄ@�'��Gd�CC~�YH�&ھ˒I��?�?݂� +��t���lo�g�1�L[�|t����V))W�S�iZH��GCY����X&��b��;A�@� ��I�CD�",�9bEI� +ނ�����f�eAZ6���K�)*����3�L%l@���`���T��! � �1�MY�"�:�d8$E7җJ�Ld;$4@� �J��|���y$y)B�ǹ=Y�,�ڞ�R�d���NF�m �$F�d_#�ρ %fI���B���rC�Z���f�H�J���"�f�Q��k�.���Nl�M�#��������j�[E9�~�H�!�1�.��W"B!Y�/�5�T�����pȼY��E�lW�h�E���$�H���hT�"�͙��j�$���:�H�jP����X����1�����j'�E�#;'�[��\�*v��W��dH�-�b�H؟��23$�2I���C�!�O���_�I�J��M�����!�#V���Z���Zf�"�bVM�W��"�v".�@�ݢ�efR�ѝ�o;���g����F[ hk�?Y*j���p��v�8�љ��di���LC��+�n�Z�o>ºC؇��c6Gc'7��'�7f�K�i�1hl����B��-ĔjU:�=�$�u� �%�%����1Y�A�yŶ- +�s"�b�H�b[2fm�Cx�!��*P�?rG͓���<a���ip�m�)V���X߃�j�LD2snŁ2- ��b��d�$AR!����I�8�;�RU�U6�YY�{�lVHu(�?iz�UMT��SU5S/ �_�����IK����U���5ݥ�.l��$v|���b�$T!Z��<�vW��@Ր�h�F��#$��[�J�e6d���1���}�])��=��l�~ �a�Ɵ +�\6�pR��M��h[��%6��ARE�د@�DZ-��7|�䅵��j=�� ��#dO�Z�K^OI�����v$@�&��ؑZ�c�e$�Y�l�+6M��{hWVv����9ڕչ!�T�x�6{]��z����5}�$�I$�I�KO�)��_?���pN�8�O0F,��%�@�U͑*lV�65$]1mb�DlvWh�"�{ ڿ1O��~ xd��O�>n�'�jP� +Q�/�(��A�ȽHP�jU<1�,�r�W�1�O)��C��Sݓ�"̥�Y�bݨ��sSbr�$�K�;[��6N�hDm��5R�̍�ȑ f��$��Cbc�Y-j�FQ%CY(�IV(� V���D�)���d�ݱ�M�^�[����A[`��l�ț=��Q䩓#���$�����,M6B'�$�I?����#b�}2>H�I�&�$O�F���I$Ƚ��"�v�".���MCvBd;�iɭ.F��O��X.IMOf �(mZ!�5f$+*\��f66I(�J$DۓH��M;5���E��K��Dg��m������l�J�H#gvgVd�Jo#$�2I�$��#�$�K%���X�ĉ�Z>�ɝ�ͱf�H������_����)Q�T�D&5�hX$G6��4A��N��ȰN� d��I$�J������$lLb�J���O* H��Y,����&?������5���䩚��f�!��bmp*��I�B)c3)����Q$�I5 �l���$�H�A�04g��F��ֻ5O%�5?S�4�Wf�| $`š�l�52��"d�#� ���k�}�ZD"ɳ)�VGKE. C�V��|�H����$�mO�Oc�&ȑ�N�tb��$�I#b�����M_�_�e�'����K�S�C3ѥ�J����}�$�6j�"I� +�� Y2M*����'R+H��"R��?�D��]Z���5 �!�Q,s���ҍ4�!x��<{M3"�{͒��ԍk�Z�(��R�Y��.옛��6����*T �jV�9�dL�0'y�$��sv�L�̋��=�&�I7�9�7ٛd�@��GȚBb�䪷W��_b�>�A��hBPK%���?����LNmK�$�EśF��Y��DkG�ѩ�^�d���Q$�6I2I� %���E�����4Ɛ�;`�B ��hJ�~�ј�l��y{��ʇ�SϺ�u������˛��1�?{���5���!1A Q0`a"q2@P��pB�#R�������?����迁&�^7�S�Z��_��1J�Ą� V+����q��P��J�_�+���E/#I11�K���(�c� {���I߱cec�(ea<1ݜ_������t���?���c��"l�В$$ۨ�?FW��zq]?�B �N?_���o��p�w��Q_�{?NOM��#��Z�?K�}:%�VӴ~��jƚv�~8n�� +����ђ�j^|�&��j����7�~�N��� ^���F�[�V?Jk�/��G�m[%�F��z7*g�����K;�/���{���7'�G�J�"�R�5���t'{��]���&� �Lr�;C�E��L�F�椶�q���~�e�g�q��Vpo���4������d����%��o�u����У��^����(�r���G�H��ԃ��?���6_���m�-�E���i*E�9�>��?���Y�roR��DS]� ؒ�]�{;����6&Y�KȽG�!�K��/B�F2����Uv�s~Va��K�(��e[L�PҲ���zF�)��x�"�#U%��D_��+C� ��7����gmǣ��t��3��g$蟥(������F.�C��v6� 3���"��j��k�VyCf��ǁw�X��L�]y#9/"�.�%��,��(�c~/�I�А��!�r�?N_2������#���>��U��n�N-�Du�H��F�T������(�����>���슷c�,��xM�;~qw��G����^5�՞����ɑ����աzq]��.�3�Q�#�̋C�d��%�e|��7��d�=��C��I��dH�9W��\����qu�I]�c~����-n=���E�hbt�7e�Loؖ���ŋ��Yeaue��[͗G'����Ycu�>����$skL�mZ���E$�L�]�����v��ͲRO�������鎇XC�C{��/�g'v6�ة�/�TQ���Yo,K�C����e������E���e�#�Vڳ��#%��I���_8��N����b%���lj��a2�hK�%}k,��{�^���2�Yxm�7�,��9*�&��t#��8J�>��t�W'��P�I|a�����I�.Ɔ<�C,���{z����J�t�^^V�~�1�+)��5GC��,Rµ�r��c��6qK��ޱT��91c��(K Qc��{Z���/�G�*�Ŏ,qILPRM����^��on�����*�6� "�a=���c�?�*��T/c-f��x�<X�C�5D����d��7n��E������#I|h��Ҷ��N��A���R�J��\l��s����M Vb�/7���Y����E�6�_�d]v4qe���xZbw��~E6��{$Ԥ�q��%��?q������K+�69!o���45�k�)�y���Ef�����4����O���%cMaE�'���4�bȭ�kWb��z��FM4K�K�I�S������h���/�c/�~甑yHHr�]��Q"�f�BqH�WItɴ��^����D}M�5��u�PKvi���{8��"�m&�/��|����[��Ӫ�S�>�B<�bX�V+�%e��^�1� �I[x��l��$�QLQl�Ilq���7B���GOF�g�S�Q:L�x����n/]}���+��tx�el�_�CBEcea�Gll�xB�yL��6YLi�F�I��,q8�.�����O��lMlDc�1¶��k��i��>P�ձ%����$��OO�X�X���B�>���Eױ�Le㈕- h�oi��5D��QL��i�[9"_�'Vρ��i��7���ʭ"߲:i�?�m;�����և��{*�x�Ry^�b~0��$��r/7�c(����Z)5G*�dX�Bez+����J��)7���u�&�G��cjWZbI�����Zo�HI.����%H�箍���U[+-�J���ȳ�&7��� +�,�dFQ;�؆&If.>F��f��8|�]�_�l�O���QzbO��{���������C/4P���P��e�rl�d�E��ǘ�Bv���bC�X������o��,��b�h�y5����%�$���-{kL�w�hm�z��jI�n��x����+Cbx��dž�Xhi�!�EЩ��/ 65Ds�x�yO(k6Ft��-�I�q}��=Q-4���C�[�)y�:�Kӭ3�I>ɧm鴛�z��Iá�.��[�?���J�>��-t8�)�����E �ɜ�-����kYH��u���X��غxDZWd���н�e?ctv�C�3��v��Mi�X��;MZ"�\_��t�� �薒oʫ9Ů4$��ӓ��� !�o����Op��HiU�YN� +*�p�D���K�(��Mkڤ�E�����4ZCF�V"� �8d�Ĭx}V�8�2�<f�������E�eЦ�$��"TƄ_�j��'�O��6�E�Z<�'�Mihr�:�t��g�� +2���>���ؒ�dz�%q�NO�+�V(�#Hu[��q����ߵ��b��+,�Dz�We� +&�BVF#���D�БX����uבm�\Kl�h]��hE+Y�"���i�ױo�Q_�"��;O��Ғ���F�(�j�Ǵ��-�������~ԒBx���d�rʼnl���GzqH�E�J^��C���vIlk0^}���Y/bl�Yɣ�xLЋ�*ī9d���rZ�5E�ة3��eWC�ɉ��7��~P��c�� +��݊Eo����U�B��/bki�#_o��*�c-�1���b�1 �o�ɳ��<��P*�X}�Qe��(�(�L���X�7[��XR�2Hl[_J�,��bg"�/64�Ŕ'N�-3�%鵱v:���b�Չ\S��Gּ�b�&����l�m��ɯ$Vǽ�L�I%��V�$����wHo�-��� ��v��:)�ކ�d=N=�ڳ��ĥBĊ�t�h}G�$�V�؝�I�G�E�Ye�,�2�,��E���?M���E�;�B��٤�M+EZB�?��L�V���[�(�RK{خ����>�]�+���o��k���%bt��o�D��6!!�3�i�l����-���d��������D��E�%*.���TAY�G�F)��$�l��4Wղ�͖&)���=��EZ���"T&��$�B���-�c���Z&�][�q����9BU����q���$�DT�m|����ަE;�-�"��(�H�%]��Nǧi�T7�9�'j͞����{�I�=�k�{�D��*��!�Cؓ.� �����X�.��#��D�D뤄�P��ҋ��$�ٵ�O�x�O�}9.������lV�����!�4��'r#�NJ�}��}!�K�S�O�r�D�(F��C�N6N{��A��$,&��(�����'^,RU�K}�I�lQCj1��۵C�RV�_�ЉN�s�6�k�Y���t6r7��K����8�+��$!��e�m +J�H�:~�����-�%|)2uC�������8��F��g��t���R�S�U%��a)]\cV�>Ѯ�(��~���)kJ����'�� +?#��.�J�����bv�N�$�n�S�QZ[����g�+I ��셡Ž�:J�$��-�m�� � +o�� ���hf��KGC^��8�Q(��%쳐����zn)�����w$��풌�tEZD�~߂:NR�{z%�m?��K_kv��$�U�jZR8�哨ﳚUVs�l�T�K�c�ǧtI7�J�J�ؚ��������أ~E*%6���#�n�$����g�%vM��������x�L��(Z��[(g����}���Y���)�J�S��5i8�^�%�ػ��z����2J-��%����#�J?$}�����ƭ?}9�u�&�K�����o} ��%o�/lRO^J#�Ht��Ǣ�%'t�"~���BLQl�9|5��#�M/$d��_���;k^ث�CM2IG��1�<QYM?j�(���~�J��?'�~&���T6��!I��$��%��v���-�k��W�_�?��5��Y$���MʯG폂k���zr[�z1[�� m$~��#�Iy.,T6J)��g�y�Ǿ�(�$�"�'+4��,N7��J�X�x���c�� +)b�1��ŕ_N2�*��sCBH���V�~�D�lqO��]3�P�������}7�vUl�.�Bv7�͊M�xn����G���Z6&]��F/c����c�=S*?�]�Q��"I2��p�!����ev(Y� QVq(�įw'���+]�>�Ϧ��:~Gp��~�%��ڪ\��ދ�zc��\�tE�m���$ݗ��.՚)q�؞) �,qLq��2�#b�YB����+��6Ֆ�4����Ί��b���7E�P��������">����Ԣ�?R+M��%��}��O�M~�)4�+�V��������%�CE�cش���F����B�Kg$Z��$"�,D�} ?c-����e"�%�V���6vS�8�� ��C,���{*���qg��/L~��# +v4Ċ�'z���G}Qr�(R��eb�ԏ����I-I�����f�I%�k���?��+��K���[;���g~ E�e"��?#x��ɗe��-&6���x�e�J�b�����%�hHk�� +��B�9�s]8�G��q9�mSZ8�|�_�z%�օ���?�$��K��%�<y��H�z�zX�&�{9 h]���Eb��J�4�c����?'��БI +�����Ś)�hc��VZ(��&X��W��b���Yb�o�J�{n�+_j]t/Z^v)^ד��ZW��C��ke��t�.�؊v>��� +mL���'݉����/je���e��7�L��X��e��X��yM���?��ȋ�X���M�:�!;/�kFmk���M2U��c��c��X�ٷ�F���]"���(�"�b�Վ�-�4hM���Ye������2��l��Ot~ +�lm��Y�c���^�����"���+u��]==a=d�<'����ʡHrCg"߲�ŗ�/�<�x�_����5c�:jϑGF��y����F��J�!-$��'п�kE&X���e�)��I��2��,} ��Bc����l\����V,e��7�iv^�ذݖYlO���v�ɵln����uy���D���#�Y/��!,^S� ������WӍVk ��+-lKx������h�����)��RP�t�t�o&9{QE��'��5�}7��5��67��t^P�C����H}�e��,�t+�����?���i�2ױ��'����*�<X�����e��߽������-e3�� ��߂������#�"obI�~��g�}�"�xKX��݉h�e�,Z$ǚ8����$����D� �<Q�}(����j��8�R.��h�����(lC�m���Kɡvk�ż,X�b���|����bŊ;�֊)�7��=���o���6�$,j��)��eD�Т�K�-�Hh��.��(|<���_E�+��lb�,��J�(����k�:ǥ�=��R�J�ם��mЭ!���7C��G��G��)�5E�s�DZ"���_F��_�����䢆�"�B{ŝ�k*�~��_f�EQEzm��#f�C�=DV�u�-I���|����Q!ݑ�uF��>�����i^���^o7_G��W��E|����lx�϶��J�R�(��(��(��(��(�m����Nr#?���I3WV�Th������(�d��S�C�Z)�VC�c��I���k�1�42��J�8����Z�Ŕ�-��?�O�<2ΐ�eQ��TQE{쿥X��(��(���&s���� +q�Z}<*�WxZ<������d*��i�_�ŕ�8�N+��J����e"�CMf����$쵕�В���O��/�������h��EQH�(��(��(��EQEQEP�,��lm��E&F�גLr^X䟑��;Xe �bi�/-V/ �7g��M�����>W�q]��"��^(���(c~��ʎC�7�R+\DJ����X��E�+�(��(��(��(��(����Z,��,��/�ऋF�H�'QT7���;�#��9vU��,H�v@m"�/ �r��5g$�š��(� +:=H&�'x��Kb�9�F��(�����O��sBVSZ�F������Ef��V(��+�(�����e��#�Ĥ�H]����G&se��x�1��,k<�l���ɋlzcV"�ı<r�9�v�ų�e�U�"�+���i"YHh���~K4heQU�_��E�+��?�F.]c��)�_$��G��CCn�<FN�xo��I4����'c�o�6� +-�I/�,䟄'�<Y1���C��^�-���kZ�z����^m��ɊL�[�LbW����W��e?jM�G�^Jv�5�X�9C�Уkd�(Z����*����RJ�[�ݒcbt)}$�N2��Qq��'�.��� *������]��~���L��������e{h��(��q�xk����b��К�d#{D��Ŗ>����6K�(�$<�C���� +_#/�IbVAoD���H��4��IE:�cxr�o +�_C[�J�YN��Yx] ����}_aDz�� �d���.ٶěxMtr�?�I1�y8��*I +�llIIh�k���P����ƻ����H�mT���K�mat)%�Rm�ev&ۡ�$�FM�z%;��El�7���LhP�RO2�DZ��bN�:9�1�%g4sE���}:��?�xEӲN�J˩vO�����o��$�eJ��c� i:H�xLb�Eb��.0D�Fȯ8�g"{b��- Wd�T?rGH��K��6Eב݈q,��jġ]���8���?Ƕ�< +Cw��7��%�-l�m +-y(���Z��ɉš�|�+�j%F|�5ʕu���b} ��g���Xn���|�}%e/��� +��["��T�K�-�]d,�"�z}QE>�����d���IJ��Y�q�i��znL��Qy��ZHQ*�C��E��]"��IV�²�'cMaA���q��1*$�?����tƊ+X�%�C��,�r9����2Ol�*�(Ӷ7t*Z) *��[/e�jƩ�!�� +-?nŭ�m�*�JE��TEXУ�8�*Ģ��%�oD�9G��E{�]�!N��A�zxhc�ű��R��k��^6�IRBn��1�X�SlQ�QM~H�ub<��X�eQ��Z���zn����!*c��/e�I�;�$����(��Q-��$GBc{(D�f�#�ؽw�~���5+�j�F�J<U�c�j����oX؆�;(�T%���UKɴ6�#���n��T{"�忤�"�c�.�+ѦqdV(���W%d��6��'8�uབ? ����B��[~���+�q��X�lqI�,�1ʙ����_���Jw�����yb<m�,��~�ݑm:x��]���S�wo�N����lz�!��b�VȽ�(�eWт��{��!RN�G�/�/$�О�h���2^O%�uX����'{HrCd[��#�ZC�<P��)P�+(Be��גPM V/ <"1l~�J��h�7h�,��j��46rE���Ƚ�r��>��-��%�1�h���l��,������$G�Kؚ��m� ��%�%�{�m2ؓ,���������ȧ{(t�(��^�'��Ij�$ݑ8����hK �.��iH~��N�P���j��dt_�����Е&$y.%��a�S.�Hx��J������9Hl���9զq�!-�M&5������C��!�"�VY��%O��]6X���G$r9 :�z9^���(�$�K4P��"Ć�8�Yt���h���,lRF�Iq�JT轍R��RF��b5D��%�~F��7�!vH�� k�H���c�j�>�E��ye��C���&͉���'g���^&��)�h�]��� X�el�c.�mh�3E�ȱ��vW���[�h�_�"�G�E?zxN�HD�ʢ�~����� +4�y-�ob���ey���$.��ײ�(��j�a�%��e �b�oqe��+��%�iC(��h��X�����2qUhe{b���x�X�*�^c"���?���e(�]a���[�X���6^��F��KX�c�_g�C�^_eZYOL���<"�a�l�hD��at"Q�dd�-"M5�KXZ�Ŵ?����J��IW�~�n�)����:�X� �>�Ɩ(hV&YcbW����종�Y�<�'����<2#�Z�+B=N�7�G +%���бkȆr��lr��qm;E�o���e롉>Dz���f�/}�e ��^��{Ѭ1��]b��X���gE��)�G$sIhn��������P�1�"ɷj���-{+q6�*�2�i�uv�i�]��&�-�he�X�=���l�-a~�2�<Q~ +,��ጽa!��xXrō I���eV+ R�9|F^���/b�Qwe���%i�����ۦ�%�DcJ�O���4W����C^�Bl��8bC�X����"�QE1g�[,�5HB'*�����al��qKd�o�ؙD���E�*�V<��E������M��]��3#��uh����Z�X����b���!:9�����Y��X�<�&Z�1�(�Cұ�~�8<��Ĕ�Ce�bj��'~ם�;좴8����Wx��_Ai�=�%��~G"�.������~�Љ$1~��[(���1�1�E�c̰�Ȳ�����]�U�,U�v��'�O�B���͞ ߵU{,�] �3�>7�"�eQEVh����ؕ����qBg������E�����,I���a:9^'�/ ��1ȼ�^S�·;<e+*��ņ�~��QS��$$���i�^W�+۬V���LR[E�C�l��K�����=�R(cf��S7J�{�-��U���D���X�c�~Ŋ8��K�xC"���) #�X���B�w���I�~�4�3��*Tq����e:��CT�� /��q�B�eL��?��)�4�L�^ +i�O Z+ +"���x���ؙ��5�=��C,l�,� �/m��2���yYcM�(�b�^�+�e� ��- �M#����_��(������ ��VК��|��I�P�qؖ�C��C�*��xk�5^�"��Vq���"�(Hx��We�� +С}���h��O] ��+�e�P���]������r_fl�E S)��I!��96��l��f��t,Z�,�{SlNƬ��VlEa#��X�)2�e�O0��y�4"�Mt"�hHK^Ş>q<QG�)�(HbV��K��}��_B���Z}�*�i���[Bi�^�Ǵ2�u��Ybg$Ye���<؋(���XE�{��q(��V�U %����a+��Q�F��Y��/�4#`����~��X��6� +-�p(j��Be��Ʒ�(n�&ȼHXt6x�}+�'�CE_'�YlC�h��4X�+�E11���ćH�H���ɎM���6�~����M�W�1����]���~˿e��Y�Í���Ѕ��$蔯�?e{�ա�����$q)�2?��*Ć�E!�"�8��-��=��c��_A ���^Y�?�ͳ��9?���e��l�e$De�B+1�7D�yB� �k4/�lhQ��ȱe�GT,8�8�"C�9%��d�t�9H��K~^����$�k�)[�w�#{&��з�Ŕq8��>��lM���e�M꽩���r,T=���{�e�:(q���U�"����ا�h�T��Vhzq�H�X�ȿ=>�mlu��;�^�1� cf��I���Yg#��(M�C�E a +:��S8���ŜN,�#F��E!��(�����_P��m��f���l��)��I�,L���~�-��dgG�"R���<�W���>���غ�/���K���_��]1��"�?��� \ No newline at end of file diff --git a/web/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php b/web/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php index 01e998e9b3d3da7bc4485790f0e87750987e4130..037680120d1797160d3855a95f3dc8c12a8bb7c6 100644 --- a/web/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php +++ b/web/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php @@ -329,9 +329,9 @@ protected function importPages() { protected function importBlockContent() { $module_path = $this->moduleHandler->getModule('demo_umami_content')->getPath(); $block_content_entities = [ - 'umami_recipes_banner' => [ - 'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541', - 'info' => 'Umami Recipes Banner', + 'umami_home_banner' => [ + 'uuid' => '9aadf4a1-ded6-4017-a10d-a5e043396edf', + 'info' => 'Umami Home Banner', 'type' => 'banner_block', 'field_title' => [ 'value' => 'Super easy vegetarian pasta bake', @@ -342,7 +342,7 @@ protected function importBlockContent() { $node = reset($nodes); return $this->aliasManager->getAliasByPath('/node/' . $node->id()); }), - 'title' => 'Super easy vegetarian pasta bake', + 'title' => 'View recipe', ], 'field_summary' => [ 'value' => 'A wholesome pasta bake is the ultimate comfort food. This delicious bake is super quick to prepare and an ideal midweek meal for all the family.', @@ -352,6 +352,29 @@ protected function importBlockContent() { 'alt' => 'Mouth watering vegetarian pasta bake with rich tomato sauce and cheese toppings', ], ], + 'umami_recipes_banner' => [ + 'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541', + 'info' => 'Umami Recipes Banner', + 'type' => 'banner_block', + 'field_title' => [ + 'value' => 'Vegan chocolate and nut brownies', + ], + 'field_content_link' => [ + 'uri' => 'internal:' . call_user_func(function () { + $nodes = $this->entityTypeManager->getStorage('node')->loadByProperties(['title' => 'Vegan chocolate and nut brownies']); + $node = reset($nodes); + return $this->aliasManager->getAliasByPath('/node/' . $node->id()); + }), + 'title' => 'View recipe', + ], + 'field_summary' => [ + 'value' => 'These sumptuous brownies should be gooey on the inside and crisp on the outside. A perfect indulgence!', + ], + 'field_banner_image' => [ + 'target_id' => $this->createFileEntity($module_path . '/default_content/images/vegan-brownies-hero-umami.jpg'), + 'alt' => 'A stack of chocolate and pecan brownies, sprinkled with pecan crumbs and crushed walnut, fresh out of the oven', + ], + ], 'umami_disclaimer' => [ 'uuid' => '9b4dcd67-99f3-48d0-93c9-2c46648b29de', 'info' => 'Umami disclaimer', diff --git a/web/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php b/web/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php index 008babc43e7b846390d1c7d8fa2861972c128ed6..9f2f50f6d9e074a044fc3453bec53a643d1da174 100644 --- a/web/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php +++ b/web/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php @@ -73,7 +73,6 @@ public function testReinstall() { $this->assertRecipesImported($node_storage); $this->assertArticlesImported($node_storage); $this->assertImportedCustomBlock($block_storage); - } /** @@ -120,16 +119,19 @@ protected function assertArticlesImported(EntityStorageInterface $node_storage) */ protected function assertImportedCustomBlock(EntityStorageInterface $block_storage) { $assert = $this->assertSession(); - $this->drupalGet('/recipes'); foreach ($this->expectedBlocks() as $block_info) { + $this->drupalGet($block_info['path']); + // Verify that the block is placed. $assert->pageTextContains($block_info['unique_text']); + // For blocks that have image alt text, also verify the presence of the // expected alt text. if (isset($block_info['image_alt_text'])) { $img_alt_text = $assert->elementExists('css', $block_info['image_css_selector'])->getAttribute('alt'); $this->assertEquals($block_info['image_alt_text'], $img_alt_text); } + // Verify that the block can be loaded. $count = $block_storage->getQuery() ->condition('type', $block_info['type']) @@ -147,18 +149,29 @@ protected function assertImportedCustomBlock(EntityStorageInterface $block_stora protected function expectedBlocks() { return [ [ + 'path' => '<front>', 'type' => 'banner_block', - 'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541', + 'uuid' => '9aadf4a1-ded6-4017-a10d-a5e043396edf', 'unique_text' => 'A wholesome pasta bake is the ultimate comfort food.', - 'image_css_selector' => '#block-umami-banner-recipes img', + 'image_css_selector' => '#block-umami-banner-home img', 'image_alt_text' => 'Mouth watering vegetarian pasta bake with rich tomato sauce and cheese toppings', ], [ + 'path' => '/recipes', + 'type' => 'banner_block', + 'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541', + 'unique_text' => 'These sumptuous brownies should be gooey on the inside and crisp on the outside. A perfect indulgence!', + 'image_css_selector' => '#block-umami-banner-recipes img', + 'image_alt_text' => 'A stack of chocolate and pecan brownies, sprinkled with pecan crumbs and crushed walnut, fresh out of the oven', + ], + [ + 'path' => '/recipes', 'type' => 'disclaimer_block', 'uuid' => '9b4dcd67-99f3-48d0-93c9-2c46648b29de', 'unique_text' => 'is a fictional magazine and publisher for illustrative purposes only', ], [ + 'path' => '/recipes', 'type' => 'footer_promo_block', 'uuid' => '924ab293-8f5f-45a1-9c7f-2423ae61a241', 'unique_text' => 'Magazine exclusive articles, recipes and plenty of reasons to get your copy today.', diff --git a/web/core/profiles/demo_umami/themes/umami/css/components/content/card/card.css b/web/core/profiles/demo_umami/themes/umami/css/components/content/card/card.css index 5bb3809259dfcd85a1e9e2cd8d5b3e33f2fdbded..466980bfe0b5281764d631693438533aa4461579 100644 --- a/web/core/profiles/demo_umami/themes/umami/css/components/content/card/card.css +++ b/web/core/profiles/demo_umami/themes/umami/css/components/content/card/card.css @@ -34,6 +34,11 @@ color: #000; } +/* Need to fix IE11 cards height issue */ +.view-mode-card .node__content { + flex-shrink: 0; +} + .view-mode-card .field--name-field-image img { display: block; width: 100%; diff --git a/web/core/profiles/demo_umami/themes/umami/css/components/messages/messages.css b/web/core/profiles/demo_umami/themes/umami/css/components/messages/messages.css index b49bc8e48cf5f3a8cac9f8d0f9f3f47522065c0d..e1bfc5595ec07598c3ee0e85bf195c2d0e05af23 100644 --- a/web/core/profiles/demo_umami/themes/umami/css/components/messages/messages.css +++ b/web/core/profiles/demo_umami/themes/umami/css/components/messages/messages.css @@ -17,9 +17,12 @@ margin-top: 1.538em; } .messages__content { + padding-left: 24px; /* LTR */ background: no-repeat 0 center; /* LTR */ } [dir=rtl] .messages__content { + padding-right: 24px; + padding-left: 0; background-position: right; } .messages--status { @@ -51,13 +54,6 @@ padding: 0; margin: 0; } -.messages__item { - margin-left: 24px; /* LTR */ -} -[dir=rtl] .messages__item { - margin-left: 0; - margin-right: 24px; -} .messages__item + .messages__item { margin-top: 0.769em; } diff --git a/web/core/profiles/demo_umami/themes/umami/templates/content/node--card-common.html.twig b/web/core/profiles/demo_umami/themes/umami/templates/content/node--card-common.html.twig index 129078c24914d03af239fcf691e0999295101f7d..f1b6a547cbbd65d0aa5c1175c3ad83061dcf7343 100644 --- a/web/core/profiles/demo_umami/themes/umami/templates/content/node--card-common.html.twig +++ b/web/core/profiles/demo_umami/themes/umami/templates/content/node--card-common.html.twig @@ -94,7 +94,9 @@ {{ title_suffix }} <div class="read-more"> - <a class="read-more__link" href="{{ url }}">{% trans %}View {{ node.type.entity.label() }}{% endtrans %}</a> + <a class="read-more__link" href="{{ url }}"> + {% trans %}View {{ node.type.entity.label() }}{% endtrans %} <span class="visually-hidden"> - {{ label }}</span> + </a> </div> <div{{ content_attributes.addClass('node__content') }}> diff --git a/web/core/profiles/demo_umami/themes/umami/templates/content/node--card.html.twig b/web/core/profiles/demo_umami/themes/umami/templates/content/node--card.html.twig index 8e8622d32cd0cda42fe64463fe950a3e14563f11..4737ca221e3b3559ceb42e5f6e5fde8767ab1453 100644 --- a/web/core/profiles/demo_umami/themes/umami/templates/content/node--card.html.twig +++ b/web/core/profiles/demo_umami/themes/umami/templates/content/node--card.html.twig @@ -95,7 +95,9 @@ </div> <div class="read-more"> - <a class="read-more__link" href="{{ url }}">{% trans %}View {{ node.type.entity.label() }}{% endtrans %}</a> + <a class="read-more__link" href="{{ url }}"> + {% trans %}View {{ node.type.entity.label() }}{% endtrans %} <span class="visually-hidden"> - {{ label }}</span> + </a> </div> </article> diff --git a/web/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php b/web/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php index f67e738baf0c2c0543620107658719321dc94ffb..3719bcc64e5dac39e10c1e2d51585623c4f7dfab 100644 --- a/web/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php +++ b/web/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php @@ -3,6 +3,8 @@ namespace Drupal\FunctionalJavascriptTests; use Behat\Mink\Driver\Selenium2Driver; +use Behat\Mink\Exception\DriverException; +use WebDriver\Exception\UnknownError; use WebDriver\ServiceFactory; /** @@ -41,4 +43,69 @@ public function setCookie($name, $value = NULL) { $this->getWebDriverSession()->setCookie($cookieArray); } + /** + * Uploads a file to the Selenium instance and returns the remote path. + * + * \Behat\Mink\Driver\Selenium2Driver::uploadFile() is a private method so + * that can't be used inside a test, but we need the remote path that is + * generated when uploading to make sure the file reference exists on the + * container running selenium. + * + * @param string $path + * The path to the file to upload. + * + * @return string + * The remote path. + * + * @throws \Behat\Mink\Exception\DriverException + * When PHP is compiled without zip support, or the file doesn't exist. + * @throws \WebDriver\Exception\UnknownError + * When an unknown error occurred during file upload. + * @throws \Exception + * When a known error occurred during file upload. + */ + public function uploadFileAndGetRemoteFilePath($path) { + if (!is_file($path)) { + throw new DriverException('File does not exist locally and cannot be uploaded to the remote instance.'); + } + + if (!class_exists('ZipArchive')) { + throw new DriverException('Could not compress file, PHP is compiled without zip support.'); + } + + // Selenium only accepts uploads that are compressed as a Zip archive. + $tempFilename = tempnam('', 'WebDriverZip'); + + $archive = new \ZipArchive(); + $result = $archive->open($tempFilename, \ZipArchive::CREATE); + if (!$result) { + throw new DriverException('Zip archive could not be created. Error ' . $result); + } + $result = $archive->addFile($path, basename($path)); + if (!$result) { + throw new DriverException('File could not be added to zip archive.'); + } + $result = $archive->close(); + if (!$result) { + throw new DriverException('Zip archive could not be closed.'); + } + + try { + $remotePath = $this->getWebDriverSession()->file(['file' => base64_encode(file_get_contents($tempFilename))]); + + // If no path is returned the file upload failed silently. + if (empty($remotePath)) { + throw new UnknownError(); + } + } + catch (\Exception $e) { + throw $e; + } + finally { + unlink($tempFilename); + } + + return $remotePath; + } + } diff --git a/web/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php b/web/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php new file mode 100644 index 0000000000000000000000000000000000000000..02fcc6ebaf6eb516364495ed3a20089eaeb2e1d9 --- /dev/null +++ b/web/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php @@ -0,0 +1,68 @@ +<?php + +namespace Drupal\FunctionalJavascriptTests\Tests; + +use Drupal\entity_test\Entity\EntityTest; +use Drupal\FunctionalJavascriptTests\WebDriverTestBase; +use Drupal\Tests\file\Functional\FileFieldCreationTrait; +use Drupal\Tests\TestFileCreationTrait; + +/** + * Tests the DrupalSelenium2Driver methods. + * + * @coversDefaultClass \Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver + * @group javascript + */ +class DrupalSelenium2DriverTest extends WebDriverTestBase { + + use TestFileCreationTrait; + use FileFieldCreationTrait; + + /** + * {@inheritdoc} + */ + protected static $modules = ['file', 'field_ui', 'entity_test']; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $storage_settings = ['cardinality' => 3]; + $this->createFileField('field_file', 'entity_test', 'entity_test', $storage_settings); + $this->drupalLogin($this->drupalCreateUser([ + 'administer entity_test content', + 'access content', + ])); + } + + /** + * Tests uploading remote files. + */ + public function testGetRemoteFilePath() { + $web_driver = $this->getSession()->getDriver(); + $file_system = \Drupal::service('file_system'); + $entity = EntityTest::create(); + $entity->save(); + + $files = array_slice($this->getTestFiles('text'), 0, 3); + $real_paths = []; + foreach ($files as $file) { + $real_paths[] = $file_system->realpath($file->uri); + } + $remote_paths = []; + foreach ($real_paths as $path) { + $remote_paths[] = $web_driver->uploadFileAndGetRemoteFilePath($path); + } + + // Tests that uploading multiple remote files works with remote path. + $this->drupalGet($entity->toUrl('edit-form')); + $multiple_field = $this->xpath('//input[@multiple]')[0]; + $multiple_field->setValue(implode("\n", $remote_paths)); + $this->assertSession()->assertWaitOnAjaxRequest(); + $this->getSession()->getPage()->findButton('Save')->click(); + $entity = EntityTest::load($entity->id()); + $this->assertCount(3, $entity->field_file); + } + +} diff --git a/web/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php b/web/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php index dde8a06a6ca4c5c4dc56fc53ab1893f8c2905f96..6b592346abcebca2d582996ff2f90af484961711 100644 --- a/web/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php @@ -110,13 +110,13 @@ public function testSettings() { $edit = [ 'fields[field_timestamp][settings_edit_form][settings][future_format]' => 'ends in @interval', 'fields[field_timestamp][settings_edit_form][settings][past_format]' => 'started @interval ago', - 'fields[field_timestamp][settings_edit_form][settings][granularity]' => 3, + 'fields[field_timestamp][settings_edit_form][settings][granularity]' => 1, ]; $this->drupalPostForm(NULL, $edit, 'Update'); $this->drupalPostForm(NULL, [], 'Save'); - $this->assertSession()->pageTextContains('ends in 1 year 1 month 1 week'); - $this->assertSession()->pageTextContains('started 1 year 1 month 1 week ago'); + $this->assertSession()->pageTextContains('ends in 1 year'); + $this->assertSession()->pageTextContains('started 1 year ago'); } } diff --git a/web/core/modules/simpletest/tests/src/Functional/FolderTest.php b/web/core/tests/Drupal/FunctionalTests/FolderTest.php similarity index 74% rename from web/core/modules/simpletest/tests/src/Functional/FolderTest.php rename to web/core/tests/Drupal/FunctionalTests/FolderTest.php index e57813fa71c3956efa44fc626d8640c4d48d6f54..d78cf5a1a7e702521ebf354bb8404b5ed80b25b4 100644 --- a/web/core/modules/simpletest/tests/src/Functional/FolderTest.php +++ b/web/core/tests/Drupal/FunctionalTests/FolderTest.php @@ -1,14 +1,15 @@ <?php -namespace Drupal\Tests\simpletest\Functional; +namespace Drupal\FunctionalTests; use Drupal\Tests\BrowserTestBase; /** - * This test will check SimpleTest's treatment of hook_install during setUp. + * This test will check BrowserTestBase's treatment of hook_install during + * setUp. * Image module is used for test. * - * @group simpletest + * @group browsertestbase */ class FolderTest extends BrowserTestBase { diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php new file mode 100644 index 0000000000000000000000000000000000000000..d18de97d566789ccf3e07fe943b318f357a5a381 --- /dev/null +++ b/web/core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php @@ -0,0 +1,38 @@ +<?php + +namespace Drupal\FunctionalTests\Installer; + +use Drupal\Tests\BrowserTestBase; + +/** + * Tests installing the Testing profile with update notifications on. + * + * @group Installer + */ +class TestingProfileInstallTest extends BrowserTestBase { + + /** + * {@inheritdoc} + */ + protected $profile = 'testing'; + + /** + * Ensure the Update module and its dependencies are installed. + */ + public function testUpdateModuleInstall() { + $this->assertTrue( + \Drupal::moduleHandler()->moduleExists('update') && \Drupal::moduleHandler()->moduleExists('file') && \Drupal::moduleHandler()->moduleExists('field'), + 'The Update module and its dependencies are installed.' + ); + } + + /** + * {@inheritdoc} + */ + protected function installParameters() { + $params = parent::installParameters(); + $params['forms']['install_configure_form']['enable_update_status_module'] = TRUE; + return $params; + } + +} diff --git a/web/core/modules/simpletest/tests/src/Functional/MailCaptureTest.php b/web/core/tests/Drupal/FunctionalTests/MailCaptureTest.php similarity index 98% rename from web/core/modules/simpletest/tests/src/Functional/MailCaptureTest.php rename to web/core/tests/Drupal/FunctionalTests/MailCaptureTest.php index 8cb0904bf9967bf400142a07c4708fb2c980548e..fdcc664f6f755a79b11562851297617874625ea0 100644 --- a/web/core/modules/simpletest/tests/src/Functional/MailCaptureTest.php +++ b/web/core/tests/Drupal/FunctionalTests/MailCaptureTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\simpletest\Functional; +namespace Drupal\FunctionalTests; use Drupal\Tests\BrowserTestBase; use Drupal\Core\Test\AssertMailTrait; @@ -9,7 +9,7 @@ * Tests the SimpleTest email capturing logic, the assertMail assertion and the * drupalGetMails function. * - * @group simpletest + * @group browsertestbase */ class MailCaptureTest extends BrowserTestBase { use AssertMailTrait { diff --git a/web/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php b/web/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php index f9fd6aaeae3526f2656901a74e9f4138e5b8570e..d14703f95969bb005944cf1ad126223336d6e027 100644 --- a/web/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php +++ b/web/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php @@ -319,9 +319,38 @@ protected function runUpdates() { } } } - // Reset the static cache of drupal_get_installed_schema_version() so that - // more complex update path testing works. - drupal_static_reset('drupal_get_installed_schema_version'); + + // Ensure that the container is updated if any modules are installed or + // uninstalled during the update. + /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */ + $module_handler = $this->container->get('module_handler'); + $config_module_list = $this->config('core.extension')->get('module'); + $module_handler_list = $module_handler->getModuleList(); + $modules_installed = FALSE; + // Modules that are in configuration but not the module handler have been + // installed. + foreach (array_keys(array_diff_key($config_module_list, $module_handler_list)) as $module) { + $module_handler->addModule($module, drupal_get_path('module', $module)); + $modules_installed = TRUE; + } + $modules_uninstalled = FALSE; + $module_handler_list = $module_handler->getModuleList(); + // Modules that are in the module handler but not configuration have been + // uninstalled. + foreach (array_keys(array_diff_key($module_handler_list, $config_module_list)) as $module) { + $modules_uninstalled = TRUE; + unset($module_handler_list[$module]); + } + if ($modules_installed || $modules_uninstalled) { + // Note that resetAll() does not reset the kernel module list so we + // have to do that manually. + $this->kernel->updateModules($module_handler_list, $module_handler_list); + } + + // If we have successfully clicked 'Apply pending updates' then we need to + // clear the caches in the update test runner as this has occurred as part + // of the updates. + $this->resetAll(); // The config schema can be incorrect while the update functions are being // executed. But once the update has been completed, it needs to be valid @@ -329,7 +358,6 @@ protected function runUpdates() { $names = $this->container->get('config.storage')->listAll(); /** @var \Drupal\Core\Config\TypedConfigManagerInterface $typed_config */ $typed_config = $this->container->get('config.typed'); - $typed_config->clearCachedDefinitions(); foreach ($names as $name) { $config = $this->config($name); $this->assertConfigSchema($typed_config, $name, $config->get()); diff --git a/web/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php b/web/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php index 45885dd086c3774e49e32d68b60fc6edee54fde3..cbf76a1133d56499019cf601612be96265a3ee06 100644 --- a/web/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php +++ b/web/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php @@ -32,6 +32,9 @@ protected function setDatabaseDumpFiles() { * Tests that the database was properly loaded. */ public function testDatabaseLoaded() { + // Set a value in the cache to prove caches are cleared. + \Drupal::service('cache.default')->set(__CLASS__, 'Test'); + foreach (['user', 'node', 'system', 'update_test_schema'] as $module) { $this->assertEqual(drupal_get_installed_schema_version($module), 8000, new FormattableMarkup('Module @module schema is 8000', ['@module' => $module])); } @@ -69,6 +72,8 @@ public function testDatabaseLoaded() { $this->assertEqual('on', $database->query("SHOW standard_conforming_strings")->fetchField()); $this->assertEqual('escape', $database->query("SHOW bytea_output")->fetchField()); } + // Ensure the test runners cache has been cleared. + $this->assertFalse(\Drupal::service('cache.default')->get(__CLASS__)); } /** @@ -95,4 +100,50 @@ public function testUpdateHookN() { $this->assertTrue(db_index_exists('update_test_schema_table', 'test'), 'Version 8001 of the update_test_schema module is installed.'); } + /** + * Tests that test running environment is updated when module list changes. + * + * @see update_test_schema_update_8003() + */ + public function testModuleListChange() { + // Set a value in the cache to prove caches are cleared. + \Drupal::service('cache.default')->set(__CLASS__, 'Test'); + + // Ensure that modules are installed and uninstalled as expected prior to + // running updates. + $extension_config = $this->config('core.extension')->get(); + $this->assertArrayHasKey('page_cache', $extension_config['module']); + $this->assertArrayNotHasKey('module_test', $extension_config['module']); + + $module_list = \Drupal::moduleHandler()->getModuleList(); + $this->assertArrayHasKey('page_cache', $module_list); + $this->assertArrayNotHasKey('module_test', $module_list); + + $namespaces = \Drupal::getContainer()->getParameter('container.namespaces'); + $this->assertArrayHasKey('Drupal\page_cache', $namespaces); + $this->assertArrayNotHasKey('Drupal\module_test', $namespaces); + + // Increment the schema version so that update_test_schema_update_8003() + // runs. + \Drupal::state()->set('update_test_schema_version', 8003); + $this->runUpdates(); + + // Ensure that test running environment has been updated with the changes to + // the module list. + $extension_config = $this->config('core.extension')->get(); + $this->assertArrayNotHasKey('page_cache', $extension_config['module']); + $this->assertArrayHasKey('module_test', $extension_config['module']); + + $module_list = \Drupal::moduleHandler()->getModuleList(); + $this->assertArrayNotHasKey('page_cache', $module_list); + $this->assertArrayHasKey('module_test', $module_list); + + $namespaces = \Drupal::getContainer()->getParameter('container.namespaces'); + $this->assertArrayNotHasKey('Drupal\page_cache', $namespaces); + $this->assertArrayHasKey('Drupal\module_test', $namespaces); + + // Ensure the test runners cache has been cleared. + $this->assertFalse(\Drupal::service('cache.default')->get(__CLASS__)); + } + } diff --git a/web/core/modules/simpletest/tests/src/Functional/UserHelpersTest.php b/web/core/tests/Drupal/FunctionalTests/UserHelpersTest.php similarity index 96% rename from web/core/modules/simpletest/tests/src/Functional/UserHelpersTest.php rename to web/core/tests/Drupal/FunctionalTests/UserHelpersTest.php index 53ea3079f86c543a2c757aa38759a436e952c80f..074f11e3f19b0609ae6f0cea478b6ffe0fcc41b0 100644 --- a/web/core/modules/simpletest/tests/src/Functional/UserHelpersTest.php +++ b/web/core/tests/Drupal/FunctionalTests/UserHelpersTest.php @@ -1,13 +1,13 @@ <?php -namespace Drupal\Tests\simpletest\Functional; +namespace Drupal\FunctionalTests; use Drupal\Tests\BrowserTestBase; /** * Tests User related helper methods of WebTestBase. * - * @group simpletest + * @group browsertestbase */ class UserHelpersTest extends BrowserTestBase { diff --git a/web/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php b/web/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ccabd268e0c63a1a402b62219640a736d84d74ed --- /dev/null +++ b/web/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php @@ -0,0 +1,109 @@ +<?php + +namespace Drupal\KernelTests\Core\Datetime; + +use Drupal\Core\Datetime\DrupalDateTime; +use Drupal\Core\Form\FormInterface; +use Drupal\Core\Form\FormStateInterface; +use Drupal\KernelTests\KernelTestBase; + +/** + * Tests DatetimeElement functionality. + * + * @group Form + */ +class DatetimeElementFormTest extends KernelTestBase implements FormInterface { + + /** + * The variable under test. + */ + protected $flag; + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['datetime', 'system']; + + /** + * Sets up the test. + */ + protected function setUp() { + parent::setUp(); + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'test_datetime_element'; + } + + /** + * {@inheritdoc} + */ + public function datetimecallback($date) { + $this->flag = 'Date time callback called.'; + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state) { + + $form['datetime_element'] = [ + '#title' => 'datelist test', + '#type' => 'datetime', + '#default_value' => new DrupalDateTime('2000-01-01 00:00:00'), + '#date_date_format' => ['Y-m-d'], + '#date_time_format' => ['H:i:s'], + '#date_date_element' => 'HTML Date', + '#date_time_element' => 'HTML Time', + '#date_increment' => 1, + '#date_date_callbacks' => [[$this, 'datetimecallback']], + ]; + + // Element without specifying the default value. + $form['simple_datetime_element'] = [ + '#type' => 'datetime', + '#date_date_format' => ['Y-m-d'], + '#date_time_format' => ['H:i:s'], + '#date_date_element' => 'HTML Date', + '#date_time_element' => 'HTML Time', + ]; + + $form['submit'] = [ + '#type' => 'submit', + '#value' => t('Submit'), + ]; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) {} + + /** + * Form validation handler. + * + * @param array $form + * An associative array containing the structure of the form. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The current state of the form. + */ + public function validateForm(array &$form, FormStateInterface $form_state) {} + + /** + * Tests that default handlers are added even if custom are specified. + */ + public function testDatetimeElement() { + $form = \Drupal::formBuilder()->getForm($this); + $this->render($form); + + $this->assertEqual(t('Date time callback called.'), $this->flag); + } + +} diff --git a/web/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php b/web/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php index 467d9262e169e71e66dc47ce0f5d29b57bc9691d..4d6d4b721c4bbee73fcfc008647b7de127ae2d0f 100644 --- a/web/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php +++ b/web/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php @@ -147,6 +147,10 @@ public function testFileDestination() { $this->assertNotEqual($path, $destination, 'A new filepath destination is created when filepath destination already exists with FILE_EXISTS_RENAME.', 'File'); $path = file_destination($destination, FILE_EXISTS_ERROR); $this->assertEqual($path, FALSE, 'An error is returned when filepath destination already exists with FILE_EXISTS_ERROR.', 'File'); + + // Invalid UTF-8 causes an exception. + $this->setExpectedException(\RuntimeException::class, "Invalid filename 'a\xFFtest\x80€.txt'"); + file_destination("core/misc/a\xFFtest\x80€.txt", FILE_EXISTS_REPLACE); } /** diff --git a/web/core/tests/Drupal/KernelTests/Core/File/FileCreateFilenameTest.php b/web/core/tests/Drupal/KernelTests/Core/File/FileCreateFilenameTest.php new file mode 100644 index 0000000000000000000000000000000000000000..bb11d074443c98b73eb947876a78d444fbdd1044 --- /dev/null +++ b/web/core/tests/Drupal/KernelTests/Core/File/FileCreateFilenameTest.php @@ -0,0 +1,21 @@ +<?php + +namespace Drupal\KernelTests\Core\File; + +/** + * Tests file_create_filename(). + * + * @group File + */ +class FileCreateFilenameTest extends FileTestBase { + + /** + * Tests that invalid UTF-8 does not break file_create_filename(). + */ + public function testInvalidUTF8() { + $filename = "a\xFFsdf\x80€" . '.txt'; + $this->setExpectedException(\RuntimeException::class, "Invalid filename '$filename'"); + file_create_filename($filename, $this->siteDirectory); + } + +} diff --git a/web/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php b/web/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php index c95b0545b940cbaaf265718e31faba0965901c39..6ff2f463045d794a95fd87a673205486cc4f5e3f 100644 --- a/web/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php +++ b/web/core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php @@ -163,12 +163,19 @@ public function testCacheFilename() { $expected = strlen($prefix) + 2 + 2 * TwigPhpStorageCache::SUFFIX_SUBSTRING_LENGTH; $this->assertEquals($expected, strlen($key)); - $original_filename = $environment->getCacheFilename('core/modules/system/templates/container.html.twig'); + $template_filename = 'core/modules/system/templates/container.html.twig'; + $cache = $environment->getCache(); + $class = $environment->getTemplateClass($template_filename); + $original_filename = $cache->generateKey($template_filename, $class); + \Drupal::getContainer()->set('twig', NULL); \Drupal::service('module_installer')->install(['twig_extension_test']); $environment = \Drupal::service('twig'); - $new_extension_filename = $environment->getCacheFilename('core/modules/system/templates/container.html.twig'); + $cache = $environment->getCache(); + $class = $environment->getTemplateClass($template_filename); + $new_extension_filename = $cache->generateKey($template_filename, $class); + \Drupal::getContainer()->set('twig', NULL); $this->assertNotEqual($new_extension_filename, $original_filename); diff --git a/web/core/tests/Drupal/KernelTests/Core/Validation/UniqueFieldConstraintTest.php b/web/core/tests/Drupal/KernelTests/Core/Validation/UniqueFieldConstraintTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3fbdf4e1414356b11af1a70dedae18ec7dff82db --- /dev/null +++ b/web/core/tests/Drupal/KernelTests/Core/Validation/UniqueFieldConstraintTest.php @@ -0,0 +1,115 @@ +<?php + +namespace Drupal\KernelTests\Core\Validation; + +use Drupal\Component\Render\FormattableMarkup; +use Drupal\entity_test\Entity\EntityTestStringId; +use Drupal\KernelTests\KernelTestBase; + +/** + * Tests the unique field value validation constraint. + * + * @coversDefaultClass \Drupal\Core\Validation\Plugin\Validation\Constraint\UniqueFieldValueValidator + * + * @group Validation + */ +class UniqueFieldConstraintTest extends KernelTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'entity_test', + 'unique_field_constraint_test', + 'user', + ]; + + /** + * Tests cases where the validation passes for entities with string IDs. + * + * @covers ::validate + */ + public function testEntityWithStringId() { + $this->installEntitySchema('entity_test_string_id'); + + EntityTestStringId::create([ + 'id' => 'foo', + 'name' => $this->randomString(), + ])->save(); + + // Reload the entity. + $entity = EntityTestStringId::load('foo'); + + // Check that an existing entity validates when the value is preserved. + $violations = $entity->name->validate(); + $this->assertCount(0, $violations); + + // Create a new entity with a different ID and a different field value. + EntityTestStringId::create([ + 'id' => 'bar', + 'name' => $this->randomString(), + ]); + + // Check that a new entity with a different field value validates. + $violations = $entity->name->validate(); + $this->assertCount(0, $violations); + } + + /** + * Tests cases when validation raises violations for entities with string IDs. + * + * @param string|int|null $id + * The entity ID. + * + * @covers ::validate + * + * @dataProvider providerTestEntityWithStringIdWithViolation + */ + public function testEntityWithStringIdWithViolation($id) { + $this->installEntitySchema('entity_test_string_id'); + + $value = $this->randomString(); + + EntityTestStringId::create([ + 'id' => 'first_entity', + 'name' => $value, + ])->save(); + + $entity = EntityTestStringId::create([ + 'id' => $id, + 'name' => $value, + ]); + /** @var \Symfony\Component\Validator\ConstraintViolationList $violations */ + $violations = $entity->get('name')->validate(); + + $message = new FormattableMarkup('A @entity_type with @field_name %value already exists.', [ + '%value' => $value, + '@entity_type' => $entity->getEntityType()->getLowercaseLabel(), + '@field_name' => 'name', + ]); + + // Check that the validation has created the appropriate violation. + $this->assertCount(1, $violations); + $this->assertEquals($message, $violations[0]->getMessage()); + } + + /** + * Data provider for ::testEntityWithStringIdWithViolation(). + * + * @return array + * An array of test cases. + * + * @see self::testEntityWithStringIdWithViolation() + */ + public function providerTestEntityWithStringIdWithViolation() { + return [ + 'without an id' => [NULL], + 'zero as integer' => [0], + 'zero as string' => ["0"], + 'non-zero as integer' => [mt_rand(1, 127)], + 'non-zero as string' => [(string) mt_rand(1, 127)], + 'alphanumeric' => [$this->randomMachineName()], + ]; + } + +}